Osborne_An_Introduction_to_Microcomputers_Volume_2_Sep78 Osborne An Introduction To Microcomputers Volume 2 Sep78

Osborne_An_Introduction_to_Microcomputers_Volume_2_Sep78 Osborne_An_Introduction_to_Microcomputers_Volume_2_Sep78

User Manual: Osborne_An_Introduction_to_Microcomputers_Volume_2_Sep78

Open the PDF directly: View PDF PDF.
Page Count: 1470

DownloadOsborne_An_Introduction_to_Microcomputers_Volume_2_Sep78 Osborne An Introduction To Microcomputers Volume 2 Sep78
Open PDF In BrowserView PDF
ow
~
a:
oa.

a:
o
o
~

en

w

~

g

AN INTRODUCTION
TO MICROCOMPUTERS
VOLUME 2

U)
U)

c:(

o/S

w

z
a:
o

SOME REAL MICROPROCESSORS

CD

U)

o

~

c:(

o

c:(

@

By Adam Osborne
With Jerry Kane

.

Osborne &. Associates, Inc.
Berkeley, California

Library of Congress Catalogue Card Number" 76-374891
ISBN 0-931988-15-2

Copyright © 1975, 1976, 1977, 1978 by Adam Osborne and Associates, Incorporated

All rights reserved. Printed in the United States of America. No part of this publication may be reproduced,
stored in a retrieval system, or transmitted in any form, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the publishers. Original bound volume of
AN INTRODUCTION TO MICROCOMPUTERS series published in 1975.

iv

Q

w

!iII:
oa..

II:

o
o

~

enw
!i

oo

Published By
Adam Osborne & Associates, Inc.
P.O. Box 2036
Berkeley, California, U.S.A. 94702

en
en
c(

011
w
Z

II:

o

!Xl

en

o

~

c(
Q
c(

@

DISTRIBUTORS OF OSBORNE & ASSOCIATES, INC. PUBLICATIONS
For information on translations and on book distributors outside of the United States of America,
please call or write:
Osborne & Associates, Inc.
P.O. Box 2036
Berkeley, California 94702
United States of America
(415) 548-2805
TVVX 910-366-7277

v

vi

CONTRIBUTING AUTHORS
The following persons have contributed in the writing of sections of this book in addition to its principal
authors:

cw

~
a:
o0.

a:

Susanna Jacobson
Osborne & Associates, Inc.
Curt Ingraham
Osborne & Associates, Inc.

o
CJ
!!:

en
w

~
(3
o
en
en

«
~

w

Z

a:

o

Dl

en

o

~

«
«

c

@

vii

viii

TABLE OF CONTENTS
CHAPTER
Q

w

~

~

a:

0

Q.

a:
0

CJ

~

en
w
~

~

U
0

CI)
CI)

~

2

oil

w

z

a:
0

In
CI)

0
~

~
Q

~

@

3

PAGE
4-Bit Microprocessors and the TMS1000 Series Microcomputers

1-1

TMS1000 Programmable Registers
TMS1000 Memory Addressing Mode
TMS1000 Status Flags
TMS1000 Input and Output Logic
TMS1000 Series Microcomputer Pins and Signals
TMS 1000 Series Microcomputer Instruction Execution
TMS 1000 Series Microcomputer Instruction Set
The Benchmark Program
Data Sheets

1-3
1-5
1-5
1-5
1-6
1-10
1-10
1-10
1-01

The Mostek 3870 (and Fairchild F8)

2-1

The 3870 One-Chip Microcomputer
3870/F8 Programmable Registers
3870 Memory Addressing Modes
3870/F8 Status Flags
3870 Pins and Signals
3870 Instruction Timing and Execution
3870 I/O Ports
3870 Interrupt Logic
Timer/Counter Logic
The 3870 Control Code
The 3870/F8 Instruction Set
The 3870 Benchmark Program
The 3850 CPU
F8 Programmable Registers and Status Flags
F8 Addressing Modes
F8 Clock Circuits
F8 CPU Pins and Signals
F8 Timing and Instruction Execution
F8 I/O Ports
A Summary of F8 Interrupt Processing
The F8 Instruction Set
The Benchmark Program
The 3851 Program Storage Unit (PSU)
The 3851 PSU Read-Only Memory
3851 PSU Input/Output Logic
3851 PSU Interrupt Logic
3851 PSU Programmable Timer Logic
3851 PSU Data Transfer Timing
Using the 3851 PSU in Non-F8 Configurations
The 3861 and 3871 Parallel I/O (PIO) Devices
The 3856 and 3857 16K Programmable Storage Units (16K PSU)
Additional F8 Support Devices
The 3852 Dynamic Memory Interface (DMil
The 3854 Direct Memory Access (DMA) Device
The 3853 Static Memory Interface (SMil
Data Sheets

2-3
2-5
2-6
2-9
2-9
2-11
2-11
2-13
2-15
2-17
2-19
2-26
2-29
2-31
2-31
2-32
2-34
2-35
2-37
2-37
2-37
2-38
2-39
2-40
2-41
2-42
2-45
2-45
2-45
2-47
2-47
2-49
2-49
2-53
2-54
2-01
3-1

The National Semiconductor SC/MP
SCiMP Programmable Registers
Addressing Modes
SC/MP Status Register
SC/MP CPU Signals and Pin Assignments

ix

3-3
3-4
3-5
3-5

TABLE OF CONTENTS (Continued)
CHAPTER
3 (Cont.)

4

SC/MP Timing and Instruction Execution
SC/MP Bus ..;\ccess Logic
SCiMP Input/Output Operations
The SC/MP Halt State
SC/MP Interrupt Processing
SC/MP DMA and Multiprocessor Operations
The SC/MP Reset Operation
SCiMP Serial Input/Output Operations
The SC/MP Instruction Set
The Benchmark Program
Support Devices for the SC/MP CPU
Using Other Microcomputer Support Devices with the SC/MP CPU
Data Sheets

PAGE
. 3-7
3-8
3-10
3-13
3-14
3-17
3-21
3-21
3-22
3-28
3-29
3-31
3-01

The8080A

4-1

The SOSOA CPU
SOSOA Programmable Registers
SOSOA Addressing Modes
SOSOA Status
8080A CPU Pins and Signals
SOSOA Timing and Instruction Execution
Clock Signals
Instruction Fetch Sequence
A Memory Read or Write Operation
Separate Stack Memory Modules
The Wait State
The Wait. Hold and Halt States
The Hold State
The Halt State and Instruction
The Reset Operation
External Interrupts
External Interrupts During the Halt State
Wait and Hold Conditions Following an Interrupt
The S080A Instruction Set
.
The Benchmark Program
Instruction Execution Times and Codes
Support Devices that may be Used with the SOSOA
The 8224 Clock Generator and Driver
The 8224 Clock Generator Pins and Signals
The 8228 and 8238 System Controller and Bus Driver
Bus Driver Logic
Control Signal Logic
8228 System Controller Pins and Signals
The 8259 Priority Interrupt Control Unit (PICU)
8259 PICU Pins and Signals
The 8259 PICU Interrupt Acknowledge Vector
8259 PICU Priority Arbitration Options
How Interrupt Requests and Priority Status are'Recorded
Programming the 8259 PICU
The TMS 5501 Multifunction Input/Output Controller
TMS 5501 Device Pins and Signals
TMS 5501 Device Access
TMS 5501 Interrupt Handling
TMS 5501 Parallel I/O Operations
TMS 5501 Serial I/O Operation
TMS 5501 Interval Timers
Data Sheets

4-3
4-3
4-4
4-5
4-6
4-7
4-8
4-12
4-12
4-12
4-13
4-16
4-17
4-19
4-19
4-21
4-24
4-24
4-24
4-25
4-33
4-46
4-46
4-46
4-48
4-48
4-49
4-49
4-52
4-52
4-54
4-57
4-60
4-62
4-67
4-67,
4-70'
4-74
4-75
4-75
4-76
4-01

x

TABLE OF CONTENTS (Continued)
CHAPTER

5

o
~
a:
o
D.
w

a:

o

u

~

en

w

I-

-t

g
CI)
CI)

-t
CI/I
w
Z

a:

o

aI

CI)

o

:E
-t
o
-t

@

6

PAGE

The 8085

5-1

The 8085A CPU
8085A Programmable Registers
8085A Addressing Modes
8085A Status
8085A CPU Pins and Signals
A Comparison of 8085A and 8080A Signals
8085A Timing and Instruction Execution·
The Clock Signals
Memqry Access Sequences
Bus Idle Machine Cycles
The Wait State
The SID and SOD Signals
The Hold State
The Halt State and Instruction
External Interrupts
The Reset Operation
The 8085A Instruction Set
8085A Microprocessor Support Devices
The 8155/815.6 Static Read/Write Memory with 1/0 Ports and Timer
8155/8156 Device Pins and Signals
8155/8156 ParaliellnputlOutput
8155/8156 Device Addressing
The 8155/8156 CounterlTimer
8155/8156 Control and Status Registers
8155/8156 Device Programming
The 8355 Read-Only Memory with I/O
8355 Device Pins and Signals
8355 Ready Logic
8355110 Logic
The 8755A Erasable Programmable Read-Only Memory with 1/0
Data Sheets

5-2
5-3
5-3
5-3
5-3
5-7
5-7
5-8
5-9
5-18
5-20
5-21
5-24
5-26
5-28
5-32
5-34
5-35
5-35
5-35
5-38
5-39
5-41
5-43
5-43
5-45
5-45
5-49
5-50
5-51
5-D1

The 8048 Microcomputer Devices

6-1

The 8048. 8748. 8049.8749 and 8035 Microcomputers
An 8048 and 8049 Functional Overview
8048. 8748. and 8035 Microcomputer Programmable Registers
8048 Series Addressing Modes
A Program Memory Map
8048 Series Status
8048 Series Microcomputer Operating Modes
8048 Series Microcomputer Pins and Signals
8048 Series Timing and Instruction Execution
Internal Execution Mode
External Memory Access Mode
Debug Mode
Single Stepping
Programming Mode
Verification Mode
InputlOutput Programming
Hold State
CounterlTimer Operations
Internal and External Interrupts

6-2
6-3
6-7
6-8
6-12
6-13
6-14
6-15
6-18
6-18
6-20
6-23
6-23
6-24
6-26

xi

6-26
6-26
6-27
6-27

TABLE OF CONTENTS (Continued)
CHAPTER
6 (Cont.)

7

The 8048 Microcomputer Series Instruction Set
The Benchmark Progra~
The 8041 Slave Microcomputer
An 8041 Functional Overview
8041 Data Bus Logic
8041 I/O Ports One and Two
8041 and 8741 Programmable Registers
8041 and 8741 Addressing Modes
8041 and 8741 Status
8041 and 8741 Slave Microcomputer Operating Modes
8041 and 8741 Pins and Signals .
8041 Series Timing and Instruction Execution
8741 Single Stepping and Programming Mode
8041 Input/Output Programming
8041 CounterlTimer Operations
8041 Interrupt Logic
Programming 8048-8041 Data Transfers
The 8041/8741 Instruction Set
The 8021 Single-Chip Microcomputer
An 8021 Fu nctional Overview
8021 I/O Port Pins
The T1 Pin
The 8021 Reset Input
The 8021 Clock Inputs
The 8021 Timer/Counter
8021 Scratchpad Memory and Programming
The 8243 Input/Output Expander
8243 Input/Output Expander Pins and Signals
8243 Input/Output Expander Operations
Data Sheets

PAGE
6-32
6-32
6-41
6-42
6-43
6-44
6-44
6-44
6-45
6-45
6-45
6-46
6-46
6-46
6-47
6-47
6-47
6-49
6-51
6-51
6-51
6-51
6-52
6-53
6-53
6-53
6-53
6-53
6-55
6-01

ZilogZ80

7-1

The Z80 CPU
A Summary of Z80/8080A Differences
Z80 Programmable Registers
Z80 Addressing Modes
Z80 Status
Z80 CPU Pins and Signals
Z80-8080A Signal Compatibility
Z80 Timing and Instruction Execution
Instruction Fetch Execution Sequences
A Memory Read Operation
Memory Write Operation
The Wait State
Input or Output Generation
Bus Requests
External Interrupts
The Halt Instruction
The Z80 Instruction Set
Input/Output Instructions
Primary Memory Reference Instructions
Block Transfer and Search Instructions
Secondary Memory Reference (Memory Operate) Instructions
Immediate Instructions
Jump Instructions

7-1
7-1
7-5
7-6
7-7
7-7
7-9
7-11
7-12
7-13
7-13
7-14
7-14
7-15
7-16
7-19
7-38
7-38
7-39
7-39
7-41
7-41
7-41

xii

TABLE OF CONTENTS (Continued)
CHAPTER
7 (Cont.)
Q

w
oct

I-

a:

0

a..

a:
0

CJ

~

en
w
I-

oct

g
CI)
CI)

oct
all

w

Z

a:
0

a:I
CI)

0

:!:

oct
Q
oct

@

9

Subroutine Call and Return Instructions
Immediate Operate Instructions
Jump-on-Condition Instructions
Register-Register Move Instructions
Register-Register Operate Instructions
Register Operate Instructions
Bit Manipulation Instructions
Stack Instructions
I nterrupt Instructions
Status and Miscellaneous Instructions
The Benchmark Program
Support Devices that may be Used with the Z80
The Z80 Parallel 110 Interface (PIO)
Z80 PIO Pins and Signals
Z80 PIO Operating Modes
Z80 PIO Interrupt Servicing
Programming the Z80 PIO
The Z80 Clock Timer Circuit (CTC)
Z80 CTC Functional Organization
Z80 CTC Pins and Signals
Z80 CTC Operating Modes
Z80 CTC Interrupt Logic
Programming the Z80 CTC
Data Sheets

PAGE
7-41
7-41
7-41
7-42
7-42
7-42
7-42
7-43
7-43
7-44
7-44
7-44
7-45
7-46
7-49
7-51
7-52
7-54
7-54
7-55
7-57
7-60
7-60
7-01

The Motorola MC6800

9-1

The MC6800 CPU
The MC6800 Programmable Registers
MC6800 Memory Addressing Modes
MC6800 Status Flags
MC6800 CPU Pins and Signals
MC6800 Timing and Instruction Execution
The Hold State. the Halt State and Direct Memory Access
Interrupt Processing. Reset and the Wait State
The MC6800 Instruction Set
The Benchmark Program
MC6800 Summary of Cycle by Cycle Operation
Support Devices that may be Used with the MC6800
The MC6802 CPU with Read/Write Memory
The MC6870 Two Phase Clocks
The MC6870A Clock Device
The MC6871A Clock Device
The MC6871 B Clock Device
The MC6875 Clock Device
Some Standard Clock Signal Interface Logic
The MC6820 and MCS6520 Peripheral Interface Adapter (PIA)
The MC6820 PIA Pins and Signals
MC6820 Operations
The MC6850 Asynchronous Communications Interface Adapter (ACIA)
The MC6850 ACIA Pins and Signals
MC6850 Data Transfer and Control Operations
MC6850 ACIA Control Codes and Status Flags
The MC6852 Synchronous Serial Data Adapter (SSDA)
MC6852 SSDA Pins and Signals
MC6852 Data Transfer and Control Operations
MC6852 Status Register

9-3
9-3
9-3
9-5
9-6
9-7
9-10
9-12
9-16
9-17
9-25
9-31
9-33
9-39
9-41
9-41
9-43
9-44
9-44
9-45
9-45
9-48
9-55
9-55
9-57
9-59
9-61
9-61
9-63
9-65

xiii

TABLE OF CONTENTS (Continued)
CHAPTER
9 (Cant.)

10

The MC6852 Control Registers
Programming the MC6852
The MC8507 (or MC6828) Priority Interrupt Controller (PIC)
MC6828 Pins and Signals
The Interrupt Acknowledge Process
Interru pt Priorities
Interrupt Inhibit Logic
The MC6840 Programmable CounterlTimer
The MC6840 CounterlTimer Pins and Signals
MC6840 Addressing
MC6840 CounterfTimer Programmable Options
The MC6844 Direct Memory Access Controller
MC6844 DMA Controller Pins and Signals
MC6844 Addressable Registers
MC6844 DMA Transfer Modes
MC6844 DMAC Three7State Control. Cycle Stealing Mode
MC6844 DMAC Halt Modes
Comparing MC6844 DMAC Modes
Using an MC6844 DMAC with Mixed Modes
The MC6844 Control Registers and Operating Options
Resetting the MC6844 DMAC
Programming the MC6844 DMAC
The MC6846 Multifunction Support Device
MC6846 Multifunction Device Pins and Signals
MC6846 CounterfTimer Logic
MC6846 I/O Port Logic
MC6846 Device Reset
Data Sheets

PAGE
9-66
9-70
9-71

9-72
9-74
9-75
9-77
9-78
9-78
9-82
9-94
9-106
9-107
9-109
9-110
9-111
9-113
9-116
9-116
9-116
9-122
9-122
9-124
9-124
9-127
9-128
9-129
9-D1

The MOS Technology MCS6500

10-1

The MCS6500 Series CPUs
MCS6500 Series CPU Programmable Registers
MCS6500 Memory Addressing Modes
MCS6500 Status Flags
MCS6500 CPU Pins and Signals
MCS6500 Timing and Instruction Execution
Interrupt Processing and System Reset
MCS6500 CPU Clock Logic
MCS6500 CPU Interface Logic
The MCS6500 Instruction Set
The Benchmark Program
Support Devices that may be Used with the MCS6500 Series Microprocessors
The MCS6522 Peripheral Interface Adapter
MCS6522 PIA Pins and Signals
MCS6522 Parallel Data Transfer Operations
MCS6522 Interval Timer Logic
MCS6522 Shifter Logic
MCS6522 Interrupt Logic
The MCS6530 Multifunction Support Logic Device
MCS6530 Multifunction Device Pins and Signals
MCS6530 Parallel Data Transfer Operations
MCS6530 Interval Timer and Interrupt Logic
The MCS6532 Multifunction Support Logic Device
MCS6532 Multifunction Device Pins and Signals
MCS6532 Logic Functions
Data Sheets

10-2
10-3
10-4
10-6
10-7
10-13
10-15
10-15
10-15
10-16
10-16
10-27
10-29
10-30
10-33
10-36
10-42
10-46
10-47
10-47
10-51
10-51
10-53
10-54
10-55
10-D1

xiv

TABLE OF CONTENTS (Continued)
CHAPTER
11

PAGE
. 11-1·

The signetics 2650A
The 2650A CPU Logic
2650A Programmable Registers
The 2650A Memory Addressing Modes
The 2650A Status Flags
The 2650A CPU Pins and Signals
Interfacing Memory to the 2650A MicrocompLiter
Interfacing I/O Devices to the 2650A Microcomputer
The 2650A Microcomputer Instruction Process
2650A Microcomputer Direct Memory Access
The 2650A Microcomputer Instruction Set
The 2650A Benchmark Program
Support Devices that may be Used with the 2650A Microprocessor
Data Sheets
.

Q

w

~

a:
oa.
a:

o

u

~

enw
l-

e{

(;

oCI)
CI)

11-1
11-3
11-4
11-8
11-10
11-12
11-12
11-12
11-14
11-14
11-15
11-23
11-D1

e{
~

12

w
Z

a:

oa:a

CI)

o

~

e{

o

e{

@

1'3

The RCA COS MAC

12-1

The COSMAC CPU
COS MAC Programmable Registers
COSMAC Memory Addressing Modes
COSMAC Status Flags
COS MAC CPU Pins and Signals
COSMAC Timing and Instruction Execution,
COSMAC Memory Read Timing
COSMAC Memory Write Instruction Timing
COS MAC Data Input Data Output and Direct Memory Access
A Summary of COSMAC Interrupt Processing
The COSMAC Instruction Set
The Benchmark Program
Using COSMAC with Other Microprocessor Support Devices
The CDP1852 Parallel I/O Port
CDP1852 Pins and Signals
CDP 1852 Operations Overview
CDP1852 Input Operations
CDP1852 Output Operations
.
Data Sheets

12-2
12-2
12-4
12-5
12-5
12-8
12-11
12-11
12-12
12-17
12-17
12-23
12-32
12-33
12-33
12-33
12-34
12-37
12-D1

IM6100 Microcomputer Devices

13-1

The IM6100 CPU
IM6100 Programmable Registers
IM6100 Memory Space
IM6100 Memory Addressing Modes
IM61 00 Status Flags
IM6100 CPU Pins and Signals
IM61 00 Timing and Instruction Execution
IM6100 No Operation Machine Cycle
IM6100 Data Input Machine Cycle
IM6100 Data Output Machine Cycle
IM6100 Address Demultiplexing
IM61 00 Memory Read Machine CycleTimirig
IM6100 Memory Write Machine Cycle
IM6100 Input/Output Timing
IM61 00 Wait State
IM6100 Hold and Halt Conditions
IM6100 Direct Memory Access

13-2
13-3
13-3
13-3
13-6
13-6
13-9
13-10
13-10
13-10
13-11
13-13
13-14
13-18
13-22
13-23
13-26

xv.

TABLE OF CONTENTS (Continued)
CHAPTER
13 (Cont.)

14

15

The IM6100 Reset
IM61 00 Interrupt Logic
IM6100 Control Panel Logic
External Control Signal Priorities
IM6100 Instruction Set
The IM6100 Benchmark Program.
Some SpeciallM6100 Hardware Considerations
Implementing a Hardware Stack
Support Devices that may be Used with the IM61 00
The IM6101 Parallel Interface Element (PIE)
IM6101 Parallel Interface Element Pins and Signals
IM6101 Functional Logic
IM6101 Interrupt Handling Logic
The IM6102 MEDIC
IM6102 MEDIC Pins and Signals
The IM6100-IM61021nterface
IM6102 Extended Memory Control
IM61 02 Extended Memory Programming Considerations
IM6102 Extended Memory Interrupt Considerations
IM6102 Dynamic Memory Refresh and Direct Memory Access Logic
IM61 02 Programmable Real-Time Clock Logic
IM61 02 MEDIC Instructions
Data Sheets

PAGE
13-29
13-29
13-33
13-37
13-37
13-38
13-47
13-47
13-51
13-53
13-55
13-56
13-62
13-64
13-65
13-69
13-69
13-77
13-78
13-79
13-83
13-85
13-D1

The 8X300 (or SMS300)

14-1

The 8X300 Microcontroller
8X300 Addressable Registers
8X300 Status Flags
8X300 Memory Addressing
8X300 Pins and Signals
8X300 Instruction Execution and Timing
The 8X300 Instruction Set
The 8X300 Benchmark Program
The 8T32. 8T33. 8T35. and 8T36 Interface Vector Byte (IV Byte)
8T32/3/5/6 IV Byte Pins and Signals
8T32/3/5/6 IV Byte Operation
8T32/3/5/6 IV Byte Addresses
The 8T39 and 8T58 Bus Expanders
Data Sheets

14-1
14-3
14-4
14-4
14-5
14-6
14-9
14-17
14-21
14-21
14-23·
14-24
14-26
14-D1

The National Semiconductor PACE and INS8900

15-1

PACE and INS8900 Microcomputer System Overviews
INS8900 Programmable Registers
INS8900 Stack
INS8900 and PACE Addressing Modes
INS8900 and PACE Status and Control Flags
INS8900 and PACE CPU Pins and Signals
INS8900 and PACE Timing and Instruction Execution
The Initialization Operation
The Halt State and Processor Stall Operations
Direct Memory Access Operations
The INS8900 and PACE Interrupt System
The INS8900 and PACE Instruction Set
The Benchmark Program
The PACE DP8302 System Timing Element (STE)

15-2
15-4
15-5
15-6
15-9
15-10
15-11
15-14
15-14
15-15
15-19
15-24
15-33
15-35

xvi

TABLE OF CONTENTS (Continued)
CHAPTER
15 (Cont.)
0

w

The PACE Bidirectional Transceiver Element (BTE)
Using Other Microcomputer Support Devices with the PACE and INS8900
Data Sheets

PAGE
15-36
15-38
15-01

The General Instrument CP1600

16-1

The CP1600 Microcomputer System Overview
CP1600 Programmable Registers
CP1600 Memory Addressing Mode
CP1600 Status and Control Flags
CP1600 CPU Pins and Signals
CP1600 Instruction Timing and Execution
CP1600 Memory Access Timing
The CP 1600 Wait State
The CP1600 Halt State
CP 1600 Initialization Sequence
CP1600 DMA Logic
The CP1600 Interrupt Logic
The CP1600 Instruction Set
The Benchmark Program
Support Devices that may be Used with the CP1600
The CP1680 Input/Output Buffer (lOB)
CP1680 lOB Pins and Signals
CP16BO Addressable Registers
The CP1680 Control Register
CP1680 Data Transfer Operations
The CP1680 Interval Timer
CP1680 Interrupt Logic
Data Sheets

16-1
16-3
16-3
16-6
16-6
16-10
16-10
16-12
16-12
16-13
16-13
16-15
16-16
16-25
16-27
16-30
16-30
16-31
16-32
16-33
16-36
16-37
16-01

The General Instrument 1650 Series Microcomputers

17-1

A 1650 Functional Overview
1650 Series Microcomputer Programmable Registers
1650 Series Microcomputer Memory Addressing Modes
1650 Series Microcomputer Pins and Signals
1650 Series Microcomputer Instruction Set
The 1650 Benchmark Program
Data Sheets

17-1
17-4
17-6
17-6
17-8
17-9
17-01

le:(

a:

16

0

a..

a:
0

0

~

u)

w

l-

e:(

(;
0
(I)
(I)

e:(

G/.I

w

za:

0

III
(I)

0
~

e:(

0

e:(

@

17

18

The Texas Instruments TMS 9900. TMS 9980, and TMS 9440 Products

18-1

The TMS 9900 Microprocessor
A TMS 9900 Functional Overview
TMS 9900 Programmable Registers
TMS 9900 Memory Addressing Modes
TMS 9900 I/O Addressing
TMS 9900 CPU Pins and Signals
TMS 9900 Timing and Instruction Execution
Memory Access Operations
Memory Select Logic
TMS 9900 I/O Instruction Timing
The Wait State
The Hold State
The Halt Stelte
TMS 9900 Interrupt Processing Logic
The TMS 9900 Reset
The TMS 9900 Load Operation

18-2
18-2
18-3
18-6
18-8
18-13
18~ 15
18-15
18-19
18-20
18-23
18-25
18-25
18-26
18-34
18-34

xvii

TABLE OF CONTENTS (Continued)
CHAPTER
18 (Cont.)

19

20

The TMS 9900 Instruction Set
The Benchmark Program
The TMS 9980A and the TMS 9981 Microprocessors
TMS 9980 Series Microprocessor Pins and Signals
TMS 9980 Series Microprocessor Timing and Instruction Execution
TMS 9980 Series Interrupt Logic
The TMS 9980 Series Instruction Set
The TMS 9940 Single-Chip Microcomputers
TMS 9940 Registers and Read/Write Memory
TMS 9940 CPU Pins and Signal Assignments
TMS 9940 General Purpose Flags
TMS 9940 Timer/Event Counter Logic
TMS 9940 Interrupt Logic
TMS 9940 Reset
Programming a TMS 9940E Erasable Programmable Read-Only Memory
Loading a Program into TMS 9940 Read/Write Memory
The TMS 9940 Instruction Set
The TIM 9904 Four-Phase Clock Generator/Driver
The TMS 9901 Programmable System Interface (PSI)
TMS 9901 Pins and Signals
TMS 9901 PSI Interrupt Logic
TMS 9901 Data Input and Output
TMS 9901 Real-Time Clock Logic
TMS 9901 Reset Logic
Data Sheets

PAGE
18-35
18-42
18-44
18-45
18-49
18-49
18-52
18-52
18-54
18-56
18-65
18-65
18-65
18-65
18-66
18-66
18-66
18-67
18-70
18-73
18-76
18-78
18-80
18-81
18-D1

Single Chip Nova Minicomputer Central Processing Units

19-1

A Product Overview
Nova Programmable Registers
Nova Memory Addressing Modes
Nova Status Flags
MicroNova and 9440 CPU Pins and Signals
CPU Logic and Instruction Execution.
Arithmetic/Logic Instructions
Memory Reference Instructions
Input/Output Instructions
A Nova Summary
9440 Timing and Instruction Execution
MicroNova and 9440 Interrupt Processing
MicroNova and 9440 Direct Memory Access Logic
The MicroNova and 9440 Instruction Sets
The Benchmark Program
Data Sheets

19-2
19-4
19-5
19-10
19-10
19-17
19-17
19-20
19-20
19-22
19-23
19-27
19-31
19-32
19-32
19-D1

The Intel 8086

20-1

The 8086 CPU
8086 Programmable Registers and Addressing Modes
8086 Status
8086 CPU Pins and Signals
8086 Timing and Instruction Execution
8086 Bus Cycles
8086 Instruction Queue
8086 Memory and I/O Device Read Bus Cycle for Simple Configurations
8086 Memory or I/O Device Write Bus Cycle for Minimum Mode
8086 Read and Write Bus Cycles for Maximum Mode

20-3
20-3
20-17
20-19
20-25
20-26
20-27
20-30
20-31
20-32

xviii

TABLE OF CONTENTS (Continued)
CHAPTER
20 (Cont.)

c

w

~

a:
0

a.

a:
0

CJ

~

iii
w
~

g<
CI)
CI)

<
o1J
w

z
a:
0

III
CI)

0
~

<
c
<
@
22

23

24

The 8086 Wait State
The 8086 Hold State
The 8086 Halt State
The 8086 Lock
The 8086 Processor Wait for Test State
The 8086 Processor Escape
The 8086 Reset Operation
8086 Interrupt Processing
Single Stepping Mode
The 8086 Instruction Set
8086-8080A Instruction Compatibility
The Benchmark Program
Instruction Execution Times and Codes
The Intel 8284 Clock Generator/Driyer
8284 Clock Generator/Driver Pins and Signals
The Intel 8288 Bus Controller
8288 Bus Controller Signals and Pin Assignments
The 8282/8283 8-Bit Input/Output Port
The 8282/8283 Input/Output Port Pins and Signal Assignments
The 8286/8287 8-Bit Bidirectional Bus Transceivers
8286 and 8287 Bidirectional Bus Transceiver Pins and Signal Assignments
Some 8086 Microprocessor Bus Configurations
Data Sheets

2900 Series and 6700 Series Chip Slice Products

22-1

The 2901/6701 Arithmetic and Logic Unit (ALU)
The 2909 Microprogram Sequencer
The 2902 Carry Look Ahead
Data Sheets

22-2
22-5
22-8
22-D1

The MC1 0800 Series Chip Slice Logic

23-1

The MC1 0800 Arithmetic and Logic Unit Slice
The MC 10801 Microprogram Control Unit
The MC1 0802 Timing Device
The MC1 0803 Memory Interface Device
Data Sheets

23-3
23-5
23-6
23-6
23-D1

The Hewlett Packard MC2

24-1

An MC2 System Overview
MC2 Programmable Registers and Status
MC2 Memory Addressing Modes
Hardware Aspects of the MC2
The MC2 Instruction Set
The Benchmark Program

25

PAGE
20-34
20-34
20-36
20-37
20-38
20-38
20-38
20-38
20-41
20-41
20-48
20-48
20-67
20-77
20-77
20-80
20-80
20-83
20-83
20-85
20-85
20-86
20-D1

24-1
24-2
24-4
24-4
24-5
24-6

Selecting a Microcomputer

25-1

Designing Logic with Microcomputers -A Sequence of Events
Microcomputer Development Hardware
Microcomputer System Software
An Economic Example
A Look at the Future

25-2
25-3
25-5
25-9
25-10

xix

xx

LIST OF FIGURES
FIGURE

Q

w

l-

e(

a:
0

D.

a:

0

CJ

~

en
w

l-

e(

(3
0

U)
U)

e(

ciS

w

z
a:
0

a:I
U)

0
~

e(

Q

Logic of the TMS1000 Series Microcomputer
TMS1000 and MC141000 Microcomputer Signals and Pin Assignments
TMS1200 and MC141200 Microcomputer Signals and Pin Assignments
TMS 1070 Microcomputer Signals and Pin Assignments
TMS1270 Microcomputer Signals and Pin Assignments
TMS1100 Microcompu~er Signals and Pin Assignments
TMS1300 Micrqcomputer Signals and Pin Assignments

1-2
1-6
1-7
1-7
1-8
1-8
1-9

2-1
2-2
2-3
2-4
2-5
2-6·
2-7
2-8
2·-9
2-10
2-11
2-12

2-2
2-4
2-9
2-26
2-30
2-34
2-39
2-40
2-46
2-48
2-49

2-13
2-14
2-15
2-16

A Fairchild/Mostek F8 Microcomputer System
Logic of the Fairchild/Mostek 3870 Microcomputer
3870 Microcomputer Signals and Pin Assignments
Instructions That Move Data Between the Scratchpad and Various Registers
Logic of the Fairchild F8 3850 CPU
Fairchild 3850 CPU Signals and Pin Assignments
Logic of the Fairchild F8 3851. 3856. and 3857 Programmable Storage Unit
3851 PSU Signals and Pin Assignments
Conceptual Logic to Include a 3851 P5U in a Non-F8 Microcomputer System
3856 PSU Signals and Pin Assignments
3857 PSU Signals and Pin Assignments
Logic of the Fairchild F8 3852 Dynamic Memory Interface (DM!). and of the 3854
Direct Memory Access (DMA) Devices
3852 DMI Signals and Pin Assignments
3854 DMA Signals and Pin Assignments
Logic of the F8 3853 Static Memory Interface (SM!) Device
3853 SMI Signals and Pin Assignments

3-1
3-2
3-3
3-4
3-5
3-6
3-7
3-8
3-9
3-10
3-11
3-12
3-13
3-14

Logic of the SC/MP Microcomputer
SC/MP CPU Signals and Pin Assignments
SC/MP Bus Access Logic Processing Sequence
Bus Utilization of Each SC/MP Instruction
SC/MP Data Input Cycle
SC/MP Data Output Cycle
NHOLD Signal Used to Lengthen SC/MP I/O Operation
Circuit to Cause Programmed Halt for SC/MP CPU
SC/MP Interrupt Instruction Fetch Process
Using SC/MP in a System with Direct Memory Access
One Method of Initializing an SC/MP Multiprocessor System
Forcing the Halt State in an SC/MP Multiprocessor System
An SC/MP System Showing Typical Support Devices that may be Required
SC/MP Data Lines Buffered Using 8216 Devices

3-2
3-6
3-9
3-11
3-12
3-12
3-13
3-13
3-14
3-17
3-20
3-20
3-29
3-30

4-1

The 8080A CPU. 8224 Clock and 8228 System Controller Forming a
Three-Device Microprocessor
8080A CPU Signals and Pin Assignments
A Machine Cycle Consisting of Five Clock Periods
Status Output During T2 of Every Machine Cycle
8080A Instruction Fetch Sequence
8080A Memory Write Timing
The 8080A CPU Operating With Fast Memory and No Wait State
The 8080A CPU Operating With Slow Memory and a Normal Wait State
Floating of Data and Address Busses at <1>2 in T3. for READ Operation Being
Completed Prior to Onset of Hold State
Floating of Data and Address Busses at <1>2 in T4. for a WRITE. or Any Non-READ
Operation (R/WO=False)
Floating of Data and Address Busses for READ Operation in a Three Clock Period
Machine Cycle

e(

@

PAGE

1-1
1-2
1-3
1-4
1-5
1-6
1-7

4-2
4-3
4-4
4-5
4-6
4-7
4-8
4-9A
4-9B
4-10A

xxi

2-50
2-52
2-54
2-55
2-56

4-4
4-8
4-8
4-10
4-13
4-14
4-15
4-16
4-17
4-18
4-18

LIST OF FIGURES (Continued)
PAGE

FIGURE
4-10B
4-11
4-12
4-13.
4-14
4-15

4-16
4-17
4-18
4-19
4-20
4-21
4-22
4-23
4-24
4-25
4-26
4-27
4-28
4-29
4-30
4-31 "
4-32
4-33
4-34
4-35
4-36
4-37
4-38
4-39
5-1 .
5-2
5-3
5-4
5-5
5-6
5-7
5-8
5-9
5-10.
5-11
5-12
5-13
5-14.
5-15
5-16
5-17·
5-18

Floating of Data and Address Busses at <1>2 in T 1. for WRITE or Any Non-READ
4-18
Operation Being Completed Prior to Onset of Hold State·
4-20
Interrupt Initiation Sequence
Signal Sequences and Timing for Instructions: STC. CMC. CMA. NOP. RLC. RRC. RAL. RAR.
XCHG. EI. DI: DAA. ADD R. ADC R. SUB A. SBB R. ANA R. XRA R. ORA R. CMP R
4-33
Signal Sequences and Timing for Instructions: INR. DCR. MOV REG REG. SPHL. PCHL.
4-34
DCX.INX
4-34
Signal Sequences and Timing for Instructions: DCR. INA. MVI M
Signal Sequences and Timing for Instructions: LDAX. MOV REG M. 'ADI. ACI. SUI. SBI.
ANI. XRI. ORI. CPI. MVI R. ADD M. ADC M. SUB M. SBB M. ANA M. XRA M.
4-35
ORA M. CMP M
4-35
Signal Sequences and Timing for Instructions:STAX. MOV M REG
4-36
Signal Sequences and Timing for Instructions; LHLD
4-36
Signal Sequences and Timing for Instructions: PUSH. RST
4-37
Signal Sequences and Timing for Instructions: POP. RET
4-38
Signal Sequences and Timing for Instructions: DAD
4-38
. Signal Sequences and Timing for Instructions: XTHL
Signal Sequences and Timing for Instructions: LXI. JMP. JNZ. JZ. JNC. JC. JPO.
4-39
JPE. JP. JM
4-39
Signal Sequences and Timing for Instructions: ST A
4-40
Signal Sequences and Timing for Instructions: LDA
4-40
Signal Sequences and Timing for Instructions:SHLD
Signal Sequences and Timing for Instructions: CALL. CNZ. CZ. CNC. CC. CPO. CPE.
CP.CM
'
4-41
4-42
Signal Sequences and Timing for Instructions: RNZ. RZ. 'RNC.RC. RPO. RPE. RP. RM
4-43
Signal Sequences and Timing for Instructions: IN
4-44
Signal Sequences and Timing for Instructions: OUT
4-45
Signal Sequences and Timing for Instructions: HL T
4-47
8224 Clock Generator Signals and Pin Assignments
4-49
8228 System Controller Signals and Pin Assignments
4-51
A Standard. Three Device 8080A Microcomputer System
4-51,
Timing for Control Signals Output by the 8228 System Controller
4-53
8259 Priority Interrupt Control Unit Signals and Pin Assignments
4-54
A System With One PICU
4-56
A System With Three PICUs -Gne Master and Two Slaves
4-68
Logic of the TMS 5501 Multifunction Input/Output Controller
4-69
TMS 5501 Multifunction Input/Output Controller Signals and Pin Assignments
Logic of the 8085A Microprocessor
8085A CPU Signals and Pin Assignments
A Comparison of 8085A and 8080A/8224/8228 Signal Interface
A Four Clock Period Instruction Fetch Machine Cycle
.
A Six Clock Period Instruction Fetch Machine Cycle
A Memory Read Machine Cycle Following an Instruction Fetch
An I/O Read Machine Cycle Following an Instruction Fetch
A Memory Write Machine Cycle Following an Instruction Fetch
An I/O Write Machine Cycle Following an Instruction Fetch
A Bus Idle Machine Cycle Following an Instruction Fetch During Execution of a
DAD Instruction
Wait States Occurring in a Memory Read Machine Cycle
A RIM Instruction Followed by a SIM Instruction
A Hold State Following a Single Machine Cycle Instruction Execution
A Halt Instruction and a Halt StateTerminated by an Interrupt Request
Hold States Occurring Within a Halt State
An Interrupt Being Acknowledged Using a Single Byte Instruction
A Bus Idle Instruction Fetch Machine Cycle
Power On and RESET IN Timing for the 8085A

xxii

5-2
5-4
5-6
5-9
5-10
5-15
5-16
5-17
5-18
5-19
5-20
5-23
5-23
5-26
5-27
5-28
5-30
5-31

LIST OF FIGURES (Continued)
FIGURE

Q

w

I~

a:

0

D.

a:
0

u

~

enw
I~

g
CI)
CI)

~

olI

w

za:
0

III
CI)

0
~
~

Q

~

@

5-19
5-20
5-21
5-22
5-23
5-24
5-25
5-26
5-27
6-1
6-2
6-3
6-4
6-5
6-6
6-7
6-8
6-9
6-10
6-11
6-12
6-13
6-14
6-15
6-16
6-17
6-18
6-19
6-20
6-21
6-22
6-23
6-24
7-1
7-2
7-3
7-4
7-5
7-6,
7-7
7-8
7-9
7-10
7-11
7-12
7-13
7-14
7-15
7-16
7-17
7-18
7-19
7-20

'PAGE

Logic of the 8155 and 8156 Multifunction Devices
Logic Functions of the 8155/8156 Device
8155/8156 Multifunction Device Signals and Pin Assignments
An 8155 Device Connected to an 8085A CPU Bus
Logic of the 8355 and 8755 Multifunction Devices
Logic Functions of the 8355 Device
8355 Multifunction Device Signals and Pin Assignments
An 8085A-8155/8156-8355 Microcomputer System
8755A Multifunction Device Signals and Pin Assignments
Logic of the 8048 Series Microcomputers
Functional Logic of the 8048,8049,8748,8749, and 8035 Microcomputers
8048 I/O p,orts '1 and 2 Pin Logic
8048 Series Microcomputers' Memory Addressing
8048,8748 and 8035 Microcomputer Pins and Signals
Execution of 8048 Single Machine Cycle Instructions Without any External Access
An 8048 Series External Instruction Fetch
An 8048 Series External Data Read or Write
An 8048-8355 Configuration
Demultiplexing DBO-DB7 to Create Separate Address and Data Busses
An 8048 Single Step Circuit
8748 EPROM Programming and Verification Timing
An Eight-Device Daisy Chained Interrupt Request/Acknowledge Scheme
A Low Chip Implementation of an Eight-Device Daisy Chained Interrupt
Request/Acknowledge Scheme
A Comparison of 8048 and 8041 Functional Logic
8041 and 8741 Microcomputer Pins and Signals
A Comparison of 8048 and 8021 Functional Logic
8021 Microcomputer Pins and Signals
Logic of the 8243 Input/Output Expander
Input/Output Expander Pins and Signals
Functional Diagram of the 8243 Input/Output Expander
An 8243/8048 Configuration with External Logic Read and Write Strobes
\ Timing for Data Output to an 8243 Port Via an MOVD, ORLD, or ANLD Instruction
Timing for Data Input from an 8243 Port
Logic Functions of the Z80 CPU
The Standard 8080A Three-Chip System and Z80,Signal Equivalents
Z80 Programmable Registers
Z80 CPU Signals and Pin Assignments
Z80 Instruction Fetch Sequence
Z80 Memory Read Timing
Z80 Memory Write Timing
Z80 Wait State Timing
Z80 Input or Output Cycles
Z80 Input or Output Cycles with Wait States
Z80 Bus TiminQ
Z80 Response to a Maskable Interrupt Request
Wait States During ?80 Response to a Maskable Interrupt Request
Z80 Response to a Nonmaskable Interrupt Request
Z80 Halt InstnJction Timing
Logic Functions of the Z80 PIO
Z80 PIO Signals ard Pin ASSignments
Mode 0 (Output) Timing
Mode 1 (lnpyt) Timing
Port A. Mode 2 (Bidirectional) Timing

xxiii

5-36
5-37
5-37
5-38
5-46
5-47
5-48
5-48
5-52
6-3
6-4 '
6-6
6-9
6-16
6-19
6-19
6-20
6-21
6-21
6-24
6-25
6-29
6-31
6-42
6-45
6-50
6-52
6-54
6-55
6-56
6-57
6-58
6-58,
7-2
7-3
7-5
7-8
7-12
7-13
7-13
7-14
7-15
7-15
7-16
7-16
7-18
7-19
7-19
7-46
7-48
7-50
7-51
7-51

LIST OF FIGURES (Continued)
FIGURE

PAGE

7-21
7-22
7-23

Interrupt Acknowledge Timing
Z80-CTC Signals and Pin Assignments
Z80-CTC Control Code Interpretation

7-52
7-56
7-61

9-1
9-2
9-3
9-4
9-5
9-6
9-7
9-8
9-9
9-10
9-11
9-12
9-13
9-14
9-15
9-16
9-17
9-18
9-19
9-20
9-21
9-22
9-23
9-24
9-25
9-26
9-27
9-28
9-29
9-30
9-31
9-32
9-33
9-34

Logic of the MC6800 CPU Device
MC6800 CPU Signals and Pin Assignments
A Standard MC6800 Read Machine Cycle
A Standard MC6800 Write Machine Cycle
TSC Floating the Address Bus
TSC Floating the Address and Data Busses When DBE is Tied to <1>2
System Bus Floating During the Halt State
MC6800 Interrupt Acknowledge Sequence
The Reset Sequence
MC6800 Wait Instruction Execution Sequence
Use of 8080A Support Devices With MC6800 CPU
Timing for8080A Support Devices Used With an MC6800 CPU
Logic of the MC6802 CPU Device
MC6802 CPU Signals and Pin Assignments
MC6870A Clock Device Pins and Signals
MC6871 A Clock Device Pins and Signals
MC6871 B Clock Device Pins and Signals
MC6875 Clock Device Pins and Signals
Logic of the MC6820 PIA
MC6820 PIA Signals and Pin Assignments
Functional Block Diagram for the MC6820 PIA
I/O Port A Control Register Interpretation
I/O Port B Control Register Interpretation
Logic of the MC6850 ACIA or MC6852 SSDA Devices
MC6850 ACIA Signals and Pin Assignments
MC6852 SSDA Signals and Pin Assignments
Data Flows Within an MC6852 SSDA
Logic of the MC6828 Priority Interrupt Controller
MC6828 Signals and Pin·Assignments
MC6840 CounterfTimer Signals and Pin Assignments
Logic of the MC6844 DMA Controller
MC6844 DrviA Controller Signafs and Pin Assignments
Timing for Three-State Control. Cycle Stealing Direct Memory Access with the MC6844
An MC6844 DMAC Connected for Three-State Control. Cycle Stealing Direct Memory
Access
Timing for Halt. Cycle Stealing Direct Memory Access with the MC6844
An MC6844 DMAC Connected for Halt. Cycle Stealing or Halt Burst Direct Memory

9-4
9-5
9-8
9-8.
9-10
9-11
9-12
9-14
9-15
9-16
9-32
9-33
9-34
9-35
9-39
9-40
9-40
9-41
9-46
9-47
9-48
9-52
9-52
9-56
9-57
9-62
9-64
9-71

9-35
9-36
9-37

Acce~~

9-72
9-79
9-107
9-108
9-111
9-112
9-114
9-115

9-38
9-39

Logic for MC6844 DMAC with Channel 3 Chained to Channel 0 and Data Flowing
into Alternate Memory Buffers
Logic of the MC684p Multifunction Device
MC6846 Multifunction Device Signals and Pi~ Assignments

9-120
9-125
9-126

10-1
10-2
10-3
10-4
10-5
10-6
10-7
10-8
10-9
10-10

Logic of MCS6500 Series CPU Devices
MCS6502 Signals andPin Assignments
MCSQ503 Signals and Pin Assignments
MCS6504 S!~nalsand Pin Assignments
MCS6505 Signals and Pin Assignments
MCS6506 Signals and pin Assignments
MCS6512 Signals and Pin Assignments
MCS6513 Signals and Pin Assignments
MCS6514 Signals and Pin Assignments
MCS6515 Signals and Pin Assignments

10-3
10-8
10-8
10-9
10-9
10-10
10-10
10-11
10-11
10-12

xxiv

LIST OF FIGURES (Continued)
pAGE

FIGURE

c

w

I-

e(

a:
0

Q.

a:
0

tJ

~

u)
w

le(

(j
0

en
en

e(

all

w

z

a:

0

co
en

0

~

e(

c

e(

@

10-11
10-12
10-13
10-14
10-15
10-16
10-17
10-18
10-19
10-20

Time Base Generation for MCS650X CPU Input Clocks
Logic of the MCS6522 PIA
MCS6522 PIA Signals and Pin Assignments
Auxiliary Control Register Bit Assignments
Peripheral Control Register Bit Assignments
Logic of the MCS6530 and MCS6532 Multifunction Support Devices
Logic Provided by the MCS6530 Multifunction Device
MCS6530 Multifunction Device Signals and Pin Assignments
Logic Provided by the MCS6532 Multifunction Device
MCS6532 Multifunction Device Signals and Pin Assignments

10-17
10-29
10-31
10-32
10-34
10-48
10-49
10-50
10-53
10-54

11-1
11-2
11-3
11-4
11-5
11-6
11-7
11-8
11-9
11-10
11-11
11-12
11-13
11-14

Logic of the 2650A MicrocomplHer CPU
2650A CPU Signals and Pin Assignments
How Control Signals Identify Address and Data Bus Use for the 2650A Microcomputer
2650A-8080A Signal Equivalents
2650A-MC6800 Signal Equivalents
An 8251 USART Accessed by ci'2650A as an I/O Device
An 8251 USART Accessed by a 2650A as a Memory Device
An 8255 PPI Accessed by a 2650A as an I/O Device
An 8255 PPI Accessed by a 2650A as a Memory Device
Vectored Interrupt Using the 8214 PICU with a 2650A CPU
Synchronization Circuits in a 2650A-MC68XX Interface
An MC6850 ACIA Connected to a 2 6 5 0 A "
An MC6820 PIA Connected to a 2650A
Important Timing Considerations When Interfacing a 2650A CPU with MC68XX
Series Devices

11-2
11-9
11-13
11-24
11-24
11-25
11-25
11-26
11-26
11-27
11-28
11-29
11-29

12-1
12-2
12-3
12-4
12-5
12-6
12-7
12-8
12-9
12-10
12-11
12-12
12-13
12-14

Logic of the CDP1802 COSMAC CPU and the CDP1852 110 Port
CDP1802 COSMAC CPU Signals and Pin Assignmellts
COSMAC Machine Cycle Timing
COSMAC Memory Read Instruction Timing
COSMAC Memory Write Instruction Timing
COSMAC DMA-IN Machine Cycle
COSMAC DMA-OUT Machine Cycle
COSMAC I/O Data Input Instruction Execution Timing
COSMAC I/O Data Output Instruction Execution Timing
CDP1852 I/O Port Pins and Signals
CDP1852 I/O Port in Input Mode with Programmed Input
CDP1852 I/O Port in Input Mode with DMA Input
COP 1852 I/O Port in Output Mode with Programmed Output
CDP1852 I/O Port in Output Mode with DMA Output

12-3
12-6
12-8
12-10
12-11
12-12
12-13
12-15
12-16
12-32
12-35
12-36
12-38
12-39

13-1
13-2
13-3
13-4
13-5
13-6
13-7
13-8
13-9
13-10
13-11

Logic of the IM61 00 CPU and the IM61 01 Parallel Interface Element
IM61 00 CPU Signals and Pin Assignments
IM6100 Machine Cycles and Clock Periods
IM6100 Data Input Machine Cycle Timing
IM6100 Data Output Machine Cycle Timing
IM61 00 Memory Read Machine Cycle Timing
IM6100 Instruction Fetch Machine Cycle
Machine Cycle Timing for Memory Read from Indirectly Addressed Location
IM61 00 Memory Write Machine Cycle Timing
Machine Cycle Timing for Memory Write to Indirectly Addressed Location
Auto-Increment Machine Cycle for an IM61 00 Memory Reference Instruction that
Specifies Indirect Addressing with Auto-Increment
IM61 00 DCA Instruction Timing with I ndirect Addressing
IM61 00 DCA Instruction Timing with Indirect Addressing and Auto-Increment

13-2
13-7
13-8
13-10
13-11
13-12
13-12
13-13
13-14
13-15

13-12
13-13

xxv

11-30

13-15
13-16
13-17

LIST OF F~GURES (Continued)
PAGE

FIGURE

13-14
13-15
13-16
13-17
13-18
13-19
13-20
13-21
13-22
13-22a
13-23
13-24
13-25
13-26
13-27
13-28
13-29
13-30·
13-31
13-32
13-33
13-34
13-35
13-36
13-37
13-38
13-39
13-40
13-41
13-42
14~1

14-2
14-3
14-4
14-5
14-6
14-7
14-8
14-9
14-10
14-11
14-12
15-1
15-2
15-3
15-4
15-5

15-6
15-7
15-8

IM61 00 I/O Data Input Machine Cycle
IM6100 I/O Data Output Machine Cycle
IM6100 I/O InstructionTiming
Wait States within an IM6100 Data Input Machine Cycle
Wait States within an IM61 00 Data Output Machine Cycle
An IM61 00 Halt State Initiated by Execution of a HL T Instruction
An IM61 00 Halt State Initiated and Terminated by the RUN/HL T Input
IM6100 DMA Initiation Timing
IM61 00 DMA Termination Timing
IM61 00 Interrupt Acknowledge Timing
Logic and Instruction Sequce for an IM61 00 Vectored Interrupt Acknowledge
IM61 00 OSR Instruction Timing
IM6100 DCA Instruction in Control Panel Memory-Timing with Indirect Addressing
IM61 00 Jump-to-Subroutine Instruction Timing with IndirectAddressing
IM6100 Jump-to-Subroutine Instruction Timing with Stack Access Logic
Using an External Stack Memory to Avoid IM6100 JMS ROM Problems,
IM6100 System Bus Converted to an 8080A-Compatible System Bus
IM6101 Parallel Interface Element Signals and Pin Assignments
LogicofthelM6101 PIE' ,
An IM61 01 I/O Read Instruction's Timing
An IM6101 I/O Write Instruction's Timing
Logic of the IM6102 MEDIC
IM61 02 MEDIC Signals and Pin Assignments
An IM61 00 Microcomputer System that Includes an IM61 02 MEDIC and IM61 01
PIE Device
'
Itvi61 02 Extended Memory Addressing Registers and Data Paths
IM61 00 DCA Instruction Timing with Direct Addressing Using Extended Memory
Addressing
IM6100 DCA Instruction Timing with Ind irect Addressing Using Extended Memory
Addressing
IM6100 DCA Instruction Timing with Indirect Addressing and Auto-Increment Using
.
Extended Memory Addressing
IM6102 DMA Read Timing
IM6102 DMA Write Timing

13-18
13-19
13-21
13-22
13-23
13-24
13-25
13-27
13-28
13-30
13~32

13-34
13-36
13-48
13-49
13-50
13-52
13-54
13-55
13-59
13-60
13~65

13-66
13-68
13-71
13-73
13-75
13-76
13-80
13-81

Logic of the 8X300 Microcontroller and 8T32/3/5/6
A Logic Overview of the 8X300 Microcontroller
8X300 Microcontroller Signals and Pin Assignments
An 8X300 Register-to-Register Instruction's Execution
An 8X300 IV Byte-to-Register Instruction's Execution
An 8X300 Register-to-IV Byte Instruction's Execution
An 8X300 IV Byte-to-IV Byte Instruction's Execution
8T32/3/5/6 Interface Vector Byte Signals and Pin Assignments
8T32/3/5/6IV Byte Control Signals and Interfaces .
8T32/3/5/6 IV Byte Address Programming Pulse
8T32/3/5/6 IV Byte Protect Programming Pulse
8T39 and 8T38 Bus Expander Signals and Pin Assignments

14-2
14-3
14-5
14-11
14-12
14-13
14-14
14-21
14-22
14-24
14-25
14-26

A National Semiconductor PACE Microcomputer System
A National Semiconductor INS8900 Microcomputer System
Logic of the INS8900 Microprocessor
INS8900 and PACE CPU Signals and Pin Assignments
INS8900 and PACE Data Input Timing
INS8900 and PACE Data Output Timing
Using the EXTEND Signal'to Lengthen I/O Cycles
INS8900 and PACE Initialization Timing

15-3
15-4
15-5
15-10
15-12
15-13
15-13
15-14

xxvi

LIST OF FIGURES (Continued)
FIGURE

Q

...w
~

0:

15-9
15-10
15-11
15-12

15-17
15-18
15-19
15-20
16-1
16-2
16-3
16-4
16-5
16-6
16-7 ,
16-8
16-9
16-10
16-11
16-12
16-13
16-14
16-15

Logic of the CP1600 CPU and CP1680 I/O Buffer
CP1600 CPU Signals and Pin Assignments
CP1600 Machine Cycles and Bus Timing
CP1600 Instruction Fetch Timing
CP1600 Timing for Memory Read Instruction with Implied Memory Addressing
CP1600 Timing for Memory Write Instruction with Implied Memory Addressing
CP1600 Wait State Timing
CP1600 DMA Timing
CP1600 Interrupt Service Routine Initialization
CP1600 Timing forTCllnstruction's Execution
CP1600 to 8080A Bus Conversion
CP1600 lOB Signals and Pin Assignments
A CP1600-CP1680 Microcomputer Configuration
PD1680 Handshaking with Data Input
PD1680 Handshaking for Data Output

16-2
16-7
16-9
16-9
16-10
16-11
16-12
16-14
16-14
16-15
16-26
16-28
16-29
16-34
16-35

17-1
17-2
17-3
17-4

Logic of the 1650 Series Microcomputers
1650 Functional Logic
1650 Series Microcomputer Bidirectional I/O Port Pin Logic
1650 Microcomputer Signals and Pin Assignments

17-2
17-3
17-4
17-7

18-1
18-2
18-3
18-4
18-5
18-6
18-7
18-8
18-9
18-10
18-11
18-12
18-13
18-14
18-15
18-16
18-17
18-18
18-19
18-20

Logic of the TMS 9900 CPU
TMS 9900 Signals and Pin Assignments
TMS 9900 Clock Periods and Timing Signals as Generated by the TIM 9904
A TMS 9900 Memory Read Machine Cycle
A TMS 9900 Memory Write Machine Cycle
Two TMS 9900 Output-to-CRU Machine Cycles
Two TMS 9900 Input-from-CRU Machine Cycles
TMS 9900 System Bus Utilization During I/O Operations
The TMS 9900 Wait State
TMS 9900 Hold State Timing
TMS 9900 Memory Map
A TMS 9900 Interrupt Acknowledge Pulse Generated Using an SBO Instruction
TMS 9900 Interrupt Acknowledge Generated by Decoding Valid Addresses
Logic of the TMS 9980A and TMS 9981 Microprocessors
TMS 9980A Signals and Pin Assignments
TMS 9981 Signals and Pin Assignments,
TMS 9980 Memory Map
Some TMS 9980A/TMS 9981 Interrupt Interfaces
Logic of the TMS 9940 Single-Chip Microcomputers
TMS 9940 Memory Map

18-2
18-14
18-16
18-16
18-17
18-21
18-22
18-24
18-24
18-25
18-28
18-33
18-33
18-46 '
18-47
18-48
18-51
18-52
18-53
18-54

0

Q.

0:'

0

(.)

a:

en
w

...

~

(3
0

(I)
(I)

~

o/S

PAGE

Terminating INS8900 or PACE Halt State
Timing Diagram for Processor Stall Using NHALT and CONTIN Si,gnals
Using PACE EXTEND Signal for Cycle-Stealing DMA
Idealized Circuit for Cycle-Stealing DMA During INS8900 and PACE Internal Machine
Cycles
Timing for Cycle-Stealing 'DMA During INS8900 and PACE Internal Machine Cycle
Internal View of INS8900 ,and PACE Interrupt System
Initiating INS8900 and PACE Level 0 Interrupt Using NHALT and CONTIN Signals
Circuit to Prevent ConflictsBetween PACE Level 0 Interrupts and Lower Priority
Interrupts
DP8302 System Timing Element (STE) Pins and Signals
Circuit to Generate Substrate Bias Voltage (VBB) for PACE CPU
BTE Signals and Pin Assignments
Signal Connections to Control BTE in a DMA System

15-13
15-14
15-15
15-16

15-15
15-16
15-17
15-18
15-19
15-20
15-23
15-25
15-35
15-36
15-36
15-37

w

z
0:
0

CD
(I)

0
~

~

Q

~

@

xxvii

LIST OF FIGURES (Continued)
FIGURE

18-21
18-22

PAGE

18-23
18-24
18-25
18-26

TMS 9940 Microcomputer Signals and Pin Assignments
Handshaking Logic in a TMS 9940 Multi-Microcomputer Network Communicating
via the TD Data Line
TIM 9904 Signals and Pin Assignments
Logic of the TMS 9.901 Programmable System Interface
TMS 9901 Programmable System Interface Signals and Pin Assignments
TMS 9901 PSI General Data Flows and CRU Bit Assignments

18-62
18-68
18-71
18-72
18-75

19-1
19-2
19-3
19-4
19-5
19-6
19-7
19-8
19-9
19-10
19-11
19-12
19-13
19-14
19-15
19-16
19-17

Logic of the Data General MicroNova and the Fairchild 9440
MicroNova CPU Signals and Pin Assignments
9440 CPU Signals and Pin Assignments
The Nova Arithmetic and Logic Unit
Arithmetic/Logic Instruction Object Code Interpretation
Load and Store Instruction Object Codes
Jump and Modify Memory Instruction Object Codes
General Input/Output Instruction Object Code Interpretation
Input/Output Skip Instruction Object Code Interpretation
CPU Device 3F 16 Input/Output Instruction Object Code Interpretation
CPU Device 1 Input/Output Instruction Object Code Interpretation
9440 Memory Read/Instruction Fetch Timing
,,
9440 Memory Write Timing
9440 I/O Data Input Timing
9440 I/O Data Output Timing
9440 Interrupt Acknowledge"lnstruction Execution Timing
9440 Mask Out Instruction Execution Timing

19-3
19-13
19-14
19-16
19-16
19-19
19-19
19-20
19-21
19-21
19-22
19-23
19-24
19-26
19-26
19-30
19-31

20-1
20-2
20-3
20-4
20-5
20-6
20-7
20-8
20-9
20-10
20-11
20-12 '
20-13
20-14
20-15
20-16
20-17
20-18
20-19
20-20

Logic of the Intel 8086 CPW
8086 Programmable Registers
8086 Pins and Signal Assignments
Two 8086 Bus Cycles
8086 Memory Read Bus Cycle for a Minimum Mode System (MN/MX=+5V)
8086 Memory Write Bus Cycle for a Minimum Mode System (MN/MX=+5V)
8086 Memory or I/O Read Bus Cycle for a Maximum Mode System (MN/MX=OV)
8086 Memory or I/O Write Bus Cycle for a Maximum Mode System (MN/MX=OV)
The 8086 READY Input and Wait States
'
8086 HALT Instruction and Bus Cycle Timing for a Complex Bus Configuration
'
8086 Interrupt Vector
Logic of the 8284 Clock Generator and Driver
8284 Clock Generator and Driver Pins and Signal A.ssignments
Normal 8284 Clock Generator Circuit
Clock Synchronization Logic in a Multi-CPU 8086 Cpnfiguration
8288 Bus Controller Pins and Signal Assignments
8282 and 8283 Input/Output Port Pins and Signal Assignments
8286 and 8287 Bidirectional Bus Transceiver Pins and Signal Assignments
Generating a System Bus for a Simple 8086 Configuration
Generating a System Bus in an 8086 Microcomp~ier System Using an 8288 Bus
Controller

20-4
20-5
20-19
20-26
20-30
20-32
20-33
20-33
20-34
20-36
20-39
20-76
20-76
20-78
20-79
20-80
20-84
20-85
20-86

22-1
22-2
22-3
22-4

The 2901/6701 Arithmetic and Logic Unit
2901 ALU Logic
2909 Microprogram Sequencer Block Diagram
Four 2901 s in a 16-Bit CPU Using the 2902 for CarfY ~ook Ahead

22-2
22-3
22-6
22-9

23-1
23-2
23-3

MC1 0800 Series Devices in a Central Processing Unit Configuration
The MC1 0800 ALU Slice Functional Diagram
MC10803 Memory Interface Device Block Diawam

23-1
23-2
23-6

xxviii

18-58

20-88

LIST OF FIGURES (Continued)
FIGURE

cw

~
a:
oQ.

PAGE

24-1
24-2

Logic of the Hewlett Packard MC2 Microprocessor
CPU and I/O Device Registers' Organization for the MC2

24-2
24-4

25-1

System Software Modules

25-6

a:

o(J
~

en
w
~

g
CI.I
CI.I

ct

..,

w
Z

a:

oen

CI.I

o

~

ct
C
ct

@

xxix

xxx

LIST OF TABLES
TABLE

Q

w

t-

<

IX

0

D.
IX

0

CJ

~

enw
t-

<
U
0

rJ)
rJ)

<

oil

w

z

IX

0

In

TMS 1000 Series Microcomputer Summary
TMS 1000 Series Instruction Set Summary

1-1
1-12

2-1
2-2
2-3
2-4
2-5
2-6

3870/F8 Instruction Set Summary
Timing and ROMC States for F8 Instruction Set
3870/F8 Instruction Set Object Codes
ROMC Signals and What They Imply
Relationship Between Programmable Timer Contents and Effective Timer Counts
A Summary of Differences Between 3851. 3856. and 3857 PSUs

2-21
2-27
2-29
2-33
2-44
2-47

3-1
3-2
3-3
3-4
3-5

Status and Address Output via the Data Lines at the Beginning of an I/O Cycle
Statuses Output on the Data Bus for Various Types of Machine Cycles
SC/MP Instruction Execution Times
SC/MP Instruction Set Summary
SC/MP Instruction Set Object Codes and Execution Times

3-8
3-8
3-11
3-24
3-27

4-1
4-2

4-2

4-3
4-4
4-5
4-6
4-7
4-8

Devices of the 8080A Microcomputer Family
Statuses Output via the Data Lines During the Second Clock Cycle of an 8080A
Machine Cycle
Statuses Output on the Data Bus for Various Types of Machine Cycle
A Summary of 8080A/9080A Microcomputer Instruction Set
A S~mmary of Instruction Object Codes and Execution Cycles
A Summary of 8259 PICU Operations
TMS 5501 Address Interpretations
TMS 5501 Interrupt Logic and Priorities

4-11
4-11
4-27
4-32
4-66
4-70
4-74

5-1
5-2

A Summary of 8085A Instruction Object Codes and Execution Cycles
8155/8156 Device Port C Pin Options

5-32
5-38

6-1
6-2
6-3

A Summary of 8048 Series Microcomputers
A Summary of 8048 Microcomputer Instruction Set
8048 Series Instruction Set Object Codes

6-2
6-35
6-41

7-1
7-2
7-3

7-4
7-22

7-4
7-5
7-6

Comparisons of Z80 and 8080A Instruction Execution Cycles
A Summary of the Z80 Instruction Set
A Summary of Instruction Object Codes and Execution Cycles with 8080A Mnemonics
for Identical Instructions
Z80 PIO Interpretation of Control Signals
Z80 PIO Select Logic
Z80 PIO and 8255 Mode Equivalences

7-33
7-45
7-47
7-49

9-1
9-2
9-3
9-4
9-5
9-6
9-7
9-8
9-9
9-10
9-11
9-12
9-13
9-14

A Summary of the MC6800 Instruction Set
Operation Summary
MC6800 Instruction Set Object Codes
MC6820 Operating Modes
Addressing MC6820 Internal Registers
MC6852 Status Register Bit Set/Reset Conditions
MC6852 Interrupt Summary
MC6828 Address Vectors Created for Eight Priority Interrupt Requests
MC6828 Interrupt Masks - Their Creation and Interpretation
MC6840 Addressable Locations
A Summary of MC6840 Options and Control Register Settings
MC6844 DMAC Register Addresses
MC6844 DMAC Modes' Response Times and Transfer Rates
MC6846 I/O Addressable Locations

9-19
9-26
9-30
9-49
9-49
9-67
9-68
9-74
9-78
9-82
9-99
9-110
9-116
9-124

rJ)

0
~

<
Q
<
@

PAGE

1-1
1-2

xxxi

LIST OF TABLES (Continued)
TABLE

PAGE

10-1
10-2
10-3
10-4
10-5
10-6
10-7
10-8

A Comparison of MCS6500 Series and the MC6800 CPU Devices
A Summary of the MCS6500 Microcomputer Instruction Set
Summary of MCS6500 Object Codes, with MC6800 Mnemonics
Addressing MCS6522 Internal Registers
Summary of I/O Port A Handshaking Control Signals
A Summary of MCS6522 Interrupt Setting and Resetting
Addressing the MCS6530 Multifunction Support Logic Device
Addressing the MCS6532 Multifunction Support Logic Device

10-2
10-20
10-26
10-33
10-37
10-47
10-52
10-55

11-1
11-2

Summary of Signetics 2650A Instruction Set
Signetics 2650A Instruction Object Codes

11-17
11-22

12-1
12-2

COS MAC Instruction Set Summary
COSMAC Instruction Set Object Codes

12-26
12-31

13-1
13-2
13-3
13-4
13-5

13-37
13-40
13-46
13-57

13-6

IM6100 External Signal Sampling Priorities
IM61 00 Instruction Set Summary
IM61 00 Instruction Set Object Codes
IM61011nterpretation of I/O Instruction Control Bits 3-0
IM6102 MEDIC Pins that should be Tied to Power or Ground when Certain Functions
are Unused
IM6102 MEDIC I/O Instructions

14-1
14-2
14-3
14-4
14-5
14-6

8X300 Source and Destination Object Code Interpretations
8X300 Instruction Set
8X300 Instruction Set Object Codes
Interface Vector Byte Options
Specifications for Signals Illustrated in Figures 14-10 and 14-11
8T39 Bus Expander Addresses and IV Byte Addresses That May Be Connected

14-10
14-18
14-20
14-21
14-24
14-27,

15-1
15-2
15-3
15-4
15-5

INS8900 and PACE Instruction Set Summary
INS8900 and PACE Instruction Set Object Codes
Branch Conditions for INS8900 and PACE BOC Instruction
PACE BTE Truth Table
Comparing INS8900 System Busses to 8080A System Busses

15-27
15-31
15-33
15-37
15-44

16-1

CP1600 Bus Control Signals
CP1600 Instruction Set Summary
CP1600 Branch Conditions and Corresponding Codes
CP1600 Instruction Set Object Codes

16-8
16-18
16-23
16-24

1650 Series One-Chip Microcomputer Options
1650 Series Microcomputer Register Designations
A Summary of the 1650 Series Microcomputer Instruction Set
Mnemonics Recognized by the 1650 Assembler for Special Cases of General
Instru ctions
1650 Instruction Set Object Codes

17-1
17-5
17 -11

High-Order Address Bus Line Used by TMS 9900 I/O Instructions
TMS 9900 Instruction Set Summary
TMS 9900 Instruction Set Object Codes
A Summary of Differences Between the TMS 9900 and TMS 9980 Series
Microprocessors
A Summary of Differences Between the TMS 9980A and TMS 9981 Microprocessors
TMS 9980 Interrupts
TMS 9940 CRU Bit Address Assignments
TMS 9940 CRU Bits Whose Functions are Determined Under Program Control

18-23
18-38
18-43

16~2

16-3
16-4
17-1
17-2
17-3
17-4
17-5
18-1
18-2
18-3
18-4
18-5
18-6
18-7
18-8

xxxii

13-67
13-87

17-14
17-15

18-45
18-50
18-59
18-60

LIST OF TABLES (C~ntinued)
PAGE

TABLE

19-1
19-2
19-3

Nova System Bus Signals
MicroNova and 9440 Instruction Set Summary
MicroNova and 9440 Instruction Set Object Codes

19-11
19-35
19-40

20-1
20-2
20-3

20-10
20-47

20-4
20-5
20-6
20-7

A Summary of Intel 8086 Memory Addressing Options
8086 Branch-on-Condition Instructions
A Summary of Intel 8086 Memory Addressing Options Identified by the EA
Abbreviations in Table 20-3
The 8086 Instruction Set Summary
A Summary of 8086 Instruction Object Codes and Execution Cycles
8080A to 8086 Instruction Mapping
Effect of lOB. CEN. and AEN on Control Signals Output by the 8288 Bus Controller

20-50
20-51
20-68
20-74
20-82

22-1
22-2
22-3

2901 ALU Function Control
ALU Source Operand Control
ALU Destination Control

22-3
22-3
22-7

23-1
23-2

MC 10800 ALU Logical Operations
MC 10800 Arithl'T1etic Operations

23-3
23-4

ce(

e(

24-1

A Summary of the MC21nstruction Set

24-8

@

25-1
25-2

Some Typical Microcomputer Based Product and Development Costs
Unit Prices for Microcomputer Based Products

25-10
25-10

c

w

l-

e(

a::

0

Q.

a::

0

CJ

~

enw
I-

e(

g
CI)
CI)

e(

CI/S

w

za::

0

m
CI)

0
~

xxxiii

xxxiv

QUICK INDEX
PAGE

INDEX

A

Address/Data Lines. Demultiplexing in the INS8900
After Sales Service
ALE Differences in 8085 and 8085A
ALE Generation in 8085 and 8085A
AMD 9080A Status Difference
Assembler
Assembler/Editor Combined

15-38
25-1
5-5
5-18
4-6
25-5
25-5

B

Bidirectional Transceiver Element (BTE)
BTE Mode Control Signals
Buffering SC/MP Busses
Bus Interface Unit (BIU). 8086

15-2
15-37
13-29
20-25

C

CALL Instruction. 8080A Interrupt Response Using
Chip Slice Logic. Carry Status and Overflow in
Chip Slice Logic. Sign Status in
Chip Slice Logic. Zero Status in
Context Switch. TMS 9900
Context Switch. TMS 9900 Backward
Context Switch. TMS 9900 Forward
CONTIN and NHALT Signals are Malfunctional
Continuing Engineering Costs
COSMAC Input/Output Programs
COSMAC Instruction Machine Cycle
COSMAC Interrupt Service Routine Programs
COSMAC Negative Set-up Time
COSMAC Nested Subroutine
COSMAC Timing Variations
Cost. Variable Contributing Factors
Costs. Variable
CPU Initiated DMA Block Data Transfers
CP1600 Direct Addressing
CP1600 Implied Addressing
CP1600 I/O Port Pin Characteristics
CP1600 PCIT Signal
CP 1600 Stack Addressing
Cycle-Stealing DMA During INS8900 and PACE Internal Machine Cycles
Cycle-Stealing DMA in PACE and INS8900 Systems

4-54
22-5
25-5
22-5
18-5
18-6

Debug
Demultiplexing the INS8900 Address/Data Lines
Demultiplexing the SC/MP Data Bus
DEND/IRO Signal. MC6844 DMAC
DGRNT. DMAC. TxSTB. TxAKA and TxAKB Signals. MC6844
DGRNT. TxRON. and DORT Signals. MC6844 DMAC
DMA and Multiprocessor Logic of the SC/MP
DMA Block Data Transfers Initiated by CPU
DMA Block Data Transfers Initiated by External Logic in PACE and .INS8900 Systems
DMA Control Sig'nals in IM6102
DMA. Cycle-Stealing. During INS8900 and PACE Internal Machine Cycles
DMA. Cycle-Stealing. in PACE and INS8900 Systems
DMA Modes in IM6102
DMA Priority Arbitration. MC6844 Fixed
DMA Programming in IM6102
DMA Registers in IM6102
DMAC. DGRNT. TxSTB. TxAKA. and TxAKB Signals. MC6844
DORT. DGRNT. and TxRON Signals. MC6844 DMAC
DROH Signal. MC6844 DMAC

25-8
15-38
3-30
9-113
9-114
9-112
3-1
15-16
15-17
13-79
15-18
15-17
13-83
9-11 q
13-83
13-79
9-114
9-112
9-114

Q

w

~

ct
ex:
0

Q.

ex:
0
u

~

enw
~

ct

g
(I)
(I)

ct
0/1

w
Z

ex:

0

CD

(I)

0
~

ct
Q
ct

@

D

xxxv

18~6

15-15
25-1
12-23
12-9
12-23
12-9
12-22
12-8
25-1
25-2
15-16
16-3
16-4
16-30
16-13
16-5
15-18
15-17

QUICK INDEX (Continued)
INDEX

PAGE

E (Cant.)

Editor
Editor/Assembler Combined
Enabling and Disabling INS8900 and PACE Interrupts
Execution Unit (EUl. 8086
Extend Used to Suspend INS8900 and PACE I/O During DMA Operations
Extended Memory. Base Page in IM6100

25-5
25-5
15-21
20-25
15-17
13-70

F

Fairchild F8 Device Set. The
Fixed Cost Contributing Factors
Fixed Costs
Floating INS8900 and PACE System Busses
F8 Device Set. The Fairchild
F8 Direct Memory Access
F8 DMI Memory Refresh
F8/3870 Accu mu lator
F8/3870 Data Counters
F8/3870 Program Counter
F8/3870 Scratchpad
F8/3870 Stack Register

2-1
25-1
25-2
15-15
2-1
2-53
2-52
2-5
2-6
2-6
2-6
2-6

G

Generating the PACE Substrate Bias Voltage

15-35

H

Halt State in 8085 and 8085A
Hold State in 8085 and 8085A

5-24
5-24

IM61 00 Base Page in Extended Memory
IM6100 Bit Numbering
IM6100 Clock Period Assignments
IM6100 Control Panel Switch Register
IM6100 Extended Memory Jump
IM6100 Extended Memory Subroutine Accesses
IM61 00-IM61 02 Interrupt Acknowledge
IM61 00-IM61 02 Reset Bootstrap
IM6100 Indirect Addressing with Auto-Increment Timing
IM6100 Indirectly Addressed Memory Read Cycle
IM61 00 Indirectly Addressed Memory Write Cycle
IM6100 Instruction Fetch Machine Cycle
IM61 00 Interrupt Processing Instructions
IM6100 Memory Fields
1fv1f31 00 Subroutines in Read-Only Memory
IMEl1 00 Vectored Interrupt Acknowledge
IM6101 Control Registers
IM6101 FLAG Instructions
IM6101 FLAG Outputs
IM61b1 Interrupt Acknowledge
IM6101 I/O lristructions
IM6101 Programming
IM61 01 Read Instruction
IM6101 ResetBootstrap
IM61Q1 Select Logic'
IM6101 Sense Inputs
IM6101 Sense Interrupt Priority
IM6101 SKIP Instructions
IM61 01 Write Operation
IM61 02 Data Field Register
IM6102 DMA Control Signals
IM6102 DMA Modes
IM6102 DMA Programming

13-70
13-7 '
13-10
13-33
13-77
13-77
13-70
13-70
13-14
13-13
13-14
13-13
13-31
13-70
13-5
13-32
13-58
13-61
13-58
13-70
13-58
13-56
13-58
13-70
13-56

xxxvi

1~-58

13-63
13-q1
13-5S
13-70
13-79
13-83
13-83

QUICK INDEX (Continued)
PAGE

INDEX
I (Cant.)

IM6102 DMA Registers
IM61 02 Extended Memory Addressing Registers
IM6102 Instruction Buffer Register
IM6102 Instruction Field Register
IM6102 Interrupt Acknowledge
IM61 02 Interrupt Vector Register
IM6102 Jump Across Memory Fields
IM6102 Reset Bootstrap
INS8900 and PACE CPU Registers During Interrupts. Saving
INS8900 and PACE. Cycle-Stealing DMA during Internal Machine Cycles
INS8900 and PACE Data Input Cycle
INS8900 and PACE Data Output Cycle
INS8900 and PACE Direct Addressing Options
INS8900 and PACE Direct Indexed Addressing
INS8900 and PACE Execution Speed
INS8900 and PACE Extend Signal for Slow I/O Operations
INS8900 and PACE. Extend Used to Suspend I/O During DMA Operations
INS8900 and PACE. Floating System Busses
INS8900 and PACE Halt State
INS8900 and PACE Interrupt Acknowledge and Return from Interrupt
iNS8900 and PACE Interrupt Pointers
INS8900 and PACE Interrupt Priorities
INS8900 and PACE Interrupt Response
INS8900 and PACE Interrupts. Enabling and Disabling
INS8900 and PACE Level 0 Interrupt Response
INS8~00 and PACE Logic Level
INS8900 and PACE Machine Cycle
INS8900 and PACE Machine Cycle Types
INS8900 and PACE Non-Maskable (Level 0) Interrupt
INS8900 and PACE Power Supply
INS8900 and PACE Processor Stall
INS8900 and PACE Signal Differences
INS8900 and PACE Split Base Page
INS8900 and PACE Split Base Page to Address I/O
INS8900 and PACE Stack Interrupts
INS8900 and PACE Systems. Cycle-Stealing DMA in
INS8900 and PACE Systems. DMA Block Data Transfers Initiated by External Logic
INS8900 and 8080A System Busses Compared
INS8900 Control Signal Polarity Considerations
INS8900. Demultiplexing the Address/Data Lines
INS8900 System. The 8212 Used as a Simple Input Port in an
INS8900 System. The 8212 Used as an Output Port in an
INS8900 System. 8255 PPI Devices Used in an
INS8900 Systems. The 8251 USART and 8253 Programmable CounterlTimer Used in
INS8900. Two 8255 Devices Used for 16-Bit I/O Ports with
INS8900. 6800 Support Devices Compatible with
INS8900. 8212 Used for Input with Handshaking in
Interrupt Differences in 8085 and 8085A
Interrupts During an MC6800 HALT
IRQ/DEND Signal. MC6844 DMAC

13-79
13-70
13-71
13-70
13-70
13-78
13-72
13-70
15-22
15-18
15-12
15-13
15-24
15-7
15-1
15-13
15-17
15-15
15-14
15-21
15-21
15-21
15-21
15-21
15-22
15-2
15-12
15-12
15-22
15-1
15-15
15-10
15-16
15-7
15-5.22
15-17
15-17
15-43
15-39
15-38
15-39
15-41
15-42
15-43
15-43
15-44
15-40
5-28
9-38
9-113

L

Label Table
Level 0 and Processor Stall Interrupt Similarities
Linking Loader

25-8
15-15
25-8

Q

w

~
o
D.
a:
o
a:
o

~

enw
~

g
en
en
ct
ell

w
Z

a:

o

III

en

o

~

ct
Q
ct

@

xxxvii

QUICK INDEX (Continued)
INDEX

M

PAGE

MCS6500 Slow Memory Interface
MCS6500 Wait State
MCS6522 Addressing
MCS6522 Interval Timer 1
tviCS6522 Interval Timer 1 Free Running Mode
MCS6522 Interval Timer 1 One-Shot Mode
MCS6522 Interval Timer 2
MCS6522 1/0 Port A Data Transfer
MCS6522 1/0 Port B Data Transfer
MCS6530 Addressing Logic
MCS6532 ~9dressing
MC6800 Bus State Controls
MC6800 Clock Signals
MC6800 Enable Signal Generation
MC6800 HALT. Interrupts During an
MC680Q Internal Operations Machine Cycle
MC6800 Interrupt Priorities
MC680d Machine Cycle
MC6800 Machine Cycle Types
MC6800 Non-Maskable Interrupt
MC6800 Normal External Interrupts
MC6800 Read Machine Cycle
MC6800 Reset
MC6800 Reset During Power-up
MC6800 Reset Operation
MC6800 Software Interrupt
MC6800 Stretching Address Timing
MC6800 SWllnstruction
MC6800 Synchronous HALT Generation
MC6800 Use of WAIT for DMA
MC6800 WAllnstruction
MC6800 Wait State
MC6800 Wait State with Slow Memory
MC680ti Write Machine Cycle
MC6820 Automatic Handshaking
MC6820 Control Codes
MCq820 Interrupt Logic
MC6820 Registers Addressing
MC6840 Continuous Mode
MC6840 Continuous Mode with 0 Initial Value
MC6840 Continuous 8-Bit Counting Square Wave Option
MC6840 Control Registers
MC6840 CounterlTimer Initialization
MC6840 Divide-by-Eight Clock
MC6840 Divide-by-Eight Mode
rviC6840 Event Counting
MC6840 External Signal Timing
MC6840 Frequency Comparison and Pulse Width Measurement Mode 5
MC6840 Hardware Initialization
MC6840lnterruptEnabie
MC6840 One-Shot Mode
MC6840 Output Signal Enable
MC6840 Programmed Initialization
MC6840 Status Register
MC6840 8-Bit Counting Mode
MC6840 16-Bit Counting Mode
MC6844 Channel Control Registers

xxxviii

10-15 .
10-14
10-31
10-39
10-41
10-40
10-41
10-33
10-35
10-48
10-54
9-6
9-7
9-44
9-38
9-9
9-13
9-7
9-7
9-13
9-13
9-7
9-13
9-15
9-15
9-13
9-42
9-13
9-45
9-16
9-16
9-16
9-9
9-8
9-53
9-51
9-51
9-49
9-100
9-103
9-103
9-94
9-79
9-95
9-103
9-104
9-80
9-1 b5
9-102
9-96
9-104
9-97
9-94
9-97
9-96
9-95
9-119

QUICK INDEX. (Continued)
INDEX

PAGE

M (Cant.)

MC6844 Data Chaining
MC6844 Data Chaining Control Register
MC6844 DMAC Address 8us
MC6844 DMAC Data 8us
MC6844 DMAC Device Select
MC6844 DMAC. DGRNT. TxST8. TxAKA andTxAK8 Signals
MC6844 DMAC DROH Signal
MC6844 DMAC Four-Channel Mode
MC6844 DMAC IRO/DEND Signal
MC6844 DMAC Two-Channel Mode
MC6844 DMAC TxAKA and TxAKB Signals
MC6844 DMAC. TxRON. DORT. and DGRNT Signals
MC6844 DMAC TxRO-TxR3 Signals
MC6844 DMAC TxSTB Signal
MC6844 DMAC <1>2 DMA Clock
MC6844 Enable/Priority Control Register
MC6844 Fixed DMAPriority Arbitration
MC6844 Interrupt Control Register
MC6844 Rotating Data Priority Arbitration
MC6846 Composite Status Register
MC6850 Control Register
MC6850 Interrupt Logic
MC6850 MODEM Control Signals
MC6850 Serial I/O Control Logic
MC6850 Serial I/O Data and Control Signals·
MC6850 System Reset
MC6852 Interrupt Logic
MC6852 Reset Operation
MC6852 Serialization Sequence
MC6852 Triple Data Buffers
Microcomputer Development Systems. Simple
Microcomputer Development Systems. Simulating
MicroNova I/O Bus
MicroNova Memory Bus
MODEM Control Signals
Monitor:
Motorola A and B Series Parts
Multiple Device Selects and Bus Loading (8085A)
Multi-8086 Clock Signals. Synchronizing

9-119
9-117
9-109
9-109
9-109
9-114
9-114
9-118
9-113
9-117
9-113
9-112
9-114
9-113.115
9-112
9-116
9-116
9-121
9-117
9-129
9-59
9-59 .
9-58
9-59
9-58
9-59
9-70
9-70
9-63
9-65
25-4
25-4
19-12
19-12
9-58
25-5
9-2
5-11
20-79

N

NEC 8080A External Interrupt Differences
NEC 8080A Hold Differences
NEC 8080Alnstruction Execution Time Differences
NEC 8080A Instruction Set Differences
NEC 8080A Interrupt Acknowledge Differences
NHALT and CONTIN Signals are Multifunctional
Nova Direct Memory Addressing
Nova Indirect Indexed Addressing
Nova Indirect Page Zero Addressing
Nova Indirect Program Relative Addressing
Nova I/O Device Address Space
Nova I/O Device Addressing
Nova I/O Device Busy and Done $tatus
Nova I/O Device Registers
Nova Multiple Indirect Addressing· •

4-24
4-17
4~33
4-24.
4-24
15-15
19-6
19-8
19-6
19-7
19-22
19-9
19-20
19-21
19-9

0

Object Programs. Relocatable
Overflow and Carry Status in Chip Slice Logic

25-7·
22-5 ..

cw

I~

a::

0

a.
a::
0
u

!:
en
w
I~

C3
0

en
en
~

clJ

w

za::

0
m
en
0
~
~

c

~

@

xxxix

.

.

QUICK INDEX (Continued)
PAGE

INDEX

P

PACE Address Latches and Decoders '
PACE and INS8900. Cycle-Stealing DMA during Internal Machine Cycles
PACE and INS8900 Data Input Cycle
PACE and INS8900 Data Output Cycle
PACE and INS8900 Direct Addressing Options
P~CE a'ld INS8900 Direct Indexed Addressing
PACE and INS8900 Execution Speed
PACE and INS8900. Extend Used to Suspend I/O During DMA Operations
PACE and INS8900. Floating System Busses
pACE and INS89dO Halt State
.
PACE and INS8900 Internjpt Acknowledge and Return from Interrupt
PACE and INS8900 Interrupt Pointers
PACE and INS8900 Interrupt Priorities
PACE and INS8900 Interrupt Response
PACE and INS8900lnterrupts. Enabling and Disabling
PACE and INS8900 Logic Level
PACE and INS8900 Machine Cycle
PACE and INS8900 Machine Cycle Types
PACE and INS8900 Non-Maskable (Level 0) Interrupt
PACE and INS8900 Power Supply
PACE and INS8900 Processor Stall
PACE and INS8900 Signal Differences
PACE and INS8900 Signal for Slow Operations
PACE and INS8900 Split Base Page
PACE and INS8900 Split Base Page to Address I/O
. PACE and INS8900 Stack Interrupts
PACE and INS8900 Systems Cycle-Stealing DMA
PACE and INS8900 Systems DMA Block Data Transfers Initiated by External Logic
PACE Clock Signals
.
PACE CPU and INS8900 Registers during Interrupts. Saving
PACE DP8302 STE Clock Frequency
PACE Level 0 Interrupt Problems
PACE Level 0 Interrupt. Return from
PACE MILE Used in an SC/MP System. The
PACE Stack Interrupt Problems
Preventing Simultaneous Selection of I/O and Memory on an 8085A
Preventing Transient Selection on an 8085A
Processor Stall and Level 0 Interrupt Similiarities
Program Linking
PSU Address Space

15-2
15-18
15-12

1~.. ~ 13
15"24
15:7
15-1
15-17
15~ 15
15-14
15-21

15-21

i 5-21
15-21
15-21
15-2
15-12
15-12
15-22
15-1
15-15
15-10
15-13
15-16
15-7
15-5.22
15-17
15-17
15-11
15-22
15-35
15-24
15-23
3-31
15-22
5-12
5-12
15-15
25-8
2-40

R

Read-Only Memory. IM6100 Subroutines in
Relocatable Loader
Relocatable Object Programs
Relocating Assembler
Reset. 8048. 8748. and 8035
Return from PACE Level 0 Interrupt
ROMC State

13-5
25-7
25-7
25-7
6-17
15-23
2-35

s

Saving INS8900 and PACE CPU Registers During Interrupts
SC/MP and SC/MP-II
SC/MP and SC/MP-II. Signal Differences Between
SC/MP Bus Access Control Signals
SC/MP Bus-Sharing Control Signals
SC/MP Busses. Buffering
SC/MP Control Techniques in Multiprocessor Applications
SC/MP Data Bus Definition Signals

15-22
3-3
3-5
3-6
3-17
3-29
3-19
3-7

xl

QUICK INDEX (Continued)
PAGE

INDEX
5 (Cant.)

cw
~
a:
oQ.
a:

o

u

~

enw
~

III(

g
(I)
(I)

III(

all

w
a:

Z

oCD

(I)

o

~

III(

c
III(
@

T

Select Problem with 8085
Service, After Sales
Sign Status in Chip Slice Logic
Simple Microcomputer Development Systems
Simulating Microcomputer Development Systems
Standard Memory Devices Connected to an 8048 Series Microcomputer
Subroutine Library
Suspension of an SC/MP 110 Cycle
Synchronizing Multi-8086 Clock Signals
System Timing Element

3-30
3-12
3-12
3-1
3-10
3-3
3-7
3-9
3-10
3-3
3-3
3-18
3-13
3-5
3-15
3-1
3-31
3-33
3-32
3-7
3-5
5-14
25-1
22-5
25-4
25-4
6-22
25-8
3-9
20-79
15-2

TMS 1000 Subroutines
TMS 5501 Nonstandard Features
TMS 5501 Output Signal Inversion
TMS 5501 Reset
TMS 5501 Wait State
TMS 9900 Backward Context Switch
TMS 9900 Context Switch
TMS 9900 Direct Addressing
TMS 9900 Forward Context Switch
TMS 9900 Implied Addressing
TMS 9900 Indexed Addressing
TMS 9900 Instruction Execution Sequences
TMS 9900 Internal Operations Machine Cycle
TMS 9900 Interrupt Vector Map
TMS 9900 Memory Addresses
TMS 9900 Multiple Interrupt Hardware Considerations
TMS 9900 Nested Interrupt Priorities
TMS 9900 Program Memory Addressing
TMS 9940 CRU Bit Utilization
TMS 9940 CRU I/O Expansion Mode
TMS 9940 HOLD Logic
TMS 9940 IDLE Logic
TMS 9940 Multiprocessor System Interface TMS 9940 Simple CRU 1/0 Mode
TMS 9940 Sync Mode

1-4
4-75
4-69
4-73
4-70
18-6
18-5
18-6
18-6
18-7
18-6
18-18
18-15
18-27
18-3
18-30
18-29
18-8
18-59
18-60
18-64
18-64
18-61
18-59
18-64

SC/MP Data Bus, Demultiplexing the
SC/MP Data Input Cycle
SC/MP Data Output Cycle
SC/MP DMA and Multiprocessor Logic
SC/MP ENOUT Signal Used to Establish Access Priorities·
SC/MP Instruction Execution Speed
SC/MP 110 Cycle Status Information
SC/MP 110 Cycle, Suspension of an
SC/MP 110 with Bus Access Logic Continuously Enabled
SC/MP Logic Level
SC/MP Memory Pages
SC/MP in Multiprocessor Systems
SC/MP NHOLD Signal for Slow 1/0 Operations
SC/MP (P-Channell and SC/MP-II (N-Channell, Signal Differences Between
SC/MP Return-from-Interrupt Technique
SC/MP Serial 110
SC/MP System, The PACE MILE Used in an
SC/MP System, The 8212 Used as an Output Port in an
SC/MP Systems, The 8212 I/O Port Used in
SC/MP Timing Control Signals
SC/MP-II (N-Channell and SC/MP (P-Channel), Signal Differences Between

xli

QUICK INDEX (Continued)
INDEX

PAGE

T (Cont.)

TMS 9980 Series Clock Logic
Transient Selection. Preventing on an 8085A
TTL Level PACE Bus
Two 8255 Devices Used for 16-Bit I/O Ports with INS8900
TxAKA and TxAKB Signals. MC6844 DMAC
TxAKA. TxAKB. DMAC. DGRNT. and TxSTB Signals. MC6844
TxAKB and TxAKA Signals. MC6844 DMAC
TxRON. DQRT and DGRNT Signals. MC6844 DMAC
TxRO-TxR3 Signals. MC6844 DMAC
TxR1 Signal. MC6844 DMAC
TxR2 Signal. MC6844 DMAC
TxR3 Signal. MC6844 DMAC
TxSTB Signal. MC6844 D
TxSTB Signal. MC6844 DMAC
TxSTB. TxAKA. TxAKB. DMAC. and DGRNT Signals. MC6844

18-49
5-12
15-2
15-43
9-113
9-114
9-113
9-112
9-114
9-114
9-114
9-114
9-113
9-115
9-114

u

Utilities

25-8

V

Variable Cost Contributing Factors
Variable Costs

25-1
25-2

w

Wait States during 8085 Interrupt Acknowledge

5-29

z-

Zero Status in Chip Slice Logic
Z80 Bus Control Signals
Z80 CPU Control Signals
Z80 Indexed Addressing
Z80 LSI Technology
Z80 System Control Signals
Z80 Wait States During Interrupt Acknowledge
1650 Accumulator
1650 Counter/Timer Logic
1650 I/O Pin Logic
1650 I/O Port Registers
1650 Program Counter
1650 Program Memory
1650 Stack17-6
1650 Status Register
1650 Timing
1650 VXX Power Supply

22-5
7-9
7-9
7-6
7-1
7-7
7-18
17-4
17-7
17-3
17-3
17-4
17-3

2650A Accumulator
2650A Branch Instruction Addressing
2650A Bus Access Control Signals
2650A Bus Contents Identification Signals
2650A CPU Execution Control Signals
2650A Extended Addressing Options
2650A External Device Control Signals
2650A Index Registers
2650A Interrupt Control Signals
2650A Memory Page Selection
2650A Memory Pages
2650A Program Counter
2650A Program Relative Addressing Options
2650A Stack
2901 ALU Operations Specification
2901 ALU Source Specification

11-3
11-7
11-11
11-11
11-11
11-6
11-12
11-3
11-12
11-8
11-3
11-3
11-4
11-4
24-4
22-4

xlii

17-5
17-8
17-8

QUICK INDEX (Continued)
PAGE

INDEX

cw

~
a:
oQ.
a:

o(J
~

en
w
~

g
CI)
CI)

oct
a1:I

w
Z

a:
o
en

2-10
2-7
2-17
2-3
2-7
. 2-13
2-16
2-6
2-16
2-8
2-10
2-6
2-5
2-6
2-6
2-6
2-6

3870 Clock Logic
3870 Direct Scratchpad Addressing
3870 Event Counter Mode
3870 Expansion
3870 Implied Scratchpad Addressing
3870 Interrupt Disable
3870 Interval Timer Mode
3870 Memory Addressing
3870 Pulse Width Measurement Mode
3870 r Scratchpad Addressing
3870 Reset
3870 Scratchpad Memory Addressing
3870/F8 Accumulator
3870/F8 Data Counters
3870/F8 Program Counter
3870/F8 Scratchpad
3870/F8 Stack Register

CI)

o

~

oct
C
oct

@

6800 Support Devices Not Compatible with INS8900
8T32 IV Byte Access Logic
8T32 IV Byte Addressing
8T32 IV Bytes
8T33 IV Byte Access Logic
8T33 IV Byte Addressing
8T33 IV Bytes
8T35 IV Byte Access Logic
8T35 IV Byte Addressing
8T35 IV Bytes
8T36 IV Byte Access Logic
8T36 IV Byte Addressing
8T36 IV Bytes
8X300 Data and I/O Addressing
8X300 Program Memory Addressing
. 8X300 Rotate and Mask Logic
8X300 Shift and Merge Logic
8035.8048. and 8748 Reset
8041 Buffer Status Register
8048 and 8748 Debug Mode
8048 Series External Memory Access Mode
8048 Series Internal Execution Mode
8048 Series 1/0 Port Pin Logic
8048 Series I/O Ports
8048 Series Machine Cycles and Clock Periods
8048 Series Memory Spaces
8048 Series Microcomputer. Standard Memory Devices Connected to an
8048 Series Microcomputer. 8355 or 8755 Connected to an
8048 Series Program Memory Addressing
8048 Series Single Stepping
8048 Series Verify Mode
8048 Wait State
8048.8748. and 8035 Reset
8049 Series Microcomputers
8080A and INS8900 System Busses Compared
8080A and 8086 Registers' Compatibility
8080A Carry Status Borrow Logic
8080A Carry Status Nomenclature

xliii

15-44
14-23
14-4
14-4
14-23
14-4
14-4
14-23
14-4
14-4
14-23
14-4
14-4
14-4
14-4
14-7
14-8
6-17
6-44
6-15
6-14
6-14
6-5
6-5
6-18
6-8
6-22
6-22
6-8
6-15
6-15
6-20
6-17
6-3
15-43
20-3
4-5
4-26

QUICK INDEX (Continued)
INDEX

PAGE

SOSOA Clock Periods
SOSOA Data Bus Definition Signals
SOSOA Direct Addressing
SOSOA Implied Addressing
SOSOA Instruction Status
SOSOA Interrupt Control Signals
S080A Interrupt Response Using CALL Instruction
SOSOA Machine Cycles
S080A Slow Memories
SOSOA Timing Control Signals
SOSOA Wait State Request Logic
SOS5 and SOS5A
SOS5 and SOS5A. ALE Differences in
SOS5 and SOS5A. ALE Generation in
SOS5 and SOS5A. Halt State in
SOS5 and SOS5A. Hold State in
SOS5 and SOS5A. Interrupt Differences in
S085 Interrupt Acknowledge
SOS5 Interrupt Acknowledge. Wait States During'
SOS5 I/O Write Timing
SOS5 Memory Read Timing
S085 Memory Write Timing
SOS5 Multibyte Acknowledge
SOS5. Select Problem with
SOS5A and SOS5
SOS5A and SOS5. Halt State in
S085A and SOS5. Interrupt Differences in
SOS5A Bus Control Signals
SOS5A Bus Idle Machine Cycle
SOS5A Clock Periods
SOS5A Control Signals
SOS5A Data Bus Definition Signals
SOS5A Device Select Logic
SOS5A Hold Within a Halt State
SOS5A Interrupt Acknowledge
SOS5A Interrupt Signals
SOS5A Machine Cycles
SOS5A Multibyte Acknowledge
SOS5A Multiple Device Selects and Bus Loading
SOS5A. Preventing Simultaneous Selection of I/O and Memory onan
SOS5A. Preventing Transient Selection on an
SOS5A Reset Signals
SOS5A RIM after TRAP
SOS5A Serial I/O
SOS5A TRAP Interrupt
SOS6 and SOSOA Registers' Compatibility
SOS6 AX Register
SOS6 Base Relative Indexed Addressing
SOS6 BCD Addition
SOS6 BCD Division
SOS6 BCD Multiplication
SOS6 BCD Subtraction
SOS6 Bus Interface Unit (BIU)
S086 BX Register
SOS6 Code Segment Register and Program Counter
SOS6 Complex Control Signals
SOS6 CX Register

xliv

4-7
4-7
4-5

4-4
4-10

4-7
4-54

4-7
4-13
4-6
4-14
5-1
5-5
5-1S
5-24
5-24
5-2S
5-29
5-29
5-16
5-15
5-16
5-29
5-14
5-1
5-24
5-2S
5-5
5-1S
5-S
5-5
5-5
5-10
5-27
5-29
5-5
5-7
5-29
5-11
5-12
5-12
5-5
. 5-31
5-5
5-31
20-3
20-3
. 20-13
20-43
20-45
20-45
20-43
20-25
20-3
20-7
20-24
20-5

QUICK INDEX (Continued)
PAGE

INDEX
c

w

~
II:
oa..

II:

o
o

~

en
w
I-

ct

oo
(I)
(I)

ct
~

w
Z

II:

o

aI
(I)

o

~

ct
c
ct

@

8086 Data Memory Base Relative Addressing
8086 Data Segment and Stack Segment Registers
8086 Direct Indexed Addressing
8086 Direct Memory Addressing
8086 OX Register
8086 Execution Unit (EU)
8086 External Memory Addressing
8086 Extra Segment. Source Index and Destination Index Registers
80~6 HOLD in Maximum Mode System
8086 HOLD in Minimum Mode System
8086 Implied Memory Addressing
80~6 Indirect Addressing
808p Instruction Queue
8086 Interrupt Return
8Q~6 Interrupt Vector Table
80861/0 Port Addressing
8086 Maskable Interrupt
8086 Non-Maskable Interrupt
8086 Program Relative Addressing
8086 Reset
8086 Segment Registers
8086 Simple Control Sgnals
8086 Single Instruction Time Identified
8086 Software Interrupts
8086 Stack Segment and Stack Pointer Registers
8155 Device Reset
8155/8156 I/O Mode 0
8155/8156 I/O Mode 1
8155/8156 I/O Port Addresses
8155/8156 Timer Mode 0
8156/815p I/O Mode 0
8156/8155 VO Mode 1
8156/81551/0 Port Addresses
8212 I/O Port Used in SC/MP Systems. The
8212 Used as a Simple Input Port in an INS8900 System. The
8212 Used as an Output Port in an INS8900 System. The
8212 Used as an Output Port in an SC/MP System. The
8212 Used in an INS8900 System for Input with Handshaking. The
8224 Clock Signals
8243 Reset
8251 USART and 8253 Programmable CounterlTimer Used in INS8900 Systems. The
8253 Programmable CounterlTimer and 8251 USART Used in INS8900 Systems
8255 Devices Used for 16-Bit I/O Ports with INS8900
8255 PPI Devices Used in an INS8900 System
8259 PICU Interrupt Mask
8259 PICU Interrupt Masking
8259 PICU Interrupt Service Routine Priorities
8259 PICU Polling
8259 PICU Rotating InterruptPriorities
8284 Wait State Logic
8288 Advanced Write Control Signals
8288 Bus Controller Interrupt Signals
8288 Bus Controller Memory Protect
8288 I/O Bus Mode
8355 or 8755 .cQnnected to an 8048 Series Microcomputer
8748 and 8048 Debug Mode
8748 Programming Mode

xlv

20-13
20-9
20-12
20-11
20-5
20-25
20-20
~0-8

20-35
20c35
20-12
20-17
20-25
20-41
20-39"
20-17
20-39.40
20-39.40
20-17
20-23.79
20-6
20-24
20-38
20-38.40
20-8
5-38
5-38
5-38
5-40
5-42
5-38
5-38
5-40
3-32
15-39
15-41
3-33
15-40
4-46
6-53
15-43
15-43
15-43
15-42
4-63
4-59
4-57
4-59
4-58
20-79
20-81
20-82
20-82
20-81
6-22
6-15
6-15

QUICK INDEX (Continued)
INDEX

PAGE

8748.8048. and 8035 Reset
8755 and 8755A
8755 or 8355 Connected to an 8048 Series Microcomputer
8755A and 8755

6-17
5-51
6-22
5-51

9080A AMD Status Difference
9440 Instruction Fetch
9440 Memory Read
9440 System Bus

4-6
19-23
19-23
19-14

xlvi

INTRODUCTION

c

w

~
a:
oIl.
a:

o

(,J

~

rn

w

I-

<

g
CI)
CI)

<
c!I

w

Z

a:

o

m
CI)

o

~

<
c
<

©

This is the first of two volumes that replace An Introduction to Microcomputers: Volume 2 - Some Real Products. This volume describes microprocessors and dedicated support devices. Volume :3 de~cribes general support devices.
We define a "dedicated" support device as one best used with its parent microprocessor. We define a
"general" support device as one which can be used w~th any microprocessor.
Unfortunately, categorizing support devices as "dedicated" or "general" is not always straightforward. Certainiy IM6100 and TMS9900 support devices have' CPU interfaces which ara peculiar to the parent
microprocessor, so using them with other microprocessors makes little sense. Most MC6800 microprocessor
support devices are also considered dedicated because they use the MC6800 clock signal. This clock signal is
automatically generated by an MC6800 microprocessor or its clock device. It can be derived quite inexpensively in other microcomputer systems; nevertheless, we include MC6800 support devices in Volume 2,
because in our opinion the added clock logic is not compensated for by any performance capabilities over and
above those which you would find in a competing device that did not require the added clock logic.
When reading Volumes 2 and 3, therefore, you should bear in mind that we have had to be subjective when
deciding whether some parts should be described in Volume 2 or Volume 3. Dp not automatically use support
parts described in Volume 2 without checking equivalent parts described in Volume 3. Conversely, there may
be instances where your application is better served by a support device described in Volume 2. In general, you
can look upon Volume 3 support devices as CPU-independent, while Volume 2 devices are CPU-dependent.
In order to cope with the rapid evolution of new parts, Volumes 2 and 3 have been printed loose-leaf. Each
volumo will have six updates per year, appearing at bimonthly intervals. For Volume 2, updates will appear in
November, January, March, May, July and September. Each Septembor the entire book will be reprinted, including the past year's updates. If you have inserted your updates, you will not need to buy a new book next
year. For your convenience, an order form may be found at the back of this book.

SIGNAL CONVENTIONS
Signals may be active high, active low or active in two states. An active high signal is one which, in the high
state, causes events to occur, while in the low state has no significance. A signal that is active low causes
events to occur when in the low state, but has no significance in the high state. A signal that has two active
states will cause two different types of events to occur, depending upon whether the signal is high or low; this
signal has no inactive state. Within this book a signal that is active low has a bar placed over the signal name.
For example, WR identifies a "write strobe" signal which is pulsed low when data is ready for external logic to
receive. A signal that is active high or has two active states has no bar over the signal name.

TIMING DIAGRAM CONVENTIONS
Timing diagrams play an important part in the description of any microprocessor or support device. Timing
diagrams are therefore used extensively in this book. All timing diagrams observe the following conventions:
1)

A low signal level is equivalent to no voltage. A high signal level is equivalent to voltage present:

No voltage

I

xlvii

Voltage present

2)

A single signal making a low-to-high transition is illustrated like this:

low

3)

A single signal making a high-to-Iow transition is illustrated like this:
high

4)

high

I

\

low

When two or more parallel signals exist. the notation:

r-

signals change

l
states that one or more of the parallel signals change level. but the transition (high-to-Iow or low-to-high) is
unspecified.
5)

A three-state single signal is shown floating thus:

~-------~
Signal
floating

6)

.

A three-state bus containing two or more signals is shown floating thus:

______~r---~~---i~----floating

7)

J

When one signal condition triggers other signal changes. an arrow indicates the relationship as follows:

co~:~on

Causes
change
here'

Thus a signal making a low-to-high transition would be illustrated triggering another signal making a high-to-Iow
transition as follows:

A signal making a high-to-Iow transition triggering a bus change of state would be illustrated as follows:

~xlviii

8)

When two or more conditions must exist in order to trigger another logic event. the following illustration is used:

TIre,. ~
""dit;o",

)

cw

le(

cause
change
here

a:

0

Q.

a:
0

(J

~

Thus a low-to-high transition of one signal occurring while another signal is low would be illustrated triggering a
third event as follows:

enw
l-

e(

(3
0

I

\

CI)
CI)

e(

ail

w

Z

a:
0

a:I
CI)

0
~

e(

c
e(

9)

When a single triggering condition causes two or more events to occur. the following illustration is used:

@
This
con,dition

j'

causes
these
changes

Thus a low-to-high transition of one signal triggering changes in two other signal levels would be illustrated as
follows:

10)

All signal level changes are shown as square waves. Thus rise and fall times are ignored. These times are given in
the data sheets which appear at the end of every chapter.

INSTRUCTION SET CONVENTIONS
Every microcomputer instruction set is described with two tables. One table identifies the operations which occur when the instruction set is executed, while the second table defines object codes and instruction times.
Because of the wide differences that exist between one instruction set and another, we have elected not to
use a single set of codes and symbols to describe the operations for all instructions in all instruction sets. We
believe any type of universal convention is likely to confuse rather than clarify; therefore each instruction set
table is preceded by a list of symbols as used within that table alone.
A short benchmark program is given to illustrate each instruction set. Some comments regarding benchmark
programs in general are, however, in order. We are not attempting to highlight strengths or weaknesses of
different devices, nor does this book make any attempt at comparative analyses, since the criteria which make
one microcQmputer better than another are simply too dependent on the application.

xlix

ATTENTION WRITERS
Osborne & Associates is seeking qualified contributors to future updates of Volumes 2 and 3.
Qualified contributors must have an excellent technical background, they must be able to write clearly,
'and they must be unaffiliated with any manufacturer of semiconductor devices. Faculty at universities
are particularly welcome as contributors.
A contributor, when selected, will be assigned a specific category of parts to keep updated. Keeping parts updated will include describing new parts iIi the category as they appear, and improving the
description of parts that are aiready covered.
If you would like to become a contributor to Volume 2 and/or Volume 3, please write stating your
qualifications and the categories of parts that you believe you could cover competently. If possible, send
us a sample of your work; we suggest two or three pages of a part description following the format presented in these books as closely as possible. Send material to:
OSBORNE &: ASSOCIATES, INC.
P.O. Box 2036
Berkeley, California 94702
Attention: Volume 2/3 Contributors

cw

~
a:
oa.
a:

o

u

~

Chapter 1
4-BIT MICROPROCESSORS AND THE TMS1000
SERIES MICROCOMPUTERS

en
w
~

g
(I)
(I)

<
G!I
w
Z

a:

o

In
(I)

o

~

c<
<
@

The earliest microprocessors were all 4-bit devices: that is to say. data was operated on in 4-bit units. frequently referred to as "nibbles". Early microprocessors were 4-bit devices simply because the concept of an LSI CPU was ambitious enough; starting with an a-bit CPU would have been foolhardy.
But LSI technology has advanced so rapidly that there is an inconsequential difference between the cost of manufacturing an 8-bit CPU chip as against a 4-bit chip. Manufacturers attempted to maintain an artificial price differential bet. ween their 4-bit and 8-bit CPUs in order to prolong the life of the 4-bit product: but the pressure of competition has all
but extinguished these price differentials - with the result that the 4-bit microprocessor is a dying product. Price is the
only advantage that 4-bit microprocessors offer when compared to the more capable 8-bit microprocessor.
Early 4-bit microcomputers included such devices as the Intel 4004 and 4040 and the National Semiconductor IMP-4.
These early 4-bit microcomputers require package counts that exceed typical 8-bit microcomputers that are now
available: therefore the economics of today dictate that the Intel 4004, the Intel 4040 and the IMP-4 offer less
capability for more money. Only the most unusual application could be more economically implemented using one of
these three 4-bit microcomputers. rather than a simple 8-bit device such as the 3870. COSMAC. 8048. or one of the
38-pin MCS6500 series CPUs. We consider the Intel 4004, the Intel 4040 and the IMP-4 to be obsolete devices;
therefore they are not described.
It is interesting to note that even though these three 4-bit microcomputers are obsolete. they will continue to have a
significant market for many years to come. based on products that were designed around them before they became obsolete. The fact that they are obsolete simply means that. were you to design a new product today. you would be better
off using one of the simple 8-bit microcomputers. That does not mean it would be economical to redesign a product
that already exists. simply to take advantage of more recent microcomputer developments. The cost of re-engineering
around a new microcomputer will likely overwhelm any savings that may accrue.
The TMS1000 series microcomputer devices, initially manufactured by Texas Instruments, are still economically very viable - even though they are 4-bit devices. This is because the TMS 1000 is a one-chip microcomputer. ROM, RAM, CPU. and I/O logic are all provided within a single package. The low cost associated with the
single-chip TMS 1000 microcomputer package makes this the product of choice for a large number of simple applications that can be accommodated within the logical confines of the TMS 1000.
In reality, the TMS 1000 is a family of six 4-bit microcomputers whose differences are summarized in Table 1-1.
The various microcomputers are sufficiently similar for us to describe them together. PMOS and CMOS versions
are now available. Some CMOS versions manufactured by Motorola have the part number MC 141 000.

Table 1-1. TMS1000 Series Microcomputer Summary
·TMS

1000
Package Pin Count
ROM Program Bytes'
RAM Data Nibbles"

28
1024
64

R Signal Outputs
o Data Outputs
Maximum Rated Voltage
Typical Power Dissipation

.

A Byte

IS

eight bits

..

TMS
1200

TMS
1070

TMS
1270

TMS
1100

TMS
1300

TMS
1000C

TMS
1200C

40
1024

28
1024
64

40
1024
64

28
2048
128

40
2048

40
1024

128

28
1024
64

11

13
10

11

16

10

16

8
20

8
20

8
6

15V/
90mW

15V/
90mW

5V/
15mW

8
6
5V/
5mW

11

64
13

8
20

8
20

15V/
90mW

15V/
90mW

A Nibble

IS

8
35
15V/
90mW

35
15V/
90mW

four bits

1-1

64

MC
MC
141000 141200
28
1024 .

40
1024·

64
11

64
16

8
6.5

8
6.5
5V/ .
2.5mW
3V/
0.5mW

5V/
2.5mW
3V/
0.5mW

Figure 1-1 illustrates that part of our .general microcomputer system logic which is implemented by the
TMS1000 series microcomputers. This figure is deceptive, since it would be hard to compare the primitive I/O
capabilities of the TMS1000 with a device such as the 8255 Programmable Peripheral Interface device, which
is described in Volume III. Nevertheless, Figure 1-1 does indicate the logic which is provided by a TMS1000
series microcomputer, albeit in a primitive form.

Logic to Handle
Interrupt Requests
from
External Devices

o"L,

.c •

>"

.....

f.••.••...••·•. \.··.

I······.

C

......

I··

I.·. .·.

1\

\(

..

~

Stack Pointer

d.
i)

Interrupt Priority
Arbitration

rj

. I.··.•

~.··i

.................

"i.e;

i

,. ;..

............ · . •···.ii•.•·<

Ii

...•....

I/O Communication
Serial to Parallel
Interface Logic

Direct Memory
Access Control
Logic

iii'

'

......

.......

.......

\

.....

•....

L.:. ia

........•

~

.i

.:.....
.....
.......

Programmable
Timers

,'"

f

Figure 1-1. Logic of the TMS 1000 Series Microcomputer

The fact that the TMS1000 series microcomputers are single-chip devices has a number of secondary, non-obvious implications. Most ifTiportant of all, there are no such things as support devices. The 1024 or 2048 bytes of ROM
represent the exact amount of program memory which will be present; there can be neither more nor less. Similarly,
the 64 or 128 nibbles of RAM cannot be expanded. Direct memory access logic is not present - and its presence
would make very little sense anyway; with the small total ROM and RAM memory available, there simply is not the opportu~ityto transfer blocks of data long enough to warrant bypassing the CPU.
Interrupts, similarly, would be of marginal value to a TMS1000 microcomputer. Given the small amount of program
memory available and the very low cost of the package, it would be hard to justify the complexities of interrupt logic,
simply to have the microcomputer perform more than one task.
All devices of the TMS 1000 microcomputer family are implemented using PMOS technology. Selected CMOS parts are
also available.
.

1-2

A single -15V power supply is required for PMOS parts. CMOS parts use power supplies in the range +3V to +6.5V.

cw

~
a:
oD..
a:

o
u

~

enw
t-

ct

C3

ofI)
fI)

ct
all
w
Z

The fastest clock frequency which can drive a TMS 1000 series microcomputer has a 2.5 microsecond cycle time. All instructions execute in six clock cycles. or 15 microseconds: but beware of making direct execution speed comparisons
between the TMS 1000 and the 8-bit microcomputers which are described next. A TMS 1000 program will usually be
considerably longer than the 8-bit microcomputer equivalent because the TMS 1000 instruction set is more primitive:
but this is not always true. It is possible for the TMS1000 instruction set to equal or surpass many 8-bit
microprocessors. in terms of instruction efficiency. for certain control applications.
The prime manufacturer of the TMS 1000 is:
TEXAS INSTRUMENTS. INC.
P.O. Box 1443
Houston. Texas 77001
A second source for CMOS parts with MC 14xxxx part numbers (see Table 1-1) is:
MOTOROLA INCORPORATED
CMOS Products Division
3501 Ed Bluestein Blvd.
Austin. Texas 78721

a:

o

CD
fI)

o

~

ct
C
ct

TMS1000 PROGRAMMABLE REGISTERS
TMS 1000 programmable registers may be illustrated as follows:
4-bit Accumulator

@
2- or 3-bit X register

}

6- or 7-bit Data Counter

4-bit Y register

6-bit Program Counter
4-bit Page register
1-bit Chapter flag (optional)

6-bit Subroutine Return register
4-bit Page Buffer register

Apart from being only four bits wide. the Accumulator is a typical primary Accumulator. It is the principal source and
destination for data that is being operated on.

1-3

Taken together. the X and Y registers constitute a 6- or 7-bit Data Counter which addresses the 64 or 128 nibbles
of RAM. The X register is two or three bits wide and theY register is four bits wide. Since the Xand Y registers are indeed separate and distinct registers. RAM is effectively divided into four or eight pages. each of which is 16 nibbles
.
long. A four-page RAM may be illustrated as follows:

CI\:) ~g~;

af~'

~ t==:I
J==1
02

.

,

Page 0

OE
OF ' B ',
10

}
Page 1

lE'sl
. ;
lF

;;~}
30

Page 2

t=:j

~d§

Page 3

The Y register, in addition, serves as a secondary Accumulator'and ari output Address register. We will describe
its use as an output Address register shortly.
Those TMS 1000 series microcomputers that provide 128 nibbles of RAM have a 3-bit X register. RAM is then divided
into eight 16-nibble pages.
The Program Counter and Page Address register, taken together, constitute a 10-bit Program Counter. They are.
in reality. separate and distinct registers. with the result that program memory is divided into sixteen 64-byte pages.
ThoseTMS1000 microcomputers that provide 2048 bytes of program memory have an additional 1-bit flag,
referred to as Chapter Logic, which is used to select one of two alternate 1024-byte ROM chapters.
TMS 1000
The Subroutine Return register is simply a buffer for the Program Counter register. Similarly,
the Page Buffer register is a simple buffer for the Page Address register. These two buffer
SUBROUTINES
registers allow the TMS1 000 a single level of subroutine call logic. When a subroutine is called,
the contents of the Page Address and Page Buffer registers are exchanged. the Program Counter register contents are
moved to the Subroutine Return register. and a new value provided by the subroutine Call instruction is loaded into the
Program Counter. This may be illustrated as follows:

I

,-.-._~I_-'-.....I~~_""--,,,_...

Instruction object code

: :d~: : :g;,: ~ ItY1cc I 1=0
1-4

Subroutine Return register
Page Buffer register

TMS1000 MEMORY ADDRESSING MODE
TMS1000 microcomputers have separate and distinct program and data memories. There are no instructions
capable of writing into program memory. and data memory cannot contain instruction object codes.

Q

w

~
II:
oa.
II:

o

tJ

~

rJi

w

~

g

Data memory is accessed using implied addressing. The X and Y registers combine to serve as a Data Counter: we
have just described this Lise of the X and Y registers.
Only subroutine Call instructions and Branch instructions address program memory. These instructions address
program memory using variations of absolute, paged direct addressing. .
We have already

illustrate~

the addressing logic of a subroutine call.

A Branch instruction loads the Program Counter with a new address. which is provided by the instruction. just as a Call
instruction does. If the Branch instruction occurs in a subroutine - that is. in the sequence between a subroutine Call
instruction and a subroutine Return instruction - the Page Address register will not be affected. However. execution
of a Branch instruction outside a subroutine will load the Page Address register from the Page Buffer register. The two
types of program branches may be illustrated as follows:

CI)
CI)

I

c(

o!I

Z

II:

oa:I

~

'\

--~~

Program Counter ...

c(
Q

c(

~ ~

.Instruction object code

1_. . . . . . _1
. .'_. .I_~~
.
I~

CI)

o

I

...... ....

'-~

w

Page Address register'

@

Page Buff"'eg;",,

Only if Branch OS;curs
outside a subroutine

TMS1000 STATUS FLAGS
The TMS 1000 series microcomputers have a single status flag which combines to serve as a Carry status and a
simple logic decision stat'us. All Branch and subroutine Call instructions are conditional; the Branch or subroutine
Call occurs only if the status flag is 1.
The unique feature of the status flag as compared to most status logic is that its passive level is high (1). If an instruction causes the status flag to be reset to 0, it will revert to 1 after a single instruction cycle:

R~'~
CLOCK

STATUS

--+---~t:

"_~II-

Instruction

____"'"

I

Instruction

Instruction

I

2

3

Instructions that test the condition of the status flag must directly follow the instruction which modifies the level of the
status flag.

TMS1000 INPUT AND OUTPUT LOGIC
The only data input to a TMS1000 series microcomputer occurs as 4-bit nibbles, referred to in Texas Instruments literature as K inputs. Instructions that access the K inputs simply input whatever signal levels exist at the time
of the access.
TMS 1000 series microcomputers output data referred to as 0 outputs, and control signals referred to as R outputs.

1-5

There are eight data or 0 outputs: but they are created in an unusual way. 0 output logic receives, as inputs, the contents of the Accumulator, plus the status flag. These five data bits create the eight 0 output signals according to a
matrix which you must define when you order the TMS 1000 microcomputer. This may be illustrated as follows:

Accumulator {
Contents

o Output

o outputs

Matrix
Status flag

As the illustration above would imply, the five inputs select 32 of the possible 256 signal combinations which can be
output via the eight 0 outputs.
The control R outputs are treated as 11, 13 or 16 single control signals. Refer to Table 1-1, which identifies the number
of R output signals available with each of the TMS 1000 series microcomputers. You can set or reset R output signals
individually. The Y register is used to identify the individual R signal which is being set or reset.

TMS1000 SERIES MICROCOMPUTER PINS AND SIGNALS
Figures 1-2 through 1-7 illustrate the pins and signals of the TMS1000 series microcomputers. Note that the
TMS 1000 and TMS 1100 microcomputers have identical pins and signals. Since signals are consistent for the entire
family of microcomputers, they will be described together.
The four data inputs are provided by K1, K2, K4 and K8. We would name these signals 010, OIL 012 and 013 to be
consistent with common microcomputer terminology: however. Texas Instruments literature uses the signal names K 1,
K2, K4 and K8 to represent the binary level of each signal.

R8
R9
RlO
(VSS in MC141000) VDD
K1
K2
K4
K8
INIT
07
06
05
04
03

3
4
5
6
7
8
9
10
11
12
13
14

TMS1000

28
27
26
25
24
23
22
21
20
19
18
17
16
15

R7
R6
R5
R4
R3
R2
R1
RO
Vss (VDD in MC141000)
OSC2
OSC1

00
01
02

Pin Name

Description

Type

K1. K2, K4. K8
00- 07
RO - R10 .
OSC1,OSC2
INIT
VDD, VSS

Data input
Data output
Control output
Timing
Power on reset
Power and Ground

Input
Output
Output
Input'
Input

Figure 1-2. TMS1000 and MC141000 Microcomputer Signals and Pin Assignments

1-6

R8
R9

1
2
3
4
5
6
7

RlO
Q

w

!ia:
oD..
a:

o
u

~

en
w
l-

R11
R12
(VSS in MC141200) VDD
K1
K2
K4
K8
INIT
07

e:(

U

oCI)
CI)

e:(
~

w
Z

a:

o

In

06
05
04
03

CI)

o

40

8
9

10

TMS1200

11
12
13
14
15
16
17
18
19
20

39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

R7
R6
R5
R4
R3

R15 }
R14

in MC141200 only

R13
R2
R1
RO
Vss (VDD in MC141200)
OSC2
OSC1

00
01
02

~

e:(
Q
e:(

@

Pin Name

Description

Type

K1, K2, K4, K8
00- 07
RO - R12,R13- R15
OSC1,OSC2
INIT

Data input
Data output
Control output
Timing
Power on reset
Power and Ground

Input
Output
Output
Input
Input

VDD' VSS

Figure 1-3. TMS 1200 and Me 141200 Microcomputer Signals and Pin Assignments

R8
R9
R10
VDD
K1

5
6

K2
K4
K8
INIT
07
06
05
04
03

28
27
26
25
24

1
2
3
4

TMS1070

8
9

10
11
12
13
14

23
22
21
20
19
18
17
16
15

R7
R6
R5
R4
R3
R2
R1
VSS
RO
OSC2
OSC1
00
01
02

Pin Name

Description

Type

K1, K2, K4, K8
00- 07
RO - R10
OSC1,OSC2
INIT

Data input
Data output
Control output
Timing
Power on reset
Power and Ground

Input
Output
Output
Input
Input

VDD' Vss

Figure 1-4. TMS1070 Microcomputer Signals and Pin Assignments

1-7

A8
A9
Al0
All
A12

1

40

2
3
4

39

5
6
7
8
9
10
11

VDD
Kl
K2
K4
K8
INIT

04

12
13
14
15
16
17
18

03
08

19·
20

07
06
05
. 09

Piri Name
,Kl, K2, K4, K8
00- 09
AO - A12
OSC1. OSC2
INIT
VDD,VSS

38
37
36
35
34

TMS1270

33
32
31
30
29
28
27
26
25
24
23
22
21

A7
A6
A5
A4
A3

A2
Al
Vss
AO
OSC2
OSCl

00
01
02

Description

Type

Data input
Data output
Control output
Timing
Power on reset
Power and Ground

Input
Output
Output
Input
Input,

Figure 1-5. TMS1270 Microcomputer Signals and Pin Assignments

A8
A9
Al0
VDD
Kl
K2
K4
K8
INIT
07
06
05
04
03

1
2
3
4
5
6
7
8
9
10
11
12
13
14

Pin' Name
K 1, K2, K4; K8

00-07
RO - R10
OSC1,OSC2
INIT
VDD,VSS

TMSll00

28
27
26
25
24
23
22
21

A7
A6
AS
A4
A3
A2
Al
RO

20
19
18
17
16
15

Vss
OSC2
OSCl

Description
Data input
Data output
, Control output
Timing
Power on reset
Power and Ground

00
01
02

Type
Input
Output
Output
Input
Input

Figure 1-6. TMS 1100 Microcomputer Signals and Pin Assignments

1-8

cw

I-

~.

o0a:

o

u

~

en
w

!(

R11
R12
R13
R14
R15
VDD
K1
K2
K4
K8
INIT

07

g
CI)
CI)

<
olJ
w
Z

a:

o

III
CI)

o

06
05
04
03

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.....i----I 16
.....-----t 17
....i----4I 18
....-----1 19
20

TMS1300

40
39
38
'37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

R10
R9
R8
R7
R6
R5
R4
R3
R2
R1
RO

Vss
OSC2
OSC1

00
01
02

:E

<
c
<
@

Pin Name

Description

Type

K1, K2, K4, K8
00- 07
RO - R15
OSC1,OSC2
INIT
VDD,VSS

Data input
Data output
Control output
Timing
Power on reset
Power and Ground

Input
Output
Output'
Input
Input

Figure 1-7. TMS 1300 Microcomputer Signals and Pin Assignments

The 0 outputs are provided by 00 - 07, or, in the case of the TMS1270, 00 - 09.
The R outputs occur at RO - R15, or some smaller number of R outputs, depending on the microcomputer.
OSC1 and OSC2 are timing inputs and outputs. A number of timing options are provided. All TMS 1000 series
microcomputers contain internal clock logic which you can access in conjunction with an external RC circuit as
follows:

::6=1=~=h :

You can also input an externally created clock signal at OSC1, in which case OSC2 must be connected to ground (VSS).
When you have more than one TMS 1000 series microcomputer in a configuration. it is a good idea to synchronize the
many microcomputers by driving them with a single clock signal.

INIT is a power on reset signal. Following power on. INIT should be input high (VSS) for at least six consecutive clock
cycles. The Reset operation stores binary ones in the Page Address register and the Page'Buffer register. The 0 outputs.
the R outputs and the Program Counter are all zeroed. Thus. the first instruction executed will have the hexadecimal
address 3C016.
Page Address register ~ ~ Program Counter

111 1 0 0 000 0

- - '-v-"'-'v-'"
3
C
0

1-9

TMS1000 SERIES MICROCOMPUTER INSTRUCTION EXECUTION
Noniicrdcomputer described in this book has simpler instruction execution timing than the TMS 1000 series. All instructions generate one byte of object code. There are no two- or three-byte object codes. Similarly. every instruction executes in a single machine cycle, as timed by the system clock.

TMS1000 SERIES MICROCOMPUTER INSTRUCTION SET
There are variations in the instruction sets of the different microcomputers in the TMS 1000 series. However. the
different instruction sets are similar enough for us to describe them all in Table 1-2. As compared to similar tables
for other microcomputers in this book. Table 1-2 has an additional column which identifies the instructions which are
available with each of the TMS 1000 series microcomputers.
.
Within the confines of a single-chip microcomputer. the instruction set defined in Table 1-2 is both powerful and effective. It would be easy to point out instruction set features which. from a programmer's point of view. are undesirable;
however. theTMS1 000 series microcomputers are oriented to digital logic. The TMS 1000 is not a product that gets
programmed; rather. its instruction set is a means of defining an optional portion of the ROM mask. Within this context.
the instruction set is very adequate. Note that, since you are dealing with a singie-chip microcomputer, there is
nothing to prevent you from redefining the Control Unit and thus creating your own instruction set.

THE BENCHMARK PROGRAM
The benchmark program we are using throughout this book in order to exercise the various microcomputer instruction
sets is essentially meaningless in any TMS 1000 application. Given 64. or at most. 128 nibbles of RAM. the whole concept of moving data among tables is meaningless. We therefore simplify the problem and look upon 10BUF as external
logic. Instead of reading from 10BUF. we will input K data. We will assume that each block of K data is preceded by a
nibble which defines the number of data nibbles to follow:

:

K1
K8

n data nibbles
follow

Thus. each block of data that is input must be fifteen nibbles or less in length.

LOOP

LDX
TKA
TAY
TKA
TAM
DYN
BR

TBHI

LOOP

LOAD TABLE PAGE ADDRESS
INPUT FIRST K NIBBLE. IT EQUALS DATA NIBBLE TO FOLLOW
MOVE TO Y. XY NOW ADDRESSES END OF TABLE
INPUT NEXT DATA NIBBLE
SAVE IN MEMORY
DECREMENT Y
IF Y NOT O. RETURN FOR NEXT NIBBLE

Symbols are used in Table 1-2 as follows:
Registers:
A
X.Y
PC
PA
CF
SR
PB

-

Accumulator
Data Counter. Y also serves as an output address.
Program Counter
Page Address register
Chapter Flag (one bit)
Subroutine Return register
Page Buffer

Statuses:
. ST
C
NE

- The Status Flag
- The status flag reflects a Carry. That is. it is set if there is a Carry from the most significant bit
(MSBl. and reset otherwise.
- The status flag reflects "not equal". That is. it is set if the compared bits are not equal. and reset
if they are equal.

1-10

Inputs and Outputs:
K

-

R

-

o
c

bb

...w

-

the four input lines
the five-bit Output register
the control outputs

Two bits in the object code which specify one of the four bits of a RAM location:

o

3

c(

a:

.......--BitNo.

I I I I. 1.-- RAM location

0

a..

a:
0

j~

CJ

~

j

.~

j

u)
w

bb

...
g

-----00
'------10
' - - - - - - - - 01

c(

(I)
(I)

c(

GlJ
w
2

a:
0

III
(I)

0
~

c(

cc(

@

' - - - - - - - - - - - - 11

b
data
label
R([Y]}
x
[ X](MSB}
[[ X.yJ]

Operand which specifies one bit of a RAM location
2. 3. or 4 bits of immediate data
Destination of Branch instruction (6 bits of direct address in the object code)
The control output line specified by the contents of the Y register.
One bit of immediate data or direct address in the object code.
The most significant bit of the X register

The contents of the RAM location addressed by the contents of the Data Counter.
[[ X.Y]](b} The specified bit of the RAM location addressed by the contents of the Data Counter.
[ ]
Contents of location enclosed within brackets. If C3 register designation is enclosed within the brackets.
then the designated register's contents are specified. If K or R is enclosed within the brackets. then the
data at the inputs or control outputs is specified.
Data is transferred in the direction of the arrow.
Data is exchanged between the two locations designated on either side of the arrow.

Where two object codes are given. the first is the code used in the TMS 1000. TMS 1200. TMS 1070. and TMS 1270.
while the second is the object code used in the TMS 11 00 and TMS 1300.
X in one of the rightmost three columns means that th~ instruction is implemented on the designated TMS 1000 device.

1-11

Table 1-2. TMS1000 Series Instruction Set Summary

TYPE

NlNEMONIC

STATUSES
OPERAND I--_-~
C
NE

x

TMS1000
TMS1200
'TMS1070
TMS1270

08

x

SETR

Load Accumulator with data on input lines.
R([Y])-1

00

RSTR

Set R output addressed by contents of Y.
R([Y])-O

TOO

Reset R output addressed by contents of Y.
[0] -([A],STI
Transfer data from Accumulator and status flag to the 0 outputs.
[0] -00,.

09

O.

a Output register.

TMS1100
TMS1300

x

TKA

Clear the

I

OBJECT
CODE

If [K] ,"",0, ST-I
Set status only if data on input lines is not
[K]-[A]

KNEZ

g

OPERATION PERFORMED

OE

x

MC141000
MC141200

x

X

X

x

X

X

DC

x

x

X

OA

x

x

X

OB

x

X

TAM

[A]-[[X,Y))

TMY

03
27
22

x

Store Accumulator to RAM location addressed by contents of XY Data Counter.
[[X,Y))-[Y]

X

X

X

TMA

Load Register Y from RAM.
[[X,Y))-[A]

21

x

X

X

XMA

,Load Accumulator from RAM.
[[X,Y))--[A]

2E

X

X

X

Exchange contents of RAM location addressed by Data Counter XY with those of
Accumulator.

N

Q3

X

x

TAMIY

[A]-[[X,Y)); [y]--'-[y] + 1

20

TAMIYC

x

Store Accumulator to RAM and increment contents of Y register.
[A]-[[X,Y)); [y]-[y] + 1; ST-C

25

X

X

Store Accumulator to RAM and increment contents of Y register. Set status flag
only if there is a carry.
[A]-[[X,Y)); [Y]-[Y]-I: ST-C

24

X

Store Accumulator to RAM and decrement contents of Y register. Set status flag
only if there is no borrow.
tA]-[[X,Y)); [A]-O

04

TAMOYN

TAMZA

Store Accumulator to RAM and then clear Accumulator.
AMAAC

SAMAN

IMAC

X

X

X

[A]-[[X,Y)) + [A]; ST-C
Add contents of RAM location to those of Accumulator. Set status flag only if
there is a carry.
[A]-[[X,Y))-[AI; ST-C
Subtract Accumulator contents from those of RAM location. Set status flag only
if there is no borrow.
[A]-[[X,Y)) + I; ST-C
Load contents of RAM location to Accumulator and increment. Set' status flag
only if there is a carry. RAM contents are unchanged.

X

X

26
25

28
3E

x
x

x
x

06
27
3C

X

X

x

x
X

x

x

x

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 1-2. TMS1000 Series Instruction Set Summary (Continued)
STATUSES
TVPE

MNEMONIC

OPERATION PERFORMED

OPERAND
C

OMAN

W

NE

X

U

Z
W
a::
w_
U.W
wIa::e(>a::C
ww
a::
OO-~

ALEM

X

MNEA

X

MNEZ

X

::E0~

w>1Z
::Ea::
00

~~g

e(::E
CZ
0
U
w
(I)

I

W

SBrr

b

RBIT

b

TBIT1

b

TCV

data

TCMIV

'data

X

[V]-'data
Load Register V immediate.
[[X,V])-data; [V]-[V] + 1
Load RAM location immediate and increment contents of Register V.
[X]-data
Load Register X immediate.
[PB]-data
Load Page Buffer register immediate .

w

l-

e(

E
w
~

~

LOX

data

LOP

data

..

...

w
e(
a::
w
00
w

l-

~

Q
w
::E

~

ALEC

data

VNEC

data

X

X

A2AAC

X

A3AAC

X

A4AAC

X

A5AAC

X

A6AAC

X

A7AAC

[A]-[[X,V))-1; ST-C
Load contents of· RAM location to Accumulator and decrement. Set status flag
only if there is no borrow. RAM contents are unchanged.
If [A] ~ [[X,V)), ST-1
Set status flag only if Accumulator contents are less than or equal to those of
RAM location addressed by Data Counter XV.
If [[X,V)) '" [AJ. ST-1
Set statu~ flag only if contents of RAM location are not equal to those of Accumulator.
·If [[X,V)) .; 0, ST - 1
Set status flag only if contents of ~AM location are hot equal.to zero.
[[X,V]](b) -1
Set specified bit of RAM location addressed by contents of Data Counter XV.
[[ X,V]](b) -0
Reset specified bit of RAM location addressed by contents of Data Counter XV.
ST - [[X,V]](b)
Test specified bit of RAM location and set status flag only if the bit is set.

X

OBJECT
CODE

TMS1000
'TMS1200
TMS1070
TMS1270

2A

X

3F
OO;;OObb

X

X

X
X

00

26

MC141000
MC141200

X

07
29
01

TMS1100
TMS1300

X

X

X

X

X
X

X

001101bb

X

X

X

001110bb

X

X

X

0100xxxx

X

X.

X

0110xxxx

X

X

X

001111xx
00101xxx
0001xxxx

X
X

X

0111xxxx

X

0101xxxx

X

X

X

.

If. [A] ~,data, ST-1
Set status flag only if Accumulator contents are less than or equal to immediate
data.
If [V] ~ ~data, ST-1
Set status flag only if contents of Register V are not equal to immediate data.
[A]-[A]+2; ST-C
Add 2 to Accumulator contents. Set status flag only if there is a carry.
[Ak-[A] + 3; ST-C
Add 3 to Accumulator contents. Set status flag only if there is a carry.
[A]":'[A]+4;ST-C
Add 4 to Accumulator contents. Set status flag only if there is a carry.
[A]-[A]+5;ST-C
Add 5 to Accumulator contents. Set status flag only if there is a carry.
·[A]-[A]+6;ST-C
Add 6 to Accumulator contents. Set status flag only if there is a carry.
[A]-[A]+7; ST-C
Add 7. to Accumulator contents. Set status flag only if there is a 'carry.

X

X

78

X

74

X

7C

X

72

X

06

7A
76

X

X

X
X

X

Table 1-2. . TMS1000 Series Instruction
Set Summary (Continued)
.
STATUSES
TYPE

MNEMONIC

O~ERAND

C
A8AAC
~w

X

Al0AAC

X

~~

AllAAC

X

~-

A12AAC

X

wC
a..w

ST -c·
Add 8 to Accumulator contents. Set status flag only if there is a ·carry.
[A]-[A]+9;ST-C
.Add 9 to Accumulator contents. Set status flag pnly if there is a carry.
[A]-[A] + 10;ST-C
Add 10 to Accumulator contents. Set status flag only if there is a carry.
[A]~[A]+8;

X

A9AAC

~
0:-

0;:)

w~

58
~

A13AAC

IL

[A]-[A]+ 11; ST-C
Add 11 to Accumulator contents.
[A]-[A]+ 12; ST-C
Add 12 to Accum'ulator contents.
[A]-[A]+ 13; ST-C
Add 13 to Accumulator contents.
[A)-[A] + 14; ST-C
Add 14 to Accumulator contents.

X

A14AAC

X

::;)

.'"
I

~

Z

0

:E:
(J

Z

BR

label

CALL

label

i=

i5
Z

c(

,

a:ce
ww
.......... w
>

~~O

~,~

TAY
TVA

::;:

cece

X

05
79

X

MC141000
MC141200
X

X
X

X

75

X

70

X

73

X

7B

X

X

Set status flag only if there is a carry.
Set status flag only if there is a carry.
OF

X

X

X

10xxxxxx

X

X

X

llxxxxxx

X

X

X

[A]-[Y]
Transfer Accumulator contents to Register Y.
[Y]-[A]
Transfer Register Y contents to Accumulator.

24
20
23

X
X

X

X

If [Y]fo[A],ST-l
Set status flag only if contents of Y register are ncit equal to those of Accumulator.

02

X

X

X

[A]-O
Clear Accumulator.
[A]-[A]+l
Increment Accumulator. No status affected.
[A]-[A]+ 1; ST -C.
Increment Accumulator. Set status flag only if there is a carry.

2F
7F
OE

X'

a

0
a: (J

IZI

01
7E
71

TMS1100
TMS1300

Set status flag only if there is a carry.

If ST = 1. then [PC]-Iabel;
outside subroutine. [PA]-[PB]
Branch if status flag is set.
If ST = 1. then [SR]-[PC]+ 1. [PB]-[PAl. [PC]-label
Call subroutine if status flag is set. A subroutine call within subroutine will act as
a branch. and load the Page Buffer from the Page Address register:
[PC]-LABEL
[PB]-[PA]

Z

0

TMS1000
'TMS1200
'TMS1070
TMS1270

Set status flag only if there is a carry.

[PC]-[SRl. [PA]-[PB]
Return from subroutine.

RETN

::;:

OBJECT
CODE

OPERATION PERFORMED'

NE

X
X

I

ffi!ffi~
.......... c(
~ ~ ce

00

w w

YNEA

X

W

IL

a: ce 0

ce w
w
..... ~
CIl ce

5w

w

CLA
IA

IL

ce 0

lAC

X

70

X
X

X

X
X

© AD~M OSBORNE &

ASSOCIATES,INCORPORATED

Table 1-2. TMS 1000 Series Instruction Set Su mmary (Continued)
STATUSES
TYPE

MNEMONIC

OPERAND

OPERATION PERFORMED
C

w

H)
Pulse width, clock low, twld>U
Sum of rise time and pulse width, clock high, tr + tw(dlHI
Sum of fall time and pulse Width, clock low, tf + twld>U
Oscillator frequency, fosc
Operating free-air temperature, T A
NOTES:

1.
2.
3.
4.

-4

K

0

V
V
/.IS
/.IS
/.IS
/.IS
/.IS
/.IS

400
70

kHz

°c

Unless otherwise noted, all voltages are with respect to VSS.
These average values apply for any 100-ms period.
Ripple must not exceed 0.2 volts peak-to.peak in the operating frequency range.
The algebraic convention where the most-positive (least-negative) limit is designated as maximum is used in this specification for
logic voltage levels only.

VSS

Voo

Jj---.,

~ tf

I-e-

tw(cpL)

~,,--_-_-_-_-_V:,:(~,

Ii

-.f

\4- tr

--.j

~

tc~"I-------- tC(c;'l1

I

tW(c;'lHI

-JI

------t..~1

NOTE: Timing points are 90% (high) and 10% (low),

FIGURE 7 - EXTERNALLY DRIVEN CLOCK INPUT WAVEFORM

Data sheets on pages 1-02 through 1-05 are reproduced by permission of Texas Instruments Incorporated.

1-D2

TMS 1000/1200 AND TMS 1100/1300
ELECTRICAL CHARACTERISTICS OVER RECOMMENDED OPERATING FREE·AIR TEMPERATURE RANGE
(UNLESS OTHERWISE NOTED)
PARAMETER

w

!ia:

VOH

Low·level output current

10L

o(J

IOO(av)

~

g

P(AV)

en
en
ct
ell

w
Z

a:

oen

TMS 1000/1200 (see Note 2)

-0."75

10 = -2mA

300

Average power dissipation
TMS 1000/1200 (see Note 2
Average power dissipation
TMS11 00/1300 (see Note 2)

MAX UNIT
500

j./A

-100

j./A

V

-0·4

All outputs open

-6

-10

rnA

All outputs open

-7

-11

rnA

All outputs open

90

175

mW

All outputs open

1q5

193

mW

300

350

kHz

TMS11 00/1300 (see Note 2)

P(AV)

Typt

-1.1:1: -0.6:1:

10 = -10mA

Average supply current from VOO
IOO(av)

50

VI = OV

VOL = VOO

Average supply current from VOO

en
w

!i

I R outputs

(see Note 1)

oa.

a:

I 0 outputs

High·level output voltage

Q

MIN

TEST CONDITIONS

Input current, K inputs

II

fosc

Internal oscillator frequency

Ci

Small'signal input capacitance, K inputs

Rext = 50 kn,
VI =0,

Cext = 47 pF
f = 1 kHz

Cj(¢)

Input capacitance, clock input

VI = 0,

f=1ookHz

250

10

pF

25

pF

en

o

~

ct
Q
ct

@

t All typical values are at VOO = -15 V, TA = 25°C.

:I: Parts with
NOTES:

VOH of -2 V minimum, -1.3 V tvpical, are available if requested.

1. The algebraic convention where the most·positive (least.negative) limit is designated as maximum is used in this
specification for logic voltage levels onlv.
2. Values are given for the open·drain 0 and R output configurations. Pull·down resistors are optionally available on all
outputs and increase I DO (see Section 4,4).

SCHEMATICS OF INPUTS AND OUTPUTS

TYPICAL OF ALL K INPUTS
INPUT

~

TYPICAL OF ALL 0 AND R
OPEN·DRAIN OUTPUTS

VSS

d

R' 50 kn

l
VOD

TYPICAL OF ALL 0 AND R
OUTPUTS WITH OPTIONAL
PULL·DOWN RESISTORS

Vss

VSS

J .

I ....
~OUTPUT

i

d

rOUTPUT

~VOO

The 0 outputs have nominally 60 n on·state impedance; however, upon request a 130·n buffer can be mask program·
med (see note It I section 4.3).
The value of the pull·down resistors is mask alterable and provides the fo!lowing nominal short·circuit output currents
(outputs shorted to VSS):

o outputs: 100,200,300,500, or 900 J.1A
R outpllls: 100, 150, or 200 J.1A.

l-D3

TMS 1000/1200 AND TMS 1100/1300
INTERNAL OR EXTERNAL CLOCK.
If the internal oscillator is used, the OSC1 and OSC2 terminals are shorted together and tied to an external resistor to
VOO and a capacitor to VSS' If an external clock is desired, the clock source may be connected to OSC1 and OSC2
shorted to VSS'

TYPICAL INTERNAL OSCILLATOR FREQUENCY

vs
EXTERNAL RESISTANCE
CONNECTION FOR INTERNAL OSCILLATOR

I lE------o
cext

osc':

Vss

OSC2 '---~-""--'l~VDD
R ext

100L-~~~--~--~~~--~~~~__~~

o

20

40

60

80

100

120 140

160

180

200

Rext.- External Resistance - kn

TYPICAL BUFFER CHARACTERISTICS

o OUTPUTS

R OUTPUTS

HIGH·LEVEL OUTPUT CURRENT

HIGH·LEVEL OUTPUT CURRENT

vs

vs

HIGH·LEVEL OUTPUT VOLTAGE

HIGH·LEVEL OUTPUT VOLTAGE

-30 .....--.--.---.---..,....-..;...,.....---.r--.......-..,....-...,...---.

-~ ~~--~--~~~~~~~~~~-4-~
c(

E

c(

-40

E

I

I

c

!

~

:J

CJ

:;

-30

-20~-4--~~~--+---~~~-+--~~4-~

CJ

;

:J.

~
o

&
:J

0

-15

1
i -10 ~-4----t-.;+-,jC---+-­

!

...I

...I

i.

l:

i

I

I

l:

l:

2

2

oL-~

o

__

~

-1

__

~~

__

-2

~

__

~

-3

__

~~~~

-4

__

-5

~

-1

-5

-2

-3'

VOH - High·Lewl Output Volt. - V

VOH - High·Lewl Output Volt8Qtl - V

1-04

-5

TMS 1070/1270
ABSOLUTE MAXIMUM RATINGS OVER OPERATING FREE-AIR TEMPERATURE RANGE
(UNLESS OTHERWISE NOTED)*

c

w

~
a:
oQ.

a:
o

o

~

en
w

~
(3
o
(I)

• -20V
-20 V to 0.3 V
-35 V to 0.3 V
-20 V to 0.3 V
-2.5 mA
-12 mA
-5mA
-24mA
400mW
600mW
O°C to 70°C
-55°C to 150°C

Voltage applied to any device terminal (see Note 1)
Supply voltage, V DD
Data input and output voltage with VDD applied (see Note 2)
Clock input and IN IT input voltage
Average output current (see Note 3): 0 outputs
R outputs
Peak output current:
0 outputs .
R outputs .
Continuous power dissipation: TMS 1070 NL .
TMS 1270 NL.
Operating free-air temperature range
Storage temperature range.

(I)

<

o!I

w
Z

a:

·Stresses beyond those listed under "Absolute Maximum Ratings" maY cause permanent damage to the device. This is a stress rating only and
functional operation of the device at these or any other conditions beyond those indicated in the "Recommended Operating Conditions"
section of this specification is not implied. Exposure to absolute-maximum-rated conditions for extended periods may affect device reliability.

oal
(I)

o

RECOMMENDED OPERATING CONDITIONS

~

<
c
<
@

PARAMETER
Supply voltage. VOO (see Note 41

MAX

UNIT

-15

-17.5

V

-1.3

INIT or Clock

Low-level input voltage, VIL (see Note 51

NOM

-14

0.3

-6

K

High-level input voltage, VIH (see Note 51

MIN

K (See Note 21

-35

INIT or Clock

VDO
2.5

Clock cycle time, tcl¢1

-1

-8

V

-15

-8

3

10

SlS

60

SlS

15

Instruction cycle time, tc

V

0.3

Pulse width, clock high, tw(¢HI

1

SlS

Pulse width, clock low, tw(¢Ll

1

SlS

Sum of rise time and pulse width, clock high, tr + tw(¢HI

1.25

SlS

Sum of fall time and pulse width, clock low, tf t tw(¢Ll

1.25

SlS

Oscillator frequency, fosc
Operating free-air temperature, T A
NOTES:

1.
2.
3.
4.
5.

100

400

0

70

kHz
C

Unless otherwise noted, all volt~ges are with respect to VSS.
VOO must be within the recommended operating conditions specified in ~.4.
These average values apply for any 100-ms period.
Ripple must not exceed 0.2 volts peak-to-peak in the operating frequency range.
The algebraic convention where the most-positive (least-negative) limit is designated as maximum is used in this specification for
logic voltage levels only.

ELECTRICAL CHARACTERISTICS OVER RECOMMENDED OPERATING FREE-AIR TEMPERATURE RANGE
(UNLESS OTHERWISE NOTED)
PARAMETER
II

TEST CONDITIONS

Input current, K inputs

I a outputs

High-level output voltage
VOH

I

(see Note 11

R outputs

MIN

Typt

VI=OV

40

100

10 = -1 mA

-1

-0.5

-4.5

-2.25

10 = -10 rnA

Low-level output current
10L
IDO(avl Average supply current from VDD

VOL = VDD
All outputs open

MAX
300

UNIT
SlA
V

-100

SlA

-10

mA

90

175

mW

300

350

kHz

-6

P(AVI

Average power dissipation

All outputs open

fosc

Internal oscillator frequency

Rext

Ci

Small-signal input capacitance, K inputs

V, =OV,

f =

1 kHz

10

pF

Ci(¢1

Input capacitance, clock input

V,-OV,

f - 100 kHz

25

pF

t All typical values are at VOO

= -15

V, T A

= 50 kn,

Cext = 47 pF

250

= 25°C.

NOTE 1: The algebraic convention where the most-positive (least-negative) limit is designated as maximum is used in this specification.
for logic voltage levels only.

1-D5

c

Chapter 2

w

~
IX:
oQ.

THE MOSTEK 3870
(AND FAIRCHILD F8)

IX:

o

U

~

en
w
I~

g
en
en

~

all
w
Z
IX:

oen

en

o

~

~

c

~

@

The F8 has had a profound Impact on the microcomputer Industry. When it first appeared, the F8 was discussed
as an off-beat product with a strange set of chips and a ridiculous Instruction set. The chip set was strang~
because logic was organized with the goal of minimizing chip counts: In contrast, microprocessors such as the
8080A and 6800 were designed with logic distributed functionally on chips - one traditional CPU logic function
per chip. The F8 instruction set is indeed strange, and in some cases quite limiting, but it reflects the simple
chip design of the F8 CPU.
Many microprocessors are now going into consumer products. In this marketplace, the two-chip F8 system provided by a 3860 CPU and a 3861 PSU gained an early dominant position. Other microprocessors available when
the F8 was introduced required seven or more chips to provide the same capabilities as the two-chip F8. The
economics of consumer product volumes rendered the inefficiencies of the F8 instruction set inconsequential:
as a result, in 1977 the F8 was the world's leading microprocessor in terms of CPU sales.
.
In recognition of the F8 success story, most microprocessor manufacturers have introduced one-chip and twochip microcompu~er systems.
Since the F8 3850 CPU/3851 PSU configuration was the world's first two-chip 8-bit microcomputer system. the F8 was
the easiest 8-bit microprocessor to convert into a one-chip microcomputer. Fairchild, the F8 prime source, and
Mostek, the F8 second source, both designed one-chip microcomputers around the F8. Fairchild des'gned the
3869, which was a simple combination of the 3860 CPU and 3861 PSU on a single chip. Mostek developed a
more ambitious one-chip microcomputer, the 3870. Mostek developed the 3870 ahead of the Fairchild 3859:
therefore, Fairchild dropped the 3869 and became a second source for the 3870. Thus. the original F8 second
source. Mostek. is now the new prime source. while the original prime source. Fairchild. is now a second source.
The majority of F8 customers have small configurations which convert readily to the 3870. This being the case. the
3870 is the F8 product being actively marketed, while the old F8 chip set is now manufactured to meet the needs of
existing customers and to represent a possible expansion for any customer whose application will no longer fit within
the confines of the 3870. In this chapter, therefore, we begin by examining the 3870 in detail. Dl3scriptions of the
F8 CPU and its support devices follow.
.

r-------.....,.
THE FAIRCHILD

These are the F8 devices described:

F8 DEVICE SET

- The 3860 CPU.
- The 3861 Programmable Storage Unit (PSU), which provides read-only memory plus
various additional logic functions.

- The 3862 Dynamic Memory Interface (DM!), which primarily provides interface logic for dynamic or static
read-write mem~ry.
- The 3863 Static Memory Interface (SM!), which primarily provides interface logic for static read/write memory.
- The 3864 Direct Memory Access (DMA), which, in conjunction with the 3862 DMI, implements Direct Memory Access logic.
'
- The 3866 and 3867 16K Programmable Storage Units (PSU 16), which are variations of the 3861 PSU b4t provide more read-only memory.
- The 3861 PIO, which provides the additional logic functions of the 3861 PSU but has no read-only memory.
- The 3871 PIO, which is equivalent to the 3861 PIO but has logic characteristics identical to thp 3870.
Some additional 3870 series products are planned for delivery in late 1978 and early 1979.

2-1

The 3872 is identical to the 3870. except that program memory is doubled from 2048 to 4096 bytes. The 4096 bytes of
program memory are configured as 4032 bytes of read-only memory and 64 bytes of read/write memory. Thus. the
3872 will have 128 bytes of read/write memory. of which 64 are in the scratchpad and an additional 64 are in external
memory.
The 3873. which will probably be available in early 1979. is equivalent to a 3870 with one serial I/O channel added.
The 3876. which will probably be available in late 1978. is equivalent to a 3870 with 64 bytes of additional read/write
memory; that is.to say. in addition to the 2048 bytes of program memory there will be 64 bytes of scratchpad memory
and an additiona>1 64 bytes of external read/write memory. This additional 64 bytes of external read/write memory will
have a low power standby option. allowing you to maintain data in these 64 bytes while power has been removed from
the rest of the device.
.
Figure 2-1 illustrates logic associated with individual F8 devices, and the 3870 one-chip microcomputer.

All devices of the F8 family require +5V and +12V power supplies. The 3870. however, uses a single +5V power supply.
Using a 500 nsdock. instruction cycle time is 2 ,""sec. Instruction execution times ·rangefrom 1'to 6.5 instruction cycles. or 2 to 13 ,""sec.
. .
N-channel isoplanar MOS technology is used for the F8.
N-channel ion injection technology is used for the 3870.
The 3870 Microcomputer

.----------------------------,
:

3850 CPU

3851, 3856 or 3857 Program Storage

I

Unit (PSU)

I
I
I

n
eques
I~~~R

-

-

I
I/O Port I/O ~ort

I/O Port I/O Port

•

,~

,

,

'.

--

~

~

r

II

3853 Static
Memory Interface .
(SMJ)

/

Prog Timer

Prog Timer

64-byte RAM
ALU
and.
CU

Interrupt Request

ROM

,--__

- --

RAM
INTERFACE
LOGIC

__ ...J

'Mem Addr Log

Jt

STATIC
RAM

t

I~

SYSTEM BUS
~

DYNAMIC
or
STATIC
RAM

~

I~

r

'.

r
RAM
INTERFACE
LOGIC
DMA CONTROL

- ..
~

/

/

--

3852 Dynamic Memory Interface
(DMJ)

-

DMA
. CONTROL
LOGIC

'"

A maximum of 65,536 bytes of memory may be present in an F8 microcomputer system.

Figure 2-1. A Fairchild/Mostek F8 Microcomputer System

2-2

3854 Direct
Memory Access
(DMA)

I

The principal manufacturer for the F8 is:
FAIRCHILD SEMICONDUCTOR .
464' Ellis Street
Mountain View. CA 94040
Q

The second source is:

w

~
a:
oQ.

a:
o
u

~

MOSTEK. INC.
P.O. Box 169
Carrollton. TX 75006
The principal manufacturer for the 3870 is:
MOSTEK. INC.
P.O. Box 169
Carrollton. TX 75006

en

w

l-

e:(

g
CI)
CI)

e:(

ciS

w
Z

a:

o

In
CI)

o

~

e:(
Q
e:(

Second sources are:
FAIRCHILD SEMICONDUCTOR
464 Ellis Street
Mountain View. CA 94040
MOTOROLA. INC.
Semiconductor Products Division
3501 Ed Bluestein Blvd.
Austin. TX 78721

@

.THE 3870 ONE-CHIP MICROCOMPUTER
Functions implemented on the 3870 microcomputer are illustrated in Figure 2-2.
Some caution must be exercised when looking at Figure 2-2; functions shown as present should not always be
considered equal to larger systems. For example. read/write memory and memory addressing are shown as completely
present: however. only 64 bytes of read/write memory are provided. with no possibility of expansion. I/O ports and interface logic are shown as provided. but the 3870 itself has only four I/O ports. Programmable timers and interrupt handling logic are shown as present. yet only one interrupt request line is available and only one programmable timer is
present -- again with no possibility for expansion.
There is. in fact. a sharp contrast between the expansion philosophy of the 3870 as compared to
the Intel 8048. The 3870 is simply not expandable: if your application overflows the 3870 you
can keep your programs, but you must revert to the F8 chip set. In contrast. the 8048 is expandable. albeit in a somewhat clumsy fashion. Thus. when an application overflows a 3870. you can keep your programs but you must throwaway your 3870 chips. When an- application overflows the 8048. you can keep the 8048
already in hand. using expansion capabilities to support new functions.

2-3

it

",,'.',.....

"'>"",'

i<

/)

......

.( J. ,jJ
.,"

'\ A;ithM~tis~Hd' \

Acc~mulat?r

: ;
~,.,

.)~9gic Unitii
.. ,',.........".,.
.... ::).: ...

R~gistens)
""""",.

,.....

','"
':','.

.:'.

..

""

,
Interrupt Priority
Arbitration

•••••••

Stack Pointer

"""'"

'".

Direct Memory
Access Control
Logic

8~~ I~t~rtace

..
>Logi'9''')'''''''~< "i'.' I' ....,:':'... ............, Program Counter

"/i:,'!/
'

.....

•••••••i

•
i"'::"""

,"',','

"'"

,':..

'i'

......

~.

it

. ,?

"."".,

'}" >t:
~

1/ a Communication

ROM Addressi;'~

Serial to Parallel
Interface Logic

t.\'iiiand
•.'. • :Interface~&glc\

RAM>Addressing

IJqf'oris
Interface Logic

- \aod")/<\
.• :,19terfil~eiLogic

xi'
.,"

,.,

",.,

...,
I/Oports ""'.'\

("E~g~ralTIma?,',Ef

Timers,"':',)i}::,

,

.Read/Write
)i<

Figure 2-2. Logic of the Fairchild/Mostek 3870 Microcomputer

2-4

:.-

3870/F8 PROGRAMMABLE REGISTERS
These are the programmable registers of the 3870 and F8:

cw

I-

<
a:
oa..

I

Accumulator (A)

8 bits

11 bits in the 3870,116 bits in the F8 Program Counter (PCO)

a:

11 bits in the 3870,16 bits in the F8' Program Counter buffer, or Stack register (PC 1)

lJ

11 bits in the 3870,16 bits in the F81 Data Counter (DCO)

o

~

rJi
w

I-

<
(j
o
II)
II)

<

o1S

w
Z

11 bits in the 3870116 bits in the F8 Data Counter buffer (DC 1)

I

6 bits

1

5 bits

oera

II)

."

<
C
<
@

DCO or PCO registers ..

o

o

1

1

2

2

I

I

4

.

J

9

11

9

HU

10

12

A

H

.,,{

HL

11

13

B

K

. - { KU
KL

12

14

C

13

15

D

Q

.. {QU

14

16

E

QL

15

17

F

16

20

10

58

72

3A

59

73

3B

60

74

3C

61

75

3D

62

76

3E

63

77

3F

o

~

I

,

W register .....

PC 1 (Stack) register ....

o

~:I
I

Status register (W)

DCO register :4

§

. ,

Scratch pad Address register (lSAR)

a:

Scratchpad Byte Address
Decimal
Octal
Hexadecimal

Scratchpad

,

H is equivalent to a Data
Counter buffer register
K is equivalent to a Stack
register buffer
Q is equivalent to a Data
Counter or Program Counter
buffer register

I

",

There is one 8-bit Accumulator, which may be likened to the Primary Accumulator (AO) of
our hypothetical microcomputer. Wherever there is a choice, this Accumulator is the usual
source or destination for data operations associated with any instruction's execution.

2-5

3870/F8
ACCUMULATOR

The 64-byte scratchpad may be viewed either as a small read~write memory, or as 64 8bit secondary Accumulators. The first 11 scratchpad bytes may. be accessed directly. as
though they were secondary Accumulators. Remaining RAM bytes can only be accessed using
a form of implied memory addressing. where a 6-bit register (identified as the ISAR register) must provide the address
of the byte being accessed. The ISAR register is in every way identical to a 6-bit Data Counter.
Data Counter DCO is an implied addressing register, as described for our hypothetical
microcomputer.
..
.

3870/F8 DATA
COUNTERS

Data Counter DC1 is simply a buffer for the contents of Data Counter DCO. Implied addressing via Data Counter DC 1 is not allowed. The only instruction that accesses Data Counter DC 1 is an instruction which
will exchange the contents of Data Counters DCO and DC 1.
Program Counter PCO serves the same function in a 3870 or F8 system as it does in
our hypothetical microcomputer.

3870/F8 PROGRAM
COUNTER

3870/F8 STACK
The Stack register (PC1) is, in reality, a buffer for Program Counter PCO; the Stack register
does not address an area in read-write memory. and there arena Push or Pop instructions as
REGISTER
described in Volume I. Chapter 6. Interrupts and Jump-to-Subroutine instructions save the
contents of Program Counter PCO in Stack register pct before loading a new address into Program Counter PCo:

Old Address from

pca

is moved to PC 1

NeWAddr~ss"

.

~

I'-e.. ?J
Program Counter

I~ -",
pea

Old Address in

/ ' PClislost

.

Stack register PCl

The classical Stack can be implemented in a 3870 or F8 system. but a short program needs to be written to do this.
Read-only memory is always addressed using implied addressing, with auto-increment, via
Data Counter DCO. No other memory addressing modes are provided.

MEMORY
ADDRESSING

There are a number of instructions which load immediate data into Data Counter DCO; data may also be transferred
between Data Counter DCO and scratchpad bytes. and it is possible to add the contents of the Accumulator to Data
.
.
Counter DCO.
In order to understand scratchpad addressing, one has to view it as representing neither 64
Accumulators nor 64 bytes of read-write memory, but rather as something between the
two.

SCRATCH PAD
MEMORY
ADDRESSING

3870 MEMORY ADDRESSING MODES
The 3870 microcomputer has two separate and distinct memories:
1)

There is the 64-byte scratchpad. which is the only read/write memory available.

2)

There are 2048 bytes of read-only memory. which must contain all programs. but may also contain constant data.

We will refer to addressing of the 64-byte scratchpad as "scratchpad addressing", while "memory addressing"
refers to the 2048 read-only memory bytes.
It is important to note that the scratchpad and the read-only memory have separate and distinct address spaces.
Scratchpad locations have addresses in the range 0 through 6310. while read-only memory locations have addresses in
the range 0 through 204710. Thus. addresses 0 through 6310 can access both a scratchpad byte and a read-only
memory location; however. this will never cause confusion since separate and distinct instructions access scratchpad
as against read-only memory. Since no one instruction can access both scratchpad and read-only memory. there is no
possibility for confusion.

2-6

Instructions which access scratchpad memory use the four low-order object code bits to identify Scratchpad Addressing mode. as follows:
654

o

2

~_.........I_...r.._.........._

...

c

,,---Sit No.

·I_..I.-

...

L

w

~
a:
oa..

a:

o

CJ

~

en
w

Scratchpad access instruction object code

~} Directly address one of Scratch pad bytes 0 through 11
1011
1100·
1101

I-

1110

ct

g
en
en

ct
oil
w
Z

a:

otil

S - Implied addressing via ISAR
I - Implied addressing via ISAR
with auto-increment of three
low-order ISAR bits.
D - Implied addressing via ISAR
with auto-decrement of three
low-order ISAR bits.

There are a number of register-register instructions that operate on the Accumulator and on one of the first 12
scratchpad bytes, using object codes as follows:

o

65432

"'-SitNo.

en

o

:E

ct
c
ct

@

0000
One scratch pad byte from bytes 0 through 11 is specified
1011
An instruction that accesses the Accumulator and one of the
scratchpad bytes is specified

This type of object code treats the first 12 scratch pad bytes as secondary Accumulators.
Any scratchpad byte may be addressed via the ISAR register using implied addressing; that
is to say. the 6-bit number in the ISAR (which can have a value in the range 0 through 63) identifies the one scratchpad byte which will be accessed by the next scratchpad referencing instruction.
The ISAR register provides implied addressing. and implied addressing with auto-increment or
auto-decrement: however. only the low-order three bits of the ISAR register are involved in the
auto-increment or auto-decrement operation:
5

4

o

3

DIRECT
SCRATCHPAD
ADDRESSING

IMPLIED
SCRATCHPAD
ADDRESSING

.....-SitNo.

·TTL--

l...........i-.....I!..-ISAR

l...-""'--'r.........I...........

-

These three bits may be incremented or decremented by ~n implied addressing scratchpad memory reference with auto-increment/decrement.
Specifies an instruction that accesses the Accumulator and one
of the scratch pad bytes

F8 scratch pad bytes may therefore be ·accessed as contiguous 8-byte buffers. with wraparound auto-increment or
auto-decrement within each 8-byte buffer.

2-7

Instructions shown in Table 2-2 use the symbol r in the operand to represent scratchpad addressing. This is what the symbol r represents:

rSCRATCHPAD
ADDRESSING

- If r is a number between a and 11. one of scratchpad bytes a through 11 is addressed directly.
- If r is S. implied addressing via ISAR is specified.
- If r is I. implied addressing via ISAR. with auto-increment of the low-order three implied address bits. is specified.
- If r is O. implied addressing via ISAR. with auto-decrement of the low-order three address bits. is specified.
Given the various ways in which scratchpad memory can be addressed. this is the most effective way of configuring
scratchpad:

o

89 AB C 0 E F 10

1718

2728

1F20

3738

2F 30

3F

11111111111111111111111111111111111111 111111111111111111111111111
Secondary
Accumulators

H

K

Q

tt+

Buffer 1

Buffer 2

Buffer 3

Buffer 4

Buffer 5

Buffer 6

Dot, Co""to, IDCOI 0' Prog"m Cou",,, IPCOI buff"
Stack (PC 1) buffer
Data Counter (OCO) buffer

' - - - - - - - - Status register (J) buffer

Treat scratch pad bytes a through
dreSSing.

8 as nine secondary Accumulators:

access these bytes using direct scratchpad ad-

Wherever possible. use scratchpad bytes 9 through F only as buffers for their associated registers: when accessing
these bytes. use the specific instructions which transfer data between these scratchpad bytes and their associated
registers.
Although you can address scratch pad bytes 9. A. and B by using direct addressing. do not do so when these
scratchpad bytes are being used as buffers for the Status registers (W) and Data Counter (DCa).
While indirect addressing via ISAR can access anyscratchpad byte. you should avoid addressing scratch pad bytes a
through F in this fashion. Wherever possible. use ISAR only to address scratch bytes 1a16 through 3F16: divide this
area into 8-byte buffers as illustrated. Because I addressing auto-increments only the three low-order ISAR bits. this
form of scratchpad byte addressing will wrap around within one 8-byte buffer. as follows:
ISAR

X

X

X
X
X

x

X

x

0

x

0
0

0

1

X
X
X

0
0

1
1

0

1
1
1
1

0
0

0

1
1

0

0
0

0
0

0'

X
X
X

X
X
X

X
X
X
X
X
X
X

x

x

x

x

x

0
1
1
1
1

etc.

Similarly. 0 implied addressing via ISAR will wrap around within eight scratchpad byte divisions. as follows:
ISAR

X
X
X
X
X
X
X
X
X
X

X
X
X
X
X
X
X
X
X
X

X
X
X
X
X
X
X
X
X
X

0

0

0

1
1
1
1

1
1

0

0
0
0
0

etc.

2-8

0

1
1
0
1

0
1
1

0

0
0

0

1

1

3870/F8 STATUS FLAGS
The Status register, also called the W register, holds five status flags, as follows:

4 3 2
o
.-'1-.................

Bit No .
Status register (WI

Q

w

~
a:
o0.
a:
o
o
~

enw·
l-

e(

' - - - - - - - Interrupt Control Bit

U

o

(I).
(I)

e(

01:1

w
Z

a:

o

III

The O. Z. C and S status flags are identical to the flags with equivalent symbols. as described in Volume I. Chapter 6 for
our hypothetical microcomputer.
The Interrupt Control bit is treated as a fifth status; this status will not be modified by arithmetic or logic operations.
but it will be transferred. as a unit with the other four status flags. to or from Scratchpad byte O.
'

(I)

o

~

3870 PINS AND SIGNALS

Q

3870 pins and

e(

e(

si~nals

are illustrated in Figure 2-3.

@
XTL1
XTL2

Po:O.
PO-1 !
PO-2 '
PO-3
STROBE
P4-0
P4-1
P4-2
P4-3

P4:4
P4-5
P4-6
P4-7
PO-7
PO-6
PO-5
PO-4
GND

..

-

---.-.

...
...
...

...
i.

.

---,- -..
~

-- ........

--.. ....

-- ...--- ..
...

-- ....

~.

...

1
40
2
39
3
38
4
37'
5
36
6
35
7
34
8
33
9
32
3870
10
31
11 Microcomputer 30
12
29
13
28
14
27
15
26
16
25
17
24
18
23
19
22.
20
21

-----... ..-

:...-~

-- -..
~

---

.....

----- -'...~

~

-.- .....
.:

--- ...
~
~

--- .--..
----~

~

Pin Name

Description

Type

PO-O - PO-7
Pl-0 - Pl-7
P4-0 - P4-7'
P5-0 - pg:r
STROBE
EXTINT
RESET
TEST
XTL1. XTL2
VCC. GND'

I/O Port 0
I/O Port 1
I/O Port 4
I/O Port 5
Ready Strobe
External Interrupt
External Reset
Test Line
Time/Clock
Power Supply Lines

Bidirectional
Bidirectional
Bidirectional
Bidirectional
Output
Input
Input
Input
Input
Input

Figure 2-3. 3870 Microcomputer Signals and Pin Assignments

2-9

32 of the 40 signals implement four 8-bit I/O ports, which are addressed as 1/0 Ports 0, 1, 4 and 5.

Pins POO through P07 implement I/O Port O.
Pins P10 through P17 implement

i/o Port 1 ~

Pins P40 through P47 implement I/O Port 4.
Pins P50 through P57 implement I/O Port 5.
I/O port characteristics are described following signal definitions.

STROBE is a handshaking control signal associated with I/O Port 4. Whenever data is output to I/O Port 4, STR08E
is pulsed low for approximately three ~Iock periods.
External interrupt requests are input via EXT INT.

RESET is a master reset input. When it is grounded, the following events occur:
1)

Program Counter contents (PCO) are pushed onto the Stack register (PC1,).

2)

The ICB bit of the Status register is reset to 0; this di~ables all interrupts.

3)

1/0 Port 4 and 5 pins all output +5V. Reset does not affect I/O Port 0 and 1 pins.

4)

Other internal registers are not affected.

The TEST input is used to test hardware. Normally the TEST pin is connected to ground, or it is left unconnected.
When a voltage between 2V and 2.6V is connected to TEST. 1/0 Ports 4 and 5 become output and input connections to
the internal Data Bus; as follows:

' l:___~__ ._----"'"T":-J
'TI-/l
______.....l"_'_

~

Data Bus

-----------~-----,

I/O
Port false.
5 is a(Port
wire-OR
th,e0)internal Data Bus; it is
logically
pin 1 input
= DatatoBus

--.. I/O Port 4 is, the internal Data Bus output; it is logically true:
(Port pin 1 = Data Bus ,1)

When a voltage level between +6V'and +7V is applied to the TEST pin, I/O Ports 4 and 5 are connected to the internal
Data Bus as illustrated above; but. in addition, internal program memory is disconnected from the Data,Bus. This allows
instruction codes to be entered via I/O Port 5. '
.

The TEST pin should be used for test purposes only. Do not use TESTduring normal 3870 operations. You cannot. for example, use TEST as a means of transferring data between the Data Bus and external logic via I/O Ports 4 and
5. Also, you cannot use TEST to supercede internal program memory, with an external program memory. This is
because timing associated with the test conditions differs markedly from normal instruction execution timing.
XTL 1 and XTL2are clock signal inputs. These two clock signal inputs can be used in one of
four ways.

3870 CLOCK
LOGIC

If XTL 1 and XTL2 are both grounded. then an internal oscillator within the 3870 generates the clock signal. Internal oscillator frequencies ranging between 1.7MHz and 4MHz are allowed.
An external crystal may be connected across XTL 1 and XTL2; in this case the external crystal determines clock frequency. Any frequency in the range 1 MHz to 4 MHz is allowed. There are internal 20 pF capacitors between XTL 1 and
ground and XTL2 and ground; therefore, external capacitors are not required. This may be illustrated as follows:
XTL 1

t------.. .

o
XTL2

t------...J

2-10

1 MHz to 4 MHz

If an external clock signal is used, then it should be applied to pin XTL2, and pin XTL 1 should be left open.
The internal clock signal generated will have a frequency that is half of the external clock signal frequency. For example. in order to generate a 1 MHz internal clock signal. a 2 MHz external clock signal must be applied to pin XTL2.

c

It is also possible to generate the internal 3870 clock signal using resistor capacitor (RC) or inductor capacitor
(LC) circuits. The RC mode may be illustrated as follows:

w

~
a:
o
Q.

R
XTL2

VCC

~-----""-""";~",""--.I

rc:

o(.)

C

~

enw
I-

XTL1

ct

(Capacitor C is optional)

~-----.

C3
o(I)
(I)

ct

R

ell

Capacitance
Minimum frequency
Maximum frequency

w

Z

a:

o

4Kil Minimum
20.5 pF + 2.5 pF + C
1/(1.1 RC + 65 ns)
1/(RC + 15 ~s)

!XI
(I)

o

~

ct
c
ct

The external capacitor C is optional. since there is a 20.5 pF internal capacitor.
The LC mode may be illustrated as follows:

@

Inductor L = 0.1 mH (minimum)
Inductor quality =. (Q) = 40
If the external capacitor (C) is present. it must be 30 pF or less.
Capacitance
10 pF
1.3 pF + C
Frequency = 1/(2 7T J1C)

±

3870 INSTRUCTION TIMING 'AND EXECUTION
All 3870 instructions execute as a sequence of "Iong" and "short" machine cycles. A long machine cycle lasts
six clock periods. A short machine cycle lasts four clock periods. For each 3870 instruction. Table 2-2 identifies the
sequence of long and short machine cycles via which the instruction executes. By referring to this table. you can compute instruction execution times as a function of clock frequency.
Note that Table 2-2 refers to ROMC states. ROMC states have no meaning when you are using a 3870: however. they
constitute five signals output by the 3850 CPU in an F8 configuration. as described later in this chapter. Since Table
2~2 applies to both the 3870 and the F8. ROMC states are identified.

3870 I/O PORTS
The 3870 has four 8-bit I/O ports, which we defined when describing 3870 pins and signals. I/O ports are addressed via port numbers 0, 1, 4, and 5. I/O port addresses 6 and 7 are also reserved by the 3870; I/O Port 6 is
used' to output control codes and to input interrupt status. I/O Port 7 is used to acc~ss interval time~ logic.

O. 1. 4. 5. 6. and 7 are the only I/O port addresses which have any meaning within a 3870. Output instructions that address any other I/O port act as "no operation" instructions. Input instructions that address any other port will clear the
Accumulator. Nevertheless. the 3870 instruction set. as oefined in Table 2-1. includes both long-form and short-form
I/O instructions. allowing any I/O port to be accessed with addresses in the range 0 through 255. This permits the 3870
instruction set to be completely compatible with the full F8 instruction set -- a necessity if 3870 programs are to be
transportable to larger F8 configurations.
.

2-11

Everyone of the 3870 1/0 port pins is truly bidirectional. Logic associated with each pin may be illustrated as
follows:
.

Vee

~
c0

Output
Buffer

..,.
~

::l

o

en

'E0

Q

Port
I/O
Pin

()

a:
0

-C'
~

]

en

:J
al

«
~
0

0

Ia:
0

0

0

l-

a:
0..

0..

~ 0«
a: .....I

The pin logic illustrated above is present in the 3870 microcomputer and the 3871 PIO only; other devices have
the F8 1/0 pin characteristics.
.
If you do not understand digital logic. then you will not understand the illustration above. but that is not particularly important. The above illustration explains exactly how bidirectional 110 port pin logic works. From a programmer's point
of view. this simply translates into the fact that you can freely input and output data without worrying about prior 1/0
port contents. However. all 1/0 port pins have inverted logic. This means that when you write 1 to a!1110 port pin a 0
voltage will be generated. while a +5V voltage will be generated if you output 0 to the pin. Conversely. external logic
will cause your program to input 1 if it grounds a pin. while it will cause your program to input 0 if it applies +5V to the
. .
pin.

The output buffer portion of 1/0 port pin logic determines th,e pin characteristics. Standard TTL logic is provided
by the standard output buffer, which may be illustrated as~ follows:

vee

I

2-12

6K II (typ;""n

You can buy 3870 devices with different output buffers at I/O Port~ 4 and 5. but not at I/O Ports 0 and 1. I/O Ports 0
and 1 pins can only have the standard output buffer illustrated above. There are two optional output buffer designs
available for phls of I/O Ports 4 and 6. A direct drive output is similar to the standard output. but it sources more current. Logic is illustrated as follows:

Vee

c

w

~
a::
oa.

, 1K

n (typical)

a::

o

u

~

en
w

...

g<
(I)
(I)

<
oil

w
Z
a::

--

o

en

(I)

o

~

The other option is an open drain output. which may be illustrated as follows:

c<

1-

@

The open drain output allows you to tie pins together: you can then wire-AND two or more pins when data is output.
Consider the following configurations:

P43
, P44
P45

~

--...-j--

-~----....
-

If all outputs are high. then the wire-AND will be high: however. if anyone of the three outputs goes low. then the wireAND resulti~g from all three outputs will also go low.

3870 INTERRUPT LOGIC
External logic can input an interrupt request to the 3870 via the EXT INT signal.
Interrupt requests may also be generated internally by timer/counter logic.
There are two levels of interrupt enable/disable logic within the 3870; There is a Control
register (described later in this chapter) which has bits 0 and 1 set aside to selectively enable or disable external interrupts and timer/counter interrupts, respectively. If one or both of
these interrupts are enabled. then any interrupt request is still subject to master ena-

2-13

3870
INTERRUPT
DISABLE

ble/disable logic, which is specified by the Interrupt Control bit of the Status register (bit 4 "of the W register).
This may be illustrated as follows:
-----------~~ To CPU

""1

a ...

432

Bit No.

....~--- Status register (W)

Latch

ta=

For all bits:
1 =enable
a = disable

,-"-.

7

6

5

4

"2

3

1

Ix I

1

a ......
._---

~t~

Bit No.

Control

,,.;,ie,

External Interrupt

•

TIme,/Counte, ,Inte"upt

A timer/counter interrupt request is latched. If timer/counter interrupt logic has been disabled via Control

register
bit 1. then an interrupt request will be held until timer/counter interrupts are subsequently enabled; the interrupt request will then occur.
External interrupt requests are not latched. An external interrupt request will only occur if the EXT INT signal makes
an active transition while external interrupts have been enabled by Control register bit O.
Ariy inteh'upt request that reaches Status register logic will be latched, Thus. if Status register bit 4 is 0 when
either an external interrupt request or a. timer/counter interrupt request occurs. then the interrupt request will be held
pending until Status register bit 4 is subsequently set to 1.
.
A reset or power-on operation disables all interrupts: the Status and Control registers are cleared.
Timer/counter interrupt requests have priority over external interrupt requests. Thus. if a timer/counter interrupt
request and external intertupt request occur simultaneously and both are enabled. then the timer/counter interrupt request will be acknowledged.
When any interrupt request is acknowledged, further interrUpts are disabled via the Status register: however. interrupt enable/disable logic associated with the Control register is not affected. Thus. an external interrupt request will
be held pending for the duration of a timer/counter interrupt seivice routine's execution. However. the external interrupt request will be removed if. at any time while it is held pending. external interrupts are specifically disabledvia bit 0
of the Control register. .
. .' ..
.

If a timer/counter interrupt request is generated while an external interrupt service routine is being executed. then
Status register interrupt disable logic will prevent the timer/counter interrupt request from interrupting the external interrupt service routine. However. the timer/counter interrupt request will beheld pending until interrupts" are subsequently enabled at the Status register. If for any reason timer/counter interrupts have been specifically disabled via
Control register bit 1. then any subsequent timer/counter interrupt request will be delayed until timer/counter interrupt
logic is specifically enabled via bit 1 of the Control register.
When an interrupt request is acknowledged. the Program Counter(PCO)"contents a~e s8vedon the Stack register (PC 1).
For a Timer interrupt request. a new value.. 02016.
into the Program
Counter:
'. is loaded
"
I.

a2a16~

I,

~
I

I

~I~'~~

pca

PC1

2-14

When an external interrupt request is acknowledged. Program Counter (PCO) contents are saved in the Stack register
(PCn then the new value OA016 is loaded into the Program Counter (PCO). Thus. interrupt service routines for timer
and external interrupts must originate at memory locations 02016 and OAO 16. respectively.
Since a reset or power-on clears the Program Counter. the beginning of program memory must be allocated thus:
Program
Memory

o

w

~
a:
o0..

a:
o
u

000

...
.:~-·Initialization begins here

020

Timer interrupt service routine
...._...- - begins here

OAO

__
Extemal interrupt service routine
...
-~- begins here

~

ui
w

~

g
fI)
fI)

~

Gl:I
w.
Z

a:

oID

fI)

o

TIMER/COUNTER LOGIC
3870 timer/counter logic represents a significant enhancement over prior F8 logic.
3870 timer/event counter logic consists of an 8-blt binary Counter register together with a Buffer register and
associated logic. The two registers are accessed as I/O Port 7. Data output to I/O Port 7 is written into the Counter
register and the Buffer register. Data input from Port 7 is read from the Counter register only. This may be illustrated
as follows:

::i:

~

Buffer Register

~

@
Out to - - - I/O Port 7
__
_~

In from I/O Port 7

The scheme illustrated above allows timer/counter logic to operate in a "free running" mode. Whenever the contents
of the Counter register decrement to O. the new Counter register contents are taken from the Buffer register. and a
timer interrupt request occurs. This may be illustrated as follows:
Counter
Buffer
Register
Register
. Contents
Contents
02
. xx
01
xx
---.;-------...~ Timer interrupt request
00
xx
xx
xx.
xx-1
xx
xx-2
xx
etc.
etc.
You can read Counter register contents at any time. eVE!n while the timer/counter is operating. by inputting from I/O
Port 7: Counter register contents will be input.

Timer/counter logic can be operated in Interval Timer mode, in Pulse Width Measurement mode, or in Evant
Counter mode. The contents of a Control register (which is accessed as I/O Port 6) determine the mode.in which
timer/counter logic will operate. We will describe the Control register after discussing timer/counter operating
modes.

2-15

In Interval Time~ mode, timer/counter logic is used to compute time intervals. In order to
3870
compute a time interval, the timer/counter register contents are decremented at fixed
INTERVAL
"decrement" intervals. The decrement interval is equal to a number of clock periods. as
TIMER MODE
specified by the control code. The decrement interval may range between a low of two clock
periodsahd a high of 400 clock periods. If. for example. a 500 nanosecond clock is employed and the decrement interval is 100 clock periods. then the Counter register contents will be decremented once every 50 microseconds. If the initial value output to I/O Port 7 is 20010 (C816). then in Interval Timer mode. timer/counter logic will time out once every 10 milliseconds.
Time interval = 0.5 x 100 x 200 microseconds
The time delays which can be generated using timer/counter logic in Interval Timer mode are given by the following
equation:
Time interval = Reset value x Decrement time interval
The reset value is the value written out to I/O Port 7; it may have any value in the range 0 through 255. 0 is in fact
equivalent to a count of 256. since the decrement ends with a Timer interrupt request when Counter register contents
decrement from 1 to O.
In Interval Timer mode, timer/counter logic operates as follows:
1)

An initial value must be output to I/O Port 7. This becomes the reset value.

2)

Using an appropriate control code. you select Interval Timer mode and options. The control code also starts and
stops timer/counter logiC in Interval Timer mode.

3)

Once started by an appropriate control code. the Counter register continuously decrements. reloads. and redecrements.

4)

In order to stop the timer/counter when operating in Interval Timer mode. you must output ari appropriate control
code.

Each time the Counter register decrements to b. a ti~er interrupt request is generated. If timer iniernlp~ requests are
enabled. then the interrupt request will be ackn6wledged; if timer interrupt requests are disabled. the interrupt request
will be latched and will be held pending until timer interrupt requests are subsequently enabled.
If interrupts are enabled when timer/counter logic times out in Interval Timer mode. there will be a small time delay
before the interrupt is acknowledged; no interrupt cah be acknowledged until the conclusion of the currently executing
instruction. plus the next instruction if it is privileged. (Privileged instructions are instructions which cannot be interrupted; they are identified in Table 2-1.) In the worst case. it is possible for 49 clock periods to elapse be.tween the
timer/counter timing out and a timer interrupt being acknowledged; on the average. between 24 and 30 clock periods
will separate these two events. If long delays between a time-out and interrupt acknowledge are not aC<:eptqble. then
you must avoid executing privileged instrLJctions while timer/counter logic is operating in Interval Timer mode.
In P~lse Width Measurement mode, timer/~aunter logic measures the duration of a pulse
which is input on the EXT INT pin. Under program control. you can measure a low pulse:

EXTINT

\

3870'
PULSE ,WIDTH
MEASUREMENT
MODE

I
+

+

START
TIMER

STOP
TIMER

or you can measure a high pulse:
EXTINT

I

\_----

-4
START
TIMER

STOP
TIMER

Stop and start logic represerits the only difference between Pulse Width Measurement mode and Interval Timer mode.
As illustrated above. it is EXT INT signal transitions that start and stop timer/counter logic in Pulse Width mode. In addition. you can use control codes to stop timer/counter logic in Pulse Width mode.

2-16

An external interrupt request occurs at the trailing edge of the EXT INT pulse. This external interrupt request will be
acknowledged only if external interrupts have been enabled. If external interrupts are disabled. no interrupt request occurs. That is to say. if external interrupts are enabled at some point after the end of a pulse. no interrupt request will be
pending.

cw

~
a:
oQ.
a:

o

(J

Within the pulse itself. timer/counter decrement logic works exactly as described for Interval Timer mode. The Counter
register contents are decremented once each decrement interval; the decrement interval is defined in Interval Timer
mode. If the timer/counter does not time-out within the pulse width. then on the trailing edge of the pulse the
timer/counter is stopped. By inputting from I/O Port 7. you read the contents of the Counter register at the trailing edge
of the pulse; the difference between this input value and the initial reset value can be used to compute the pulse duration. as follows:

~

enw
I~

U

oen

Pulse duration = (Initial reset value - final Counter register contents) x decrement time interval
For example. su ppose the initial reset value output to I/O Port 7 is 10010 (6416). while the final value input from I/O
Port 7 is 1610 (1016); if the control code has set timer/counter logic to decrement once every 100 microseconds. then
the pulse width must be 8.4 milliseconds:

en

Pulse width = (100 - 16) x 100 microseconds

~

o!I

w
Z

a:

o

If the Counter register does time-out within a pulse. then a timer interrupt request occurs. the Buffer register contents
are loaded into the Counter register. and decrementing restarts. Program logic must respond to the timer interrupt request by incrementing a scratchpad counter; the total pulse time is computed as follows:

al

en

Pulse duration = (Initial reset value - final Counter register contents)
x decrement time interval
x initial reset value x decrement time interval
x scratchpad counter contents

o

~

~

c

~

@

Suppose. for example. that the initial reset value output to I/O Port 7 is 20010 (C816). and that the Counter register has
timed out three times within the pulse width; the scratchpad counter will now contain 3. If the final value input from
I/O Port 7 is 5310 (3516) and the decrement time interval specified by the control code is 50 microseconds. then the
total pulse timer interval is 37.35 milliseconds:
Pulse interval = (200 - 53) x 50 + 200 x 3 x 50
= 37.350 microseconds

In Event Counter mode, the Counter register contents are decremented on "active" transitions of the EXT INT input. An "active" transition on this signal may be high-to-Iow or low-tohigh. as selected by the control code.

3870
EVENT
COUNTER
MODE

In the Event Counter mode. when the Counter register decrements to 0 a timer interrupt request is
latched. as described for the Interval Timer mode. Thus. if the timer interrupts are enabled. the interrupt request will be acknowledged following execution of the next non-privileged instruction; if timer interrupts are
disabled. the interrupt request will be held until interrupt requests are re-enabled. Active transitions on the EXT INT
signal. while decrementing the Counter register contents. also cause interrupt requests to occur if external interrupts
are enabled. Since it would be pointless to have an external interrupt request occur on every decrement. external interrupts are normally disabled in Event Counter mode.

THE 3870 CONTROL CODE
Operation of 3870 timer/counter logic and interrupt logic is controlled via an 8-bit control code which must bo
output to I/O Port 6. I/O Port 6 is a write-only location. When you input from I/O Port 6, you do not read the contents of the Control register: rather~ the level on the EXT INT pin appoars at bit 7 of the Accumulator. This may
be illustrated as follows:

_~:_g~~~O_elr_~~"':'-';;';;';~$~~~~
I I I I I I I I I
40000000
EXTINT

~}---------------j.' IN
2-17

6

Accumulator

If you need to read the control code after writing it out. then you must keep a copy of it in one of the scratch pad bytes.
Control code bits are assigned as follows:
7

6

5

4

..

3

o

2

",-SitNo.

I I I I I I I I I
I~

I~

~

.~

~.

~

Control code

~
interrupts disabled
~{ o1 Extemal
Extemal interrupts enabled
interrupts disabled
{ o1 Timer/counter
Timer/counter interrupts enabled
INT is active low
{ o1 EXT
EXT INT is active high
Stop timer/counter in any mode
{ o1 Start
timer/counter in Interval Timer or Event Counter modes
~

~

o Interval Timer mode if bits

{

7, 6, 5 are not 000
Event Counter mode if bits 7, 6, 5 are 000
1 Pulse Width Measurement mode. (Do not use 000 for bits 7, 6, 5 in
this mode)
.

+ 2 pre-scalar}
+ 5 pre-scalar
+ 20 p ..-,c,'" ~

+

,---.
7

o

o

o
o
1

6' 5

0
·0

1
1

o

1

o

1
1

1
1

",-SitNo.

o

Event Counter mode

1
0
1
0
1

+ 10 pre_scalar.
+ 20 pre-scalar
+ 40 pre-scalar
'+ 100 pre-scalar
+ 200 pre-scalar

6 . ! ~ ~~:~:~:::~}"
.

.

Pre-scalar x Clock period gives decrement time interval in Interval Timer or Pulse Width Measurement modes
.
.
. '

Bits 0 and 1 are used to selectively enable or disable interrupt requests. External interrupt requests occur via
active transitions on the EXT INT input signal; timer/counter interrupt requests are generated within
timer/counter logic. You have the option of enabling both external interrupts and timer/counter interrupts; you
can enable one but not the other, or you can disable both.
Recall that timer/counter interrupt requests are latched; if timer/counter interrupt logic is disabled (control code bit 1 is
0) whe"n the timerlcounter interrupt request occurs. then the interrupt request will remain pending until timer/counter
interrupts are subsequently enabled (control code bit 1 is 1). or until the 3870 is reset. A reset removes the latched interrupt request. External interrupts are not latched; an external interrupt request will be generated only as EXT INT
makes an active transition while control code bit 0 is 1. A timer/counter interrupt request occurs whenever the
timer/counter register decrements from 1 to O. as previously described.

An external interrupt request occurs whenever an "active" transition is sensed on the EXT INT pin. Bit 2 of the
control code determines what an "active" transition of EXT INT will consist of. If bit 2.is O. then a low level on
EXT INT is considered active. and high-to-Iow transition causes an external interrupt request. If bit 2 of the control code
is 1. then a high level on EXT INT is considered active and a low-to-high signal transition will cause an external interrupt request.
Control code bit 3 is the start/stop bit. This bit must be used to start and stop timer/counter logic when operating in Interval Timer mode or Event Counter mode. When timer/counter logic is operating in Pulse Width Measurement mode.
then leading and trailing edges of an active EXT INT pulse start and stop timer/counter logic; within a pulse. however.
the start/stop bitof the Control code can be used to stop and then restart timer/counter logic.

2-18

In Interval Timer mode or Pulse Width mode. bits 5. 6 and 7 select the decrement time interval. The important point to
note is that bits 5. 6 and 7 are cumulative. Thus. you have seven pre-scalar options shown with the control code.

c

w

~
a:
oQ.

a:
o
o
~

en
w
~

g
C/)
C/)

In Interval Timer mode or in Pulse Width mode. the Counter register contents are decremented once every decrement
time interval. A decrement time interval is equal to the internal clock pulse time multiplied by the pre-scalar. Assuming
a 500 nanosecond internal clock pulse width. 010 in Control register bits 7.6 and 5 would generate a decrement time
interval of 2.5 microseconds. A decrement time interval of 50 microseconds would be generated by 110 in Control
register bits 7. 6 and 5.

THE 38~O/F8 INSTRUCTION SET
Table 2-1 summarizes the 3870/F8 instruction set: instructions are grouped into categories that conform with
our hypothetical microcomputer Instruction set, as described in Volume I, Chapter 7.
.
With reference to Table 2-1. refer to the addressing modes description for an explanation of "r". which occurs in the
operand column to represent some of the scratchpad addressing options.
One of the more confusing aspects of 3870/F8 programming is understanding the ways in which data may be moved
between different registers: this information is therefore summarized in Figure 2-4.

<
a!I

w
Z

a:

o

CD
C/)

o

~.

c<
<
@

The following symbols are used in Table 2-1 :
A
addr
C
data3
data4
data5

DCO
DC1
dpchr
disp
FMASK

The Accumulator
A 16-bit memory address
Carry status
A 3-bit binary data unit
A 4-bit binary data unit
. A 5-bit binary data unit
Data Counter register
Data Counter buffer
Scratchpad Data or Program Counter Half Registers. These are KU (Register 12). KL (Register 13).
(Register 14) and aL (Register 15).
An 8-bit signed binary address displacement
A 4-bit mask composed of a portion of the Status register (W):
3

2

0 ............... Bit No.
I-~--I=FMASK

- - - - - - - - Overflow status

H

ISAR

J
K

o
p4
p8

. PCO
PC1

a

Scratchpad Data Counter Register H (Registers 10 and 11).
The Interrupt Control Bit in the Status register (W).
Indirect Scratchpad Address Register
Scratchpad Register 9
Scratchpad Registers 12 and 13
Overflow status
A 4-bit I/O port number
An 8-bit 1/0 port number
Program Counter
Stack register
Scratchpad Registers 14 and 15

2-19

au

S
sr
TMASK

Any of the following operands and Scratchpad addressing modes:
.
R direct address of bytes 0 through 11
S implied addressing via ISAR
I implied addressing via ISAR. with auto-increment of the low-order
three ISAR bits
D implied addressing via ISAR. with auto-decrement of the low-order
three ISAR bits
Sign status
The register specified by the r argument
A 3-bit mask composed of a portion of the Status register (W):
2

0

~BitNo.

TMASK

~--- Sign status
~----

Carry status

' - - - - - - - Zero status

W
Z
x
[]

[[ ]]
A
V
¥

The CPU Status register
Zero status
Bits y through z of the quantity x. For example. A <3.0> represents the low-order four bits of the Accumulator; addr < 15.8 > represents the high-order eight bits of a 16-bit memory address
Contents of location enclosed within brackets. If a register designation is enclosed within the brackets.
then the designated register's contents are specified. If an I/O port number is enclosed within the brackets.
then the liD port contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified.
.
Implied memory addressing; the contents of the memory location or register designated by the contents of
a register
Logical AND
Logical OR
Logical Exclusive OR
Data is transferred in the direction of the arrow
Data is exchanged between the two locations designated on either side of the arrow

Under the heading of STATUSES in Table 2-1. an X indicates statuses which are modified in the course of the instructions' execution. If there is no X. it means that the status maintains the value it had before the instruction was executed. A 0 or 1 means the status is cleared or set. respectively.

2-20

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 2-1. 3870/F8 Instruction Set Summary
STATUSESTYPE

-g

MNEMONIC

OPERAND(S)

OPERATION PER-FORMED

BYTES
C

Z

S

0

INS

P4

1

0

X

X

0

(A]-[P4]

IN

PS

2

0

X

X

0

Input to Accumulator from I/O port.
[A]-[PS]

OUTS

P4

1

Input to Accumulator from I/O port.
[P4]-[A]

OUT

PS

2

Output to I/O port from Accumulator.
[PS]-[A]
Output to I/O port from Accumulator.

LM

1

ST

1

LR

A.r

1

LA

A.DPCHR

1

LR

r.A

LR

DPCHR.A

1

LR

DCO.H

1

LR

DCO,o

1

LR

H,DCO

1

LR

o.DCO

1

[O]-[OCO]

IU.

U

Z

IU

a:

IU

~

IU

a:
>a:
0

:E
IU
:E
>a:

ia:

[A]-[[DCO)). [DCO]-[OCO]+ 1
Load the Accumulator via DCO and auto-increment DCO.
[[DCOll-[Al. [OCO]-[OCO+ 11
Store the Accumulator via DCO and auto-increment OCO.
[A]-[SR]
Load the contents of the specified register. SR. into the Accumulator. Increment or decrement
ISAR if specified by r.
[A]-[DPCHR]
Load Accumulator with the conterits of the specified DPCHR.
[SR]-[A]
Load the contents of the Accumulator into the specified register. Increment or decrement ISAR
if specifl8d by r.
[DPCHR]-[A]
Load the contents of the Accumulator into the specifl8d DPCHR.
[DCO]-[H]
Load the contents of Scratchpad registers 10 and 11 into DCO.
[DCO]-[o]
Load the contents of Scratchpad registers 14 and 15 into DCO.
[H]-[DCO]
Load the contents of DCO into Scratchpad registers 10 and 11.

LR

PC1.K

1

. L.oad the contents of DCO lnto Scratchpad registers 14 and 15.
[PCl]-[K]

LR

K,PCl

1

Load the contents of Register K into the Stack register.
[K]-[PCl]

LR

pco,o

1

- Load the contents of the Stack register into Register K.
[pco]-[o]

1

Load the contents of Register
[pCl]-[PCO], (PCO]-[oi

a.

PI<

a into the Program Counter.

Save the f=:ontents of the Program cOunter in the Stack register. then ioad the contents of
Register a into the Program Counter.

Table 2-1. 3870/F8 Instruction Set Summary (Continued)

TYPE

MNEMONIC

OPERANDIS)

STATUSES
BYTES ~---r---T--~~--~--~~

OPERATION PERFORMED

c

z

s

o

AS

x

x

x

x

ASD

x

x

x

x

[Al-:[A]+ [SR]
Add binary the contents of the specified register to the cdntents of the Accumulator. Increment
or decrement ISAR if sPecified by r.
[A]--:-[A]+ [SR]

o

Add decil1)al the contents of the sP ]-oATA3
Load immediate into the upper three bits of the ISAR.
[ISAR<2.0>]-oATA3
Load immediate into the lower three bits of the ISAR.
[DCO]-ADDR
Load immediate data into the DCO.
[A<3.0>]-DATA4
Load immediate data into the lower four bits of the Accumulator ..Clear the high four b!ts of the
Accumulator.
[A]-DATA8
Load immediate data into Accumulator.

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 2-1. 3870/F8 Instruction Set Summary (Continued)
STATUSES
TYPE

MNEMONIC

OPERAND IS)

OPERATION PERFORMED

BYTES
C

Z

S

0

AI

DATAS

2

X

X

~

x

NI

DATAS

2

0

X

X

0

01

DATAS

2

0

X

X

0

XI

DATAS

2

0

X

X

0

CI

DATAB

2

X

X

X

X

1&1
~

4(

a:

1&1

a.
0

1&1
~

4(

Q
1&1

Exclusive-OR immediate with Accumulator.

::E

~

[A)-[A) + DATAS
Add immediate to Accumulator:
[A)-[A) A DATAS
AND i.r:nmediate with Accumulator.
[A)-[A) VDATAS
OR immediate with Accumulator.
[A)-[A).y.DATAB
DATAB - [A]
Compare immediate: subtract Accumulator contents from immediate data. but only the status
f1,!I;1.~ are affected.

a.
::E

..,

PI

ADDR

3

BR

DISP

2

JMP

AD DR

3

:;)

[pcll-[PCOl. [PCO)-ADDR
Save Program .Counter in Stack register. then load immediate address into Program Cou·nter.
[pcO)-[PCO)+DISP
Add immediate displacement to contents of Program Counter.
[PCO)-ADDR. [A)-ADDR<15.B>
Load irnmediate address into Program Counter.1.oad the high order byte of the address into the
Accumulator,

Z
0

·E
Q

BT

. DATA3.DISP

2

BF

DATA4.DISP

2

BP

DISP

2

Be

DISP

2

BZ

DISP

2

If DATA3 VTMASK4 0 then [PCO)-[PCO) + DISP
OR the 3 bits of immediate data with the current TMASK.lf any resulting bit is a 1. add the displacement· to PCO.
If DATA4 =FMASK. then [PCO)-[PCO)+DISP
If the 4 bits of immediate data are equal to FMASK. add the displacement to PCO.
If[S] = 1 then [PCO)-[PCO)+ DISP
Branch relative if the Sign bit is set.
If [e) = 1 then [PCO)-[PCO)+ DISP
Branch relative if the Carry bit is set.
If [Z) =; 1 then [PCO)-[PCO)+ DISP

8M

DISP

2

If [S) =utnen lrCO]-[PCO)+ DISP

BNC

DISP

2

BNZ

DISP

2

.Branch relative if the Sign bit is reset.
If [C) =0 then [PCO)-[PCO)+ DISP
Branch relative if the Carry bit is reset.
If [Z] =0 then [PCO)-[PCO]+DISP

BNO

DISP

2

Branch relative if the Zero bit is reset.
If (0) =0 then· [PCO]-[PCO)+ DISP

BR7

DISP

2

Branc~ !.ellltive !!'!!J~ Zero bit is set.

Z
0

U

Z
0

:z:.
U

Z

4(

a:

ID

Branch relative if the Overflow bit is reset.
If [ISAR <2.0 » = 7 then [PCO)-[ PCO) + DISP
If the low three bits of the ISAR are not all 1s. branch relative.

Table 2-1. 3870/F8 Instruction Set Summary (Continued)
STATUSES
TYPE

MNEMONIC

OPERAND(S)

OPERATION PERFORMED

BYTES

C

Z

S

0

S

LR

A.IS

1

[DCO]-[DCll
Exchange:the contents of DCO with the contents of DC1.
[A]-[ISAR]

~~

LR

IS. A

1

Load the contents of ISAR into the Accumulator.
[ISAR]-[A]

a:

XDC

'"I-

1

(/)

"''''
~~

Load the contents of the Accumulator into the ISAR.
[PCO]-[PCll
Load the contents of the Stack register, into the Program Counter.

(/)

S

'"a:

a:

a:
'"I"''''
1-1- c(
(/)(/)

pop

1

ADC

1

0

X

1

0

[DCO]-[DCO]+ [A]
Add the contents of DCO to the contents of the Accumulator, which is treated as a signed binary
number. Store the ,result in DCO.

1

0

X

1

0

0--+f7

a:

SS'"
",,,,IL
a: a: 0

i

SR'

1

of.

Shift the contents of the Accumulator right one bit. The most significant bit becomes a O.

SR

4

1

1

1

0

X

1

0

0000

T

17

l

I

i
0'

Shift the contents of the Accumulator right four bits. The most significant four bits become Os.

'"I-

SL

0

X

X

0

a:

'"0

+--17

IL

a:

,

Ot.-O

Shift the contents of the Accumulator left one bit. The least significant bit becomes a O.

c(

SL

4

1

0

X

X

0

'"

P

l-

(/)

S
w

I

~

0' 0000

T

Shift the contents of the Accumulator left four bits. The least significant four bits become Os.

a:

COM

1

0

X

X

0

[A]-[M

LNK

1

X

X

X

X

Complement Accumulator contents.
[A]-[A]+C

INC

1

X

X

X

X

Add the Carry to the contents of the 'Accumulator.
[A]-[A]+1

CLR

1

Increment the contents of the Accumulator.
[Al-O
Clear the Accumulator.

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 2-1. 3870/F8 Instruction Set Summary (Continued)
STATUSES
TYPE

MNEMONIC

OPERAND(S)

OPERATION PERFORMED

BYTES
C

ICL

:I

a:
a:

1&1

I-

DI

1

EI

1

!:
CI.I

:I
I-

I-

S

O.
[1]-0'
Set the interrupt enable- bit in the Status register•. W, to O.
(1)-1
Set the interrupt enable bit in the Status register, W.to·1.

LR

W,J

1

[W]-[J)

LR

J,W

1

Move the contents of Scratchpad register 9 into the Status register. W.
[J]-[W]

c(

CI.I

Z

Move the contents.of the Status register, W. into Sclatchpad register 9.
NOP

1

No operation is performed. This is not a Haft.

THE 3870 BENCHMARK PROGRAM
The fact that the 3870 has just 64 bytes of read/write memory makes the benchmark program used In this book
somewhat meaningless. We will therefore substitute a program similar to the one given in Chapter 1 for the
TMS1000. A block of data is to be input via I/O Port O. The first byte of data identifies'the length of the data block to
follow: this data block must be less than 48 bytes in length so that it will fit into scratchpad memory starting at
scratchpad byte 1016. Here is the necessary program:

LOOP

INS
LR
L1SU
L1SL
INS

LR

LR
INC
LR
DS
BNZ

0

INPUT FIRST BLOCK LENGTH BYTE
SAVE IN SCRATCHPAD BYTE 0
INITIALIZE ISAR·

O,A

1
0

0
S,A
A,IS
IS,A

o
LOOP

Accumulator

7

INPUT DATA BYTE
SAVE IN NEXT SCRATCHPAD BYTE
INCREMENT ALL SIX ISAR BITS

DECREMENT SCRATCHPAD BYTE 0
RETURN IF NOT ZERO

..

0

I....
7

ISAR

0

I

CPU .
General
: Registers

LR r,A
LR A,r

Register
Address
Poiriter

..

PI, Interrupt, Reset

0

. . .____. tI. _____. .

2

0

3

15

4

Program Counter

5
6

LRJ,W

0

Zero
Carry
Sign

:r

PI

9

J

A

H

B

H

C

K

D

K

E

Q

F
10

Q

Interrupt
Reset

_-_...._-_.......

...........

Stack Pointer

··

LR P,K

•

3'RS3
I

o
Data Counter

Memory
Address
Pointer

PK

8

Overflow

15

POP

7

LR
LR
LR
LR

•

DC,H
H,DC
DC,Q
a,DC

Figure 2-4. Instructions That Move Data Between the Scratchpad and Various Registers

2-26

Table 2-2. Timing and ROMe States for Fa Instruction Set
MNEMONIC:

OPERAND IS)

ADC

cw

~
c:
o

D-

OATA8

AI

~

g
fI)
fI)

c:

oCD
fI)

o

~

<
c
<
@

0

{

No
Branch

BR7

No' Branch
Branch
BT
No
Branch
Branch
CI

DATA4,DISP

{

BF
Branch

t

DISP

{
DATA3,DISP

1

CM
COM
DCI

ADDR

r

DS
EI

P8

IN

S

0

LR

DCO,Q

S
S

lC
3

S
S

0

LR

H,DCO

S

0

L
S

1

LR

IS,A

INS

Oor 1

0

A,ClI.
A,QU
A,r

lC
1

3

0

LR

J,W

LR

K,P

S

0

S

lC
1

LR
LR

0

LR

3

L
S

3

L
S
S

2

KLA
KU,A
P,K

0

LR

PCO,Q

LR

Q,DCO

11

L
S

E

S
S
S

0
0

L
L

16
19

S
L
L
S

16
19

S
S
S
S

L
L
S
S
L
L
S
S
S
L
L
S
L

0

0
6
9

0
0
0
7
8

0
0
0
15
18

0

L

0
0

L
S

2

0
0
0
0
0
0

S

lC

0

S

1

.-,

3

0
lC

6

S

9·

LR
LR
LR

QL,A
QU,A
r,A

S
S
S

0
0
0
0

W,J

S

lC

S

0

L

3
O.

0
0

LR

L
S

lC

NI

S

0

L

3
lB

DATA8

S
L

NM
NS'
01

0
0

L
L

r
DATA8

S
S

2
0
0

L

3

S

0
2
0

lC

0

OM

2

L

through
15

L
S
L

lC
18

OUT

P8

S
L
L

3
1A

OUTS

Oorl

S
S

lC

OUTS

2
through
15
ADDR

(INTERRUPTI

ADDR

LI

DATA8

LIS

DATA4
DATA3

uSt.

2
O·

ROMe
STATE

S
S

INS

JMP

0

A,IS
A,KL
A,KU

S
S

L
S
S

INC

S
L
S

DCO,H

S
S
S

DI

DATA3

LR'

L
S
DATA8

LISU
LM

0

L
S
S

r
r

. CYCLE.

lC

AMD
AS

OPERAND IS)

S
S
S
L

2

ASD

MNEMONIC

LNK
LR
LR
LR
LR
LR
LR

0

CI/S

w

'3

A

L
S

<
Z

L
S
L
S·

~

en
w

ROMC
STATE

AM

c:

o

o

CYCLE.

0
lC

L
L

08

S
L
L

0

L
S
L.
S
S
S

L

13
3.
C
14

PI

0
3

0
0
0

S

0

L

lC
lA

L
S
L
S
L
L
S

2-27

0

O·

3
D
C
14

0

Table 2-2. Timing: and ROMC States 'for F8 Instruction Set (Continued)
MNEMONIC

OPERAND!S)

, CYCLE,
L
L
S

PI<

:
pop

S
S

s

!RESET}

SL'

SL

SA
SA
Sf

1
4
1
4

B

0
0
0
0
0
5
0
3
0
2
0
0

S
S
L

L

S
L
S
S

XM

xs

r

0
4
0
1C

L

S

DATAB

12
14

S
S

S
XI

ROMC
STATE

The following symbols are used in Table 2-3:
aaaa

Four bits choosing the register addressing mode:
0000-1011 Registers 0 - B directly addressed .
1100 ISAR addresses the register'
1101 ISAR addresses the register. Increment low three bits of ISAR.
1110 ISAR addresses the register. Decrement low three bits of ISAR.
1111 NOP. No operation is performed if aaaa=F16.
cc
Two bits choosing a Scratchpad register:
OO--KU
Scratchpad Register 12
01--KL
Scratchpad Register 13
10--0U . Scratchpad Register 14
11--0L
Scratchpad Register 15
One bit of immediate data.
d
eeee A 4-bit port number.
qqqq A 16-bit address.
rr
An 8-bit signed d,isplacement.
An 8-bit port number.
ss
yy
One byte (8 bits) of immediate data:.
When two numbers are given in the "Machine Cycles" column (for example. 3/3.5). the first is the execution time if no
branch is taken. and the second is execution time if the branch is taken.'
.

2-28

Table 2-3. 3870/F8 Instruction Set Object Code

ODJECT
INSTRUCTION
Q

ADC

~
a:
o0-

AI DATAB
AM

w

a:

o

AMO
AS r

~

ASO r
Be OISP
BF DATA4.DISP

~

8M DISP

CJ

en
w

gen

BNC DISP
BNO DISP

all

BNZ DISP
BP DISP
BR DISP
BR7 DISP

en
ct
w

Z

a:

oCD

BT DATA3.DISP

o

BZ DISP

en

BYTES

BE

1

2.5

2
1

2.5
2.5

1
1

2.5

24

@

yy

BB
B9
. 11008888
11018888

INSTRUCTION

CYCLES

LNK
LR A.DPCHR
LR A.IS
LR A,r
LR DC,H

1
2
3/3.5
3/3.5

LR DC,a
LR DPCHR,A
LR H,DC

3/3.5
3/3.5
3/3.5

LR
LR
LR
LR

2
2
2

3/3.5

LR PC1,K

3/3.5
3.5

BF RR
l0000ddd
RR

2
2

3/3.5
3/3.5

LR
LR
LR
NI

84

2

B2 RR
l00ldddd
RR

1
2
2

91
92

RR
RR

2
2

9B

RR
RR

2

94
Bl

~R

90

~

ct
Q
ct

MACHINE

CODE

RR

3/3.5

RR
CI DATAB
CLR

25

CM

YY
70

2
1

2.5
1

BD
lB

1
1
3
1
1

2.5
1
6

1
2
1
1

2
4

COM
DCI AD DR
DI

2A

DS r
EI
IN PB
INC

00118888
lB
26 55
lF

INS P4

1010eeee

JMP ADDR

aaaa
lA

2
1

1
4
. 5.5
2.5
1

1

1

1
1

1

3

LIS DATA4
LlSL DATA3

aaaa
. 20 yy
0111dddd
01101ddd

LlSU DATA3

01100ddd

LI DATA8

LM

29

16

19

1

OOOOOOcc
OA

1
1

010081188

1

10
OF
00000lcc

1
1

1
4
4

1
1

1
4

1

1
1
4
4

11
OB
1E

CYCLES
1
1
1

OB
OD

1
1
1

09
OE
01018888

1
1
1

10

1
2

1
2
2.5

YY

21

4
4

NM

BA

1

2.5

NOP

2B
11118888
22 YY

1
1

1

NS r
01 DATAB
OM
OUT PB
OUTS P4
PI ADDR

2
1.5

BYTES

IS,A
J,W
K,PCl
pco,a
a,DC
r,A
W,J
DATAB

MACHINE

OBJECT
CODE

BB
27 55
1011eeeo
2B

aaaa

PK

OC

pop

lC
13
15

SL 1
SL 4

2
1

1
2.5
2.5

2
1

4
4

3
1
1

6.5
4

1
1
1

2
1
1
1
1
2.5

SR 4

12
14

ST

17

1
1

2C
YY

1

2·

2

2.5

1
1

2.5
1

SR 1

XDC
XI DATAB

23

XM
XS r

BC
11108888

2.5

THE 3860 CPU
Beginning with the 3860 CPU. we are going to describe the Individual devices of the Fa microcomputer system.
The 3860 CPU and the 3861 PSU descriptions depend on the preceding 3870 discussion for a frame of
reference. That Is to say. these two F8 devices are described as variations of the 3870. rather than as standalone devices.
Functions Implemented on the 3860 CPU are illustrated In Figure 2-6.
These are the functions which one would expect to find on a CPU chip. and which are on the 3860 CPU:
- The Arithmetic and Logic Unit
- The Control Unit and Instruction register
- Logic needed to interface the System 8us with the 'control Signals which are input and output by the CPU
- Accumulator register

There Is no memory addressing logic. and there are no memory addressing registors on the 3860 CPU. Stack
Pointer. Program Counter and Data Counter reglaters are all maintained on memory chips and memory interface
chips.
With the F8 scheme. memory addressing logic will be duplicated if more than one memory device is present in
an F8 microcomputer system. We will discuss shortly how potential contention problems are resolved under
these circumstances.
.

2-29

Logic to Handle
___ Interrupt Requests
---from
External Devices

Data Countensl

Stack Pointer

,
".

Interrupt Priority
Arbitration

-

:·t

Program Counter

Direct Memory
Access Control
Logic

~

System Bus

~

I/O Communication
Serial to Parallel
Interface Logic

t

:.

ROM Addressing
and
Interface Logic

i,{::.

t
Programmable
Timers

~

Read Only
Memory

/

L

Figure 2-5. Logic of the Fairchild F8 3850 CPU

Two advantages accruo from having no momory address logic on the CPU chip:

1)

No address lines are needed on the System Bus. so neither the CPU nor connecting devices need 16 address pins.
These 16 pins are used instead to implement two 8-bit I/O ports at each device.

2)

The real estate on the CPU chip which would have been used by Address registers and memory addressing logic is
available for other purposes; it is used to implement 64 bytes of read/write memory.

Having I/O ports and read/write memory on the CPU chip paves the. way for some very low-cost small
microcomputer configurations; for example. the 3850 CPU and the 3851 PSU form a two-device microcomputer
system. with all of the necessary prerequisites for reasonable performance. Until the advent of the 3870 single-chip
microcomputer. this two-chip configuration represented the lowest cost 8-bit microcomputer on the market.
The disadvantage of removing memory addressing logic from the CPU chip is that standard memory devices can
no longer connoct directly to the System Bus. This bus has no address lines;therefore. separate logic devices must
create the interface needed by standard memories. In the F8 system this is done by the 3852 OMI and the 3853 SMI
devices.
Clock signal generation logic is also part of the 3850 CPU. This is now standard among microcomputers.

2-30

Fa PROGRAMMABLE REGISTERS AND STATUS FLAGS
F8 programmable registers and status flags are Identical to the 3870. For details. refer to the earlier discussion.

Fa ADDRESSING MODES
3870 and F8 addressing modes are Identical. both for scratchpad memory and for external program memory. But
memory addressing logic Is Implemented on F8 memory devices. not on the 3860 CPU.

c

w

~
II:
oa.
II:
o

o

Every 3851 PSU contains its own Program Counter (PCOl. Stack register (PS 11. and Data Counter (DCO). The 3851 PSU
has no Data Counter buffer (DC 1).
The 3852 DMI and 3853 SMI devices contain all four Address registers: PCO. PC1. DCO and DC1.

~

Since Address registers are present on every PSU. OMlor SMI device In an F8 microcomputer system. these
registers will be duplicated In any F8 system that contains more than a minimum amount of memory. So long as
the microcomputer system has been correctly configured. this presents no problem. Every memory device contains
identical connections to the common System Bus. and instructions that modify the contents of any Address register do
so identically for all memory devices. For example. if there are three memory devices. and therefore three Program
Counters in an F8 system. every Program Counter is incremented identically after a byte of object code is fetched. This
being the case. Address registers on different memory devices will always contain identical address information.

enw
~

g
C/')
C/')

c:(

oil
w
Z

II:

o
II)
C/')

o

~

c:(

c

c:(

@

Every F8 device that contains memory addressing logic also contains a memory address mask which you must
define when ordering the device. This mask identifies the device's addressed space. Thus. a memory device will only
respond to memory accesses within its address space. So long as no two devices have overlapping address spaces
(and if they do. that is a logic design error) there Is no chance for memory contentions to arise. In order to illustrate
this point. consider the very simple example of an F8 configuration that contains two 3851 PSUs. Each 3851 PSU contains 1024 bytes of read-only memory. Let us assume that 3851 PSU #1 responds to memory addresses in the range
000016 through 03FF16. while PSU #2 responds to memory addresses in the range 040016 through 07FF16. This may
be illustrated as follows:
These two Program
Counters always
contain the
same information

PSU 1

I

PSU 2

~

DCO or PCO

I

DCO or PCO

I
I

I

I II IIII
0

0

0

0

0

0

MASK

PSU 1 responds only if PCO or DCO bits 10 through
15 are 000000. because
0000 16 = 0000000000000002
03FF16 = 00000011111111112

PSU 2 responds only if PCO or DCO bits 10 through
15 are 00000 1. because
0400 16 = 00000 100000000002
07FF16 =00000111111111112

--....-

"-v-"

MASK

MASK

Any memory reference instruction will identify a memory address as the contents of either the Program Counter (PCO)
or the Data Counter (DCO). When this address is in the range 000016 through 03FF16. PSU #1 will respond but PSU
#2 will not. If this address is in the range 040016 through 07FF16. then PSU #2 will respond but PSU #1 will not. A
memory address of 080016 or more will result in neither PSU responding.
There is one circumstance under which memory addressing contentions can arise. Since the 3851 PSU does not contain a DC 1 register. it does not respond to the XDC instruction which exchanges the contents of the DCO and DC 1
registers. Therefore. in an F8 configuration that contains 3851 PSUs together with 3852 DMI and/or 3853 SMI devices.
execution of an XDC instruction will result in 3851 PSU DCO registers containing different information from 3852 DMI
or 3853 SMI DCO registers. If an external data memory reference instruction is now executed. it is possible for a 3851
PSU and 3852 OMlor 3853 SMI device to simultaneously consider itself selected. For example. consider an F8 configuration which contains a 3851 PSU and 3853 SMI. Suppose the 3851 PSU mask causes it to respond to addresses in
the range 000016 through 03FF16. while the 3853 SMI responds to all other memory addresses. Now. if Data Counter
DCO contains 02A316 while the Data Co·unter buffer (DC 1) contains OA7F16. then. following execution of an XDC in-

2-31

struction, nothing will happen to the contents ofthe 3851 PSU DCO register: however, the 3853 SMI DCO register will
contain OA7F16. Any instruction that accesses data memory via DCO will now cause both the 3851 PSU and the 3853
SMI to consider themselves selected.
In F8 configurations that include the 3851 PSU together with 3852 OMlor 3853 SMI devices, the best way of avoiding
memory addressing problems is to not use the XDC instruction. If you do use the XDC instruction, you must be particularly careful to ensure that DCO is never within a 3851 PSU's address space when the XDC instruction is executed.

F8 CLOCK CIRCUITS
Three ways of generating an F8 system clock have been advertised; these are the RC mode, Crystal mode, and
External mode. Only Crystal mode has worked consistently in practice.
Using the Crystal mode, a crystal In the 1 to 2 MHz range connects across the XTLX and XTLY pins; along with
two capacitors (C1 and C2), which provide a highly precise clock frequency:

Vss
RC
C,
XTLY

3850

CPU

D
XTLX

C2

1
VGG

The external crystal (and capacitors), together with internal circuitry, combine to form a parallel resonant crystal
oscillator. The two capacitors should be approximately 15pF. The crystal should have these characteristics:
Frequency: 1 to 2 MHz
Mode of Oscillation: Fundamental
Operating Temperature Range: 0 to 70°C
Equivalent Resistance: 1 to 1.5 MHz - 4750
1.5 to 2 MHz - 3500
Resonance: Parallel
Drive Level: 10mW
Load Capacity: - 15pF
Frequency Tolerance: Per customer's requirements
Holder (case) Style:
You can use an external clock to synchronize an F8 system with external logic. The clock signal must be input to the
3850 XTL Y pin as follows:

Vss
RC

External
Clock

XTLY

3850
CPU

XTLX

2-32

Table 2-4. ROMe Signals and What They Imply
CYCLE

4

ROMC
3 2 1

0

HEX

LENGTH

0

0

0

0

0

00

S.L

Instructio~ Fetch. The device whose address space includes the contents of the PCO register must place
on the Data Bus the op code addressed by PCO. Then all devices increment the contents of PCO.

0

0

0

0

1

01

L

The device whose address space includes the contents of the PCO register must place on the Data Bus
the contents of the memory location addressed by PCO. Then all devices add the 8-bit value on the Data
Bus. as a signed binary number. to PCO.

c

w

~
a:
oc.
a:
o

o

0

0

0

1

0

02

L

0

0

0

1

1

03

L.S

The device whose DCO addresses a memory word within the address space of that device must place
on the Data Bus the contents of the memory location addressed by DCO. Then all devices increment
DCO.
Similar to 00, except that it is used for Immediate Operand fetches (using PCO) instead of instruction
fetches.

~

en
w

. FUNCTION

0

0

1

0

0

04

S

Copy the contents of PCl into PCO.

0

0

1

0

1

05

L

Store the Data Bus contents or write bus contents into the memory location pointed to by DCO. Increment DCO.

0

0

1

1

0

06

L

Place the high order byte of DCO on the Data Bus.

e(

0

0

1

1

1

07

L

Place the high order byte of PCl on the Data Bus.

c1:I

0

1

0

0

0

08

L

All devices copy the contents of PCO into PC1. The CPU outputs zero on the Data Bus in this ROMC
state. Load the Data Bus into both halves of PCO thus clearing the register.

0

1

0

0

1

09

L

The device whose address space includes the contents of the DCO register must place the low order
byte of DCO onto the Data Bus.

l-

e(

(3

oCI)

CI)

w
Z

a:

o

al
CI)

o

0

1

0

1

0

OA

L

All devices add the 8-bit value on the Data Bus. treated as a signed binary number. to the Data Counter.

~

0

1

0

1

1

OB

L

The device whose address space includes the value in PCl must place the low order byte of PCl on the

0

1

1

0

0

OC

L

The device whose address space includes the contents of the PCO register must place the c~ntents of
the memory word addressed by PCO onto the Data Bus. Then all devices move the value which has just

0

1

1

0

1

00

S

All devices store in PCl the current contents of PCO. incremented by 1. PCO is unaltered.

0

1

1

1

0

OE

L

The device whose address space includes the contents of PCO must place the contents of the word addressed by PCO onto the Data Bus. The value on the Data Bus is then moved to the low order byte of

0

1

1

1

1

OF

L

The interrupting device with highest priority must place the low order byte of the interrupt vector on the

e(

ce(

@

Data Bus.

been placed on the Data Bus into the low order byte of PCO.

DCO by all devices.
Data Bus. All devices must copy the contents of PCO into PC1. All devices must move the contents of
the Data Bus into the low order byte of PCO.
1

0

0

0

0

10

L

Inhibit any modification to the interrupt priority logic.

1

0

0

0

1

11

L

The device whose memory space includes the contents of Pc:O must place the contents of the addressed memory word on the Data Bus. All devices must then move the contents of the Data Bus to the
upper byte of DCO.

1

0

0

1

0

12

L

All devices copy the contents of PCO into PC 1. All devices then move the contents of the Data Bus into

1

0

0

1

1

13

L

The interrupting device with highest priority must move the high order half of the interrupt vector onto

the low order byte of PCO.
the Data Bus. All devices must move the contents of the Data Bus into the high order byte of PCO. The
interrupting device will reset its interrupt circuitry (so that it is no longer requesting CPU servicing and
can respond to another interrupt).
1

0

1

0

0

14

L

1

0

1

0

1

15

L

All devices move the contents of the Data Bus into the high order byte of PC 1.

1

0

1

1

0

16

L

All devices move the contents of the Data Bus into the high order byte of DCO.

1

0

1

1

1

17

L

All devices move the contents of the Data Bus into the low order byte of PCO ..

1

1

0

0

0

18

L

All devices move the contents of the Data Bus into the low order byte of PC 1.

1

1

0

0

1

19

L

All devices move the contents of the Data Bus into the low order byte.of DCO.

1

1

O.

1

0

lA

L

During the prior cycle an I/O port timer orinterrupt control register was addressed. The devic\! contain-

1

1

0

1

1

lB

L

All devices move the contents of the Data Bus into the high order byte of PCO.

ing the a~dressed port must move the current contents of the Data Bus into the addressed port.
During the prior cycle the Data Bus specified the address of an I/O port. The device containing the addressed I/O port must place the contents of the I/O port on the Data Bus. (No~e that the contents of
timer and interrupt control regis'ters 'cannot be read back onto the Data Bus.)

1

1

1

0

0

lC

Lor S

1

1

1

0

1

10

S

Devices with DCO and DCl registers must switch registers. Devices without a DCl register perform no
operation.

1

1

1

1

0

IE

L

The device whose address spac'e includes the contents of PCO must place the low order byte of PCO

1

1

1

1

1

IF

L

The device whose address space includes the contents of PCO must place the high order byte of PCO on

None.

onto the Data Bus.
the Data Bus.

F8 CPU PINS AND SIGNALS
3860 CPU pins and signals are illustrated in Figure 2-6. A description of these signals is useful as a guide to the
way in which the F8 microcomputer system works.

11>
WRITE·
VDD
VGG
I/O 03
DB3
I/O 13
I/O 12
DB2
I/O 02
I/O 01
DBl
I/O 11
I/O 10
DBO
I/O 00
ROMCO
ROMCl
ROMC2
ROMC3

---- ..--.. -...
-- '.-..--- --.....
--- -.
-- -----

- -..
-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

RC
40
XTLX
39
XTLY
38
37 ~ EXT RES
I/O 04
36
DB4
35
I/O 14
34
I/O 15
33
DB5
32
31 ~ I/O 05
30
... I/O 06
DB6
29
28
I/O 16
27
I/O 17
26
DB7
25
I/O 07
24 i - - - VSS
23
INT REO
22
ICB
21
ROMC4

-.. -..
'

-- --

3850
CPU

- -- ..----,--- ------ ..
----- ----,

--- --

Pin Name

Description

Type

·DBO - DB7
.11>. WRITE
I/O 00 - I/O 07
I/O 10 - I/O 17
·ROMCO - ROMC4
·EXT RES
·INT REO
*ICB
RC
XTLX
XTLY
VSS.VDD.VGG

Data Bus Unes
Clock Lines
I/O Port Zero
I/O Port One
Control Lines
External Reset
Interrupt Request
Interrupt Control Bit
Clock Oscillator
Crystal Clock Line
External Clock Une
Power Unes

Bidirectional
Output
Bidirectional
Bidirectional
Output
Input
Input
Output
Input
Output
Input

·These signals connect to the System Bus.

Figure 2-6. Fairchild 3850 CPU Signals and Pin Assi,gnments
The Data Bus lines (DBO - DB7) and the control lines (ROMCO - ROMC4) provide the heart of all data and control
information flow.
The Data Bus lines are common. bidirectional lines. and are the only conduit for data to be transmitted between devices
of an F8 microcomputer system.
A lack of address lines on the System Bus usually means that data and addresses must be multiplexed on a
single set of eight lines - which slows down all memory reference operations; they must now proceed in three
serial increments, rather than in one parallel increment. In the F8 System Bus, multiplexing is rarely needed,
since addresses originate within memory devices, or memory interface devices" whence they are transmitted
directly to memory. In other words. the only time addresses are ever transmitted on the Data Bus is when they are
being transmitted as data.
Refer to Fig~re 2-1. Suppose a memory reference instruction needs to access a by'te o,f dynamic RAM. ROMC control
signals (described in the next paragraph) specify that the memory byte whose address is implied by the Data Counters
, (DCa) is to be 'referenced. Every memory device receives the ROMC control signals. but only the 3852 DMI finds that its
address space includes the Data Counter implied address; therefore. only the 3852 DMI will respond to the/memory
reference instruction. The 3852 DMI then outputs an address directly to dyna.mic RAM; this address is not transmitted

2-34

via the System Bus. If the memory reference instruction requires data to be input to or output from dynamic RAM. the
data transfer occurs directly between the System Bus and Dynamic RAM. bypassing the 3852 DMI entirely..

I

Q

w

~
a:
oa.

a:

o(J
~

u)
w

I

Since the 3851 PSU. the 3852 DMI and the 3853 SMI devices all contain Address registers and
ROMC STATE
address generation logic. they also coritain rudimentary Arithmetic arid Logic Units equivalent to
very primitive CPUs. These primitive CPUs are driven by 5-bit instructions called ROMC states. ROMC states are output by the 3860 CPU via five control lines, ROMCO - ROMC4. Each five-bit combination of ROMC signal states
identifies one 01.32 possible operations which the memory devices may have to perform to accomplish one step of an
instruction's execution. For example. ROMC state 00000 causes the contents of memory bytes addressed by the Program Counter to be transmitted to the CPU: this is the "instruction fetch" ROMC state. Table 2-4 summarizes the interpretation of ROMC states.
 and WRITE are two timing signals output by the 3850 CPU to synchronize events within the rest of the

Fa system.

~

The EXT RES line disables Interrupts and loads a 0 address into all Program Counters. causing program execution to
restart with the instruction code stored in external memory byte O.

en
en

INT REQ and ICB are signals used for overall Interrupt control. INT REO is the master lihe on which all interrupt requests are transmitted to the 3850 CPU. ICB is output low by the CPU if interrupts are enabled. and it is output high by
the CPU if interrupts are disabled.

g
c(

all
w
Z

a:

ocg

The two I/O ports which are part of the 3860 CPU device use pins 1/000 -11007 and 1/010 -1/017, respectively.
RC, XTLX and XTL Yare the three pins used for clock inputs.

en

o

~

c(
Q
c(

@

Fa TIMING AND INSTRUCTION EXECUTION
All instructions are executed in cycles, which are timed by the trailing edge of WRITE.
There are two types of instruction cycle, the short cycle which is four  clock periods long. and the long cycle
which is six  clock periods long. The long cycle is sometimes referred to as 1.5 cycles. WRITE high appears only at the
end of an instruction cycle. Timing may be illustrated as follows:
I

I

cJ>

.

I .

I

I

I , ·

I

.

I
I

I

WRITE.~~

---1

I

I

\

I

Start of

End of

End of

new
cycle

short
cycle

long
cycle

,.-_ _.....'

WRITE

I

I

I

\___

The simplest instructiohS of the F8 instruction set execute in one short cycle. The most complex instruction (PI) re.
quires two short cycles plus three long cycles.
Table 2-2 summarizes the sequence in which short (5) and long (L) machine cycles are executed for each F8 instruction. ROMC states defining operations performed during each machine cycle are summarized In Table 2-4.

2-35

The trailing edge of the WRITE pulse triggers the next ROMC state to be output on the ROMCO - ROMC4 lines:
I


I

I .

I

.

.

_rrE.~~~~
I

ROMC

.

I

I

I

.

.

I'

I

:,...~
....- - - -

One short machine cyCle ----.~~:

I

I

For any instruction that only accesses the Accumulator or scratchpad memory. no further System Bus activity is .required. since all subsequent operations will occur within the F8 CPU. This inactivity on the System Bus is used to overlap the last (or only) machine cycle of one instruction with the instruction fetch for the next instruction. For instructions
that execute in a single machine cycle. accessing only logic within the 3850 CPU. timing may be illustrated as follows:
I



I

I

I

I

I

WRITE

I

I
I
:
I
I
I

I

.
Instruction 1 execute
Instruction 2 fetch
Short machine
cycle 1

I
I

'

I

I

II

I
I
I
I
I

I
I
I
I

.

Instruction 2 execute
Instruction 3 fetch
Short machine
cycle 2

I

Instruction 3 execute
Short machine
cycle 3

Instructions that do access external memory or I/O ports will always terminate with a machine cycle that does not
cause any System Bus activity: the next instruction is fetched during this machine cycle. This may be illustrated as
follows:

I

WRITE

~~
I

:

I

n

I

______~____~r--\~______~.
I

Instruction 1 execute
Long machine cycle 1

I

Instruction 1 execute
Instruction 2 fetch
Short machine cycle 2

_.__
I
:
I

If for any reason data is to be transferred via the Data Bus during a machine cycle. then the data appears on the Data
Bus at some time which depends on the data source or destination. For details. see the data sheets at the end of this
chapter. There are no accompanying control signals since none are needed: the ROMC state identifies events which are
occurring. Tim}ng for any machine cycle that involves data transfer via the Data Bus may be illustrated as follows:

WRITE

ROMC

DATA

2-36

Fa I/O PORTS
Logic associated with each F8 I/O port pin may be illustrated as follows:
+5V

+5V

c

w

~
oa..
a:

a:
o

o

~

enw

~
(3
o(f)

(

Output _ _ _ _ _--,
Strobe

FB)

(f)

oCt
all

~ Data Out ---;~

Latch

w
Z

a:

o

aI

(f)

o

~
oCt

c

«
@

The characteristics of F8 I/O port pins differ markedly from the 3870. The only point of similarity is the fact that both
have inve'rse logic; when you output a 1-bit. OV' is output to external logic; when you write a O-bit. a +5V voltage is
output to external logic. Conversely. external logic must input OV for a 1 input bit and +5V for a 0 input bit.
On reset or power up. F8 I/O port pins are indeterminate. You must therefore start every Reset instruction sequence
with instructions that initialize all I/O port pins. In contrast. the 3870 clears I/O Port 4 and 5 pins on reset; this gener.
ates +5V outputs since logic is inverted.
When using 3870 or F8 I/O ports. the following restrictiors apply:
1)

You must write 0 to every I/O port pin that is to receive data input. This is because external logic cannot write a 0
to any I/O port pin that previously had a 1 bit output by the CPU.

2)

The CPU cannot output a 0 bit (+5V output) to an I/O port pin if the pin is connected to external logic that is inputting a' 1 bit (OV input),

A SUMMARY OF Fa INTERRUPT PROCESSING
The interrupt handling capabilities of the F8 system are described with the 3861 PSU and 3863 SMI devices.
Although many different interrupt priority arbitration schemes could be implemented, the simplest scheme
would be to daisy chain 3861 PSUs, terminating the daisy chain with ~ 3863 8MI if present. '
As soon as an interrupt is acknowledged. the contents of Program Counters (PCO) a're saved in Stack registers (PC 1);
then an interrupt vector address is loaded into the Program' Counters. This address is a permanent mask option for
PSUs. with the exception of bit 7. which discriminates between timer interrupts and external interrupts. The interrupt
address vector is completely programmable for the 3853 SMI. again with the exception of bit 7. which discriminates
device interrupts.
.
between timer interrupts and external
,
,
Post-interrupt housekeeping operations must be handled via an appropriate program. Defining just what this program
consists of is not simple; an F8 system has only the Acc~mulator and Status register which must be saved. but at the
'
other extreme. it has the entire scratchpad which could be saved.

THE Fa INSTRUqTION SET
The F8 and 3870

ins~ruction set~

are identical; for details see Table 2-1 and associated text.

2-37

THE BENCHMARK PROGRAM
Now consider our benchmark program: for the

lOOP

DCI
lM
ADC
XDC
DCI
lM
XDC
ST
XDC
DS
BNZ
lR
lR
DCI
ST

Fa it looks like this:

TABLE

lOAD TABLE BASE ADDRESS
lOAD DISPLACEMENT TO FIRST FREE BYTE
ADD TO BASE ADDRESS
SAVE THIS ADDRESS IN DC1
10BUF
lOAD I/O BUFFER BASE ADDRESS
lOAD NEXT BYTE FROM I/O BUFFER
SWITCH ADDRESSES
STORE IN NEXT BYTE OF TABLE
SWITCH ADDRESSES .
0
DECREMENT I/O BUFFER lENGTH
lOOP
RETURN IF NOT END
H.DC
IF END. STORE SECOND BYTE OF CURRENT
A.Hl
TABLE ADDRESS AS DISPLACEMENT TO
TABLE. FIRST FREE BYTE

The benchmark pr!,gram above makes the following assumptions:
1)

The I/O buffer can be located anywhere in read/write memory.

2)

The number of occupied bytes in the I/O buffer is maintained in scratchpad byte O. Thus. decrementing scratchpad
byte 0 to zero provides the I/O buffer length. .

3)

The
permanent
data table beginning memory
address has all Os for the low-order eight bits:
I
. .
, . . . .
..

The table is not more than 256 bytes long. and the displacement to the first free byte is stored in the first byte of the table. Since the table beginning address has Os in the low~order eight bits. the displacement to the first free byte also
becomes the low-order eight bits of the first free byte address:
Table beginning address

Address of first free byte

pq and rs are hexadecimal digits

All of the above assumptions are valid - and. depending upon the application. may also be realistic. Removing any of
the above assumptions will make the FB program longer. by removing one of the inherent strengths of the F8 instruction set.

2-38

THE 3861 PROGRAM STORAGE UNIT (PSU)
The 3861 PSU has been the principal read-only memory program storage device in small F8 microcomputer
systems. In addition to providing 1024 bytes of read-only memory, the 3861 PSU has two 8-bit I/O ports, a programmable timer, and interru~t logic.
'.

o
w

~
o
D-

0::

o::

o

(.)

~

en
w

The 3861 PSU can also' be used In non-F8 microcomputer systems. The most important and non-obvious advantage of including a 3851 PSU in a non-F8 microcomputer system is the fact that 3851 PSU memory will lie outside of
the microcomputer address space. This is because the 3851 PSU relies on its own memory addressing logic. which exists independent of and parallel to any other memo,rv addressing logic.
Figure 2-7 illustrates functions provided by the 3851 PSU. Device pins and signals are given in Figure 2-8. Pins and signals which are unique to the 3851 PSU are described as part of the general 3851 PSU discussion.

~

g
(I)
(I)

Clock Logic

c(
~

w
Z

0::

o

a:I

(I)

o

Arithmetic and
Logic Unit

Accumulator
Registerts)

:E
c(
c

c(

@

Figure 2-7. Logic of the.Fairchild F8 3851. 3856 and 3857 Programmable Storage Unit

2-39

I/O B7
I/O A7

1
2
3
4
5
6
7
.8

VGG

~

EXTINT

PRiOUT
WRITE


INT REO
PRIIN.
DBDR

9
10
11
12
13
14
15
16
17
18
19
20

ROMC4
ROMC3
ROMC2
ROMCl
ROMCO
VSS
I/O AO
I/O BO

Pin Name

3851
PSU

38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

Description

I/O AO - I/O A7
I/O BO - I/O B7
DBO - DB7
ROMCO - ROMC4
<1>. WRITE
EXTINT
PRIIN
PRIOUT
INT REO
DBDR
VSS.VDD.VGG

DB7
DB6
I/O B6
I/O A6
I/O A5
I/O B5
DB5
DB4
I/O B4
I/O A4
I/O A3
. I/O B3

. 39

I/O Port A
I/O Port B
Data Bus
Control Lines
Clock Lines
External Interrupt
Priority In
.,
Priority Out
Interrupt Request
Data Bus Drive
Power Supply Lines

DB3
DB2
I/O B2
I/O A2
I/O Al
I/O Bl
DBl
DBO

Type
Input/Output
Input/Output
Tristate. Bidirectional
Input
Input
Input
Input
Output
Output
Output
Input

Figure 2-8. 3851 PSU Signals and Pin Assignments

THE 3851 PSU READ-ONLY MEMORX
Every 3861 PSU has 1024 bytes of read-only'memory, pIps memory addressing logic. The rea'd-only memory
must be defined when the chip is created.
•
.
3861 PSU memory addressing logic consists of a Program Counter (PCO), a Data Counter (DCO), and a Stack
register (PC1L which is in fact a buffer for the Program Counter.
.
There is also a 6-bit page select mask, which must be specified when the chip is created; the
page select represents the high-order six bits of the memory address for all ROM bytes of the
PSU. As such, the page select defines the PSU's address space.

PSU
ADDRESS
SPACE

When a ROMC state output by the 3850 CPU. and received by the 3851 PSU, identifies a memory
reference operation, the ROMC state also identifies whether the memory address is to be found in PCO or in DCa. In
response to this ROMC state, PSU memory addressing logic will compare its 6-bit page select mask with the high-order
six bits of the specified Address regis.ter's contents:

lS 14 13 12 11 10 9 8 76 S 4 3 2 1 0

Bit No.

{xlxlxlxlxlxf ,II I I I I I I I I PCOorDCO
I
I

I
I

I

I

Iy Iy Iy Iy Iy Iy I

Page Select Mask

2-40

If there is coincidence. the 3851 PSU will respond to the memory reference operation: if there is no coincidence. the
3851 PSU addressing logic modifies the contents of Address registers. as might be required by the ROMC state. but it
does not respond to the actual memory reference instruction.

3861 PSU INPUT/OUTPUT LOGIC
c
~
a:
oa..
w

a:

o
u
!:
u)
w

~

g
U)
U)

0(

CI/l

w

Z

a:

o

ID

Every 3861 PSU has four I/O port addresses assigned to it. These four I/O ports have addresses which are
specified via a 6-blt I/O port address mask, which you must define when you order a 3851 PSU. This mask is interpreted as the 6 high-order bits of an 8-bit I/O port address. These are the four addressable I/O ports:
I/O port address mask: XXXXXX
XXXXXXOO
XXXXXX01
XXXXXX 10
XXXXXX11

I/O Port A
I/O Port B
Interrupt control port
Programmable Timer register

Suppose the 6-bit I/O port mask is specified as 0000112. I/O Ports OC16. OD16. OE16 and OF16 will then be selected.
An I/O port mask of 000000 is illegal. since I/O port addresses 0 and 1 are reserved for the two 3850 CPU I/O ports.

The two 8-bit I/O ports of a 3861 PSU are identical to the 3860 CPU I/O ports which we have already described.
except for one detail: there are three optional I/O port pin logic configurations available with a 3861 PSU.
The first option is the standard configuration which we described for the 3850 CPU I/O port pins.

U)

o

The second option is open drain configuration. which maybe illustrated as follows:

:!
0(

c0(

@

-----------...,
I

VOO'

I
I

(a)

-

~--(b)

TTL Input

L_

y

I
I
X

I

I

I
I
I

--~;_----.--­

I

I
I

I/O Port

r

rI

I
I
I

I

I------(c)

I
I

_______ _":::: ",::... J

TTL Output
IL- _ _ _ _ _ _ _ _ _
__

This open drain configuration allows you to wire-OR outputs from a number of pins.

2-41

The third option is a driver pull-up configuration designed specifically to drive LED displays. This configuration may be
illustrated as follows:

------------,I
I/O Port

VDD

VDD

I

I

LED

I
I

R

x ----.0---1

__

~

________ --l

3851 PSU INTERRUPT LOGIC
The 3851 PSU can receive external interrupt requests or interrupt requests from its programmable timer. These
two sets of interrupt logic can be selectively enabled or disabled via a control code written to the interrupt controll/O port. This control code is interpreted as follows:
I/O Port No: X X X X X X 1 0
6

4

3

2

o ....--BitNo.

~L
o .

. Control code
. { O. 0 Disable all interrupts
0 1 Enable external interrupt
Disable timer interrupt
.
1 0 Disable all interrupts
1 1 Enable timer interrupt
.
Disable external interrupt

onb~

care
Its

:
.
.

External interrupt request logic may be illustrated as follows:
From
external
logic
From higher
priority device
in daisy chain

EXT tNT
PRIIN

--1

t··

'INT REQ

---~"'I'+----""I"'~· PRI OUT

To thtl CPU
To lower
priority device
in daisy chain

An external interrupt request is generated by external logic pulling EXT INT low. The interrupt request will be passed
on to the CPU by outputting INT REO low. providing these two conditions are met:
1)

External interrupts have been enabled via the interrupt control code (01 in the two low-order bits).

2)

The PRI IN signal is low.

2-42

If EXT INT is low and external interrupts are enabled. an interrupt is~requested:· whether or not it is
acknowledged. PRI OUT is output high. The combination of the PRI IN and PRI OUT signals is designed to implement
daisy chain interrupt priority logic. which may be illustrated as follows:

c

1iN-rREQ~~----~----------------~--------------~&---------------~~-------

w

~
a:
oD-

a:
o

Device 1

o

Device 3

Device 2

Device 4

~

enw
~

g
en
en
ct
oil
w
Z

a:

oCO

en

o

~

ct
ct

C

@

When an active interrupt request occurs at one device. outputting PRI OUT high disables external interrupt logic at all
lower priority devices in the daisy chain.
An interval timer interrupt request is generated when the programmablo timer I/O port decrements to zero. This
interrupt request will be acknowledged if programmable timer interrupts have been enabled via the interrupt control
1/0 port (11 in the two low-order bits).
.

There is no priority arbitration between external interrupts and programmable timer interrupts. since one or the other
but not both can be enabled at any time.
When the CPU acknowledges an interrupt request, the 3861 PSU responds by saving Program Counter (PCO)
contents in the Stack register (PC1), then loading an interrupt sorvice routino starting address into the Program
Counter (PCO). This Interrupt service routine starting address is a mask option which you must specify when ordering the 3861 PSU. One bit of the interrupt address vector (it is bit 7) is set aside to identify the interrupt request a8 external or a8 coming from the programmable timer. This may be illustrated as follows:
15

14

13

12

11

10

9

8

6

5

4

3

2
Interrupt address vector

t

V

/ t'-

f

/

!

J 0 '",ert_d fo< ,,,,",,,mmeble tlme< 'ote"",1
1 1 inserted for external interrupt

~------------------••- - - - - - - - - Mask defined address bits

The actual interrupt response sequence consists of five machine cycles. during which ROMC states are output in the
order 1016. 1C16. OF16. 1316.0016. Table 2-4 identifies functions performed in response to each ROMC state.

2-43

Table 2-5. Relationship Between Programmable Timer Contents and Effective Timer Counts
TIMER
CONTENTS

TIMER
COUNTS

TIMER
CONTENTS

TIMER
COUNTS

TIMER
CONTENTS

TIMER
COUNTS

TIMER
CONTENTS

TIMER
COUNTS

TIMER
CONTENTS

TIMER
COUNTS

FE
FO
FB
F7
EE
DC
B8
71
E3
C7
8E

254
253
252
251
250
249
248
247
246
245
244
243
242
241
240
239
238
237
236
235
234
233
232
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
209
208
207
206
205
204

F5
EA
04
A9
52

203
202
201
200
199
198
197
196
195
194
193
192
191
190
189
188
187
186
185
184
183
182
181
180
179
178
177
176
175
174
173
172
171
170
169
168
167
166
165
164
163
162
161
160
159
158
157
156
155
154
153

BC
79
F2
E4
C9
93
27
4E
9C
38
70
El
C3
86
OC
18
31
63
C6
8C
19
33
67
CE
90
3A
74
E9
02
A5
4B
96
20
5B
B7
6E
DO
BA
75
EB
06
AD
5A
B5
6A
05
AB
56
AC
58
B1

152
151
150
149
148
147
146
145
144
143
142
141
140
139
138
137
136
135
134
133
132
131
130
129
128
127
126
125
124
123
122
121
120
119
118
117
116
115
114
113
112
111
110
109
108
107
106
105
104
103
102

62
C4
88
11
22
44
89
13
26
4C
98
30
61
C2
84
08
10
20
40
81
02
05
OB
16
2C
59
B3
66
CC
99
32
65
CA
95
2B
57
AE
5C
B9
73
E7
CF
9F
3E
7C
F8
Fl
E2
C5
8A
15

101
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51

2A
55
AA
54
A8
50
AO
41
83
06
00
lA
35
6B
07
AF
5E
BO
7B
F6
EC
08
BO
60
CO
80
00
01
03
07
OF
lE
3D
7A
F4
E8
DO
A1
43
87
OE
lC
39
72
E5
CB
97
2F
5F
BF
7F

50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0

10

3B
76
ED
OA
B4
68
01
A3
47
8F
IF
3F
7E
FC
F9
F3
E6
CD
9B
36
60
DB
B6
6C
09
B2
64
C8
91
23
46
80
lB
37
6F
OF
BE
70
FA

A4
49
92
25
4A
94
29
53
A6
40
9A
34
69
03
A7
4F
9E
3C
78
FO
EO
Cl
82
04
09
12
24
48
90
21
42
85
OA
14
28
51
A2
45
8B
17
2E
50
BB
77
EF
DE

Timer counts are decimal numbers
Timer contents are hexadecimal numbers

2-44

3861 PSU PROGRAMMABLE TIMER LOGIC
The 3861 PSU has a single programmable timer which Is addressed as the fourth I/O port (XXXXXX112). This
"
timer is free running unless it contains the value FF16. The value FF16 stops the timer.

Q

w

~
II:
oa.

II:

o

CJ

~

en
w
~

g
CI)
CI)

ct
all

w
Z

II:

o

The Interval timer Is a polynomial shift register. Table 2-6 gives the correlation between timer counts and timer
register contents.
'
,
The programmable timer dec'rementsonce every 31 clock periods. Using a 500rianosecond c!ock. therefore. the timer
'
register will decrement once every 15.5 microseconds.
In order to generate any specific, time interval. you must load an initial value into the programmable timer register by
outputting the appropriate,timer contents to the programmable timer I/O port address. For example. in order to have an
initial value of 10016. you must load the programmable timer I/O port with the value C416. Loading the programmable
timer with the initial value 2816 will generate an initial count of 16410. These correlations can be read off Table 2·5.
Once the programmable timer times out. it reloads the value FE16. representing 25410 counts. and starts to decrement
,,,.
again.

3861 PSU DATA TRANSFER TIMING
When data Is Input to the 3861 PSU from the Data Bus, no control signals are needed since the ROMC state sig·
nals identify the presence of data on the Data Bus. When data Is output by the 3861 PSU, however, the control
output DBDR is low. Timing ~ay be illustrated as follows:

In
CI)

o

~

ct
Q
ct

@
WRITE--...I

ROMC----------------------R-------------~~~-----------------------------

DATAOUT--------------------------------------~~-----------------------------

5B5R--------------------------------------~
The purpose of the low DBDR signal is 'to prevent Data Bus contentions from ever'arising. This is also a very useful sig·
nal in non·F8 microcomputer systems that include a 3851 PSU. since it can be used as a data read strobe., '

,

' . '

,

. '

;:,..;~ r"·
,:.J

USING THE 3861 PSU IN NON-F8 CONFIGURATIONS
The 3861 PSU is easily included in non-F8 microcomputer configurations. The trick is to generate ROMC s1ates
as memory addresses. A ROMC state of 1C idles the 3861 PSU. Appropriate logic is illustrated, in Figur~ 2·9.
Let us consider some examples. For simplicity. we will use 8080A assembly language mnemonics and assurl1~ that the
3851 PSU is selected by addresses FFED16 through FFFF16. This is how data input and data output'via 3851 PSU I/O
ports could be implemented. in conjunction with the logic of Figure 2·9:
•
F8 Instructions'
IN
PORT

OUT

PORT

ROMC States
03
1B
00
03
lA

80aOA Instructions
MVI
APORT
STA
OFFE3H
LDA "OFFFBH
MVI
LXI
MVI
STA
MOV

2-45

APORT
OFFFAH
B.DATA
OFFE3H
M.B,

--

··..
··..

---

~

---

.
~

:;;:

~

.

.-

•

n

T

,r

t

,
..

l
~

2 IN
1 OUT
SELECT

-

A4
A5
A15

DO
D7

iN'fR"EQ
CLOCK
SYNC

,. ... ,.

CLOCK
DERIVATIVE
LOGIC

SELECT
LOGIC

··.--..;.

AO

-....
··..-

·-

DBO --- DB7 I/O AO - I/O A7

~


WRITE
ROMC
ROMC4

I/O BO - I/O B7
3851
PSU

+

1'11002 ,

¢::>

4+ .+

--

I~ I~ I~

Figure 2-9. Conceptual Logic to Include a 3851 PSU in a Non-F8 Microcomputer System
Possibly the most useful application for a 3861 PSU in some other microcomputer system would be to implement lookup tables. The 1024 bytes of read-only memory could store data tables of that size. The Program Counter
and Data Counter are active Address registers which can be used to identify ,the location which must be looked up.

By way of illustration. consider a decimal multiplication table look-up program. 100 bytes of read-only memory could
be set aside to store the product of any two single decimal digits. This may be illustrated as follows:
Memory location: 00---0910 11 12-~"'19 20 21 22---293031 etc.
Contents: 00---000001 02---09000204---180003 etc.
Now. in order to compute any decimal multiplication. the two decimal digits are loaded into the eight low-order Data
Counter bits: the contents of the memory location addressed by the Data Counter are then read. Again assuming that
the 3851 PSU is selected by memory addresses FFED16 through FFFF16. and using 8080A assembly language
mnemonics in conjunction with Figure 2-9. appropriate instructions may be illustrated as follows:
ROMC States
19
02

8080A Instructions
MVI
. STA
LDA

46H
OFFF9H
OFFE2H

These instructions seek 4 x 6: 24 will be returned to the Accumulator.
These are just some conceptual examples of how the 3851 PSU can be used in non-F8 configurations. Clearly. the
specific microprocessor being used to drive the 3851 PSU will have a significant influence on the exact interface used
and the 3851 logic capabilities which are or are not accessible.

2-46

THE 3861 AND' 3871 PARALLEL 1/0 (PIO) DEVICES
The 3861 PIO contains the I/O ports, programmable timer, and Interrupt logic of the 3861 PSU. This device contains no memory; It Is otherwise Id!~11~al to the 3861 PSU. Figure 2-8 provldes38~1 PIO signals aod pin assignments.
. .
.
Q

w

~
oQ.

a:

The 3871 has the I/O ports, timer/counter and Interrupt logic of the 3870 single-chip microcomputer. 3871 PIO
signals and'pln ~sslgnment., are Identical to the 3851 PSU Illustrated In Figure 2-8, with the exception that the
3870 STROBE signal __ gsoclated with 1/9 Port 4 Is output at pl~ 12.

a:

o

u

~

THE 3866 AI\IP 3867 16K PROGRAMMABLE
\
STORAGE UNITS (16K PSU)

u)
w

~

g
CI)
CI)

ct
riJ
w
Z

These two devices .are enhancements

?f and repl~cements for the 3861

PSU which we have just described.

Superficially. Figure 2-7 represents t~e logi~ implemented on all three PSUs-the 3851.3856 and 3857. Table 2-6
summarizes the differences between the devices. These are tho most significant features of the 3866 and 3867
PSUs:'
.!'
c',, .
'

a:

oCD

1)

RESET sets all I/O port pins and address lines to zero. In the 3851. PSU RESET leaves 110 port pins indeterminate ','
.
and this has caused problems in'marw applications.

2)

The interval timers of the 3856 arid 38q7 PSUsare binary decremel'lters rather than polynomial shifters -with the
result that you can read timer contents directly and determine lapsed times. Also. a programmable option allows
you to measure pulse widths being input to the PSu.
.I
. .

3)

The 3857 PSU uses the 16 pins of the two 8-bit I/O ports for 16 address lines. so that additional ROM or RAM can
be interfaced directly to a 3857 PSU "':":'" without requiring a 3852 DMI or 3853 SMI. as was the case with the 3851
PSU.
. '

4)

The 3856 and 3857 PSU~ both provide 2K bytes of ROM for program storage: this is twice the program memory
on the 3851 PSU. This significantly.' increases
the
scope of two-device
Fa microcomputer systems.
available
.
,.
I·
.

CI)

o

:!!

ct
ct
Q

@

Figures 2-10 and 2-11 illustrate the pins anq si9flals of the 3856 anq 3857 16K PSUs respectively.
Table 2-6. A Summary of Differences Bem:een 3851. 3856 and 3857 PSUs
FUNCTION

3851 PSU

ROM
I/O Ports
Address lines
Interrupt
signals

1024 !>ytes
2 x 8 bits
None

Interrupt
options
Timer register
Timer decrement
interval
Timer stop/start
control
Timer readback
Timer read
pulse width?
RESET zero
I/O ports?

3856 PSU
2048 bytes
2 x 8 pits
Non~: .
Priority in and
Priority out

Priority in an~
Priority out

3857 PSU
2048 bytes
None
16
Priority in only.
Must be end of
daisy chain.
Enable timer and/or
external

Enable timer or
external. but not
both

Enabl~ timer and/or
external

~-Dit

No

8-bit Count down
2. 8. 32 or 128
clock cycles
Yes

8-bit Count down
2. 8. 32 or 128
clock cycles
Yes

No
No

Yes
Yes

Yes
Yes

No

Yel>

No I/O ports

Polynomial
31 clock cycl~s

2-47

I/O B7
I/O A7
VGG
VDD

EXfTNf
PRIOUT
, WRITE
<1>
INT REO
PRIIN
DBDR
STROBE
ROMC4
ROMC3
ROMC2
ROMCl
. ROMCO
VSS
. I/O AO
I/O BO

Pin Name
I/O AO- I/O A7
I/O BO - I/O B7
STROBE
DBQ-DB7
ROMCO - ROMC4
<1>, WRiTE
EXTINT
PRIIN
PRIOUT
INT REO
DBDR··
VSS: VDD , VGG

Fig~re

1
2
3
4
5
6
8
9
10
11
12
13
14
15
16
17
18
19
20

3856
16K PSU

40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22

21

Description·
I/O Port A
I/O Port B
STROBE for I/O Port A
Data Bus
Control Lines
Clock Lines
External Interrupt
Pri9rity In
Priority Out
Interrupt Request
Data Bus Drive
. Power Supply Lines

DB7
DB6
I/O B6
I/O A6
I/O A5
I/O B5
DB5
DB4
I/O B4
I/OA4
I/O A~

170B3
DB3
DB2
I/OB2
I/O A2
I/O A1
I/O B1
DB1

i:>~

Type
Input/Output
Input/Output
Output '
Tristate, Bidirectional
Input
Input'
Input
Input.
Output
Output
Output

2-10. 3856 PSU Signals and Pin Assignments

2-48

c

w

le:(

a:

0

D.

ADDR10
ADDR09
VGG
VDD
EXTINT
ADDR15
WRITE

a:

0

(J

~
u)

w

I-

e:(

U
0
en
en
e:(
~

«1>

INT REO
PRIIN
DBDR
CPU READ
ROMC4
ROMC3
ROMC2
ROMCl

w

~OM~O

a:
en

VSS
RAM vyRITE
ADDR06

Z

0

en

0

:!:

40

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

3857
16K PSU

37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

DB7
DB6
ADDR12
ADDR13
ADDR14
ADDRll
DB5
DB4
ADDR07
ADDROO
ADDROl
ADDR03
DB3
DB2
ADDR04
ADDR05
ADDR02
ADDROS
DBl
DBO

,J

e:(

C

e:(

@

Pin Name

Description

ADDROO - ADDR 15
CPU READ
RAMWRITE
DBO - DB7
ROMCO - ROMC4
«1>. WRITE
EXTINT
PRIIN
iNfREQ
DBDR
VSS. VDD.VGG

Address Lines
Memory Read Enable
Memory Write Signal
Data Bus .
Control Cines
Clock Lines
External Interrupt
Priority 'In
Interrupt Request
Data Bus Drive
Power Supply Lines

Type
Output
Output
Output
Tristate. Bidirectional
. Input
Input
Input
Input
Output
. Output

Fig'ure 2-11. 3857 PSU. Signal'S and PiO Assignments

ADDITIONAL F8 SUPPORT DEVICES
There are three additional F8 support devices: the 3862 Dynamic Memory Interface. the 3863 Static Memory
Interface. and the 3864 Direct Memory Access device. We are going to summarize these devices rather than
,. .
give complete descriptions. since th~se devices are infrequently used.
Only F8 configurations with a substantial amount of memory use these devices - and there are very few such F8 configurations: however. in every case there are better alternatives. For example. the 3854 Direct Memory Access device
should not be used to implement direct memorY access logic in·r}on-F8 configurations: the Z80 OMA device is clearly
superior. In fact. signal peculiarities and timing problems associated with the 3852 OMI. 3853 SMI and 3854 OMA
devices make them unattractive components in non-F8 configurations.
If you do need to use the 3852 OMI. the 3853 SMI. or the 3854 OMA d~vices. you will have to refer
since the discussion which follows provides performance summaries only - not product detail.

t~ vendor literature.

THE 3862 DYNAMIC MEMORY INTERFACE (DMI)
Primarily. this device contains the necessary address ge~eratlon and memory refresh logic needed to include
dynamic read/write memory in an F8 system.
Because of the way in which the F8 microcomputer system is organized. however. memory refresh and direct
memory access logic are closely related. That is why. in Figure 2-12. a small part of the direct memory access
control logic is shown as being implemented on the 3862 DMI c~ip.·
.
.

2-49

Clock Log!c

Logic to Handle
Interrupt Requests
from
External Devices

Arithmetic and
, Logic Unit

Accumulator
Registensi

Interrupt Priority
Arbitration '

Syste~

Bus

Interlace Logic

Interlace Logic

Programmable
Timers

Read Only
'Memory

I/O Ports

Figure 2-12. Logic of the Fairchild F8 3852 Dynamic M.emory Interface (OM!). and of the
3854 Direct Memory Acc!3sS (DM~) Devices

2-50

Figure 2-13 illustrates pins and signals of the 3852 OMI.

Conceptually, memory addressing logic of the 3862 OMI is very similar to 3867 PSU memory addressing logic;
there are, however, some differences between the 3862 OMI memory addressing and the 3861 or 3866 PSU:
The 3852 OMI contains two Oata Counters.
and OC 1. The presence of the auxiliary Oata Counter (OC 1) has no
immediate impact on memory addressing logic within the 3852 OMI. However. as we discussed earlier. its presence in an F8 system that also includes a 3851 PSU calls for programming caution.

2)

Oata and address flows surrounding a 3852 OMI are totally unlike the 3851 or 3856 PSU. In the case of these PSUs.
addresses are transmitted entirely within the logic of the PSU; the only communication needed between a PSU and
the CPU is via the eight Oata Bus lines of the System Bus. The OM I. on the other hand. generates a 16-bit address.
which it outputs directly to the read/write memory which it is controlling.

l-

e:(

a:

oca

1)

cw
0

D.

a:
0
u

~

a

These address pins are equivalent to 3857 PSU address pins -:.. that is. the address pins which CPU would have.
if the CPU contained memory addressing logic for the microcomputer system. In other words. the 3852 OMI creates the address lines and control signals. which. so far as the read/write memory is concerned. are lacking on the
F8 System Bus. The F8 System Bus does. however. contain data lines needed by the read/write memory to actually
transmit data to or from the CPU.

enw
l-

e:(

g
II)
II)

e:(

Oata and address flows around the 3852 OMI may be illustrated as follows:

all
w
Z

a:
0

CD

II)

0

Data lines {

:!
e:(

~

I

Control lines

ce:(
@

Data being
written or read
flows via this
connection

}

D~ta being input to. - - - - - "
or out from address
registers uses this

-P'
Iii.

r

connection

System
Bus

.~

•

r

u

.Dynamic
RAM

K..

Address lines

C,.

Control lines

-

3857 PSU
or
3852DMI

~

I

Address
Space
Master
Enable

3)

Logic

~

.-

Unlike the 3851. 3856 or 3857 PSU. the 3852 OMI has no on-chip logic to determine address space for read/write
memory which the OMI is controlling. Address space determination is made by logic in between the OMI and the
read/write memory. Typically. selected'high-order address lines output by the OMI are gated through elementary
Boolean logic components to create the master enable signal used to strobe attached read/write memory. This is illustrated above.

2-51

VGG

1

40

~

2
3
4

39
38
37
36

VDD
ROMC4
RDMC3
ROMCl
ROMCl

34
33
32
31

ROMCO
CPU READ
REGDR
ADDR15
ADDR14

WRITE
MEMIDLE
CPU SLOT
RAM WRITE
CYCLE REO
ADDR7
ADDR6
ADDR5
ADDR4
,ADDR3

5
6
7
8
9
10
11

DBl
DB2
DB3

12
13
14
15
16
17
18
19

Vss

20

ADDR2
ADDRl
ADDRO
DBO

3852
DMI

30
29
28
27
26
25
24

ADDR13
ADDR12
ADDRll
ADDR10
ADDR9
ADDR8'
DB7
DB6

23
22
2.1

Pin Name

Description

DBO - DB7
ADDRO - AD DR 15
~. WRITE
MEMIDLE
CYCLE REO
CPU SLOT
CPU READ
REGDR
RAM WRITE
ROMCO - ROMC4
VSS. VDD. VGG

Data Bus Lines
Address' Unes
Clock Lines
DMA Timing Une
RAM Timing Line
Timing Line
RAM Timing Line
Register Drive Une
Write Line
Control Lines
Power Lines

DB5
DB4
. Type
Tristate. Bidirectiomil
Tristate, Output
Input
Output
Output
Input/Output
Output
Input/Output'
Tristate. Output
InputInpu~

Figure 2-13. 3852 DMI Signals and Pin Assignments

The process of refreshing dynamic memory and implementing direct memory access are integrally related in an
F8 syste~.
.
'
The presence of a separate DMI interface device means that there can be a limited overlap
between a -memory reference operation which was initiated by the CPU' and a memory
referenc~, operation that Is not Initiated by th~ CPU. '

FaDMI
MEMORY
REFRE:SH

Two types of memory reference operations are not initiated by the CPU: memory refresh
'
and direct .memo~ access.
Let us consfch,r how a direct memory access may follow a CPU-initiated memory read' operation. These are the
events which occur: ,
,.
"
'
,

.

.

,

,

1)

Upon receiving 'an appropriate ROMC state from the CPU. the 3852 DMI, outputs a 16-bit memory address.
together'wJth a read stroQe: these outputs from the 3852 DMI are received by read/write memory.

2)

Read/writ~ m~mory responds by placing data directly on the Data Bus. The data must rema'in stable on the Data
Bu~ until the CPU has had time to read the data.

·2-52

3)

While data is stable on the Data Bus. DMA logic may apply a new memory address to
read/write memory. Following the arrival of address and control signals at read/write memory.
there is a fixed time delay before read/write memory responds by placing data on the Data
Bus. This time delay can overlap with time when prior data must be stable on the Data Bus.
This may be illustrated as follows:

F8 DIRECT
MEMORY
ACCESS

c

w

~
a:
ono

Add..,. Bu,

a:

o

~ Re,:;m

A, :.."

x...t'__A_~_:_r:_s_s_.JX,",

u

I

~

enw

~

Data Bus

g
CI)
CI)

X

Data stable
to CPU

--..

I

DMA
Data Stable

I

overlap

I

~

n

_ _ __

~

I

cW:I

w

z

a:

o

In

DMI logic outputs control signals which identify the way In which each memory access period is being used;
there are three possibilities:

CI)

1)

Memory is communicating with the F8System Bus.

~

2)

Memory is not communicating with the System Bus. but since it is dynamic memory it is being refreshed.

c

3)

Memory is not Gommunicating with the System Bus and is available for external access.

@

Cases 2 or 3 above may follow case 1 in separate memory access periods of the same instruction cycle.

o

~

~

THE 3864 DIRECT MEMORY ACCESS (DMA) DEVICE
This device receives memory access period Identification signals output by the 3862 DMI. Based on the direct
memory access requirements specified by the currently executing program, the DMA device accesses
read/write memory, during available memory access periods, al defined by the 3862 DMI. Figure 2-14 illustrates 3864 DMA pins and signals.
These are the variables which must be specified for a direct memory access operation:
1)

The beginning address for the memory buffer into which data must be written. or out of which data must be read.

2)

The length of the buffer.

3)

Whether data is to be written or read out of the buffer.

Once a direct memory access operation has been initiated, it proceeds in parallel with other events occurring
within the F8 microcomputer system, using memory access periods which are defined by the 3862 DMI as
available for direct memory access. In other words. direct memory access operations in no way slow down program
execution that may be occurring in parallel.
DMA data transfe~ may be high-speed or low-speed. Low-speed DMA transfer means that each DMA access is
enabled by a signal from the external device. stating that it is ready to transmit or receive data. High-speed access
assumes that the external device will always be ready to transmit or receive data: therefore. every single available
memory access period is utilized.
As a direct memory access operation proceeds. after each access the memory address is incremented and the buffer
length is decremented. Memory address. buffer length and DMA controls are stored in buffers which the CPU accesses
as though they were I/O ports. The contents of these I/O ports may be written into. or read at any time. This means
that the F8 DMA system allows total flexibility for every type of programmable DMA operation; these include
such things as stopping a DMA operation temporarily. or interrogating a DMA operation to determine how far it has
progressed.
Indefinite DMA transfer may also be specified. In this case. no buffer length is given: rather. the DMA operation will
proceed until stopped.

2-53

DIRECTION

1.

ENABLE
XFER

2

XFER'REci
VGG
VDD
ADDR8
. ADDR9
ADDR10
'ADDR11
ADDR12
ADDR13
ADDR14
ADDR15
P1
P2
DB7
DB6
DB5

084

DWS
STROBE
LOAD REG
MEMIDLE

3
4
5
6
7

34

8'

33

9
10
11
12
13
14
15
16

«I>

Vss
3854
DMA

32

ADDRO
ADDR1
ADDR2
ADDR3
ADDR4

29
28
27

17

ADDR5
ADDR6
ADDR7
26 ....t - - READ REG
25
WRITE
24
DBO

18
19
20

23
22
21

DB1
DB2
DB3

Pin Name

Description

Type

Doo - DB7
ADDRO - ADDR 15
«1>. WRITE
LOAD REG/READ REG
P1. P2
MEMIDLE

Data Bus Lines
Address Unes
Clock Lines
Registers Load/Read Line
Port 'Address Select
Memory Idle Une
Transfer Request Line
Control Status Lines
DMA Write Slot. Transfer'
Output Strobe Une
Power Lines

Tristate. Bidirectional
Tristate. Output
Input
Input
Input
Input
Input
Output
Output
Output

XFER'REci
ENABLE. DIRECTION
DWS. XFER
STROBE
VSS,VDD.VGG

Figure 2-14. 3854 DMA Signals and Pin Assignments

THE 3853 STATIC MEMORY INTERFACE (SMI)

,

.

The 3863 SMI provides interface logic for static read/write memory, that is, for memory which does not need to
be refreshed. Logic implemented on this device Is Illustrated in Figure 2-16, and Is a simple combination of functions which have already been described for the 3861 PSU and for the 3862 DMI. Figure 2-16 illustrates 3863
SMI pins and signals.
The description of memory Interface logic which was given for the 3862 DMI applies also for the 3863 SMI. The
3863 SMI, however, does not identify memory access periods, and cannotbe used to Implement direct memory
access.

Becausethe 3853 SMI does not have me'mory refresh or direct memory access supportlogic. there is unused real estate
on the. SMI chip .. The real estate is used to implement a programmable timer and interrupt processing logic. as described for the 3851 PSU. There are. however. two small differences between interrupt logic as implemented on the
PSU ,and the SMI devices: they are:
1)

The 3853 SMI interrupt address vector is not a permanent mask option as it is on the PSU: rather. it is programmable.

2)

The 3853 SMI has no priority output line. which means that in a daisy chain interrupt configuration it must have
lowest priority: that is. it must come at the end of the daisy chain.

2-54

Clock Logic

c

w

~
oa..

ex:

Arithmetic and
Logic Unit

ex:

o

(,J

~

en
w
~

g
CI)
CI)

~

o!I

w
Z

ex:

o

III
CI)

o

~
~

c

System- Bus

ct

@

I/O Ports
Interface Logic

Interface Logic

Read Only
Memory

I/O Ports

Figure 2-15. Logic of the F8 3853 Static Memory Interface (SMJ) Device

2-55

VGG

1

40

«I>

2
3
4

39
38
37
36
35
34

WRITE
INT REO
PRIIN
RAM WRITE

EXfiNT
ADDR7
ADDR6
ADDR5
ADDR4
ADDR3
ADDR2
ADDRl
ADDRO
DBO
DBl
DB2
DB3
Vss

5
6
7
8
9
10

"12

3853
SMI

13
14
15
16
17
18
19
20

33
32
31
30
29
28
27
26
25
24
23
22
21

VDD
. ROMC4
ROMC3
ROMC2
ROMCl
ROMCO
CPU READ
REGDR
ADDR15
ADDR14
ADDR13
ADDR12
ADDR1l
ADDR10
ADDR9
ADDR8
DB7
DB6
DB5
DB4

Pin Name

Description

Type

000 - DB7
ADDRO - ADDR 15
«1>. WRITE
INT REO

Data Bus Lines
Address Unes
Clock Lines
Interrupt Request
Priority In Line
Write Une
External Interrupt Line
Register Drive Une
CPU Read Line
Control Lines
Power Supply Lines

Bidirectional
Output
Input
Output
Input
Output
Input
Input/Output
Output
Input

PATiN
RAM WRITE

EXTiNT
REGDR
CPU READ
ROMCO - ROMC4
VSS. VDD. VGG

Figure 2-16. 3853 SMI Signals and Pin Assignments

2-56

DATA SHEETS
This section contains specific electrical and timing data for the following devices:
c

w

~
oQ.

II:
II:

o

U

~

enw

• 3870 One-Chip Microcomputer
.3850 CPU
.3851 PSU
.38520MI
.3853 SMI
.38540MA
·3856 2K P.SU
.3861 PIO

l-

e:(

(j

oCI)
CI)

e:(

all
w
Z

II:

o

m
CI)

o

~

e:(

c

e:(

@

2-01

3870
ELECTRICAL SPECIFICATIONS
ABSOLUTE MAXIMUM RATINGS*
0

Temperature Under Bias ....................................................ooe to 70 e
o
Storage Temperature ................................................ ; . -65"e to +150 e
Voltage On Any Pin With Respect To Ground ............................. .- .. -1.0V to + 7V
Power Dissipation .................... _.............. '.' ......................... 1.0W
De CHARACTERISTICS
TA = O°C to 70°C, Vec = 5V ± 10%
SYMBOL

PARAMETER

MIN

MAX

UNIT

TEST CONDITIONS
Outputs Open
Outputs Open

Ice

Power Supply Current

TBD

mA

Po

Power Dissipation

TBD

mW

VIHEX

External Clock
Input High Level

2.4

5 ..

a

V

V,LHEX

External Clock
Inpl.Jt Low Level

-0.3

0.6

V

',HEX

External Clock
Input High Current

100

pA

V'HEX= 2.4V

',LEX

External Clock
Input Low Current

-100

pA

V'LEX= 0.6V

V,H

Input High Level

V,L

Input Low Level

IIH

Input High Current
(except open drain and
direct drive I/O ports)

IlL

Input Low Current
(except open drain and
direct drive ports)

ILOD

Leakage Current
(open drain ports)

10H

Output High Current
(except open drain and
direct drive ports)

-100

IOHDD

Output Drive Current
(direct drive ports)

-1.5

5.8

V

0.8

V

100

pA

V'H= 2AV
internal pull-up

-1.6

mA

V'L=O.4V

10

pA

Pull-down
. device off

2.0
-0.3

-8

pA

VOH=2.4V

mA

VOH= 0.7V
to 1.5V

IOL

Output Low Current

1.8

mA

VOL=O.4V

IOHS

Output High Current
(STROBE Output)

-300

pA

VOH=2.4V

IOLS

Output Low Current
(STROBE Output)

5.0

mA

VOL= O.4V

*Stresses above those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and
functional operation of the device at these or any other condition above those indicated in the operational sections of this specification is
not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

Data sheets on pages 2-02 through 2-05 reprinted by permission of Mostek Corporation.

·2-D2

3870
AC CHARACTERISTICS
TA = at to 70t, VCC = +5V ± 10%
SIGNA~
Q

w

~
a:
oa.

SYMBOL

PARAMETER

MIN

MAX

UNIT

to(XTL)

Time Base Period, Crystal Mode

250

1000

ns

4MHz-1MHz

to(LC)

Time Base Period, LC Mode

250

1000

ns

4MHz-1MHz

COMMENTS

a:

XTLl

to(RC)

Time Base Period, RC Mode

250

2000

ns

4MHz-500kHz

u

XTL2

to(INT)

Time Base Period, !nternal Mode

250

590',

ns

4MHz-1.7MHz

to(EX)

Time Base Period, External Mode

250

2500

ns

4MHz-400kHz

tEX(H)

External Clock Pulse Width, High

90

2000

ns

tEX(L)

External Clock Pulse Width, Low

90

2000

ns



t 

Internal C!ock Period

2to

typo

ns

0.5 JJS @ 4MHz
ext. time base

STROBE

tl/O-S

Port Output to

3t <1>-1 000 min.
3tcJ>+250 max.

ns

Note 1

1SL

sTROBE

8t -250 min.
12t +250 max.

ns,

o

~
u)

w

~

g
CI)
CI)

c(
~

w
2
a:

o
m
CI)

o

:E
c(
Q
c(

@

STROBE

Delay

Pulse Width, Low

RI;SET

tRH

RESET Hold Time, Low

6t + 750 min.

ns

EXT/NT

tEH

EXT INT Hold Time, Active
State

6t + 750 min.

ns

NOTES:

Note 2

1. Load is SOpF plus 1 standard TTL input.
2. Specificatiol"l is applicable when the timer is in the Interval Timer Mode.
See "Timer Characteristics" for EXT INT requirements when in the Pulse Width,
Measure~ent Mode or the Event Counter Mode.

J. The AC Timing Diagrams are given in Figure 5.

CAPACITANCE
TA = 25t:, f=
2MHz
I
SYMBOL

PARAMETER

CIN

IriPlh Capacitance: I/O Ports, RESET, EXT INT '

CXTL

Input Capacitance: XTL 1, XTL 2

MIN

18

2-03

MAX

UNIT

7

pF

23

pF

TEST CONDITION
Unmeasuredcfrins
returned to N D

3870
TIMER CHARACTERISTICS
Definitions:
Error = Indicated tim'e value - actual time value
tpsc

= t  x Prescale Value

Interval Timer Mode:
Single interval error, free running (Note 3) .................................... , ±6t
Cumulative interval error, free running (Note 3) ..................................... 0
Error between two Timer reads (Note 2) ............. ; ...... "; ............... ±(tpsc + t to ~(tpsc +t to -(tpsc"+ 7t to ~8t
Load Timer to stop Timer error (Note 1) .. ': ........................ +t to -(tpsc + 2t to -itpsc + 8teil)
Loa~ Timer to interrupt request error (Notes 1,3) ......................... -2t  to -9t
Pulse Width Measurement Mode:
Measurement accuracy (Note 4) ..................................+t  to -(tpsc +2t <1»
Minimum pulse width of EXT INT pin .............,' .............................2t
Event Counter Mode:
Minimum active time of EXT INT pin ..... ; ......................................2t
Minimum inactive time of Ext I NT pin ........ ~ ..... , ........................... 2t
Notes:

1. All times which entail loading, starting, or stopping the Timer are referenced from the end
of the last machine cycle of the OUT or OUTS instruction.
2. All times which entail reading the Timer are referenced from the end of the .Iast machine
cycle of th~ IN ·or INS in~tructiori.
. . '
.
3. All times which entail the generation of an interrupt request are referenced from the start
of the machine cycle i"n which the appropriate interrupt request latch is set. Additional
time may elapse if the interrupt request occurs during ~ privileged or multicycle instruction:
4. Error may be ~ufl1ulative if operation is rep~tit~"ely perf~rmed.

2-04

3870
External Clock

c

w

~
oD.

a:

Internal  Clock

a:

o

CJ

~

u)
w

...

c(

(3

oCI)
CI)

c(

ail

I/O Port Output

w
Z

f'VO.'

a:

o

a:a

CI)

o

:E
c(
cc(

STROBE

tSL

@

EXTINT

lep BIT

~Ir--------.J'EH
3(~

BITJ

_

Note: All measurements are referenced to VI L max., VIH min., VOL max., or VOH min.

FIGURE 5. AC TIMING DIAGRAMS

2-05

3850 CPU

2.2.2' EI~ctrical Specifications
Absoiuiema;, WRITE

V OH
VOL.
V OH

Output High Voltage
Output Low Voltage
Output High Voltage

XTLY

VIH
VIL
IIH
IlL

Input
Input
Input
I nput

VOH
VOL

c
w

~
a:
oa.

a:
o

o

~

enw
~

ROMCO

CI)
CI)

ROMC4

g
c(

ail

w

Z

.

OB.O

a:

oco

OB7

CI)

o

~

c(
Q
c(

@

1/00
1/0 17

EXT RES

INT REO

reB

TEST CONDITIONS

MIN.

MAX.

UNITS

4.4
VSS
2.9

VOO
0.4

Volts
Volts
Volts

10H = -50 p.A
10L = 1.6 rnA
10H = -100 p.A

4.5
VSS
5
-10

VGG
O.B
50
-120

Volts
Volts
pA
pA

VIN= VOO
VIN = VSS

Output High Voltage
Output Low Voltage

3.9
VSS

VOO
0.4

Volts
Volts

10H = -100 pA
10L = 1.6 rnA

VIH
VIL
VOH
VOL
IIH
IlL

Input High Voltage
Input Low Voltage
Output High Voltage
Outpu~ Low Voltage
Input H igti Current
I nput Low Current

2.9
VSS
3.9
VSS

VOO
O.B
VOO
0.4
3
-3

Volts
Vo'its
Volts
Volts
pA
pA

10H = -100 pA
10L = 1.6 rnA
V IN = 7V 3-State mode
VIN = VSS, 3-State mode

VOH
VOH
VOL
VIH
VIL
IlL

Output High Voltage
Output High Voltage
Output Low Voltage
Input High Voltage (1)
Input Low Voltage
I nput Low Current

3.9
2.9
VSS
2.9
VSS

VOO
VOO
0.4
VOO
O.B
-1.6

Volts
Volts
Volts
Volts
Volts
rnA

10H = -30 p.A
10H = -150pA
10L = 1.6 rnA
Internal pull-up to VOO

VIH
VIL
IlL

Input High Voltage
Input Low Voltage
I nput Low Current

3.5
VSS
-0.1

VOO
O.B
-1.0

Volts
Volts
rnA

Internal pull-up to VOO

VIH
VIL
IlL

Input High Voltage
Input Low Voltage
I nput Low Current

3.5
VSS
-0.1

VOO
O.B
-1.0

Volts
Volts
rnA

VIN = VSS

VOH
VOH
VOL

Output High Voltage
Output High Voltage
Output Low Voltage

3.9
2.9
VSS

VOO
VOO
0.4

Volts
Volts
Voits

IOH = -10 p.A
10H = -100 pA
10L = 100 pA

PARAMETER

High Voltage
Low Voltage
High Current
Low Current

(1)

VIN

= O.4V

(2)

VIN = VSS
Internal pull-up to VOO

Hysteresis input circuit provides additional 0.3V noise immunity while internal pull-up provides TTL
compatability.
.
. (2) Measured while FB port is outputting a high level.
Note:
Positive current is defin~d as conventional current flowing into the pin referenced ..
(3) Guaranteed but ,not tested.

2-D7

3850 CPU

Table 2-4. A Summary of 3850 CPUSignal AC Characteristics

~C Cha:acteristics: VSS = OV, VDD = +5V ± 5%, VGG =+12V ±5910, T A = O°C to +70°C

Symbols in this table are used by all figures in Section 2.
PARAMETER

SYMBOL
Px *
PW ..
x
tXl

MIN.

UNITS

TEST CONDITIONS

External Input Period

0.5

10

pS

200

Px -200
250

nS

tp tf ~30 nS

nS

CL= 100 pf
CL= 100 pf

Ext. to  - to - Delay
Ext. to <11+ to + Delay

PtI>

tI> Period

0.5

PWl
td 1
td2

 Pulse Width

180

PW2

WRIT!: Pulse Width

PWs

W~!T~

PWL

MAX;

External Pulse Width

txi'

, .td 3
td 4 *

TYP.

250
. 10

nS
pS

P(ll-180

nS'

tI> to WRI~E + Delay

150

250

nS

CL = 100 pf

-'I
td,--I
~

-~I '/,

WRITE
ROMC

~td2

I

~---.---PWS---~==:::;:.~
~~__________~/
~ ___________ _

~PW2~

I
I

:i

- -TRUE
- -ROMC
- -STATE
- - 0- I I

.
X,

I--td 3 - l
I
- I

\1

~tdb3~ll

DATA--------------~------------------~ ~------~----------------BUS _____________
1_____________----J~ OP CODE FOR NEXT INSTRUCTION

I

I

l O N E CYCLE OF A SINGLE CYCLE
I
INSTRUCTION, OR LAST CYCLE OF A
MUL llCYCLEINSTRUCTION

I
NEXT
I INSTRUCTION

Symbols are defined in Table 2-4

Figure 2-1 OA. A Short Cycle Instruction Fetch

ROMC---------------I----~){~________T_R_U_E_R_O_M__
C_S_TA_T_E__
O_______~~--f.-td 3

I

~tdb3-1

-J

:

I

_______________________________________________~~OPCODEFORNEXT
ONE CYCLE OF THE SINGLE, LONG
CYCLE OS INSTRUCTION
(DECREMENTSCRATCHPAD)

I INSTRUCTI0 N

Symbols are defined in Table 2-4

Figure 2-10B.A Long Cycle Instruction Fetch (During DS Only)

2-010

1

NEXT
INSTRUCTION

3850 CPU

cw

PWL

I:
"

(WRITE)J

~

0

tdbl

I

I

STABLE

I

DATA BUS (1)
tdbo~

~

en

w

I
I

I

0

u

I- _____~

I I

0.

a:

'1

I

~

f

I
I

a:

~

PWS

XI

I~

~

c:(

U

I

(HIGH IMPEDANCE)

"I:

DATA BUS (1)
tdb2

STABLE

0

CI)
CI)

c:(

X

DATA BUS

w
2

I~

a:
0

en

X

DATA BUS

CI)

0
~

c:(

STABLE

l~tdb4

ell

tdbS

~

DATA STABLE

X

DATA BUS

~

DATA STABLE

l~tdbs~1

c
c:(
@
1. Timing for CPU outputting data onto the data bus.
Delay tdbl is the delay when data is coming from the accumulator.

Delay tdb2 is the delay when data is comi'ng from the scratch pad (or from a memory device).
Delay tdbO is the delay for the CPU to stop

~riving

the data bus.

2. There are four possible cases when inputting data to the CPU, via the data bus lines: they depend on the data path and the
destination in the CPU, as follows:
tdb3;
tdb4;
tdb5;
tdbS;

Destination
Destination
Destination
Destination

-

IR (instruction Fetch) - See Figure 2-10 for details.
Accumulator (with ALU operation - AM)
Scratch pad (LR K,P etc.)
Accumulator (no ALU operation - LM)

In each case a stable data hold time of 50 nS from the WR ITE refrence point is required.
Symbol~

are defined in Table 2-4

Figure 2-11. Memory Reference Timing

2':'D11

3850 CPU.

11~~-~~~~~-_-_-_-_-_P_WS_-_-_-_-/---~~=~~~~I____________

(WRITE).../

I I

II
---~"~I !..-- th

j.-- tsu

I/O (1)

DATA MAY CHANGE

X

I

I-

to

..

: DATA FROM OLDOUTS

I/O (2)

STABLE

X

:

DATA MAY CHANGE

I
I

I

X---N-E-W-D-A-T-A--+:----------

(1)

This represents the timing for data at the I/O pin during the execution of the INS instruction, i.e., the
CPU is inputting.

(2)

This represents the timing for data being output by the CPU at the I/O pin.
Symbols are defined in Table 2-4
Figure 2-13. Timing for Data Input or Output at I/O Port Pins

~
WRITE
ROMC

~.

PW

s

/

j.- PW2 -.j I

PW L

II

~ -jX

TRUE

INT REO (2)

1

I-

INT REO (2)
EXT RES

I

.. I

1

X

1

\

I
I

:1

.. I

td 5

I

I

I

--~

I

I
~td4~
!::td 5

I

/

:

td 3

ICB (1)

~I

{

tsx

I

1

I

.I

(1)

ICB will go from a 1 to a 0 following the execution of the EI instruction and will go from a 0 to 1
following either the execution of the 01 instruction or the CPU's acknowledgement of an interrupt .

. (2)

This is an input to the CPU chip and is generated by a PSU or 3853 MI chip. The open drain outputs
of these chips are all wire "ANDed" together on this line with the pull-up being located on the CPU
chip. For a 0 to 1 transition the delay is measured to 2.0V.
Symbols are defined in Table 2-4
Figure 2-14. Interrupt Signals Timing

2-012

3851 PSU

3.2.5 . Electrical Specifications
Absolute Maximum Ratings (Above which useful
life may be impaired)

Q

w

~
a:
oQ.
a:

o

CJ

~

enw

t-

c(

U

o

(I)
(I)

c(

c1J

w
2

a:

VGG
VDD
I/O Port Open Drain Option
Exter:nal nHerrupt Input
All other inputs & outputs
Storage Temperature
Operating Temperature

Note: All voltages with r~spectto VSS'
DC Characteristics: VSS = OV, VDD =+5V ± 5%,
VGG ~ +12V ±5%,
T A = O°C to +70°C

o

a:a

SUPPL Y CURRENTS

(I)

o

:!:
c(
Q
c(

@

+ 15V 'to -O.3V
+7Vto -O.3V
+ 15V., to -O.3V
-6ocfjiA to +225 J.l.A
+7V to -O.3V
-55°C to +150°C
O°C to +ib~c

SYMBOL PARAMETER MIN. TYP. MAX. UNITS
IDD

IGG

V

DD

Current

VGG Current

28

60

rnA

TEST·
CONDITIONS
f = 2 MHz.

Outputs
Unloaded
10

30

rnA

f = 2 MHz,

Outputs
Unloaded

'2-013

Table 3-2. A Summary of 3851 PSU Signal Characteristics

3851 PSU
SIGNAL
DATA BUS (D80-D87)

SYMBOL

PARAMETER

MIN.

MAX.

UNITS

TEST CONDITIONS

2.9

VDD
0.8
VDD
0.4
1
-1

Volts
Volts
Volts
Volts
/lA
/lA

10H = -100 /lA ,
10L = 1.6 rnA
VIN = VDD: 3-State mode'
VIN = VSS' 3-State mode

VDD
0.8
3

Volts
Volts
/lA

VIN = VDI:>

VDD'
0.8
3

Volts
Volts
/lA

VIN = VDD

VDD
0.4

Volts
Volts

10H= -100/lA
10L = 100/lA
Open Drain Output (1)
10L": 1 mA
VIN = VDD

VIH
VIL
VOH
VOL
IIH
10L

Input High Voltage
'Input Low Voltage
Output High Voltage
Output Low Voltage
Input High Current
Input Low Current

VIH
VIL
IL

Input High Voltage
Input low Voltage
Leakage Current

4.0

VIH
VIL
IL

Input High Voltage
Input Low Voltage
Leakage Current

3.5

V OH
VOL

Output High Voltage
Output Low Voltage

3.9

INTERRUPT REQUEST
(INT REO)

VOH
VOL
IL

Output High Voltage
Output Low Voltage
Leakage Current

VSS

0.4
3

Volts
Volts
/lA

DATA BUS DRIVE (DBDR)

VOH
VOL
IL

Output High Voltage
Output Low Voltage
Leakage Current

VSS

0.4
3

Volts
/lA

YiN = VDD

VIH
VIL
VIC
IIH
IlL
IlL

Input
Input
Input
Input
Input
Input

0.8
15
10
-225
-500

Volts
Volts
Volts
/lA
/lA
/lA

VIN = VOD
VIN = 2V
VIN = VSS

VOH
VOH
VOL
VIH
VIL
IL
IlL

Output High Voltage
Output High Voltage
Output Low Voltage
Input High Voltage
Input Low Voltage
Leakage Current
Input Low Current

VOH
VOL
VIH
VIL
IlL

Output High Voltage
Output Low Voltage
Input High Voltage
Input Low Voltage
Leakage Current

CLOCK LINES (, WRITE)

PRIORITY IN AND CONTROL
LINES (i>'RTTN, ROMCD-ROMC4)

PRIORITY OUT (PRI OUT)

EXTERNAL INTERRUPT
(EXT INT)

I/O PORT OPTION A
(STANDARD PULL-UP)

I/O PORT OPTION B
(OPEN DRAIN)

High Voltage
Low Voltage
Clamp Voltage
High Current
Low Current
Low Current

2-D14

VSS
3.9
VSS

VSS

VSS

VSS

3.5

-150
3.9(5)
2.9
VSS
2.9(3)
VSS

VDD
VDD
0.4
VDD
0.8
1
-1.6

Volts
Volts
Volts
Volts
Volts
/lA
mA

"

External Pull:up
IOL ='2 rnA

IIH = 185'/lA

10H = -30/lA
IOH = .;.150 JlA
10L= 1.6 rnA
Internal Pull-up to VDD [3]
YiN = VDD
VIN =O.4V'(4)
External Pull·up

VSS
2.9(3)
VSS

0.4

\tDD
0.8
2

Volts
Volts
Volts
/lA

10L = 2 ~A
(3)
VIN=+12V

.3861 pSU

A Sumr:riary of 3851 PSU S/gnal Characteristics (Continued)

Table 3-2.
SIGNAL

SYMBOL

PARAMETER

MIN.

VOH
VOL

Output High Voltage
Output Low Voitage

I/O p'ORT OPTION C (DRIVER
PULL·UP)

MAX.

UNITS

3.75

VDO

Vss

0.4

Volts
Volts

TEST CONDITIONS
IOH
IOL

=-1 mA
= 1.6 rnA

c

w

~
oQ.

a:

Notes:
1. Pull·up resistor to VOO on CpU.
2. Positive current is defined conventional current flowing into the pin referenced.
3. Hysteresis input circuit provitJes additionai 0.3V n~ise immunity while internal/external puil-up provides TTL compatibility.
4. Measuted while I/O port is outputting a high level.
5. Guaranteed but not tested.

a:

as

o

u

~

en
w

I-

ct

g
U)
U)

Table 3-3. A Summary of 3851 PSUSignalAC Characteristics'

ct
~

w
Z

a:

om

U)

o

~

ct
c
ct

@

,

AC Characteristics: VSS

;

= OV,

\tOO

= +5V

± 5%, VGG

= +12V

± 5%, TA

= etc

to +70°C

Symbols i~ this table are use8 by aU figures in Section 3.
SYMBOL

PARAMETER

MIN.

Pet>·
PWl
tdl
td2
td4
PW2
PWs
PWL
td3

et> Period
et> Pulse Width
et> to WRITE + De.lay
ct> to WRITE-Delay.
WRITE to bB Input Delay
WRITE Pulse Width
WRITE Period; Short
WRITE Period; Lo'ng
WRITE to ROMCDelay
WRITE to DB Output Delay
WRITE to DB"DR' - Delay
WRITE to i5'BDR -+- Delay
WRITE to INT REO - Delay
WRiTE to ~ + Delay
PRIIN to INT REQ- Delay
PAl IN to PRI OUT -:- Delay
PRIIN to PRi'O'OT + Delax
WRITE to j5§'jQ'O'T + Delay

0.5
180

td7
tds
tn
tf2
tpn
tpdl
tpd2
tpd3

TYP.

MAX.
10
Pet>-180
250
250
2Pet> + 1.0
Pet>

Pet>-100

UNITS
pS
nS

oS

nS
pS
nS

TEST
CONDiTIONS

tr. tl = 50 nS typo
CL = 100 pf
CL = 100 pf
tr. tl = 50 nS typo

4Pet>
SPet>
2Pet> + 100-td2

2Pet> + 200

550

nS

2Pet> + 850 - td2

nS

CL

nS
nS
nS
nS
nS
nS
riS

Open Drain
CL = 100 pf [1]
Cl, = 100 pf [3j
CL = 100 pf [2]
CL = 5ci p~
CL = 50 pf
CL = 50 pf

200

200

430
430
'/
300

= 100 pi

~i:ld~:::}:: ,,;~:~~:to 'PATQij'f ::-:-~~~I:~y : :'i: ::::":.:'::'} ,<' ::) <;: ::;"S( 0 ,,:<:::::;::) 1:<>::Jl ~': ,. tC>:,,~~ ~! ...• '. '.:
. . . i . ? i .iF; . C.••. "'j: •.• •••. ((.... ..;.. •.• . ....."
Ii. •.• '~i'ji~ ."i

~:

II>.:.:.::
•. ::
.•. ; .::: •.

!:. :•. :•. .: •:.••:.•:. :• •. •:.• .•.•:.• . • :•. :.:•.:• \:•.:'
:>.' •..•. .:.:. .:..•
>:::::: -: . : »

.•••
.•
: :••. ).::.:::.:." .:.•:: .••.•.

C:,

>.: ...•..:.c:.'.::
.•:.:.::

I; ·. . •.• iii)

.':.

'"

ili,i{

':::

...
vr' '. ;)( • • i,· .it>
..
[f;11" 1" •.. '.'•
1/'· )j i.·.' , ii.;: 1:(~'i.I .••!
. . •::~., j;i2.;•.sc.•.•.'• . 1·':.,~
. ,'i.· ,. . . . (j,:! •. • ·~l.; :i I i I .·.....ii:] I;i~l '\ li·~i~;.i

~:<.

'>(:.;;~ I'~;

.

.

:.•. : ., .:: .•..

i."
.•.•.

:!..• :.. • • . ::i.

:.i . ·•..•..• :.:.
::.::.: '.'.: ' •.

P.

••.•..••. : •....

Notes:

1. Ass~me Priority In was enabled (PRI IN =0) in previous F8 cycle before interrupt is detected in the PSU.
.
2. PSU has interrupt pending before priority in is enabled.
~.::

3. Assume pin tied to INT REQ input of the 3850 CPU.
4. The parameters which are shaded in the table above represent those which are most frequently of importance when
interfacing to an FB system. Unshaded paramet~rs are typically those that are relevant only between FB chips and not
normally of concern to the user.
5. Input and output capacitance is 3 to 5 pf typical on all pins except VOO, V GG, and VSS'

. 2-015

(.:. '.' ••

3851 PSU.
'I'

,r----- . . . \
LONG CYCLE

ROMC

STABLE

------~-------'

I~----------td7------~--~~

DATA BUS OUTPUT ~_____~I____________________--,~}-______~~S~T~A~B~L_E_____________

I
DBDR
(START OF DATA OUT)

DBDR
(ENDOF DATA
OUT IN SUBSEQUENT
CYCLE)

i

I

j.d8J..,;-.--_ _ _ __

~~I~~·------------~~t-d4::~~~-------~!------------~~--

DATA BUS INPUT __________________________~

STABLE

SYMBOLS ARE DEFINED IN TABLE 3-3

Figure 3-3. 3851 PSU Data Bus Timing

~----~~------------I

WRITE

INPUT (1)

~

I......t----tsu--~..~~~:th

DATA MAY CHANGE

---------------------------'

OUTPUT (2)
_________
(STANDARDPULLUP)

__

DATA STABLE

DATA MAY CHANGE

~I~~-.___ts~p~
------------------~-------------------~~
~2~.9~V~
S~T~A~B~L~E~
~
~
__
______

~~_tOd~

_____________

________

____

___________

OUTPUT (2)
~~
____2_._9V
_______________S_T_A_B_L_E__________________
(OPEN DRAIN) --~------------- -

_----+-_t=--:-"'\td.P~I_

r--

OUTPUT (2)
(DRIVER PULLUP) _______________~

._ _ _ _ _

r--

2.9V

STABLE

SYMBOLS ARE DEFINED IN TABLE 3-3
1. The set-up and hold times specified are with respect to the end ·of the second long cycle during execution of the three·
cycle IN or INS instruction.
2. All delay times are specified with respecUo the end of the second long cycle during execution of the three cycle OUT or
OUTS instruction.

Figure 3-7. Timing at PSU I/O Ports

2-016

3851 PSU

Q

w

~
II:
oa.

~---.....;,-,

I

"

LONG CYCLE

II:

o

CJ

~

en
w

ROMC

t-

ct

g
en
en

INTREQ

ct
ell

w
Z

II:

o
III

STABLE

-------------------'

~~
__

______

~~--t-r-'::i~.____., ______~--------------:I·:======-tr-2----~~
t'pd3j._--+--F-tpd4=i~_

en

o

~

ct
Q
ct

PRIIN ------------------~

~tP't

@

,

i

r_
'\l._

,~tPd,',
PRI OUT

~

EXT INT _________________________________

I

···ft
r

P'2:kv

tPd2

,

....;....---..~ tex~
,~--~----------------

NOTE: TIMING MEASUREMENTS ARE MADE AT VALID LOGIC lEVEL OF THE SIGNALS
REFERENCED UNLESS OTHERWISE NOTED.
SYMBOLS ARE DEFINED IN TABLE 3-3

Figure 3-13. Interrupt Logic Signals' Timing

2-017

Table 4-2. Summary of 3852 DMI Signal Characteristics

3852DMI

SYMBOL

PARAMETER

VIH
VIL
VOH
VOL
IIH
IlL

ADDRESS LINES
(ADDRO-ADDR 15)
AND
RAM WRITE
CLOCK
(til, WRITE)

SIGNAL

MIN. MAX.

UNITS

TEST CONDITIONS

Input High Voltage
I nput Low Voltage
Output Higb Voltage
Output Ldw Voltage
I nput High Current
Input Lbw Current

2.9

Volts
Volts
Volts
Volts
Il A
Il A

IOH = -100 IlA
IOL =1.6 rnA
VIN = VDD, 3-State mode
VIN == VSS, 3-State mode

VOH
VOL
IL
IL

Output High Voltage
Output Low Voltage
Leakage Current
Leakage Current

4.0
VSS

Volts
Volts
Il A
Il A

IOH = -1 rnA
IOL = 3.2 rnA
VIN = VDD, 3-State mode
V IN = V SS' 3-State mode

VIH
VIL
IL

Input High Voltage
Input LolJV Voltage
Leakage Current

4.0
VSS

3

Volts
Volts
Il A

VIN = V DD

MEMIDLE,
CYCLE REQ,
CPU READ

VOH
VOL

Output High Voltage
Output Low Voltage

3.9
VSS

VDD
0.4

Volts
Volts

IOH = -1 rnA
IOL = 2 rnA

CONTROL LINES
(ROMCO-ROMC4)

VIH
VIL
IL

I nput High Voltage
Input LoW Voltage
Leakage Current

3.5
VSS

VDD
0.8

Volts
Volts

3

~A

VIN = 6V

VDD
VDD
0.8
-14.0

Yolts
Volts
Volts
Volts
rnA

IOH = -300 Il A
IOL = 2 rnA
I nternal Pull-up

,3

Il A --

DATA BUS
(DBO-DB7)

..

J

,

REGDR,
CPU SLOT

,

'. ~

VOH
VOL
VIH
ViL
IrL
IL

VSS
3.9
VSS

VDD
0.8
VDD

004
3
-3
VDD

004
3
-3
VDD
0.8

,

Output High Voltage
Output Low Voltage
Input High Vbltage
Input Low Voltage
I nput Low Current
(REGDR)
Leakage Current

3.9
VSS
3.5
VSS
-3.5

O.fl

VIN = OAV & Device
outputting a logic "1"
VIN = 6V
"

2-018

3862DMI

PARAMETER

SYMBOL
pcf)

cw

~
a:
oa..
a:
o

u

~
u)
w

~

g
(/)
(/)

c(

oll

w
2

a:

o

Ul
(/)

o

~

c(

C

c(

@

..

td2
tad1

tad2
• tad3
tad4
tad5
. tad6
tcrl
tcr2
t?Sl
tcs2
tcs3
tml
tm2
tm3
tm4
tCY1
tCY2
tCY3
tCY4
twr1
twr2
twr3
twr4
trgl
trg2
td4
td7

Table 4-3. 3852 OM I Output Signals Timing Summary
MIN.

 clock period
 to WRITE - Delay
Address delay if PCO
Address delay to high Z (short cycle with DMA on)
Address delay to refresh (short cycle with REF on)
Address delay if DC
Address delay to high Z (long cycle with DMA on)
Address delay to refresh (long cycle with REF on)
CPU READ - Delay
CPU READ + Delay
CPU SLOT + Delay
CPU SLOT - Delay (PCO access)
CPU SLOT - Delay (DC access)
MEMIDLE + Delay (PCO access)
MEMIDLE - Delay (PCO access)
MEMIDLE + Delay (DC access)
MEMIDLE - Delay (DC access)
WRITE to CYCLE REO - Delay
WR ITE to CYCLE REO + Delay
CYCLE REO + to + Edge Delay
CYCLE REO - to - Edge Delay
RAM WRITE - Delay
RAM WRITE + Delay
RAM WRITE Pulse Width
RAM WRITE to High Z Delay
REGDR - Delay
REGDR + Delay
WRITE to Data Bus Input Delay
WR ITE to Data Bus Output Delay

TYP.

MAX.

10
250
50
300 500
tcs2+200
tcs2+50
tcs2+400
tcs2+50
2P+50-td 2
2P+400-td 2
tcs3+50
tcs3+200
tcs3+400
tcs3+50
50.
250 450
2P(I>+50-td 2
2PcI>+400-td 2
80-td 2
320-: td 2
2P+420-td 2
2P+60-td 2
2pcf>+420-td 2
4P+60-td 2
4P(I>+400-td 2
2P+50-td2
4Pc:f>+50-td2
4P+350-td i
4P+50-td 2
4P+400-td 2
6P(I>+50-td 2
6P+350-td2
400-td 2
80- td 2
P+80-td 2
Pcf>+400-td 2
2P(I>
2P(1)
4Pcf>+450-td2
4PeI>+50-td 2
5P(I>+50-td 2
5P(I>+300-td 2
Pel>
350
tcs2+200
tcs2+40
70
300 500
2P(I>+80-td 2
2Pcf>+500-td 2
2P11>+1000
2P(I>+100-td 2
2P(fJ+850-td 2
0.5

UNITS NOTES
",S
nS
nS

nS
nS
nS
hS
nS
nS
nS
nS
nS
nS
nS
nS
nS
nS
nS
nS

nS
nS
nS
nS
nS
nS
nS

Fig. 2-9
3
3
3
3
3
3
1
1
1

1
1
1
1
1
1
1,4
1,4
1,4
1,4
3
3
3
3
1
1
2

Notes:
1. CL

=

50 pf.

2. CL = 100 pf.
3. CL :: 500 pf.
4. CYCLE REO is a divide-by-2 of (I> for all instructions except the STORE instruction.
5. On a given chip, the timing for all signals will tend to track. For example, if CPU SLOT for a particular chip is fairly slow
and its timing falls out near the MAX aelay value specified, then the timing for all signals on that chip will tend to be out
near the MAX delay values. Likewise for a fast chip whose signals fall near the MIN values. This is a result of the fact that
processing parameters (which affect device speed) are quite uniform over small physical areas on the surface of a wafer.
6. Input and output capacitance is 3 to 5 pf typical on all pins except VDD, VGG' and VSS'

2-019

38520MI
W
I-

a:~

~~

~.
~

d3
~
tad2ta--=--------.t

' '. I
I tad, =1)(~----------~--~><===><---R-E-F-.--~-------><~_R_E_F_.
____

~

~

: 'I:

rnd.

~

rndS

",I:
tadS - - - - - - - - - - - - - - - + 1
.\

" \

~ ~::::g----------- -------~ ~tcs,

'\ - - - - - - - - - ' ,

: I:

~~,
~ I:
g , 'I

" ' 3 ' 1 ·1

,1m,

+

ICY,

•\

I

'

':::J~f--------\

t_m_4~:~:I'-----------------·~1

tCY3 _ _

, \____--J!

\---'--7-_

: --: Icy, I===ICY'~
twr'----------..;....
It:

,-

~

-------------------------------------------------I

:E
~

-\..

·1

~ 1__ "'"-_________-----------------...;...twr4

It:

~-----------------twr2----------------------~

~

~

_ __I _ _ tr_"

-

~I-

t-------------------

1~:~----------tr-g2----------~t-d4-----~~-~-----------~~·~1

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _...;...________

~£ _~

~!

-

-

~ ~ __I:.:====~~~~~~:::_-_-t_d_7~=============:·~1
~~

~0

~

__

~

_______________~________~______Jx~------------------.

x~--------------

Figure 4-4. Timing Characteristics for 3852 OM I Output Signals

2-020

3852 DMI/3853 SMI
4.2.2

= OV, VOO = +5V ± .5%,
VGG = +12V ± 5%,
T A = O°C to +70°C

OC Electrical Specifications

DC Characteristics: VSS

Absolute Maximum Ratings (Above which useful

life may be impaired).
SUPPL Y CURRENTS
Q

w

!ia::
oa..
a::
o
o

~

iii

+15V to -O.3V·
+7V to -O.3V
+7V to -O.3V
-65°C to +150°C
O°C to +70°C

VGG
VOO
All other inputs & outputs
Storage Temperature
Operating Temperature

TEST
SYMBOL PARAMETER MIN. TYP. MAX. UNITS CONDITIONS
100

VOO Current

35

70

rnA

f = 2 MHz,
Outputs
unloaded

IGG

VGG Current

13

30

rnA

f = 2 MHz,
Outputs
unloaded

Note: All voltages with respect to VSS'

w

!i

u
o
(/)
(/)

Table 5-2. 3853 SM I Output Signals Timing Summary

c:(
~

w
Z

a::

oIII
(/)

o

~

c:(
Q
c:(

@

SYMBOL
P
td2
tadl
tad4
tcrl
tcr2
twrl
twr2
t~r3

trgl
trg2
td4
td7
trl .
tpr l .
tex

 clock period
 to WR ITE - Delay
Address delay if PCO .
Address delay if DCO
CPU READ - Delay
CPU READ + Delay
RAM WRITE - Delay
RAM WRITE + Delay
RAM WRITE Pulse
REGDR - Delay
REGDR + Delay
WRITE to Data Bus
Input Delay
WRITE to Data Bus
Output Delay
WRITE to INT REO - Delay
PRI IN to INT REO - Delay
EXT INT Set·up Time

TYP.

MIN.

PARAMETER
0.5

50
2P+50-td 2
50
2P+50-td 2
4P+50-td 2
5P+50- td 2
350
70
2P+80-td 2

300
250

300

2P+ 100-td2

200

NOTES

MAX.

UNITS

10
250
500
2P+400-td 2
450
2P+400-td 2
4P+450-td 2
5P+300-td 2
P
500
2P+500-td 2
2P+1000

J,lS
nS
nS
nS
nS
nS
nS
nS
nS
nS
nS
nS

2
3
3
1
1
3
3
3
1
1

2P+850-td 2

nS

2

430
240

nS
nS
nS

2, 6
2, 7

400

Fig. 2-9

Notes:

1. CL = 50 pf.
2. CL

= 100 pf.

3. CL

=500 pf.

4. On a given chip, the timing for all signals will tend to track. For example, if CPU SLOT for a particular chip is fairly slow
and its timing falls out near the MAX delay value specified, then the timing for all signals on that chip will tend to be out
near the MAX delay values. Likewise fora fast chip whose signals fallout near the MIN values. This is a result of the fact
that processing parameters (which affect device speed) are quite uniform.
5. Input and output capacitance is 3 to 5 pf typical on all pins except VDD, VGG, and VSS'
6. Assume Priority In was enabled (PRI IN = 0) in previous F8 cycle before interrupt is detected in the PSU.
7. PSU has interrupt pending before priority in is enabled.
2-021

·3853 SMI

...-w

~

~

~

en

~

~
I'~·

__________________________-L,,---,
______~\________~/______~\~

~tadl --+\_--------_
~----------------x
__________________

I

Xl~

~ ~I1-oI.t-------- tad 4 ------'~~

: E~

"'1

-1\ "'2 -~.I

I

.-..1

"""-1----------- twrl - - - - - - - - -••+0141- twr3,

~ -<--~~~~~~~~~~~~~~~~~~~~~~-t-w-r2--~~~~~~~~~~~~~~\----~.r,.----- ..

I·

td7-~
______________________________
___________________________
~ ~ ---------------------r-------------------------

en ...
~

~

c5

0

--JX~

"2-:1-

I~
I~

I~
I§

2V

ItP)

I

1-- tP'21

~~-------------------~------~I------------~
2V

1__!..___

---~t-~t.
Figure 5-4. 3853 Signal Timing

2-022

3854 DMA

Table 6-3. Summary of 3854 DMA Signal Characteristics
ELECTRICAL SPECIFICA TlONS

Absolute Maximum Ratings (Above which useful life may be impaired)

...
e:(

IX:

o11.
IX:
o
CJ

Note: All voltages with respect to VSS'

en

DC CHARACTERISTICS: VSS = OV, VDD = +5V

~

...w

+15V to -0.3V
+7V to -0.3V
+7V to -0.3V
-55°C to +150 o C
OOC to +70 o C

VGG
VDD
All other Inputs & Outputs
Storage Temperature
Operating Temperature

cw

e:(

± 5%,

VGG = +12V

± 5%, TA = a to +70 o C

SUPPLY CURRENTS

(3

oCI)
CI)

e:(

PARAMETER

SYMBOL

MIN.

TYP.

MAX.

UNITS

TEST CONDITIONS

20
15

40
28

mA
mA

.t = 2 MHz, Outputs Unloaded
f = 2 MHz, Outputs Unloaded

o/l

w
Z

IX:

o

VDD Current
VGG Current

IDD
IGG

!Xl
CI)

o

SIGNAL

SYMBOL

PARAMETER

MIN.

MAX.

UNITS

TEST CONDITIONS

3.5

VDD
0.8
VDD
0.4
1
-1

Volts
Volts
Volts
Volts
pA
pA

IOH = -100pA
IOl = 1.6 mA
V IN = 6V, 3-State mode
VIN = VSS' 3-State mode

VDD
0.4
1

Volts
Volts
pA

IOH=-lmA
IOl = '3.2 mA
VIN = 6V, 3-State mode

VDD
0.4

Volts
Volts

IOH = -100pA
IOL = 2 mA

1

pA

VIN = 6V

~

e:(

c

e:(

DATA BUS (DBO-DB7)

VIH
VIL
VOH
VOL
IIH
III

Input High Voltage
Input low Voltage
Output High Voltage
Output low Voltage
Input High Current
I nput low Current

ADDRESS LINES
(ADDRO-ADDR15)

VOH
VOL
IL

Output High Voltage
Output low Voltage
Leakage Current

4.0

ENABLE, DI RECTION
DWS (DMA WRITE
SLOT), XFER,
STROBE

VOH
VOL

Output High Voltage
Output Low Voltage

3.9

IL

Leakage Current

@

SIGNAL

SYMBOL

PARAMETER

VIH
VIL
IL

LOAD REG, READ
REG, Pl, P2
WRITE,«(l

MEM IDLE, XFER REO

VSS
3.9 '
VSS

VSS

VSS

MIN.

MAX.

UNITS

Input High Voltage
Input Low Voltage
Leakage Current

3.5

VDD
0.8
1

Volts
Volts
pA

VIN = 6Y

VIH
VIL
IL

Input High Voltage
Input Low Voltage
Leakage Current

3.5

VDD
0.8
1

Volts
Volts
pA

VIN = 6V

VIH
VIL
Il

Input High Voltage
Input Low Voltage
Leakage Current

4.0

VDD
0.8
1

Volts
Volts
pA

VIN = 6V

VSS

VSS
0

VSS

a

Note:
Positive current is defined as conventional current flowing into the pin referenced.

2-023

TEST CONDITIONS

Table 6~4. 3854 DMA Device Signals Summary

3854DMA
SYMBOL
P
PW 1
td1
td2
PW2
td3
td4
td6
td7

tdi
td8
tdg
tdg'
td10
td'10
td11
td 11

PARAMETER
 Clock Period
 Pulse Width
 to WRITE + Delay
 to WRITE - Delay
WRITE Pulse Width
WRITE to READ/LOAD REG
Delay
DB I nput Set-upTime
XFER REQ to MEM IDLE Set-up
MEM IDLE to ADDR True
MEM IDLE to ADDR 3-State
READ REG to DB Output
WRITE
ENABLE &
01 RECTI ON + Delay
MEM IDLE to ENABLE - Delay
MEM IDLE to, XFER & DWS
+ Delay'
MEM IDLE to XFER & DWS
- Delay
 to STROBE + Delay
 to STROBE - Delay

to

MIN.

TYP.

0.5
180
60
60
P-100

'

,

200
50
30
40

200

,

30
30

:

MAX.

UNITS

NOTES

10
P-180
300
250
P and W R 'I TE as su ppl ied by the 3850 CPU.
2. Input and output capacitance is 3 to ~ pf typic~·lon all pins except V DD , V GG , and VSS.

, 2-024

Q

w

__________~L~ ____ ~~____~/~---~-~-~~,'~

~

a:
0

D.

a:
0

u

~

----------------------------------------------~)(~-------

en
w

I

l-

e(

g
U)
U)

e(

0

<{

gl!)

CI/S

00:
UJ

a:
0

a:a

U)

0
~

e(
Q

e(

@

r--.,td

-.. UJ

W

Z

<{

0:
(1)-

::>1co::>
<{a..
1-1<{::>

oQ
z

wO

...J-

col<{u
zUJ

.

..

3

-1, X : . . - , - - - - - - - - - - - - -

--------------I-.--------~

I~--------------~--~-------------

1 1 . - tda -1:.,.-;...______~_______

________________________________

~><:~

__________

S_TA_B_L_E____________

1'- td9'-j

~~~~r~-_-_-_--------------+---~~
1

UJ~
0

UJ

...J

e
~

OUJ

UJ~

0:
0:

________________________

~~)f

'. !.- td

6-"

------------------~i

UJ

u..

X

I
I
I

(I)

~~
~~
~...J

,

/

I

~ td7'-1------~--~~--~----~ 'di~

_________________3_.S_TA_T_E______________--J>c~

____A~D~D~R~T~R~U~E~__~I~3~.S~T~A~T~E

I

~ _ _ _ _ _ _---,.--~t----JdlO) .
:_ti~dl

L .'

.. 'd,. ~'t: . . .-._

~ ------------~~----------------------~~~----------------­

I-

(I)

Figure 6-5. 3854 DMA Device Signals and Timing

2-025

3856 2K PSU
ABSOLUTE MAXIMUM RATINGS (Note 1)
Supply Voltage VGG
Supply Voltage Voo
I/O Port Open Drain Option
Other I/O Port Options
All Inputs and Outputs
Storage Temperature
Temperature (Ambient) Under Bias

+15 to -0.3 V
+ito -0.3 V
+15 to -0.3 V
. +7 to -0.3 V
+7 to -0.3 V
-55 to +150°C
to +70°C

o

NOTE 1. Above which useful life may be Impaired. All voltages measured with respect to Vss.

TYPICAL THERMAL RESISTANCE VALUES

SUPPLY CURRENTS
TEST
SYMBOL PARAMETER TYP MAX UNITS
CONDITIONS
100

IGG

Voo Current

VGG Current

75

30

125

45

mA

f = 2 MHz,

mA

Outputs
unloaded
f = 2 MHz,
Outputs
unloaded

PLASTIC:
(}JA (Junction to ambient)
(}JC (Junction to case)

= 60°C/W (Still Air)
= 42°C/W

CERAMIC:
(}JA (Junction to ambient)
(}JC (Junction to case)

= 48°C/W (Still Air)
= 33°C/W

TABLE 1. 3856 PSU SIGNAL DC CHARACTERISTICS
DC ELECTRICAL CHARACTERISTICS: Vss = OV, Voo
SYMBOL

PAR~METER

= +5.0V±5%, VGG = +12V ±5%, TA = O·Cto +70·Cunlessotherwisenoted.

SIGNAL

MIN

MAX

UNITS

2.9

Voo
0.8

V
V
V
V
/LA

Input HIGH Voltage
Input LOW Voltage
Output HIGH Voltage
Output LOW Voltage
Input HIGH Current
Input LOW Current

Data Bus (DB o·DB 7 )

Input HIGH Voltage
Input LOW Voltage
Leakage Cumint

Clock Lines (, Write)

. Priority In and Control

3.5

VIL
IL

Input HIGH Voltage
Input LOW Voltage
Leakage Current

Lines (PFiiiN, ROM Co-ROM C4 )

Vss

VOH
VOL

Output HIGH Voltage
Output LOW Voltage

Priority Out (PRI OUT)

VOH
VOL

Interrupt Request (INT REO)

I~

Output HIGH Voltage
Output LOW Voltage
Leakage Current

VOH
VOL
IL

Output HIGH Voltage
Output LOW Voltage
Leakage Current

Data Bus Drive (DBDR)

VIH
VIL
VO H
VOL
IIH
10L
V IH
VIL
IL
V IH

Vss
3.9
Vss

4.0
Vss

3.9
Vss·

Vss

Vss

2-D26

TEST CONDITIONS

/LA

10H = -100/LA
10L = 1.6 rnA
VIN = Voo, 3-State Mode
VIN = Vss, 3-State Mode

Voo
0.8
3.0

V
V
/LA

VIN

= Voo

Voo
0.8
3.0

V
VIN

= Voo

Voo
0.4
3.0
-3.0

Voo
0.4
0.4
3.0
0.4
3.0

V
/LA

V

IOH = -100 /LA

= 100 /LA

If

IOL

V
V

Open Drain Output (Note 1)
IOL = 1.0 rnA

/LA
V
/LA

VIN

= Voo

External Pull-up
IOL = 2.0 rnA
VIN = Voo

3866 2K PSU
TABLE 1. 3856 PSU SIGNAL DC CHARACTERISTICS

DC ELECTRICAL CHARACTERISTICS: Vss = OV, Vee = +5.0V :5%, VGG = +12V :5%, TA =
SYMBOL
VOL
VIH
VIL
IlL

Input HIGH Voltage
Input LOW Voltage
Input LOW Current

External Interrupt (EXT INT)

VO H

Output HIGH Voltage

VOH
VOL
VIH
VIL
IlL

Output HIGH.Voltage
Output LOW Voltage
Input HIGH VoltagE!
Input LOW Voltage
Input LOW Current

1/0 Port Option A
(Standard Pull-Up)

VOH
VOL
V IH

Output HIGH Voltage
Output LOW Voltage
Input HIGH Voltage
Input LOW Voltage

VO H
Q

w

~
II:
oD..

II:

o(.)
~

u)

w

~

g
(f)
(f)

ct
o!I

w

VIL

II:

VO H

In

VOL

Z

o

(f)

o

~

ct
Q

«
@

SIGNAL

PARAMETER
Input HiGH Voltage
Output LOW Voltage

Strobe

MIN

MAX

UNITS

3.9

Vee
0.4

V
V

Vee
O.B
-1.6

V
V
mA

Vee
Vee
0.4

V
V
V
V
V
mA

Vss
2.9
Vss
3.9
2.9
Vss
2.9
Vss

Vee
O.B
-1.6

1/0 Port Option B

TEST CONDITIONS
IOH = 1.0 mA
IOL = 2.0 mA
liN = -130 p.A (Internal Pull-up)
VIN = 0.4 V
IOH = -30 p.A, Note 5
IOH = -150 p.A
IOL = 1.6 mA
Internal Pull-up to VOD, Note 3
VIN = 0.4 V, Note 4
External Pull-up

(Open Drain)

Vss
2.9
Vss

Output HIGH Voltage
Output LOW Voltage

o·bto +70·Cunlessotherwisenoted.

I/O Port Option C
(Driver Pull-Up)

4.0
Vss

0.4

IOL = 2.0 mA, Note 3

Vee
O.B

V
V
V

Vee
0.4

V
V

IOH = -1.0 mA
IOL = 2.0 mA

NOTES:
1. Pull-up resistor to VOO on CPU.
2. Positive current is defined as conventional current Ilowing into the pin relerenced.
3. HysteresiS input circuit provides edditional 0.3 V noise immunity while internallexternal pull-up provides TTL compatibility.
4. Measured while 1/0 port is outputting a high level.
5. Guaranteed. but not tested.

.

TABLE 2. 3856 PSU SIGNAL AC CHARACTERISTICS

AC ELECTRICAL CHARACTERISTICS: Vss = 0 V, Voo = +5.0 V :5%, VGG = + 12 V :5%, TA = O·C to + 70·C unless otherwise noted.
SYMBOL
P
PW 1
td 1, td2
td 4
PW2
PWs
PW L
td 3
td7
tda·
tr1
tp r1

PARAMETER
 Period
 Pulse Width
 to Write + Delay
Write to DB Input Delay
Write Pulse Width
Write Period; Short
Write Period; Long
Wr~te

Write
Write
Write
Write

to
to
to
to
to

ROMC Delay
DB Output Delay
DBDA - Delay
DBDR + Delay
INT Req - Delay

MIN
0.5
1BO

P-100

Write to Output Stable

tdp
tsu
th

Write to Output Stable
1/0 Set-up Time
1/0 Hold Time
Ext Int Set-up;Time
Write to Strobe + Delay
Write to Strobe - Delay

tax
tsB1
tsB2

MAX
10
P-1BO
250

UNITS
p's
ns
ns

t r , tl = 50 ns Typ
CL = 100 pF

2P+1.0

p.s
ns

t r , tl = 50 ns Typ

P

TEST CONDITIONS

4P
ns
2P+100-td2

2P+200

550
2P+850-td2

ns
ns

CL = 100 pF

ns

Open Drain

430

CL = 100 pF, Note 1
CL = 100 pF, Note 2

1.0

ns
ns
ns
ns
p's

2.5

p.s

400

ns
p.s
ns
ns
ns
ns

200

PRI In to INT Req - Delay
tpd 1, tpd2 PRI In to PRI Out Delay
tpd 3 • tpd4 Write to PRI Out Delay
Write to Output Stable
tsp
tod

TYP

200
BOO
600

200
1.3
0
400

5P+300
6P+410

CL = 50 pF
CL = 50 pF
CL = 50 pF, Standard Pull-up
Note 3
CL = 50 pF, RL = 12.5 kG
Open Drain, Note 5
CL = 50 pF, Driver Pull-up

CL = 50 pF
CL = 50 pF

NOTES:
1. Assume Priority In was enabled (PRIIN ~ 0) in previous Fa cycle before interrupt is detected in the PSU.
2. PSU has interrupt pending belore priority in is enabled.
3. Assume pin tied to INT REa input 01 the 3850 CPU.
4. The parameters which are shaded in the table above represent those which are most Irequently 01 Importance when interlacing to an Fe system. Unshadad
parameters are typically those that are relevant only between Fe chips and not normaliy 01 concern to the user.
5. Input and output capacitance is 3 to 5 01 typical on all pins except VOO' VCC and VSS'

2-027

3856 2K PSU

WRITE

Id11 _ _

-

Id,

1"

l

r---,

----:-- I-pw,-/ _ld3~1

.

ROMC

.

Id,

LONG CYCLE

STABLE

X

DATA BUS OUTPUT

.\

I

---

STABLE.

-

-.
DBDR
(START OF DATA OUT)

'\..

-Id·-I

DBDR
(END OF DATA OUT
IN SUBEQUENT CYCLE)

.

I

.

Id.

DATA BUS INPUT - - - - - - - - - - - - - - - . . . . ; . . - - - - - - - - * - - - - - - S - T A - B - L - E - - - - -

Fig. 2 DATA BUS TIMING

WRITE

,

'\

,---,
LONG CYCLE

-1"-1
X

ROMC

\

/

STABLE

_I"~

.

I',

• I

2V

~IPd3-1

-"

tpr,

4--tpd,,~

/

-

~tpr2----+-

-'1

.--Ipd,-..

2 V.

4--I Pd2

1-1.,STROBE

"'

.

'ISl

.

'182

Fig. 3 INTERRUPT LOGIC SIGNALS 1/0 STROBE

NOTES:

1. Timing measurements are made at valid logic level to valid logic level
of the signals referenced unless otherwise noted.
2. Symbols are defined in Table 2.

2-D28

.

.

3856 2K PSU/3861 PIO
110 operations that use the two psu 110 ports execute in three instruction cycles. During the first cycle, the port
address is transmitted to the Data Bus. During the second cycle, data is either sent from the Accumulator to the
110 latch or enabled from the 110 pin to the Accumulator depending on whether the instruction is an output or
an input. At the falling edge or Write (marking the end of the second cycle and beginning of the third cycle) the
data is strobed into either the Latch (OUTS) or the Accumulator{ INS) respectively. The third cycle is then used
by the CPU for its next instruction fetch. Figure 4 indicates 110 timing.

cw

~
oQ.
a:
a:

o(.)
~

Data Bus timing associated with execution of 110 instructions does not differ from Data Bus timing associated·
with any other data transfer to, or from the PSU. However, timing at ttie 110 port itself depends on which port
option is being used. Figures 5a, 5b, and 5c illustrate the three ports options. Figure 4 illustrates timing for the
f~ree cases.
WRITE

en
w
~

INPUT III

en
en
ct

OUTPUT (2)
(STANDARD PUllUPI

g

------DA-Tr-A-M-AY-C-H-AN-G-E-~-~X

------r---__Yi'2.9

DATA STABLE

v

STABLE

(OPENO~::~~ (2) ------r---~y~2.9 v

STABLE

.X DATA M~Y CHANGE

a15

w
Z

a:

o

III

en

o

~

OUTPUT (2)
(DR)VER PUllUPI

-----------------~-P--.~)tL----------------------------~--------• F""
2.9V

ct
C
ct

STABLE

Fig. 4 TIMING AT PSU 110 PORTS

@
(1,) The set-up and hold times specified are with respect to the end of the second long cycle during execution of the three cycle IN or INS
instruction.
(2.) All delay times are specified with respect to the end of the second long cycle during execution of the three cycle OUT or OUTS instruction.

:,1

7.2.2

Electrical Specifications

Absolute Maximum Ratings (Above which useful
life may be impaired)

VGG

+15V to -0.3V

VOO
External Interrupt Input
All other Inputs & Outputs
Storage Temperature
Operating Temperature

+7V to -0.3V
-600 p.A to +225 p.A
+7V to -0.3V
-55°e to+150 0 e
oOe to +70o e

SUPPL Y CURRENTS
TEST
SYMBOL PARMJIETER MIN. TYP. MAX. UNITS
CONDITIONS

100

VOo Current

30

70

rnA

f = 2 MHz,
Outputs
Unloaded

IGG

VGG Current

10

18

rnA

f = 2 MHz,
Outputs
Unloaded

Supply Currents measured with VOO = +5V ± 5%,
o
VGG = +12V ± 5%, T A = oOe to +70 e. All other
eleCtric~1 specifications are in Table 7-4. All
voltages ~easured with respect to VSS.

2-D29

3861 PIO·

Table 7-4. A Summary of 3861 PIO Signal Characteristics
MAX.

UNITS

Input High Voltage
Input Low Voltage
Output High Voltage
Output Low Voltage
Input High Current
Input Low Current

3.5

VOO
0.8
VOD
0.4
1
-1

Volts
Volts
Volts
Volts
pA
pA

10H'= -100 pA
10L = 1.6 mA
V IN = 6V, 3-State mode
V IN = V SS' 3-State mode

VIH
VIL
IL

Input High Voltage
Input Low Voltage
Leakage Current

4.0

VDD
0.8
1

Volts
Volts
pA

VIN = 6V

PRIORITY IN AND,
CONTROL LINES
(PRI IN, ROMCOROMC4)

VIH
VIL
IL

Input High Voltage
Input Low Voltage
Leakage Current

3.5

VDO
0.8
1

Volts
Volts
pA

VIN = 6V

PRIORITY OUT
(PRIOUT)

VOH
VOL

Output High Voltage
Output Low Voltage

3.9

VDD
0.4

Volts
Volts

10H = -100 pA
10L = 100 pA

INTERRUPT
REOUEST
(lNT REO)

VOH
VOL
IL

Output High Voltage
Output Low Voltage
Leakage Current

0.4
1

Volts
Volts
pA

Open Drain Output (1]

VSS

DATA. BUS DRIVE
(DBDR) •

VOH
VOL
IL

R~tPut High Voltage
QLitput low Voltage
Leakage Current

VSS

0.4
1

Volts
pA

EXTERNAL
INTERRUPT
(EXT INT)

VIH
VIL
VIC
IIH
IlL
IlL

Input
Input
Input
Input
Input
Input

1.2
15
10
-225
-500

Volts
Volts
Volts
pA
pA
pA

SYMBOL

DATA BUS
(DBO-OB7)

CLOCK LINES
(,WRIT~)

I/O PORT
(STANDARD
PULL-UP)

VIH
VIL
VOH
VOL
IIH
10L

VOH
.- VOH
VOL
VIH
VIL
IlL
IL

PARAMETER

TEST CONDITIONS

MIN.

SIGNAL

High Voltage
Low Voltage
Clamp Voltage
High Current
Low Current
LpVJ Current

Output High Voltage
OutP!Jt High Voltage
Output Low Voltage
Input High Voltage
Input Low Voltage
Leakage Current
I nput Low Current

VSS
3.9
VSS

VSS

VSS

VSS

10L = 1 mA
VIN = 6V
External Pull-up

3.5

-150
3.9
2.9
VSS
2.9
VSS

VDD
VDD
0.4
VOD
0.8
1
-1.6

10L = 2 mA
VIN = 6V

IIH = 185pA
VIN = VDD
VIN = 2V
VIN = VSS

Volts
Volts
Volts
Volts
Volts

10H = -30 pA
10H = -100 pA
10l = 2 mA
Internal Pull-up to VOO (3)

/lA
mA

VIN = 6V
VIN = O.4V (4)

Notes:
1. Pull-lip resistor to V DDDn CPU.
2. POliitive current is defined as conventional current flowing into the pin referenced.
3. Hysteresis input circuit 'provides additional 0.3V noise immunity while internal/external pull-up provides TTL compatibility.
4. Measured while I/O port is outputting a high level.
5. VSS = OV, VDD = +5V
6. Output device off.

± 5%, VGG = +12V ± 5%, T A = O°C to +70°C.

2-D30

3861 PIO

Table 7-5.

AC Characteristics: VSS

A Summary of 3861

PIO Signal AC Characteristics

= OV, Vee = +5V ± 5%, T A = 0

o

e to +70 e

Symbols in this table are used by all figures in Section 7.
cw

~
a:
o0-

SYMBOL

PARAMETER

MIN.

TYP.

MAX.

TEST
CONDITIONS

UNITS

a:

o(.)
~

P(ll

0.5
180
60
60

td8,
tr1
tr2·
tp r l
tp r 2
tp d l
tp d 2
tp d 3
tpd4
*t sp

!f> Period
!f> Pulse Width
!f> to WRITE + Delay
!f> to WRITE - Delay
WRITE to DB Input Delay
WR ITE Pulse Width
WRITE Period; Short
WRITE Period; Long
WRITE to ROMC Delay
WRITE to DB Output Delay
WRITE to DBDR - Delay
WRITE to DBDR + Delay
WRITE to INT REO - Delay
WRITE to INT REO + Delay
PRI IN to INT REO - Delay
PRI IN to INT REO + Delay
PRI IN to PRI OUT - Delay
PRI IN to PRI OUT + Delay
WRITE to PRI OUT + Delay
WRITE to PRI OUT - Delay
WRITE to Output Stable

*t su
*th
*t ex

I/O Set-up Time
I/O Hold Time
EXT INT Set-up Time

1.3
0
400

w
Z

PWl
tdl
td2
td4
PW2
PWS
PWL
td3

oal

td7

u)
w

~
oC/)

U
C/)

<
o/S

a:
C/)

o

::?i

<
c
<
@

P-180
250
225
2P!f>+1.0
P

pS
nS
nS
nS
pS
nS

550

nS

2P+850-td 2

nS

t r , tf = 50 nS typo
CL = 100 pf
CL = 100 pf
t r , tf

= 50 nS typo

4P
6P!f>

2P+100-td 2

2P+200
200

430
430
240
240
300
365
700
640
2.5

nS
nS
nS
nS
nS
nS
nS
.nS
nS
pS

CL

= 100 pf

Open Drain
CL = 100 pf (1)
CL = 100 pf [3]
CL = 100 pf [2]
CL = 100 pf
CL = 50 pf
CL = 50 pf
CL = 50 pf
CL = 50 pf
CL = 50 pf.
Standard Pull-up

pS
nS
nS

Notes:

1. Assume Priority In was enabled (PRI IN

=OJ

in previous F8 cycle before interr~pt is detected in the Pia.

2. PSU has interrupt pending before priority in is enabled.
3. Assume pin tied to INT REO input of the 3850 CPU.
*4. The parameters which are starred in the table above represent those which are most frequently of importance when
interfacing to an F8 system. Other parameters are typically those that are relevant only between F8 chips and not normally
of concern to the user.
5. Input and output capacitance is 3 to 5 pf typical on all pins except VDD. VGG. and VSS.

2-D31

3861 PIC
,

(/

r--_---'\
_________...JL __ __ ).'-___I'--_
_~\l..)

_

LONG CYCLE
STABLE
~----~----td7----------~
I~

~

OAT A BUS OUTPUT

STABLE

I

I-

-IX

~-----------td4------------~

DATA BUS INPUT

I

DBDR
(START OF
,DATA OUT)

,

DBDR (END OF

STABLE

i

I~

~----------td7--------~~

•

L

tda

DATA OUT IN
,"
SUBSEQUENT CYCLE)

Figure

'WRITE

7~3.

3861 PIO Data Bus Timing

"

r- =1
. j

'su

\~-----

----l

rJ>
CD

~

w

l-

.

.

..
..)

.

...

DMAREOl
DEVICE
1

DMACKl

I/)

r

I/)

..

..

DM~~E02
~

DEVICE
2

DMACK2

\N"

Figure 3-10. Using SC/MP in a System with Direct Memory Access

3-17

N'ow let us look at how the SC/MP bus-sharing logic might be used in a multiprocessor
system. It is in such a system that the CPU's bus-sharing logic can be most appreciated.
First, let us restate the rules which govern the conditions of the SC/MP ENOUT output
sign~1.
'
,
"
':,i
'

SC/MP IN
MULTIPROCESSOR
SYSTEMS

1)

ENOUTis always low while SC/MP is actually using the System Busses; that is, while the ENIN input and
, BREQ output are both high.
. .'
2) When SC/MP is not using the System Busses (either BREQ output or ENIN input loW), ENOUT is held in the
'
same state as the ENIN input.
The effect of these rules may not be immediately obvious. To see how they function to simplify bus-sharing, let
us construct a 'simple multiprocessor system consisting of two SC/MP CPUs and some memory.
VGG (-7V)

BREQ1
~----t~ ENIN1 ,

ENOUTl

t----.-... ENIN2

BREQ2

SC/M,P
#2

SC/MP
#1

SYSTEM BUSSES

MEMORY
t.::

There are three possible situations that can exist with this configuration.
1)

If one of the CPUs is currently using the bus. it is outputting a high on the BREG line. This automatically prevents
the other CPU from vy'ing for the bus until the BREQ'lire goes low upon completion of the bus access by the first
CPU.
'

2)

If neither CPU is currently using the bus. the BREG line is low. If one of the CPUs requires bus access. it can now
output.a high on the BREG !!Il~' Once again. this will prevent the other CPU from subsequently vyi~g for the bus.

Thus far there would seem to be no need for any control signals except the bidirectional BREQ line. However, it
is when t~e third possibl~ situation is encountered that the ENIN and E"!OU'! signals are needed.

3-18

3)

If both CPUs require bus access at the same time. each will test the BREQ line and. finding it low. will output a high
on BREQ. This simultaneous occurrence of requests for bus access is resolved by using the ENIN and ENOUT signals. The operation of these bus access signals to resolve this situation can be illustrated as follows:
, SC/MP #1 BUS
,ACCESS COMPLETE

cw

~
a:
oa..

SC/MP #2 'BUS
ACCESS COMPLETE

BREQl

a:

o

u

BREQ2

~

enw

~
o
II)

ENINl

U
II)

~

ENOUTl

olI

iii
Z

a:

o

ENIN2

al
II)

o

~
~

c

SC/MP #2 GRANTED
BUS ACCESS

BUS ACCESS

~

@

When the BREQ line goes high it applies a high input to the ENIN1 input of SC/MP #1. SinceBREQ 1 is also high at this
time. SC/MP #1 now has access to the bus and it outputs a low on ENOUT1. This is applied to the ENIN2 input to
SC/MP #2 and thus deniesbus,access by SC/MP #2. Notice that SC/MP #2 holds its BREQ2 output signal high even
though its request has not yet been granted. When SC/MP ,#1 has finished, its bus access. the BREQ 1 output returns
low. However. since the BREQ2 output is still high. ENIN1 remains high. This condition of BFlEQ1 low and ENIN1 high
causes the ENOUT1 signai to go high. thus enabling SC/MP .#2.
This arrang~~e~t allows the 'first CPU in a daisy-chain string to have the highest priority for bus access and also
automaticaliy allows any other CPU to gain immediate access to the busses whenever they become availabie.
Now that we have described the .wayin which the bus-sharing logic of the SC/MP CPU can be
SC/MP, CONTROL
used in a multiprocessor system.' let us continue just a bit further and describe a few more
TECHNIQUES IN
common considerations that you must deal with if you are designing a multiprocessor system.
MULTIPROCESSOR
We will limit this discussion primarjiy to hardware and control considerations since programAPPLICATIONS
ming in a multiprocessor system can become quite complex and is beyond the scope of this
book. However. the techniques we will describe here are the first step towards simplifying the programming for such a
"
system.
The first operation that you must deal with in any microcomputer system is initialization of the system. This
operation requires some additional thought when designing a multiprocessor system. Typically. one CPU will be
the primary or controlling CPU: how do you ensure that this CPU has control of the system when power is first applied?
Figure.3-11 illustrates an easy method of establishing system control upon initialization.The system reset signal
(NRST). which is generated at power-up. is applied to SC/MP #1. The FLAG 1 output from SC/MP #1 is then applied to
the NRST input of SC/MP #2. Since the FLAG1 line is connected to a bit in the CPU's Status register which is set to
zero onpower-up. SC/MP #2 will be held in a reset condition untii SC/MP #1 executes an instruction which sets that
bit (and thUS. the FLAG1 output line) high.
Of course. this method requires the FLAG1 output from SC/MP #1 to be dedicated to this initialization operation. If this
is a problem. you could use two separate initialization circuits with. for example. the RC time constant for the SC/MP
#2 circuitry being greater than that of the circuitry for SCiMP #1. This approach. however. does not provide the positive control of the first method we described.

3-19

Initialization
Circuit

-

7

NRST

SC/MP
#1
FLAG 1

~

21

~

NRST

SC/MP
#2

Figure 3-11. One Method of Initializing an SC/MP Multiprocessor System
Once the multiprocessor system has been initialized and is running, the bus-sharing logic that we've already described
will resolve contentions between the CPUs as far as access to System Busses is concerned. However, there might be
situations where we want to assure that one of the CPUs will be guaranteed immediate and extended access to
the System Busses. This can also be accomplished quite easily with SC/MP as illustrated in Figure 3-12.

SC/MP
#1

~

-

8

21

CONT

FLAG 1

SC/MP
#2

Figure 3-12. Forcing the Halt State in an SC/MP Multiprocessor System

3-20

In this illustration the FLAG 1 output of SC/MP #2 is inverted and applied to the CONT input of SC/MP #1. Now. if the
F1 bit in the Status register of SC/MP #2 is set to "1". SCiMP # 1 will be forced into the Halt state and is effectively
removed from the system until the F1 bit is reset under program control.

THE SC/MP RESET OPERATION
cw

~
oQ.

II:
II:

o

o

~

enw
~

gen

An NRST low signal input to the SC/MP CPU initializes the microprocessor. While NRST is low. any in-process
operations are automatically aborted and the CPU's strobes and address and data lines are floated. NRST must be held
low for a minimum of two microcycles. After NRST goes high again. this is what happens:
1)
2)
3)

All of the programmable registers are cleared.
The first instruction is fetched from memory location 000116.
The Bus Request (BREO) for this first input/output ope~ation occurs within 6-1/2 microcycles after NRST goes high.

The NRST signal can be used at any time to reset the CPU, and must be used following power-up since SC/MP
may power up in a random condition. After power has first been applied to the CPU. you should allow approximately
100 milliseconds for the oscillator and internal clocks to stabilize before applying the NRST signal.

en

SC/MP SERIAL INPUT/OUTPUT OPERATIONS

a/I

The SC/MP CPU not only has two of its 40 pins designated primarily for serial input/output operations, it also
dedicates one instruction from its rather limited instruction set solely to serial I/O. Allocation of this amount of a
CPU's resources for this purpose would seem unwarranted with most microprocessors; however. keep in mind that
SCiMP is a very low-cost device and intended primarily for use in slow-speed applications. It is quite likely that SC/MP
will frequently be used to transfer data serially. so it is therefore not only reasonable but advantageous to provide
straightforward methods of performing these operations, Let us look now at how this is done with SC/MP.

<
w

Z

II:

o
IC
en

o

~

<
c
<
@

In our description of SClMP's programmable registers. we described the Extension (E) register as an 8-bit register.
When the E register is used for serial I/O, it is actually a 9-bit register with connections to two of the device
pins as shown in the figure below.

SIN

Extension

Output

Register

Latch

~716151 . 131211Io~ sour

When the SC/MP SIO (Serial Input/Output) instruction is executed, the contents of the Extension register are
shifted right one bit positipn: the previous contents of bitO are'loaded into the output latch and output on the SOUT
pin. and the level (1 or 0) present at the SIN pin is loaded into bit 7 of the Extension register. The Extension register can
be loaded from. and its contents can be transferred to the Accumulator. A typical serial output operation would thus
consist of:
1)
2)
3)

Loading the Accumulator with the data byte that is to be transmitted.
Transferring the contents of the Accumulator into the Extension register.
Performing eight SIO'instructions to shift the contents of the Extension register into the output latch and out onto
the SOUT pin.

Of course. this sequence does not cover all the programming requirements for serial data transfers. For example. your
program must provide spme method of timing the bit transmission. This is easily accomplished with SC/MP by using
the Delay (DL Y) instruction. which can generate variable time delays ranging from 13 to 131.593 microcycles. For
asynchronous operations. one of the SC/MP Flags which are connected to device pins can be pulsed each time a new
bit is shifted out (or in) and one of the sense conditions inputs (SENSEA or SENSEB) can be tested to detect bit
received/ready.
.
.

3-21

THE SC/I\IIP INSTRUCTION SET
Table 3-4 lists the SC/MP instruction set.
Memory reference instructions are shown as having either full or limited addressing capability. Full addressing
capability is identified in the operand as follows:
It'

OISP

(X)

T'" , ' ,

If P""'"1. X "",d, '0"" .2 0,P3, ",d ;"d",d
addressing is specified

Must always be present. Specifies a program
relative displacement. '

--------If present. specifies auto-increment or autodecrement addressing.

Thus. the real options associated with full addressing capabHity are:
DISP
Direct. program relative' addressing
DISP(X)
Direct. indexed addressing
@DISP(X)ALJto-increment or auto-decrement addressing'
limited addressing capabilities do not include the auto-increment and auto-decrement feature. The operand field for
instructions with limited addressing capability is shown as follows:
'

rr

OISP

(X)

If pre""" X ,,,,,d,

'0' • I, .2 0' P3 ",d ;"d.,""

addressing is specified
Must always be present. Specifies a program .
relative displacement.

The serial I/O instruction inputs serial data via the high-order bit of the Extension register. and/or outputs serial data via
. the low-order bit of the Extension register.
"
The serial 110 instruction works as a on~-bit right shift of the Extension register contents. withbitO being s'hifted to the
SOUT pin and the SIN pin being shifted into bit 7. This has been illustrated along with the logic description.
It is worth noting that SC/MP has no Jump-to-Subroutine instruction: rather. the XPPC instruction is used to exchange
the contents of the Program Counter with the contents of a Pointer register. In very simple applications (and those are
the applications for which SC/MP is intended) this is a very effective scheme. Providing subroutines are not nested. a
subroutine's beginning address may be stored in a Pointer register. then execution of XPPC moves the subroutine's
starting address to the Program Counter. thereby executing the subroutine ~ but at the' same time. the Program
Counter contents are stored in the Pointer register. thus preserving the return address. At the conclusion of the
subroutine. execution of another XPPC instruction is all tha,t is needed to return from the subroutine. The only penalty
paid is that one Pointer register is out of service while the subroutine is being executed. If all Pointer registers are
needed by the subroutine. or if subroutines are nested. then the return address which is stored in the Pointer register
must be saved inmemory. In these more complicated applications. one of the Pointer registers will probably be used as
a Stack Pointer. 'and addresses will be saved on the Stack.
This type of subroutine access. while it may appear primitive to a minicomputer programmer. is very effective in simple
microcomputer applications.
The following symbols are used in Table 3-4.
AC
DATA

Accumulator
Carry status
An 8-bit binary data unit

DISP
E

The Extension register

C

An 8-bit signed binary displacement

3-22

EA

c

w

~

a::

0

D-

a::

0

u

~

enw
I-

<

U
0

CI)
CI)

<
~

w

za::

E
IE
O
PC
X
SIN
SOUT
SR
Z
@

X

0

CD

CI)

0

@DISP(X)

~

<
c
<

[ ]

@
[[ ]]

A
V
¥

Effective address. determined by the instruction. Options are:
DISP EA is [PC] + DISP
DISP(X) EA is [X] + DISP
@DISP(X) EA is [X] if DISP ~ O.
EA is [X] + DISP if DISP < 0;
in both cases [X]-[ X] + DISP after EA is calculated.
The ith bit of the Extension register
Interrupt Enable
Overflow status
Program Counter
One of the three Pointer registers
Serial Input pin
Serial Output pin
Status register
Zero status
Auto-increment flag
Bits y through z of a Pointer register. For example. P3 <7.0> represents the low-order byte of Pointer
register P3.
This designates the available addressing modes for the SC/MP. as described above. In all three of the addressing modes. if -128 is specified for DISP. the contents of the Extension register are used instead of
DISP.
Contents of location enclosed within brackets. If a register designation is enclosed within the brackets.
then the designated register's contents are specified. If a memory address is enclosed within the
brackets. then the contents of the addressed memory location are specified.
Implied memory addressing; the contents of the memory location designated by the contents of a
register.
Logical AND
Logical OR
Logical Exclusive-OR
Data is transferred in the direction of the arrow.
Data isexchanged between the two locations designated on either side of the arrow.

Under the heading of STATUSES in Table 3-4. an X indicates statuses which are modified in the course of the instruction's execution. If there is no X. it means that the status maintains the value it had before the instruction was executed.
.

3-23

Table 3-4. SC/MP Instruction Set Summary
STATUSES
TYPE

MNEMONIC

OPERAND(SI

OPERATION PERFORMED

BYTES
C

SIO

0

1

[E]-[E]
SOUT - [EO]
[E7l-SIN
Shift the Extension register rigHt one bit. Shift bit 0 of the Extension register to the output Pin
SOUTo Shift the data at input pin SIN into bit 7 of the Extension register.

[AC]-[EA]
load Accumulator from addressed memory location.
[EA]-[AC]
Store Accumulator contents in addressed memory location.

g
u..

w

lD

@

DISP(XI

2

ST

@

DISP(XI

2

ADD

@ DISP(XI

2

X

zw

DAD

@ DISP(XI

2

X

~~

CAD

@ DISP(XI

2

X

AND

@ DISP(XI

2

Add decimal to Accumulator the addressed memory iocation's contents with Carry,
[AC]-[AC]+ [EA]+ [C]
Add complement of addressed memory location's contents with Carry to AccumulatOr.
[AC]-[AC] A [EA]

OR

@ DISP(XI

2

AND Accumulator with addressed memory location's contents.
[AC]-[AC]V [EA]

XOR

@ DISP(XI

2

OR Accumulator with addressed memory location's contents.
[AC]-[AC]¥ [EA]

IlD

@ DISP(XI

2

DLD

@ DISP(XI

2

~~Q
«a:-

~ ~"~
W «

Q.

~

w

X

u

a: w

~ffi

>Q.
a:O
0>
~a:
wO
~~

"> w
a:~
«0

Oz
~«

u
w
en

~

0

w

X

[AC]-[AC]+ [EA]+ [C]
Add binary to AcciJmulator the addressed memory location's contents with carry.
[AC]-[AC] + [EA] + [C]

Exclusive-OR Accumulator with addressed memory location's contents.
[EA]-[EA]+l; [AC]-[EA]
Increment addressed memory iocation's contents, then load into Accumulator.
[EA]-[EA]-l; [AC]-[EA]
Decrement addressed memory location's contents, then load into Accumulator,

[AC]-DATA
Load immediata into Accumulator,

LDI

DATA

2

ADI

DATA

2

X

DAI

DATA

2

X

CAl

DATA

2

X

ANI

DATA

2

:E

:!

~"
a:
w
Q.
0
w
I-

«

0w
~

~

X

X

[AC]-[AC]+DATA+ [C]
Add binary immediete, Add Carry to result,
[AC]-[AC] + DATA + [C]
Decimal add immediate, Add Carry to result,
[AC]-[AC] + DATA [C]'
Add the contents of the Accumulator to the complement of the immediate data value, Add Car-

+

ry to result.
[AC]-[AC] A DATA
AND immediate.

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 3-4. SC/MP Instruction Set Summary (Continued)
STATUSES
TYPE

MN1MONIC

OPERAND'S)

BYTES

OPERATION PERFORMED
C

III

0

--

~

~

52

ORI

DATA

2

,~g

XRI

DATA

2

JMP

DISP(X)

2

I!!i

;y

[AC]-[AC] V DATA
OR immediate.
[AC]-[AC]¥DATA
Exclusive-OR immediate.

;I

D.

~

.,::l

[PC]-EA
Unco'nditional jump to effective address •

JP

DISP(X)

2

JZ

DISP(X)

2

JNZ

DISP(X)

2

If [AC] ~O; [PC]-EA
If the Accumulator contents are greater than O. lump to effective address.
If [AC] =0; [PC]-EA
If the Accumulator contents equal O. jl1rnp to effective address.
If [AC] =0; [PC]-EA
If the' Accumulator contents are not O. jump to effective address.

ZZ

02
D.t:

:EO

::lZ

w

"8

N

OJ

III

>
:E
0

LDE

[AC)-[E)

1

XPAL

X

1

XI>AH

X

1

XPPC

X

1

Load the contents of the Extension register into the Accumulator.
[AC]-[X<7.0>]
Exchange the contents of the Accumulator with the low order byte of the specified Pointer
register.
[AC)-[X<15.8>]
Exchange the contents of the Accumulator with the high order byte of the specified Pointer
register.
[PC)-[X]

1

Exchange the contents of the Program Counter with those of the specified Pointer register.
[AC)-[E)

a:

III

~
(/)

C;
a:

III

ci:

III
~
(/)

5
III
a:

XAE

Exchange the contents of the Accumulator with those of the Extension register.
W

~

cs:

ADE

1

X

DAE

1

X

CAE

1

X

X

a:

III

D.

0

a:

III

~
(/)

5

III

a:

~
I/)

5

a:

this result.
[AC)-[AC) + [E) + [C)
Add binary the contents of the Accumulator and the complement of the Extension register con-

ci:

III

III

X

[AC)-[AC]+ [E)+ [C)
Add binary the contents of the Accumulator and the contents 0; the Extension register. Add Ceirry to this result.
[AC)-[AC1+ [E1+ [C)
Add decimal the contents of the Extension register to those of the Accumulator. Add Carry to

ANE

1

tents. Add Carry to this result.
[AC)-[AC] 1\ [E)
AND the contents of the Accumulator with those of the Extension register..

Table 3~4. SC/MP Instruction .Set Summary (Continued)
STATUSES
TYPE

MNEMONIC

OPERANDiS)

BYTES

OPERATION PERFORMED
C

a

o

~I~:~~

(/)'(/)I~~
C;'Si~ !z

~a:IO 0

0

ORE

1

[AC]-[AC]V[E]

XRE

1

. OR the contents of the Accumulator with those of the Extension register.
[AC]-[AC1¥ [E)
Exclusive-OR the contents of the Accumulator with those of the Extension register.

g

O-·~·V

1

SR

~O~

Shift Accumulator contents right one bit. The high
iost.

w

SRl

~7

1

f-

w

110

W

f-

low order bit is

O~

Shift Accumulator contents right ~~e. bit. The Carry bit is shifted into the high order bit of the
Accumulator. The low order bit is lost.

,

~~=:
.
I PULL,U'

. i

l

0

' Vss

ENIN

NHDLD

IPU~~~
I

Vss

'

'

BRE'~l
Vss

r-::::-1

'INCLUDES JIG CAPACITANCE.

i

-1H~:g~T
-1'
..
~~~:2
.

Simulated Current Load

I
I

-1

VGG

....
a:

:::>

I

~...

-1 , - -

z

..

INPUT PROTECTION

~

'to
0.8

;

0.6

...

0.4

~~

0.2

~

2_____
·----,."",,-,.f.......!r--

IL ________________
-1

m·

NRDS

I

a:

Yss

xz~

2
VG~SS

. ~

Vss

I

,,1.

NWDS

-1

8

Vss

V

u

I

~

~

... ..
.. ..
C>

Z

Vss

C>

Z

~

60 70 BO

-20

100

AMBIENT TEMPERATURE I'C)

SC/MP Driver and Receiver Equivalent Circuits

TYPICAL PLOT OF NORMALIZED IGG lAND ISS)
VERSUS AMBIENT TEMPERATURE
DC POWER' IGG • vGG+ ISS· VSS

B~' BREa, ENIN, and ENOUT Timing

22

22

22

NADS

NRDS!NWDS'~~
Note 1: ENOUT goes high to indicate that SC/MP was granted access to bus (ENIN high) but is not using bus.
Note 2: ENOUT goes low in response to low ENIN input.
Note 3: SC/MP generates bus request; bus access not granted because ENIN low.
Note 4: ENIN goes high. Bus access now gran~ed and input/output cycie actually initiated. If ENIN is set low while SC/MP
has access to the bus, the address and data ports will go to the high-impedance (TRI-STATE@) state, but BREQwili remain
high. When ENIN is subsequently set high, the input/output cycle will begin again.
Note 5: I/O cycle completed. ENOUT goes high to indicate th2
INTE
DBIN

WR
SYNC
(VC C) + 5V

26
25
24
23
22
21

20

PIN NAME

All
A14
A13
A12
A15
A9
A8
A7
A6
A5

.4.4

A3

+ 12V (VDD )
A2
Al
AO
WAIT
READY
4>1
HLDA

DESCRIPTION

-AO - A15
-DO -

TYPE

Address Lines

07

Output. Tristate

Data Bus Lines

Bidirectional. Tristate

Machine Cycle Synchronizer

Output

-DBI~

Data Input Strobe

Output

;READY
"-WAIT

Data Input Stable
CPU In Wait State

SYNC
_

Input

-\iVA

Data Output Strobe

Output
Output

-HOLD

Enter Hold State

Input

-HLDA

Hold Acknowledge

Output

~INT

Interrupt Request
Interrupt Enable

Input
Output

4>1. 4>2

Reset CPU
Clock Signals

Input

VSS·VDD'vCC·VBB

Power and Ground

-INTE
-RESET

Inpu~

-These signals connect to the System Bus.

Figure 4-2. 8080A CPU Signals and Pin Assignments

CLOCK SIGNALS
Two clocks.' <1>1 and <1>2. provide the CPU with· its til"!ling ..

Figure 4-3 illustrates the way in which clock signals <1>1 and <1>2 are used to generate a machine cycle consisting
of fiye 'clock periods. A SYNC pulse identifies the first clock period of every machine cycle.

4>1

4>

JJl

t9

211

I

SYNC:
I

.

~

n
n~_. .n~___:
'1 ~ I ~r"'\-.-~: n
I:
i" '. . --"1_..1 . . . . . . ._.~"'.:',
n

Ii . . -~.I-----~. . . ----....---.-....,
I

_

.•.

'I

..

J

II

.

SYNC. pulse Identifies clock period T 1

Figure4-3. A Machine C'ycle Consisting of Five Clock Periods:'

4-8

I

A 9-segment clock is specified for the 8080A.where the <1>1 and <1>2 signals are generated out of 9 segments as
follows:

2
I

cw

1 pulse at the start of T2 to read status off the Data 8us. Timing is illustrated in Figure 4-4.

8080A
INSTRUCTION
STATUS

If you are using an 8228 System Controller, it will decode status output on the Data Bus
during T2. By combining this status information with 'the three control signals: WR. DBIN and HLDA. the 8228 System
Controller is able to generate a set of bus control signals which will interface' industry standard memory devices and external logic.
.
If you are not using an 8228 System Controller, then you must provide external logic that decodes the Data Bus
during <1>1 of T2. Your external logic must generate control signals which will be active during' subsequent clock
periods, at which time the Data Bus no longer holds status information. j;.

<1>1

<1>2

SYNC

. Status on
Data Bus

Strobe to read status off Data Bus
when <1>1 and SYNC are both high

Figure 4-4. Status Output During T2 of Every
Machine Cycle

4-10

Table 4-2 defines the statuses which may be output during clock' period T2. Table 4-3 defines the way in which
statuses should be interpreted to identify the various possible types of, machine cycles.
Table 4-2. Statuses Output Via the Data Lines Du~ing the Second
Clock Cycle of an 8080A Machine Cycle
DATA BUS
BIT

Q
III

SYMBOLS

HLTA

D3

Acknowledge signal for Halt instruction

a:

INTA*

DO

Acknowledge signal for INTERRUPT request. Signal should be used to gate a
Restart instruction onto the Data Bus when DBIN is active.

INP*

D6

Indicates that the Address Bus contains the address of an input device and
the input device shou Id be placed on the Data Bus when DBIN is active.

g

~

OUT

D4

en
en

Indicates that the Address Bus contains the address of an output device and
the Data Bus will contain the output data when WRis active.

oCt

MEMR*

D7

Designates that the Data Bus will be used for memory read data.

ail

M1

D5

Provides a signal to indicate that the CPU is in the fetch cycle for the first
byte of an instruction.

STACK

D2

Indicates that the Address Bus holds the pushdown stack address from the
, Stack Pointer.

WO

D1

Indicates that the operation in the current machine cycle will be a WRITE
memory or OUTPUT function (WO = 0). Otherwise a READ memory. INPUT
operation. or interrupt or Halt acknowledge will be executed.

~
a:
o
D.

o

CJ

~

en
III

III

Z

a:

oaI

en

o

~

oCt

Q

oCt

@

DEFINITION

*These three'status bits can be used to control the flow of data onto the 8080A Data Bus.
Table 4-3. Statuses Output on the Data Bus for
Various Types of Machine Cycle
TYPE OF MACHINE CYCLE
III

"....e
III

z

0
j:

:I:

~

~

<

....

iii
III
;:)

ID

<
....
<
e

(0)

a:
0

II.

~
III

;:)

....
....<
III

~

C.)
....
z

0
j:

C.)

;:)

a:

....
III
~

0

e
<
III
a:
>
a:
0

~

III

~

z

III

....

a:
~

>
a:

0

~

III

III

e
<
III

a:.

~
C.)
~

III

....

a:
~

~
C.)
<.

....

e
,<
III

a:

....
;:)
0.

~

III

III

~

....

a:
~

....

;:)

0.
....
;:)

III

III

"e
0. ....

"~e

a:o
a:z

.... z

.... 111

~

;:)~
III~

0

....~

0

~<

""C.)

2 triggers the SYNC high pulse'. identifying period T 1,
WAIT is low. since the CPU is not in the Wait state,
WR remains high since this is an instruction fetch cycle; data is not being writte,n to memory,
I . , . '

•

The leading edge of <1>2 is used to set selected Data Bus lines high. providing external logic with status
i.nformation as follows:
RlfWO (D1),
. The CPU is expecting data input.
M 1 (D5)
,This is an instruction fetch period.'
MEMR (D7) . Data input is expected from memory.
The leading ,edge 0(<1>2 is used to set the required
Period T2

memo~

address on the address lines AD to A 15.

External logic uses the <1>1 pulse of ti'me 'period T2 to read status off the Data Bus, The read status strobe
'
may be created as follows:

SY:~

'~D"--------READSTATUSSTROBE

________

Remember. if you are using an 8228 Syste'm Controller.' it reads and decodes status for you.
ImmediatelY after status has been output on the Data Bus. the Data Bus is free to receive the instruction
object code. The addr'ess for the instructio'n object code'will be on'the Address Bus; this address appears
on the Address Bus during T 1. beginning with the rising edge of <1>2, The fact that status has been output
and the Data Bus is free to receive the instruction,object code is indicated by DBIN being pulsed high.
The DBIN high pulse begins with the rising edge of <1>2 in T2 and lasts exactly one clock period.
Period T3

While DBIN is high. external logic must place the addressed instruction code on the Data Bus. The CPU
will store this data iii the 'Instruction register -whence the Control Unit interprets it as an instruction
code.
The Data Bus is floated at <1>2 during T3. This means that the Data Bus has been disconnected from the
CPU a~d can be used in any way by .Iogic external t~ the CPU. ,
.

Period T4

The Address Bus is floated at <1>2 during T4,

The 8080A uses', 2 and 3 byte instructions. Each byte of a multibyte instruction requires its own instruction
fetch. Exact timing for multibyte instructions is given later in this chapter. after the 8D8DA instruction set has been de..
scribed.

A MEMORY READ ,OR WRITE OPERATION
SO far as external logic is concerned. there is no difference between "read from memory" timing and instruction fetch
timing - ex~ept that the M 1 status (D5 on the Data Bus) is high during an instructio,", fetch only. Figure 4-5 therefore
applies to a memory read operation also.

Since a memory read operation is executed during time periods T" T2 andT3 of a,machine cycle, the presence
of a memory read operation in an instruction's execution sequenc~ will add one machine cycle to instruction execution time.
'
"
Figure 4-6 shows timing and signal sequences for a memory write opera~ion. The signal sequences are identical
to the instruction fetch sequence with the exception that DBIN remains low during T2 and T3, and different
status signals are output on the Data Bus during T,.
'

SEPARATE STACK MEMORY MODULES
One 8080A CPU can access two memory modules with overlapping memory, addresses: a stack memory
module and a nonstack memory module. Overlapping memory addresses can be used by the two memory modules.
since Stack status (D2 high at <1>1 in T2) can be used to select the stack memory. while lack of Sta~k status (D2 low at
<1>1 in T2) can be used to select nonstack memory. External logic must decode the' address as referencing stack or nonstack memory.
'
,

4-12

Note that the 8228 System Controller does not generate a STACK control signal. Nevertheless. if you wish. you may implement separate stack and nonstack memory. with overlapping addresses; this requires your own status decode logic
to isolate the Stack status. Such logic is quite simple. and may be illustrated as follo~s:

SY:: _ _ _ _ _.

w

~
a:
oQ.

a:
o
u
~

iii

.-----

D--[l>~

Q

-

Stack memory select

Nonstack memory select

The only disadvantage associated with having a separate stack memory is that nonstack instructions cannot reference
the stack memory.

w

~

g

T1

U)
U)

ct

<1>1

~

w
Z

a:

oCD

U)

o

~

ct
Q
ct

@

SYNC

READY.f\

I

I
I

WAITjr1l~I+-________-+__~______-p______~__~~____~~~__________~

DBIN

Di
(instruction I

AO
to A15
I .

I
I
I

External Logic
Read Status
Di - Signals

I·

I
I
I.
I
I

I

I
I

I
.1

I

I
1.. .....1------I Instruction Fetch -----~.~
I

-The NEC 8080A maintains the address on the Address Bus during T4 and T 5'

Figure 4-5. 8080A Instruction Fetch 'sequence

THE WAIT STATE
A Wait state may occur between clock periods T2 and T3. The Wait state frees external
logic or memory from having to operate at CPU speed. Wait state timing is illustrated in Figure
4-7 and Figure 4-8.

8080A
SLOW
MEMORIES

If READY is low during <1>2 of T2. the 8080A CPU will enter the Wait state following T2. The Wait
state consists of any number of clock periods during which the CPU performs no operations and maintains the levels of
all output signals. The Wait state ends when READY is input high. The CPU samples READY during every <1>2 pulse
within the Wait state; the Wait state will therefore end with the <1>1 pu Ise which follows a <1>2 p~ Ise during which
READY is sensed high.

4-13

Memory interface logic in any 8080A microcomputer system must be designed to anticipate that every memory
access either will, or will not require a Wait state.

If memory is as fast as the 8080A CPU, then READY will normally be held high, in anticipation of no Wait state. In
Figures 4-7 and 4-8 a broken line is used to represent this "READY normally high" case. Memory interface logic will
pull READY low in order to insert one or more Wait machine cycles only in special circumstances: memory interface
logic has until 1

_ _ _ _ _ _....1

c

w

~
a:
oa.

a:

o(J
!:

en
w

READY

Consider the sequence of signal transitions in the logic we have illustrated above. At each <1>1 clock pulse. tranSitions
will occur as follows:

l-

e:(

g

4>1

(I)
(I)

e:(
~

w

Z

a:
o
ca

01

--0-_.1

(I)

o

~

01-' 02

e:(

c

e:(

@

02
READY

It requires 01 and 02 to be high simultaneously for READY to be low; and that condition exists for a single clock pulse.

Observe that you can use READY to trigger a one-shot in order to create a low READY input of any duration.

T,

T3

T2

T4

T5

4>1
4>2
SYNC

READY

I
WAIT.f\. I
I
WRVI

I
I

I Status

. -••• "' ••• Represents alternate signal form for READY as described in text accompanying this figure.

Figure 4-7. The 8080A CPU Operating With Fast Memory and No Wait State

4-15

T2

WAIT

cfJl
cfJ2

SYNC,

READY

I
WAITJ\

I
1 - ,- - _. . . . ._ - . . . ,

(Write Only)

WRVI
I

- _ ••• "'... Represents alternate signal form for READY as described in text accompanying this figure.
READY is false at cfJ2 in T 2, so next cfJl pulse initiates a Wait state, with WAIT set high by the leading
edge of the cfJl pulse. When READY is high at a 1 ...I

mac~".

La"
cycle
of an instruction's
execution

I

..

HOLD state clock periods'

~

I"1 in T3. If a HOLD is requested during a write or output operation, then HLDA is set
high by the leading edge of <1>1 in the cycle following T3.
Note that even though HOLD is acknowledged and the Hold state is initiated in T3 during a read memory or input data
machine cycle, logic must still hold data steady on the Data Bus until the leading edge of <1>2 in T3. This is because
operations internal to the CPU will be executed normally during a HOLD. Operations internal to the CPU will only cease
if the Hold state lasts for more cycles than would normally ~e present before the onset of the next T 1 cycle.

al
CI)

o

:iE'
~

c

~

@

HOLD low will cause the end of the Hold state. HOLD low must coincide with the leading edge of <1>1 or <1>2, and will
terminate the Hold state at the <1>1 pulse of the next machine cycle's T 1 clock period. The 8080A CPU will signal the
end of the Hold state with HLDA false.
During the Hold state, the Data Bus and the Address Bus are floated. Floating begins at <1>2 in T3 for a read operation
and at <1>2 in the clock period following T3 otherwise.
Figures 4-9 and 4-10 illustrate some variations on the Hold state.
The NEC 8080A and the Intel 8080A differ when a Hold is 'requested during a DAD instruction's execution. The NEC 80BOA initiates the Hold as though a read operation was occurring,
while the Intel 8080A initiates the Hold operation as though a write operation was occurring.

NEC 8080A
HOLD
DIFFERENCES

M.chine Cycle N + 1

SYNC
HOLD
HLDA

H---t---I-f--+-+---+---+--

HOLD STATE

--+-----+----+----4!'-----j

Wi H--~~~~~-~~--~---~---+_--+_---+_---~---~--~
00 to 07

\V--+---+---+-'--t floating
f---'-----l---+---+- flo.ting·I
·optional, depending on instruction being executed

Figure 4-9A. Floating of Data and Address Busses at <1>2 in T3, for READ Operation Being Completed Prior
to Onset of Hold State

4-17

Figure 4-9B. Flo'ating of Data and Address Busses at <1>2 in T4. for a WRITE. or Any
Non-READ Operation (RI/WO=False)

Machine Cycle N + 1

Machine Cycle N

SYNC

HOLD
HLDA rt------r----t--~.----+~------~-----HOLDSTATE--~------~------~L~----_1

WR ~------r----r--~---+~------~------~------~~----~~------~----~
"""---+-------+------_+_~ floating

I
Figure 4-1 OA. Floating of Data and Address Busses for READ Operation in"a Three Clock
Period Machine Cycle
Machine Cycle N + 1

Machine Cycle N

SYNC

HOLD 1-+------1--+-----1-+--'
HLDA hr------r-lr----ri----~I.-+_~~~----~--HOLDSTATE ____~------~~L-----_1

WR Ht-------I--+----.J

DO to 01

Ao

to A,s

H:J'---.:......,-....
1--A----I------I-------1--_

Figure 4-1 OB. Floating of Data and Address Busses at <1>2 in T 1. for WRITE or Any Non-READ Operation Being
Completed Prior to Onset of Hold State

4-18

THE HALT STATE AND INSTRUCTION
The Halt state is similar to the Wait state, except that it is initiated by a Halt instruction.

Q

w

~
a::
o
Do

The Halt state is not initiated by READY low. although READY low is a necessary requirement for the onset of the Halt
state. This means that READY high cannot be used to terminate a Halt state. Instead. an interrupt request (lNT high)
must be used to terminate the Halt state.

Note that if interrupts have been inhibited, the interrupt request (lNT high) will never be acknowledged, and
the only way , to get out of a Halt state is to power down, then power up the CPU.
l

CJ

An anomaly of the Halt state is that the Data and Address Busses may be floated by entering th~ Hold state after entering the Halt state; that is. you can move into. and out of the Hold state while in the Halt state.

en
w

If the Hold state is entered after the Halt state. then the Hold state must be exited py setting HOLD low before exiting
the Halt state.

g

During a HALT. a hold request signaled by HOLD will not be acknowledged if an interrupt has been requested (lNT
high) but not acknowledged (lNTE high); i.e .. the CPU will not enter the Hold state in the time be~ween an interrupt
being requested and acknowledged. Once the interrupt has been acknowledged (lNTE 10wL the CPU may enter the
Hold state.
'

a::

o

,~

~

(I)
(I)

1 pu Ise. Since the Program Counter contains 0000. the first instruction executed following RESET will be the instruction stored in memory
"
'
,
location 0000) 6.
Interrupts remain disabled when program execution resumes.

When you power up any 8080A system you must simultaneously reset it. Powering up does not reset or change
anything within the 8080A. If you power u'p without resetting. then registers. including the Program Counter. will contain undefined data; thu~ program execution will immediately and erroneously begin at some random location of
memory.
Here are two possible reset on power up logic implementations:
First a simple logic sequence:
+ 5V

RESIN
8224

~

I

RESET

Next a more s:omplex. and more reliable one:
+5V
1.0

1.0

MH

MH

B

4

6

if

Vee

T~
1/674LS04

2

TR

555

. RESIN

OUT

8224

7

~- -

RESET

lo.,uF

lo. ,uf

--

--

--

Machine Cycle N t 1

N
T,

T2

11

\

READyJ\

'\I

)

/

V

DBIN

n

.(L

~

/\\

\

T,

T5

n

n

h
~

"": N + 2
T4

T3

U~

h

Ln 1~
SYNC

GND

ev

I +O.47UF
h

DIS

WAITJ\

W'RJ\

I

INT

\

l\,)

INTE

1--~.

,

\.,

D; Status

\~

I

DS~~~lt~

I

I

.J

I
floating

I

External Logic
Read Status
Do - Status
Inte;rupt Initiation

Figure 4~

11,

Interrupt Initiation §e'Quence

4-20

I

EXTERNAL INTERRUPTS

External logic may reque~tan i,nterrupt at any time by setting thelNT input hi~h. An interrupt request will only
be acknowledged if interrupts have been enabled. Normally the EI (Enable Interrupts) and 01 (Disable Interrupts) instructions are ~xecuted to enable and disable interrupts; however. interrupts are automatically disabled by the CPU
during the RESET condition. and following an interrupt ackhowledge.

cw

tiII:
Q

a..

II:

o

U

~

enw
~

g
en
en

The 8080A CPU outputs INTE high when interrupts have been enabled. and low when interrupts are dis~bled. If interrupts are enabled. then the 8080ACPU will acknowledge an interrupt request during the next T1 clock period. on the
rising edge of 2 in clock period T2:this is one clock period later than illustrated in Figure 4-11. Note that this difference in NEC 8080Aresponse applies only to the
interrupt acknowledge process occurring within a Halt state.

NEC 8080A
EXTERNAL
INTERRUPT
DIFFERENCES

WAIT AND HOLD CONDITIONS FOLLOWING
AN INTERRUPT
An interrupt cannot be a'cknowledged during a WAIT or HOLD condition. However. either of these conditions may occur following the interrupt acknowledge. For example. if there is insufficient time between <1>1 in T2 and <1>2 in T2 for
external logic to fetch the required RST or CALL instruction. more time may be acquired by using the READY signal to
generate a Wait state. as with any instruction's execution.

THE 8080A INSTRUCTION SET
Table 4-4 summarizes the 8080A instruction set; there is.a significant departure in instruction set philosophy
from the hypothetical microcomputer described in Volume I.
The 8080A is most efficiently programmed by making extensive use of the Stack and of subroutines. By providing a
variety of Jump-to-Subroutine on Condition. and Return-from-Subroutine on Condition instructions. the S080A allows
the execution of subroutines to become an integral part of programmed logic sequences.

a

Observe that the 8080A has number of 16-bit instructions: that is. instructions that operate on the 16~bit contents of
the BC. DE or HL registers. These include 16-bit increment and decrement. 16-bit add. and 16-bit data moves.
The 16-bit instruction XTHL' is particularly useful. since by allowing the top two Stack bytes to be exchanged with the
HL registers. an easy method is provided for switching addresses.
The DAA instruction modifies the A register contents to generate a binary coded decimal equivalent of t~e original binary value. If carries out of bit 3 or bit 7 result. these are reported in the Auxiliary Carry and Carry statuses. respectively.
See Volume I for a discussion of the decimal adjust operation.

There are a few differences be.tween NEC 8080Aand Intel80BOAinstruction execution.
For binary subtraction and BCD arithmetic the NEC 8080A performs operations in what is
theoretically the "correct" fashion - which diffe.rs. from the actual implementation of the Intel
8080A. Specifically. the NEC S080A has a SubtraCt status (SUB) which is set after any addition
is pei'formep.:Only the NEC 8080A has a Subtract st~tus.'
,
'

NEe 8080A
INSTRUCTION
SET ~
DIFFERENCES

The NEC 8080A correctly sets and resets the Auxiliary Carry status (AC) during subtract operations. identifying any
borrow by the low order digit as follows:

(f
,7

6

4

3

Borrow here sets AC
2

1

0...

X X X X X X X X
-.Y Y Y Y Y Y Y Y
Z, Z

Z

Z

Z

Z

Z

4-24

Z

Bit No.

X. Y and Z represent any binary digits.
Decimal subtraction for the Intel 8080A and NEC 8080A may be illustrated as follows. assuming the contents of
Register B are to be subtracted from the contents of Register C:
INTEL 8080A
MVI
A.99H
SUB
C
ADD
B
DAA

c
w

~
a:
o

D.

a:

o

u

~

en
w

NEC 8080A
MOV
A.B
SUB
C
DAA

In the instruction sequence illustrated above for the Inte18080A. you cannot use the Subtract instruction directly since
it works for binary arithmetic only. You must create the nine's complement of the subtrahend by subtracting it from 99.
Then you add the minuend to the nine's complement of the subtrahend. Finally you decimal adjust the result.

l-

In the case of the NEC 8080A you may use the Subtract instruction for either binary or BCD data.

U

For a complete discussion of decimal subtraction using the Intel 8080A. see 8080 Programming for Logic Design.
Chapter 7.

e(

oCI)
CI)

e(

o/S

w
Z

a:

o

III

The Carry and Auxiliary Carry statuses are also treated differently by the NEC and Intel 8080A. When Boolean
instructions are executed by the Intel 8080A, the Carry status IC) is always reset; the Auxiliary Carry status
lAC) is sometimes reset. The NEC 8080A leaves the Carry and Auxiliary Carry statuses alone when executing
Boolean instructions.

CI)

o

~

e(

o

e(

@

When the AMD 9080A executes Boolean instructions it always clears both the Carry and Auxiliary Carry
statuses.

THE BENCHMARK PROGRAM
Our ben~hmark program is coded for the 8080A as follows:

LOOP

LHLD
LXI
LDA
MOV
LDAX
INX
MOV
INX
DCR
JNZ
SHLD

TABLE
D.IOBUF
10CNT
B.A
D
D
M.A
H
B
LOOP
TABLE

;LOAD ADDRESS OF FIRST FREE TABLE BYTE IN HL
;LOAD STARTING ADDRESS OF 10BU'F IN DE
;LOAD I/O BUFFER LENGTH
;SAVE IN B
;LOAD NEXT I/O BYTE
;INCREMENT BUFFER ADDRESS
;STORE IN TABLE
;INCREMENT TABLE ADDRESS
;DECREMENT BYTE COUNT
;RETURN FOR MORE BYTES
;AT END. RESTORE ADDRESS OF FIRST FREE TABLE BYTE

The 8080A makes very few assumptions regarding the benchmark program.
The address of the first free byte in the data table is assumed to be stored in the first two bytes of the data table - addressed by the label TABLE. The immediate addressing instruction LHLD loads the contents of the first two bytes of the
data table into the Hand L registers. At the end of the program. the incremented table address is restored with the
direct addressing instruction SHLD.
Since the I/O buffer starting address does not change. an Immediate instruction is used to load this address into the DE
registers.
Since the number of occupied bytes in the 110 buffer may change. a direct addressing instruction. LDA. is used to load
this buffer length into the Accumulator. It is then moved to the B register. since the Accumulator is used to transfer
data within the program loop.
The 8080A program makes no assumptions regarding the location of either the I/O buffer. or the data table. but it does
assume that the table is not more than 256 bytes long.

These are the abbreviations used in Table 4-4:
A

The Accumulator

B
C

The B register}
The C register

These are sometimes treated as a register pair

D

The D register}
The E register

These are sometimes treated as a register pair

E

4-25

H
L

The H register}
The L register

This register pair provides the implied memory address

C

Carry status. In Table 4-4 C refers to Carry status. not to the C register.

AC

Auxiliary Carry status

Z
S
P

Zero status

SUB

Sign status
Parity status
Subtract status (present in the NEC 8080A only)
The Instruction register

12
13

Third object code byte

Second object code byte

PC

The Program Counter

SP

The Stack Pointer

PSW

The Program Status Word. which has bits assigned to status flags as follows:

7 6 5 4 3 2 1 0 ...._---- Bit

No.

IsIz ~x 1)(1 XI pix 1c I

T+~-04tt-~!. . .----

Unassigned

.....- - - - - - - - - S U B (NEe 80BOA only)

DATA

8-bit immediate data

DATA16

16-bit immediate data

DEV

An I/O device

REG

Register A. B. C. D. E. H or L

s

Source register

d

Destination register

M

Memory. address implied by HL

LABEL

A 16-bit address. specifying an instruction label

RP

A register pair: B for BC. D for DE. H for HL. SP for Stack Pointer

PORT

An I/O port. identified by a number between 0 and FF16

ADDR
[ ]

A 16-bit address. specifying a data memory byte

[[ ]]

n

Contents of location identified within brackets
Memory byte addressed by location identified within brackets
Complement of the contents of
Move data in direction of arrow
Exchange contents of locations on either side of arrow

+

Add
Subtract

A

AND

V

OR

V-

XOR

The letter C is used to identify Carry status. Although C also identifies one of the 8080A
registers. registers are always referenced generically in Table 4-4.

4-26

8080A
CARRY
STATUS
NOMENCLATURE

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 4-4. A Summary of 8080A/9080A Microcomputer Instruction Set
STATUSES
TYPE

MNEMONIC

OPERANO(S)

BYTES

OPERATION PERFqRMED
C

AC

Z

S

P

SUB'

IN

DEY

2

[A]-[DEV]

OUT

DEV

2

Input to A from device DEV (DEV
[DEV]-[A]

g

= 0 to 255)

Output from A to device DEV (DEV

= 0 to 255)

LDAX

RP

1

[A]-[[RP))

STAX

RP

1

load A using address implied by BC (RP
[[RP))-[A]

MOV

REG,M

1

Store A using implied addressing as for LDAX
[REG]-[[ H,Ll]

MOV

M,REG

1

lDA

ADDR

3

STA

ADDR

3

LHlD

ADDR

3

SHlD

ADDR

3

ADD

M

1

X

X

?C

X

X

0

[A]-[A] + [[H,l]]

ADC

M

1

X.

X

X

X

X

0

Add tp A
[A]-[A] + UH,L)] + [C)

SUB

M

1

X

X

X

X

X

1

Add with Carry to A
[A]-lA] - [[H,Ll]

u.w

SBB

M

1

X

X

X

X

X

1

Subtract from A
[A]-[A] - [[H,Li] - [C]

a:c(
>a:
a: w
00..

ANA

M

1

0"

?w·

X

X

X

XRA

M

1

0"

Ot""

X

X

X

ORA

M

1

0"

Ot""

X

X

X

CMP

M

1

X

X

X

X

X

1

O~ with A
[A] - [[ H,Ll1. Discard result but set flags.

INR

M

1

X"

X

X

X

0

Compare with A
[[H,Ll]-[[H,Lll+ 1

DCR

M

1

X··

X

X

X

1

Increment memory
[[H,L]]-[[H,l]]-l

w
u
2
w
>a:
a::f
c(w
~a:
->
a: a:
0..

0

load any register using address implied by Hl
[[ H,Ll]-[ REG]
Store any register using address implied by Hl
[A]-[ADDRl. i.e., [A]-[[13, 12))

~

w
~

= B) or DE (Rp = D)

load A, use direct addressing
[ADDR]-[Al. i.e., [[13, 12))-[A]
Store A. use direct addressing
[l]-[ADDRl. [H]-[ADDR+ 11. i.e., [Li-[[13,12]l. [H]-[[I3, 12]+ 1]
load Hand l registers, use direct addressing
[ADDR]-[Ll, [ADDR+ ll-[H] i.e., [[13,12))-[Ll. [[13,12]+ l]-[H]
Store Hand l registers, ·use direct addressing
-

w
u
2
w
a:
w_
w~

~o

w>
~~
>~
a:w
c(~

Subtract from A with borrow
[A]-[A] I\. [H,l))
AND with A
[A]-[A]¥ [[H,L))
Exclusive-OR with A
[A]-[A] V [[H,Ll]

02

0

u
w
II)

Decrement merr'ory

--

Table 4-4. 'A

S~m~ary

of'SOSOA/90S0A Microcomputer Instruction Set

(C~~tinued)

,

STATUSES
TYPE

MNEMONIC

OPERAND(S)

OPE~ATION

BYTES
C

LXI

RP,DATAI6

3

MVI

M,DATA

2

MVI

REG,DATA

2

JMP

ADDR

3

AC

Z

is
w

~,

~

,.

Q.

~

,:l

I

PCHL

:..,

CALL

ADDR

3

CC

ADDR

3

CNC

ADDR

3

CZ

ADDR

3

Z

CNZ

ADDR

3

:l"";'
t:;~

CP

ADDR

3

Zen


MOV

ds

AC

Z

S

P

SUB"
[REG]-[REG]
Move any register (5) to any register (d)
[D]--[H1. [E]--[LJ
Exchange DE with HL
[SP]-[HLJ
Transfer HL to SP

1

0

~

"a:
6

XCHG

1

SPHL

1

W

W

a:
ADD

REG

1

X

X

X

X

X

0

ADC

REG

1

X

X

X

X

X

0

SUB

REG

1

X

X

X

X

X

1

tn

SBB

REG

1

X

X

X

X

X

1

~~

ANA

REG

1

0"

xt

X

X

X

tn o

XRA

REG

1

0··

at""

X

X

X

ORA

REG

1

0··

at""

X

X

X

[A]-[A]+ [REG]
Add any register to A
[A]-[A] + [REG] + [e)
Add with Carry any register to A
[A]-[A] - [REG]
Subtract any register from A
[A]-[A] - [REG] - [e)
Subtract any register with borrow from A
[A]-[A] "[REG]
AND any register with A .
[A]-[A]¥-[REG]
Exclusive-OR any register with A
[A]-[A] v [REG]

eMP

REG

1

X·

X

X

X

X

1

[AI - [REG]. Discard result but set flags.

DAD

RP

1

·x

0

Compare any register with A
[H.LJ-[H.L]+ [RP]
Add to HL

INR

REG

1

X··

X

X

X

0

OCR

REG

1

X··

X

X

X

1

X··

X

X

X

a:

W

c:;~

ffi~

c:;
W

~
I

a:

W

o

CMA

1

OM

1

X

RLC

1

X

OR any register with A

[REG]-[REG] + 1
Increment any register
[REG]-[REG] - 1
Decrement any register
[A]-[A]
Complement A

a:

W
WI-

1-",

~ffi

~~

;·O . J I I I I I I I I iJ

Decimal adjust A

Rotate A left with branch carry

cOJ ..1 I I I I I I I ~

RRC

1

X

Rotate A right with branch carry

© ADAM OSBORNE &
.

ASSOCIATES. INCORPORATED

.

Table 4-4. A Summary of 8080A/9080AMicrocomputer Instruction Set (Continued)
STATUSES
TYPE

MNEMONIC

OPERAND(S)

BYTES

OPERATION PERFORMED
C

w

I-

~ww
0':

AC

Z

S

P

SUB·

LTI~- I I I I I I I I j:J

RAL

1

X

Rotate A left with'carry

RAR

1

X

_Rotate A right with carry

li{j

11.;:)

02

ffii=Z

I(/)0

52
w

a:;

INX

RP

1

DCX

RP

1

:-. I-

I I I I I I I

~

[RP]-[ RP] + 1
Increment RP. RP = BC. DE. HL or SP"
'[RP]-[RP] - 1
Decrement RP

~

u

~

PUSH

RP

1

POP

RP

1

[[SP]]-[RPJ. [SP]-[SP] - 2 }
Push RP contents onto stack
RP = BC. DE. HL or PSW
[RP]-[[SP]J. [SP]-[SP]+2
.

1

Pop stack into RP
[ H.Ll-- [[ SP]]

I-

(/)

XTHL

Exchange HL with top of stack
I11.

w
IZ

EI

1

Enable interrupts

1

Disable interrupts

1

Restart at addresses S·N. N = 0 through 7.

RST

(/)
;:)

N

STC

1

1

CMC

1

X

I~

l-

(/)

Statuses:

.

01

;:)

a:_
a:

-

[C]-l
Set Carry.
[C]-[C]
Complement Carry

NOP

1

N? operation

HLT

1

Halt

C

Ac
Z
S
P
X

0
Blank

Carry
Carry out of bit 3
Zero
Sign
ParityStatus set or reset
Status reset
- Status Set
Status unchanged

• . SUB status is present in NEC 8080A only
•.• NEC S080A does not modify these status flags

t The AMD 9080A always-resets

Ac to 0 for all Boolean instructions. The Intel 8085 sets Ac _to

instructions. and resets AC to 0 for all other Boolean instructions.

1 for all AND

Table 4-5. A ,Summary of Instruction Object Codes
and Execution Cycles
f

BYTES

CLOCK
PERIODS

FIGURE

OOXXOOOI
YYYY

3

10

4-22

Aci
'ADC

01dddsss
01110sss

1

4-13

ADC

1

7

4-16

01dddl10
OOdddll0

1

7

2

7

10110XXX

2
1
'I

M
DATA

B6
F6 YY

1
2

PORT

03

2
1
1

10

E9
llXXOOOl
l1XX010l
17

1
1

,~~

LXI

MOV
MVI

.

RP,DATA16
f

MOV
MOV

~~ t.

REG,REG

M:F~EG

'

.REG,M
REG,DATA

MVI

M,DATA

NOP
ORA

REG

ORA
ORI'
OUT
PCHL
pOP
PUSH

RP
RP

RAL
RAR

YY
36, YY
00

RC
RET
RLc
RM
RNC

\

YY

FIGURE

DATA
REG

CE yy
l0001XXX

2
1

7
4

4-15

ADD

M
REG

8E
l0000XXX

7
4

4-15
4-12

4-15 '
4-15

ADD
ADI

M
DATA

1
1
1

7

2

4-14
4-12

ANA
ANA
ANI

REG
M
DATA

7
4
7

4-15
4-15

10
4

C6 yy
10100XXX
A6
E6 yy

4
7
7

4-12

CALL

CD

ppqq

4-15

CC
CM

LABEL
LABEL

DC

ppqq

3
• 3

LABEL

FC ppqq

3

4-15
4-29

86

REG

11
4

4-18
4-12

CMP
CNC

M
LABEL

BE
04 ppqq

1
3

11/17

4-12

CNZ
CP

LABEL
LABEL

C4

3

11/17

F4

LABEL
DATA
LABEL

3
3

11/17
11/17
7
11/17

4
5/11

4-12
4-27

5/11

4-27

CPE
CPI
CPO
CZ

5/11
5/11

4-27
4-27

DAA
DAD

5/11
5/11
4
11

4-27
4-27
4-12
4-18

OCR
DCR
DCX
01

5/11
4
7

4-27
4-12

EI
HLT

4-15
4-15

IN
INR

PORT
REG

OOXXX100

4-25
4-13
4-23

INR
INX
JC
JM
JMP

M
RP
LABEL

OOXXOOll
DA ppqq

JNC
JNZ

LABEL
LABEL

JP
JPE
JPO

LABEL
LABEL
LABEL
LABEL

1
1

RRC
RST
RZ

N

EO
OF
l1XXXll1

SBB

REG

C8
l00IIXXX

1
1

SBB

M

SBI,
SHLD
SPHL
STA

DATA
ADDR

9E
DE YY
22 .ppqq

2
3

STAX
STC

RP

SUB
SUB

REG
M

SUI
XCHG
XRA
XRA

DATA

F9

1
1

1

7
16
'5(4)"

PPqq
OOOX0010
37 .

1
3
1
1

l0010XXX
96

1
1

4
7

2

7
4
4

32

06

YY
EB
10101XXX
AE
EE YY
E3

1
1
2
1·

4-~6

10

1
1

13
7
4

7
7
18(17)"

4-16
4-12
4-12
4-15
4-15
4-12
4-12
4-15

JZ
LOA
LOAX

4-15
4-21

LHLO
ppqq
YY

represents four hexadecimal digit memory address
represents two hexadecimal data digits

YYYY
X.
ddd '

represents four hexadecimal data digits
represents an optional binary digit
represents optiMal binary digits identifying a destination register

sss ,

represents optional binary digits identifying a source register

* The NEC 8080A has five instructions with unique execution times, defined above by
:'(N)* where N is the number of NEC 8080A instruction cycles.

4-32

LABEL
RP
REG

27
OOXX100l
OOXXX101

M
RP

LABEL
LABEL

ADDR
RP
ADDR

2
3
3
1
1
1

35
OOXX1011
F3

1
1
1

FB
76
DB YY

1
1

34

FA
C3
02
C2
F2

ppqq
ppqq
ppqq
ppqq

ppqq
ppqq
E2 ppqq
CA ppqq
3A ppqq
OOOX1010
2A ppqq

EA

2
1
1
1
3
3
3
3
3
3
3
3
3
3
1
3

4-26
4-26

1
1
1

PP<1q
ppqq
EC ppqq
FE yy
E4 ppqq
CC ppqq

4-12
4-15
4-15

11/17
4

3F
10111XXX

4-27
4-19

4-12

11/17

2F

1

E8

7
17

CMC
CMP

C9
07
F8
DO

RPE
RPO

2

CMA

4
5/11
10(11t"

1

1
1

4-13
4-19

5

1

FO

REG

PERIODS

1

1
1

M
DATA

BYTES

IF

CO

ADDR

OBJECT CODE

" 5(4)"

INSTRUCTION'

08

RNZ
RP

XRI
XTHL,

CLOCK

OBJECT CODE

INSTRUCTION

4

4
7

11/17
4
10(11)*
5
10
5
4
4
7
10
5
10

4-12
4-12
4-12
4-15
4-26
4-26
4-26
4-26
4-15
4-26
4-26
4-12
4-20
4-13
4-14
4-13
4-12
4-12
4-30
4-28
4-13
4-14

5
10

4-13
4-22

10
10

4-22
4-22

10
10
10

4-22
4-22

13

4-22
4-22
4-22
4-22
4-24

'7
16

4-15
4-17

10
10
10

INSTRUCTION EXECUTION TIMES AND CODES
Table 4-5 lists instructions in alphabetic order, showing object codes and execution times, expressed as
machine cycles.

c

w

~
oa..

a:

a:
o

o

~

enw

I-

et

(;

oCJ)

Where two instruction cycles are shown, the first is for "condition not met" whereas the second is for "condition met".
Detailed timing for instructions is provided by Figures 4-12 through 4-30. Table 4-5 identifies the timing diagram that
applies to each instruction.

Instruction object codes are represented as two hexadecimal digits for instructions without variations.
Instruction object codes are represented as eight binary digits for instructions with variations; the binary digit
representation of. variations is then identifiable.
The NEC 8080A has four instructions with execution times that differ from the Intel
8080A. These four instructions are the Register Move (MOVi. the Return (RET). the 16-bit Add
(DAD). and the Exchange instructions XTHL and SPHL.

CJ)

et
ell
w
Z

a:
en

o

CJ)

o

:!:

Instruction
Execute

I nstruction Fetch

et
c
et

©

MC1
T1

T2

T3

<1>1
<1>2
SYNC

f\.
WAIT f\.

READY

DSIN

W~ F\.
Ai
Di
RI/WO
MI
MEMR

Figure 4-12. Signal Sequences and Timing for Instructions:
STC, CMC, CMA. Nap, RLC, RRC, RAL. RAR. XCHG, EI.
DI. DAA, ADD R, ADC R, SUB R, SSB R, ANA R, XRA R, ORA R, CMP R

4-33

NEC 8080A
INSTRUCTION
EXECUTION
TIME
DIFFERENCES

.

I

I nstruction Fetch

Instruction
Execute

. .
MCI

n

11>1

Tj

T2

Tl

T4

n

t1
<1>2
SYNC

V"L- ~

~

r-p

'WRf\
Ai
Di

\~L

I

J\
WAIT J\

T4

TS

rL- T\
~

¥

\

l
'/

1
\'

I

,\

~

Status

I

RI/WO
MI
MEMR

rL- tL- ~\
-fL
2)L
n

1:-

Tl

T3

\

T2

T3

rt-.- ~\

~

W-~ T ~~.
\

I \

I
I

\\

~i

T2

Tl

\

L

READY

DBIN

T3

Instruction Address

I
10ata In Stablel

I~truction
Code

/

V

\

\\\ I
,
I

Data Ac1drlPn

#

t
I

Slatus

Stack

RI/W?:> Low

I
Data oul Stahle

\'

/

.\

V

\\\ I
,
I

I

Figure 4-18. Signal Sequences and Timing for Instructions:
PUSH. RST

/

~

Data Address

f
Status

I

Stack

t
I

RI/WO Low

I
Data oul Stable

I

·© ADAM OSBORNE & ASSOCIATES. INCORPORATED

I

I nstruction Fetch

Instruction
Execute

Data Read

Data Read

MC2

MC3

MCI
T2

Tl

4>1
4>2
SYNC

~

CAl
'-l

READY

F\.

WAIT

f\

DBIN

Wrif\
Ai
Di

h

~

~

~~1

T3

h

~

\\

Y

\

1\

\

,

Status

I'' "'
MI

MEMR

.fL

Instruction Address

T3

T2

~~

h

7

/
I1\,

J

~~

-y

/

/

I

"-"Y

)

1\

I

\\y

\

Data Address

~y

/

L-

I

(Data ,n Stabl;J"

Status

1'' '0 1
MEMR

1Code

STACK

Figure 4-19. Signal Sequences and Timing for Instructions:

POP. RET

\
\

Data Address

I\, \

['\:\

,"t.~'HO"

h

re-liT ~

I

7

T3

1\

7

1
¥oata In Stablel

T2

Tl

h

h

~~ ~

1

'/

\

Tl

h

\

Il

~I

T5

h

/

I

T4

I

Status

I
IOata In Stable

1'' '0 1
MEMR

STACK

I

,

Instruction
Execute

I nstruction Fetch

Instruction Execute

Instruction Execute

MC2

MC3

MCl
T2

Tl

~

h

(1'1

T3

p-"1\
r \[

<1'2
SYNC

n

h

J\
WAIT 1\

J

I

1

It

~i

Ai

I

Di

Status

h

-

n

n

h

-

r-'"

T3

.JL

-

/

\
\
I' _,

h

T2

Tl

I

\\

WrfJ\

T3

1

t

'J

\\

DBIN

h

i

J

READY

T2

Tl

T4

Instruction Address

I

yoata In Stab If>I

I

AI WO
MI

MEMA

Instruction

Code

Figure 4-20. Signal Sequences and Timing for Instructions:

DAD
_-ln~t.ur.llonFt'tch _ _·I"~\~~~~t,'~n

_

Mel
T,

TI

<1>,

~',
SYNC
READY

J\

WAlT

1\

~~

V'L-

A.
D.

T,

\

O... "W"'1'

Me,

MC3

MC4

T,

~ h-- ~

T,

T3

H'- ~ ~
., ~ +

fir-- ----t

\\

Data ReiICI

T,

!

DBIN

w-J\

T3

OillaRead

In<;lruCllonAddress

F1;,1
InS"uellon

Cm1e

~

/

~~

/
ty

~
.,
I

""t

T,

~rr
fy

STACIC

\

I

1

i

\\

L1l~'.1

."

....

0 •••

\

I~'

A' ..... "

L--

'\\

,

,,·,'<;, .... •..

wo '"

Figure 4-21. Signal Sequences and Timing for Instructions:

XTHL

T4

~~

y

"1

-y

~~f ~~~t
FlIWO

T3

~CLIf~ t)'If~
., ~r-

)

/

t

T,

T,

T3

rL- r-L.- 1"---

\':.

-

-

-

InstrUctlOnE .. ecule

MeS

r,

T,

T3

----j

D... ,W •• "

fY I)

n .. uA ........

. .....,

IR'~'"''

f
n ........

<;, .......

TS

~ (L..

WL-- -

.© ADAM OSBORNE &
Instruction
Execute

Instruction Fetch

. Data Rud

MCI

~

fl

<1>1

~

<1>2

READY

f\

WAIT

J\

T3

WRV
Ai

\'

I

~~

\

\
\

.1\

I
+
Instruction

YOata in Stable

RIlWo

MI
MEMR

~
YJ'

0

I
J

I

-y

h

J\L

7

If\,

/

L-

[\

\\I

I-

Status

/fy

~

1\

/

Instruction Address

,

\

I

T3

,(~

fl

~

II

J

.

h
6:"'\

~.

T2

Tl

T3

~

I

\\

Y

Di

~\

If ---,
I OJ
A
-/\

MC3

T2

-h

h
~

'[

qBIN

Tl

'- T4

h

~~'

~

SYNC

Data Read

MC2

T2

Tl

ASSOCIATES. INCORPORATED

I

\

\\,-y

,1

Data Address

I\, "
Status

IData '" Stabl;;J

\
\

I

IData '" Stable

RIIWO
MEMR

RIIWO
MEMR

CooP

Data Address

I'- "
Status

Figure 4-22. Signal Sequences and Timing for Instructions:
.
. LXI JMP JNZ JZ JNC JC JPO JPE JP JM
,-!Instruc
tion
E
xecu t e

...--Instructlon Fetch

r------Instruction Fetch

MCI
Tl

<1>1
<1>2
SYNC
READY

f1.

WAIT

f\

DBIN

WFiV
Ai

T3

T4

T2

Tl

V"L- L -h--V"L- h--

I

Il

'/

~

\'

II

I

~J
'i

\

I
Instruction Address

",,".,~
~','Wo
t
MEMR

OataWnte

MC3

MC4

InstructIOn

Code

T3

T3

T3

T2

Tl

L- h--h-- L-

~ ~ ~ t:)L ~ ~ ~

\

/

I

~

\

7

\

II

/
fy

'\
\

Y'

"I

1\

I" "

Status

InsuuctlOl'l Address

I
IDatotmSlab't'1

RI/WO

MEMR

r

\

I\, "

Status

AI/WO

l!strucllOn
Code

MEMR

\

\
I

'Y

I

i\

\\\ J
,

hn= ~

7

\\
\

y\

'''I

YI

I

/

/
"I

T2

Tl

~ h-- h--

~ P\LKL ~ ~
P " V\,

\

Di

T2

Instruction Fetch

MC2

Inltructlon Address

I
fData In Stabl:Y

T

Instruction
Code

Figure 4-23. Signal Sequences and Timing for Instructions:
STA

IY

1\\-V-

,

T

O.UI Address

I
Stalus

flO

Low

/
1

Oala out Slable

I

'.

-I

...-Instructlon F e t c h - _

Instruction

Execute

.

......---Instructlon Fetch

MCl
Tl

T3

T2
~

+T

f\
WAIT f\

I

Il

1
I

V \\\\
\

,

I
\

J

Di

Instruction Address

\
Status

yoatalnStablel

, MIAI/WO

T2

Tl

T3

/

I

L

\
\

/

Instruction Address

Status

J

\\\ y

\

T3

'" I

\.
Status

-c=

~T

11 '( J
L

/.,

~

f

/

1\

L-

\\

\\
\

"-

\

\ I

Instruction Address

"I

I
IDatalnStablel

IRIIWO

I,Luct>On

MEMR

Code

/

"I

\\

IOatamStablel

IRIIWO

/

I\.

~

f

I\, ".

I

T2

Tl

/

/'' 1

"Luetlon

MEMA

T3

I

~\

/

,

Ai

MC4

~r-T ~ tr~

1\\

~

J

DBIN

Data Read

MC3

~ fL- rL- ~ rL- "--~~ "--

.

READY

WR

T2

Tl

T4

"-- iL--~ f"L-.:.... ~
~~
~
f1
I

SYNC

Instruction Fetch

MC2

. \ DataAddress

Statu5~"'~
1~lIwO
MEMR

"Luct,on

MEMR

Code

I

Code

figure 4-24. Signal Sequences and Timing for Instructions:

LOA

l-'O"'",<>OOF"'h-l'~:~~~','~O

~Da'aAead

T2

TI

Oala Read

DataW"le

Me3

Me.

Me2

Mel
T3

T.

T2

Tt'

T3

Tt

T3

T2

DataWrlte_
Mes

T,

Tt

T3

n--n-~~
~ K- ~ ~ K'-= ~ ~ ~ ~ ::rL1
.p
~

h--r.-

rL- ~ ~
_'I

I

READY.f\.
WAIT

J\.

\\

\

InstructIOn Address

~~I
:::~MR

~:~uctlon

~

\"

/

fir- H
/

\\

\

0" •

-V
.0'" ..

'~~T'
MEMA

'f

\':

/

j

IY

~

~

\\

-!

J

/

n .. ,~

Oala,nSTabtl'

·I,""WG
MEMR

I

s,.t".

s;n=~

1'°"

I

\

J

\\

'-------'
(Jd'.A.'.'· ....

~
0.·."",5 ..','"

I

Figure 4-25. Signal Sequences and Timing for Instructions:

SHLO

t:)L
~
'f
\"

A I .... "

\
S1aTuI

~ :L--

\

~

D",Ad"",

\

T3

(

~

\\

\
\

PN

j

ty

~

\'

T,

Tt

S,~,

.,

I····

0.,. ""'S,.,, ...

I

/
~

©

~~~:t'~~::~ ~:~;'-

_'n"'",I"'nF'''"~

Instruction
Execute

<1>,

f\--

T2

MC2

.p

T4

T,

T.

T2

T,

T3

D.'I .•

~\ .. I"

MC_

MC3
T2

T,

T3

~\·.I

.. _

MC.

-- -

'.I

T,

"

"

-

"

~ ~ ~WL- t;= ~ ~ ~ ~ -=t~ t1'-W~ t1'- ~ ~

~ IT

f\
WAIT f\

T3

0 .• 1••

OalaRI!1
<1>2

f"
~

N

SYNC

~~

~

Ai

I

'{

Status

\

,

IMIRI/WO

MEMR

T2

~~

Instruction Address

I
I

7

11

7

y.

"'I

\\l
I

\

Data Address

I\, "
Status

. IOatamStablel

STACK

R~ RPO.RP~

YI

I··
I

L-

'Y

\\,-y
"-y

\

Data Address

I..... "

Status

JOata In Stabl;}

/RIiWo
MEMR

'"

Figure 4-27. Signal Sequences and Timing for Instructions:

RNL RL RNC.

~.

1\

IRIiWo
MEMR

llntruction
Code

T3

./
"

I

'"

1\

I
. YOau,nStab,eI

T2

~ ~ ~~
f
7

/

J
\'

Tl

T3

1oc1L--~ h....- ~IL--h....-

I

1\
'/

I~

Tl

7

I

~I

T5

T lJL ~ I/~

\\

~

Di

In

h

.

WAlTA

VlRA

T4

~ IT~
Y

READY A

DBIN

T3

RP. RM

STACK

I

©

.

,J

I nstruction Fetch

Instruction
Execute

Data Read

Data Read

MC2

MC3

MCl
T2

Tl

<1>1
<1>2
SYNC

~
I
~

w

READY

f\

WAIT

11.

DBIN

"WRF\
Ai
Oi

fl

T3

c;(\

h

T2

n

~
L

J

It

1

'/

Y

1\

\\

/

\

\

1\

\

,

Status
RI/Wo

M.
MEMR

Instruction Address

I
YOata In Stable

t

I

f

/

I

\

~".

Status

r

IOata in StableI'

RI/WO
MEMR

Instruction
Code

Figure 4-28. Signal Sequences and Timing for Instructions:
IN

/

~

/

Data Address

T

1 '"~
I

1\

1\y

n

~

\ ~

\

T3

,«;\

(\

I

/ 1\'1

I

.'

T2

Tl

T3

fC?\

\ -At

I \~'

I

~it

Tl

'r\

(\

.r,
4>2
SYNC
~

.b.
~

J\
WAIT J\

n

~
rP·

READY

DBIN
WR

J\
Ai
Di

T2

T3

~

If
/.

T4

n

f\

I

I

1

t

]

\\

~jr

\

\
\

,

Status
RI/Wo

MI

MEMR

Instruction Address'

I

yoata In StableI

t

I
I

/

h

~
/

I

l\

v-

I

\

f

- ~
y\
~
\

~

\
j

Data Address

\
'\\

Instruction
Code

Figure 4-29. Signal Sequences and Timing for Instructions:

,J-

Oafa Ad(hE'\\

#

I

J

X

1\I

RIfWO
MEMR

OUT

f\

\

IOata in Stablel-

Status

~

h

/

'\ '.

I

T3

T2

\

~-

\I

T,

T3

,<~

h
\

It

\

T2

\- ~

\~

l\

T,

~

I

S1a1u\

out

Oafa oul Stahle

l

. © ADAM OSBORNE &

Instruction

.\1 nstruction
E
. xecute

Fetch~

I

Initiate Halt

H AL T

T1

4>1
4>2
SYNC
READY

~

."..

U1

WAIT

f\.
f\.

OBIN

"WAf\.
Ai
Di

T2

h--

~ Ii

W

f\.

INTE

J\

T4

'(

I(

T

I

II
~

1

'/

I
I

\'

\\

~Y

Y

T2

T1

-rK'-r1- #-;
'\

Instruction Address

f' ,
Status
AI

INT

T3

rL-h--rL- ~\

~

MI
MEMR

•

Instruction

\

...

""-

\

TW

~ h-

~

Il"

~ I

Lr
~
)
/
~

\

\

\
I

YData In S'ab'f'I

Wo

- - - - - - t .____

MC2

MC1

ASSOCIATES,INCORPORATED

i\
Status

AI WO
HI TA

Code

Figure 4-30. Signal Sequences~and Timing for Instructions:
.
HLT

Interrupt Terminates Halt

MC1

SUPPORT DEVICES THAT MAY BE USED
,
WITH THE 8080A
Of the microprocessors described in this book, none have a wider variety of support devices than the 8080A.
These support devices are described in the rest of Chapter 4 and in Volume III. Most of the devices described
were originally developed by Intel, although a few were not. Note that the 8224 Clock Generator and the 8228
System Controller devices are used so routinely with the 8080A that they frequently are looked upon as a three-chip
CPU. An exception to this three-chip concept is the TMS 5501 made by Texaslnstruments; it cannot be used with an
8228 System Controller.
A number of general-purpose support devices are described in Volume III. These are support devices that may be used
with any microprocessor and are specific to none.
One generalization that can be maderegarding 8080A support devices is that the 8080A is so well endowed with support logic that it will rarely make m~ch sens:e to use another micro'processor's support part in preference.
It is very difficult to use 6800 support devices with the 8080A because 6800 support devices require a synchronizing
strobe signal which is difficult to generate within an.8080A system.

. THE 8224 CLOCK GENERATOR AND DRIVER
The primary purpose of this device is to provide the 8080A CPU with its required <1>1 and <1>2 clock signals. Coincidentally, the 8080A READY and RESET inputs are created, with correct synchronization. Recall that these two
signals must be ~ynchronized with <1>2.
'
Logic implemented on the 8224 Clock Generator corresponds generally to the block labeled "Clock Logic" in
Figure 4-1. To be completely accurate, however, a small portion of the Bus Interface Logic should also be illustrated as provided by the 8224 device.
"

'

8224 CLOCK GENERATOR PINS AND SIGNALS
8224 pins and signals pre illustrated in Figure 4-31. Figure 4-33 illustrates the 8224 connected to an 8080A
CPU and
8228 System Controller.

an'

Signals may be divided between tilTling logic and control logic.
,

I

.

I

Clock frequency is controlled by a crystal connected to the XT AL 1 and XT AL2 pins. Crystal, 8224
frequency must be exactly nine times' the required clock frequency. The fastest clock period
CLOCK
SIGNALS
supported today is 250 nanoseconds, provided by the AMD 9080A. 500 nanosecond clock
periods are standard. Since crystal frequency has to be nine times the clock frequency, the usual, ..._ - -..
500 nanosecond clock will require an 18 MHz frequency crystal.
If an overtone mode crystal is employed, then it must be supported by an external LC network, connected to
the TANK input. This is standard'clock logic practice; microprocessor clock logic represents no special case, therefore
we will not discuss overtone· mode crystals further.
'

4-46

RESET

RESiN
RDYIN
READY
SYNC
1112 (TIL)

c

~,

ct
a:

oD.

STS'i'B

o

GND

a:
o

-.. --- ----..

--

1
2
3
4
5
6
7
8

8224

16
15
14
13
12
11
- 10
9

------ ..
--.
---.

VCC
XTALl
XTAL2
TANK
OSC
1111
1112
VDD

~

ui

PIN NAME

w

~

g

RDYIN
READY
SYNC
1112 (TTL)
STSTB
XTAL l,XTAL2
TANK
OSC
1111, 1112

ct
IllS

w
Z

a:

o

a:J
UJ

o

::!:
ct
c
ct

VCC,VDD,GND

@

Output
Input
Input
Output
Input
Output
Output
Input
Input
Output
Output

Control signal output to 8080A
Reset logic input
Ready logic input
Control signal output to 8080A
Control signal input from 8080A
TTL level duplicate of 1112
Sync signal output to 8228External crystal connections
Overtone crystal extra input
Crystal oscillator waveform
Clock signals to 8080A
Power and Ground

ReSiN

UJ
UJ

TYPE

DESCRIPTION

RESET

Figure 4-31. 8224 Clock Generator Signals and Pin Assignments
The principal clock-signals output are <1>1 and <1>2, as required by the 8080A CPU.-These tyvo clock signals are
derived from a divide-by-nine counter that defines <1>1 and <1>2 as follows:

<1>1

I
I
---1I

I

3

2

.

,
~

I

I

1112

I
I

I'

I

5

6

7

8

,
I

I

I

I

I

I

I
I

I

9

I

1
I

- I-

Two additional timing ?ignals are output:
The crystal oscillator frequency is output as OSC.
A TTL level duplicate of <1>2 is also output for general use within the microcomputer systen:t.
The RESET input signal required by the 8080A CPU is usually generated by special external logic to provide
sharp signal edges and synchronization with the <1>2 clock pulse. Consider one common use of RESET - to detect
power failure. A vague input may have to be converted into a crisp RESET as follows:
Threshold

Input (RESIN)

::::::::::-::-::-:-:::,~~~~~~.g~~_.;...__....._._I./~
__~__;._=.:_:.;_:.:_:.

1112

RESET

4-47

.The 8224 Clock Generator will accept a sloppy input, as illustrated above by RES I N, and in response will create
a sharp RESET output that conforms to the requirements of the 8080A CPU. A Schmitt trigger within the logic of
the ~224 clock chip creates the appropriate reset logic level change when RESIN falls below a threshold level.
RESET is also frequently connected to manually operated switches; this allows the microcomputer system to be reset
by human intervention. The following simple circuit creates the appropriate RESIN input to the 8224 Clock Generator
so that either power failure oran external switch may reset the CPU: '

Vee (Power

fail detect source)

~--------~--------------------------RESIN

--

--

. READY logic accepts an asynchronous RDYIN signal and creates a synchronous READY input to the 8080A
'CPU:
'
,

RO::

ry==

J\\_----(~~~._fL_:.

READY

Y

~

One further signal created by the 8224 Clock Generator is the status strobe signal STSTB, which is required by
the 8228 System Controller. This signal is of very little interest toa user since it simply accepts an 8080A SYNC output and converts it into the required 8228 STSTB input.
When comparing the 8080A microcomputer system with other devices, it would be inaccurate to dismiss the
822~ Clock Generator simply as an additional device - which must be added to an 8080A system, supplying
logic which is commonly found on competing CPU chips. Do not forget the reset logic capability provided by the
8224 Clock Generator,
"
it can be argued that the 8080A CPU creates an artificial restriction - that RESET and READY inputs must. be synchronized with <1>2; therefore the fact that the 8224 does this for you. simply eliminates a self imposed problem that
should never have been 'there in the first place, This reasoning has merit. but the ability' of the 8224 to receive a ragged
RESIN input is a valuable feature that should not be overlooked,
."
..'.,'

THE 8228 AN~ 8238 SYSTEM CONTROL~'ER AND BUS DRIVER
The 8228 System Controller consists of a bidirectional bus driver, plus control signal generation logic. The 8238
Sy~temControlier advances IIOW and MEMW to give large me'mories mo~e time 'to respond to a memory write.

BUS D~IVER LOGIC

Alarge number of memory and 1/0 devices may be connected directly to the 8228 bidirectional Data Bus; such

connection~'to the 8080A Data Bus would not be feasible. Remember. memory devices leak current even when
they are'notselected; therefore. even the passive load ofunselected memory devices connected directly to an 8080A
CPU will leak more currerit than is available,
"

4-48

When comparing the 8080A microcomputer system with an alternate microcomputer system, you should look
carefully at the fan out provided by the alternate CPU.
If the alternate CPU busses need to be buffered. then the 8228 System Controller becomes the equivalent 8080A
system device; as such it does not represent an economic liability,
Q

w

~
a:
oQ,
a:

o
u

~

en
w
~

g
(/)
(/)

ct
all

If the alternate CPU busses do not need to be buffered. then the 8228 System Controller represents an additional
device. peculiar to the 8080A system.

CONTROL SIGNAL LOGIC
The 8228 combines the three 8080A control signals: WR, OBIN and HLOA, with the statuses output on the
Data Bus during T2 in order to generate bus control signals as follows:
MEMR status on 07 true. with DBIN true generates MEMR true
OUT status on 04 false. with WR true generates MEMW true
INP status on 06 true. with DBIN true generates IIOR true
OUT status on 04 true. with WR true generates I/OW true
INTA status on DO true generates iNTA true

w

Z

----..

a:

o

CD

(/)

o

~
ct
Q

ct

@

STSTB
HLDA
WR
DBIN

DB4
04
DB7
07
DB3
03
DB2
02

DBO
GND

--

-..- :....
--- ..

-- -..
------ :.--..
--- --

.::

~

PIN NAME
00- 07
DBO - DB7
STSTB
HLDA

WR
DBIN
IIOW
MEMW
I/OR
MEMR
INTA
BUSEN
VCC·GND

1

28
27

2
3
4
5
6
7
,8

..--

26
25
24

8228

9
10
11
12
13
14

23
22
21
20
19
18
17
16
15

-...-

-=- ..=
--...

-- ..

.. ..

..: :
... :.

--

DESCRIPTION

~

IIOW
MEMW
IIOR
MEMR
INTA
BUSEN
06
DB6
05
DB5
01
DBl

DO
TYPE

Data Bus connection to CPU
Data Bus to external logic
Status strobe input from 8224

Bidirectional
Bidirectional
Input

Hold acknowledge input from CPU
Data output strobe. input from CPU
Data input strobe. input from CPU
1/0 write control output
Memory write. control output

Input
Input
Input

I/O read control output
Memory read control output

Output
Output
Output
Input

Interrupt acknowledge control
DB Bus float/enable control input

Output
Output

Power and Ground

Figure 4-32, 8228 System Controller Signals and Pin Assignments

8228 SYSTEM CONTROLLER PINS AND SIGNALS
8228 pins and signals are illustrated in Figure 4-32.
DO through 07 represent the bidirectional Data Bus connection between the 8228 System Controller and the 8080A
CPU; it is referred to as the "Processor Data Bus",
OBO through OB7 represent the high fan out. bidirectional Data Bus accessed by external logic; it is referred to as the
"System Data Bus",

4-49

WR, DBIN and HLDA represent the control signals of the same name that are output by the 8080A CPU
All control bus signals use active low logic and may be defined as follows:

MEi\iiR -

a read from memory strobe

MEMW - a write to memory strobe
I/OR - a read from external I/O strobe
I/OW -

iNTA -

a write to external I/O strobe
interrupt acknowledge

Control signal timing .is given in Figure 4-34.

The interrupt acknowledge signallNTA has two special features which need to be explained. This signal may be
tied to a +12 Volt power supply through a 1 K Ohm resistor, in which case 8228 logic assumes that there is only one
possible interrupting source within the microcomputer system. Now the 8228 will automatically insert the object
code for an RST 7 instruction in response to the interrupt acknowledge. This means that external logic does not
need to supply the first post-interrupt instruction's object code. Of course, this means that all interrupt service'routines
effectively begin with the execution of an RST 7 instruction.
If external logic responds to the INTA low pulse by supplying the first byte of a CALL instruction's object code
(11001101), then the 8228 System Controller will automatically generate two more INTA low pulses for the
next tW..E..!!!achine cycles. See Figure 4-34 for i'i\iTA pulse timing within the machine cycle~ Now external logic can
use the INTA pulse as a memory deselect and an interrupt acknowledge logic select. Here is a very general illustration
of external logic that responds to an interrupt acknowledge by supplying the CPU with a three-byte CALL instruction's
object code:
INTA

t

from
8228

Any pulse
count logic

Select true on
first i'NTA pulse

i.
Select true
on second
iNTA pulse

Select true on third

i'NTA pulse

--

Data Bus to CPU

Program memory
select (High true)

.....

--

-.4-50

8-bit port,
holds 11001101
(a CALL instruction)

8-bit port,
holds Call
address, low
order byte

8-bit port,
holds Call
address, high
order byte

-

----

.

AO

GNO
+W
·W
+12V

C

...ct
W

a:

0

Q.

a:

0

CJ

~

13

SYSTEM DMA REa.

1~

SYSTEM INT. REa.

16

INT. ENABlE

HOLO
INT

8080A

BUS
INTE

TANK
OSC

CI)
CI)

2(ml

ct

RDYIN

W

Z

a:

<1>1
<1>2
WAIT
READY
RESET

ReSiN

_000
_OBI
_DB2
_DBJ
_DB4
_OBS
_DOO
_OB7

05

+ 12V
+5V
GNO

S

19

De
07

SYNC

a:I
CI)

0
ct

MEMR

. SYSTEM
CONTllOL

STATUS STROBE

~W

imm

iToW

C

ct

@

Figure 4-33. A Standard. Three Device 8080A Microcomputer System

--

I

Instruction Fetch

I

Instruction
Execute

Data Out

.-c;-

MCl
T,

I,

T2

I-

II

Me2
T3

II

T4·

T,

I1_

T2

I

T3

READ1\1
I

rf\

WAIT

1

I
1:+-----~~._--~~--~~----~~~----_4--~--~--~~_P--

I

DBIN~+-_~~""'J

WR1J:I~--~-'--------~~--~~+-------P-~
~--~~

I
I

MEMRI

I

(I/OR or INTA) I

I

MEMW:------~~------~------~:-------+------~------~~,
orl/OW I
I
I
I
Figure 4-34: Timing for Control Signals Output by
the 8228 System Controller

4-51

}~,.

W}

0

~

ADDRESS
BUS

DBiN
HLOA

...
ct
olI

AO
AI
A2
A3
A4
A5
Ae
A7
AS
AS
AIO
All
A12
AI3
AI4
AIS

Wii

en
w

g

25

AI
A2
A3
A4
A5
Ae
A7
AS
A9
AIO
All
AU
AI3
AI4
AIS

BUS

CONTROL
BUS

Recall that the NEC 8080A generates three INT A low output pulses in response to a Call instruction object code being
returned during the interrupt acknowledge process. But the NEC 8228 System Controller does not assume that these
three low INTA pulses will occur. Thus the NEC 8228 System Controller may be used with an NEC 8080A or any
other 8080A.ln every case the NEC 8228 will generate three low INTA output pulses when external logic responds to
an interrupt acknowledge by providing a Call instruction object code.
The status strobe STSTB which is output by the 8224 Clock Generator is a variation of the SYNC output from the
8080A CPU. STSTB synchronizes the 8228 System Controller and is of no other concern to an 8080A user.
BUSEN is an external input to the 8228 System Controller. This is a very useful signal because it allows external
logic to float the Data Bus. When this signal is input low, the bidirectional bus driver logic of the 8228 System
Controller presents a high impedance to the external Data Bus, thus allowing external logic to gain access to
this bus.
Figure 4-33 illustrates the way in which the 8080A CPU normally combines with the 8224 Clock Generator and the
8228 System Controller. These three devices are frequently looked upon as a single entity.

THE 8259 PRIORITY INTERRUPT CONTROL UNIT (PICU)
This is a very flexible, programmable interrupt handling device; it provides a CALL instruction's object code in
response to three interrupt acknowledge (lNTA) signals; the 8228 System Controller responds to an interrupt
acknowledge in this fashion, as described earlier in this chapter. Therefore the 8259 PICU should be looked
upon as a companion to the three-chip (8080A, 8224, 8228) microprocessor system.
The 8259 PICU cannot be used with non-8080A systems.
A single 8259 PICU with an 8080A microcomputer system will handle up to eight external interrupts, providing
a variety of programmable interrupt priority arbitration schemes.
Alternatively, an 8080A microcomputer system may have a single 8259 PICU designated as a master, controlling up to eight additional 8259 PICUs designated as slaves. This allows a maximum of 64 levels of interrupt
priority. Priority arbitration schemes may be set independently for the master and for each slave, resulting in a
bewildering profusion of priority arbitration possibilities.
Use extreme caution before including master and slave PICUs within an 8080A microcomputer system. When
an application is implemented around a microprocessor with the general speed and performance characteristics
of an 8080A, then it is usually more efficient to handle numerous external request lines using multiple CPU configurations and/or programmed polling techniques, rather than interrupts.
The 8259 PICU is fabricated using NMOS technology; it is packaged in a 28-pin plastic DIP. All outputs are TTL
compatible.
With reference to the standard logic functions' illustration used throughout this book. the box marked "Interrupt
Priority Arbitration" represents the functions implemented by the 8259 PICU. But it is hard to equate the large number
of options provided by the 8259 PICU with the interrupt logic provided by other microcomputer systems. An application that needs the 8259 PICU would certainly not be satisfied by Interrupt Priority control logic provided by almost any
other device described in this book.

8259 PICU PINS AND SIGNALS
8259 PICU pins and signals are illustrated in Figure 4-35; we will summarize these signals, then discuss how
the PICU is used.
From the programmer's point of view, the 8259 PICU will be accessed either as two I/O ports, or as two memory 10cations.CS is a typical chip select and AO identifies one of two I/O ports or memory locations. The way you.
as a programmer. must interpret the function of each 8259 PICU I/O port or memory location depends on an intricate
logical sequence.
The two 8259 addressable locations are accessed via the Data Bus (DO - 07).
lOR and lOW are standard read and write control signals. If the 8259 PICU is being accessed as two I/O ports. then
these two signals will be connected to the IIOR and IIOW controls output by the 8228 System Controller; on the other
hand. if the 8259 PICU is being accessed as two memory locations. then lOR and lOW must be connected to the MEMR
and MEMW controls output by the 8228 System Controller.
External devices requesting interrupt service have their request signals connected to IRO - IR7. A high level on
anyone of these signals will be interpreted as an interrupt request. An interrupt request is passed on to the CPU via
the INT signal. This is illustrated in Figure 4-36.

4-52

In a configuration that includes master and slave 8259 PICUs external logic will connect to the interrupt request
signals (lRO - IR7) of the slave PICUs only. The INT outputs of the slave PICUs will be connected to the interrupt requests (lRO - IR7) of the master PICU. This is illustrated in Figure 4-37.

c

w

When more than one 8259 PICU is present in a system. SP identifies the master and slave units. SP high defines the
master. while SP low forces an 8259 PICU to operate as a slave. SP also determines the sense of the three cascade
lines (CO, C1, C2); these are output lines from the master and input lines to a slave.

~
a::
o
0.

The 8080A CPU provides the standard interrupt acknowledge via INTA. This interrupt acknowledge will be
received by all 8259 PICUs in the system. master or slave.

o

In a system that includes a master 8259 PICU only, the three bytes of a CALL instruction's object code are output via the Data Bus in response to the three INTA control signals arriving from the 8228 System Controller. The
second and third bytes of the CALL instruction's object code provide an address which is unique to the selected interrupt request.

a::

(.)

~

en
w

I-

ct

U

o
(f)

(f)

ct
ell

w
Z

a::

oen

(f)

o

~

In a configuration that includes master and slave 8259 PICUs, the master PICU outputs the first byte of a CALL
instruction's object code; the master also outputs a value between 000 and 111 via the three cascade lines
(CO - C2). This three-bit binary value identifies the interrupt request level being acknowledged - and therefore
the slave PICU being selected. The selected slave P.ICU provides the second and third bytes of the CALL'instruction's object code in response to the second and thi'rd II'.!TA pulses output by the 8228 System Controller.
Thus the slave PICU identifies the interrupt request I~V~! it is acknowledging.
The interrupt acknowledge logic of the 8259 PICU is referred to as "Vectoring". Let us examine 8259 vectoring
in more detail.

ct
ct

C

@

cs

1

lOW

2

28
' 27

3

26

4

25
24

-.,

i5R
D7
D6
D5
D4

-

..

5

.,

6
7
8

D3
D2
D1

DO
CO
C1
GND

--

9
10
11

AO

INTERRUPT
CONTROL
UNIT

-

INTA
IR7
IR6
IR5

23

PRIORITY

22

IR4

21

IR3

20
19
,18
17

12
13

16

14

15

"

-

IR2

--

IR1
IRO
INT

SP
a

C2

DESCRIPTION

PIN NAME
CS

8259

VCC
AO

Device Select
Identifies PICU as one of two

TYPE
Input
Input

I/O ports or memory locations
Tristate. Bidirectional

DO - D7

Data Bus

iOR
loW

Read control signal
Write control signal

Input
, Input

IRO -IR7

Interrupt request lines to PICU

'Input

INT

Interrupt request sent by PICU

Output

iNTA
SP

Interrupt acknowledge

Input

IdE:ntifies PICU as either master

Input

co - C2

or slave
Cascade lines select slave in
multiple PICU systems

VCC. GND

Output on master
Input on slave

Power and Ground

,Figure 4-35. 8259 Priority Interrupt Control Unit Signals And Pin Assignments

4-53

MEMR ori/OR

INT

MEMW

8228

or TfOi1J

SYSTEM

-

8080A
CPU

CONTROLLER

-

INTA

. ....

AO

DBO •• • "•••

A15

DB7

..

~O

,

--

-'
........

--

DO

.....

INT

ADDRESS:
DECODING

AO

~

CS

or07

07

iOR

~
8259
PRIORITY
INTERRUPT
CONTROL

-loW
iNTA

UNIT

"

IRO
DEVICE

0

. IIRl •••••• • ••••• ·1·IR6
DEVICE
1

DEVICE
6

IIR7
DEVICE
7

Figure 4-36. A System With One PICU

THE 8259 PICU INTERRUPT ACKNOWLEDGE VECTOR
Vectoring is a general term used to identify an interrupt acknowledge sequence which results in the immediate
identification of the interrupting external source. With a non-vectored interrupt acknowledge, the CPU must execute some instruction sequence whose sale purpose is to identify the source of the interrupt - and that assumes
,
'more than one possible external interrupting source. '
Recall that when an interrupt request is "acknowledged by a three-device 8080A microprocessor
system, the 8228 System Controller outputs a low pulse on the INTA control line. External logic
must interpret the low INTA pulse as a signal to bypass normal instruction fetch logic, and provide
the object code for the first instruction to be executed following the interrupt acknowledge. (If this
is new to you, refer to our discussion of the 8080A and 8228 devices.) If a CALL instruction's object code (CD16) is returned to the 8228 System Controller, then low INTA pulses are output for

4-54

------..
8080A
INTERRUPT
RESPONSE
USING CALL
INSTRUCTION

the next two machine cycles - thus making it easy for external logic to fetch all three bytes of a CALL instruction's object code. The 8259 PICU uses this 8228 logic to supply a three-byte CALL instruction's object code as the first
instruction executed following an interrupt acknowledge. But a ~ALL irstruction's object code is interpreted
thus:
.'
"

~
a:
o

~

D.

· ".-

-----..v~-----'./

16-bit address of called subroutine's

CALL

a:

Byte 3

Byte 2

Byte 1

cw

o(.J

first executable instruction

:!!E

iii

w

~

There are two ways in which the 8259 PICU can compute the address portion of the CALL instruction object
code (bytes 2 and 3). These are the two options:

g
en
en

«

oil

Option 1

Option 2

XXXXXXXXXXXYYYOO

XXXXXXXXXXYYYOOO

w

X

represents binary digits which are defined. under program control. to be a constant portion of the Call address,

a:

Y

represents binary digits which identify the interrupt priority level (000 through 111).

ca
en

Since the CALL is the first instruction executed following an interrupt acknowledge. it causes program logic to branch
to a memory location which is uniquely set aside for a single external interrupting source. Suppose you have selected
CALL instruction Option 1, as illustrated above. You would then Set aside. an area of memory for a jump table. as
follows:

Z

o
o

:!:

«
c
«
@

PROGRAM
MEMORY'

XXXXXXXXXXXYYYOO

o0

1 1 1 0 0 0 0 0 0 0 0 0 0 0 - - - - -....-

3800

(3

JMP
} ADDR1

Unused
3804

(3

etc

JMP
} ADDR2

Unused
3808

(3

l

JMP
ADDR3

Unused
380C

(3

JMP

~ADDR'4
Unused
3810

(3
etc.

Memory addresses have been selected arbitrarily in. the illustration above.

4-55

Program logic does not have. to determine the source of an interrupt. You simply orlgrn separate interrupt service
routines at starting addresses specified by the Jump instructions in the jump table. This may be illustrated asfollows:
MORE
PROGRAM
MEMORY

PROGRAM
MEMORY
"1-r.t

OEOO
OEOl

(3

3800

80

OE02 ....----4

OF

OE03
OE04 t - - - - 4

'(3

3804

ADDR2

00

-

- .

'OF

~!l08- "'" (3

..

"

~OO

Of'

~

'.'

(3'

380C

80
00

The illustration above arbitrarily assumes that the interrupt request arriving at IR2 has its service routine origined at
OE0016. In this example. the address vector provided by the 8259 is 380816:
2
--'-

XXXXXXXXXXXYYYOO
0011100000001000
~

--...-.-- '-v-" '-.,-..'

3

8

0

8
MEMR or

C~U

JAO
AO

l

f'

.~

~'

I

ADDRESS
DECODING

4

too .. ·t

---

IVeel

~AO If~om

r----

8259
PICU

PICU
(Masterl

CS

~
~

~ B' (from Addres! Oecoding Iogicl

PICU
ISiavel

CO

INT

sp-r

t

L~

To level 7

8259

~ (fro!!l Address

INT

Slava

t
07

____ AO (from Address Busl

Addr.s. Busl

' Decoding)

ISlavel

IR6

To level 6
Slave

CS

I

IRO . . .

IR;:::::t'R5
DEVICE

0

DEVICE
•
5

I

"

DEVICE
14

II

IRO"

IR7
DEVICE.
21

V

,.

• DEVICES AT MASTER PlCU LEVEL 7

Figure 4-37.

A System

With Three PICUs -

4-56

DSO" ,.DB7

~

r-----.

CO

Cl
C2

8259

t

I-INTA

iNi'A

+ 5V.i!!.-

DO· . .

~

lOW

CS

j

D7 _
lOR

~

~

I

CONTROLLER

l

..

tDO .. ·tD7_
lOR
INT' '.

A15

8228
SYSTEM

iN'fA

•• , A15

t

iToR

MEMW o;TroW

~

8080A

I

'-

DEVICE
6

•

II

IR7
DEVICE

13

'V'

,;

DEVICES ZT'MASTER PICU LEVEL 6

One Master And Two SI?ves

At memory location 380816. the object code for the instruction:
JMP

ADDR2

takes us directly to the required interrupt service routine.

8259 PICU PRIORITY ARBITRATION OPTIONS
Q

w

~
oa..

a:

a:
o
o
~

enw
~

g
(/)
(/)

«

a!I
w
Z

a:

o

Priority arbitration logic is used to determin~ which interrupt request will be acknowledged when two or more
interrupt requests exist simultaneously. The 8259 PICU allows interrupt priorities to be specified at two
levels - which need to be clearly separated and identified.
As discussed in Volume 1- 8asic ConceRts. interrupt priority arbitration usually applies to simultaneous interrupt requests: at the instant an interrupt is acknowledged. if more than one external requesting source is requesting an interrupt, priority arbitration logic decides which single interrupt request will be acknowledged. Once an interrupt
has been acknowledged. priority arbitration has nothing to do with whether the interrupt ser.vice routine can itself be
interrupted. or by whom.
, .
The 8259 PICU extends interrupt priorities to the service routines themselves. Once an interrupt has been
acknowledged. its service routine can only be interrupted by a higher priority interrupt.
If you are unsure of the difference between interrupt priority arbitration at the point when interrupts are acknowledged.
as against priority arbitration for the entire duration of an interrupt service routine. then refer to Volume I - 8asic Con£f3RtS. where this subject is covered thorough!y.

CD
(/)

o

Let us now look at the various priority arbitration options provided by the 8259 PICU.

~

The Fully Nested Mode is the default case. Interrupt priorities are set sequentially from 0 (highest) to 7 (lowest).

«
Q
«
@

As we will describe shortly. the 8259 PICU must be initialized by an appropriate instruction sequence before it can
be used in any way. Upon completing programmed initialization, Fully Nested Mode is ttle priority arbitration option in force. It takes additional instructions to specify a'ny other priority arbitration option.·
8259 PICU
In Fully Nested Mode. interrupt priorities will never change. An interrupt request arriving at an IR
INTERRUPT
line will never be acknowledged if an interrupt request exists at a higher priority line. or if an interSERVICE
rupt service routine is being executed in response to a higher priority interrupt request. Conversely. once an interrupt has been acknowledged. the interrupt service routine which is sUQseROUTINE
PRIORITIES
quently e.xecuted may be interrupted only by a higher priority interrupt. It makes no difference
whether interrupts have. or have not been disabled. the 8259 PICU will ignore all interrupt requests at priority levels below that of an interrupt service routine currently being executed. For example. suppose interrupts are being requested simultaneously at levels 2 and 5. The level 2 interrupt will be acknowledged and its interrupt
service routine will be executed. While the level 2 interrupt is being executed. the level 5 interrupt requeslwill be
denied by the 8259 PICU. whether or not interrupts have been disabled at the CPU. However. if an interrupt request arrives at priority level 1. the PICU will acknowledge this interrupt request. and will allow the level 2 interrupt service
. '
routine to be interrupted. This may be illustrated as f o l l o w s : '

".lioe,,?
Interrupts are requested

Denied - IR5 IR2 - acknowledged

I

Program
executing

An interrupt request at IR5.
if still pending. can now
be acknowledged

Ir'----.

New interrupt
request appears
at IRI
Interrupt is

IR2 request's

higher priority
than IR2. so
is acknowledged

service routine
is executed
IRI request's
service routine
is executed

4-57

It is very important to understand that the 8259 PICU extends interrupt priority logic beyond the interrupt
acknowledge. to the interrupt service routine itself. Standard priority arbitration logic does not extend to the interrupt
service routine. Thus. in the standard case if interrupts were being requested at prio~ities 2 and 5. then the priority level
2 request would be acknowledged. but the priority level 2 interrupt service routine could be interrupted by the level 5
interrupt request. unless all interrupts were disabled at th.e CPU - in which case pn interrupt request at level 1 would
also be denied.
'
If you do not want to extend interrupt priorities to the interrupt service routines. you can output a Special Mask Mode
comlTla~~ (which we will describe shortly) to selectively enable interrupt requests of lower priority than the currently
exec~ting interrupt service routine.
~otating Priority, Mode A is the next option. This differs from the Fully Nested Priority Mode.
which we just described. in that after being serviced. a request is immediately relegated to lowest
priority. This may be illustrated as follows:

8259 PICU
ROTATING
INTERRUPT
PRIORITIES

Priorities assigned to IR lines
'~

rLowest
7
IR7
IR2
IRS

Before first acknowledge
After first acknowledge
~fter

second acknowledge

.

"-

Highest

6
IR6
IRl
IR4

S
IRS·
IRO
IR3

4
IR4
IR7
IR2

3
IR3
IR6
IRl

2
IR2·
IRS·
IRO,

0
IRl
IR4
IR7

IRO
IR3
IR6

• id~f1tifies active interrupt r~quests.

In a microcomputer system that makes heavy use of interrupts, Rotating Run in Priority Mode A may be a necessary
replacement for the default Fully Nested Priority Mode. In the default case, the lowest priority levels may get little or no
service if there is heavy interrupt traffic. In an application that does not have a well defined hierarchy of interrupt
priorities. a rotation of priorities, as illustrated above, is superior - because it has the effect of giving every priority
level equal service.
Rotating Priority MoqeA is implemented as a sequence of single programmed events. The microprocessor outputs an
appropriate Control code to the 8259 PICU upon completing'every interrupt service routine. Thus Rotating Priority
Mode A is not a perman~ntly specified PICU condition: each rotation represents a single response to a single Control
l
code - unconnected to previous or future priority selections . For the moment. however, it is not necessary that you understand the programrnin~ techniques emp!oyed when selecting 8259 interrupt priority rrodes: that is a subject we
will cover after completing the description of all available priority options.
'

Rotating prio'rity lYIode B gi~es you some fle.xibility in determining future priorities. Now under program control
you can fix the next division between top and bottom pr!

'i<

I'

."",

>i

{
"

I

'.."'"

'/.'• , I tLogictoHandl~
>

Arithmetic and
·Logic Unit

>Interrupt~eq~est~

from
Exterriill Devices

Iii:

I

Clock Logic

:.':c

--

Accumulator
Registeris)

~;)

,:

Instruction Register ~
.'." .• '.'••.••

,..:.

Ii

:

,

>,.

~

~

Data Counteris)

Control Unit
I~

Stack Pointer
i,'

~ Program Counter

Direct Memory
Access Control
Logic

.,.,.."".

System Bus

(i."·:·

"'..':,

RAM Addressing
and .

ROM Addressing
and
Interface Logic

.....
,<:

·'···"·x>
Read Only
Memory

,(,'
.'.....".

Interface Logic

.....'.

)/i
·"··' •.·.·.',,·,,,·':":i'··""",··,·

(".

>
"

.. "

p"

Read/Write
MerTlOry

t

'. . "."y
"::'

i,.

,>

.'.,

'Figure 4-38. Logic of the TMS 5501 Multifunction InputlOutput Controller

4-68

~

Q

w

~
a:
o0.

V BB
VCC

1

40

XMT

2

39

Xl0

VOO

3

38

Vss
RCV

4
5

37
36

07

6

35

06
05

a:

o

-

04

CJ

~

03

en
w

02

l-

01

g

AO

e(

DO

fI.I
fI.I
e(

":'

-.
-- .

Al

ILl

A2
A3

a:

CE

!Xl
fI.I

SYNC

ell

Z

o
o

ct>1

~

.

~

~

7

34

8

33

9

32

XII

XI2

"'"-

XI3
XI4

-

XI5
XI6
XI7

~

10

TMS
5501

Xo7

31
30

.....

29

~

13

28

~

14

27

11
12

15

26

16
17

25
24

18

23

-

~

..

-

X06

XOs
X04

Xo3
X02
XOI

.

XOO

19

22

INT
SENS

20

21

11>2

~

e(
Q
e(

DESCRIPTION

,;; PIN NAME

@

TYPE
Bidirectional

DO - 07
XIO - XI7

Data Bus to CPU
Data Bus from external logic

Input

XOO - xo-;

Data Bus to external logic

Output

XMT

Transmit serial data line

Output

RCV

Receive serial data line

SENS
INT

External interrupt sense

Input
Input

Interrupt request

O~tput

CE

Chip Select

Input

AO - A3

Address Select

Input

SYNC

Synchronizing signal (SYNC) from 8080A

Ihput

11>1. ct>2

Clock inputs. same as to 80abA

Input

VBB·VCC·VOO·VSS

Power Supply (-5V. + 5V. + 12Vl and Ground

.

Figure 4-39. TMS 5501 Multifunction Input/Output Controller Signals
and Pin Assignments

Do not miss the significance of XO negative logic; whatever yo~ write to the TMS 5501 for
parallel output will be complemented. XO signals are the inverse of the output buffer contents.
Serial I/O data uses the XMT and RCV pins. XMT is used to transmit serial data. whereas RCV is
used to receive serial data. Note that RCV is negative-true signal. whereas XMT is a positive-true
Signal.

TMS 5501
OUTPUT
SIGNAL
INVERSION

a

..

'

.

\

External logic may request interrupt service either via the SENS input or via the XI7 input. A low-to-high transition on either signal constitutes an interrupt request. SENS is always part of external interrupt request logic; XI7 must
be programmed for this purpose - in which case the eight XI pins cannot be used to input 8-bit parallel data. .
Logic internal to the TMS 5501 may also generate interrupt requests. Whatever the source of the interrupt request. it is passed on to the CPU via the INT interrupt request signal.
The TMS 5501 is acc~ssed either as 16 I/O ports or 16 inemory locations. Addressing logic consists of a chip
select (CE) and four address select inputs (AO, A 1, A2 arid A3).
The TMS 5501 receives the SYNC timing pulse, and this requires special mention. While SYNC is high. the TMS
5501 decodes statuS off the Oat? Bus. therefore the 8228 System Controller is not needed.
Additional signals required by the TMS 5501 are the two 8080A clock signals <1>1 and <1>2. Slight clock signal
variations will confuse serial I/O logic which computes baud rates internally.

4-69

A feature of the TMS 5501 which you must note carefully is that it cannot handle Wait
states. Any TW clock periods in a machine cycle will cause the TMS 5501 to malfunction.

TMS 5501
WAIT STATE

There is a further unlikely ramification of the TMS 5501 inability to handle Wait states. If you are
accessing the TMS 5501 as 16 memory locations, then you cannot have a Halt instruction's object code in the
memory location immediately preceding the 16 TMS 5501 addresses. If you do. the Halt instruction will execute.
following which the Address Bus will contain the address of the next sequential memory location -which now is a
TMS 5501 address. Thus. the TMS 5501 becomes selected. But the TMS 5501 logic cannot cope with a sequence of
'undefined clock periods. which is exactly what will happen following a Halt instruction's execution. The net effect is
.that following a Halt. the TMS 5501 receiver buffer loaded flag will be inadvertently cleared.
Always make sure that the memory address directly preceding the 16 addresses assigned to a TMS 5501 remains
unused.
.

TMS 5501 DEVICE ACCESS

,

,i

Some of the 16 I/O port or memory addresses via which the TMS 5501 device is accessed are equivalent to
memory locations, but others are command identifiers. Table 4-7 defines the manner in which addresses are interpreted.
You will find the TMS 5501 far easier to use if you address it as 16 memory locations. because that will give you access
to memory referencing instructions.
When creating TMS 5501 select logic. any of the select schemes described earlier in this chapter will do -with one
addition. Include READY as part of the select logic; if READY is low. a Wait state will follow. and that will cause the
TMS 5501 to malfunction. By making READY high a necessary component of device select logic. you can avoid this
problem.
In the following discussion of individual TMS 5501 capabilities. we will use programming examples to show the effec. tiveness of including the TMS 5501 device within your memory rather than I/O space.
Table 4-7. TMS 5501 Address Interpretations
A3

A2

A1

AO

FUNCTION

0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

b

0
0
1
1
0
0
1
1
0
0
1
1

0
1
0
1
0
1
0
1
0

0
0

0

1
1

0

Read assembled serial input data byte out of Receiver Buffer
Read parallel data input via XIO - XI7
Read RST instruction code. as a data byte. when polling interrupt requests
Read Status register contents to the CPU
Write command code to the TMS 5501
Load. serial I/O Control register. specifying baud rate and stop bits
Write data byte to serial transmit logic
Write data byte to parallel output port
Write out interrupt mask byte to selectively enable and disable interrupts
Write initial count to Interval Timer 1
Write initial count to Interval Timer 2
Write initial count to .Interval Timer 3
Write initial count to Interval Timer 4
Write initial count to Interval Timer 5
No Operation
No Operation

0
0
0
1
1
1
1
0
0

O·
0
1
1
1
1

i
0

;

1
1

.

.

TMS 5501 addressable locations 3, 4 and 5 are used for status. and controls which generally apply to serial I/O
and interrupt processing. We will define how these ports are used now. in advance of our discussion of TMS 5501
serial I/O and interrupt processing capabilities.
.
.

4-70

Locations 3 and 5 apply to serial I/O logic. Location 3 is a Status register whose bits are interpreted as follows:
7 6

5 4 3 2 1 0

~Bit No.

I I I I I I I I :
c
w

.

•

!(
ex:
oQ.

~

~

Serial I/O Status register (Address 3)

+

1 Framing error detected
1 Overrun

ex:

error detected

o
u

1 No serial data being received

en
w

1 Transmit Buffer empty

1 Receive Buffer ready to be read

~

!(

1 Intenupt pending

en

1 Start bit as been de'tected

g
en

1 Serial data character being received

~

all
w
Z

ex:

oID
en

o

~
~

C

~

@

Bits 0 and 1 are standard framing and overrun error indicators.
If a framing error is detected. Status register bit 0 will be set to 1 and will remain 1 until assembly of the next complete
serial data character has been completed.
If Receiver Buffer contents are not read while the next serial character is being input and assembled. an overrun error
will be reported in bit 1 of the Status register. This error indicator will be cleared as soon as the Status register contents
are read. or when a reset command is output. Remember. you have the time it takes to receive. and assemble one
character in which to read the previous character out of the Receiver Buffer. This is because receive logic includes a
double buffer. A character is assembled in a Receiver register: when completely assembled. it is shifted to a Receiver
Buffer and the next character is assembled in the Receiver register:

RcV

I

Byte N

Receiver

Byte N being

Register

assembled

I

\

\

Byte N + 1
Byt~

N + 1 being
assembled

Contents
Receiver
Buffer
Contents

Assembled Byte N.

Assembled Byte N - 1.
waiting to be read·

waiting to be read

Status bits 2,3,6 and 7 monitor the condition of the serial data input signal. During a break. that is. when no valid
serial data is being input. status bit 2 will be high. As soon as a start bit has been detected. status bit 2 will be reset low
and status bit 7 will be set high. When the first valid data bit is detected. status bit 6 is also set high. When the
received character has been assembled in the Receiver Buffer. and may be read by the CPU. status bits 7 and 6 are
reset and status bit 3 is set. This may be illustrated as follows:
End of first data character

RCV

M

M

D

Bit 2

Bit 3

Bit 6

Bit 7

4-71

D
M

Marking

A

Start bit

D

Data bits

P

Parity bit

0

Stop bits

Status bit 4 applies to serial transmit logic. As soon as the Transmit Buffer is ready to receive another byte of data.
status bit 4 will be set high. It will remain high until new data has been loaded into the Transmit Buffer.
Transmit logic. like receive logic. is double-buffered. A byte of data is held in a Transmitter register while being output
serially; meanwhile. the next data byte may be loaded into a Transmitter Buffer. Transmitter Buffer contents are automatically shifted to the Transmitter register when' serial output of a data byte is complete. This may be illustrated as
follows:
XMT

Transmitter
Register

I

I

\

Byte N

Byte N + 1

Byte N being

Byte N + 1 being

output serially

output serially

Write Byte N + 1 into

Write Byte N + 2 into

transmitter Buffer

Transmitter Buffer

during this time

during this time

\

Contents
Transmitter
Buffer
Contents

Status bit 4 is high from the insti:lntTransmitter Buffer contents are shifted into the Transmitter register. until a new
data byte is written into the Transmitter buffer.

Status bit 5 isset whenever the TMS5501has an unacknowledged interrupt request. While this status bit is very
important in sedall/O operations. it also may have application elsewhere; this bit therefore may be looked upon asan
exception within the Status register. in that it is the only status flag that does not apply strictly to serial 1/0 operations.
TMS 5501 addressable location 5 is also dedicated to serial I/O. Into this location you must load a control byte
which selects baud rate. and the number of stop bits. Register contents will be interpreted as follows:

..

7 6 5 .. 3 2..
~~~~~~

. 0 ~ Bit

No .

.....----Baud Rate Register (Address 5)

~~

...____. . ;. __ j

~ ~[;~}.

_ _ _ _ _ _ _ _ _ 1 = 2400 saud
---------- 1

'------------1

"'------------ 1

Baud rates based
on 2 mHz clock

= 4800 Baud
= 9600 Baud

= One

stop bit

o = Two stop bits

If more than one of bits 0 through 6 are high. then the highest indicated baud rate will be selected. If no baud rate bit is
high. then all serial transmit and receive logic will be inhibited.

·4-72

TMS 5501 addressable location 4 is a general command register. Its contents will be interpreted as follows:

7 6 5

.c

3 2 1 0

~ Bit No .

......-

~~~~~~~~

.... COntrol Register (Address 4)

Q

w

~---

-----1o

~
oQ.
a:

a:
o
u

~-----

1 = Device reset

= Output
= Output

Mark on idle
space on idle

1 = Select XI7 as lowest priority interrupt

o = Select interval timer 5 as lowest priority interrupt

~

~-------, = Enable TMS 5501 interrupt acknowledge

enw

o = Disable TMS 5501

~
(j
ofI)

interrupt acknowledge

~-------- 0 = Normal baud rate and interval timing

1

fI)

ct

= TMS 5501 11>1 intemal clocking runs eight times normal rate. which
11 multiplies all baud rates in the baud rate register by 8. allowing
high speed data transfers at rates up to 76.8 kilo baud

ell

----------0

w
Z

a:

o

21 decrements the interval timers every 8 microseconds
= Normal operation

1 = INT outputs a clock whose frequency depends on bit 4. If bit 4 is reset

m

(0). the output frequency is the system clock frequency divided by 128.

fI)

o

If bit 4 is set (11. the output frequency is the system clock frequency
divided by 16.
....- - - - - - - - - - - C a n have any value

~

ct
Q

ct

@
If your system does not require interrupts from the TMS 5501, you can set bit 5 high to derive a TTL compatible
clock from the INT output.
If the TMS 5501 device is reset by outputting 1 to bit 0, then the following events will occur:
1)

Serial receive logic enters the Hunt mode. Status bits 2.3.6 and 7 are all reset however. reset
will not clear the Receive Buffer contents.

2)

Serial transmit logic will output a high marking signal. Status bit 4 will be set high indicating that transmit logic is
ready to receive another data byte.

3)

The interrupt mask register is cleared with the exception of the Transmit Buffer interrupt. which is enabled. (Interrupt levels and interrupt masking are described shortly.)
All interval timers are halted.

4)

The Reset has no effect on any of the following:
- Parallel input and output port contents
- Interrupt acknowledge enable
- Interrupt Mask register contents
- Baud rate register contents
- Serial Transmit or Receive Buffer contents
. Control command bit 1. determines whether serial transmit logic will mark or space when not transmitting data.
A 1 in bit 1 will cause serial transmit logic to mark (output high) while a 0 in bit 1 will cause transmit logic to space
(output low).
If Reset conflicts with the break specification. then Reset will override and transmit logic will mark. irrespective of the
break bit specification.
The TMS 5501 can receive an interrupt request from one of nine different sources. Using the eight Restart instructions.
each interrupt request is assigned one of eight priorities. For this to be possible. two interrupt sources share the lowest
priority interrupt level (RST 7); these two sources are an external request arriving via XI7 and the Interval Timer 5 time
out interrupt request. You use bit 2 of the control command to select which requesting source will be active at
any time as the lowest priority interrupt.
Bit 3 of the control command is a master enable/disable for TMS 5501 interrupt logic. If this bit is output as O.
then TMS 5501 interrupt acknowledge logic is disabled - and that effectively disables the entire interru pt processing
system. Observe that with interrupt acknowledge logic disabled you can still use polling techniques in lieu of interrupt
processing.

4-73

Table 4-S. TMS 5501 Interrupt Logic and Priorities'
Interrupt
and Mask
Bit

Data Bus
Status
05
04
03

o (highest)

0
0
0
0

0
0

0

1
1

0

1
1
1
1

0
0

0

1
1

0

RST
Instruction'

Interrupting Source
•

1
2
3
4
5
6
7 (lowest)

1
1
1
1

RSTO
RST 1
RST 2
RST 3
RST'4
RST 5
RST 6
RST 7

f

Interval Timer 1
Interval Timer 2
External SENS interrupt request
Interval Timer 3
Serial I/O Receiver Buffer full
Serial I/O Transmitter Buffer full
Interval Timer 4
Interval Timer 5, or external XI7
interrupt request, whichever has
beeri selected by commant;! code

TMS 5501 INTERRUPT HANDLING
The TMS 5501 responds to nine different interrupt requests, with priorities as defined in Table 4-S.
When an interrupt is acknowledged, INT is output high by the TMS 5501. If the TMS 5501 INT output is connected
to the SOSOA INT input. then the SOSOA will acknowledge the interrupt by outputting D1 high at SYNC high. The TMS
5501 responds to this acknowledge by placing an RST instruction's object code on the Data Bus. as required by standard SOSOA timing. This is an utterly standard SOSOA interrupt request/acknowledge sequence.
Interrupts may be selectively disabled by writing a mask to TMS 5501 Register S: see Table 4-7. A 0 bit will disable
an interrupt: mask bits are related to priorities as follows:

7 6 5

4

3 2 1 0 ...........- - Bit

I 1 I I I I I I :
~

, ,

t'

No.

TMS 5501 Register 8
Interval Timer 1
Interval Timer 2
External SENS interrupt request
Interval Timer 3
Serial I/O Receiver Buffer full
Serial I/O Transmitter Buffer full
Interval Timer 4
Interval Timer 5 or external XI7 interrupt request

Note that TMS 5501 interrupt priorities apply to the request/acknowledge sequence only -which is the standard
passive interrupt priority arbitration sequence used in most microcomputer applications. Once an interrupt is
acknowledged and is being serviced by an interrupt service routine. it is up to the programmer to disable all interrupts.
or selected interrupts. if the interrupt service routine is not itself to get interrupted. If. for example. an interrupt were to
be acknowledged at priority 3 (Interval Timer 3). in the normal course of events the SOSOA CPU will disable all interrupts upon acknowledging any interrupt. Therefore the Interval Timer 3 interrupt service routine will deny any other interrupt request. whatever its priority. until the Interval Timer 3 service routine completes execution. If the Interval Timer
3 interrupt service routine were to immediately enable all interrupts. then any other·interrupt request would be
acknowledged. irrespective of priority.
If you want to ensure that only higher priority requests interrupt the Timer 3 service routine. then the Timer 3 service
routine must begin by outputting a mask to disable all lower level interrupts at the TMS 5501: then it must enable all
interrupts at the CPU. Here is the necessary instruction sequence:
MVI
EI

TMSS.07H

:OUTPUT MASK TO REGISTER S OF TMS 5501
:ENABLE INTERRUPTS

The mask output in this case has the value 07. since mask bits O. 1 and 2 only must be set to 1. enabling the highest
. ,
three interrupt priority levels.

4-74

Let us now look at the nonstandard features associated with TMS 5501 interrupt
handling logic. First of all. so long as there is an unacknowledged interrupt request. Status
register bit 5 is set to 1; next the RST instruction object code for the highest level interrupt
request is stored in TMS 5501 Register 2. This allows you to bypass normal interrupt processing logic and poll the TMS 5501 instead.
.

cw

~
ex:
o

Il.

ex:

o

CJ

~

en
w

~
o
U)

(3

U)

c(

TMS 5501
NONSTANDARD
FEATURES

In order to bypass interrupt logic. simply disconnect the TMS 5501 INT output from the 8080A INT input. You can still
identify interrupt requests occurring within the TMS 5501 by reading the TMS 5501 Status register. If bit 5 of the
Status register is 1. then one or more interrupt requests are active within the TMS 5501. In order to determine which is
the highest level active interrupt request. read the contents of TMS 5501 memory location 2. The RST instruction object code corresponding to the highest priority interrupt request will have been assembled in this location. Bits 3. 4 and
5 of the RST instruction object code identify the priority level. Thus you can determine which of the eight priority levels
was the highest active interrupt request. Here is a typical polling sequence:
;ASSUME THAT THE TMS 5501 ADDRESS SPACE CONSISTS OF 16 MEMORY
;LOCATIONS FROM 8000 THROUGH 800F. TMS5 IS THE SYMBOL ASSIGNED
:TO THE BASE ADDRESS
TMS5
EOU
8000H

all

w

Z

ex:

o

aI

U)

o

~

c(

c

c(

;TEST STATUS REGISTER FOR INTERRUPT PENDING
LOA
TMS5+3
;LOAD STATUS TO ACCUMULATOR
ANI
20H
;ISOLATE BIT 5
TMS5+2
;IF NOT ZERO. AN INTERRUPT HAS BEEN
JNZ
;REOUESTED

@

It is worth spending a minute looking at the three-instruction sequence illustrated above. The TMS 5501 Status register
contents are loaded into the Accumulator by the LOA instruction. The next instruction isolates bit 5. If bit 5 is 1. then
an interrupt has been requested. and the next instruction. a JNZ. branches program execution to a memory location
within the TMS 5501 itself. Will that work? Indeed. it will. The label TMS5+2 addresses TMS 5501 Register 2. which
contains an RST instruction's object code; this is the object code which would have been output in response to a normal interrupt acknowledge. What the JNZ instruction does is cause this RST instruction's object code to be executed
next; and that is precisely the logic sequence which a normal interrupt response would have implemented.
Notice that the very simple method we have illustrated for polling on status only works if the TMS 5501 can be addressed as memory locations rather than I/O ports.

TMS 5501 PARALLEL I/O OPERATIONS
It is very easy to handle simple parallel I/O. without handshaking, using the TMS 5501. This is equivalent to 8255
Mode 0 operation. TMS 5501 address 1 accesses the parallel 8-bit input port. while address 7 accesses a parallel 8-bit
output port (see Table 4-7). Assuming that the TMS 5501 is addressed as memory. input and output operations are
handled using any memory reference instructions.
A very limited amount of parallel I/O handshaking is available. The SENS interrupt input signal can be used by externallogic either to indicate that it has read output data. or to indicate that it has transmitted input data .. However. the
TMS 5501 device itself has no control~als which can be used to prompt external logic; that is to say. the TMS 5501
has no signal equivalent to the 8255 OBF control. When comparing the parallel I/O capabilities of the TMS 5501 with
the 8255. therefore. we conclude that 8255 Mode 0 operations can be duplicated without problems. but neither Mode
1 nor Mode 2 parallel I/O operations with handshaking can be duplicated. Only a primitive level of parallel I/O with
handshaking exists within the TMS 5501 and even this exists at the expense of external interrupt logic.

TMS 5501 SERIAL I/O OPERATION
A significant asynchronous, serial I/O capability is provided by the TMS 5501. Synchronous serial I/O is not supported.
There are very significant differences between the implementation of asynchronous serial I/O by the TMS
5501. as compared to the 8251 USART.
The TMS 5501 has separate serial transmit and receive pins (XMT and RCV). but it has no accompanying handshaking
control signals; instead 5th and 6th priority interrupts identify Receiver Buffer full and Transmit Buffer full. respectively. Bits 2. 3. 6 and 7 of the Status register (addressable location 3) identify the condition of a serial receive data
stream.

4-75

When using the TMS 5501. you have to continuously read in the contents of the Status register and test the condition
of appropriate status bits in order to implement standard serial receive logic: however. in the end you can implement
the same serial receive logic as is provided automatically by the 8251 USART. Here is the relationship between the
TMS 5501 and the 8251 USART controls:
8251 USART
TxRDY
TxE
TxC
RxRDY
RxC
SYNDET

TMS 5501 EQUIVALENT
Status register bit 4
None
Baud Rate register
Status register bit 3
Baud Rate register
None

Probably the most significant difference between TMS 5501 and 8251 USART control is the fact that TMS 5501 baud
rate is programmed by outputting an appropriate Control code. while it is clocked by rate signals input to the 8251
USART. The TMS 5501 advantage is that the TMS 5501 does not need external baud rate clock generation logic:
however there must be a very precise synchronization between the TMS 5501 and whatever external logic it is communicating with. Minor timing differences are no problem when using an 8251 USART since a clock signal can accompany the serial data stream. Minor timing differences can be intolerable when using the TMS 5501: a small difference
between TMS 5501 baud rate and external clock signals can generate very significant errors.

TMS 5501 INTERVAL TIMERS
The TMS 5501 has five programmable Interval Timers. Each timer can be loaded with an initial count ranging
from 01 (lowest) through FF16 (highest). Each Timer will decrement one count every 64 microseconds. As soon
as a programmable timer counts out to zero, it requests an interrupt. In our discussion of TMS 5501 interrupt logic.
we have defined the priority levels assigned to the various Interval Timers. Notice that Interval Timer priorities have
been spread across the range of priority levels. By using Interval Timer 1 or 2. you can be sure of precise time intervals.
since an interrupt request will be acknowledged with little or no delay. Timers 4 and 5. being the lowest priority. can be
used to generate less precise time intervals. It is conceivable that interrupt requests originating at these two timers
might have to wait a significant amount of time before being serviced - if there is any degree of interrupt traffic within
the microcomputer system.
Loading a 0 value into an Interval Timer causes an immediate interrupt request.
When a nonzero value is loaded into an Interval Timer. it starts to count down immediately. If a new value is loaded into
an Interval Timer while it is halfway through counting out. then the new value will be accepted: it will override the previous value and subsequently will be decremented. Therefore the Interval Timers are retriggerable.
Once an Interval Timer counts out. it halts.

4-76

DATA SHEETS
This section contains specific electrical and timing data for the following devices:

c

w

~
o
D.

a:

• 8080A CPU
• 8224 Clock Device
• 8228 System Controller
·8259 PIC
• TMS 5501 I/O Controller

a:
o

o

~

en
w
~

g
CI)
CI)

c(

o!I

w
Z

a:

oa:I
CI)

o

~

c(

c

c(

@

4-D1

BOBOA/BOBOA-1/BOBOA-2
ABSOLUTE MAXIMUM RATINGS·
·COMMENT: Stresses above those listed under "Absolute Maximum Ratings" may cause permanent damage to the device.
This is a stress rating only and functional operation of the device at these or any other conditions above those indicated in
the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended
periods may affect device reliability.

Temperature Under Bias . • . . . . . . . • . • O°C to +70° C
Storage Temperature ..•...•..•.•. -65°C to +150°C
All Input or Output Voltages
With Respect to VeB ....•..•... -0.3V to +20V
Vce , VOO and Vss With Respect to VBB
-0.3V to +20V
Power Dissipation .•..•••..•-..... ...•••. 1.5W

D.C. CHARACTERISTICS
= o°c

TA

to 70°C, VOO

Symbol

= +12V ± 5%, Vce = +5V ± 5%, VB B = -5V ± 5%, Vss = OV,
Typ.

Min.

Parameter

Unless Otherwise Note~.

Max.

Unit

Vss+0.8

V

Test Condition

VILC

Clock Input Low Voltage

VIHe

Clock Input High Voltage

9.0

Voo+l

V

VIL

Input Low Voltage

Vss-l

Vss+0.8

V

VIH

Input High Voltage

3.3

Vec+ 1

V

VOL

Output Low Voltage

VOH

Output High Voltage

100 (AV)

Avg. Power Supply Current (Voo)

40

70

mA

leC(AV)

Avg. Power Supply Current (Vce!

60

80

mA

IBB (AV)

Avg. Power Supply Current (VSB)

.01

1

mA

IlL

Input Leakage

±10

J.lA

Vss ~ VIN ~ Vce

ICL

Clock Leakage

±10

J.lA

Vss'~ VCLOCK ~ Voo

IOL(2]

Data Bus Leakage in Input Mode

-100
-2.0

J.lA
mA

Vss ~VIN ~Vss +0.8V

+10 .
-100

J.lA

IFL

Vss-l

0.45

V

Address and Data Bus Leakage
During HOLD

Symbol

Vce = VOO

} Op,,";oo
Tcy

= .48 J.lsec.

Vss +0.8V ~VIN ~Vcc
VAOOR/OATA
V AOOR/OATA

CAPACITANCE
TA = 25°C

} IOL = 1.9mA on all outputs,
IoH =-l50J.lA.
.

V

3.7

= Vee
= VSS + 0.45V

1.5

= Vss = OV, VBB = -5V

Parameter

...

Typ.

Max.

Unit

Ccf>

Clock Capacitance

17

25

pf

fc

CIN

I nput Capacitance

6

10

pf

Unmeasured Pins

COUT

Output Capacitance

10

20

pf

Returned to Vss

Test Condition

= 1 MHz

~

:J
c.>

~

t

iil
0.5

NOTES:
1. The RESET signal must be active for a minimum of 3 clock cycles.
2. When OBIN is high and VIN > VIH an internal active pull up will
be switched onto the Oata Bus.
3. A I supply (AT A = -0.45%1' c.

0

+25

+75

+50

AMBIENT TEMPERATURE (OC)

Figure 2. Typical Supply Current vs.
Temperature, Normallzed(JI

~:]----~
o

Vee

YIN

Figure 3. Data Bus Characteristic
During DBIN
Data sheets on pages 4-02 through 4-012 are reprinted by permission of Intel Corporation, Copyright 1978.

4-02

SOSOA/SOSOA-1/S0S0A-2
A.C. CHARACTERISTICS (8080A)
TA = o°c to lODC, VDD = +12V ± 5%, Vee = +5V ± 5%, VBB

= -5V

± 5%,

·2

Mu.

·1
Min.

·1

Min.

MIx.

Min.

·2
MIx.

Unll

0.48

2.0

0.32

2.0

0.38

2.0

"sec

50

0

25

0

50

nsec

Vss = OV, Unless Otherwise Noted

--'-'

PI,.mlllr

S,mbol

c

w

tcyl31

Clock Period

TI.I Condition

Ir,l,

Clock Rise and Fall Time

0

oQ.

1",

"1 Pulse Width

60

50

60

nsec

o
u

t"2

"2 Pulse Wldlh

220

145

175

nsec

~

tDl

Delay "1 to "2

0

0

0

nsec

en
w

tD2

De~ay "2 to "1

70

60

70

nsec

tD3

Delay "1 to "2 Leading Edges

60

60

70

g

IDA[21

A~dress

CI)
CI)

tDD[21

Data Output Delay From "2

toc[21

Signal Outpul Delay From "2 or ~ (SYNC, WR, WAIT, HLDA)

z
o
III

tOl:(21

DBIN Delay From "2

tDI[ll

Delay 'or Input Bus to Enter Input Mode

CI)

tDSl

Data Setup Time During "1 and DBIN

!ia:
a:

!i
ct
oil
w

a:

o

Output Delay From "2

150

175

nsec

220

180

200

nsec

120
25

nsec

200

110

140

25

25

130

tDF

tDF
10

30

120

nsec

140

nsec

tDF

nsec

}

CL"'OOpF

}

CL-50pF

nsec

20

:!:
ct
c
ct

WAVEFORMS

(Note: Timing measurements are made at the following reference voltages: CLOCK "1" = B.OV
"0" = 1.0V; INPUTS "1" = 3.3V, "0" = O.BV; OUTPUTS "1" = 2.0V, "0" = O.BV.)

@

"I

;rr

-::r"-"-~
~

.r ~
-- I ---

Qz

-toJ ...1

A'5'Ao

-1
I

~,
0 7,0
0

I

,r-\

1

-I toe

1-

.

-

tOI

--1 -- --

J-

....., toHI-

. Pit"-r.-

-----4--

~

~ '0$14-

READY

~---

'f-tAW
I--too-

~

I
I

-'ocl-

~~

-- -- ~--- ~-

_tOF-l

--- - -r"!."-.o!!,:(
-tow

Ii
:i
I

!

-----------

_L

I

.I@I Y

------------

- tRsf.-l
t H-

WAIT

-

HLDA

toc f--

I

I

!

J--

tRS toc-I
&t~

toc-I
HOLD

tH -

I

i

i

iI

1

I-to~

m

~

tou -

.\..

T

OBIN

~
I

t02

I-to.:=r
I-too

SYNC

/\

/\

......--,

I

!

Ii

I

I!

X.I

1-

-

tH -.:

14 -

I@ I
-I~;~

Ii

II

-_~

INT _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

INTE

4-03

80S0A/8080A-1/8080A-2
A.C. CHARACTERISTICS (8080A)
oOe to 7oo e, VDD = +12V ± 5%, Vec = +5V ± 5%, VBB

TA =

= -5V

Plrlmetlr

Min.

Data Setup Time to "2 During DBIN

150

tDH (1 )

Data Holt time From "2 During DBIN

(1)

t1E (2)

INTE Output Delay From "2

tRS

RE~DY

SymbOl
tDS2

± 5%, Vss

= OV,

·1
Min.

MIx.

Mu.

·2

·2

Min.

MIX.

130

120
(1)
200

Unit

nsec
200

nsec

120

90

90

nsec

tHS

HOLD Se'up Time to "2

140

120

120

nsec

tiS

INT Setup Time During "2

120

100

100

nsec

tH

Hold Time From "2 (READY.Ir.H. HOLD)

0

0

0

tFD

Delay to Float During Hold (Address and Data Bus)

tAW2)

Address Stable Prior to WR

120

Te.t Condition

nsec

(1)

200

Setup Time During "2

·1

Unless Otherwise Noted

CL= 50 pF

nsec

120

120

nsec
1-

IS)

(5)

(5)

nsec

tDW 2)

OutP'!t Data Stable Prior 10 WR

(6)

(6)

(6)

nsec

tWD(2 )

Output Data Stable From WR

(7)

(7)

(7)

nsec

tWA (2 )

'Address Siable From WR

(7)

(7)

(7)

nsec

tHF(2 )

HLDAto Float Delay

IB)

[B)

[B)

nsec

twF (2)

WR to Float Delay

t AH (2)

Address Hold Time After DBIN During HLDA

.,

f\

(9)

(9)

(9)

nsec

-20

-20

-20

nsec

CL = 100 pF: Address. Data
CL = 50 pF: WR,HLDA,DBIN

1-

NOTES: (Parenthesis gives ·1. ·2 specifications. respectively)
1. Data input should be enabled with DB IN status. No bus conflict can then occur and data hold time is assured.
tDH = 50 ns or tDF. whichever is less.
2. Load Circuit .
+SV

'2

B080A
OUTPUT

A'5 Ao

3. ICY = tD3 + tr+2 + t+2 + t'+2 + t02 + tr+1 ~ ~80 ns (- 1:320 ns, - 2:3BO ns).
TYPICAL

~

OUTPUT DELAY VS.

~

CAPACITANCE

+20 .------.-----r-.--~--

0)'0 0
c

>

syrJC:

~

0

....

OBIN

~

::>

..,

0

\/ill

·10

I

+10r.
REAllY

.l

CAPACITANCE Ipll
ICACTUAL - CSPEcl

WAIT

HOLD

~

-

HLDA

IN~

INTE

~

l,,,~

_Jt;-

toe ______

4. The following are relevant when interfacing the aOaOA to devices having VI H = 3.3V;
al Maximum output rise time from .av to 3.3V = lOOns @ CL = SPEC.
b) i)utput delay when measured to 3.0V • SPEC +60ns @ CL = SPEC.
c) If CL SPEC, add .6ns/pF if CL> CSPEC, subtract .3ns/pF (from modified delay) if CL

*

< CSPEC.

5. rAW = 2tCY - tD3 - tr+2 -140ns(-1:110ns. -2:130ns).
6. tow = ICY - tD3 - t r +2 - 170 ns (-1:150 ns, -: 2:170 ns).
If not HLDA. tWD = tWA = tD3 + tr2 +10ns. If HLDA. tWD = tWA = tWF.
tHF = tD3 + t"1>2 -SOns.
tWF = tD3 + tr2 -IOns
Data in must be stable for this period during DBIN ·T3. Both tDS1 and tDS2 must be satisfied.
Ready signal must be stable for this period during T2 or TW. (Must be externally synchronized.)
Hold signal must be stable for this period during T2 or TW when entering hold mode. and during T3. T 4, TS
and TWH when in hold mode. (External synchronization is not required.)
13: Interrupt signal must be stable during this period of the last clock cycle of any instruction in order to be
recognized on the following instruction. (External synchronization is not required.)
14. This timing diagram shows timing relationships only: it does not represent any specific machine cycle.
7.
a.
9.
10.
11.
12.

4-04

8224

ABSOLUTE MAXIMUM RATINGS·

Q

w

~
a:
o0.
a:

o

·COMMENT: Stresses above those listed under "Absolute
Maximum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at these or any other conditions above
thoSe indicated in the operational sections of this specification is not implied. E~posure to absolute maximum
rating conditions for extended periods may affect device
reliability.

Temperature Under Bias ............... O°C to 70°C
Storage Temparature .............. -65°C to 150°C
Supply Voltage. Vee ................ -0.5V to +7V
Supply Voltage. Voo .. : ........... -0.5V to +13.5V
Input Voltage ..................... -1.5V to +7V
Output Current ......... ; ............... 100inA

CJ

~

en
w

~
U
oCI)
CI)

«
o1J
w
Z

D.C. CHARACTERISTICS
TA = O°C to 70°C; Vee = +5.0V ±5%; Voo = +12V ±5%.
Limits
Typ.

a:
c:a

Symbol

Max.

Units

o

IF

Input Current Loading

-.25

mA

VF = .45V

IA

Input Leakage Current

10

J1A

VA = 5.25V

Ve

Input Forward Clamp Voltage

1.0

V

Ie = -5mA

V 1L

Input "Low" Voltage

.8

V

Vee = 5.0V

VIH

Input "High" Voltage

2.6
2.0

V

Reset Input
All Other Inputs

VIWVIL

RESIN Input Hysteresis

.25

VOL

Output "Low" Voltage

o

Parameter

Min.

Test Conditions

CI)

~

«Q
«
@

VOH

Output "High" Voltage
4>" .4>2
READY. RESET
All Other Outputs

Ise (1 )

Output Short Circuit Current
(All Low Voltage Outputs Only)

Icc
100

V

Vee = 5.0V

.45

V

.45

V

(4)1.4>2). Ready, Reset, STSTB
IOL=2.5mA
All Other Outputs
iciL= 15mA

9.4
3.6
2.4

V
V
V
-60

mA

POI·'''· ~ ... pply Current

115

mA

Power Supply Current

12

mA

-10

Note: 1. Caution. 1 Pulse Width

2tcy _ 20ns
9

t4/2

cf>2 Pulse Width

5tcy _ 35ns
9

t01

cf>1 to cf>2 Delay

0

t02

cf>2 to cf>1 Delay

2tcy _ 14ns
9

t03

cf>1 to cf>2 Delay

2tcy
9

Max.

ns
CL = 20pF to 50pF
2tcy + 20ns
9

tA

cf>1 and cf>'j Rise Time

20

tF

cf>1 and cf>2 Fall Time'

20

t04/2

cf>2 to cf>2 (TTL. Delay

toss

-5

+15

cf>2 to STSTB Delay

6tcy _ 30ns
9

6tcy
9

tpw

STSTB Pulse Width

tcy _ 15ns
9

tOAS

RDYIN Setup Time to
Status Strobe

SOns _ 4tcy
9

tOAH

RDYIN Hold Time
After STSTB

tOA

RDYIN or RESIN to
cf>2 Delay

Test
Conditions

Units

ns

cf>2TTl,Cl=30
R1=300n
R2=600n

STSTB,Cl=15pF
R1 = 2K
R2 = 4K

4tcy
9
Ready & Reset
Cl=10pF
R1=2K
R2=4K

4tcy _ 25ns
9

tcy
9

tCLK

ClK Period

f max

Maximum Oscillating
Frequency

27

MHz

Cin

Input Capacitance

8

pF

Vcc=+5.0V
Voo=+12V
VSIAs=2.5V
f=.1 MHz

Vee
TEST
CIRCUIT

R,

INPUT
CL

~ND
4-06

Rz
GNO

8224
WAVEFORMS

cw

~
a:
oQ.

I-----~----~

1------102----1

a:

o
u

~

1121TTLI

en
w
~

g
(/)
(/)

SYNC
(FROM 8080A)

I

<
..,

I-o---------IOSS------

w

Z

a:

o

III

~--_-IORH------

(/)

o

~

RDYINOR RESIN

c<
<
@

""\1,-----------"""'\.1, - - - - - - - - -

-------------------

- - - - - - - - - - - - - - - - - - - '\j:------+-----------------

READY OUT

~tDR

RESET OUT

VOLTAGE MEASUREMENT POINTS: ':>1.':>2 Logic "0" = 1.0V. Logic "1" = B.OV. All other signals measured at 1.5V.

EXAMPLE:

A.C. CHARACTERISTICS (For tCY == 488.28 ns)
TA = O°C to 70°C; VOO = +qV ±5%; Voo = +12V ±5%.
Symbol

Limits
Typ.

Units

Test Conditions

t.p1

<1>1

Pulse Width

89

ns

tCy=488.28ns

t4>2

<1>2

Pulse Width

236

ns

t01

Delay

0

ns

t02

Delay <1>2 to

Parameter

<1>1

to <1>2
<1>1

Min.

Max.

109

129

ns

t03

Delay

tr

Output Rise Time

20

ns

tf

Output Fall Time

20

ns

toss

<1>2

to STSTB Delay

296

326

ns

to':>2
tpw

<1>2

to

-5

+15

ns

Status Strobe Pulse Width

tORS

RDYIN SetupTimeto STSTB

tORH
tOR
fMAX

Oscillator Frequency

<1>1

<1>2

to <1>2 Leading Edges

(TTL) Delay

Loaded to
C L = 20 to 50pF

r- <1>1 & <1>2

ns

95

40

ns

-167

ns

RDYIN Hold Time after STSTB

217

ns

READY or RESET
to 4>2 Delay

192

ns

18.432

4-07

MHz

-

Ready & Reset Loaded
to 2mA/10pF
All measurements
referenced to 1.5V
unless specified
otherwise.

8228/8238

*COMMENT: Stresses above those listed under "Absolute
Maximum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at these or any other conditions above
those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum
rating conditions for extended periods may affect device
reliability.

ABSOLUTE MAXIMUM RATINGS*
Temperature Under Bias ............ _O°C to 70°C
Storage Temperature .............. -65°C to 150°C
Supply Voltage, Vce ................ -0.5V to +7V
Input Voltage ..................... -1.5V to +7V
Output Current ......................... 100mA

D.C. CHARACTERISTICS
Symbol

TA = DoC to 70°C; Vce = 5V ±5%.

Parameter

Vi;

Input Clamp Voltage, All Inputs

IF

Input Load Current,
STSTB

-.

Limits
Min. Typ.(1) Max. .75

02& 06
00,01,0.i;b
& 07

s,

OBO·OB7
All Other Inputs
YTH
I~c

POW~~,S~bply Current

VbL

Output Low Voltage,

0.8
140

00.0 7
All Other Outputs

00.0 7

3.6

All Other Outputs

2.4

los

Short Circuit Current, All Outputs

101off)

Off State Output Current,
All Control Outputs

Note1:

500

pA

Vcc':'5.25V

750

pA

VF=0.45V

250

pA

100

pA

Vcc=5.25V

20

pA

VR =5.25V

100

pA

2.0

V

190

mA

.45

V

Vee=4.75V; 10L =2mA

.45

V

10L = 10mA

Vee=5V
Vee=5.25V

Output High Voltage,

VOH

liNT

Vee=4.75V; le==-5mA

250

Input Leakage Current
STSTB

Input_1~~eshold Voltage, All Inputs

Test Conditions

pA

All Other Inputs
IR

Unit
V

-1.0

3.8

15

4-08

10H = -1i'nA
Vce=5V -

100

pA

Vee=5.25V; VO=5.25

-100

pA

5

Typical values are for T A = 250 e and nominal supply voltages.

Vee=4.75V; IOH=-10pA

V
mA

90

I NTA Current

V

mA

Vo=.45V
-(See _Figure below)

8228/8238
WAVEFORMS

°a----J

SnT~AT..~~5T~RN08DE ------=j~~.------------~

\J

V

cw

~
a::
oa.

~J( !

IOIOOATAD:::===::=:;,u?\._.

,,,~;o;;.•'.'

a::
o
o
~

+

.:

HLDA

'DC

u)

i -+

i
i:

!

w

iNTA.iOR.MEMR-------""i\

~

S~STEM BUS DURING ~EAD -

-

-

-

-

-

-

-

t- - - -

,.-r.------------I

(

.1, /'.. , - . . . . ; , : : . . . . - - - - - - - - - - - - 'HO

! . ! _ 'os :1-

DURING HLDA

g

.... 'RR

'OH ..,

~

t ~ - - - - - - - - - - - --

--- -- - - -t---I-l''Ao
I=~- ------- -----1- - - - - ~ - - - - - - - - - - - - - i, 'RE~ 1-

en
en

I.

ct
o1J
w
Z

I0IO IUS DURING READ· -

a::

oa:I

WR

o

IOWORMEMW

en

-

-

-

-

-

-

~

ct

C

ct

@

\....._ _-----1
SYSTEM BUS OUTPUTS -

-

-

-

-

-

-

-

-

-

-

-

-

-

-

<1

>- - - - - - - - - - - - - -

I

I

VOLTAGE MEASUREMENT POINTS: 00.07 (when outputs) Logic "0"
at 1.SV.
-ADVANCED IOW/MEMW FOR 8238 ONLY.

A.C. CHARACTERISTICS

TA

=

0.8V, Logic "1"

=

3.0V. All other signals measured

= O°C to 70"C; Vee = 5V ±5%.
Limits

Symbol

Parameter·

tpw

Width of Status Strobe

tss
tSH

Min.

Max.

Units

22

ns

Setup Time, Status Inputs 00.07

8

ns

Hold Time, Status Inputs 00.07

5

toc

Delay from STSTB to any Control Signal

20

tRR

Condition

ns

60

ns

CL = l00pF

Delay from DBIN to Control Outputs

30

ns

CL = 100pF

tRE

Delay from DBIN to Enable/Disable 8080 Bus

45

ns

CL = 25pF

tRO

Delay from System Bus to 8080 Bus during Read

30

ns

CL:: 25pF

45

ns

CL = 100pF

30

ns

CL = 100pF

ns

CL = 100pF

30

ns

CL - 100pF

25

ns

twR

Delay from WR to Control Outputs

tWE

Delay to Enable System Bus DBo·DB7 after STSTB

two

Delay from 8080 Bus 00.07 to System Bus
DBo·DB7 during Write

5

5

40

tE

Delay from System Bus Enable to System Bus DBo·DB7

tHO

HLDA to Read Status Outputs

tos

Setup Time, System Bus Inputs to HLDA

10

ns

tOH

Hold Time, System Bus Inputs to HLDA

20

ns

4-09

CL = 100pF

8228/8238 AND 8259/8259-5
CAPACITANCE
This parameter is periodically sampled and not 100% tested.

Limits
Parameter

Symbol

Min.

Typ.ll1

Max.

Unit

CIN

I nput Capacitance

8

12

pF

GoUT

Output Capacitance
Control Signals

7

15

pF

I/O

I/O Capacitance
(0 or DB)

8

+12V

lKH ·10%

pF

15

8228

Test Conditions: NS: VSIAS = 2.5V, Vee=5.0V, TA = 25°C, f = 1MHz.
Note 2: For 00-07: Rl = 4Kn. R2 = ""n.
eL = 2SpF. For all other outputs:
Rl = soon. R2 = 1 Kn. eL = 100pF.

23

INTA

D---------l

Figure 1. INTA Test Circuit (for RST 7)

ABSOLUTE MAXIMUM RATINGS·
Ambient Temperature Under Bias ........ 0° C to 70° C
Storage Temperature .............. -65°Cto+150°C
Voltage On Any Pin
With Respect to Ground .............. -0.5 V to +7 V
Power Dissipation . . . . . . . . . . . . . . . . . . . . . . . . . .. 1 Watt

'COMMENT:
Stresses above those listed under '"Absolute Maximum Ratings'"
may cause permanent damage to the device. This is a stress rating
only and functional operation of the device at these or any other
conditions above those indicated in the operational sections of this
specification is not implied.

D.C. CHARACTERISTICS
(TA = o°c to 70°C; Vee = 5V ±S%)
SYMBOL

PARAMETER

MIN.

MAX.

UNITS

VIL

Input Low Voltage

-.5

.8

V

VIH

Input High Voltage

2.0

Vee+. 5V

V

VOL

Output Low Voltage

.45

VOH

Output High Voltage

VOH-INT

Interrupt Output High Voltage

V

IOL = 2 mA

2.4

V

IOH = -400 /1A

2.4

V

IOH = -400 /1A

3.5

V

Input Leakage Current
.IILIIRO_7)
IlL

TEST CONDITIONS

for IRQ..7
Input Leakage Current
for Other Inputs

IOH = -50 /1A

-300

/1A

VIN = OV

10

/1A

VIN = Vee

10

/1A

VIN = Vee to OV
VOUT = 0.45V to Vee

IOFL

Output Float Leakage

±10

/1A

lee

Vee Supply Current

100

mA

CAPACITANCE
TA = 25°C; Vee = GND = ov
SYMBOL

PARAMETER

MIN.

MAX.

UNIT

CIN

Input Capacitance

10

pF

fc = 1 MHz

CliO

I/O Capacitance

20

pF

Unmeasured pins returned to Vss

TYP.

4-010

TEST CONDITIONS

8259/8259-5
A.C. CHARACTERISTICS
(TA = o°c to 70°C; VCC = +5V ±5%, GND = OV)

Bus Parameters

cw

~
a:
oQ.

Read:
8259
PARAMETER

SYMBOL

a:

MIN.

o(J

tAR

CS/Ao Stable Before RD or INTA

~

tRA

CS/Ao Stable After RD or INTA

ui
w

~R

RD Pulse Width

~

g

tRO

Data Valid From RD/INTAI1

tOF

Data Float After RD/INTA

U)
U)

8259·5
MAX.

MIN.

50

MAX.

UNIT

50

ns

5

30

ns

420

300

ns

300

J

20

200

20

MAX.

MIN.

200

ns

100

ns

MAX.

UNIT

<
oil
w
2

Write:

a:

o
m

8259

U)

o

PARAMETER

SYMBOL

:!:

<
c
<
@

MIN.

8259·5

tAW

Ao Stable Before WR

50

50

ns

tWA

Ao Stable After WR

20

30

ns

tww

WR Pulse Width

400

300

ns

tow

Data Valid to WR (T. E.)

300

250

ns

two

Data Valid After WR

40

30

ns

Other Timings:
8259
PARAMETER

SYMBOL

Note 1:

MIN.

8259·5
MAX.

MIN.

MAX.

UNIT

tlW

Width of Interrupt Request Pulse

100

100

tiNT

INT t After IR t

400

350

ns

tiC

Cascade Line Stable After INTA t

400

400

ns

8259: CL = 1OOpF, 8259-5: CL = 150pF.

Input Waveforms for A.C. Tests

2.4

---""X::: >TEST~INTS <:::x. ___

0.45 _ _ _.I

-

4-011

ns

8259/8259-5
WAVEFORMS
Read Timing

Write Timing

ADDRESS BUS

ADDRESS BUS

----~'~----------------~--------~-~-------------

----~,~----~---------+--------~.'--------------

DATA BUS

flOWA

Other Timing

,: --);J f~-----------""""\\,-________
INTA

DB

Note: Interrupt Request must remain "H IGH" (at least) until leading edge of first INT A.

Read Status/Poll Mode

, ____...J!
~----------~

~-------------------------------

~'--+j---'I

:vzzzod

DAT. .

DOW,

rzz;zmzz~

4-012

DATA

I

womz;;mu

TMS 5501
TMS 5501 ELECTRICAL AND MECHANICAL SPECI FICATIONS
ABSOLUTE MAXIMUM RATINGS OVER OPERATING FREE·AIR TEMPERATURE RANGE
(UNLESS OTHERWISE NOTED)Q

w

~
IX:
oD..
IX:

o

CJ

~

en
w

-0.3 V to 20 V
-0.3 V to 20 V
-0.3 V to 20 V
-0.3 V to 20 V
. . . . 1.1 W
O°C to 70°C
-65°C to 150°C

Supply voltage, V CC (see Note 1)
Supply voltage, VDD (see Note 1
Supply voltage, VSS (see Note 1)
All input and output voltages (see Note 1)
Continuous power dissipation
Operating free·air temperature range
Storage temperature range

~

g
CI)
CI)

ct
~

w
Z

·Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only
and functional operation of the device at these or any other conditions beyond those indicated in the "Recommended Operating
Conditions" section of this specification is not implied. Exposure to absolute·maximum·rated conditions for extended periods may affect
. device reliability.
NOTE 1: Under absolute maximum ratings voltage values are with respect to the normaliy most negative supply voltage, V BB (substrate).
Throughout the remainder of this data sheet, voltage values are with respect to VSS unless otherwise noted.

IX:

o

CD
CI)

o

RECOMMENDED OPERATING CONDITIONS

:!:
ct
Q
ct

NOM

MAX

Supply voltage, VSS

-4.75

-5

-5.25

V

@

Supply voltage, Vee

4.75

5

5.25

V

Supply voltage, VOO

11.4

12

12.6

V

MIN

Supply Voltage, VSS

V

0

High·level input voltage, VIH (all inputs except clocks)

3.3

Vee+ 1

High·level clock input voltage, VIH(2)

Delay time, clock 1 low to clock 2

tc(q,)

Clock cycle time

tr(q,)

ns

ns
300

ns

0

ns

td(q,2-cPl)

Delay time, clock 2 to clock 1

70

ns

td(q,l H-2)

Delay time, clock 1 high to clock 2 (time between leading edges)

80

ns

tsu(ad)

Address setup time

SO

ns

tsu(CE)

Chip-enable setup time

50

ns

tsu(da)

Data setup time

50

ns

tsu(sync)

Sync setup time

50

ns

tsu(XI)

External input setup time

50

ns

th(ad)

Address hold time

0

ns

th(CE)

Chip-enable hold time

10

ns

thIda)

Data hold time

10

ns

th(sync)

Sync hold time

10

ns

th(XI)

External input hold time

40

ns

tw(sens H)

Pulse width, sensor input high

SOD

ns

Ll

Pulse width, sensor input low

500

tw(sens

td(sens-intl

Delay time, sensor to interrupt (time between leading edges)

td(rst-intl

Delay time, RST instruction to interrupt (time between trailing edges)

4-D14

ns
2000

ns

500

ns

TMS 5501
SWITCHING CHARACTERISTICS OVER FULL RANGE OF RECOMMENDED
OPERATING CONDITIONS (SEE FIGURES 6 AND 7)

cw

.....

MIN

TEST CONDITIONS

PARAMETER
tpzx

Data bus output enable time

tpxz

Data bus output disable time to high-impedance state

tpD

External data output propagation delay time from q,2

MAX UNIT

CL'" 100 pF,
RL'" 1.3 kn

200

ns

180

ns

200

ns

<
a:
o11.
a:

o

3V

CJ

~

en
w
~

gen

TMS 5501
OUTPUT

en

<

-I
J

L ';'1.3kn

CL'" lOOpF

all

w
Z

a:

CL includes probe and Jig capacitance

In

LOAD CIRCUIT

o

en

o

~

<
c
<
@

...
.I--------tc(q,}-------~.I
~ ...... tf(q,}
I
I
I I
I.1
tdq,l--I 14"'I I.1 td(l/>l L-4>21

t w(q,ll

1/>1

-----.-r~1

~

t ( 1 1_.'
w 1/>2

I

I

1

!_I_'___Ip-_ _...-,~

-I

1/>2\_ _td_(_1/>1_H_-4>_2_1...

.:

CHIP

th(CEI~

I
tsu(dal
01

02-07

I.

W

INPUTS

I

1
I·

1

I

I

th(dal~1
I

I

:~

I

W< I
~

Hi-Z

I1

~

!

I

\!.,

.

~I
I
I

1

tpxz~

.
I
OUTPUT DATA yALID

'-L

/lUI
HI -Z

I

Hi-Z

_

.l

,...!-----t------~I
OUTPUT DATA VALID

(,I

'

~=~
-t

j

tpzx

th(dal~

II

I.

EXTERNAL

I

I

I

I.

AO-A3

I
_I

..

th(synclJ.....--....l

I

DO

d
t (1/>2-4>11:

. I

!

tdCPI~ ,.-

~~rg*j~

ENABLE

......- -...1

I

'

.

1 I

Hi-Z

k:

tsu(adl

OUTPUT DATA yALlD

I.

I

READ FUNCTION

A~DRESS
I.

., tsu(XII
EXTERNAL INPUT DATA

HI-Z

I

I

_I

*",I-Z
_I th(adl

~~~~,.."O
....
N....
'T...,C...,~-~-§§.,..,.

th(XII

~~~~~~D~ON~*~r~{A~*~~~~~~~~

NOTE: For 1/>1 or 1/>2 inputs, high and low timing points are 90% and 10% of V'H(I/»' Allother timing points are the 50% level.

FIGURE 6-READ CYCLE TIMING

4-015

TMS 5501

--~~

cP1

I

~~------I

.

I

I.~

tsu(CE)

CHIP
ENABLE

I_

'I

mr,

SYNC

00,01

~th(CE)

.

'.;.

I

:.

~:

. tsu(da)

I-

.

-,

thIda)

~.---M-tsu(ad)

I_

INPUTDATA:

,

'I I

!:=

INPUTDATA!

·,1·

D2-07'~g&itst~~
~

~~~-~~~

~

th(ad)~

WRITE FUNCTION ADDRESS

I

~,.~_~~~-,r-_
tPD ,.

EXTERNAL

,I

~TA

PREVIOUS EXTERNAL OUTPUT DATA

OUTPUTS

'--

~

,I

~

,

AO-A3

/j

I

~k9E:rj}~~
I
f
I
"~
I
I
I
I
I
I

I

---Ii,7

,~

"J

-J/

_ _ _ _---1 _ _ _ _...
'_..;;.,.;...

NOTE: For ct>1 and ct>2 inputs, high and 10":' timing points are 90% and 10% of VIH(ct>l. All other timing points are the 50% level.

FIGURE 7-WRITE CYCLE TIMING

k-tw(sens H)...... tw(sens L)~

SENSOR

J£
--I'!
I

~~
""l\
if"

...
' ......- - - - - - - t d ( s e n s - i n t ) - - - - - - - . - . , '

INTERRUPT

----------------------------~)(------------------~

RST INSTRUCTION
ON DATA BUS
(See Note 1)

NOTES:

!.-td(rst-int)--t

-------------------------------~~.
~

1. The RST instruction occurs during the output data valid time of the read cycle.
2. All timing points are 50% of VIH.

FIGURE 8-SENSOR/INTERRUPT TIMING

4-016

,

--------

c

Chapter 5

w

~
a:
oQ.

THE Q085

a:

o(J
~

en
w
~

g

en
en
oct
c/J

w
Z

a:

o

In

en

The 808SA is Intel's enhancement of the 8080A Z80 is described in Chapter 7.

just as the Z80 is Zilog's enhancement of the 8080A. The

Intel is the developer of the 808SA; Intel is also the principal manufacturer of the 8080A. But the individuals at
Zilog who developed the Z80 were previously employed by Intel, at which time they developed the 8080A
from the' 8008. The Z80 and the 808SA therefore have equal claim to be the legitimate desc'endent of the
8080A.
The 808SA provides the same logic as the 8080A, 8224 and 8228 tflree-chip CPU. The 808SA has the following
additional enhancements:

o

1)

The SOS5A requires a single +5V power supply,

~

2)

The SOS5A uses a single clock signal.

3)

The SOS5A has a primitive on-chip serial I/O capability which may also be used to input status and output control
signals.

4)

The SOS5A has interrupt request pins with hardware-generated interrupt vectoring,

5)

The SOS5A operates with a standard 320 nanosecond clock as against the standard 500 nanosecond clock of the
SOSOA. Blo!t recall that there are versions of the SOSOA that operate with a 250 nanosecond clock.

oct
c
oct

@

The 808SA instruction set is almost identical to the 8080A instruction set; in contrast, the Z80 has a massively
expanded instruction set. The large ZSO instruction set has been criticized for its complexity. but one could argue that
since the ZSO also provides the complete SOSOA instruction set. anyone who does not want to use the additional instructions can simply ignore them.
.
.
The 808SA multiplexes its pata Bus with the low-order Address Bus lines. Such multiplexing demands custom
support devices. or external demultiplexing logic.
Figure 5-3 and associated text provide a direct comparison of 808SA and 8080A signal interfaces.
In addition to the 808SA microprocessor, support devices described in this chapter inclucte:
- The S155/S156 static RAM with I/O ports and timer, This device provides 256 bytes of static read/write memory.
- The S355 ROM with I/O ports. This device provides 204S bytes of read-only memory plus I/O logic.
- The S755A EPROM with I/O ports, This device provides 204S bytes of erasable programmable read-only memory with
I/O logic.
'

The 808SA is a new version of an earlier device, the 8085. In most respects the two parts
are identical - however, there are some important differences, which we will note
througho~t this chapter. Where we note no difference, the discussion applies to both the
8085 and the 808SA.
.
Standar~

8080A support devices described in Chapter 4 and in Volume III cannot be used with the 808SA
unless the 808SA is operating with a 500 ns clock. If you are using the 808SA with a 320 ns clock, you must
use the special -5 series of support parts.
The SOS5A prime source is:
INTEL CORPORATION
3065 Bowers Avenue
Santa Clara. California 95051
The SOS5A second source is:
ADVANCED MICRO DEVICES
901 Thompson Place
Sunnyvale. California 940S6

5-1

The 8085A uses a single +5V power supply; it is packaged as a 40-pin DIP.
Using a 320 nanosecond clock. instruction execution times range from 1.3 microseconds to 5.75 microseconds.
All 8085A devices have TTL compatible signals.
:.'.::

Logic to HandlEj
..

Interru~:d~lg0jJ~
ExternalOevices

/?

II

I • '"
'"."

Direct Memory
Access Control
Logic

~

t

System Bus

I/O Com~u~i?a~jon
. . Serial to~ata!l~r
Interfac~,+ogi9 ii
,..

t

ROM Addressing
and
Interface Logic

...........

'Programmable
Timers

Read Only
Memory

I/O Ports
Interface Logic

RAM Addressing
and
Interface' Logic

1

t

I/O Ports

Read/Write
Memory

~

~

Figure 5-1. Logic of the 8085A Microproc'essor

THE SOS5A CPU
Functions implemented on the SOS5A CPU are illustrated in Figure 5-1; they represent typical CPU logic. The
8085A has an Arithmetic and Logic Unit. a Control Unit. Accumulators and registers.
Clock logic is on the 8085A CPU chip; only an external crystal or RC network is needed.
Bus interface logic which was excluded on the 8080A is provided by the 8085A.
N-channel silicon gate technology is used by all 8085A devices.

5-2

SOS5A PROGRAMMABLE REGISTERS
The SOS5A programmable registers are identical to the SOSOA programmable registers. They may be illustrated
as follows:

psw

Q

w

A

!ia:

B

o0..
a:
o

C
E
L

0
H

u

SP

en
w.

PC

~

!i

u

oCI)
CI)

ct
all

w
Z

a:

oen

CI)

o

~

ct
Q
ct

@

Program Status Word
Primary Accumulator

}

These two sometimes
treated as a 16-bit unit

Secondary Accumulators/Data Counter
Secondary Accumulators/Data Counter
Secondary Accumulators/Data Counter
Stack Pointer
Program Counter

For a discussion of SOS5A programmable registers refer to the SOSOA CPU description given in Chapter 4.

SOS5A ADDRESSING MODES
The SOS5A uses exactly the same memory addressing modes as the SOSOA. Direct and implied memory addressing are available. See the SOSOA addressing mod~s description given in Chapter 4 for details.

SOS5A STATUS
The SOS5A has the same set of status flags as the SOSOA; status flags are stored in the same bits of the Program Status Words. The five status flags provided are: .
Zero (Z)
Sign (S)
Parity (P)
Carry (C)
Auxiliary Carry (AC)
Status flags are assigned to bits of the Program Status Words as follows:
7 6 5 4

3 2 1 0 ~ Bit No.

I s I z I X 1:XC1 X I p I X Ic I

+",-~l. . -"l.-----

Unassigned

For a discussion of status flags refer to the SOSOA status description given in Chapter 4.

SOS5A CPU PINS AND SIGNALS
SOS5A CPU pins and signals are illustrated in Figure 5-2.
Whereas the internal architecture and the instruction sets of the 8080A and the 8085A are very similar. pins and signals are not. We will therefore begin by describing 8085A signals without reference to. or comparison with. the 8080A;
then we will compare the two interfaces.

The Address and Data Busses of the SOS5A are multiplexed. Pins A8 - A 15 are output-only lines which carry the
high-order byte of memory addresses. ADO - AD7 are bidirectional lines which output the low-order byte of memory
addresses: ADO - AD7 also serve as a bidirectional Data Bus.

5-3

Xl
X2
RESET OUT
SOD
SID

..

-..

-:ow

--.-..
--

RST 7.5
RST 6.5
RST 5.5
INTR

ADO
ADl
AD2
AD3
AD4
AD5
AD6
AD7
Vss

PIN NAME
ADO.- AD7
A8 - A15
ALE

R5
\VA

.

..-

TRAP

iNT'A

--

-.. -...
--..
-,--.. --.....
-- -----:-

...

--""

~

-

-- -.:..

1

40

2

39

3
4

38
37

VCC (+ 5V)
HOLD

--- -..

HlDA
CLOCK (OUT)

5

36

6

35

READY

7

34

10/M

8

33

9
10

32

11

8085

31
30

12

29

13

28

14

2~

15

26

16

25
24

17
.18

23

19

22

20

21

RESET IN

------

WR
ALE

SO

...

'

Sl

R5

A15

--.
--,

A14
A13
A12
All

..

Al0
A9
A8

DESCRIPTION

TYPE

Address/Data Bus

Bidirectional. tristate

Address Bus
Address Latch Enable

Output. tristate
Output·

Read Control

Output. tristate

10iM

Write Control
I/O or Memory Indicator

Output. tristate
Output. tristate

SO. Sl
READY

Bus State Indicators
Wait State Request

OutPUt
Input

SID

Serial Data Input

Input

SOD

Serial Data Output

Output

HOLD
HlDA
INTR

Hold Request
Hold Acknowledge

Input
Output

Interrupt Request

Input

TRAP

Non-maskable Interrupt Request

Input

RST 5.5}
RST 6.5

Hardware vectored

RST 7.5

interrupt requests

Input
{

Input
Input

iNTA

Interrupt Acknowledge

REsETTN

System Reset

RESET OUT

Peripherals Reset

Xl. X2
elK'

Crystal or RC Connections

Output
Input

Clock Signal

Output

VCC Vss

Power. Ground

Output
Input

·This output is tristate on the 8085. but not on the 8085A

Figure 5-2. 8085A CPU Signals and Pin Assignments

5-4

ALE is an address latch enable signal which pulses high when address data is being output on ADO - AD7. You may use the falling edge of ALE to strobe the address off
ADO - AD7 into external latches if you are demultiplexing ADO - AD7 into separate Address
and Data Busses. ALE is a tristate output on the 8085, an earlier version of the 8085A.

ALE DIFFERENCE
IN 8085 AND
8085A

Five control signals control memory and I/O accesses.
Q

w

~
a:
oa..

RD is pulsed low for a memory or I/O read operation.

8085A
CONTROL
SIGNALS

WR is pulsed low for a memory or I/O write operation.

a:

10/M is output high in conjunction with RD or WR for an I/O access.

CJ

10/M is output low in conjunction with RD or WR for a memory read or write operation.

o

~

enw

The state of the System Bus is further defined by the SO and S1 status signals as follows:

~

S1

CI)
CI)

o

g
<
oil

w

z
a:
o
ID
CI)

o

~

<
Q
<
@

o
1
1

SO
0
1
0
1

OPERATION SPECIFIED
Halt
Memory or I/O write
Memory or I/O read
Instruction fetch

8085A
DATA BUS
DEFINITION
SIGNALS

External logic that does not have sufficient time to respond to an access can gain additional time by using the READY
input signal. The READY input can be used to insert Wait state clock periods in any machine cycle. Timing and
logic associated with Wait states is described later in this chapter.
Two signals allow a primitive serial I/O capability. The high-order Accumulator bit may be output via SOD. The signal level at SID may be input to the high-order bit of the Accumulator.
SID and SOD may also be used to input status and to output control Signals.

Two signals allow external logic to take control of the System Bus.
HOLD, when input high, floats the Address Bus plus the RD, WR, 10/M and ALE control signals. HLDA is output high to acknowledge this Hold condition.
There are six signals associated with interrupt logic. Interrupts may be requested via INTR,
RST 5.5, RST 6.5, RST 7.5 and TRAP. An interrupt request made via INTR is acknowledged
via the INTA output.
INTR is the general purpose interrupt request used by external logic: it is equivalent to the aOaOA
INTR signal.

8085A BUS
CONTROL
SIGNALS
8085A
INTERRUPT
SIGNALS

TRAP is a non-maskable. highest priority interrupt request. TRAP is used for catastrophic failure interrupts.
RST 5.5. RST 6.5 and RST 7.5 are three interrupt request signals supported by hardware-implemented vectoring.

Interrupt capabilities of the 8085A are described in detail later in this chapter.
There are two signals associated with 8085A Reset logic.
RESET IN is the Reset input signal. This Signal need not be synchronized with the clock. RESET
OUT is a Reset signal output by the 8085A for use throughout the rest of the 8085A microcomputer system.

8085A

~~:~iLS

X1 and X2 connect an external crystal or RC network to drive clock logic internal to the 8085A. A crystal will be
connected as follows:

Xl

D
' - - - - - I X2

5-5

An RC network will be connected as follows:

,....--. .- ...... X1
R

.....-

..... X2

You can apply a clock signal directly to X 1:
+ 5V

CLK-------4~--~~

X1

X2

The input frequency must be twice the operating frequency. Thus. to obtain a 320 nanosecond clock. or 3.125
MHz. the input frequency must be 6.25 MHz.
Slave SOS5A devices in a multiple CPU system will usually be driven directly by a clock signal.
A TTL level clock signal (ClK) is output by the SOS5A. It may be used to drive slave CPUs. or for any other synchronization purpose within the microcomputer system. The frequency of ClK is the operating frequency of the SOS5A; that is.
the ClK frequency is half the input frequency.

GND------------------~~~
+sv __________________
'-sv _________________

~-------------------------1~AO
~~---------------------_1~Al

~~~

---,-....~

, + 12V

~ SYSTEM DMA
REO.

~~------------------------4~A2
~~-------------------------4~A3
~~---------------------------.~A4

-------------------IIoi..i-l

~~-------------------------_1~A5

-------------------;.;...,-1

~---------------------------~~A6
~---------------------------4~·A7
~-----------------------------1~A8

~----------------------------1~A9

SYSTEM INT. ------------------....:~~
REO.
'INT. ENABLE

~~--------------------------_~ A 10
~---------------------------1~

All

HiI~-------------------------~~ AU

_---------------:.:;..-1

m~------------------------1~

A13

~------------------------1~AI4

~1:-------------------------_~ AIS

'TANK

_DBO

'esc

_OBI
-OB2

21TTl)

RDYIN

mm

-0B3
-0B4

'+12V
'+5V

-oae

-OBS

'GND

-087
'+ sv

_____.,.2.::-8_4-4

'GNO - - - " " ' : - - ' i
-Signals no longer needed or not present.
'BUSEN - - - - - -....~L
New 8085A signals: RST 5.5. RST 6.5. RST 7.5. TRAP. RESET OUT. SID. SOD
Shaded signals represent 8085A equivalents of 8080A.

24
SYSTEM
COHTAOl

____P ....------

Figure 5-3. A Comparison of SOS5A and SOSOA/S224/S22S Signal Interface

5-6

A COMPARISON OF SOS6A AND SOSOA SIGNALS

c

w

~
a:
oa.

No attempt has been made to maintain any kind of pin compatibility between the SOSSA and the SOSOA.
Nevertheless, as illustrated in Figure S-3, it is relatively simple to derive equivalent system busses when using
the SOSSA or SOSOA. But look at Figure 5-3 with an element of caution. Many logical combinations of 8085A signals
are shown reproducing 8080A signals: in reality you will never generate such logical combinations - a point which
will become clear as the chapter proceeds. The purpose of Figure S-3 is to illustrate the equivalence of the system
busses generated by the SOSSA and the SOSOA without indicating that creation of equivalent busses is desirable.

a:
o

The 8080A signals which are shown as having direct 8085A equivalents are either obvious. or will become so after you
.
have read this chapter.

ui
w

What is more interesting is to. look at the 8080A Signals which no longer exist and the new 8085A signals which have
.
been added.

o

~

~

g
en
en
~

CI1J

w
Z

a:

o

III

en

o

~

~

c

~

@

Let us first look at the signals which have been dropped.

There are the surplus power supplies -5V and +12V. plus the secondary power supplies required by the 8224 Clock
Generator and the 8228 System Controller. Elimination of these signals is self-evident.
INTE is an 8080A signal that indicates to external logic when interrupts have or have not been enabled internally by the
8080A. This signal is not very useful. since external logic cannot use the information it provides. Apart from illuminating an appropriate indicator on a minicomputer-like control panel. the INTE signal of the 8080A serves little useful purpose.
WAIT is a signal which is output high by the 8080A while Wait states are being inserted within a machine cycle. There
is little that external logic can do with this signal. therefore its elimination in the 8085A carries no penalty.
BUS EN is a control input to the 8228 System Controller: it causes the 8228 to float its output signals. This signal is no
longer required in the 8085A since the Hold state floats all equivalent 8085A output signals - with the exception of
INT A. which does not need to be floated.
.
The 8224 Clock Generator outputs two synchronizing clock signals reproduced by ClK: OSC has no equivalent 8085A signal.

OSC and <1>2 (TTL). <1>2 (TTL) is approximately

The TANK input to the 8224 Clock Generator allows overtones of the external crystal to be used. No such signal exists
with the 8085A - which simply means that you have to use the primary frequency of any crystal connected across the
X 1 and X2 inputs.
Seven new signals have been added to the· SOSSA; it would have been possible to provide separate Data and
Address Busses by eliminating these seven signals, plus the ALE control signal whose presence is a direct consequence of having multiplexed Data and Address Busses. Intel has chosen to provide the seven new signals. paying the
price of having multiplexed Data and Address Busses.
Let us examine the new signals.

RST 5.5. RST 6.5. RST 7.5 and TRAP represent additional interrupt request inputs. TRAP is a non-maskable. high
. priority interrupt: the other three interrupt requests are supported by hardware-implemented vectoring.
RESET OUT is a Reset signal output by the 8085A: it may be used to reset support devices around the 8085A.
SID and SOD are control signals which provide a primitive serial input and output capability. These signals can also be
used as a general purpose status input (SID) and a control output (SOD).

SOS5A TIMING AND.INSTRUCTION EXECUTION
An SOSSA instruction's execution is timed by a sequence of machine cycles, each of which is divided into clock
periods.

An instruction is executed in from one to five machine cycles labeled MC 1. MC2. MC3.
MC4 and MC5.

5-7

SOSSA
MACHINE CYCLES

The first machine cycle of any instruction's execution will have either four or six clock periods.
Subsequent machine cycles will have three clock periods only. This may be iliustrated as follows:

MCl

SOS5A
CLOCK
PERIODS

i··/i\

TlIT2IT3IT41:t~IT~;

Tl

T2

T3

Tl T2 T3

Tl

T21 T 3

Tl T2

T3

Where MC is shaded, the entire machine cycle is optional. Where T iss haded, the clock period is
optional within its machine cycle.
8085A machine cycles and clock periods are very similar to those ofthe 8080A. You will find in Table 5-1 that the
number of clock periods required to execute 8085A instructions is equal to the number of clock periods required by the
8080A to execute the same instructions, or differs by one clock period only.

THE CLOCK SIGNALS
The SOS5A times its machine cycles using this simple clock signal:
MC3 .

MC2

MCl

ClK

Although the SOS5A has no SYNC signal to identify the start of a new machine cycle, you can use the SOS5A
ALE signal for the same purpose, This signal is output true during the first clock period of every machine cycle - at
which time the ADO - AD7 lines are outputting address data. In addition, you can identify the first (instruction fetch) cycle of any instruction's execution. SO and S1 will both be output high during an instruction fetch machine cycle. Clock
periods and machine cycles may therefore be identified as follows:
MCl
Tl

CLK

T2

MC2
T3

I

I

IO/M.\
I
SO

51

AS - A15
Low-order
ADO -AD7

ALE

T1 identified

MC 1 identified
by SO = 1

and 51 = 1

5-8 .

MEMORY ACCESS SEQUENCES
SO far as external logic is concerned, there is very little difference between an instruction fetch, a memory
read, and a memory write. We will therefore examine timing for these operations together.

C

LU

Mel

~
oQ.

Me2

a:

Tl

a:

o

CJ

~

en

elK

LU

~

g
U)
U)

«

101M

so

I
I

ell
LU

Z

a:

oen

51

U)

o

~

ct·

c

«
@

ADO- AD7

..

P~ high-order byt~
I

---~

Input

I

i~struction

Unspecified

I

II

I
~

::;L-=;.=~t:;r-....,
object code

~

______ I
~I

______JI

..~

~.------

ALE

,I

latch low- I
order

I

address
byte

~~--""""~'r~--""""~/~
Instruction Fetch

' Instruction
Decode

Figure 5-4. A Four Clock Period Instruction Fetch Machine Cycle'

Let us first consider an instruction fetch. Timing is illustrated in Figure 5-4 for a four clock period machine cycle,
and in Figure' 5-5 for a six clock period machine cycle.
'
The most important aspect of the instruction fetch machine cycle is the fact that it will have either four or six clock
periods. as against three for all subsequent machine cycles. The instruction fetch machine cycle must have at least four
clock periods. since the fourth clock period is needed to decode the instruction object code which has been fetched .. If
the instruction requires no subsequent memory accesses. then a fifth and sixth clock period may be needed to perform
the internal operation specified by the fetched instruction. If additional memory accesses will be required. then the
"
fourth clock pe'riod of the first machine cycle is sufficient.'
At the end of the first clock period. ADO - AD7 is floated transiently: then it is turned around to act as a Data Input Bus.
RD is pulsed low to strobe data onto the Data Bus.
The memory read must occur within three clock periods. Since this is an instruction fetch machine cycle. the CPU will
place the input in .the Instruction register. If external logic requires more time to respond to the memory access. then it
can generate additional Wait clock periods. We will describe the 8085A Wait state shortly.
During the fourth clock period of the instruction fetch machine cycle the instruction object code is interpreted by logic
of the 8085A CPU. Fifth and sixth clock periods will be required by some instructions to execute required internal
operations.

5-9

MCl
Tl

T2

T3

I

Mel

T4

T5

T2

Tl

Te

T3

T4

ClK I

I

I

I·
loiM ~
I~--~----~--~----~----~--------~----~--------~

so

~

I
SlV~~----+---~--~--~--~~--+---~--~--~
I
AS - A15

I Unspecified

ADO-AD7

PC high-order byte

I

I

I

~~.j~~~~__~~---;I;-~-;I----~!;!:~ (·--I-~~I---'J:
order byte

I

I

RD,
I

I
Latch loworder
address
byte

'-~----~'r~""~~ '-~--"~'r~""~~
Instruction Fetch

Instruction decode
and execute

Figure 5-5. A Six Clock Period Instruction Fetch Machine Cycle

During the fourth and subsequent clock periods, ADO - AD7 is floated and A8 - A 15 contains unspecified data.
The fact that ADO - AD7 and A8 - A 15 are unknown data during the fourth and subsequent
clock periods of an instruction fetch machine cycle must be taken into account when you
create memory select and I/O device select l o g i c . ·
In Figures 5-4 and 5-5 SO and S1 are both high. identifying this as an instruction fetch machine
cycle. 101M is low since the instruction object code is to be fetched from memory. An instruction
fetch is thus equivalent toa memory read.

8085A
DEVICE
SELECT
LOGIC

The address of the memory location to be accessed is fetched from the Program Counter (PC) and is output on
ADO - AD7 {low-order byte) and AS - A 15 (high-order byte). The low-order byte of this memory address is stable on
ADO~ AD7 during the first clock period. ALE is pulsed high at this time. The trailing edge of ALE is designed to act
as a strobe signal which external logic can use to latch the low-order address byte off ADO - AD7. If you are using
one of the 808SA support devices (the 8155, the 8156 the 8344 or the or the 8755A), then the low-order byte

5-10

of the memory address is latched off the ADO - AD7 lines for you. If you are using standard memory devices,
then you must demultiplex ADO - AD7. Any simple latched buffer can be used for this purpose; here is an example of the 8212 I/O port being used as a demultiplexer:

c
w
!;(

A8 - A 15

a:
0

Q.

a:
0

u

ALE

~

u)

...w

oCt

OS2

U

0

Address
Bus

OSl

8085A

CI)
CI)

8212

oCt
o!I

w

Z

010

a:
0

Ol
CI)

.•

••
017

000

MO

CLR

'

AO-A7

007

0
~

oCt

c

oCt

@

ST8
~----~--------------~~-----VCC

Data Bus

You might argue that there is no harm done if memory or 1/0 devices select themselves
when the System Bus is supposed to be idle; if neither the read nor write strobe is present,
data transfer between the System Bus and the selected device ~annot ?ccur.
Unfortunately, the problem is not so simple.

MULTIPLE
DEVICE
SELECTS
AND BUS
LOADING

It is possible for more than one memory or I/O device to consider itself sf3lecteq while the bus is
idle; this may occur under the following conditions:
'
1)
2)

If I/O devices are being selected as I/O ports. then the Address Bus lines may select an I/O port while
'
simultaneously selecting a memory device.
In microcomputer systems that use only a small portion of the total allowed memory - and most microcomputer
systems fall into this category - memory select logic need not decode unique memory addresses. Here is an example of two 4096-byte memory modules. each of which uses a single line of the Address Bus in order to create
device selects:
A15
A14
All
AO

"

Y>

~-

-.. t

.,

-

-.....

.

..-.

..

:

.

5-11

CSl

Address to Memory
fModule 1
Address to Memory
} Module 2

Memory module 1 will be assigned the address space 800016 through 8FFF16. Memory module 2 will be assigned the
address space 400016 through 4FFF16. In reality a variety of other addresses will select memory modules 1 or 2. Addresses C00016 through CFFF16 will select memory modules 1 and 2.
A correctly written program will keep either A 15 or A 14 low; but while the System Bus is floating. both address lines
could be high - in which case both memory modules will become selected.
While signal levels on the Address Bus are changing state. memory and I/O devices may be transiently selected. Transient selection may occur during T1 as well as during T4. T5 and T6. Transient selection may leave more than one
memory or I/O device simultaneously selected for shoq periods of time.
If more than one memory or 1/0 device is simultaneously selected, excessive loads may be placed on the
System Bus: At best. these excessive loads will cause devices connected to the' System Bus to temporarily malfunction: 'at worst. device failures may result.
It is very important to prevent devices from being spuriously selected.
If you use RPIVI devices with multiple chip select inputs, you can prevent transient memory
selection'~y 'connecting the SOS5A RD output to one of the select (or enable) inputs. This
will ensure that the device responds only when a valid address is on the System Bus: therefore
only one ROM device will be 'selected at a time. Refer to Volume III for information on memory
devices.
.
The simplest w~y of preventing memory and 1/0 device selection is to use 101M, RD and
WR as cqntributors to' device select logic:

ADO

PREVENTING
TRANSIENT
SELECTION

PREVENTING
SIMULTANEOUS
SELECTION'
OF 1/0 AND
MEMORY

A15

Memory
Address

Decode
L~ic

AD -----c;;a
"WR-----c:.

s

~______

Memory
Select

10iM-----------'
A~5

AS

I/O Device
Select

Decode
Logic

AD -----4~
'WR-----4"

I/O device
select

10/M - - - - 4 : 1

5-12

Timing for the memory select illustrated above may be illustrated as

I
I

Q

w

~
a:
oc..

elK
101M

en
w

RDorWR

~

T2

,

Memory
Select

~

I

I

I

I

I

I

I
I

I
I

I

I

I
I
I

I

~

I
I

I

\

I

\

I

a:

1/0 device select logic timing differs only in the level of 101M.

t/)

!O/M distinguishes between memory and 110 devices. When AD or WA is low. memory or 1/0

:E

device addresses must be valid. Thus the logic illustrated above will guarantee that spurious
memory and 1/0 device selects never occur.

oID
o

~
Q
~

@

L

'1

CI/:I

w
Z

i\
I
I

I-

t/)
t/)

~

I

a:
o
u

g

T1

foll~ws:

But there is a problem associated with the solution illustrated; memory and i/O devices do not receive a valid select signal until early in the second clock period. This is unfortunate. since valid addresses are available early in the first clock
period. Delaying memory select logic until the second clock period may require Wait states to be added between clock
periods 2 and 3 - and that unnecessarily slows down CPU operations. If e>secution speed is not a problem to you. then
the simple select logic illustrated above will do. If execution speed is a problem, then you must replace:

D

WR.
Ri5 ____________

.

~------------

in the simple select logic with alternative logic that may be defined as follows:

ALE

RoorWR

s

5-13

S

The required S output may be generated using two flip-flops as follows:

~-------------s
a

0 ....- -...

VCC----t J

ALE ---<1I>CK

74107

RESET---...lI("'...........

AD
WR

----til.""'"

>----------~

If your system contains an 8085. rather than an 8085A. the first S output after a Reset will
occur before the address.lines are valid. Since ALE is tristate in the 8085. a falling edge occurs
when Reset goes off: at this time the address lines may still be floating. One solution is to connect the first J input above to the Q output of the following D·flip-flop:

a

VCC----f 0

ALE·-----I::~K

t---tl~

7474

CLR·

RESET

The flip-flop above prevents S from going high until after the first rising edge of ALE.

5-14

SELECT
PROBLEM
WITH 8085

MCl

Q

w

~
a:
oIl.
a:

o

I
elK I
I

:

~

\'-_ _ _....;._ _..:..-_~~

I~----------------~----------------~------I------

~

w

~

g
en

so

I

Sl

en
ct

a!I
w
Z

I

~/~ ~

CJ

iii

Mel

Me2

I

,r----~------~----~----~----~I~·----~------~----~
I

AS - A15

PC high-order'byte

a:

o

III

en

o

ADO- AD7

~

ct
Q
ct

ALE

@

RDI
I

Latch low·
order
address
byte

I

I

Latch low.
order
memory
address

'-'. . . .EB. .~. . . .~~
~. . . .aa...._~~
b~~.e__. . . .,~~.rrmz~ag..~~
Instruction Fetch'

Memory Read

Figure 5-6. A Memory Read Machine Cycle Following an Instruction Fetch

Let us now consider a memory read operation; timing is illustrated i,n Figure 5-6. So far as ex8085
ternal logic is concerned. the only difference between a memory read and an instruction fetch is
MEMORY
the SO and S1 signal levels; they are both high for an instruction fetch. but SO is low during a
READ TIMING
memory read. Also. the instruction fetch has four or six clock periods. while the memory read has·
three; but the extra instruction fetch clock periods occur after the memory access is completed. Therefore. so far as external logic is concerned. the extra clock periods of the instruction fetch machine cycle are irrelevant.

5-15

MCl

ClK

I

Mel

MC2

Tl

I I I

I

I
I

10iM

~

I
50

~

\

I
I

I
51

I

~
I

I
Unspecified
I/O evice select code

AS - A15

ADO - AD7

ALE

AD
order

Read I/O
port address

address
byte

from either
half of

......_ _- - - . . . . . ~...- -_ _ _~~
Ad!reSS
........
V".
Instruction' Fetch

Figure 5-7. An I/O

~ead

Machine

Figure 5-7 illustrates I/O read timing. Only the
Figure 5-6.

Bus

/

v~---..",

.' lIO Read

Cy~le Followi~g

101M signal

an Instruction Fetch

level in Figure 5-7 differs from

Memory write timing, illustrated in Figure 5-8, is very similar to memory read timing. The
principal difference is that during a memory write WR is output low. whereas during a memory
read RD'is output low. Also. during a memory write operation S 1 is output low while SO is out-·
put high.
.
.
An I/O write operation is illustrated in Figure 5-9. As compared to Figure 5:8. 10/Mis high in
Figure 5-9 during the write machine cycle: there are no other timing differences.

5-16

8085 I/O
READ TIMING
8085
MEMORY
WRITE TIMING
8085.1/0
WRITE TIMING

MCl

MCl

MC2

Tl

Tl

Q

w

I-

~,

0

a.

II:

0

ClK

IO/M~

U

I

~

en
w

SO

l-

en
en
w
Z

I
I

\

Sl :/

1r--........

~--------------~I

I

e(
~

~
I

e(

g

I

I

AS - A15

Address high-order byte

II:

0

ID

en
0

ADO - AD7

~

e(
Q
e(

@

latch loworder

Latch loworder

address

memory

byte

..........

~~

address
byte

....~~,.......~~

-~~ ~~--

Instruction Fetch

Memory Write

Figure 5-8. A Memory Write Machine Cycle Following an Instruction Fetch

5-17

T2

T2

elK

Mel

Me2

Mel

I

I
10/M

~
I

so

~

I
Sl

~

I

\

I

Unspecified

PC high-order byte

AS - A 15

I/O device select code

ADO - AD7

ALE

Latch loworder

port address

address
byte

from either
half of Address Bus

~~--""""~~~--""""~~~~""--''r~--''''~~
Instruction Fetch

I/O Write

Figure 5-9. An I/O Write Machine Cycle Following an Instruction Fetch

BUS IDLE MACHINE CYCLES
During a Bus Idle machine cycle no control signals change state on the System Bus.
There are three types of Bus Idle machine cycles:

8085A
BUS IDLE
MACHINE
CYCLE

1)

An instruction fetch Bus Idle machine cycle. The 8085A CPU acknowledges an interrupt from
TRAP. RST 5.5. RST 6.5. and RST 7.5 by generating a Restart instruction internally. No external instruction fetch operations occur; however. logic internal to the CPU requires time to
create the instruction object code. Therefore a Bus Idle instruction fetch machine cycle is executed. Timing is illustrated in Figure 5-17.

2)

The instruction execute Bus Idle machine cycle. Only the DAD instruction uses this machine cycle. The DAD instruction adds the contents of two CPU registers to two other CPU registers. It takes six clock periods for logic internal to the 8085 CPU to complete these operations. The six clock periods are generated via two instruction execute Bus Idle- machine cycles. Timing is illustrated in Figure 5-10.

Figure 5-10 shows a difference in operations between The 8085A and the earlier version. the
ALE GENERATION
8085. During an instruction execute Bus Idle machine cylce, the 8085A does not generIN 8085 AND
8085A
ate a high pulse on ALE. The 8085, however, pulses ALE high during every T1 of every
machine cycle - including instruction execute Bus Idle machine cycles.
- - - - - - - -....
3)

The Halt Bus Idle machine cycle. Following execution of a Halt instruction an indeterminate number of Bus Idle
machine cycles are executed for the duration of the Halt condition. Timing is illustrated in Figure 5-14.

5-18

The condition of the 101M, S1 and S2 signals during a Bus Idle machine cycle varies with the type of Bus Idle
machine cycle. These three signals will conform to instruction fetch level during an instruction fetch Bus Idle machine
cycle. During an instruction execute Bus Idle machine cycle. Memory Read signal levels are maintained. but the RD
control signal is not pulse low.
During a Halt Bus Idle machine cycle. 50 and 51 are both low but

101M.

along with other tristate signals. is floated.

cw

~
0::
o

Q.

0::

MCl

o

MC3

MC2

o

~

Tl

ui
w

~

g

I

fI)
fI)

~

o1J
w
Z

101M

~
I~--~~----------~----~------------~-----------

,

0::

o

m
fI)

o

~
~

SO :/
I
51

c

I

~~--~~--~----~----~--~----~----~--~
I

~

@

I

CLK I

AS-A15

Unspecified

1 1~______pc_l_h_i9_h_-O_rd_e_r_~_yt_e______~I..__..I~____PC~h-i9-h-.o-rd-e-r~~~t-e----~I------~
PC low- I

.Input DAD instruction

I

I

PC low-

i

I

I

I

ADO - AD7

ALE

I

·1

Latch loworder
address
byte

*SOS5A does not generate ALE; only SOS5 generates ALE during MC2 and MC3 of DAD.

~~..........~~~........--~~~~"""~'r~"""~~
Instruction Fetch

Bus Idle

Figure 5-10. A Bus Idle Machine Cycle Following an Instruction Fetch During
Execution of a DAD Instruction

5-19

Mel

Mel

Me2

I

I

101M

~
::
I~--~--------~-----I--------~----~--~----~I----~

so~I
S1

:'

)

~~--------------~----~

I

,r----+-----~----~----~I----.~'~----~----~----.-----+-----~
II
I

I Unspecified

I

AS -A15

Address high-ord':!r byte

'11

I

r---+---In-p-u~t:-da-t-a--~:~--~~

i

'}----I,

.

ALE

I

I
order
address
byte

order
address

.... .......... ........
byte

'-~--------~~~--

Instruction Fetch

--,~ '-~

~~~

~~

Memory Read with Wait States

Figure 5-11. Wait States Occurring in a Memory Read Machine Cycle

THE WAIT STATE
The 8085A will insert Wait states between clock periods T2 and T3 in a manner that is closely analogous to the
8080A. Timing is illustrated in Figure 5-11. which shows Wait states being inserted in a memory read cycle; a
Wait state inserted in any other memory reference or I/O machine cycle would differ only in the levels of control
signals.
The 8085A samples the READY line during T2. If READY is low during T2. then a Wait clock period will follow T2. The
READY line is sampled in the middle of each Wait clock period; Wait clock periods continue to be inserted until READY
is sampled high. As soon as READY is sampled high. the next clock period will be a T3 clock period - and normal program execution continues. This sampling may be illustrated as follows:

elK

READY

5-20

Wait states are used in an 8085A system exactly as described for the 8080A in Chapter 4 - to give slow memories and
I/O devices more time in order to respond to an access. Thus the discussion of Wait states provided in Chapter 4 applies equally to the 8085A.
In Chapter 4 a pair of 7474 flip-flops are shown creating a low READY pulse that generates a single Wait state in a
memory read machine cycle. For the 8085A the following variation applies:

cw

~
a:
oQ.
a:

o
u

~

SI - - - - I

IO/M---a
ALE - - - - c : I I

I--~ 01

>----II~~lK

Q1

7474'

1----------.. . 02
ClK (8085A)

>--..... ~ClK7474

en
w
~

U
o
en
en
~

oil

w
Z

a:

o

III

·CLK is rising edge triggered

o

·ClEAR is low level active

en

READY

::E

~

c

~

The circuit will operate with the following timing:

@

TW

If the cycle is a memory read (S = 1. SO = 0) or an instruction fetch (S 1 = 1. SO = 1). 01 will go high at the falling edge
of ALE. This will cause flip-flop 2 to go on at the next falling edge of the 8085A.clock. thereby forcing READY low. The
Iowan READY will clear flip-flop 1. so that READY will return high on the next falling edge of the 8085A clock.

THE SID AND SOD SIGNALS
The 8085A has two instructions which handle single-bit data.
The RIM instruction inputs data from the SID pin to the high-order bit of the Accumulator. The SIM instruction
. outputs the high-order bit of the Accumulator to the SOD pin.
You may use the RIM and SIM instructions in order to implement a primitive serial 1/0 capability. A more useful application of these instructions is to read single signal status and to output single-signal controls.

5-21

When the RIM instruction is executed. the SID signal level is sampled on the rising edge of the clock signal during clock
period T3 of the instruction fetch machine cycle. The high-order bit of the Accumulator is modified while the clock signal is high during T1 of the next instruction fetch machine cycle. Timing may be illustrated as follows:
'MCl

Mel

ClK

SID

A. Bit 7

When an SIM instruction is executed. the actual change in SOD signal level does not occur until T2 of the next instruction fetch machine cycle; that is to say execution of the SIM instruction overlaps with the next instruction fetch.
This may be illustrated as follows:
Mel

Mel

Following an SIM instruction fetch. the high-order bit of the Accumulator is sampled while the clock is low during T2 of
the next instruction fetch machine cycle. During the same clock period. the SOD signal level is modified to reflect the
contents of the high-order Accumulator bit. This overlap is feasible since neither the SOD signal nor the Accumulator
contents are modified while an instruction is being fetched. Note that SOD must be enabled before it can be accessed
or changed; you use bit 6 of the Accumulator to enable SOD. as detailed later in this chapter when we describe the
8085A instruction set.

5-22

Figure 5-12 illustrates SID and SOD signal timing during execution of a RIM instruction followed by a SIM instruction.

MCl

cw

MCl

MC1'

~
a::
oa.
a::

o

CJ

ClK

enw

SOD

~

~

g

en
en

SID

ct
oil

w
2
a::

A REG (BIT 7)

o

III

en

AS - A15

:!!
ct
c

ADO- AD7

o

ct

PC high-order byte

PC high-order byte

PC high-order byte

@
ALE

latch PC lowarder byte

latch PC loworder byte

latch PC loworder byte

Figure 5-12. A RIM Instruction Followed by a SIM Instruction

5-23

~~-----HOlD------~~

MCl

MCl

ClK
HOLD

HlDA

I

I
101M

I

1\
I '

I
~··-I··-·i·-··--'
I

I~----------------~I

I

~~

l

I

I

51

~
I

A8 - A 15

J
~

PC

~igh.order brte

PC low-1

ADO - AD 15 lorder

bYte~.~

I

ALE

~----------~

I

h

I

I

I
I

object code

~

~

. . . . ., . . . . . . . . . . . . . . . . . . . .

I

~

~

I

I

I

8085

~

I

............... ....... a .......

I

.............

I

llr.
'---i

~·----""""hll....
I

~

~

h

I

I

I

I

I

I

I

I

I

I
•

I

,. .... .............. ............. .........."

\

. ._ _ _ _ _ _ _ _. .

I

~

I

I

~D I

} ••I I. . . . . . . . .

Input instructIOn I

rl. .~~~~~. .~. . . . . . .~...........J

I
I

I

~

....- -.....---....---"""':\......"...-~............~..............jp---.....--~
I

I

Figure 5-13. A Hold State Following a Sill9le Machine Cycle Instruction Execution

THE HOLD STATE
The 8080A and the 8085A both USf3 the Hold state as a means of transiently floating the System Bus. During a
Hold, external logic gains bus control, usually to perform direct memory access operations.
External logic requests a' Hold state by inputting HOLD high. The microprocessor responds by entering the Hold state
an~ outputting HLDA high. During ~'Hold §tate the microprocessor floats all tristate signals.
In the 8085, an earlier version of the SOS5A. ALE is a tristate signal and is floated during the
Hold sta~e. In the 8085A, how~ver, ALE is kept low during H o l d . '
Both the SOSOA and the SOS5A initiate the Hold state at the conclusion of an instruction's execution. But there are si'gnificant differences b~tween Hold. state initiation logic for the SOS5A as
againstihe ~OSOA.
..
.

HOLD STATE
IN 8085 AND

~085A

The sosbA initiates a Hold state following T3 for a Read machine cycle, or following T4 for a Write machine cycle. Timi'l9is illustrated in Figure~ 4-9 and 4-10.

5-24

The SOS5A in contrast. has a fixed, two machine cycle sequence for Hold state initiation; it may be illustrated as
follows:
.

Tn - 1

Tn +

Tn

Tn

+ 2

Tn + 3

Q

w

~
a:
oa.

a:

o

(J

~

enw

~
(3
o
CI)
CI)

 500 J.l.SEC

I
I

__________~_::1

1

~

L

.......----------------------

,I
I
,~
I

~

I
RESET OUT

1

~

1

I

ALE .1

l-

,
A8 - A15

,

lI
ADO - AD7

I

_.J_

I

ADDRESS RESET
TO All ZEROES
1

...............

,

I

I
1 8085 I

82; n. .:.__. ,._-_-_..l_-_-_-_._-_~..,
I

I
I,...

I

" , __""-_-J

-1

ADDRESS RESET
TO All ZEROES

..•.............•.........

.1." 1......... .

LI
*8085 floats ALE during Reset; 8085A does not do this.

Figure 5-1S. Power On and RESET IN Timing for the 8085A
5-31

I

~

___

THE RESET OPERATION
You reset an SOS5A by inputting a low signal via RESET IN.
When power is first turned on, the RESET IN pulse must last at least 500 nanoseconds (3 full clock cycles); no
further requirements are imposed on the RESET IN signal. Logic internal to the SOS5A will synchronize the
RESET IN pulse with the internal clock. Timing for a Reset following a powerup is given in Figure 5-1S.
Notice that a RESET OUT signal is provided. You can use this signal to reset other devices in the SOS5A
microcomputer system .
. When the SOS5A is reset the following events occur:
1)
2)
3)
4)
5)

The Program Counter is cleared; thus the first instruction executed following a reset must have its object code
stored in memory location O.
The Instruction register is cleared.
Interrupts are disabled.
The RST 7.5. RST 6.5 and RST 5.5 interrupts are masked out and thus disabled.
All tristate bus lines are floated. In the earlier 8085. ALE is tristate and thus floats during Reset. In the 8085A. ALE
is not tristate.
Table 5-1. A Summary of 8085A Instruction Object Codes and Execution Cycles
CLOCK PERIODS
INSTRUCTION

OBJECT CODE

8080A
ACI

DATA

AOC

REG

ADC

M

ADD

REG

ADD

M

ADI

DATA

ANA
ANA

REG
M

ANI

DATA

CALL

LABEL

CC

LABEL

CM

LABEL

yy

CE

8085A

BYTES
8085A

MACHINE CYCLES

2

7

7

13

l000lXXX

1

4

4

1

8E

1

7

7

l0000XXX

1

4

4

1.3
1

86

yy

C6

10100XXX
A6
E6

yy

ppqq
DC ppqq
FC ppqq
CD

1

7

7

13

2

7

7

13

1
1

4

4

7

1
13

2

7

7
7

I(l/;l,~ii

. . .• .• . • . . (• .

3
3

13

~.f, ~ ~

13i~~~~

h>,,:;;

..,'.•....••..• ,.;;.~.. c.:... . ....

....

CMA

2F

3
1

4

4

1

CMC
CMP

1
1

4

REG

3F
10111XXX

4
4

1
1

BE

1

7

7

13

ppqq
C4 ppqq
F4 ppqq
EC ppqq

3

CMP

M

CNC

LABEL

CNZ

LABEL

CP

LABEL

CPE

LABEL

CPI

DATA

CPO

LABEL

CZ

04

FE

YY

3
3
3
'2

4

'''.~!
j5

.f

I.··· I
I}

•••••••

. . /i;

7

7

13

3SS(

....

3

LABEL

ppqq
CC ppqq
27

1

4

4

1

DAD

RP

00XX100l

1

REG

OOXXX10l

1

10
4

177

OCR

10
5

OCR

M

35

1

10

10

135

DCX
01

RP

OOXX10ll

1
1

5
4

6
4

2

F3

EI

FB

1

4

4

1

HLT

76

1

4

4

1

2

10

10

134

10

10

135

E4

DAA

IN

PORT

INR

REG

DB

YY

OOXXX100

...

3

1

1

1

INR

M

34

1

INX

RP

OOXXOOll

1

JC

LABEL

DA

10

LABEL

FA

3

10

JMP

LABEL

3

10

10

JNC

LABEL

3

13.133

3

10
10

7/10

JNZ
JP

7/10

13. 1 33

LABEL

ppqq
ppqq
C3 ppqq
02 ppqq
C2 ppqq
F2 ppqq

3

JM

3

10

7/10

13. 1 33

LABEL

5-32

1
7/10

133

13. 133
133

Table 5-1. A Summary of 8085A Instruction Object Codes and Execution Cycles
(Continued)
, CLOCK PERIODS
INSTRUCTION

OBJECT CODE

7/10.

13'.133

10

7/10

13. 133

10

7/10

13

13

i

7

13

16
10

16
10

13333

LABEL

c(

a:

JZ

LABEL

0

LOA

ADDR

ppqq
ppqq
CA ppqq
3A ppqq

a:

LDAX

RP

OOOX10l0

(J

LHLD
LXI

ADDR
RP.DATAI6

2A ppqq
OOXXOOOI

0

SOSSA
MACHINE CYCLES

10

LABEl

JPO

!:

SOSSA

E2

JPE

t-

D.

8080A

EA

C

w

BYTES

13.133
333

133

YYYY

u)
w

MOV

REG.REG

c(

MOV

M.REG

MOV

REG.M

01dddl10

en
en

MVI

REG.DATA

OOdddl10

MVI

M.DATA

t-

g

01dddsss
01110sss

YY

c(

oll

36

ORA

REG

0

ORA

M

en

ORI
OUT,

DATA

F6

0

PORT

03

~

PCHL

C

POP
PUSH

a:
a:J

c(
c(

@

yy
00

NOP

w
Z

10110XXX
B6

yy
yy
E9 '

RP
RP

llXXOOOl
l1XX0101

17

RAL

IF

F8
RNC

DO

RNZ

CO

RP

FO

RPE

ES

RPO

EO

RCC
Rsr

N'

OF
l1XXXll1

SBB

REG

l0011XXX

SBB

M

STA

ADDR

32

ppqq

13

13

1335

STAX

RP

OOOX0010

7

7

15

C8

RZ

9E

SUB

REG

SUB

M

SUI
XCHG

DATA

XRA

REG

XRA

M

XRI

ppqq
YYYY
X
ddd

sss

4

l0010XXX
96

13

.1

06 yy

7

EB

4

4

10101XXX

4

4

DATA

XTHL

YY

4

37

STC

AE

13
1

13

EE yy
E3

Machine cycle types:

represents four hexadecimal digit memory address
represents two hexadecimal data digits
represents four hexadecimal data digits

1 - Four clock period instruction fetch (Figure 5-41
2 - Six clock period instruction fetch (Figure 5-51
3 - Memory read (Figure 5-61
4 -lio read (Figure 5-71
5 - Memory write (Figure 5-81
6 - I/O write (Figure 5-91
7 - Bus idle (Figure 5-101

represents an optional binary digit
represents optional binary digits identifying a destination register
represents optional binary digits identifying a l;Ource register

5-33

THE SOS5A INSTRUCTION SET
There are just three differences between the SOS5A and the SOSOA instruction sets:
1)
2)
3)

The 8085A has two additional instructions - RIM and SIM.
The number of clock periods required to execute instructions differs in some cases; Table 5-1 summarizes these
differences.
Following a Halt instruction's execution, the 8085A floats tristate bus lines in the ensuing Halt state; the 8080A
does not.

Because the SOS5A and SOSOA instruction sets are so similar, the same benchmark program applies to both
microprocessors. Refer to Chapter 4 for a discussion of this benchmark program.
Refer to Table 4·4 for a summary of the SOS5A instruction set. The only two SOS5A instructions not present in
Table 4·4 are the RIM and SIM instructions.
When the RIM instruction is executed, the following data is loaded into the Accumulator:

7 6 5 <4 3 2 1 0 ~ Bit
RIM

IIIIIJII·

No.

This data is loaded into the Accumulator

t

I

RST 5.5 interrupt mask }
RST 6.5 interrupt mask
RST 7.5 interrupt mask

o =enabled
1 =disabled

1 =enabled

M, aster interrupt enable

0= disabled

RST 5.5 interrupt status
RST 6.5 interrupt status

RST 7.5 interrupt status

1 = request pending

o = no request

SID signal level

Thus, the RIM instruction allows you to examine interrupt and external status.
When the SIM instruction is executed the contents of the Accumulator are interpreted as follows:

7 6 5
SIM

4

3 2 1 0

~Bit No.

I 1 I I II I I ,.
~

~

t•

This data must already be in the Accumulator

RST 5.5 maSk}
RST 65 m.ask
0 =. enable
1 = disable
RST 7.5 mask

o = ignore bits 0,

1 and 2
1 = mask as per bits 0, 1 and 2

1 = reset RST 75 latch so a leading edge will cause another
interrupt request

o = disable serial data out
1 = enable serial data out
This bit is transmitted to SOD pin if bit 6 is· 1

Thus the SIM instruction is used to selectively mask interrupts and to output a control signal via the SOD pin.
Note that if bit 6 of the Accumulator is 0 when the SIM instruction is executed, then the contents of bit 7 will not be
transferred to the SOD pin.

5-34

From our discussion of the 8085A reset. recall that following a reset RST 5.5. RST 6.5 and RST 7.5 are all disabled: also.
reset sets the SOD output to O. Thus. following a reset an RIM instruction would input the following data to the A~­
cumulator:

RIM

cw

~
a:
oQ.

1""1.....- - Data loaded to the Accumulator
~~~--~~~~~
l I -_ _ _ _ Mask

1 bits disable interrupts

RST 7.5. RST 6.5 and RST 5.5

a:

o

' - - - - - - - - Master interrupt is disabled

u

~

- - - - - - - - - - These bits reflect the state of the
~ST 7.5. RST 6.5 and RST 5.5 inputs

en
w
~

' - - - - - - - - - - - - - - - This bit reflects the SID signal level

g

8085A MICROPROCESSOR SUPPORT DEVICES

(/)

(/)

c(

all

w

The 8085 has four special purpose multifunction support devices; they are described in this chapter.

a:

The 8085A can use any -5 version of the 8080A support devices described in Chapter 4 and Volume III. If you
Use the low-order eight 8085A address lines, you must de,multiplex the 8085A Address and Data Busses to use
8080A support devices.

Z

oCD
(/)

o

:!!
c(
c

c(

THE 8155/8156 STATIC READIWRITE MEMORY
WITH I/O PORTS AND TIMER

@

The 8155 and 8156 are custom circuits ~esigned specifically for the 8085A microprocessor. Each device provides 256 bytes of static read/writ~ memory, two or three parailel I/O ports, and a programmable timer. The
8155 and 8156 devices differ only in the active level of the chip enable signal.
Figure 5-1~ illustrates that part of general microcomputer system logic which has been implemented on the
8155 /8156 devices.
Figure 5-20 provides a functional diagram of 8155/8156 logic.
The 8155 or 8156 device is pa~kaged as a 40-pin DIP. It uses a single +5V power supply. All inputs and o~tputs
are TTL compatible.

8155/8156 DEVICE PINS AND SIGNALS
8155/8156 pins and signals are illustrated in Figure 5-21. Signals ni~y be divided into the following categories:
1)
2)
3)

CPU interface and control
Parallel I/O
Programmable Timer

We will first consider CPU interface and control signals.
ADO - AD7 cOlmect to a bidirectional, multiplexed Data and Address Bus. As illustrated in Figure 5-22. these pins
connect to the ADO - AD7 bus lines output by the 8085A microprocessor.
ALE is the Address Latch Enable control signal output by the 8085A microprocessor to identify addresses on the
multiplexed Data and Address Bus.
The 8155 or 8156 has both a memory space and an I/O address space. Whe~ 10/M is high, I/O port addresses are
decoded off ADO - AD7 on the high-to-Iow transition of ALE: this may be illustrated as follows:
ADO - AD7

ALE

101M

5-35

Clock Logic

..

....

Logic to Hantlle
InteH'upt Requests
" from
External, Devices

Arithmetic and
Logic Unit

--

Accumulator
Registerlsl

-

-,

~

....

Instruction Register ~
Control Unit

~

Data Counterlsl

~

Stack Pointer

,~

, 1.

..

1

(,

Interrupt Priority
Arbitration

Bus Interface
Logic

Direct Memory
Access Control
Logic

~ Program Counter

t

t

,~

~

~.

System ,Bus
I~

~

I)',

'ii}

"""

ROM Addressing
and
'Interface Logic

I/O Communication
~ Serial to Parallel
Interface Logic

\

,/1:1"
'"C

:-:

":"

~

"-

'0
"."""
:',

I,'"

.I

,,,'

I{,

i,
Programmqble
Timers

'i

"'.

}i

Read Only
Memory

i

....

,/

l

1

Figure 5-19, Logic of the 8155 and 8156 Multifundion Devices
When lo/iVi is low, the address strobed off,ADO- AD7 is interpreted as a memory address.
CE is active high hi the 8156 device; it is active low in the 8155. There is no other difference between the 8155
and 8156 devices.
The 8155 or 8156 device uses standard 8085A coritrol signals on its CPU interface. These signals are RD, WR,
ALE and 101M. Refer to the description of these control signals given in the 8085A section of this chapter.

5-36

101M

[j

256 x 8
STATIC
RAM

c

G<

PORT

w

~
a:
oQ.

a:
o
o
~

enw
~

g
(J)
(J)

c(

ADO - AD7
CE (8155) or CE (8156)
ALE

AD
WR

PAO - PA7

B

8

>

PBO·P07

EJ

' TIMER

RESET

PCO - PC7

Vce (-+ 5V)

TIMER IN

Vss (OV)

TIMER OUT

01:1

w
Z

Figure 5-20. Logic Functions of the 81?5/8156 Device

a:

o

In
(J)

c(

@

.

1

40

Vec (+ 5V)

39

PC2

3
4

38
37

5
6

36

101M

7

34

CE (8155) or CE (8156)

8

AD

9
10

33
32
31

PC3
PC4

~

cc(

--

2

o

.

TIMER IN
. .RESET
PC5
TIMER OllT

_

.

\VA
ALE
ADO
ADl

-

AD2

11

8155

12
13

30
29
28
27

14
~

26

AD5
AD6

18

23

AD7

19

22

(GND)VSS

20

21

PIN NAME

PCl
PCO

PB7

35

15
16
17

AD3
AD4

""-

---.

..
--"..

-

PB6
PB5
PB4
PB3
PB2
PBl

PBO
PA7

~

PA6

25
24

..
'.

DESCRIPTION

PA5
PA4
PA3
PA2
PA
PAO

TYPE

MUltiplexed Address and Data Bus

Bidirectiomil

PAO - PA7

Eight 1/0 pins. designated as Port A

Bid~rectional

PBO - PB7
PCO - PC5

Eight 1/0 pins. designated as Port B
Six I/O pins. designated as Port C

Bidirectional

AD
iNA

Read from device control
Write to device control

Input
Input

101M

I/O ports or memory

ALE

Address latch enable

Input

RESET

System reset

Input

CE/CE
TIMER IN

Chip enable

Input

Timer clock

Input

TIMER OUT

Timer output signal

Output

"SS VCC

Ground. Power

ADO- AD7

sel~ct

B!dir~tional

Input

Figure 5-21. 8155/8156 Multifunction Device Signals and Pin Assignments

5-37

TIMER IN

elK
Device

TIMER OUT

select

logic

8085

8155

ADO - AD7

ALE ~----------""'0.1 ALE

RD'
WR

AD

WR

101M

101M

RESET OUT

RESET

Figure 5-.22 ... An 8155 Device Connected to an 8085A CPU Bus
Table 5-2. 8155/8156 Device Port C Pin Options
Pin

PCO
PC1
PC2
PC3
PC4
PC5

ALT 1
Input
Input
Input
Input
Input
Input

Port
Pon
Pon
Port
Pon
Pon

ALT 2
Output
Output
Output
Output
Output
Output

Port
Port
Port
Pon
Pon
Pon

ALT 3
A INTR (Pon A Interrupt)
A BF (Port A Buffer Full)
A Si'B (Pon A Strobe)
Output Port
Output Port
Output Port

~

J

ALT4

A INTR (Port A Interrupt)
A BF (Port A Buffer Full)
A Si'B (Port A Strobe)
B INTR (Port B Interrupt!
B BF (Port B Buffer Full)
. B Si'B (Port B Strobe)

The 8155/8156 device is reset by a high input at the RESET pin. The Reset operation does not
clear memory or I/O locations within .the 8155/8156 device. Thus all memory locations contain zero. 1/0 ports are assigned to input mode and the CounterlTimer is stopped with an initial
zero value.

8155
DEVICE
RESET

8155/8; 56 PARALLEL INPUT/OUTPUT
The interface presented by the 8155/8156 device to external logic consists of three I/O ports and two signals
associated with CounterlTimer logic.
.
We will examine the I/O port logic and then the CounterlTimer logic.

1/0 Ports A and Bare 8-bit parallel ports; each may be defined as an input port or an output port.
1/0 Port C is a 6-bit parallel I/O port; it may be used to input or output parallel data. or Port C pins may support
handshaking control signals for Ports A and B. Table 5-2 defines the four ways in which 1/0 Port C may be used.
When I/O Ports A and B are used for simple parallel input or output, then their operation is
identical to Mode 0 as described in Chapter 4 for the 8255 PPI. Handshaking mode is identical to 8255 Mode 1. We will therefore discuss 8155 input and output with handshaking briefly.
For a more detailed discussion refer to the 8255 PPI description given in Volume III.

5-38

8155/81'56 I/O
MODE 0
8155/8156 I/O'
MODE 1

Input with handshaking may be illustrated as follows:

c

w

~
a:
oDo
a:

o

tJ

~

rnw

~

g
en
en
ct
D1:I

w
Z

a:

o

!Xl

en

o

~

ct
C
ct

@

An event sequence begins with external logic inputting parallel data to I/O Port A or B: external
logic must pulse STROBE low, at which time the parallel data is loaded into the I/O port buffer. This causes BF.
the Buffer Full signal. to go high.
External logic uses the BF signal as an indicator that no more data can be written.
As soon as the externally provided low STROBE pulse is over. the interrupt request signallNTR goes high. This allows
the 8085A to be interrupted once data has been loaded i~to the input buffer of the I/O port.
BF and INTR remain high until the CPU reads the contents of the I/O port. The read operation will be identified by a low
RD pulse input to the 8155/8156 device.INTR is reset at the beginning of the RD'pulse. while BF is reset at the end of
the RD pulse. BF therefore is high while data is waiting to be read and while data is being loaded into the I/O port buffer
or read out of the I/O port buffer. INTR is high only while data is waiting to be read.
BF and INTR have associated bits in the Status register of the 8155/8156 device.
You connect INTR to an 8085A interrupt request if you want an interrupt-driven system. You write a program
which polls the Status register of the 8155/8156 if you want to operate the system under program control.
Strobod output timing may be illustrated as follows:

In output mode the I/O port buffer is initially empty. which means that the CPU must transmit data to the I/O port.
Therefore INTR is initially high.
As soon as the CPU writes data to the I/O port. the interrupt request signallNTR is reset low: this occurs on the leading
edge of the WR pulse. On the trailing edge of the WR pulse BF is output high, telling external logic that data is in
the I/O port buffer and may be read.
.
External logiC strobes the data out by providing a low pulse at STROBE. The leading edge of STROBE resets BF
low. while the trailing edge of STROBE sets INTR high. causing the CPU to again output parallel data.
You connect INTR to an appropriate 8085A interrupt request pin if you want an interrupt-driven system. You
write a program to poll the Status register if you want to operate the 8155/8156 Linder program control.
A simple method of using the 8155/8.156 device parallel input/output with handshaking. in interrupt mode would be to
connect INTRA and INTRB to RST 5.5 and RST 6.5.

8155/8156 DEVICE ADDRESSING
Having discussed 8155/8156 device memory and I/O ports, we must now look at device addressing ..
The 8155/8156 has 256 bytes of static read/write memory which are addressed by ADO - AD7 while Chip Enable is
true. and 10/M = O.

5-39

The 8155/8156 has eight addressable I/O ports. ADO. AD1 and AD2 select I/O ports while Chip
Enable is true and 10/M = 1. These are the eight addressable I/O ports:
AD2

AD1

ADO

a
a
a
a

a
a

a

1
1
1
1

1
1

a
a
1
1

PORT

8155/8156
I/O PORT
ADDRESSES

Status/Command registers
Port A
Port B
Port C
CounterlTimer register. low-order byte
CounterlTimer register. high-order byte
Unused
Unused

1

a
1

a
1

a
1

Chip Enable is derived from A8 - A 15. which holds th~ high-order byte of a memory address. or the I/O device number.
Chip Enable thus defines the exact address and I/O space for the 8155/8156 device. Here is one possible configuration:
A15
A14
A13
A12
All
Al0
A9
AS

These lines
contribute
to CE
These lines
are ignored

J----

101111 1010 I

T
n

CE(S156)

I n I n I xI xI xI xI x'l xI xI x11"'II4t--- Valid memory addresses

t /

ADO - AD7. x can be 0 or 1

These bits are ignored. They may have
any value.

8155/8156 memory bytes will be selected by any memory addresses in the range 6n0016 through 6nFF16. "n" represents any digit in the range a through 7. Let us assume that programs access 8155/8156 memory bytes via addresses
in the range 600016 through 60FF16; we must further assume that addresses created by values of n in the range 1
through 7 never occur.
Now the same chip select that you use to define your memory address space is also going to define your I/O address space. Recall that the 8-bit I/O device number is output twice following execution of an I/O instruction - once
on the high-order eight address lines A8 - A 15 and again on the low-order Address/Data Bus lines ADO - AD7. Thus the
device select code which you generate from the eight high-order address lines for a memory address is the same device
select code which you generate for the 8155/8156 I/O space.

5-40

But whereas the 8155/8156 has 256 addressable memory locations, it has eight addressable I/O ports: I/O ports are
selected as follows:

TI'p.

~ Bit No ..

7 6 5 .. 3 2 1 0

I_.._- ~rt Num~'

Q

w

!ia:
oQ.
a:

o

CJ

-

~

en
w
I-

<

g
CI)
CI)

<

all

w
Z

a:

o

CE

If Chip Enable is true when A 15 - A 11 is 011002, then I/O port addresses will be 6016 through 6716.
Address lines A 15 - A 11 represent I/O device number bits 7 through 3. This is because the I/O device number is output
on A 15 - A8 following execution of an I/O instruction. It is therefore fortunate that we only used address lines
A 15 - A 11 to create Chip Enable. Had we used A8, A9 or A 10, the low-order three I/O device code bits would have
served a double purpose - with strange results.
Suppose A 10 = 0 is a prerequisite for device select logic to be true: these are the memory and I/O port selects which
will result:

III
CI)

o

Memory

I/O Port

~

Address

Address

<
Q
<
@

r
15 1413 1211 10 9

A........._ - - - -..,....r
8 7

6

54 3 2 1 0

:&1

,A..

7 6 5 4

3

2

"

1 0 . . . . - B i t No.

TI~' I, It" I'I~I~

Address bits
Don't care
Device Select

You can now address only four of the eight 8155/8156 I/O Ports. You cannot include address lines A8, A9 or
A 10 in the device select logic that you use for any 8155/8156 device; if you do, you will limit the I/O
capabilities of the device.
101M discriminates between exectuion of I/O instructions and memory reference instructions.

THE 8155/8156 COUNTER/TIMER
CounterlTimer logic consists of a 16-bit register, addressed as two 8-bit I/O ports, an input clock signal and an
output timer signal. This may be illustrated as follows:

....

~

r15 14

I/O Port

~~

..

I/O Port

100

101

'r

t: +. __
13 12 11 10 9 8 7 6

IIIII

~~

5 4 3 2

-~

,

1 0 :.....
- - - - Bit No.

"_::~~~~ '~~nt

I_I_I_I_I_.#"_'_.__

-

Timer mode

5-41

The low-order 14 bits of the Counter!Timer register must be initialized with a 14-bit binary value that will
decrement on low-to-high transitions of TIMER IN. If TIMER IN is connected to the 8085A clock output signal elK.
then the timer is computing real time. TIMER IN can alternatively be connected to any external logic in which case the
timer is counting external events.
The timer times out when it decrements to zero.
The two high-order bits of the Counter!Timer register define one of four ways in which the TIMER OUT signal
may be created.
' .
In Mode 0, TIMER OUT is high for the first half of the time interval and low for the second half of
the time interval. This may be illustrated as follows:

8155/8156
TIMER
MODE 0

TIMER IN

TIMER OUT

Timer
initial count
is N
STOP

START

If N is odd. the extra pulse will occur while TIMER OUT is high.,
In Mode 1, as in Mode O. TIMER OUT is high for the first half of theco~ilt and low for the' second half. However. the
timer is automatically reloaded with the initial value following each time out. creating a square wave which may be illustrated as follows:

\

TIMER OUT

Timer initial

f

\

l

f

f

Reload N

Reload N

count is N
START

Mode 2 outputs a single low clock pulse on the terminal count. then stops the timer. Timing may be illustrated as
follows:

'-----,.............,-_....

TIMER IN

....--..aqr---. .- -...- - - - - -.............- - - - . . . ,...- ... ,
TIMER OUT

Timer initial

. Decrement

Decrement

count is N

to Zero
START

STOP

Mode 3 is identical to Mode 2. except that when the timer times out 'the initial counter value is automatically reloaded .

. 5-42

8155/8156 CONTROL AND STATUS REGISTERS
The Control and Status registers of the 8155/8156 are used to control both timer and parallel I/O logic. Let us
now examine these registers.

cw

~
II:
oD.
II:

o
o

~

en
w

~
(3
oen

The Control and Status registers of the 8155/8156 device are accessed via a single I/O port address. This is the
lowest of the 8155/8156 I/O port addresses. When you write to this address you access the Control register;
when you read from this address you access the Status register.
8155/8156 internal logic will interpret Control register bits as follows:

..

7 6

S .. 3 2 1 0

~Bit No.

. .__--Control register

~~~~~~~~

Port A definition }
.....- - - - P o r t B definition

en

<
oIS

w
Z

II:

. . . ------1

oa:I

en

o

~

c<

= Input

1 = Output

See Table 5-2

....- - - - - - - - P o r t A interrupts

0 = Disable

....- - - - - - - - - P o r t · B interrupts

1 = Enable

<
@

Port C definition
00 =ALT 1
01 = ALT 3
10=ALT4
11 =ALT 2

0

....-----------<:

Timer control
00 = No effect on timer

01 = Stop timer immediately. if running
10 = Stop timer after next time out. if running
11 = Start timer immediately

Status register bits are set and reset as follows:

7 6· S .. 3 2 1 0 . . . . - Bit No.
'-1--- Status register

~I..r-I~~""""""",,,"""'"

~

_ _ _ Port A interrupt request

- - - - - Port A buffer full
' " - - - - - - - Port A interrupt enabled

1 = True

- - - - - - - - Port B interrupt request

0 = False

......- - - - - - - - Port B buffer full
......- - - - - - - - - P o r t B interrupt enabled
- - - - - - - - - - - - T i m e r interrupt. Set to 1 on time out. reset to 0 when
Status regist.er is read or a new count is started

8155/8156 DEVICE PROGRAMMING
Accessing 8155/8156 read/write memory is self-evident. If you execute a memory reference instruction that
specifies an address within the 8155/8156 address space. you will access an 8155/8156 memory byte.
Parallel I/O programming is also self-evident; you begin by outputting an appropriate code to the Control register jn
order to define the modes in which various ports will operate. and to enable or disable Mode 1 interrupts. Your only
caution at this time must be to ensure that the two high-order bits of the Control code are 0; this prevents initiation of
any timer operations.
If you are using I/O ports without handshaking, the Status register is not affected by I/O operations. No control
signals or status indicate that new data has been input to. or has been read from I/O ports.

If 'you are operating the 8155/8156 in handshaking mode under program control. then you must poll the Status register
in order to determine whether data is waiting to be read or must be written. Your program will consist of a series of input instructions which read status. followed by conditional branches that read or write data.

5-43

If you are operating the 8155/8156 parallel I/O in handshaking mode under interrupt control. then whenever data is
waiting to be read or must be written. the high INTR control signal will vector program execution to an appropriate interrupt service routine.
.

You can at any time read the contents of an I/O port that has been declared an output port. You will simply read
back whatever data was most recently written out to that 110 port. Reading the contents of an output port will have no
effect on handshaking control signals associated with that port.
Let us now examine programming associated with 8155/8156 CounterlTimer logic.
You must first initialize the .16-bit CounterlTimer register by outputting two bytes that specify timer mode and initial
count. The order in which you output these two bytes is unimportant.
Next you output an appropriate Control code in order to start the timer. When you output a Control code. remember not
to modify any control bits that define parallel I/O operations.
Here is an appropriate initialization instruction sequence:
MVI
OUT
MVI
OUT
MVI
OUT

A.80H
OC4H
A.60H
OC5H
A.OFAH
OCOH

LOAD 6080H AS AN INITIAL COUNTER
VALUE. SELECT COUNTER MODE 1

START TIMER

. This instruction sequence assumes that the 8155/8156 I/O port addresses are C016 through C516. The code FA16
output to the Control register starts the timer. and defines Port A as an input port. Port B as an output port. both in
handshaking mode with interrupts enabled.
You can at any time stop the counter. either immediately or following the next time-out. The following instructions will
stop the counter immediately:
MVI
OUT

A.7AH
COH

STOP THE TIMER IMMEDIATELY

The following instructions will stop the counter after the next time-out:
MVI
OUT

A.BAH
COH

STOP THE TIMER AFTER THE
NEXT TIME OUT

The Counter/Timer instruction sequences illustrated above contain a nonobvious propensity for programming
errors. We start the timer by outputting the code FA 16 to the Control register; we stop immediately by outputting the
code 7A16 and we stop the timer after the next time-out by outputting the code BA16. In reality. this is the code we are
outputting:

7 6 5 4 32 1 0 .......----Bit

I
I I 'Tl
IllT1
10 I tL....

No.

O

_+.

_'_ _

Port A input
Port B output

-

Port C ALT 4
Enable Ports A and B interrupts
Timer code:
11 = Start immediately
10 = Stop after next time out
01 = Stop immediately

Whenever you output Control codes to modify 8155/8156 timer operation. you must always remember to output bits 0
through 5 correctly. in order to maintain previously defined parallel I/O options. A commonly used programming
technique that frees you from having to remember the condition of irrelevant bits in a control word is to use
AND and OR masks. Consider this general purpose instruction sequence:
IN
ANI
(ORI
OUT

COH
3FH
COH
COH

INPUT PRESENT CONTROL CODE
CLEAR TIMER BITS
SET TIMER BITS)
RESTORE CONTROL CODE

5-44

This technique will not work with the 8155/8156 device, since you cannot read the contents of the Control
register. If you read from the address of the Control register, you will access the Status register. If you want to
use a masking technique. you must maintain the Control code in memory. Here is an instruction sequence that will
work:

cw

!iII:
oa..

II:

o

U

~

ui
w

!i

LDA
ANI
(ORI
OUT
STA

CONTRL
3FH
COH
COH
CONTRL

LOAD CONTROL CODE FROM MEMORY
CLEAR TIMER BITS
SET TIMER BITS)
OUTPUT CONTROL CODE TO 8155/8156
SAVE CONTROL CODE IN MEMORY.

Your instruction sequence will include the ANI mask to clear timer bits. or the ORI mask to set timer bits. but obviously
not both.
CONTRL is the label for

g

som~

read/write memory byte which always holds the current 8155/8156 Coritrol code.

THE 8355 READ ONLY MEMORY WITH I/O

(I)
(I)

c(
~

w

2

II:

oCD

(I)

o

~

c(

C

c(

@

The 8355 provides 2048 bytes of read-only memory and two 8-bit I/O ports. The device has been designed to
interface with the 8085A CPU.
Figure 5-23 illustrates that part of our general microcomputer system logic which has been implemented on the
8355 device.
'

.

"

The 8355 is packaged as a 40-pin DIP. It uses a single +5V power supply. All inputs and outputs are TTL-compatible. The device is implemented using"N-channei MOS technology.
Figure 5-24 fu~cti~~aiIY illustrates logic of the 8355 device. A simple 8085A-8155/8156-8355 configuration is
illustrated in Figure 5-26.
There are many similarities between the 8155/8156, which we have already described, and the 8355. Where
appropriate we will refer back to the 8155/8156 discussion for clarification of concepts.

8355 DEVICE PINS AND SIGNALS
8355 pins and signals are illustrated in Figure 5-25.
The 8355-8085A interface differs somewhat from the 8155/8156-8085A interface in that the 8355 has more
memory, fewer addressable I/O ports, plus the ability to address I/O ports within the memory space of the,
device.
Having 2048 bytes of addressable read-only memory. the 8355 requires eleven address pins. These are derived
from ADO-AD7 and A8-A 10.
Having only four addressable I/O ports. the 8355 I/O address logic decodes ADO and AD1 only. I/O ports are selected
as follows:
AD1

ADO

a

1

o
1
1

a
a
1

I/O PORT A
I/O PORT B
DATA DIRECTION REGISTER A
DATA DIRECTION REGISTER B

5-45

Clock Logic

...

Logic to Handle
Interrupt Requests
from
External Devices

~

~

Arithmetic and
Logic Unit

Instruction Register

,'"

-

Accumulator
Registerisl

.........

Control Unit,

...

Data Counterisl

~

r

~

Stack Pointer

~

Program Counter

r

Interrupt Priority
Arbitration

Bus Interface
Logic

,.

' Direct Memory
Access Control
Logic

,t

r
$

...

..

System 'Bus
~

. i.'iii,'..'

,•....

I/O Communication
Serial to Parallel
Interface Logic

~",

i,r;r~'

t

A

•
i.

;;

Iii

'.'i

f!)

~;

i'"

J

RAM Addressing
and
Interface Logic

_t_

,>/

Programmable
Timers

~

!

~

Read/Write
Memory

i.".

,.'C:}{i·<.'.".'."

,

Figure 5-23. Logic of the 8355 and 8755 Multifunction Devices

5-46

~

CLK

READY
Q

w

I-

<
II:

AOO- AD7

0

Q.

A

PAO - PA7

B

PBO - PB7

II:

0

U

~

AS-A10

en
w.

2Kx 8

I-

ROM

<

CE

U

Ce

0

U)
U)

101M

<

ALE

all
w

AD
iOW

z

II:

RESET
lOR

0

In
U)

0
~

<
Q
<

~-------- VCC (+ 5V)

@

L..._ _ _ _ _ _ _ _ _ _

Vss (OV)

Figure 5-24. Logic Functions of the 8355 Device

8355 device select logic must generate the chip enable signals CE and CE from the hve address lines A 11-A 15.
The discussion of select logic given for the 8155/8156 device applies also to the 8355.
If you select 8355 memory and I/O ports in their respective address spaces, the control signals ALE, RD, and
are used exactly as described for the 8155/8156 device.

10liVi

But you can also access 8355 I/O ports within the 8355 memory space using control signals lOW and lOR.
lOW and lOR are control signals which override 10/M and RD when accessing I/O ports.
Providing CE and CE are true. a low input on lOW will cause data on the Data Bus to be written into the I/O port
selected by ADO and AD1. irrespective of the 10/M level. Similarly. lOR low will cause the contents of the I/O port
selected by ADO and AD1 to be output on the Data Bus.
You can connect lOW directly to the WR control signal. and thus write into the four I/O ports of the 8355 device as
though they were the four low-order memory bytes. But connecting lOR to RD is not so straightforward. The 8355
device may receive a low input on lOR. to'gether with low inputs on RD and 101M; it will then attempt to read the contents of a read only memory byte and an I/O port at the same time. While elaborate schemes could be devised for
generating separate selects that map the four I/O ports into a memory space of its own. it is wisest to ignore the lOR
signal if you are using 8355 memory and I/O logic. Use lOR only when the 8355 is configured as two I/O portsand the 8355 memory is unused. lOFi and lOW are used in 8048 microcomputer systems; that is the principal
reason they were designed into the 8355 device.

5-47

rl------;~--40
39 ....r--......

CE
CE
CLK
RESET

VCC (+ 5V)

PB7

38
PB6
37 ............. PB5

READY
10/M

i5R

RD
iOW

10

ALE
ADO
ADl

11
12
13
14
15

AD2
AD3
AD4
AD5

8355

16

17

AD6
AD7

t-........- PB4
................ PB3
............. PB2
............. PBl
............. PBO

.....f--~ PA7

............29 ..............~
28
27 .............
26
25 ..............

PA6
PA5
PA4

PA3
PA2
PAl

24 .....1-....- PAO
23 .........__ Al0
A9
22
....1---A8

18'
19
20

(GND),(SS

36
35
34
33
32
31
30

;n

PIN NAME

TYPE

DESCRIPTION

ADO-AD7
AS -Al0
~AO - PA7
PBO - PB7

CLK

Multiplexed Address and Data Bus
Memory Address Unes
Eight I/O pins. designated as Port A
Eight I/O pins. designated as Port D
Read from device control
Read from I/O port control
Write to I/O port control
I/O ports or memory select
Address latch enable
System reset
Chip enables
Wait state request
TIming for Wait state request

VSS. VCC

Ground. Power

R5
iOR
loW
10/M
ALE
RESET
CE.Ce
READY

Bidirectional
Input
Bidirectional
Bidirectional
Input
Input
Input
Input
Input
Input
Input
Output. tristate
Input

Figure 5-25. 8355 Multifunction Device Signals and Pin Assignments
)A8-A15

~

~b~
RESETIN--HlDAHOlD _ _

["-

INTR _ _

I-t--

> ADO-AD7

•
•

f----

8085A

INTARST7.5_
RST6.5-RST5.5 _ _

!:·· ~~~DY

~
A8-A15

I

J

t

~

1 - ' IT

llElIJCE·
S£lECT
lOGIC

~¢:!> ~~ -

AD7

i-

X2

1 - RESET
_ 1 0 1WA
M
1I____

8155

.

LTIMERIN

~:"':~
PCO - PC5

I_AD
_ _ _ ALE
VCCL--

~

L

'----.I

~
DEVICE·
SELECT
LOGIC

PPAO-PA7

iOW

Ro

ALE

8355

AS -Al0
ADO - AD7
CE
CE

Figu re 5-26. An 8085A-8155/8156-8355 Microcomputer System

5-48

Poo - PB7

loR

READY
ClK
~ RESET
iO/M

~

------- ==
-·Complexity of device select logic depends on
the number of devices in the system.

Rii

101M
RESET OUT

f----

TRAP - - 5051-

ALE

WI!

PPoo-PB7

8355 READY LOGIC
The 8366 device has on-chip logic to create a READY signal that will insert one Wait state into the 8085A
machine cycle that references the 8355 device. 8355 READY signal timing may be illustrated as follows:
MC1

cw

~
a:
oD..
a:

o

(..)

Tw
ClK

~

en
w

~

g

CE·CE

en
en

ALE

ciJ
w
Z

READY

ct

........................................
I

a:

I

o
!Xl

I

I

en

o

~

ct
C
ct

@

The READY output is floated by the 8355 device while CE·CE is false.
READY is forced low by the combination of Chip Enable true while ALE is high: READY stays low until the first low-tohigh transition of CLK following the end of the ALE pulse. If you refer back to Figure 5-11. you will see that this READY
logic creates a single Wait state.
.
The problem with the READY logic illustrated above is that in order to have Chip Enable true while ALE is high. chip
enable logic must be tied directly to Address Bus lines. Refer to the timing diagram below and you will see that AOA 15 is stable while ALE is high.
But as we discussed earlier in this chapter. you can derive chip enable logic directly from A8-A 15 only in small 8085
microcomputer systems. When a large number of support devices are connected to the System Bus. you must
guarantee against spurious device selects by including control signals in the chip enable logic. Logic illustrated earlier
in this chapter shows how to create a chip select signal that is true between the trailing edge of ALE and the low-tohigh transition of RD or WR. The following chip enable timing results:

T1

T2

T3

I
~

ClK

I

I

),(
ALE

I

l

:
I

\

,I

I

~

I
I
I

AD orWR
CE

5-49

I

Timing illustrated above is theoretically the best guarantee against spurious selects: but it will not work if you want to
create a single Wait state when using an 8355 device. If Chip Enable (CEl goes true on the trailing edge of ALE. READY
will never be reset lciw:

MCl

I

'Tl
I

ClK

~

:L..J

1

T2

I

I

I

ALE

,
I

I

T3

I

I

T4

I

~

I

L

I

cE·EE 1
1_ _ _...".'-1
I:--_ _..,._....~

AD orWR I

,1

READY

.fl ..--------.
:

I

1

You can resolve this problem by simply inverting ALE as a clock input to the select logic flip-flop.
But when do you need to induce a Wait state?

8355 device timing is fast enough to respond to memory and I/O accesses without the inclusion of a Wait state. unless
you have buffers on the System Bus and the buffers introduce unacceptably long response delays. Therefore. ignore
the READY signal logic of the 8355 in small 8085Asystems and derive chip enable logic directly from the high-order
address lines A 11 ~A 15. In larger systems where buffers on the System Bus force the 8355 device to require a Wait
state. use READY logic of the 8355 device.

8355 I/O LOGIC
Let us now I~ok at the I/O logic of the 8355 device. This device has two I/O ports whose pins can be individually
assigned. to input or output. This assignment is made by loading appropriate Control codes into a Data Direction
register assocIated with each I/O port. A 1 in any bit position of the Data Direction register defines the associated 1/0
porfpirias an output pin. A 0 in any bit position defines the associated I/O port pin as an input pin. This may be illustrated ~as follows:
Data Direction
Register A:
(Port 2)

1
0
0

1
0
1
1

Data Direction
Register B
(Port 3)

I/O Port A
. (Port 0)

1

"

-

1

1
0
1
0
1
1

...

0

I/O Port B
(Port 1)

...

...-

...

Observe that the 8355 has no 1/0 with handshaking. For I/O with handshaking you should use the 8155/8156 or the
8255 devices.

5-50

THE 8755A ERASABLE PROGRAMMABLE READ
ONLY MEMORY WITH 1/0.
Q

w

~
a:
oa.
a:

o
o

~
u)

w

~

g
en
en
~

alS

w

Z

a:

o

m

en

o

The 8755A device provides 2048 bytes of erasable programmable read-only memory and two 8-bit I/O ports . .
The only difference between this dev.ice and the 8355, which we have just described, is the fact that the
8755A read-only memory is programmable and erasable. There are minor pin and signal variations supporting
..
the EPROM. These differences are identified in Figure 5-27.
The 8755A is a new version of an earlier device, the 8755. The only difference between the
two is the level of Vee during normal read operations: +5V on the current 8755A, but OV
on the earlier 8755.
This discussion of the 8755A device is limited to describing how you program the read-only memory. In all other ways.
the 8755A device is identical to the 8355.
There are two Chip Enable signals' on the 8755A device: CE is the standard chip enable. which must be true when the
8755 device is being accessed for any purpose. either in normal operation or when programming the read-only memo~
ry. CE is a high true signal.
.
The second Chip Enable signal. CE/PROG. is first held low. then is pulsed true only when you are programming the
read-only memory. You must apply a +25V pulse lasting between 50 and 100 milliseconds. beginning with the leading
edge of ALE. At this time. data will be written into the addressed read-only memory location. Timing may be illustrated
as f o l l o w s : '
.

~

~

Q

~

@

ClK

ADO - AD7

ALE

CE

I

26V
5V
OV

READY

I

DATA.

:----1

n

I

~

I

I

I

CE/PROG ,

VDD

,
I

ADDRESS

A

8755A

--------I
8755

\

You erase the programmable read-only memory by exposing it to ultraviolet light for a minimum of twenty minutes.

5-51

;·.···~~ANDCf

..

CE
ClK
RESET
VDD (+5Vor +25V) *

READY
10/M

-..

iO'R

R5

--'"

--

TOw

...

ALE

ADO
ADl
AD2
AD3
AD4
ADS
AD6
AD7
(GND) Vss

-

- -.

-- .
-- --

PIN NAME

1

40

2

39

3
4

38
37

5
6
7

35
34

6

33

9
10

32

36

..
"'"-

VCC (+5V)

--.
....

-- --- ..

PB7

PB6
. PB5

PB4
PB3

PB2
PBl
PBO
PA7

12

31
30
29

13
14

28
27

15

26

16
17

25
24

18

23

Al0

.19

22
21

A8

11

8755A

20

--

PA6
PA5

...

PA4

..

PA2

PA3

DESCRIPTION

, PAl
PAO
A9

TYPE

ADO - AD8

Multiplexed Address and Data Bus

Bidirectional

AS - Al0
PAO - PA7

Memory address lines
Eight I/O pins, designated as Port A

Input

PBO - PB7

Eight I/O pins. designated as Port B
Read from device control

Bidirectional
Input

iOR
iOW

Read from I/O port control

Input

Write to I/O port control

Input

10/M

I/O ports or memory select
Address·latch enable

Input-

Ri5

ALE
RESET
CE
PROG AND
READY
ClK

System reset
Chip enable

CE

Bidirectional

Input
Input
Input

PROM programming chip enable

Input

Wait state request
Timing for Wait state request

Output. tristate
Input

VDD

Programming voltage:
+ 25V to program
+ 5V in normal read operation*

VSS· VCC

Ground. Power

*VDD is OV in earlier 8755 read mode

Figure 5-27. 8755A Multifunction De·vice Signals and Pin Assignments

5-52

DATA SHEETS
This section contains specific electrical and timing data for the following devices:
• 8085A CPU
Q

w

~
a:
oD.

• 8155/8156 RAM/IO
• 8355 ROM/IO
• 8755A EPROM/IO

a:
u

o

~

en
w
~

g
en

~
all
w
Z

a:

o

Ul

en

o
~

c(
Q
c(

@

5-01

SOS5A

ABSOLUTE MAXIMUM RATINGS*
Ambient Temperature Under Bias ......... O°Cto 70°C
Storage Temperature ..............-65°C to +150°C
Voltage on Any Pin
With Respect to Ground ............ - 0.5 to + 7V
Power Dissipation . . . . . . . . . . . . . . . . . . . . . 1.5 Watt

*COMMENT: Stresses above thosh;stedUhfl.e(i<~'Absolute
Maximum Ratings" may cause per;a'n8ntdafn~'t() the
device. This is a stress rating only and iun~tiQ,,!if~p,~il­
tion of the device at these or any other cond"tionfafjC?J#;\~
those indicated in the operational sections of titl$spe~j1J,i;,
cation is not implied. Exposure to absolute maximum"
rating conditions for extended periods may affect de~ice'
reliability.

D.C. CHARACTERISTICS
= o°c to 70°C; Vee = 5V ±5%; Vss = OV; unless otherwise specified)

(TA

Min.

Max.

Units

Input Low Voltage

-0.5

+0.8

V

VIH

Input High Voltage

2.0

Vee +0.5

V

VOL

Output Low Voltage

0.45

V

IOl

VOH

Output High Voltage

V

IOH

= 2mA
= -400J.LA
= Vee

Symbol
V il

Parameter

2.4

Test Conditions

lee

Power Supply Current

170

mA

III

Input Leakage

±10

J.LA

Vin

IlO

Output Leakage

±10

J.LA

0.45V

VllR

Input Low Level, RESET

-0.5

+0.8

V

VIHR
VHy

2.4

Vee +0.5

V

Hysteresis, RESET

Input High Level, RESET

0.25

< V out < Vee

V

TIMING CHARACTERISTICS
Bus Timing Specification as a Tcye Dependent
tAL
tlA
tLl
t lCK
t Lc
tAD
tRO
tRAE
teA
tow
two
tcc
tCl
t ARy
t HACK
tHABF
tHABE
tAC
t1
t2

-

(1/2) T - 50

MIN

-

(1/2) T - 60

MIN

-

-

(1/2) T - 20

MIN

(1/2) T - 60

MIN

(1/2) T - 30

MIN

(5/2 + N) T - 225
(3/2 + N) T - 180

MAX

(1/2) T -10

MIN

MAX

(1/2) T - 40

MIN

(3/2 + N) T - 60

MIN

-

(1/2) T - 60

MIN

(3/2 + N) T - 80

MIN

-

(1/2) T-ll0

MIN

(3/2) T - 260

MAX

(1/2) T - 50

MIN

-

(1/2) T +50

MAX

(1/2) T + 50

MAX

-

(2/2) T - 50

MIN

-

(1/2) T - 80

MIN

(1/2) T - 40

MIN

(3/2) T - 80
tRV
NOTE: N is equal to the total WAIT states.
T = tCYC.

MIN

Data sheets on pages 5-02 through 5-018 reprinted by permission of Intel Corporation. Copyright 1978.

,5-02

. SOS5A
!;

(TA =o°c to 70°C' VCC
Parameter

A C CHARACTERISTICS
Symbol

= 5V +5%'
- '"SS-- OV)

i,

Max.

Units

TestJ;ol:ld itiot\f'i t,

2000

ns

See note;'1/2:~a~;4"5~y

TCYC

ClK Cycle Period

320

cw

t1

ClK low Time

80

ns

a:

t2

ClK High Time

120

ns

~
o
11.

tr, tf

ClK Rise and Fall Time

tAL

Address Valid Before Trailing Edge of ALE

110

tLA

Address Hold Time After ALE

100

ns

tLL
t LcK

ALE Width

140

ns

ALE low During ClK High

t LC

Trailing Edge of ALE to leading Edge of
Control

100
130

ns

en
en
w
Z

tAFA

a:

o(J
~

en
w
~

g

.,

<
a:

o

CO

en

o

:!:

<
c

<
@

30

Address Float After leading Edge of
, ,READ (lNTA)

ns

ns

0

ns

Valid Address to Valid Data In

575

ns

tAO
t ROH

READ (or INTA) to Valid Data

300

ns

0

ns

tAAE

Trailing Edge of READ to Re·Enabling
of Address

150

ns

tCA

Address (AB-A 15) Valid After Control

120

ns

tow

Data Valid to Trailing Edge of WR ITE

420

ns

two

Data Valid After Trailing Edge of WR ITE

ns

tce

Width of Control low (RD, WR, INTA)

100
400

tCL

Trailing Edge of Control to leading Edge
of ALE

50

ns

t AAy
t AyS

READY Valid From Address Valid

t AYH

READY Hold Time

t HACK

HlDA Valid to Trailing Edge of ClK

tHABF

Bus Float After HlDA

210

ns

tHABE

HlDA to Bus Enable

ns

tLOR

ALE to Valid Data In

210
460

TeYc

220
110

READY Setup Time to leading Edge of ClK

ns
ns

0

ns

110

ns

ns

400

ns

tAC
t HOS

Address Valid to leading Edge of Control

270

ns

HOLD Setup Time to Trailing Edge of ClK

ns

t HOH

HOLD Hold Time

170
0

INTR Setup Time to Falling Edge of ClK

160

ns

tiNS

= 320ns;

C L =150 pF

ns

' Control Trailing Edge to leading Edge of
Next Control

tAV

..

ns

tAO

Data Hold Time After READ ONTA)

"j",,:,;.t _

,',

Min.

ns

(M1, Tfonly). Also RSTand TRAP
INTR Hold Time
0
ns
tlNH
- 50 and 51.
NOTES: 1. AB-15 Address 5pecsapply to 101M,
2. For all output timing where CL '" 150pf use the following correction factors:
25pf <: CL < 150pf: -.10 nslpf
150pf < CL <: 300pf: +.30 ns/pf
3. Output timings are measured with purely capacitive load.
4. All timings are measured at output voltage VL = .av, VH - 2.0V, and 1.5V with 20ns rise and fall time on inputL
5. To calculate timing specifications at other values of TCYC use the table in Table 2.
6. L.E. - Leading Edge T.E ... Trailing Edge

5-03

SOS5A

WAVEFORMS

Figure 10. Clock Timing Waveform

Read Operation
T,

'AO------------

ALE

1-----+----- t RO - - - - - - -..,
- - - 'CC-·~---Ir--__j---

RD/INTA--+----++----.I

READY

Writs OpGn~tlon

T,

,'--_...-

''--_...-1
ADDRESS

I
)

1-

ADDRESS

r'll-

, tCA _

I

X

DATA OUT

~_llA---l ~

tow

X

-two-I

1/

ALE

.

I+-t Al -

I

tcc

II ....- t ---.
el

~tlC-1

f------

tAC - - - ' ARy · -

READY

tRYS

\

t RYH .1

I

1

Figure 11. 808SA Bus Timing

5-04

SOS5A

TZ

Q

w

\

!ta::
oa..

o
(J
~

en
w

!t

g

.J

\

t

HOLD

a::

THOLO

T3

/

ClK

/

.T

• I--IHA.F-I-

BUS

TI

~IHAIl-H
I.r'

H

(ADDRESS, CONTROLS)

,

,

r-IHACK"

f

HlDA

\

:~

"\
I HOS • + I HOH

T HOLO

1"10.

I

o
o

c:(

011
w
Z

a::

oIII

Figure 13. BO~5A Hold Timing I

o

o
~

c:(

Q
c:(

@

1 1 - - - - - BUS FLOATING'

------.1

ALE

Rol--------------t-----~----------------~

HOLD

HLOA________________-JI
'HACK

,"AIF

Figure 14. BOB5A Interrupt and Hold Timing

5-05

'IO!Q IS ALSO FLOATING DURING THIS TIME

8155/8156

ABSOLUTE MAXIMUM RATINGS·

*COMMENT: Stresses above those listed under "Absolute
Maximum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at these or any other conditions above
those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum
rating conditions for extended periods may affect device
reliability.

TemperatureUnderBias ................ 0°Cto+70°C
Storage Temperature ............... -65°Cto+150°C
Voltage on Any Pin
WithRespecttoGround ............... -0.3Vto+7V
Power Dissipation ............................... 1.5W

D.C. CHARACTERISTICS

.ITA = O°C to 70°C; Vee = 5V ±·5%)

PARAMETER

MIN.

VIL

Input low Voltage

-0.5

0.8

V

VIH

Input High Voltage

2.0

Vee +0.5

V

0.45

V

IOL

V

IoH

SYMBOL

MAX.

UNITS

TEST CONDITIONS

IlL

Input leakage

±10

J.LA

= 2mA
= -400,uA
VIN = Vee to OV

ILO

Output leakage Current

±10

J.LA

0.45V ~VOUT ~Vec

IcC

Vee Supply Current

180

mA

IldCE)

Chip Enable
8155
8156

+100
-100

J.LA
J.LA

VOL

Output low Voltage

VOH

Output High Voltage

2.4

l~akage

.5-06

VIN

= Vee to OV'

8155/8156

A.C. CHARACTERISTICS
Q

w

(TA

=o°c to 70°C; Vcc =5V ± 5%)
MIN.

SYMBOL

PARAMETER

tAL

Address to Latch Set Up Time

tLA

Address Hold Time after Latch

a:

tlC

Latch to R EAD/WR ITE Control

a:

tRO

Valid Data Out Delay from READ Control

~
o
11.
o(J

MAX.

UNITS

80

ns

100

ns
170

V~!id

400

ns
ns

tAD

Address Stable to Data Out

tll

Latch Enable Width

tROF

Data Bus Float After READ

0

tCl

READtWRITE Control to Latch'Enable

20

ns

c(

tcc

READ/WRITE Control Width

250

ns

01:1

tow

Data In to WR ITE Set Up Time

150

ns
ns

~

en
w
~

g
II)
II)

w
Z

a:

o!XI
II)

o

~

c(
Q
c(

@

100

..

two

Data In Hold Time After WRITE

0

tRv

Recovery Time Between Controls

300

twp

WR ITE to Port Output

ns
100

ns

ns

tpR

Port Input Setup Time

70

ns

tRP

Port Input Hold Time

50

ns

tSBF

Strobe to Buffer Full

tss

Strobe Width

tRBE

400

ns

READ to Buffer Empty

400

ns

tSI

Strobe to INTR On

400

ns

tROI

READ to INTR Off

400

tpss

Port Setup Time to Strobe Strobe

50

tpHS

Port Hold Time After Strobe

120

tSBE

Strobe to Butter Empty

400

ns

tWBF

WR ITE to Buffer Full

400

ns

tWI

WR ITE to INTR Off

400

ns

tTL

TIMER-IN to TIMER-OUT Low

400

ns

tTH

TIMER-IN to TIMER-OUT High

49P

ns

tROE

Data Bus Enable from READ Control

200

ns

5-07

ns
ns
ns

<,

Note: For Timer Input Specification, see Figure 10.

,.

ns
400

10

TEST CONDITIONS

ns

50

,

ns

150 pF Load

8155/8156

WAVEFORMS
Read Cycle

CE (8155 )

\[-

,(

\

Jf-

~\

/

\

,(

\

OR

CE (8156 )

101M

..

X

tAD

J<-

)(

[-

~I\

H
-,(

~r-

l_ tRDE •

- tl l -

--'\

- - t RDF -

-tRD_

.

(-

-tle~

l----

Write Cycle

CE (8155)

~

DATA VALID

- tlA -

!----.tAl -

ALE

r-

ADDRESS

.

OR

CE (8156)

101M

ALE

Figure 7. 815518158 ReadlVlrlte Timing Diagrams

5-D8

t ee -

,~

~

-

~~
tel-

- . - · t RV -

8155/8156

Strobed ~np~t Mode

cw

~

£!F

a:
0

tSBF

D.

a:
0

(.)

~

en
w

~

g

INTR

(/)
(/)

c:(

a/J

RD

w
Z
a:
0

CD
(/)

0

t pHS

INPUT DATA
FROM PORT

~

c:(

cc:(

@

Strobed Output Mode
BF

STROBE

tWBF

INTR

tWI

WR
twp

OUTPUT DATA
TO PORT

Figure 8. Str~bed 110 Timing

5-09

8155/8156
Basic InPL!t M,ode

~

DATA BUS'

===-=-=-.=x. . .__________

Basic Output Mode

DATA BUS'

OUTPUT

'DATA BUS TIMING IS SHOWN IN FIGURE 7.

F~gure

9. Basic I/O Timing Diagram

LOAD COUNTER FROM CLR

I

2.

--I.

,..1

I

RELOAD COUNTER FROM CLR

I

.5

TIMER IN

'i"iMEi'iOuf
(PULSE)

TIMER 04T
(SQUARE WAVE)

~OTE',

\

\

...... (NOTE1I
__ ;..J"

...... _ _ _(NOTE')
_ _ _ _ _ ..1"

THE TIMER OUTPUT IS PERIODIC IF IN AN AUTOI11ATIC
RELOAP MODE (M, MODE BIT·')

COUNTDOWN FROM 5 TO ,

tcvc
t, ANDtl

t,';'
t2

tTlANDtTH

320 nsec
JOnsec
80 nsec
'20 nsec
400 nsec

figure 10. Timer Output Waveform

'S-Dl0

MIN.
MAX.
MIN.
MIN.
MAX.

2

I,

-t
I

8355

ABSOLUTE MAXIMUM RATINGS·

cw

~
a:
oD..

a:

o
u

~

enw
~

g
C/)
C/)

-t

all
w
Z

a:

o

III
C/)

o

~

-t

C

·COMMENT: Stresses above those listed under "Absolute
Maximum Ratings"may cause permanent damage to the
device. This is ,a stress rating only and functional opera·
tion of the device at these or any other conditions above
those indicated in the operational sections of this specifi·
cation is not implied. Exposure to absolute maximum
rating conditions for extended periods may affect device
reliability.

Temperature Under Bias .•.............. O°C to +70°C
Storage Temperature ............... -65°Cto +150°C
Voltage on Any Pin
WithRespecttoGround ............... -0.3Vto+7V
Power Dissipation ............................. 1.5W

D.C. CHARACTERISTICS

(TA = o°c to 70°C; Vee = 5V

± 5%)
TEST CONDITIONS

SYMBOL

PARAMETER

MIN.

MAX.

UNITS

VIL

Input Low Voltage

-0.5

0.8

V

Vee = 5.0V

VIH

Input High Voltage

2.0

Vee+O· 5

V

Vec = 5.0V

VOL

Output Low Voltage

0.45

V

IoL=2mA

VOH

Output High Voltage

IlL

Input Leakage

ILO

Output

Icc

Vee Supply Current

leakag~

2.4

J,.LA

VIN = Vcc to OV

±10

pA

0.45V ~VOUT ~Vee

180

mA

10
Current

IoH = -400J,.LA

V

c(

@

A.C. CHARACTERISTICS
SYMBOL

(TA = o°c to 70°C; VCC = 5V

PARAMETER

± 5%)

MIN.

MAX.

UNITS

tCYC

Clock Cycle Time

320

ns

T1

ClK Pulse Width

, ,80

ns

T2

ClK Pulse Width

120

30

ClK Rise and Fall Time

tAL

Address to latch Set Up Time

tLA
tLC
tRO

Valid Data Out Delay from READ Control

170

ns

tAD

Address Stable to Data Out Valid

400

ns

100

ns

ns

50

ns

Address Hold Time after Latch

80

ns

Latch to READ/WRITE Control

100

ns

tLL

Latch Enable Width

tROF

Data Bus Float after READ

tCL

R EADIWR ITE Control to latch Enable

20

ns

tee

R EADIWR ITE Control Width

250

ns

100

ns

tow

Data In to WR ITE Set Up Time

150

ns

two

Data In Hold Time After WR ITE

10

ns

twp

WR ITE to Port Output

tpR

Port Input Set Up Time

50

tRP

Port Input Hold Time

50

tRYH

READY HOLD TIME

0

tARY

ADDRESS (CE) to READY

tRV

Recovery Time between Controls

tRI;lE

Data Out Delay from READ Control

400

ns
ns
ns

160
160

ns
ns

300

ns

10

ns

5-011

CLOAO = 150 pF

ns

tf,t r

0

TEST CONDITIONS

150 pF load

8355
WAVEFORMS

Figure 4. Clock SpeCification for 8355

tCYC

CLK

-\

\

/

A~,O

/

""-----_....

ADDRESS

101M

tAD

AD0-7

ADDRESS

DATA

(CE -1)'
(CE=O)

t LA -

ALE
tAL

R5
iOR
1 + - - - - - 'DW-----+I

tcc -------------~

Figure 5. ROM Read and 110 Read and Write

5-012

ir------t-----

8355

elK
Q

w

~
a:

ICE-1l. U:-E-OI

oa..

a:

o
U

~

ALE

u)
W

~
(j
o
en
en
oct

ell

w

Z

a:

Figure 6. Wait State Timing (READY 5 0)

o
In

en

o

~

oct
Q
oct

@
A. INPUT MODE

DATA"- BUS

---

--)<

-------

----------------------

B. OUTPUT MODE

GLITCH FREE
/OUTPUT
PORT
OUTPUT

~~iA*

=====)(10...._______...IX"'_____

*DATA BUS TIMING IS SHOWN IN FIGURE 3.

Figure 7. 110 Port Timing

5-D13

8755A
<<.<. . . )

·COMMENT: Stresses above those''1;~~~iJfJ
Maximum Ratings" may cause permanilnltJatrl
device. This is a stress rating only and f~;'c.·tt'wJ,.a
tion of the device at these or any other cond,'tl'o~hi II
those indicated in the operational sections of thisSRik/,.
cation is not implied. Exposure to absolute maxfrrwfn.
rating conditions for extended periods may affect devide
reliability.

ABSOLUTE MAXIMUM RATINGS·

TemperatureUnderBias .............. -10°C to +70°C
Storage Temperature ............... -65°C to +150°C
Voltage on Any Pin
.
With Respect to Ground ............... -0.5V to +7V
Power Dissipation ............................. 1.5W_

D.C. CHARACTERISTICS,

(TA

=o°c to 70°C; Vee =5V ± 5%)

SYMBOL

PARAMETER

MIN.

MAX.

UNITS

VIL

Input Low Voltage

-0.5

0.8

V

VIH

Input High yoltage

2.0

Vee +0.5

V

VOL

Output low Voltage

VOH

Output High Voltage

IlL

Input leakage

ILO

Output leakage Current

Icc

Vce Supply Current

A.C. CHARACTERISTICS

p.A

= 2mA
= -400J.LA
VIN = Vee to OV

±10

J.LA

0.45V ~VOUT ~Vee

180

mA

V

0.45

IoL

V

2.4
10

(TA

TEST CONDITIONS

IoH

= o°c to 70°C; Vee = 5V ± 5%)
MAX.

UNITS

SYMBOL

PARAMETER

MIN.

tcvc

Clock Cycle Time

320

ns

T1

ClK Pulse Width

80

ns

T2

ClK Pulse Width

120

ns
30

ClK Rise and Fall Time

tAL

Address to Latch Set Up Time

50

ns

tLA

Address Hold Time after latch

80

ns

tLC

Latch to R EADIWR ITE Control

100

tRO

Valid Data Out Delay from READ Control

tAD

Address Stable to Data Out Valid

tLL

latch Enable Width

tROF:

Data Bus Float after READ

0

tCL

R EADIWR ITE Control to latch Enable

20

ns
ns

ns
170

ns

450

ns

100

ns
100

ns

tcc

READIWRITE Control Width

250

tow

Data In to WR ITE Set Up Time

150

ns

two

Data In Hold Time After WR ITE

30

ns

twp

WR ITE to Port Output

tPR

Port Input Set Up Time

50

tRP

Port Input Hold Time

50

tRVH

READY HOLD TIME

0

tARV

ADDRESS (CE) to READY
Recovery Time between Controls

tROE

Data Out Delay from READ Control

400

ns
ns
ns

160

ns

160

ns

300

ns

10

ns

5-D14

CLOAD = 150 pF
(See Figure 3)

ns

tf,tr

tRV

TEST CONDITIONS

150 pF load

8755A

WAVEFORMS

c

w

~
a:
oD..
a:

o
u

~

en

w

~

g
CI)
CI)

Figure 5. Clock Specification for 8755A

<
..,
w
Z

a:

oIII
CI)

o

A.. ,O

~

<
c
<
@

~

ADDRESS

:K

ADDRESS

tAD

AD()'7

)

r

ADDRESS

}·--~D

)-----(

DATA

ADDRESS

.>-

f-tll-

ALE

f

\0!-tAl_

(PROG)/CE

\~

CE

}r-

~tlA_

-'\

-~tlC_

--Jr-

tROF

I--tRDE

tow

-tRO

-

\
I-oJ

L-

~ t-two

,~

L-

tcc
I---tCltRV

Figure 6. PROM Read, 110 Read and Write Timing
Please note that ffi must remain low for the entire cycle.
This is due to the fact that the programming enable
function common to this pin will disrupt internal data bus
levels If CE1 is taken high during the read.

5-015

8755A

Input Mode

A. INPUT MODE

DATA- BUS

-

-- -

-

-)<

----- - -

Output Mode

-------------

B. OUTPUT MODE

GLITCH FREE
/OUTPUT
PORT
OUTPUT

====)<________X"'_____

~~iA- =

-DATA BUS TIMING IS SHOWN IN FIGURE 6.

Figure 7. 110 Port Timing

Figure 8. Walt ~tate Timing (READY = 0)

5-016

8755A

Q

w

D.C. SPECIFICATION FOR PROGRAMMING

a:

(TA

~
o
Q.

a:
o

o

=O.J C to 70°C; Vee =5V ±5%; Vss =OV)
SYMBOL

~

PARAMETER

enw

Voo

Programming Voltage
(during wri$e to EPROM)

g

lop

Prog Supply Current

~

MIN.

TYP.

MAX.

UNIT

24

25

26

V

15

30

mA

TYP.

MAX.

UNIT

en
en

ct
.;s
w

Z

a:
~

A.C ... SPECIFICATION FOR PROGRAMMING

o

(TA

en

=o°c to 70°C; Vee =5V ±5%; vss =OV)

~

ct
Q

ct

@

SYMBO·L.

PARAMETER

MIN.

tps

Data Setup Time

10

tPD

Data Hold Time

0

ns

ts

Prog Pulse

2

I1S

tH

Prog Pulse Hold Time

2

tpR

Prog Pulse Rise Time

0.01

2

tpF

Prog Pulse Fall Time

0-01

2

I1S

tPRG

Prog Pulse Width

A5'

50

msec

~etup

Time

5-017

ns

I1S
I1S

8755A
WAVEFORMS
FUNCTION PIN NO.

.I~.•.------

PROGRAM CYCLE

------'.~I.__

~ .!;~~;~

---VERIFY CYCLE- - - - ·......I:

.<~{
ALE

4

11

AlDO_7

12-19

A8·10

21·23

DATA TO BE
PROGRAMMED

CE

PROG/CE

~-----------------------

V OD

\J-• VERIFY CYCLE IS A REGULAR MEMORY READ CYCLE (WITH V DD

Figure 10. 87SS/87S5A Program Mode Timing Diagram

5-018

= +5V

FOR 8755A. V DD

= OV

FOR 8755.1

cw

Chapter ,6

oQ.

THE 8048 MICROCOMPUTER DEVICES

!ia:
a:

o(,)
:!!:

en

w

!i

~r

U)
U)

oCt
011
w
Z

a:

o

en
U)

o

~

oCt
C

oCt

@

The 8048 series microcomputers are single-chip 8-bit devices which have been developed by Intel to compete
in the market for low-cost, high-volume applications. This is a market where the 8080A, with its high chip
counts, does not do well. One version of the 8048, the 8748, is also likely to do exc'eptionally well in lowvolume, custom applications because it is very easy to use.
'
The 8048 looks like a one-chip 8080A with heavy' F8 influence. The F8 was the first 8-bit microprocessor to
bring the economics of low chip counts to the attention of the semicoriductor industry. It is therefore not
surprising to find an F8 influence in the 8048. (The F8has now been superceded by the 3870; both parts are described in Chapter 2.) .
,
It is intriguing to note that, in terms of general architectural organization, there are striking similarities between
the 8048 and the MCS6530 (which is described in Chapter 10).
The 8041 and 8021 are slave microcomputers of the 8048 family. On simple inspection the principal di1ference
between the '8948 ij(1d the 8041/8021 w'ould appear to be that the 8041/8021 cannot generate external
System Busses. In fact, there are non~obvious differences between the 8048 and the 8041/802'1; there are
further significant d!fferences between the 8041 and the 8021.
,.'
.
The 8048 is a simple. single-chip microcomputer that may be a stand-alone device. or part of a multi-microprocessor
configuration. As a stand-alone device. the 8048 mayor, may not have external additional logic. Thus. the 8048 is a
straightforward. low-end, low-cost microprocessor with less versatility than a device such as the 8085.
If you ~ontinue the philosophical progression from the 8085 to the 8048. you reach the 8021. This is a single-chip
microcomputer with no expansion capabilities, and very low-cost. If the 8021 exists in a multi-microprocessor configuration. then so far as the 8021 is concerned there is logic beyond'its perimeters. The fact that this logic contains
one or more microprocessors is quite immaterial to the manner in which the 802,. will be programm~d.
The 8041. in sharp contrast. is a slave microprocessor that assumes the presence of a master microprocessor 011 on~
side and extern'al logic on the other side. The 8041 thus becomes an interface and control part - which is how the
8041 should be considered. But you will observe that a large number of microprocessor support parts also act as interfaces between microprocessor. assumed to E3xist on one side. and some other logic. assumed to eXist on thE3 other
side. This is a very accurate parallel to draw. The 8041 is. in fact. a universal interface device. limited only by the speed
of the part and the amount of programmed logic that can be included in it. The 8041 can s.erve a wide variety of interface logic functions. Thus. when'ever you consider using a complex interface controller part, you should also consider using the 8041 as an alternative. Because.the 8041 is programmable. you can tailor it to meet. exactly. the requirements of the specific microprocessor on one side and specific logic on the other side, This is something you cannot do with dedicated controller parts such as floppy disk and CRT controllers. which must look generically. rather than
specifically. upon the CPU on one side and the device being controlled on the other side.

a

There is also an erasable programmable read-only memory version of the 8041; it is the 8741.
I'

•

8048 series microcomputers are summarized il'!Table 6-1.
The only support device described in this chapter is the 82431/0 Expander. In addition, the 8155, the 8355, and
the 8755 multifunction devices (which have~:'been desc~ibed in Chapter 5) can be used with 8048 family
microcomputers.

6-1

The prime source for the 8048 series rnicrocomputers is:
INTEL CORPORATION
3065 Bowers Avenue
Sa nta Cia ra. Ca Iiforn ia 95051
Second sources for the 8048 include:
ADVANCED MICRO DEVICES
901 Thompson Place
Sunnyvale. California 94086
SIGNETICS
811 East Arques Avenue
Sunnyvale;. California 94043 '
Neither of the8048 second sources are likely to have' sign,ificantProduct volumes until mid-1978,
Intersil plans to introduce a CMOS version of the 8048 ih early 1979,
The 8048 series microcomputers use 'a single +5V power supply. There are two versions of each microcomputer; one
uses a 2.5 microsecond clock while the other LJ~es 5 microsecond clock. 8048 instructions execute in either one or
two clock periods. The 8021 uses alb microqecond clock. A ~e~ version of the 8049 uses a 1 A JLsec clock, '

a

All 8048. '804~ and 8041 devices are p~'ckaged as 40-pin DI~s and ~flve TTL-compatible signals, 8021 devices are
.
'
packaged a,s 28-pin DIPs and have TTL-compatible signals,
Table 6-1. A Summaryof 8048 Series Microcomputers
ON CHIP MEMORY
R9M/EPROM

RAM

102~ROM

64
64

8048
8035
8035-8"
8748
8748-8
8049
; 8041
8741
8021

0
0
1024 EPROM
1024 EPROM
2048 ROM
1024 ROM
1024EPROM

802~

64
64
64
64
64

CYCLE
TIME
2.5p.sec
2.5p.sec
5.0 p.sec
2.5 p.sec
~.O p.sec

1024 ROM

64
64

lAp.sec
2.5 p.sec
2.5p.sec
10 p.sec

2048 ROM

64

10 p.sec

I/O PORTS

EXTERNAL
INTI;RRUPTS

TIMER

3x8 bits

1

Yes

3x8 bits
3x8 bits
3x8 bits
3x8 bits

1
1
1

Yes
Yes
Yes
Yes

3x8 bits
3x8 bits
3x8 bits
2x8 bits
lx4 bits
3x8 bits

1
1
0
0
0
1

PACKAGE
PINS

EXPANDABLE

ANALOG TO
DIGITAL
CONVERTER

28

N8
No
No

No
No
No
No
No
No
No
' No
' No

40

No

Yes

40
40
40
40
40

Yes
Yes
Yes
Yes

40
40
40

Yes,

Yes
Yes
Yes
Y~s

Yes
Yes

THE 8048, 8748,. 8049, 8749 AND 8035

,

MICROgo~~~frE~~"

For a description of an 8048, 8748, 8049, 8749, or 8035 device, read the following text; where ambiguities
may arise in your mind,:r~m~mber'these overriding rules:
..
1)

The 8049 is an 8048 with twice as much on-chip program memory. and. in newer models. higher execution speed,
are no other differences
betweenl
these
two parts.
'
There
,
, .
'
'.

2) , A~ 8035 is alJ 8048 with no on-chip program memory. There are no other differences between these two parts.
For a ~escription of an 8041,8741 or 8021 device, read the following'text, then read the specific device discussion tt,at ~ppears Ia.~er-'in this ch~Pt~r.

Functioj,~ ilT!plemented qn the tt1~e~ versions of the 8048 micr~c~mputer are illustrated in Figure 6-1. With the
exception of the 80~~, yo~ will see that complete microcomputer logic is provided within a single pac!

~

~

~

ex:
a..

~

--

A

"'I

1024 x ,8 Bits
'ROM (8048)
or EPROM
(8748)

0

DO - 07

ex:
.~ a..
0

en

::l

m

-.

Interrupt Request

.----..

System Reset
PROM/Expander strobe
CPU/Memory Separate

Read Strobe
Write Strobe
Test input or Timer output
Test or Event Counter input

-.

-

-...

~ ~

.

A

INT

,..

....
RESET

64 x 8 Bits
RAM

PROG
EA

~

XTAL1

~,

Accumulator

XTAL2
ALE
PSEN

--

......;.,

58
RO
WR

--- --.

--

. Arithmetic and
Logic Unit;
Control Unit
and Instruction
Register

Program
Status Word

,

---

"

~

ex:
0
a..
I--

Single Step

~

"

N

.<=::>

Program Memory Enable

"'V

~

I--

P20 - P27

Address Latch and Clock

f--'\

Program Counter

~

Program
Counter may
be output on
P23 - P20 plus
07 - DO

External Crystal {

.~

~

TO
T1

--

~

Counter /Timer

Figure 6-2. Functional Logic of the 8048.8049 .. 8748.
8749 and 8035 Microcomputers

6-4

Q

w

~
a:
oQ.

a:
o

o

~

en
w
~

All 8048 series microcomputers (with the exception of the 8021) have three 8-bit I/O ports.
For the 8048 series and 8049 series microcomputers, one of these ports, the Bus Port, is a
truly bidirectional I/O port with input and output strobes. Outputs can be statically latched.
while inputs are nonlatching. This means that external logic must hold input data true at Bus Port pins until the data
has been read. All eight pins of the Bus Port must be assigned either to input or output: you cannot mix input and output on the Bus Port.

Bus Port is used as the primary I/O port in a single-chip microcomputer system. In multiple-chip microcomputer
systems Bus Port serves as a multiplexed Address and Data Bus.
.
I/O Ports 1 and 2 are secondary I/O ports with characteristics that differ significantly from Bus Port. If you output
parallel data to I/O Port 1 or 2. it is latched and maintained at the I/O port until you next write data. But the only way
external logic can input data to I/O Port 1 or2 is by pulling individual pins from a high to a low level. Thus when a high
level is being output at any pin of I/O Port 1 or 2. external logic can pull this level low - and subsequently if the ~PU
reads back data from the I/O port it will read a bit value. This may be illustrated as follows:

a

g

CPU

CI)
CI)

c(

(2)

o!I
w
Z

External Logic

I/O Port
output

11110101 ----------I.~11110101

~

a:

oa1

Pull one pin low

,>--'-

CI)

0

- - 2

o

11010101

~

c(
Q
c(

CD

@

input

11010101 ..........- - - - - - - - - 11010101

External logic cannot create a high level at any pin of I/O Port 1 or 2 which is outputting a .Iow level.
Here is a summary of I/O Port 1 and 2 capabilities:

1)

You can at any time output parallel data to I/O Port 1 or 2. The data will be latched and held until the next output.

2). Individual pins of I/O Ports 1 and 2 can serve as input or output pins. When you output data to I/O Port 1 or 2. you
must output a 1 bit to any input pill. This may be illustrated as follows:
Data Output

X 1 1 X X 1 X 1 (x.;. 0 or.1)

7

6

5

4

0

I

1.1 01

0

I I
3)

--+

3

2

1

0

0

I

0

I

I I I I

~Bit

No.

~ I/O Port 1 or 2 (0 = Output. I = Input)

External logic writes to input pins of I/O Ports 1 and 2 by leaving low levels alone. and by pulling high levels low.

Figure 6-3 illustrates logic associated with each pin onto Ports 1 and 2 in all 8048 series
microcomputers.

Output data is latched by a Ootype flip-flop.

8048 SERIES
I/O PORT
PIN LOGIC

The Q and Q outputs of the Ootype flip-flop control a pair of gates on either side of the pin connec. .
tion. To provide fast switching times in 0-to-1 transitions. a relatively low impedance (~5K ohms) is switched in for approximately 500 nanoseconds whenever a 1 is output.

6-5

+5V

+SV

ORl.ANl--------------~

=50Kfl
INTE:RNAl ---4~"" D

Q 1-......---4

BUS

D
FLIP
FLOP

I/O PIN
PORT 1 AND 2·

QI---+-------"""1

elK
WRITE -~--f---~
PULSE

__- - -...

IN--------....I

INPUT BUFFER

Figure 6-3. 8048 I/O Ports 1 and 2 Pin Logic
Pins are continuously pulled upto +5V through a relatively high impedance (-50K ohms). When a 0 is output to the
D-type flip-flop. a low impedance (-3K ohms) overcomes the pull-up and provides TTL current sinking capability.
When a 'pin of I/O Port 1 or 2 is at a high level. external logic can sink the 50Kfl. pull-up. But when the pin is at a low
level. external logic cannot overcome the low impedance to ground; thus it cannot pull the pin up to a high level.

By placing an input buffer between the pin and the switching gates. pin logic allows the CPU to read current levels induced by external logic - but only while external logic is connected to the pin.
The buffer connecting the Q output of the D-type flip-flop to the D input is present to enable 8048 instructions that
mask I/O port data.
Later in this chapter we will iook at I/O ports in more detail. showing programming and design examples.

6-6

8048, 8748 AND 8035 MICROCOMPUTER PROGRAMMABLE REGISTERS
The 8048 series microcomputers have an 8-bit Accumulator, a 12-bit Program Counter and 64 bytes of
scratchpad memory. Scratch pad memory may be visualized either as read/write memory or as general purpose
registers.
c

The Accumulator, Program Counter and scratch pad memory may be illustrated as follows:

w

~
a:
o
D.

8 Bits
~

a:

o

CJ

~

enw

~
(3
o
CI)
CI)

c(

a!I

w
Z

02

R3
R4

03

General Purpose

04

Registers

R5

05

R6
R7·

06

a:

50 {
51 {

o

01

R2

CI)

oIII

00

RO1
Data Counters { R

09
OA
OB

~

c(

OC

cc(

52 {

@

53 {

00
OE
OF
'-0
11
12

54 {
55 {

5tack

13
14

56 {

15
16

57 {

17
18

Data Counters { RO'
Rl'
R2'
R3'

1B

Alternate General

R4'

1C

Purpose Registers

R5'

10

19
1A

R6'

1E

R7'

1F
20

·••
~'O

••

l3eneral 5cratchpad

3E
3F

~-t-t-"I-~I~-t-t-t-"I-..,..-r-..,.-"I

8-bit Accumulator
12-bit Program Counter "'........_ ' - - - " _..........._

6-7

............_

.............................

The Accumulator is the principal conduit for all data transfers. The Accumulator is' always one source and the
destination for Arithmetic or Boolean operations involving memory or registers.
Two sets of eight scratchpad bytes serve as secondary registers. At any time one set of general purpose registers
is selected while the other set of general purpose registers is not selected.
The first two general purpose registers of each set, RO and R1, act as Data Counters to address scratchpad
memory and external data memory. Thus you address scratchpad memory using implied memory addressing via
general purpose Register RO or R1: you can address anyone of the 64 scratchpad bytes. including the general purpose
registers. or even the Data Counter register itself.
In between the two sets of eight general purpose registers there is a 16-byte stack. The Stack Pointer is maintained in the Program Status Word: therefore we will defer our discussion of stack operations until we look at status.

8048 SERIES ADDRESSING MODES
The 8048 series microcomputers separate memory into program memory and data memory.
Without resorting to complex expansion schemes, you are limited to a maximum of 4096
program memory bytes and 320 data memory bytes.

8048 SERIES
MEMORY
SPACES

The 8048 and 8748 microcomputers have 1024 bytes of program memory on the CPU chip. The
8049 microcomputer has 2048 bytes of program memory on the CPU chip. More program memory. if present. must be
external to the CPU chip. The 8035 microcomputer has no on-chip p'rogram memory: it requires all program memory to
be external.
All 8048 series microcomputers provide 64 bytes of read/write data memory on the CPU chip. In addition. 256 bytes of
external data memory may be addressed. The external data memory space must be shared by external data memory and any external 1/0 ports - that is to say. I/O ports other than the microcomputer's own three I/O ports or 8243
Expander ports.
8048 series microcomputer address spaces and addressing modes are illustrated in Figure 6-4.
Let us first examine program memory addressing.
8048 SERIES
A single address space is used to access all of program memory. In the normal course of events
program memory is addressed via the 12-bit Program Counter. The high order Program
PROGRAM
Counter bit is isolated in Figure 6-4 because when the Program Counter is incremented only
MEMORY
ADDRESSING
bits 0 through 10 are affected. You must execute special instructions to modify the contents of
the high order Program Counter bit. Program memory is therefore effectively divided into two
memory banks. each containing up to 2048 bytes of program memory. You cannot branch. via Jump-on-Condition instructions. from one program memory bank to the other. nor can instructions stored in one program memory bank
directly access the other. You can switch completely from one program memory bank to the other by preceding a JMP.
CALL or RET instruction with a SEL MB instruction.
Two types of program memory addressing are available: you can read data from program memory and you can
execute Jump instructions.
You can unconditionally jump anywhere within the currently selected program memory bank: this may be illustrated as
follows:
These bits
replaced

PC

~~--------~~~------~"-

PROGRAM
MEMORY

Arbitrary
Memory
Address
010A

11000100
10111010

010B} JMP instruction
object code
010C
0100

06BA
06BB

New Address

06BC
06BO

6-8

Program Memory

0000
On 8048, 8748
and
8049 Chip

c

w

~
a:
oa..

Memory
Bank 0

03FF
0400

a:
o
u

I
I
I

~

enw

07FF

g

0800

11 : 10

~

,

r

On 8049
Chip

IA
9

8

7

6

5

4

3

2

I I I
........

0

I PC

S

CI)
CI)

~

#'"

~

w
Z

a:

o

Memory
Bank 1

OBFF
OCOO

al
CI)

o

~
~

c

OFFF _ _ _ _ _--'

~

@
00 ...- - - -.....

7

6

4

3

2

0

I I I I I I I I I:~

External
Data Memory

FF _ _ _ _ _..... /

00 ...- - - -.....
On Chip
Scratchpad
Memory
3F _ _ _ _ _ _J
A = Accumulator
PC = Program Counter
RO, R 1 are general purpose registers
in scratch pad memory

Figure 6-4. 8048 Series Microcomputers' Memory Addressing

6-9

Thus the JMP instruction stored in program memory bytes 010B16 and 010C16 causes program execution to jump to
location 06BA16.
You can also jump using a form of paged. indirect addressing. where the Accumulator points to an indirect address
stored in the current page of program memory. This may be illustrated as follows:
Arbitrary
Memory
Addresses

Program
Memory

t - - - - - I 013A
t - - - - - I 0138
Accumulator _ _......r------::::::::=--I'1-~C~8~..J 013C
I---...-.t
t - - -........

Program
Counter

I

1

~._

I

•

I

I

0130
013E

3 ~~::

~

58
....._ _...

~

I

I

I

I

0150

01CA

___J----~ 01C8
t-----f

...-JMPP@A

015C

~Jump here

01CC
01CO

All conditional Jump instructions allow you to branch within the current page of program memory only. This may be illustrated as follows:
Arbitrary
Memory
Address

Program
Memory

~~__--_~..II------fl ~ ~ _
P

I

I

J,mp he"

I . I

I

~

rogram A
AD
Counter ..._~._ _--'.

I

OAA8
I---...-.t
F6
OAAC}
I----...-.t
JC instruction

-----------t__12~C~OAAO
I---...-.t

condition is rriet

6-10

OAAE

You cali ~ead data from program memory, but there are no instructions which allow you to write data to program
memory. Instructions (other than immediate instructions) that read data from program memory use paged, implied addressing. There are two forms of paged, implied programming memory addressing; they may be illustrated as
follows:
.

cw

Arbitrary
Memory
Address,

a:

01AA

u

MOVP A,@A01ASI---_A_3_-t

~
a:
oa..

o

Program
Memory

Program
Memory
Program Counter
1------1

1----1
E3

1-------1

~
u)
w

1-----1
1-----1

~
U
o
en

Arbitrary
Memory
Address
01AA
01AS MOVP3 A,@A
01AC
01AD

en
oCt

clJ

013E

w

Z

o13F 1----.;.4;..;A_-I

o

0140

a:

III

en

1------1

1-----1

4A

1-----1

033E
033F

t - - - - - I 0340

1------1

o

~

oCt
oCt

C

@

The illustration above compares execution of the MOVP and MOVP3 instructions. These are the two instructions which
allow you to read a byte of data from program memory into the Accumulator. Both instructions load 4A into the Accumulator, as illustrated above.
When the MOVP instruction is executed, the program memory address is formed by concatenating the high-order four
bits of the Program Counter with the contents of the Accumulator:
Program Counter (X

' P

Q

f

When the MOVP3 instruction is executed, the program memory address is computed by appending the Accumulator
contents to 0011:

~ Accumulator
I

I

3

I

I

I

I

I

P

Q

I} Program Memory Address

Thus the MOVP instruction loads into the Accumulator the contents of a program memory byte within the current program page. The MOVP3 instruction loads into the Accumulator the contents of a byte from program memory page 3.
Note carefully that paged addressing of program memory carries with it the usual page boundary problems. The
program memory addressing modes which replace th·e low-order eight Program Counter bits keep the four high-order
Program Counter bits - after the Program Counter has been incremented.
.
Refer back to the JMPP @A instruction. This instruction is illustrated as being stored in program memory location
015B16. But suppose this instruction were stored in memory location 01 FF16; then after the JMPP ins~ruction is
fetched, t~e Program Counter will no longer contain 01 FF16, it will contain 020016. Now instead of jumping to program memory location 01CB16, you would jump to program memory location 02CB16.
This page boundary problem is common to all microcomputers that use absolute paged addressing. For a complete discussion of this problem refer to Volume I - Basic Concepts, Chapter 6.

6-11

Note that the 8048 has no instructions which write into program memory. If you want to write into program
memory you must have external logic which overlaps external program and data memory.
Let us now look at data memory addressing. First of all. notice that scratchpad memory and external data memory
have overlapping address spaces. Separate and distinct instructions access scratchpad memory as against external
data memory. External data memory does not represent a continuation of scratchpad memory. For example. there will
be memory bytes with addresses in the range 0016 through 3F16 in the scratchpad and in external data memory.
Implied memory addressing is the only addressing mode available to you when accessing data memory.
Instructions that access scratchpad memory take the scratchpad memory byte' address from the low-order six bits of
General Purpose Register RO or R1.
Instructions that access external data memory take the external data memory address from all eight bits of General Purpose Register RO or R1.
The eight general purpose registers within scratchpad memory can be addressed directly. We could argue that this
constitutes a limited scratchpad memory direct addressing capability: but in order to remain consistent with other
microcomputers described in this book. we will classify these direct accesses of general purpose registers as registerto-register operations rather than direct addressing of data memory.

A PROGRAM MEMORY MAP
The instruction set of the 8048 microcomputer is designed to allocate the on-chip program memory as follows:
3FF
} Data Tables
300
2FF
200
1FF

} Pro9"""

100
OFF;

:

.

007 ~ l

interrupt calls subroutine
r Ti~~r
ongmed here

003

000

~

} External interrupt calls subroutine
origined here

t
f

R~s~art calls subroutine
ongmed here

The MOVP3 instructions assume that the 256 byt~s of program memory with addresses 30016 - 3FF16 have been set
aside to hold tables of constant data.
Interrupt logic (which is described later) uses low memory locations O. 3 and 7 to origin interrupt service routines that
will be executed in response to a restart. an external interrupt or a timer interrupt. Jump instructions will normally be
located in these low program memory locations.

6-12

8048 SERIES STATUS
8048 series microcomputers have an 8-bit Program Status Word which may be illustrated as follows:
- - - - - - - - - - - - T h e s e four bits saved on Stack

~
j-'

cw

7

~
a:

6

5; 4: j

o -:4-- Bit

2

No.

r--P--~~~--~~--~~

Program Status Word

~

a:

o

(J

~

en
w

' - - - - - - - Stack Pointer
bank select
o = Scratch pad bytes 0-7 selected
1 = Scratch pad bytes 18-1 F selected

~

'----'---~----- Register

g
en
en

' - - - - - - - - - - - - - FO, software flag
' - - - - - - - - - - - - - - - A C , Auxiliary Carry
C, Carry

ct
clJ
w
Z

L----------______

a:

o

III

en

o

~

ct
C
ct

@

C and AC are the standard Carry ~nd Auxili~ry Carry statuses as defined in Volume I and used throughout this
book.
FO is a flag ~hich you set or reset using apprd~riate Status instructions. A conditional Jump instruc!ion tests the
level of Fa. Fa is not connected to external logic and cannot be modified or tested by external logic.
BS identifies which set of gen~~al purpose registers is currently selected. If BS is 0, then scratchpad byte~ a
through 7 are serving as general purpose registers. If BS is 1, then scratchpad bytes 1816 through 1F16 are serving as
general purpose registers.
The low-o~der three Pro~ram Status W~rd bits serve as a Stack Pointer. The 16 Stack bytes are treated as eight
16-bit registers, with the current top of Stack identified by the three low-order Program St~tus Word· bits.
A subroutine Call instruction pushes the Program Counter contents and the four high-order Program Status
Word bits onto the Stack as follows:

Program
Counter

I

P

Scratchpad
Memory

o .4--Bit No.

11

P

P

P

Q

Q

,0

Q

R

R

R

R

I

QQQQRRRR
SSSSPPPP

o .--SitNo.

7

PSW

Is

S

S

S

X

X

Lowest
Scratchpad
Address

jxxx
xxx+ 1

xi
7

In the illustration above. P. Q. R. S and X represent any binary digits.

6-13

o ...-Bit No.

T

Highest
Scratch pad
Address

Observe tHa~ the begirlhing of the Stack has the lowest scratchpad address. The order in which Program Status Word
.
and Program Counter contents are pushed onto the Stack is illustrated above. Here is a specific case:

000

PSW

{

001 ~

PC

Fl!1I

07

Full

08 ....-Beginning of Stack

Full

09

Full

OA

4A

OB

72

oc·

010 ~

12

-------G1

OD

<

OE
OF

100

10

;,

: !'

You need to know the exact order ih which data is stored Qn the Stack since the Stack is also accessible as general
scratch pad memory.
.
There are two ReHjrn-from~Subroutine instructions; one restores Program Counter contents only. the other restores
. Program Counter ~~d Program Status Word contents.
Since the Stack has eight 16-bit registers. subroutines may be nested eight deep. If you are using interrupts. thEm the
combined t6tal G,t sutHbutine nesting levels on either side of the interrupt must sum to 7 or less. For example. if the interrupt service' routine nests subroutines .t6 a maximum level of 3. then non-interrupt programs cannot nest
subroutines to a level greater than 4. The interrupt itself requires one Stack location.

8048 SERIES MICROCOMPUTER OPERATING MODES
8048 series microcomputers can operate in a variety of modes. Many signals serve more than one function, depending on the operating mode.
. ,
.
In order to clarify this potentially confusing' subje'ct, w'e will summarize 8048 series operating modes in the
para'graphs below, then we will summarize' deVice signals; these two summaries are followed by an in-depth
anaiysis of operating modes, illustrating timing and signal fUhctions.
IntEnnal execution'mode is the simplest case; .the _8048 ~eries microcomputers normally
operate in Internal Execution mode, at which time they execute programs without accessing external program memory or data memory. All iriformatio~ transfer with external logic occurs via. I/O ports or control signals. The 8035. having no i'nternal program memory. cannot operate in Internal Execution mode.
Expandable 8048 series microcomputers can access e)(ternal program and data memory. Having
exter.nal,program memory and/or data memory causes the ri1icroco~puter to output additional
control signals which identify extern'al program and data memory accesses. This is External
Memory Access mode. Memory addresses are output via the Bus Port and four pins of I/O Port 2;
bidirectional data transfers occur via the Bus Port. This may be illustrated as follows:
P20 - P23

....

.

8048
. 8748
8035

,;.
...

DBO - DB7

Address Bus

Jo..

}
) Data Bus

..

-;,
..,.

:.

6-14

RD
WR

PSEN
ALE

} Control B"

8048 SERIES
INTERNAL
EXECUTIOr,;
MODE
8048 SERIES
EXTERNAL
MEMORY
ACCESS MODE

External Memory Access mode represents the simplest case for the 8035 microcomputer. which has no on-chip program memory.

cw

The 8048 series microcomputers can be operated in Debug mode. In Debug mode the CPU is
disconnected from its internal program memory. All program memory accesses are deflected to
external program memory. This may be iliustrated as follows:

8048 AND
8748 DEBUG
MODE

t-

<
a:

0000

0

0.

a:
0

0

~

enw
t-

<

Internal
Program
Memory

External
Debug
Memory

(3
0

CI)
CI)

<

-

""

w
a:

03FF

..

Z

0

III
CI)

0

0400

:!!

c<
<

External
Program
Memory

@

OFFF

Since the 8035 has no internal program memory. it is always in "Debug mode."
You will use Debug mode to test microcomputer systems built around an 8048 series microcomputer. Typically. special
purpose test and verify programs will be maintained in external debug memory.
Single stepping is not really a mode, but is worth mentioning in connection with Debug
mode since it is a powerful debugging tool. In any of the operating modes you can apply a
Single Step signal (SS) which halts instruction execution following the next instruction fetch. This
allows you to execute programs one instruction at a time in order to locate errors or gain a better
understanding of event sequences.
The 8748 microcomputer contains Erasable Programmable Read Only Memory (EPROM). In
Programming mode you can program the EPROM.
Finally .. there is a Verify mode. In Verify mode you can read the contents of internal or external program memory as data. Verify mode is used in conjunction with Programming mode
to test data written into EPROMs. Verify mode can also be used on its own to examine the contents of program memory for any 8048 series microcomputer.

8048 SERIES
SINGLE
STEPPING

8748'
PROGRAMMING
MODE
8048 SERIES
VERIFY MODE

8048 SERIES MICROCOMPUTER PINS AND SIGNALS
Figure 6-5 illustrates pins and signals for the 8048 series microcomputers. We will briefly summarize functions
performed by signals before discussing how signals are used in different modes.
DBO - DB7 serves both as a bidirectional 1/0 port and as a multiplexed Address and Data Bus. When no external
data or program memory accesses are occurring. OBO - DB7 serves as a simple bidirectional I/O port or latch. During
external program or data memory accesses. DBO - DB7 serves as a bidirectional Data Bus as well as outputting the loworder eight bits of all memory addresses. Data inputs are not latched in bidirectional mode. External logic must hold input signal levels until the CPU has read input data.

6-'5

TO
XTAL1
XTAL2
RESET
SS
INT
EA

AD
PSEN
WR
ALE
DBO
DB1
DB2
DB3
DB4
DB5
DB6
DB7
(GND) VSS

1
2
..
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

8048
8748
8035

VCC (+5V)
40
.T1
39
P27
38
37 ...t--~~26
36 ...t--~P25
P24
35
34 .....1--~P17
P16
33
32 .....1--~P15
31 .......__~P14
30 .....I--~ P13
P12
29
28 .......--~P11
27 ....1--~P10
26
VDD
PROG
25
24 .....I--~ P23
P22
23
.~2 ....1--~P21
21
P20

PIN NAME

DESCRIPTION

TYPE

DBO - DB7

Bidirectional I/O port, Data Bus and
low-order eight Address Bus lines
I/O Port 1
..
I/O Port 2. P20 - P23 aiso serves as four \
high-order Address Bus lines
External clock signal and address
iatch enable
Data merllory read control
DatcLmemory write control
External program memory read control
External program memory access
Single step control
Interr·upt request
Test input, optional clock output
a~d. Program/Verify mode select
Test input, optional event counter input
System reset and EPROM address latch
Ground
+5V
+ 25V to,program 8748. + 5V standby·
for 8048 RAM
+ 25V input to program 8748. Control
output for 4-bit I/O
External crystal connections

Bidirectional, tristate

pio - P17
P20 - P27

ALE

fill
WR

PSEN
EA
SS
INT
TO
T1
RESET

VSS
VCC
VDD
PROG
XTAL1, XTAL2

Ouasibidirectional
Ouasibidirectional
Output
Output
Output
Output
Input
Input
IrJput
Bidirectional
Input
Input

Bidirectional

Figure 6-5. 8048. 8748 and 8035 Microcomputer Pins and Signals

6-16

P10 - P17 and P20 - P27 support I/O Ports 1 and 2, respectively. We described the characteristics of these two 1/0
ports earlier in this chapter. During external accesses of program memory the four high-order address lines are output
via P20 - P23.

Q

w

~
o
D.

ALE is a control signal which is pulsed high at the beginning of every instruction execution machine cycle. This
signal may be used as a clock by external logic. During external memory accesses. the trailing edge of ALE strobes
memory addresses being output.

a::

RD is a control signal which is pulsed low to strobe data from external data memory onto the Data Bus ..

a::

WR is a control signal which is strobed low when external data memory is to read data off the Data Bus.

o

PSEN is a control signal which is strobed low when external program memory is to place data on the Data Bus.

en
w

External logic inputs EA high in order to separate the CPU from internal program memory and force the microcom.
puter into Debug mode.

U
o
en
en

SS is input low in order to stop instruction execution following an instruction fetch: this allows you to singie step
through a program.

o

~

~

oct
~

w
Z
a::
m

o

en

o

~

oct
Q
oct

@

INT is the input for external interrupt requests. If the interrupt is enabled. a low input at INT causes a subroutine call
to program memory location 3 when the current instruction finishes execution.
TO is a test input which may be sampled by a conditional Jump instruction. TO is also used while selecting External
Program mode and Verify mode. The internal CPU clock signal can be output via TO.
T1 is a test input which can be sampled by a Jump-on-Condition instruction. T1 can also be used to input a signal
to Counter/Timer logic when it is serving as an event counter.
. RESET is a standard system reset input signal. The normal RESET signal should be output from
an open collector or active pUll-up:

8048,8748
AND 8035
RESET

~Vcc

~

1K

------------~~------------~l~------RESIT
The power-on RESET should be generated as follows:

r-----------~~C~----------~~----------_o~------RESIT

1Kil

::r:

1p.F

10V

There is an internal pull-up resistor which. in combination with an external 1~F capacitor. generates an adequate internal RESET pulse. If the RESET pulse is generated externally. then it must be held below 0.5V for at least 50 milliseconds.
This is what happens when you reset an 8048 series microcomputer:
1)

The Program Counter and the Program Status Word are cleared. This selects register bank 0 and program memory
bank O. Also. the first instruction executed following a Reset will be fetched from program memory location O.

2)

The Bus Port is floated.

3)

1/0 Ports 1 and 2 are set to Input mode.

4)

External interrupts are disabled.

5)

The counterltimer is stopped and TO is disconnected from the timer.

6)

The timer flag and internal flags F1 and FO are cleared.

6-17

An external crystal, if present. is connected across XTAL 1 and XTAL2. Typically a 6 MHz crystal will be used. You
can input a clock signal directly to XTAL 1. If you do. the input clock signal should have a frequency in the range of 1
MHz to 6 MHz. or 11 MHz for the 8049.
The 8048 series microcomputers use power supplies in a number of interesting ways.
Vee is the standard +5V power supply. VSS is the standard ground connection.
VDD is .an additional +5V standby power supply. This standby power supply will maintain the contents of
scratchpad memory when all other power has been removed. Typically VDD will be connected to a battery so that
when the system is powered down data can be preserved in scratchpad memory (8048 .. 8035l and 8049 only).
The 8748 and 8749 microcomputers use VDD and PROG in order to program the EPROM. While programming the
EPROM. a voltage of +25V is input at VDD. +25V pulses lasting 50 milliseconds are input at PROG. A single byte of
program memory will be written during a Single PROG +25V pulse.
PROGserves as a control strobe output to the 8243 Input/Output Expander during the execution of instructions
that reference the Expander ports. This function of PROG is described in more detail later in this chapter. when we describe the 8243 I/O Expander.

8048 SERIES TIMING AND INSTRUCTION EXECUTION
Let us begin our detailed analysis of 8048 series microcomputer operations by looking at basic instruction timing.
A master clock signal must be input via XTAL 1, or the clock signal may be generated internally by connecting a
crystal across XT Allor XT Al2. A 6 MHz crystal is recommended. This clock signal is divided by 3 to generate a
master synchronizing 2 MHz signal which is used throughout the microcomputer system. You can output this 2
MHz clock signal via the TO pin.
All -8 versions of 8048 series microcomputers operate at half speed; they use 3 MHz crystals and generate a 1
MHz master synchronizing signal.
InstriJctions execute in machine cycles. Every machine cycle has five clock periods.
Using a 2 MHz clock signal. therefore. each machine cycle will last 2.5 microseconds. Instructions execute in either one or two machine cycles.

INTERNAL EXECUTION MODE

8048 SERIES
MACHINE
CYCLES AND
CLOCK PERIODS

Figure 6-6 illustrates timing for the simplest case - execution of a single machine cycle instruction accessing internal program or data memory only. The only signal change seen beyond the microcomputer
chip itself is the ALE pulse - and the elK Signal. if you elect to output it via TO. The events which occur during each
clock period are illustrated in Figure 6-6; but remember. these operations are internal to the microcomputer. They are
beyond you r access or control.
Figure 6-6 also illustrates timing for instructions that execute in two machine cycles. but access only program and/or
data memory internal to the microcomputer chip. Once again external logic sees ALE. and optionally elK.

6-18

MCl

MCl

Tl

T5

Tl

T5

c

w

~
II:
oa..

(TO) ClK

II:

o(.)
~

ALE

en
w
~

<
(3
oCI)

Output instruction address

Increment PC,
Execute instruction

CI)

<
~

w

Decode instruction
Input instruction

Z

II:

oaI

Decode instruction

CI)

o

~

<
C

Figure 6-6. Execution of 8048 Single Machine Cycle Instructions
without any External Access

icept Resed are disabled until an RETR instruction is executed. Within an Externaior Timer interrupt
service routine you cannot'enable interrupts under program control. This maybe a problem if you are using the
timer and external interrupts in timer sensitive applications. If execution time for an external interrupt's service routine
extends over more than one counterltimer time out. then you will fa!! to detect one or more time outs. The simplest way
of resolving this problem is to make sure that your External interrupt 'service routines are very stiort - executing in 75%
of the counterltimer interval. or less. If this is not feasible. then you must monitor the counterltimer by testing its time
out flag rather than by using counterltimer interrupt logic. You can execute the JTF conditional Jump instruction at
frequent intervals within the main program and interrupt service routines. thus catching time outs irrespective of when
" "
,
they occur:
You cal"! re-enable interrupts within an interrupt service routine by executing a dummy RETR instruction. Here is
an appropriate instruction sequence:
START OF INTERRLJPT SERVICE ROUTINE

CALL
EN .
EN

ENAB
I
TCNTI

;RE-ENABLE INTERRUPTS

END OF INTERRUPT SERVICE ROUTINE
ENAB
RETR
En~bling i"terrup~s within a service routine, as illustrated above, is not recommended in' an 8048 microcomputer

system.
Two problems need to be resolved when using external interrupts in an 8048 series microcomputer system: an
interrupt acknowledge must be created, and in muitiplf! interrupt configurations we must be able to identify the
interrupting source. '
8048 series microcomputers have no interrupt acknowledge signal. An interrupt acknowledge signal must be created;
otherwise external logic does not know when to remove its interru'pt request. And if the interrupt request remains after
an RETR instruction executes. the interrupt will be reacknowledged. The only straightforward way of acknowledging an interrupt is to assign one of the I/O port pins to serve as an interrupt acknowledge signal. The extern'al interrupt service ro~tine will begin by outputting an appropriate low pin signal. Here is one possibility: '
ANL
ORL

P1.#7FH
P1.#80H

;RESET PIN 7 OF I/O PORT 1 LOW
;SET PIN 7 OF I/O PORT 1 HIGH

Here. the output at pin 7 of

Va Port 1 is a low pulse with a duration of two machine cycles (5.0 microseconds).

But remember. if you us~ an
I/O operations, '

!f0 port pin as an interrupt acknowledge. you cannot use the same pin to perform standard

6-28

lACK
(p17)

IACKO

P10

cw

.------+------+-----~------~----~------~----~~~17

9318
or
74148

!ia:
oQ.
a:

10

o(J
!:

P11

P12

en
w

!i

g
(/J
(/J

<
01:1

w

Z

a:

o

In
(/J

o

t----------!~ INT
to CPU

~

<
c
<
@

Figure 6-13. An Eight-Device Daisy Chained Interrupt Request/Acknowledge Scheme
If there are many external devices which can request interrupt service. then the most effective way of handling multiple
interrupts is via a daisy chain. Daisy chain logic has been discussed in Volume I - Basic Concepts. The acknowledged
device in the daisy chain must create a device code that is input to an I/o port. Figure 6-13 illustrates a scheme
whereby eight devices in a daisy chain may request interrupt service, and upon being acknowledged, the
selected device will input a unique code to I/O Port 1. The high-order bit of I/O Port 1 serves as an interrupt
acknowledge. I/O Port 1 bits O. 1 and 2 receive as inputs a 3-bit code identifying the acknowledged device.
.
The daisy chain logic in Figure 6-13 is created using a chain of eight AND gates and eight NAND gates. The AND g~tes
are chained in order of priority. with INTO h'aving the highest priority and INT? having the lowest priority. The first
NAND gate receives as its inputs INTO and the acknowledge signal output via pin? of I/O Port 1. Subsequent NAND
gates receive as their inputs an interrupt request signal. the acknowledge signal and the output of the previous AND
gate. The output of each NAND gate becomes an interrupt acknowledge signal which is low-true. Thus in Figure 6-13
there are eight low-true interrupt requests. represente~gnals INTO through INT? and there are eight low-true interrupt acknowledges. represented by IACKO through lACK? Each external device capable of requesting an interrupt
must output a low-true INTn which it removes upon receiving a low-true IACKn. For device 3 this may be illustrated as
follows:
'

------~_\--------;j

I

The eight interrupt request signals INTO through INT? are input to an AND gate. The AND gate generates a master lowtrue interrupt r.equest. INT. If anyone or more of the INTn signals are low. then the AND gate will output a low INT.
The eight interrupt acknowledge signals IACKO - lACK? are input to an 8-to-3 Decoder. The 8-to-3 Decoder will receive
seven high signals and one low signal. The one low signal will be identified by the decoder 3-bit output which is
transmitted to pins O. 1 and 2 of I/O Port 1.

6-29

This then is the event sequence associated with an interrupt request:
1)

INT is input low to the 8048.

2)

The interrupt is acknowledged by the CPU. which branches to an interrupt service routine.

3)

The first instruction of the interrupt service routine outputs a low level via pin 7 of I/O Porr1.

4)

The interrupt ser~ice routine receives back. via pins O. 1 and 2 of I/O Port 1. the device code for the acknowledged
device. You must make sure that the program being executed gives external logic time to return this code. You
may have to insert No Operation instructions to create the necessary time delay.

5)

A high level is output via pin 7 of I/O Port 1.

6)

Using the code input via pins 0.1 and 2 of I/O Port 1. branch to the appropriate interrupt service routine.

Here is the initial instruction sequence required by the logic of Figure 6-13:
ORG
3
;START OF INTERRUPT SERVICE ROUTINE
JMP
EXTINT

ORG
ANL
NOP
IN
ORL
ANL
JMPP

EXTINT
P1.#7FH
. A.P1
P1.#80H
A.#7
@A

;SET I/O PORT 1 PIN 7 LOW
;ALLOW SETTLING TIME
;INPUT PORT 1 CONTENTS
;SET I/O PORT 1 PIN 7 HIGH
. ;CLEAR ALL ACCUMULATOR BITS BAR O. 1 AND 2
;JUMP TO IDENTIFIED INTERRUPT SERVICE ROUTINE

Let us examine the interrupt service routine begInning instruction sequence illustrated above.
When an 8048 series microcomputer is initially reset. all I/O port pins output high levels. Thus you do not have to in~
itialize pin 7 of I/O Port 1 to a high level.
We actually identify one of eight device interrupt service routines by creating a 3-bit code in bits 1. 2 and 3 of the Accumulator. We then perform an-indirect Jump. This Jump instruction will branch to a location on the current page of
program memory; the address is fetched from the location in the current page addressed by the Accumulator contents.
We illustrated this addressing technique earlier in the chapter.
Given the instruction sequence illustrated above. the first eight program memory locations on the same page as the
JMPP instruction must be set aside for eight addresses; these are the starting addresses for the interrupt service
routines. This may be illustrated as follows:
.
-

EXTINT

ORG
DB
DB
DB
DB
DB
DB
DB
DB
ANL

#0300H
ISO
IS1
IS2
IS3
IS4
IS5
IS6
IS7
#7FH

;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;ADDRESS OF INTERRUPT SERVICE
;SET I/O PORT 1 PIN 7 LOW

ROUTINE
ROUTINE
ROUTINE
ROUTINE
ROUTINE
ROUTINE
ROUTINE
ROUTINE

0
1
2
3
4

5
6
7

The daisy chained interrupt scheme discussed above can also be implemented using the circuit in Figure 6-14.
The advantage of this circuit is that it requires fewer chips than the circuit of Figure 6-13. As far as the 8048
program is concerned, however, the two circuits are identical.
'
The INT and device code inputs are generated in exactly the same way. However. an eight-line-to-three-line priority encoder (9318 or 74148) replaces the network of AND gates. As the function table for the encoder shows. the device code
output on lines A2. A 1 and AO is that of the highest priority request. The CPU enables the code outputs by sending the
acknowledge signal.

-6-30

IT

iAcKIP171

cw

!;i
a:

a:

GiA

ii,

CiS

,~

16

rue

EO

Gl

~

~

iNTi

jj

CJ

~

YO

745138

or

or

74148.

74LS138

i2

INT5
INT6
INT7

o

9318

14'

INT3

o
a.

'---

iNTo

C
B
A

A2

IT
iO

AI
AO

enw

VI
Vi

Y3
Y4
Ys
Ys
Y7

!;i

g

-

...

'---

en
en

.

'---

<

.---

~

G/J
w
Z

......J

a:

Pl0
Pl1
P12.

iNT

to CPU

o

III

en

o

~

<
c
c(

@

74LS138. 745138

9318. 74148 FUNCTION TABLE.

FUNCTION TABLE

INPUTS
OUTPUTS
ENABLE
Gl

G2°

C

B

A ,YO

X

H

L
H
H
H
H
H

X

X
X

X
X

X
X

L
L
L

L
L
H
H
L

H
H
H

L
L
L

L
L
L
L
L

OUTPUTS

INPUTS

SELECT

L
H
H
H
H

L
H
H

om = G2A v G2a

H
L

H
H
L
H
H
H
H

H
L
H

H
H
H

L
H
L

VI Vi Y3 Y4 Ys Y6
H
H
H

H
H
H

H
H
H

L

H

H
H
H

L
H
H

H
H
H

H
H
H

H
H
L
H
H
H
H

H = high level.

H
H
H
H

H
H
H
H

H
H
H
H

H
H
L
'H

H
H
H

H
H
H

L
H
H

H
L
H

H
H

L = low level.

y:; B iO i1 12 i3 i4 is 16 i7
H
H
H

H
L
L

H
H
H
H
H
H
L

L
L
L
L

A2

AI

AO

Gs

EO
H
L
H
H
H
.H
H
H
H

X

X

X

X

X

X

X

X

H

H

H

,H

H
X
X
X
X
X
X
L
H

H

H
X
X

H
X
X

H
X
X

H
X
L

H
L
H

H
L
L

H
L
H

H
H
L
L

X
L
H

L
H
H

H
H

H
H

H

X
X

X
X
L

H
L
L
L

L
H
H

H
H
H

H
H
H

H
H
H

H
H
H
H

H
H
H
H

L
H
H
H
H

H
L
L
H
H

L
H
L
H
L
H

L
L
L
L
L
L

L
L
L

X
X
X
X
X
X
X
L

X
X
X

H

X = irrelevant

Figure 6-14. A Low Chip Count Implementation of an Eight-Device Daisy Chained
Interrupt Request/Acknowledge Scheme
In Figure 6-13. a network of NAND gates generated the low-true interrupt acknowledge signal to inform the appropriate device that its interrupt was being serviced. In Figure 6-14. a three-line-to-eight-line decoder (745138 or 74LS138)
translates the device code output by the encoder and sets the corresponding acknowledge line low. as is shown in the
function table for the decoder.
Connecting the enable inputs as shown prevents spurious acknowledgements or phantom device codes. provided that
the CPU gives the external devices time for response and propagation delay.

6-31

THE 8048 MICROCOMPUTER SERIES
INSTRUCTION SET
Table 6-2 summarizes the instruction set for the 8048 series microcomputers. Instruction object codes and timing are given in Table 6-3. This instruction set reflects the specific architecture of 8048 series microcomputers. For example. there are separate I/O instructions to access the three on-chip I/O ports. as against 8243 Input/Output Expander
I/O ports. Also. there are separate instructions to access on-chip scratchpad read/write memory. as against external·
data memory.
The 8048 instruction set is probably more versatile than any other one-chip microcomputer instruction set described in this book. The only omission that may cause problems is the lack of an Overflow status; this will make
multibyte signed binary arithmetic harder to program.

THE BENCHMARK PROGRAM
The benchmark program we have been using in this book is not realistic for the 8048 with its limited data memory.
Using the 8048 you would not load data into some general depository. then transferit to a specific data table.
In order to provide some illustration of 8048 instructions. however. we will slightly modify the benchmark program and
move a number of data bytes from the top of scratchpad memory to a table in external data memory. Since the data in
scratchpad memory must have been input from an I/O port. we will assume that the number of scratchpad memory
bytes is stored in General Purpose Register R7. The table in external memory begins at a known location and the first table byte addresses the first free table location. Operations performed may be illustrated as follows:
External Data
Memory

Scratchpad

R0t-_ _--4
R1
~-------R2
R3

t-----4
~----4

R4

t----t
R5t-_ _--4
R6
I----t
R7

NN
I

I

I

I·.

I
I

~ \ . . - Last byte

t

_

I

I

I

I

_

of data table

~

~

RO indexes I
scratch pad ,I

-~x~x-11~~
...__ TBASE. 'start

I

/

transfer
performed

t
I

I
I

3F 1-----4

6-32

xx ...- First free byte

cw

~
a:
oD.

LOOP

a:

o
o
a;
en
w
~

MOV
MOVX
MOV
ADD
MOVX
MOV
MOV
MOVX
DEC
INC
DJNZ

;LOAD EXTERNAL TABLE BASE ADDRESS INTO RO
;LOAD ADDRESS OF FIRST FREE BYTE INTO A
;SAVE IN R1
;ADD NEW BYTE COUNT TO A
;RESTORE IN FIRST FREE BYTE OF EXTERNAL TABLE
;LOAD SCRATCHPAD ADDRESS INTO RO
;MOVE DATA FROM SCRATCHPAD TO A
;STORE IN EXTERNAL DATA TABLE
;DECREMENT RO
;INCREMENT R1
;DECREMENT R7. SKIP IF NOT ZERO

RO.#TBASE
A.@RO
R1.A
A.R7
@RO.A
RO.#3FH
A@RO
@R1.A
RO
R1
R7.LOOP

These are the abbreviations used in Table 6-2:
A

The Accumulator

g

A03

Accumulator bits 0-3

(J)
(J)

R

Register RO or R1

ail
w
Z

REG

Accumulator. RO. R1. R2. R3. R4. R5. R6 or R7

RN

Register RO. R1. R2. R3. R4. R5. R6 or R7

o

T

Timer/Counter

o

C

Carry status

~

AC

Auxiliary Carry status

MBO

Program memory bank 0

MB1

Program memory bank 1

«
a:

m
(J)

«c
«
@

MBN

MBO or MB1
The Instruction register

12

Second object code byte

PC

The Program Counter

PC10

The Program Counter. bits 0-10

PCL

The Program Counter. bits 0-7

PCH

The Program Counter. bits 8-11

SP

Stack Pointer: PSW bits O. 1 and 2

PSW

The Program Status Word which has bits assigned to status flags as follows:
6

S

PSW bit C. FO or F1

DATA

8-bit immediate data

DEV

An I/O device

PORT

I/O Port P1. P2 or BUS

5

4

3

2

o

"'-BitNo.

ADDR

An 11-bit address. specifying a data memory byte

ADDR8

The low-order eight bits of a memory address

[] -

Contents of location identified within brackets

[[ ]]

Scratch pad memory byte addressed by location identified within brackets

I []J

External memory byte addressed by location identified within brackets

([ ])

Program memory byte addressed by location identified within brackets

6-33

Move data in direction of arrow
Exchange contents of locations on either side of arrow

+

Add
Subtract

A

AND

V

OR

¥

Exclusive-OR

BUS

Bus I/O port

P1

I/O Port 1

P2

I/O Port 2

EP

8243 Expander Port P4. P5. P6 or P7

PN

P1 or P2

6-34

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 6-2, A Summary of 8048 Microcomputer Instruction Set
TYPE

MNEMONIC

OPERANDIS)

B021

B041'

B04B
B049

STATUS
OPERATION PERFORMED

BYTES
C

AC

ANl

PORT.#OATA

2

ANlD

EP.A

1

[P,ORT]-[PORT] A DATA
AND immediate data with I/O Port Pl. P2 or BUS
[EP]-[A03] A [EP]

IN

A.PN

1

AND expander port P4. P5. P6 or P7 with Accumulator bits 0 - 3
[A]--:-[PN]

IN

A.DBB

1

Input I/O Port PI or P2 to Accumulator
[A]-[BUS]

INS

A,BUS

1

[A]-[BUS]

MOVD

A.EP

1

Input BUS to Accumulator with strobe
[A03]-[EP]

MOVO

EP.A

1

Input expander port P4. P5. P6 or P7 to Accumulator bits 0 - 3
[EP]-[A03]

ORl

PORT.#OATA

2

Output Accumulator bits 0 - 3 to eKpander port P4. P5. P6 or P7
[PORTl-[PORT] V DATA

ORlO

EP.A

1

OR immediate data with I/O Port Pl. P2 or BUS
[EP]-[A03]V [EP]

OUT

OBB.A

1

OR Accumulator bits 0 - 3 with expander port P4. P5. P6 or P7
[BUS]-[A]

OUTL

PORT.A

1

Output from Accumulator to Data Bus buffer
[PORT]-[A]

Input to Accumulator from Data Bus,buffer

g

Output Accumulator contents to I/O Port Pl. P2 lor BUS B04B. 8049 onlyl

w

(.)

MOV

A.@R

1

[A]-[[Rll

'MOV

@lA.A

1

Load contents of scratchpad byte addressed by RO or R 1 into Accumulator
[[Rll-[A]

MOVP

f:.,.@lA

l

Store Accumulator contents in scratch pad byte addressed by RO or R1
[A]-I[PCH] [A]l
load into the Accumulator the'contents of the program memory byte addressed by the Accumulator and Program Counter bits B - 11.
[A]-(3 [A]l

Z

w
II:
w
~

MOVP3

A.@A

1

w

MOVX

A.@R

1

>
II:

MOVX

@R.A

1

XCH

A.@lR

1

XCHO

A.@lR

1

II:

>

II:

0

~
~

c:(

~

a:
Q.

load into the Accumulator the contents of the program memory byte with binary'~
w

XRL

1

OR contents of scratchpad byte addressed bV RO ()( Rt with Accumulat()(
[A)-[A)¥- [[RII

INC

1

Exclusive OR contents of scratchpad byte addressed bV RO ()( R1 with Accumulat()(
[[ RII-[[ RII": 1

(J

Z

W

a:
W ",w
w~
a:c(
>ffi
a: a..

00
~>

~O

a:

c(~

c-

z
0

scrat~hpad

byte addressed bV RO or Rl with Accumulat()(

Increment the contents of the scratchpad byte addressed bv RO ()( Rt

(J

w

II)

w
~
c(

C
w

~

MOV

2

[REG)-DATA

MOV

2

Load immediate data into Accumulator. ()( Register RO. Rt. R2. R3. R4. RS. R6 or R7
[[RIl-DATA
Load immediate data into scratchpad byte addressed bV RO ()( R1

[PC10)-ADDR

~

JMP

ADDR

2

JMPP

@lA

1

SEL

MOO

1

With the next JMP or CALL instruction. reset the high order bit ':If PC to O. thus selecting first 2K
program memory bytes.

SEL

MBI

1

With the n'ext JMP or CALL instruction. set high order bit of PC to 1. thus selecting second 2K
program memory bytes.

CALL

ADDR

2

STACK -STATUS + [PCI. [spl-[SPI + 1. [PCI-ADDR
Call subroutine at specified address.

RET

1

RETR

1

[PCI-STACK. [SPI-[SPI-l
Return from subroutine without restoring status
[PCI + STATUS -STACK. [spl-[SPI-l
Return from subroutine and restore status

Jump to instruction in current 2K block having label ADDR
[PC)-[PCH)[AI. [PCL)-( [PCH)[A))
Load into the eight low order Program Counter bits the contents of the program memory byte
addressed bV the Accumulator and the four hgih order Program Counter bits.

a..

~

.,:l

Z

a:

:l
~

w
a:
C

Z

c(
-'
-'
c(
(J

w

Z

~
:l

0

a:

CD

:l

II)

.'

X

X

© ADAM OSBORNE &

ASSOCIATES. INCORPORATED

Table 6-2. A Summary of8048 Microcomputer Instruction Set (Continued)
TYPE

MNEMONIC

ADD

OPERANDIS)

A.#DATA

S021

X

S041

X

BYTES

X

1&1

!(

STATUS

S04S
S049

-

AC

2

X

x

2

X

X

a:

.ADDC

A#DATA

X

X

X

0

ANL

A.#DATA

X

X

X

2

ORL

A.#DATA

X

X

X

2

XRL

A.#DATA

X

X

X

2

DJNZ

RN.ADDRS

2

JBb

ADDRS

2

JC

AD DRS

2

JFO

ADDRS

2

JF1

ADDRB

2

JNC

ADDRS

2

JNI

ADDRB

2

JNIBF

·ADDRS

2

JNTO

ADDRS

2

JNTl

ADDRS

2

JNZ

ADDRS

2

JOBF

ADDRS

2

JTF

ADDRS

2

1&1
Q.
1&1

~
«

i3

OPERATION PERFORMED
C

[A1,-[A] + DATA
Add immediate data to Accumulator
[A]-[A]+DATA+ [e]
Add immediate data plus Carry to Accumulator
[A]-[A] 1\ DATA
AND immediate data with Accumulator contents
[A]-[A] V DATA
OR immediate data with' Accumulator contents
[A]-[A]¥DATA
Exclusive OR immediate data with Accumulator contents

1&1

~

~

Z

'0

;::

0
Z

0

CJ

Z

0

Q.

..

~

..,::l

JTO

ADDRS

2

JT1

ADDRS

2

JZ

ADDRS

2

[RN]-[RN]-l.lf [RN] ~O. [PCLl-ADDRS
Decrement Register RO. R1. R2. R3. R4. R5. R6 or R7.lf the result is not O. branch to ADDRS on _
the current program memory page.
[PCL]-ADDRS
Jump on current page if Accumulator bit b is 1. b must be O. 1.2.3.4.5.6 or 7
[PCL]-ADDRS
.:dump on current page if Carry is 1
[PCL]-ADDRS
Jump on current page if flag FO is 1
[PCL]-ADDRS
Jump on current page if flag F1 is 1
[PCL]-ADDRS
.Jump on current page if Carry is 0
[PCL]-"ADDRS
Jump on current page if interrupt request input is 0
[PCL]-ADDRS
. Jump if IBF flag is 0
[PCL] - ADDRS
• - Jump on current page if TO input is 0
[PCL] - ADDRS
Jump on current page if Tl input is 0
[PCL]--' ADDRS
-!ump on current page if Accumulator contents is nonzero
[PCL]-ADDRS
Jump if OBF flag is 1
[PCL)- ADDRS
Jump on current page if timer has timed out. that is. if timer flag is 1. The
by this instruction.
[PCL]-ADDRS
Jump on current page if TO input is 1
[PCL]-ADDRS
Jump -on current page if Tl input is 1
[PCL]-ADDRS
Jump on current page if Accumulator contents are zero

ti~r

flag is reset. to 0

Table 6-2. A Summary of 8048 Microcomputer Instruction Set (Continued)

TYPE

w

MNEMONIC

OPERAND(S)

8021

8041

8048
8049

STATUS
BYTES

OPERATION PERFORMED
C

AC

>

MOV

A,RN

[A)-[RN)

I-Ir

MOV

RNA

Move the contents of a general purpose register to the Accumulator
[RN)-[A)

alWill

XCH

ARN

Move the Accumulator contents to a general purpose register
[A)--[RN)

a: °::E
w

IIlW

Ira
w
Ir

Exchange the Accumulator contents with the contents of a general purpose"register

ADD

ARN

x

x

[A)-[A)+ [RN)

'AD DC

ARN

x

x

Add the contents of a general purpose register to the Accumulator
[A)-[A) + [RN) + [C)

ANL

ARN

Add the contents of a general purpose register, plus Carry, to the Accumulator
[A)-[A) A [RN)

ti°

ORL

A,RN

AND the contents of a general purpose register with the Accumulator
[A)-[A) V [RN)

Ir

XRL

ARN

OR the contents of a general purpose register with the Accumulator
[A)-[A)¥- [RN)

Ir
W
I-

III

·awI-w
Ir~

'Ir
Irw
Wll.

aw

Exclusive-OR the contents of a general purpose register with the Accumulator

Cf
w

00

CLR

A

(A)-O

CPL

A

Zero the Accumulator
[A)":"[A)

DEC

REG

Complement the Accumulator
Decimal adjust Accumulator contents
[REG)-[REG)-l

INC

REG

The 8021 can only decrement Accumulator contents.
[REG)-[REG) + 1

RL

A

RLC

A

RR

A

DAA

Decrement the contents of the Acrumulator or general purpose register.

w

I~
Ir
W

Increment the contents of the Accumulator or general purpose register
"Rotate Accumulator left

Il.

o

Ir
W
I-

III

aw
Ir

x

Rotate Accumulator left through Carry

EQ!itlf7f:tll !OJ
Rotate Accumulator right

© ADAM OSBORNE & ASSOCIATES. INCORPORATED

Table 6-2. A Summary of 8048 Microcomputer Instruction Set (Continued)
TYPE

MNEMONIC

OPERAND(S)

8021

8041

8048
8049

STATUS
BYTES

OPERATION PERFORMED
C

AC

X

RRC

A

1

SEL
SEl

RBO
RBl

1
1

Select register bank 0
Select register bank 1

SWAP

A

1

Swap Accumulator nibbles

Rotate Accumulator right through Carry

~l\fllI±I ~

C
w
:;)

z

~
Z

0

g

...ctw
a::

w

0..

0

a::

[AI

...w
til

(;
W

a::

II IIIIIII

,DIS
EN
DIS
EN

TCNTI
TCNTI
I
I

1
1
1
1

Disable timer interrupt
Enable timer interrupt
Disable external interrupt
Enable external interrupts

ENTO
, MOV

·CLK
A,T

1.
1

MOV

T,A

1

STOP
.STRT
STRT

TCNT
CNT
T

1
1
1

Enable timer output:on TO until next system reset
[AI-[TI
Read timer/counter
IlI-[AI
Load timer/counter
Stop timer/counter
Start counter
Start timer

CLR
CPl
MOV

S
S
A,PSW

1
1
1

0

MOV

'PSW,A

1

X

Clear PSW bit C, FO or Fl. 8021 can only clear Carry,
Complement PSW bit C, FO or Flo 8021 can only complement Carry.
[AI-[PSvit)
--

X

X

Move Program Status Word contents to the Accumulator
[PSWI-[AI
Move Accumulator contents to the Program Status Word

NOP

1

No Operation

The following symbols are used in Table 6-3:
bbb

.ee

Three bits designating which bit of the Accumulator is to be tested.
Two bits designating an 8243 Expander port:
00
01
10
11

k

MM
nnn
pp

qq

-'
-

P.4

P5
P6

P7
One bit selecting a memory or register bank:
o MBO or RBO
1 MBl or RBl
Eight bits of immediate data
Three bits designating one of the eight general purpose registers
Two bits designating one of the on-chip I/O ports:
.
00 - BUS
.
01 - Pl
10 - P2
Two bits designating either I/O Port 1 or I/O Port 2:
01 - Pl
10 - P2
One bit selecting a pointer register:

o - RO
1 - Rl

xxx
XX

The high-order three bits of a prowam memory address
T~r low-order eight bits of a progra~ memory address

6-40

Table 6-3. 8048 Series Instruction Set Object Codes

c

w

~
o
D..
a:

a:
o
o
~

enw
~

g
rn
rn

OBJECT CODE

BYTES

ADD

A.RN

01101nnn

1

1

ADD

A.~1,fl

0110000r

1

ADD

A.#DATA

03

MM

ADDC

01111nnn

ADDC

A.RN
A.((!,'fl

ADDC

A.#DATA

w
Z

a:
o
en

INSTRUCTION

CYCLES

2

JTO

'ADDR8

36

XX

'2

2

1

1

JTl

ADDR8

56

XX

2

2

0111000r

1

1

JZ

ADDR8

C6

XX

2

2

2

2

MOV

A.#DATA

23

MM
C7

2

2

1

1

lllllnnn

1

llll000r

1
1

42

1

1
1

ANl

A.RN

1

1

MOV

A.PSW

ANl

A.ql~

0101000r

1

1

MOV

ANl

A.#OATA

2

2

MOV

ANl

PORT.#DATA

53 MM
loo110pp

A.RN
A.ei:'R

2

2

MOV

A.T

MOV

PSW.A

07

1

ANlD

loolllee

1

2

MOV

RN.A

10101nnn

1

1

CAll

EP.A
AODR

'xxxl0loo

2

2

MOV

RN.#DATA

10111nn

2

2

ClR

A

27

1

MOV

ClR

C

97

1
1

1

MOV

1tlR.A
1tR.#DATA

1010000r
1011000r

ClR

Fl

A5

1

1

ClR

FO

85

1

1

MOV

T.A

62

1

1

CPl

A

37

1

1

A.EP

00001100

1

2

EP.A
A.{liA

ooflllee

1

2

A3

1

2

A.1tA

E3

1

2_

A.!IJR
;t(fl,A

l000000r

1

2

lOO1000r

1

2

00

1

1

1

1

MM

1

1

2

2

MM

A7

1

1

FO

95

1

1

MOVP

C

CPl
OA

Fl

B5
57

1

1

1

1

MOVP3
MOVX

A

1

MM

XX

C

@

2
2

CYCLES

2

CPl

c:(

2
2

1

CPl

c:(

86 XX
16 XX

AnDR8
ADDRII

~

o

BYTES

JOBF
JTF

MOVD
,MOVD

rn

MACHINE

OBJECT CODE

13 MM
01011nnn

c:(

all

MACHINE

INSTRUCTION

DEC

A

07

1

1

MOVX

DEC

RN

l1oo1nnn

1

1

NOP

DIS

I

15

1

1

ORl

A.RN

01oo1nnn

35
• 11101rrr

1

1

ORl

A.lOR

0100000r

1

1

2

2

ORl

A.#DATA

43

MM

2

2

ORl

PORT. # DATA

looo10pp

2

2

looo11ee

1

2

02
02

1
1

1
2

oo1110qq
83 •

1

2

1

2

1
1

2
1
1

DIS
DJNZ

TCNTI
' RN.ADDR8

XX
EN

I

05

1

1

EN

TCNTI

25

1

1

ORlD

EP.A

ENTO

ClK

75

1

1

IN

A.PN

oooolOqq

1

2

OUT
OUTl

DBB.A
BUS.A

IN
INC

A.DBB
A-

22
17

1
1

1
1

OUTl

PN.A

INC

RN

'ooollnnn
oool000r

A

08

1

2

'Rl
RLC

93
E7

INS

'fR
A.BUS

1
1

RETR

INC

1
1

A

F7

1

JBb

ADORa

bbbloo10

2

2

RR

A

77

1

1

RRC

A

1

1

XX
JC

ADORa

F6

JFO

ADORa

B6

JFl
JMP

ADDR8
ADDR

xx
xx

76 XX
:xxxOO100

JMPP

({IJA
ADORa

E6

ADORa

a6

B3

JNIBF

ADORa

06

JNTO
JNTI

ADORa
ADORa

26
46

JNZ

ADORa

96

xx
xx
xx
xx
xx
xx

RET

2

2

SEl

MBk

67
l11kOl0l

1

1

2

2
2
2

SEL

RBk

lfokOl0l

1

1

STOP
STRT

TCNT
CNT

65
45

1

1

1

1

STRT

T

55

1

1

2
2
2

SWAP

A

47

1

1

XCH

A.RN
A.fl:ll

oo101nnn

1

1

00loooor

1

1

2

2

oollooor

1

1

2
2
2

XCHD
XRL

A.fl'R

2

XRL

A.RN
A.'flCA

11011nnn
1101000r

1
1

1
1

XRL

A.#DATA

03

MM

2

2

2

2

XX
JNC
JNI

MM

1
2

2

2
2

XCH

THE 8041 SLAVE MICROCOMPUTER
This device is also referred to in Intel literature as a Universal Programmable Interface (UP!); it represents a simple variation of the 8048 microcomputer.
The 8741 is a slave variation of the 8748 microcomputer.
This discussion of the 8041 and 8741 slave microcomputers explains differences as compared to the 8048 and
8748; you should therefore read the following pages after reading the 8048 and 8748 descriptions.

6-41

AN 8041 FUNCTIONAL OVERVIEW
The principal difference between the 8048 and the 8041 is the fact that the 8041 Data Bus and I/O Port 0 are
used exclusively to communicate with a master microprocessor. The 8041 generate"s no external Address or
Data Bus. so on-chip 8041 program memory and scratchpad data memory cannot be expanded.
External interrupt logic. which is available on the 8048. is not available on an 8041; the 8041 uses this logic as
a handshaking interrupt for data input from the master microprocessor.

8048 and' a041 logic are compared functionally in Figure 6-15.

1024 x 8 Bits
8048 or
8041 = ROM
8748 or '
8741 = EPRQM

Arithmetic And
Logic Unit.
Control Unit
and Instruction
Register
Program
Status Word

System

rp'sl~t--__'" RESET

PROM/Expander strobe
CPU/Memory Separate

64 x 8 Bits
RAM

PROG
EA

----1~

XTAL 1

----1~

XTAL2

" Accumulator

~~~~~~~~~!~:~~~~~~~~~:~j~J~~~f'--~-iPS~NorAO
Steo--__... SS

Read suc>De .....i---i RD
Write strc)be .....f----i WR
Counter/ Timer
Test or event counter input

Figure 6-15. A Comparison of 8048 and 8041 Functional Logic

6-42

Communications between an 8041 and a master microprocessor are very limited. Data must be transferred byteby-byte under program control. with nearly all handshaking protocol being implemented via program logic. You must
therefore define the protocol within the logic of your 8041 and master microprocessor programs. A rigid protocol is
absolutely necessary, since the 8041 offers no protection against data transfer contentions.

8041 DATA BUS LOGIC
~

~
a:
oD..

8041 Data Bus logic may be illustrated conceptually as follows:
r-

a:
o
u

Data
Out
Buffer

""-

K

!:

'"

enw

A

....

J

I-

oCt
(3

o

C/)
C/)

oCt
~

w
a:
oen
Z

C/)

o

~

Master
Microprocessor

....

<'"

....

t..

or

...

Data
In
Buffer

'"

8041 LOGIC

y

oCt

C

oCt

@

Buffer
Status register

-

F1

A

J>.

FO

...

r

IBF

Connected
as follows:

....

F1
FO
IBF
OBF

}¢:::>

OBF

- Bit 3
-

Bit 2
Bit 1
Bit 0

In reality, the Data Out buffer and the Data In buffer are a single piece of logic; however, operations occur (to
some extent) as though there were two separate buffers.
A master microprocessor will access an 8041 as two 1/0 ports or two memory locations. These locations are identified via chip select (CS) and address (AO) input signals as follows:
CS

o

o

AO

0

Read from Data Out
buffer
Write to Data In buffer
{ and reset
F1 Buffer status to 0
Read from Buffer
Status register
Write to Data In buffer
{ and set
F 1 Buffer status to 1

6-43

"Read" and "Write" above refer to master microprocessor operations .
.The 8041 accesses the Data Bus buffer register as I/O Port O. The Status register is inaccessible to the 8041 as an
addressable I/O port however. there are specific 8041 instructions that access the FO and F1 Buffer Status bits .
.The four Buffer Status register bits may be defined as follows:
OBF is the output buffer full flag. This flag is automatically set to 1 when the 8041 outputs data
to the Data Out buffer. When the master microprocessor reads the contents of the Data Out
buffer: the OBF flag is reset to O.

8041
BUFFER
STATUS
REGISTER

IBF is the input buffer full flag. This flag is set to 1 when the master microprocessor writes data
into the Data In buffer. This flag is reset to 0 when the 8041 subsequently reads data from the Data In buffer.
FO is a general-purpose flag which can be set or reset by the 8041. The master microprocessor can sample FO by reading Buffer Status register contents.
F1 is another general-purpose flag which can be modified by the 8041. F1 is also set or reset to the level of AO
whenever the master microprocessor writes data into the Data I n buffer. The master microprocessor can sample F1 by
reading Buffer Status register contents.
When the master microprocessor reads buffer status. flags appear on the Data Bus lines as follows:

07
06
05
04
03
02
01

} Undef;"d

F1
FO
ISF
OSF

00

Whenever the 8041 outputs data to I/O Port O. the data is stored in the Data Out buffer and the OBF status flag is set to
1; when the master microprocessor subsequently reads the contents of the Data Out buffer. the OBF flag is reset to O.
When the master microprocessor writes to the 8041. the data is loaded into the Data In buffer. the IBF status is set to 1
and an interrupt request is generated within the 8041; this interrupt request replaces the external interrupt logic of the
8048. The IBF status is cleared when the 8041 subsequently reads the contents of the Data In buffer.
The FO flag is set or reset by the 8041 using appropriate instructions. There is no predefined manner in which this flag
is interpreted; your program logic can use this flag in any way.
The F1 flag is set to the level of the AO signal input whenever the master microprocessor writes a control byte into the
Data In buffer.- In reality. there is no difference between a control byte and a data byte; that is to say. thero is no predefined way in which the 8041 will interpret the contents of the Data In buffer based on the F1 flag level.
The master microprocessor reads data which has been output by the 8041; the master microprocessor cannot read
back data which it wrote to the 8041.
The 8041 inputs from I/O Port 0 data that was written by the master microprocessor; the 8041 cannot read back data
which it previously output to 110 Port O.

8041 1/0 PORTS ONE AND TWO
Physically. 8041 I/O Ports 1 and 2 have logic which is identical to the 8048. Thus the pseudo-bidirectional I/O port
characteristics described for the 8048 110 Ports 1 and 2 apply also to the 8041 110 Ports 1 and 2.
Note that the 8041 does not generate an external Address Bus. therefore I/O Port 2 pins P20 - P23 never output address information.

8041 AND 8741 PROGRAMMABLE REGISTERS
The 8041 and 8741 have a 1O-bit Program Counter. The 8048 and 8748 have a 12-bit Program Counter. These are the
only differences between the 8041 series and 8048 series programmable registers.

8041 AND 8741 ADDRESSING MODES
The 8041 and 8741 can address only on-chip memory. This includes the 1024 bytes of on-chip program memory and
64 bytes of on-chip scratchpad data memory. 8041 and 8741 addressing modes are identical to the 8048 and 8748
on-chip memory addressing modes. Of course. the 8048 and 8748 external memory addressing modes will not apply
to the 8041 or the 8741.

6-44

8041 AND 8741 STATUS
The 8041 and 8741 slave microcomputers have two Status registers. First, there is the Buffer Status register,
which is part of the Data Bus logic. We have already described this 4-bit Status register. The 8041 and 8741
also have the 8-bit Program Status Word described for the 8048 series microcomputers. 8041 and 8048 Program Status Words are identical.

~.

8041 AND 8741 SLAVE MICROCOMPUTER OPERATING MODES

~:

The 8041 and 8741 can be operated in Internal Execution mode and Debug mode; in addition, the 8741 can be
operated in Single Stepping mode, Programming mode and Verification mode. Neither the 8041 nor the 8741
can be operated in External Memory Access mode.

~
~
u;
~

en
w
~

8041 AND 8741 PINS AND SIGNALS
There are a few differences between 8041 and 8741 pins and signals, as compared to the 8048 and 8748.
Figure 6-16 defines 8041 and 8741 pins and signals; the four changed signals are shaded.
.

(j

o
(I)

(I)

oct

o!I

w

TO

a:

oct
oct

XTAL1
XTAL2
RESET
SS
CS
EA

@

Ro

Z

oIn
(I)

o

:!:
Q

AO
WR
SYNC
DBO
OBI
DB2
DB3
DB4
DB5
DBB
DB7
(GND) Vss

I
2
3
4
5
6
7
8
9
10
II
12
13
14
15
16
17
18
19
20

8041
8741

40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

Vee (+5V)
Tl
P27
P26
P25
P24
P17
P16
P15
P14
P13
P12
Pll
Pl0
VDD
'PROG
P23
P22
P21
P20

PIN NAME

DESCRIPTION

TYPE

DBO - DB7

Bidirectional I/O port, Data Bus and
low-order eight Address Bus lines
I/O Port 1
I/O Port 2, P20 - P23 also serves as four
high-or~er .A~.~refj~Bu~ lines
Extemalclocksigl'lal
Data memory read control
Data
write control

Bidirectional, tristate

PIa - P17
P20 - P27

Ouasibidirectional
Ouasibidirectional

program memory access
Single step control
Test inpu(and
PrOgramlVerifYrn6i::ie.··sel~ct

Tl
RESET
VSS
Vee
VDD
PROG
XTAL1, XTAL2

Test input, optional event counter input
System reset and EPROM address latch
Ground
+5V
+ 25V to program 8741. + 5V standby
for 8041 RAM
+ 25V input to program 8741. Control
output for 4-bit I/O
Extemal crystal connections

Input
Input

Bidirectional

Figure 6-16. 8041 and 8741 Microcomputer Pins and Signals

6-45

CS and AO are the device select inputs which we have already described.
SYNC is an external synchronizing signal which is output once per machine cycle.
TO cannot be connected to the internal system clock; other uses of TO are the same for the 8041/8741 and the
804S/8748.
All other signals are identical to the 8048 and 8748 as previously described. Note. however. that no addresses are output on the DBO - DB7 pins or the P20 - P23 pins.

8041 SERIES TIMING AND INSTRUCTION EXECUTION
The 8041/8741 clock signals and instruction execution timing logic is identical to the 8048/8748. Of course. the 8041
and 8741 have no external memory reference instructions. therefore timing associated with these instructions will not
apply.

8741 SINGLE STEPPING AND PROGRAMMING MODE
Single Stepping and Programming modes of operation are available only with the 8741; the 8041 cannot be
operated in these modes.
There are, of necessity, some differences between 8741 and 8748 Single Stepping and Programming modes;
this is because the 8741 has no ALE signal and no output Address Bus.
In Single Stepping mode. the 8741 is stopped by applying a low SS input when SYNC is low.
The 8741 responds by stopping during the next instruction fetch. At this time. SYNC is maintained high. The address
of the next instruction to be accessed appears at 1/0 Port 1 and 'the low-order two bits of 1/0 Port 2. This condition is
maintained until SS is input high again. Timing may be illustrated as follows:

SYNC

-1

Pl0-P17----------------------------u-------------------~ ~--~~---------------PCO - PCg

P20-P21------------------__________R-__________________

~~---n------------------

There are also some minor differences between 8741 and 8748 Programming modes. The ten-step 8741 programming sequence is therefore given below. Differences as compared to the 8748 are shaded.
Initially +5V is input at VDD.g§. TO and EA. RESET and~.9 are held at ground. Under these conditions you
insert the 8741 into the programming socket. You must make certain to insert the 8741 correctly. If you
insert the 8741 incorrectly you will destroy it.

Step

1)

Step

2) TO is pulled to ground; this selects Programming mode.

Step 3) +25V is applied to EA. This.activates Programming mode.
Step 4) A 10-bit memory address is applied via DBO - DB7 and P20 - P21. Remember. there are 1024 bytes of program memory on the 8741 device. The low-order eight address bits are input via DBO - DB7 while the two
high-order address bits are input via P20 and P21.
Step

5) +5V is applied at RESET. This latches the address.

Step 6) The data to be written into the addressed programmed memory byte is input at DBO - DB7.
Step

7) In order to write the data into the addressed program memory byte apply +25V to VDD. then ground PROG.
then apply a +25V pulse at PROG; the +25V pulse at PROG must last at least 50 milliseconds.

Step 8) Now reduce VDD to +5V. Programming is complete and verification is about to begin.
Step

9) In order to verify the data just written. apply +5V to the TO input. This selects Verify mode.

Step 10) As soon as Verify mode has been selected. the data just written is output on DBO - DB7. You must read and
verify this data using appropriate external circuitry. Verification is now complete.

6-46

8041 INPUT/OUTPUT PROGRAMMING
The only differences between 8041/8741 and 8048/8748 input/output programming are those which result
from the uniq~e 8041 I/O Port 0 logic - which we have described.

8041 COUNTER/TIMER
OPERATIONS
..
"

'

cw

8041 series and 8048 series counter/timer operations are identical.

a:

o(J
!:

The entire external interrupt logic of the 8048 has been converted in the 8041/8741 Data Bus handshaking interrupt logic. This interrupt request occurs every time a master microprocessor writes to either of the
8041/8741 addressable locations.

en
w

~
U
oCI)

In order to generate external interrupt logic at an 8041 or 8741 you must use the counterltimer. By loading the
counterltimer with an initial value of FF16 and operating the counterltimer in Counter mode, the first high-ta-Iow input
transition on T1 will generate a Timer interrupt request. Of course, you are using the counterltimer in this way, you
' , '
'
cannot use it for any of its normal functions.

~
a:
oD..

8041 INTERRUPT LOGIC

if

CI)

c(

all

w
Z

a:

o

al
CI)

o

~

c(

cc(
@

PROGRAMMING 8048-8041 DATA TRANSFERS
The only complexity associated with programming an 8041 involves data transfers between the 8041 and a
master microcomputer. Programming these data transfers is not straigh~forward.
We described earlier how there are separate data paths for data entering or leaving the 8041 via the Data Bus buffer.
Nevertheless, if a master· microcomputer attempts to write to the 8041/8741 while the 8041/8741 is
simultaneously outputting to I/O Port 0, then there will be an undefined result.,This is unfortunate, since there are
no signals or indicators of any kind allowing the master microcomputer to lock out the 8041/8741; nor can the
8041/8741 lock out the master microcomputer. Lock out logic rn~!it be implemented by you, via your program
logic. Program logic must also make sure that data written by ;'~:I master microcomputer has been read by the
8041/8741 before the master microcomputer writes any new data; similqrly, the 8041/8741 must make sure that any
data it has output to I/O Port 0 has been read by the master microcomputer before the 8041/8741 attempts to output
new data to 1/9 Port O.
Let us look at the programming steps required for error free data transfers between the 8041/8741 and a
master microcomputer. Programming examples assume an 8048 is the 'master microprocessor because the 8048 is
described in this chapter and has an instruction set that is similar to the 8041. In reality, the master microprocessor is
likely to be an 8085-type device.
The mastElr microcomputer can make sure that it does not overwrite data by testing both the IBF and the OBF flags;
that is to say, the master microcomputer will,not attempt to write data to the 8041/8741 if prior data it wrote is waiting
to be read by the 8041/8741, or if data output by the 8041/8741 is waiting to be read by the master microcomputer.
The following master microcomputer output instruction sequence will suffice:
.
MOV

MOVX
RRC
JC
RRC
JC
DEC

0,ADDR+1

;LOAD 8041 ADDRESS INTO 8048 REGISTER RO

A,@O

; LOAD STATUS
;TEST LOW ORDER (OBF) FLAG
;IF IT IS 1, DO NOT WRITE NEW DATA
;TEST NEXT BIT (lBF) FLAG
;IF IT IS 1, DATA IS WAITING TO BE READ
;OK TO OUTPUT

A
NEXT

A
READ

o

6-47

But this scheme does not prevent the master microcomputer and the 8041/8741 from simultaneously accessing the
Data Bus buffer. This must be guaranteed by 8041/8741 lock out logic. The 8041/8741 can use programming logic or
interrupt logic to lock out the master microcomputer. Using programming logic. the 8041/8741 will use the FO flag to
identify those time intervals when the master microcomputer is free to access the Data Bus buffer. Now any 8048
master microcomputer instruction sequence that accesses the 8041/8741 will first read 8041/8741 status and test the
Fa flag. If this flag is "false". no data transfer must occur. Continuing our master microprocessor instruction sequence.
this may be illustrated as follows:
MOV

TEST

READ

MOVX
RRC
JC
RRC
JC
RRC
JNC
DEC
MOV
MOVX
. JMP
RRC
JNC
DEC
MOVX
MOV
JMP

0.ADDR+1

;LOAD 8041 ADDRESS INTO 8048 REGISTER RO

A@O
A

;LOAD STATUS
;TEST LOW ORDER (OBF) FLAG
;IF IT IS 1. DO NOTWRITE NEW DATA
;TEST NEXT BIT OBF) FLAG
;IF IT IS 1. DATA IS WAITING TO BE READ
;TEST FO FLAG
;IF Fa IS a. MASTER IS LOCKED OUT
;FO IS 1 SO IT IS OK TO OUTPUT DATA
;LOAD DATA TO BE OUTPUT INTO ACCUMULATOR
;OUTPUT DATA TO 8041

NEXT

A
READ

A
TEST

o

A@1
@O.A
OUT

A
TEST

o

A@O
@1.A
OUT

;TEST FO FLAG
;IF FO IS O. MASTER IS LOCKED OUT
;FO IS 1 SO IT IS OK TO READ DATA
;INPUT DATA
;STORE IN SCRATCHPAD

The instructions above assume that scratchpad register R1 addresses the scratchpad byte out of which written data is
fetched. or into which read data is stored.
.
If there is heavy traffic between an 8041/8741 and a master microcomputer. then the 8041/8741 shou Id use interrupt
logic to identify times when a master microcomputer can either output data to the 8041/8741 or input data from the
8041/8741. To do this. one or two 8041/8741 110 port pins must be set aside as interrupt request generation lines.
Now the master microcomputer will not access the 8041/8741 except within an interrupt service routine which is initiated by an interrupt request arising from one of the t,wo dedicated 8041/8741 I/O port pins.
Data transfers from the 8041/8741 to the master microcomputer are easy to program. When the 8041/8741 writes to
I/O Port O. the OBF flag is set to 1 ; th is flag is reset to 0 when a master microcomputer reads data. Thus. the 8041/8741
simply tests the OBF status before outputting data; here are appropriate instructions:
CLR
JOBF
OUT
CPL

FO
NEXT
DBB.A
FO

;ZERO FO TO LOCK OUT THE MASTER MICROPROCESSOR
;TEST OBF FLAG
;IF IT IS ZERO. OUTPUT NEXT DATA BYTE
;SET FO TO ALLOW MASTER MICROPROCESSOR ACCESS

NEXT

6-48

The 8041 /8741'can respond to data arriving from the master microcomputer by using polling logic or interrupt logic. If
polling logic is used. then the 8041/8741 must test the IBF flag before reading any data that the master microcomputer
has output. In order to determine whether the master microprocessor has output data or a control code. the 8041/8741
must also check the F1 flag. Here is an appropriate instruction sequence:
Q

w

~
a:
oQ.
a:

o
u
!:

CLR
JNIBF
JF1

Fa

IN
CPL

A.DBB
Fa

:ZERO Fa TO LOCK OUT THE MASTER MICROPROCESSOR
:TEST FOR DATA WAITING TO BE READ
:DATA IS READY TO BE READ. TEST
: FOR DATA BYTE OR CONTROL BYTE
:READ DATA
:?ET Fa TO ALLOW MASTER MICROPROCESSOR ACCESS

IN
CpL'

A.DBB
Fa

:READ CONTROL CODE
:SET Fa TO ALLOW MASTER MICROPROCESSOR ACCESS

~EXT

CONT

en
w
~

g

CONT

CI)
CI)

01(

oil
w

z
a:

g
~

:iE
~

NEXT
If 8041/8741 data input logic is interrupt driven. then external interrupts must be left enabled. Now as soon as the
master microcomputer outputs data to the 8041/8741. an interrupt request will occur. followed by a Call 3 instruction
being executed. Beginning at rnemory location 3. the following instruction sequence will initiate the data input interrupt service routine within the 8041/8741:
1

01(

qRG
JMP

3
DTIN

:JUMP TO DATA INPUT ROUTINE

DTIN·

CLR
JFl
IN

Fa
CONT
A.DBB

:ZERO Fa TO LOCK OUT MASTER MICROPROCESSOR
:TEST FOR DATA TYPE
:READ DATA

CONT

IN

A.DBB

:READ. CONTROL CODE

CPL
RET

Fa

:SET Fa TO ALLOW MASTER MICROPROCESSOR ACCESS
:RETURN FROM INTERRUPT SERVICE ROUTINE

@

The master microprocessor must not write to the 8041/8741 while data thatthe 8041/8741 has output is waiting to be
rea~j; similarly. the 8041/8741 cal1not output data fO the master microprocessor while data from the master
microprocessor is w~iting to be read by the 8041/8741. In each case. prior data will be overwritten and lost. In order to
prevent this from happening. you must have appropriate lock out logic. Fa is used for this pur~o~j3 abo,:,e.

THE 8041/~741
INSTRUCTION. SET
. ' ;;.
~

:,~

~

..

The 8041/8741 instruction set differs from the 8048/8748 in minor ways only. Tables 6-2 and ~-3 therefore
.•. . .
.
summarize t~e instruction set for both the 8048 series and 8041 series microcomputers:

6-49

1024 x 8 Bits

RP~

Arithmetic and
Logic Unit,
Control Unit
and Instruction
Register

x 8 Bits
RAM
8021 has one
set: of registers
only
64

Count~r /Timer

Iii

All 8021 I/O port pins have

1:1

These signals

.

.

,.'

uni~ue characteristics

ar~
not pres~nt in an 8021 .
.
:} ~ ~ ~

1::;1 8021 T1 characteristics are unique
Figure 6-17. A Comparison of 8048 and 8021 Functional Logic

6-50

THE 8021 SINGlE-CHIP MICROCOMPUTER

c

w

~
a:
o

11.

a:

o

CJ

The 8021 is a low-cost subset of the 8048,slngle-chip microcomputer. Unlike .the 8041, the 8021, is not
designed to operate as a slave microcomput~r. The 8021 is intended for high-volume, low-cost 'applications
with limited microcomputer logic requirements. The only easy way in which an 8021 can be expanded is by adding
an 82431nput/Output Expander. There is no simple way to increase either 8021 program memory or data memory. over
and above that which is internal to the 8021.
This discussion of the 8021 single-chip microcomputer explains differences as compared to the 8048 and 8748;
you should therefore read the following pages after reading the 8048 and 8748 descriptions ..

~

AN 8021 FU NCTIONAL OVERVIEW

en

The principal difference between the 8048 and the 8q21 is the fact that the 8021 has no Data Bus, and 1/0 Port
o is simply another 1/0 port. Thus. the only way in whli:h an 8021 can communicate with logic beyond the chip Itself
is via its 1/0 ports. which have no accompanying handshaking control signals. In contrast. the 8041 has I/O Port 0 logic
designed for two-way communication between the 8041and a master microprocessor. The 8021 cannot distinguish
between a master microprocessor or any otrer external logic.

~,
ct'

U

oCI)
CI)

ct
olJ
w
Z

a:

o

III
CI)

o

~

ct

c

ct

@

The 8021 has no external interrupt logic and only one Test input.
Only two control signals are output by the 8021: a synchronizing 'clock signal and an 8243 Input/Output Expander
control strobe.
With these reduced capabilities. the 8021 is pa~kaged bs a 28-pin DIP, in contrast to other members of the 8048
series. which are 'packaged as 40-pin DIPs.

. The 8021 can be driven by a crystal oscillator with a maximum 3 MHz frequency. This is half the maximum frequency of the 8048 and 8041. but equivalent to the maximum frequency of the -8 parts. This3 MHz crystal generates
10-microsecond machine cycles. Thus. all 8021 instructions execute in either 10 or 20 microseconds.
Functionally, 8048 and 8021 logic are compared in Figure 6-17. 8021 pins and signals are illustrated in Figure

6-18.

802 i I/O PORT PINS
8021 1/0 port pins are referred to as quasi-bidirectional, a term we also use to describe 8048110 port pins. 8048
and 8021 1/0 port pin logic is identical.
.

THE T1 PIN
When you order an 8021 microcomputer, you can specify one of two configurations for the T1 pin. Electrically,
these maY'be illustrated as follows:
Option A

,,,

(Zero cross-over sensing)

Option B

(Pull-up resistor)

I

I
I

I
I

i Capacitor

CPU

Pin
13

Il-

Switch

CPU

External
logic

Pin
13

External
logic

Option A allows you to detect the zero cross-over point on Slow-moving input Signals. Option B. with the pUll-up. is
designed to sense fast changes such as contact switch~s.

6-51

P22
P23
PSEN
POQ
POl
P02
P03

P04
P05
P06
P07
ALE

•

T1

.. --

--

-.

1
2
3
4
5

..~ --..-

..-

~

--

--

-..

6

-..
--- -

7
8
9
10
11
12
13
14

.

- -..-

~

'-.
-

(GND) VSS

28
27
26
25
24
23
22
21
20
19
18
17
16
15

. 8021

-

:.
'.-

..

...-

-

-:... ....-..

--

--

. ,;.

..

DESCRIPTION

PIN NAME

lib Port 0

POO - P07
Pl0 - P17
P20 - P23

I/O Port 1
1/.0 :port2 .
tlock,signal
8243 Control
Test iMput. optional
event counter
System reset
External crystal connections
Ground
Power

Ai.E
PSEN
Tl
RESET
XTAL1. XTAL2
VSS
VCC

Vcc (+5V)
P21
.P20
P17
P16
P15
P14
P13
P12
P11
~10

RESET
XTAL2
XTAL1

,TYPE
Ouasibidirectional
ciuasibidirectional
Ouasibidirectional
. Output
Output
Input
Input

Figure 6-18. 8021 Microcomputer Pins and Signals

THE 8021' RESET iNPUT
When the 8021 is reset, the same internal operations occur as described for the 8048; the, Program Counter and
Program Status Word are cleared and 1 is output to 1/9 port pins. However, 8021 reset logic has been modified so
that the 8021 can operate with noisy power supplies. You have one of two options. which may be illustrated as
follows:
Option A (Reset when power falls below 1.5V)

RESET

,

-r".' '.

,

~I- 0

VCC

Option B (Operate as long as power will drive chip)

1~

RESET .....
- - - - - -...

lJ.lF

lJ.lF

10V

10V

VCC

-In the case of Option A. you connect the diode between reset and ground to force a reset whenever power drops below
1.5V. Thus. operations will stop while power falls below 1.5V. but when normal power rl3turnsoperations will restart.
Since chip operations continue only as long as poWer remains high enough to maintain the contents of chip read/write
locatio·ns. this circuit guards against execution with faulty data. By removing the diode. as illustrated in Option B. this
reset feature is eliminated ahd the 8021 will operate as long as power is sufficient to drive logic internal to the chip.

THE 8021 CLOCK INPUTS
A crystal Resistor/Capacitor or inductor circuit can be connected to the XTL 1 and XTL2 pins to provide the
needed internal clock signal. The maximum external crystal frequency allowed is 3 MHz. This generates 10-microsecond machine cycles. All instructions execute in 1 or 2 machine cycles.
C'

w

~

~:

o

no·

a::

o
(J
~

THE 8021 TIMER/COUNTER
Logic associated with the 8021 timer/counter is identical to that which we have described for the 8048. The
contents of the Accumulator can be moved to the Counter/Timer register. which is subsequently incremented once every 32 crystal oscillations in Timer mode. or once every high-to-Iow transition of a T1 input in Counter mode. However.
there is no interrupt logic on the 8021, which means that a time-out will not cause an interrupt request to occur. You
must therefore test for a time-out under program control using the JTF (Branch-on-Timer Flag) instruction.

ui

8021 SCRATCHPAD MEMORY AND PROGRAMMING

~

In addition to the lack of interrupt logic, the 8021 has no Status register and data memory is simplified.

w

g
en
en
oct

Instead of having a Status register. the 8021 has a 3-bit Stack Pointer and a single Carry status flag.

w
Z

Data memory consists of eight general purpose registers in scratchpad bytes 0-7. plus a 16-byte Stack which uses
scratchpad bytes 8-1716. This stack allows subroutines to be nested to a level of 8. The 8021 does not have the second
set of eight registers located in scratchpad bytes 1816 - 1F16. as is available on the 8048 and the 8041.

oIII

The 8021 instruction set is a subset of the 8048 instruction set. In Table 6-1. 8021 instructions are identified.

all

a::

en

o

:1!

oct
C
oct

THE 8243 INPUT/OUTPUT EXPANDER

@

This support device expands I/O Port 2 of an 8041 or 8048 series microcomputer to four individually addressable 4-bit
I/O ports. The 8243 Input/Output Expander is particularly useful in numerical applications where data is transferred in
4-bit nibbles.
Figure 6-19 illustrates that part of our general microcomputer system logic which has been implemented on the 8243
Input/Output Expander.
The 8243 Input/Output Expander is packaged as a 24-pin DIP. It uses a single +5V power supply. All inputs and outputs are TTL-compatible. The device is implemented using N-channel MOS technology.

8243 INPUT/OUTPUT EXPANDE~ PINS AND SIGNALS
The 8243 Input/Output Expander pins and Signals are illustrated in Figure 6-20. Functional internal architecture is il' ,
lustrated in Figure 6-21.
P20 - P23 represent the 4-bit bidirectional I/O port or bus connection between the 8243 Input/Output Expander and
the 8048 series microcomputer. P20 - P23 must be connected to the low-order four pins of the microcomputer I/O Port
2. Figure 6-22 illustrates the 8243-8048 interface.
P40 - P43, P50 - P53, P60 - P63 and P70 - P73 provide four bidirectional I/O ports, referred to as Ports 4.5. 6 and
7. respectively. These are 4-bit ports via which data is transferred to or from external logic.
Data being output via one of these four ports IS latched and held in a low impedance state.
Data input is buffered. During a read operation 8243 I/O port pins are sampled then I/O port pins are floated.

while the read is being executed;

CS is the single chip select signal for the 8243 device. CS must be low for the device to be selected. There is no
specifically defined manner in which CS has to be created; in Figure 6-22 it is shown being decoded off the four highorder pins of I/O Port 2.
PROG is the single control strobe output by the 8048 series microcomputer to time 8243 events. On the falling
edge of PROG. data input via P20 - P23 is decoded as an I/O port select and operation specification. Resulting 8243
operations are strobed by the rising edge of PROG ..

I

There is no Reset input to the 8243. The device is reset when power is first applied, or when
18243 RESET
power input at the VCC pin drops below +1 volt. Following Reset. Port 2 is inlnput mode while
Ports 4. 5. 6 and 7 are floated. The 8243 device will exit the Reset mode on the first high-to-Iow transition of PROG.

6-53

Clock Logic

Logic to Handle
Interrupt Requests
from
External Devices

Arithmetic and
Logic Unit

Accumulator
Register(s)

,",

I

Instruction Register .........
....

..

Data Counter(s)

~

Stack Pointer

Control Unit

•
r
Interrupt Priority
Arbitration

Bus Interface
Logic

Direct Memory
Access Control
Logic

. . Program Counter

u
System Bus

•
...

I/O Communication
Serial to Parallel
Interface Logic

ROM Addressing

RAM Addressing

and
Interface Logic

and
Interface Logic
(" ,.;}:.':: '<,,' ".',.\ i, ,",> ,. ',:/:
"2·'··/"<·,·; : .',')'i,,· <'.".'<.(

." •.". . < :, i i '
Programmable
Timers

Read Only
Memory

,. ".<¥.'

i i i '. . ."

.o-

a:

o
III

,.-

ClK
ClR

U)

o

J

L-£>-

:!!
~

c

6

~

ClR

@

J

~

K
"---

01 t--WRITE
74107

CLK
PRE

~+5V

PROG

P22. P23

READ

WRITE

Figure 6-22. An 8243/8048 Configuration with External Logic Read and Write Strobes

6-57

)

...

AP70 - P73 ...

"

~

PROG

P20 - P23

Float

I

Instruction

\
1\

,

PNO - PN3

~I \

I

Float

Data Out

,

I

Old output data

Float

New output data

8243
device
decodes
instruction

Figure 6-23. Timing for Data Output to an 8243 Port Via
an MOVD. ORlD or ANlD Instruction

~

PROG

P20 - P23

PNO - PN3

Float

I

Old input data

'\

I\

Instruction

I

Float

1

0
\
Data·ln

New input data

~

Float

L
b

1

8243
device
decodes
instruction

Figure 6-24. Timing for Data Input from an 8243 Port

Timing for 8243 port accesses is illustrated in Figures 6-23 and 6-24.
In each case an instruction is output via P20 - P23 of the 8048 microcomputer on the high-to-Iow transition of
PROG. The instruction is decoded as follows:
P20
0
0
1
1

P21
0
1
0
1

8243 Port Selected
Port 4
Port 5
Port 6
Port 7

P22
0
0
1
1

P23
0
1
0
1

Function Defined
Read from Port
Write to Port
OR with Port
AND with Port

The actual I/O operation within the 8243 device is strobed by the subsequent low-to-high transition of PROG.
Observe that external logic must transmit data to an 8243 I/O port on the high-to-Iow transition of PROG. External logic
must read data output after the low-to-high transition of PROG. These signals to external logic are shown in Figure
6-22. Let us take a more careful look at this figure.
.
The 8243 device select CS is derived in some fashion from the four high-order lines of the 8048 I/O Port 2. The manner
in which we decode CS from these four lines is not relevant: however. the fact that we are generating CS in this fashion
means that any 8243 access instruction must be bracketed by instructions that select and then deselect the 8243
device.
It is not a good idea to leave the 8243 device selected when you are not accessing it: therefore do not leave high-order
bits of I/O Port 2 in a condition that would select the 8243 device while the device is supposed to be idle.

6-58

The PROG signal connecting the 8048 to the 8243 requires no explanation. The signal is output by the 8048 with timing required by the 8243.

c'
~!
a:
e:(

The READ and WRITE strobes created in Figure 6-22 identify the time at which external logic must either read data
from an I/O port. or write data to an I/O port however. the I/O port is not itself identified. The READ and WRITE strobes
would have to be qualified by P20 and P21 on the high-to-Iow transition of PROG in order to create READ and WRITE
strobes specific to any given I/O port. Here. for example. is the logic which would make READ and WRITE specific to I/O
Port 5:

oD..
a:
o

P21------f

enw

P20

o

~

READ

~

READ 5

7474.

gen

en·
e:(

Q ..........- - - - - 1

D

PROG

-X)-------ICLK
WRITE

CI/l

WRITE 5

w
Z

a:

o

III

en

o

~

e:(1

C

e:(

@

Referring to the timing in Figure 6-22. let us first look at the READ strobe. This signal must go true on the high-to-Iow
transition of PROG - but only if P22 and P23 are both low. READ can stay high until the device is deselected. providing external logic uses the low-to-high transition of READ or timing immediately thereafter. in order to place data at the
required I/O port - whence it can be read by the 8048. We obtained the required waveform by using the complement
of CS as a CLEAR input to the READ 7474 flip-flop. Thus while the 8243 device is not selected READ will be low. The
NOR of P22 and P23 becomes the D input to the READ flip-flop; this input will be high only when P22 and P23 are both
low - and that specifies a Read operation. On the high-to-Iow transition of PROG. PROG goes low-to-high. and that
clocks the READ flip-flop Q output high. READ subsequently stays high until CS goes high again. at which point the
READ flip-flop is cleared and READ goes low.
A 74107 master-slave flip-flop creates the WRITE pulse. The high-to-Iow transition of PROG marks the instant at which
P22 and P23 must be decoded to determine that a non-read operation is in progress. but the actuallow-to-high transition WRITE must not occur until the subsequent low-to-high transition of PROG.
The 74107 modifies the Q 1 output on the trailing edge of ClK. based on the JK inputs at the leading edge of ClK; thus
WRITE logic requirements are met.

6-59

DATA SHEETS
This section contains specific electrical and timing data for the following devices:

c

w

~
a:
oQ.

8048/8748/8035 }
8049/8039
8041/8021
8243 liD Expander

One-Chip Microcomputers

a:

o

CJ

~

enw
~

g
en
en

<
all
w
Z

a:

o

III

en

o

:1!

c<
<
@

6-01

8048/8748/8035
ABSOLUTE MAXIMUM RATINGS·
Ambierit ,Temperature Under Bias ........... ooe to 70°C
Storaga Temperature ................... -65°C to +150 oe
Voltage On Any Pin With Respect
to Ground ............................. -0.5V to +7V
Power Dissipation. . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 1.5 Watt

'COMMENT:
Stresses above those listed under "Absolute Maximum Ratings"
may cause permanent damage to the device. This is a stress rating
only and functional operation of the device at these or any other
conditions above those indicated in the operational sections of this
specification is not implied.

D.C. AND OPERATING CHARACTERISTICS
Symbol

Parameter

TA = o°c to 70°C, VCC = V DD = +5V ±10%*, VSS= OV
Limits
Typ.

Min.

Unit

Max.

V IL

InpLlt Low Voltage
(All Extept XTALl, XTAL2)

-.5

.8

V

V IH

Input High Voltage
(All Except XTAL 1,XTAL2,RESET)

2.0

Vcc

V

3.0

Test Conditions'

V IH1

Input High Voltage (RESET,XTAL1)

Vcc

V

VOL

Oqtput Low Voltage
(BUS, RD, WR, PSEN, ALE)

.45

V

IOL = 2.?mA

V OL1

Output Low Voltage
(All Other Outputs Except PROG)

.45

V

IOL = 1.6mA

VOL2

Output Low Voltage (PROG)

.45

V

IOL = 1.0mA

V OH

OlJtpu!...!::!.ig~oltage

2.4

V

IOH = 100J..IA

2.4

V

IOH = 50J..IA

(BUS, RD, WR, PSEN, ALE)
VOH1

Output High Voltage
(All Other Outputs)

IlL

Input Leakage Current
(Tl, EA, INT)

±10

J.1A

VSS:!(VIN:!(VCC

IOL

Output Leakage Current (BUS, TO)
(High impedance State)

-10

J.1A

Vcc >VIN~VSS +.45

I DO

V DO Supply Current

10

20

mA

100+ Icc

Total Supply Current

65

135

mA

A.C. CHARACTERISTICS
Symbol

TA = o°c to 70°C, Vcc = VOO = +5V ±10%*, Vss= OV

Parameter

8048/8748
8035/8035L
Min. Max.

8748-8
8035-8
Min. Max.

Unit

Conditions (Note 1)

tLL

ALE Pulse Width

400

600

ns

tAL

Address Setup to ALE

150

150

ns

tLA

Ai:ldress Hold from ALE

80

80

ns

tcc

Control Pulse Width (PSEN, RD, WR)

900

1500

ns

tow

Data Setup before WR

500

640

ns

tWD

Data Hold After WR

120

120

ns

CL = 20pF

tCY

Cycle Time

2.5

4.17 15.0

J.1s

6 MHz XTAL
(3.6MHz XTAL for -8)

tOR

Data Hold

tRD

PSEN, RD to Data In

0

tAW

Address Setup to WR

tAD

Address Setup to Data In

tAFC

Address Float to RD, PSEN

*Standard 8748 and 8035 ±5%,

t 1 0%

available.

15.0
200

0

500
230

750

950

1450
0

Control Outputs:
aUSOutputs:

ns
ns
ns

260

0
Notel:

200

ns
ns

CL = 80 pF
CL=150p;, tCy=25fJs

Data sheets on pages 6-02 through 6-014 are reprinted by permission of Intel Corporation, Copyright 1978.
6-D2

8048/8748/8035
A.C. CHARACTERISTICS
TA

= O°C to 70°C, Vee = 5V±10%

- •..

C

Symbol

~o

tcp

Port. Control Setup Before Falling
Edge of PROG

110

c:

tpc

CJ

-.
tpR

Port Control. Hold After Falling
Edge of PROG

140

ns

PROG to Time P2 Ir)put Must Be Valid .

810

ns

LLI

Q.

o

~

en
LLI

Parameter

.. _.

Min.

Max.

Unit

ns

top

Output Data Setup Time

220

ns

tpo

Output Data Hold Time

65

ns

tPF

Input Data Hold Time

110

ns

<

tpp

PROG Pulse Width

c/J
LLI

tPL

c:

tLP

I-

<
(j
oC/)
C/)

Z

oen

1510

ns

Port 2 I/O Data Setup

400

ns

Port 2 I/O Data Hold

150

ns

C/)

o

~

<
C
<
@

WAVEFORMS

PORT 2 TIMING

A~E

J

\'--..........---~

EXPANDER
PORT
OUTPUT

PCH

EXPANDER
PORT
INPUT

PCH

PROG

6-D3

Test Conditions

8048/8748/8035·
WAVEFORMS

Instruction Fetch Fr~m External Program Memory

l:··~~-'-LL -=1·_·__ ._- ~y-ALE

J

----'I

'--_____;-1~-----'L

PSEN

BUS
INSTRUCTION

Read From External Data Memory
ALE

J

L

RD

BUS

Write to External Data MemorV
ALE

J

L

WR

BUS

WARNING:

An attempt to program a missocketed 8748 will result in severe
damage to the part_ An indication of a properly socketed part is the
appearance of the ALE clock output. The lack of this clock may
be used to disable the prqgrammer.

6-04

8048/8748/8035
Data show that constant exposure to room level flourescent lighting could erase the typical 8748 in approxmately 3 years while it would take approximately 1 week
to cause erasure when exposed to direct sunlight. If the
8748 is to be exposed to these types of lighting conditions
for extended periods of time, opaque labels are available
from Intel which should be placed over the 8748 window
to prevent unintentional erasure.

Programming Options
The 8748 EPROM can be programmed by either of two
Intel products:

c

w

~
a::
o
D.

a::

·1. PROMPT-48 Microcomputer Design Aid, or
2. Universal PROM Programmer (UPP-101 or UPP-1021
peripheral of the Intelleci!!l Development System with a
UPP-848 Personality Card.

o

The recommended erasure procedure for the 8748 is exposure to shortwave ultraviolet light which has a wavelength
of 2537 Angstroms (A). The integrated dose (i.e., UV
intensity X exposure time) for erasure should be a minimum of 15W-sec/cm 2 • The erasure time with this dosage
is approximately 15 to 20 minutes using an ultraviolet lamp
with a 12000tIW/cm 2 power rating. The 8748 should be
placed within one inch from the lamp tubes during erasure.
Some lamps have a' filter on their tubes and this filter
should be removed before erasure.

tJ

~

iii
w

I-

ct

8748 Erasure Characteristics

CI)
CI)

The erasure characteristics of the 8748 are such that
erasure begins to occur when exposed to light with wavelengths shorter than approximately 4000 Angstroms (A).
It should be noted that sunlight and certain types of flourescent lamps have wavelengths in the 300()'4000A range.

g
ct
all
w
Z

a::

oCD

CI)

o

:!:

ct
c
ct

WAVEFORMS
Combination ProgramNerify Mode (EPROM's Only)
f---------

@

PROGRAM

--------'*0---

I~----PROGRAM----

TO

DBO-DB7

J--

---<

DATA TO BE
PROGRAMMED VALID

NEXT ADDR
VALID

x==

NEXT
ADDRESS

LAST
ADDRESS

.":~: ~= = = = = = = = = = =-I-O=~=~:OW~- 'U~_-~-:_- _--I

~
--,'-------_

__________________________

~--- --""'\.'-_____L..;........¥J

Verify Mode (ROM/EPROM)
TO.RESET

\ __-----11

~\\.-. _ _- - - J/

=>---

---<'-___A_~_~_~_Js_S

ADDRESS
(0-7) VALID

_

____________J)('__________A_D_D_R_E_SS_(8_-_9)_V_A_L_ID________

s

__JX'__~_~_~T_VD_A~_iD_A_'>_

-

-

-

-

-

-

N_E_X_T_AD_D_R_E_SS_V~A-L-ID--------------

___________

-

__

3. THE FOLLOWING CONDITIONS MUST BE MET:
TTL '1'
AOa TTL '0'
THIS CAN BE DON'E USING 10K RESISTORS TO Vee. Vss RESPECTIVELY.
4. Xl AND X2 DRIVEN BY 3 MHz CLOCK WILL GIVE 5 psec ICY. THIS IS GOOD
FOR -8 PARTS AS WELL AS NON -8 PARTS.

NOTES:
1. PROG MUST FLOAT IF EA IS LOW (i .•.• ~ 25V). OR IF TO
FOR THE 8041 PROG MUST ALWAYS FLOAT.
2. VEAH FOR 8041· 11.4V MIN .• 12.6V MAX.

__J)(~·

\'-----

cs=

5V FOR THE 8741.

6~D5

8048/8748/8035
AC TIMING SPECIFICATION FOR PROGRAMMING
TA-25°C+5°C
, Vcc=5V+5%
- , Voo=25V+1V
Min.

Parameter

Symbol

"

tAW

Address Setup,Time to RESET I

4tcy

tWA

Address Hold Time After RESET I

4tcy

tow

Data ,in Setup Time to PROG 1

4tcy

two

Data, in Hold Time After PROG I

4tcy

tPH

RESET Hold Time to Verify

4tcy

tvoow

Voo

4tcy

tVOOH

Voo Hold Time After PROG I

0

tpw

Program Pulse Width

50

trw

Test 0 Setup Time for Program Mode

41cy
41cy

twr

Test 0 Hold Time After Program Mode

too

Test btoData Out Delay

tww

RESET Pulse Width to Latch Address

41cy

tr.

tf

Max.

Unit

,':'

,

,Te.(eo~ffitl~';'/;';;:

<'"

60

MS

41cy

Voo and PROG Rise and Fall Times

0.5

tCY

CPU Operation Cycle Time

5.0

tRE

RESET Setup Time Before EA 1

41cy

2.0

p's
p's

Note: If Test 0 is high too can be triggered by RESET I.

DC SPECIFICATION FOR PROGRAMMING
TA = 25°C ± 5°C, Vee = 5V ± 5%, Voo = 25V ± ,1V
Symbol

Parameter

Min.

Max.

Unit

VOOH

Voo Program Voltage High Level

24.0

26.0

V

VOOL

Voo Voltage Low Level

4.75

5.25

V

VPH

PROG Program Voltage High Level

21.5

24.5

V

VPL

PROG Voltage Low Level

0.2'

V

VEAH

EA Program or Verify Voltage High Level

VEAL

21,5

24.5

V

EA Voltage Low Level

5.25

V

100

Voo High Voltage Supply Current

30.0

mA

IpROG

PROG High Voltage Supply Current

16.0

mA

lEA

EA High Voltage Supply Current

1.0

mA

6-06

Test Conditions

8049/8039

w

Ambient Temperature Under Bias ........ 0° C to 70° C
Storage Temperature ............... -65°Cto+150°C
Voltage on Any Pin With
Respect to Ground ...................... -0.5V to +7V
Power Dissipation .... . . . . . . . . . . . . . . . . . . . . .. 1.5 Watt

·COMMENT: Stresses above those listed und9t "Absolute
Maximum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional
operation of the device at these or any other conditions
above those indicated in the operational sections of this
specification is not implied. Exposure to absolute
maximum rating conditions for extended periods may
affect device reliability.

a:
o
u

D.C. AND OPERATING CHARACTERISTICS

TA

ABSOLUTE MAXIMUM RATINGS·

c

~
a:
oD.

= DoC to

70°C, Vee

= Voo = +5V ±1 0%. Vss = OV

~

u)
w

~

gen

Symbol

Limits

Parameter
Min.

Unit

Typ.

Test Conditions

Max.

VIL

Input Low Voltage
(All Except XTALl. XTAL2)

-0.5

0.8

VIH

w

Input High Voltage
(All Except XTALl. XTAL2. RESET)

2.0

Vee

V

a:

oCO

VIHl

Input High Voltage (R ESET. XTALl)

3.0

Vee

V

o

VOL

Output Low Voltage
(BUS. RD. WR. PSEN. ALE)

0.45

V

IOL

= 2.0mA

VOLl

Output Low Voltage
(All Other Outputs Except PROG)

0.45

V

IOL

= 1.6mA

VOH

Output High Voltage
(BUS. RD. WR. PSEN. ALE)

2.4

V

IoH

= 100J1A

VOHl

Output High Voltage
(All Other Out puts)

2.4

V

IOH

= 50J1A

IlL

Input Leaka~c Current
(Tl. EA. INT)

IOL

Output Leakage Current (Bus. TO)
(H}gh Impedance State)

100

Power Down Supply Current

en

<
all

Z

en
~

<
c
c(

@

±10

loo+lce Total Supply Current

A.C. CHARACTERISTICS

V

TA =

o°c to 70 n C.

J1A

VSS~VIN~Vee .

-10

J1A

Vee~VIN~VSS + 0.45

20

50

mA

TA

75

140

mA

TA = 25°C

Vee = Voo

= 25°C

= +5V ±10%. Vss = ov
8049/8039
Unit

Parameter

Symbol

Min.

Conditions

Max.
ns

tLL

ALE Pulse Width

400

tAL

Address Setll[J to ALE

150

ns

80

ns

tLA

Address Hold from ALE

tee

Control Pulse Width (PSEN. RD. WR)

900

ns

tow

Data Set·Up Before WR

500

ns

two

Data Hold After WR

120

ns

CL = 20 pF

tey

Cycle Time

2.5

15.0

J1S

6 MHz XTAL

tOR

Data Hold

0

200

ns

tRO

PSEN. RD to Data In

tAW

Address Setup to WR

500

tAD

Address Setup to Data In

tAFe

Address Float to RD. PSEN

A.C. TEST CONDITIONS

950
0

Control Outputs: CL = 00 pF

6-07

ns
ns

230

ns
ns

BUS Outputs: CL = 150 pF

tey = 2.5J1s

8049/8039
WAVEFORMS
Instruction Fetch From External Program Memory

I -tll--I

--------~y--------

ALE

J I. . ________. .

L

- tAFcl-ta;-i

----------~--~~

~--------------

BUS

INSTRUCTION

Read From External Data Memory

ALE

J
l-4--f(;C-1

RD

---------~I

'm
BUS

L
-----------

~I

-I I

".OATING

11- "'~

F L O A T I N G - - - I = - t - O - A - T - I N - G - ,- - -

.I-'A,,~I
Write To External Data Memory

ALE

J
I-tce

WR

-------.1

Itow
BUS

4-tAW_
6-08

L

8041/8741
ABSOLUTE MAXIMUM RATINGS*

c

w

~
oD.

c:
c:
o

AmbientTemperature Under Bias ........ O°C to 70°C
Storage Temperature .. . . . . . . . . . . . .. -65°C to +150°C
Voltage on Any Pin With
RespecttoGround ...................... 0.5Vto+7V
Power Dissipation .. . . . . . . . . . . . . . . . . . . . . . . .. 1.5 Watt

o

D.C. AND OPERATING CHARACTERISTICS

~
u)
w

TA

~
o
(I)

U

= O°C to 70°C, Vcc = Voo = +5V

CI/:I

w
Z
c:

o

±5%, Vss

= OV
Limits

Symbol

Parameter

Min.

Max.

Unit

VIL

Input Low Voltage(AIi
Except Xl. X2)

-0.5

O.B

V

VIH

Input High Voltage (All
Except Xl. X2 RESET)

2.0

Vcc

V

VIH2

Input High Voltage (Xl.
RESET)

3.0

Vcc

V

VOL

Output Low Voltage (Oo-D7.
Sync)

0.45

V

IOL

= 2.0

VOL2

Output Low Voltage (All
Other Outputs Except Prog)

0.45

V

IOL

= 1.6 mA

VOH

Output High Voltage (OO-D7)

2.4

V

IOH = -400J.lA

VOHI

Output High Voltage (All
Other OutputS)

2.4

V

IOH = -50J1.A

III

Input Leakage Current
(To. T,. RD. WR. CS. Ao. EA)

±10

pA

Vss

~

IOL

Output Leakage Current
(Oo-D7. High Z State)

±10

pA

Vss

+ 0.45 ~ VIN

100

Voo Supply Current

10

25

mA

65

135

mA

(I)

oct

·COMMENT: Stresses above those listed under "Absolute
Maximum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional opera·
tion of the device at these or any other conditions above
those indicated in the operational sections of this specifi·
cation is not implied. Exposure to absolute maximum
rating conditions for extended periods may affect device
reliability.

In

Typ.

Test Conditions

(I)

o

~
oct

c

oct

@

Icc + 100 Total Supply Current
Output Low Voltage (Prog)
VOL3

rnA

VIN

~

Vee

V

IOl

IlI1

Low Input Source Current
PlO-P17 P20-P27

0.4

mA

Vll

= 1.0 mA
= O.BV

IlI2

Low Input Source Current
RESET.SS

0.2

mA

VIL

= O.BV

0.45

~

Vec

A.C. CHARACTERISTICS
TA

= O°C to 70°C, Vcc = Voo = +5V

±5%, Vss

= OV

DBB Read:
Symbol

Parameter

8741
Min.

8041

Max.

Min.

Max.

Units

tAR

CS, Ao Setup to RD ,

60

0

ns

tRA

CS, Ao Hold After RD t

30

0

ns

tRR

RD Pulse Width

tAD

CS, Ao to Data Out Delay

tRD

RD , to Data Out Delay

tOF

RD t to Data Float Delay

tRV

Recovery Time Between Reads
And/Or Write

tCY

Cycle Time

300

2)( tCY

250

370
200
10

ns
150

ns

150

ns

10
140

tCY

= 2.5,..s

ns
100

ns

1

1

,..S

2.5

2.5

,..S

6-D9

Test Conditions

6 M Hz Crystal

8041/8741
DBB Write:

Symbol

8741
Max.

Parameter

Min.

8041
Max.

Min.

Units'

tAW

CS, Ao Setup to WR ,

60

0

ns

tWA

CS, Ao Hold After WR t

30

0

ns

tww
tow
two

WR Pulse Width

300

. Data 'Setup to WR t
Data Hold After WR t

250

ns

250

2)( tCY

150

ns

30

0

ns

Test Conditions

tCY

= 2.5 ",s·

A.C. TEST CONDITIONS
DrDo Outputs

RL = 2.2k to Vss .

4.3k to Vee

CL

= 100 pF

WAVEFORMS
Read Operation -

Data Bus Buffer Register

(SYSTEM'S
ADDR ESS BUS)

~OR Ao

~---------------------

I---------.Rv----t-------I
I----·R.----I

(R EAD CDNTRO.l)

--.RO-I ."

DATA BUS
(OUTPUT)

Write Operation -

Cl: DR Ao

~

-

tDF

l

--"'<----""m"d>>------Data Bus Buffer Register

r
4~~.A-w---l1------.w-w------IJ--~~~A--~----------------- . .-f L. .
V

DATA
DATA BUS __________________
DATA
J \J--DATAVALID-" _ _ ~__________________
~_ _
MAY CHANGE
MAY CHANGE
~
!INPUT)

J'IJ

6-010

(SYSTEM'S
ADDR ESS BUS)

'w"''''''''''

8041/8741
8748 Erasure Characteristics

c

w

~
a:
oD..

a:

o

(J

~

ui
w

~
C3
oCI)

CI)

ct

""

w

The erasure characteristics of the 8748 are such that
erasure begins to occur when exposed to light with
wavelengths shorter than approximately 4000 Angstroms (A). It should be noted that sunlight and certain
types of fluorescent lamps have wavelengths in the
3000-4000A range. Data show that constant exposure to
room level fluorescent lighting could erase the typical
8748 in approximately 3 years while it would take approximately one week to cause erasure when exposed
to direct sunlight. If the 8748 is to be exposed to these
types of lighting conditions for extended periods of.

time, opaque labels are available from Int~1 which
should be placed over the 8748 window to prevent
unintentional erasure.
The recommended erasure procedure for the 8748 Is exposure to shortwave ultraviolet light which has a wavelength of 2537 A. The Integrated dose (I.e., UV Intensity
x exposure time) for erasure should be a minimum of 15
W-sec/cm 2• The erasure time with this dosage Is approxImately 15 to 20 minutes using an ultraviolet lamp with a
12,000 JAW/cm 2 power rating. The 8748 should be placed
within one inch of the lamp tubes during erasure. Some
lamps have a filter on their tubes which should be
removed before erasure.

A.C. TIMING SPECIFICATION FOR PROGRAMMING
TA = 25°C ±5°C, Vee = 5V ±5%, Voo = 25V ±1V

Z

a:

oIII

Symbol

Min.

Parameter

Max.

Unit

60

MS

Telt Conditions

CI)

o

~

ct
ct

c

@

tAW

Address Setup Time to RESET I

4tcy

tWA

Address Hold Time After RESET I

4tcy

tow

Data in Setup Time to PROG I

4tcy

two

Data in Hold Time After PROG I

4tcy

tPH

RESET Hold Time to Verify

4tcy

tvoow

Voo

4tcy

tVOOH

Voo Hold Time After PROG I

0

tpw

Program Pulse Width

50

tTW

Test 0 Setup Time for Program Mode

4tcy

tWT

Test 0 Hold Time After Program Mode

4tcy

too

Test 0 to Data Out Delay

tww

RESET Pulse Width to Latch Address

4tcy

tr.lt

Voo and PROG Rise and Fall Times

0.5

tey

CPU Operation Cycle Time

5.0

tRE

RESET Setup Time Before EA I

4tcy

Note:

If

TEST 0 is high. too

can

4tcy
2.0

'"'s
'"'S

Min.

Max.

Unit

24.0

26.0

V

be triggered by RESET 1.

D.C. SPECIFICATION FOR PROGRAMMING
TA = 25°C ±5°C, Vee = 5V ±5%, Voo = 25V ±1V
Symbol

Parameter

VOOH

Voo Program Voltage High Level

VOOL

Voo Voltage Low Level

4.75

5.25

V

VPH

PROG Program Voltage High Level

21.5

24.5

V

0.2

V

21.5

24.5

V

VPL

PROG Voltage Low Level

VEAH

EA Program or Verify Voltage High Level

VEAL

EA Voltage Low Level

5.25

V

100

Voo High Voltage Supply Current

30.0

rnA

IPROG

PROG High Voltage Supply Current

16.0

rnA

lEA

EA High Voltage Supply Current

1.0

rnA

6-011

Test Conditions

8041/8741
WAVEFORMS
Combination ProgramlVerify Mode (EPROMs Only)

1 - - - - - - - - - PROGRAM

----------t--- VERIFY--~FI~'---- PROGRAM - - - - -

------"'\.
TO

DBO-DB7

PZO-P,

'J--.

DATA TO BE
PROGRAMMED VALID

--

-<

NEXT
ADDR
VALID

X=='

NEXT
ADDRESS

LAST
ADDRESS

, :~~: -~- -'- -'~ ~= - - ~ - - - - -~ -'- - - - -_'D-,_~ ·~ D~W~:Df,'~_-~·-,'_-_-'

-J---------------------

:~ ------""'\"'------l..;..._Jt "

1-1.

--''''--------

Veriiy Mode (ROM/EPROM)

VERIFY MODE (ROM/EPROMI

TO,RESET

DBO-DB7

Pzo-P,

~"'

.I/

________

\'--_----J/

J--

\'"----

NEXT
, ADDRESS

______-J)("'______

A_D_D_RE_S_S_(8_-_91_V_A_L_ID_ _ _ _ _

6-012

.I)(~_____N_E_X_T_A_D_D_R_ES_S_V_A_L_ID_ _ _ _ _ _ _ __

8243
'COMMENT: Stresses above thoselisted u~der ';Absolute
Maximum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional ~p(Jra.
tion of the device at these or any other conditions above.,
those indicated in the operational sections of this speci'i·} :':\'
cation is not implied. Exposure to absolute maximum,'
rating conditions for extended periods may affect device
reliability.

ABSOLUTE MAXIMUM RATINGS·
Q

w

~

a:
oa.
a:

o

CJ

~

Ambient Temperature Under Bias . . . . . . . . . o°c to 70"C
Storage Temperature . . . . . . . . . . . . . . -65°C to +150°C
Voltage on Any Pin
With Respect to Ground . . . . . . . . . . . . -0.5V to +7V
Power Dissipation . . . . . . . . . . . . . . . . . . . . . . . 1 Watt

en
w
~

g
~
w
Z

a:

o
III
C/)

o

::E
c(
Q
c(

@

D.C. AND OPERATING CHARACTERISTICS
Max;

Units

Input Low Voltage

-0.5

0.8

V

VIH

Input High Voltage

2.0

Vee+0 . 5

V

VOL1

Output Low Voltage Ports 4-7

Symbol
VIL

Parameter

Min.

Typ.

Test Conditions

0.45

V

IOL = 5 mA *

1

V

IOL = 20 mA

V

IOH= 240pA

VOL2

Output Low Voltage Port 7

VOH1

Output High Voltage Ports 4·7

2.4

11L1

Input Leakage Ports 4·7

-10

20

pA

Vin = Vee to OV

IIL2

Input Leakage Port 2, CS, PROG

-10

10

pA

Vin = Vee to OV

VOL3

Output Low Voltage Port 2

.45

V

ICC

Vee Supply Current

20

mA

VOH2

Output Voltage Port 2

IOL

Sum of all IOL from 16 Outputs

100

mA

10
2.4

IOL = 0.6 mA

IOH= 100pA
5 mA Each Pin

·See following graph for additional sink current capability.

A.C. CHARACTERISTICS
Symbol

Parameter

Min.

Max.

Units

Test Conditions

100

ns

80 pF Load

tA

Code Valid Before PROG

ts

Code Valid After PROG

60

ns

20 pF Load

te

Data Valid Before PROG

200

ns

80 pF Load

tD

Data Valid After PROG

20

ns

20 pF Load

tH

Floating After PROG

0

ns

20 pF Load

150

tK

PROG Negative Pulse Width

900

ns

tes

CS Valid Before/After PROG

50

ns

tpo

Ports 4-7 Valid After PROG

tLP1

Ports 4-7 Valid Before/After PROG

tAee

Port 2 Valid After PROG

700
100

100 pF Load

ns
750

6-013

ns

ns

80 pF Load

8243
WAVEFORMS

PROG

~-----------------tK----------------~

PORT 2

FLOAT

..

FLOAT

t ACC

OUTPUT
VAllO

PORT 2

~tpo

OUTPUT
VALID

PR EVIOUS OUTPUT VALID

PORTS 4·7

-

tiP

PORTS 4-7

INPUT VALID

tcs

6-014

tiP

c

w

~
o
a..

IX:
IX:

Chapter 7
ZILOG

o

zeo

CJ

~

enw

~
(3
oCI)
CI)

ct
oil

w
Z

IX:

o

til

CI)

o

~

ct
c
ct

@

Zilog Z80 microcomputer devices have been designed as 8080A enhancements. In fact, the same individuals
responsible for designing the 8080A CPU at Intel designed the zao devices at Zilog. The 8085, described in
Chapter 5, is Intel's 8080A enhancement.
.
. .
The Z80 instruction set includes all 8080A instructions as a subset. In deference to rational necessity,
however, neither the Z80CPU, nor any of its support devices attempt to maintain pin-for-pin compatibility with
8080A counterparts. Compatibility is limited to instruction sets and general functional capabilities. A program
that has been written to drive. an 8080A microcomputer system will also drive the ZSO system - within certain limits; for example, a ROM device that has been created to: implement object programs for an 8080A
microcomputer system can be physically remo~ed and used in 'a Z80 system.
But Z80-8080A comp~tibility does extend ~omewhatfurther, since most support devices that have been
designed for the 8080A CPU will also work with a Zeo CPU; therefore in many cases you will be able to upgrade
an 8080A microcomputer system to a Z80, confining hardware' modifications to the CPU and its immediate interface o n l y . '
.
It is interesting to note that the Z80 pins and signal interface is far closer than the 80S5 to the three-chip S080A
configuration illustrated in 8QSOA chapter: Also, whereas the Z8Q instruction set is greatly expanded as compared to
the 8080A the 8085 instruction set 'contains just two new instructions. However, both the Z80 and the 8085 have
resolved the two most distressing problems associated wi~h the 8080A~ the three-chip 8080A CPU has in both cases
been reduced to one chip, and the three 8080Apower supplies have in both cases been reduced to a single +5V power
supply.
.
.
ZILOG, INC., manufacturers of the Z80, are located at:
10460 Bubb Road
Cupertino, California 95014
The official second source for Zilog products is:
MOSTEK, INC.
1215 West Crosby Road
Carrollton, Texas 75006
N-Channel MOS technology is used for all Z80 devices.

THE

Z80 LSI
TECHNOLOGY

zao CPU

Functions implemented on the ZSO CPU are illustrated in Figure 7-1. They represent "typical" CPU logic,
equivalent to the three devices: 8080A CPU, 8224 Clock and 8228 System Controller.
.

A SUMMARY OF ZSO/SOSOA DIFFERENCES
Weare going to summarize Z80/S080A differences before describing differences in detail. If you know the
SOSOA well, read on; if you do not, come back to this summary after reading the rest of the Z80.CPU description. We will also contrast the ZSO and the 80S5, where relevant
. .

,

For the programmer, the Z80 provides more registers and addressing modes t~an the 8080A, plus a much larger
instruction set.
Significant hardware features are a single power supply (+5V), a single system clock signal, an additional interrupt, and logic to refresh dynamic memories.
....
.
.

7-1

Direct Memory
Access Control

Interface Logic

Interface Logic

Programmable
Timers

Read Only
Memory .

Interface Logic

I/O Ports

Memory

Figure 7-1. Logic Functions of the Z80 CPU
The 8085 also has a single power supply and a single system clock signal. The 8085 has three additional interrupts. but
lacks logic to refresh dynamic memories.

I.s the ZBO CPU indeed the logical next BOBOA evolution?
Hardware aspects of the BOBOA represent its weakest features, as compared to principal current competitors.
Specifically. the fact that the 8080A is really a three-chip CPU is its biggest single problem: three chips are always
going to cost more than one. Next. the fact that the 8080A requires three power supplies (+5V. -5V and + 12V) is a very
negative feature for many users and the desirability of going to a single power supply is self-evident: the Z80 requires a
single +5Vpower supply. This is also true of the 8085.
The problems associated with condensing logic from three chips onto one chip are not so straightforward. Figure 7-2 illustrates the standard three-chip 8080A CpU. Let us assume that the three devices are to be condensed into a single
chip. Asterisks (*) have been placed by the signals which must be maintainf~d if the single chip is to be hardware compatible with the three chips it replaces. Forty-three signals are asterisked. therefore the standard 40-pin DIP cannot be
used. The 'problem is compounded by the fact that not all 8080A systems use an 8228 System Controller. Some 8080A
systems use an 8212 bidirectional 1/0 port to create control signals. A few' of the earliest 8080 systems use neither the
8228 System Controller. nor an 8212 1/0 port: rather external logic decodes the Data Bus when SYNC is true in order to
generate control signals; for example. that is how the TMS5501 works. We must therefore conclude that any attempt

7-2

to reduce three chips to cine will create a product that is not pin compatible with the 8080A: and. indeed. the Z80 is not
pin compatible. What Zilog has done is include as many hardware enhancements as possible within the confines of a
40-pin DIP that must be philosophically similar to the 8080A. without attempting any form of pin compatibility. Figure
7-2 identifies the correlation between Z80 signals and 8080A signals. Notice that there is a significant similarity.
Q

w

~
a:
oD..

a:

o
u

~
(I)

w

~

g

Figure 5-3 is equivalent to Figure 7-2. comparing 8085 and 8080A signals. Z80 signals are far closer to the 8080A
three-chip set than the 8085.
Here is a summary of the hardware differences:
1)
2)

Clock logic is entirely within the Z80.

3)

The complex. two clock signals of the 8080A have been replaced by a single clock signal.

4)

Automatic dynamic memory refresh logic has been included within the CPU.

5)

Read and write control signal philosophy has changed. The 8080A uses separate memory read. memory write. I/O
read and I/O write signals. The Z80 uses a general read and a general write. coupled with a memory select and an
I/O select. This means that if a Z80 CPU is to replace an 8080A CPU then additional logic will be required beyond
the Z80 CPU .. You will either have to combine the four Z80 control signals to generate 8080A equivalents. or you
will have to change the select and strobe logic for every I/O device. We will discuss this in more detail later.

6)

Address and Data Bus float timing associated with DMA operations have changed. The 8080A floats these busses
at the beginning of the third or fourth time period within the machine cycle during which a bus request occurs:
this initiates a Hold state. The Z80 has a more straightforward scheme: a Bus Request input signal causes the Data
and Address Busses to float at the beginning of the machine cycle: floating busses are acknowledged with a Bus
Acknowledge output signal.

7)

The Z80 has an additional interrupt request. In addition to.the RESET and normal 8080A interrupt request. the Z80
has a nonmaskable interrupt which is typically used to execute a short program that prepares for power failure.
once a power failure has been detected.

CI)
CI)

ct
olI

w
Z
a:

oCD

CI)

o

~

ct

Q

ct

@

The Z80 has reduced three power supplies to a single +5V power supply.

Now consider internal organization of the

zao in terms of instruction set compatibility and enhancement.

As illustrated by Table 7-3 the 8080A instruction set is. indeed. a subset of the Z80 instruction set. Unfortunately. the
Z80 uses completely new source program instruction mnemonics. therefore 8080A instructions carinot immediately be
identified. Technical Design Labs. Inc .. has an 8080-like Z80 assembly language .
2
20

.GND
• +6\1

II

·5V
+ 12V

21

13

1tmiiCi SYSTEM DMA REO

808010.
CPU

14

SYSTEM INT. REO.

NT. ENABlE

r,~[J1TAL

. .
14

TNW.~

~tt.

MNW~
.liESiN
.'2V~

.

INT-.

Ie

INTl·

Wi!
OBiN
. HLDA

1224
CLOCK
GENERATOR
DRIVER

10.0""1
10.1
IU
10.3
10.4
10.5
Ae
10.7

AS

22
15

II

10
4
I
5

4>1.·

W11'I"..;f
12

m

--2(7

19

DO
01
D2
03
D4
05
DB
07

4>2·
WArT·
READY·
RESET·.
SYNC·

STATUS STROBE

10.12
10.13
10.14
10.15 ...

,'-

L

17
21

~
~
~
~
~

13

8228
•
BIDIRECTIONAL.
BUS DRIVER •

~ ----,

DEN~.
1li'

•

Z80 equiv• . ,•. or new lign.ll.
Signlil reproduced by the zeo.
Signlil which mUlt be dupliclted by I

_

BUsAK

3'

~
•
17

GN

) ADDRESS BUS.

10.9
10.10
10.11

2[ 41

IS

.IV~

OND

HOlD·

• 10.0 125
2e
·10.1
27
·10.2
29
·10.3
30
·10.4
31
·10.5
32
·Ae
33
·10.7
34
·10.8
35
·10.9
I
·10.10
_AlL
·10.11
37
·10.12
J8
·10.13
JII
·10.14
J8
·10.15

SYSTlM
CONTROL

=t

\8
11

082

I

::

~
'11

20
7

'1 lORa MI
24
20
25

MREO RD
MREQ WR
lORa RO

7,KJ-"~

)DATABUh

085
DB8
017

iNTA

MEMR
MfMW
iiCiii
iiOw

~} TheM.,. zeo lignall
HALT

NMi

with no 808010.
counltlf'P8rt

... NPioclmont product.

Figure 7-2. The Standard 8080A Three-Chip System and Z80 Signal Equivalents

7-3

CONTROL BUS

There are very few unused object codes in the 8080A instruction set. The Z80 has therefore taken what few unused object codes there are. and used them to specify that an additional byte of object code. follows:
110111014-Spare 8080A object code
4-Specifies new Z80 object code follows
This results in most new Z80 instructions having 16-bit object codes; but simultaneously it means that a very large
number of new instructions can be added.
Any enhancement of the 8080A can include major changes within the CPU; providing the 8080A registers and status
flags remain as a subset of the new design. instruction compatibility remains. These are the principal enhancements
made by the Z80:
1)

The standard general purpose registers and status flags have been duplicated. This makes it very easy to handle
single-level interrupts. since general purpose register and Accumulator contents no longer need to be saved on the
Stack; instead. the program may simply switch to the alternate register set.

2)

Two Index registers have been added. This means that additional Z80 instructions can use indexed memory addressing.

2)

An Interrupt Vector register allows external logic the option of responding to an interrupt acknowledge by issuing
the equivalent of a Call instruction - which vectors program execution to a memory address which is dedicated
.
to the acknowledged external logic.

4)

A single Block Move instruction allows the contents of any number of contiguous memory bytes to be moved from
one area of memory to another. or between an area of memory and a single I/O port. You can also scan a block of
memory for a defined value by executing a Block Compare instruction.

5)

Instructions have been added to test or alter the condition of individual register and memory bits.

In contrast to the extensive enhancements of the Z80. the 8085 registers and status architecture are identical to the
8080A. There are only two additional instructions in the 8085 instruction set; however. the 8085. like the Z80. allows
Call instructions to be used when acknowledgi~g an interrupt - a particularly useful enhancement.
While on the surface the zao instruction set appears to be very powerful, note that instruction sets are very
subjective; right and wrong, good and bad are not easily defined. Let us look at some nonobvious features of the
zao instruction set.
.
.
First of all. the ex.ecution speed advantage that results from the new Z80 instructions is reduced by the fact that many
of these instructions require two bytes of object code. Some examples of Z80 instructions and equivalent 8080A instruction sequences with equivalent cycle times are given in Table 7-1.
Table 7-1. Comparisons of Z80 and 8080A
Instruction Execution Cycles
8080A

Z80
Instru ctions
LD

R.(lX

Cycles

+

d)

19

Instructions
LXI
DAD
MOV

H.d
IX
R;M

LD

RP.ADDR

20

LHLD
MOV
MOV

ADDR
C.L
B.H

SET

B.(HL)

15

MOV
ORI
tvlOV

A.M
MASK
·M.A

Cycles
10
10

227
16
5
'5

26
7
7
7

21

Also. a novice programmer may find the Z80 instruction set bewilderingly complex. At a time when the majority of potential microcomputer users are terrified by simple assembly language instruction sets. it is possible that users will
react negatively to an instruction set whose complexity (if not power) rivals that of many large minicomputers.
Many of the new Z80 instructions use direct. indexed memory addressing to perform operations which are otherwise
identical to existing 8080A instructions .. Now the zao has two new 16-bitlndex registers whose contents are added to

7-4

an a-bit displacement provided by the instruction code: this is the scheme adopted by the Motorola MC6aOO. This
scheme is inherently weaker than having a 16-bit. instruction-provided displacement. as implemented by the Signetics
2650. When the Index register is larger than the displacement. the Index register. in effect. becomes a base register.
When the Index register has the same size. or is smaller than the displacement. it is truly an Index register as described
in "Volume 1 - Basic Concepts". The Signetics 2650 implementation is more powerful.

cw

~
II:
oD..
II:

o(,)
~

u)
w

~

g

zao PROGRAMMABLE REGISTERS
We will now start looking at the Z80 CPU in detail, beginning with its programmable registers.
The Z80 has two sets of 8-bit programmable registers, and two Program Status Words. At any time one set of
programmable registers and one Program Status Word will be active and accessible.
In addition, the Z80 has a 16-bit Program Counter, a 16-bit Stack Pointer, two 16-bit Index registers, an 8-bit
Interrupt Vector and an 8-bit Memory Refresh register.
Figure 7-3 illustrates the Z80 registers. Within this figure, the 8080A registers' subset is shaded.

CI)
CI)

ct
These two 8-, bit registers
are sometimes treated ~
_ _ _~

o1J
w
Z

{

II:

o

as a 16-bit unit

~

III
CI)

o

Program Status Words
Primary Accumulators

~

ct
C
ct

@

TsW'Il..J

t-~~-,-+-~~--t Secondary Accumulators/Data Counter
Secondary Accumulators/Data Counter

Secondary Accumulators/Data Counter
Stack Pointer
t---~:--::--~~-t. Program Counter

IV

Index Register X
Index Register V
Interrupt Vector

R

Memory Refresh Counter

IV

A'
B'
0'

H'

f

C'
E'
L'

Shaded registers represent the 8080A subset.'

Figure 7-3. zao Programmable Registers

The Z80 uses its Program Status Word, its A, B, C, 0, E, H, and L registers, plus the Stack Pointer and the Program Counter exactly as the 8080A uses these locations; therefore no additional discussion of these registers
is needed.
The Program Status Word, plus registers A, B, C, 0, E, Hand L are duplicated. Single zao instructions allow you to
switch access from one register set to another. or to exchange the contents of selected registers. At any time. one or
the other set of registers. but not both. is accessible.
There are two 16-bit Index registers, marked IXand IV. These are more accurately looked upon as base registers. as
will become apparent when we examine zao addressing modes.
The Interrupt Vector register performs a function'similar to the ICW2 byte of the 8259 PICU device (described
in the 8080A chapter). zao interrupt acknowledge logic gives you the option of initiating an interrupt service routine
with a Call instruction. where the high order address byte for the call is provided by the Interrupt Vector register. The
80a5 also provides this capability.
The Memory Refresh Counter register represents a feature of microcomputer systems which has been overlooked by everyone except Fairchild and Zilog. Dynamic memory devices will not hold their contents for very long.
irrespective of whether power is off or on. A dynamic memory must therefore be accessed at millisecond intervals.
Dynamic memory devices compensate for this short-coming by being very cheap - and dynamic refresh circuitry is
very simple. Using a technique akin to direct memory access. dynamic refresh circuitry will periodically access dynamic
memories. rewriting the contents of individual memory words on each access. About the only logic needed by dynamic
refresh is a counter via which it keeps track of its progress through the dynamic memory: that is the purpose of the zao
Memory Refresh Counter register. The zao also has 'a special DMA refresh control signal: therefore the zao provides
much of the dynamic refresh logic needed by dynamic memory devices.

7-5

zao ADDRESSING MODES
zao instructions use all of the aOaOA addressing modes; the ZaOalso has these two enhancements:
1)

A number of memory reference instructions use the IX and IV registers for indexed, or base relative addressing.

2)

There are some two-byte program relative Jump instructions ..

A memory reference instruction that uses the IX or IY register will include a single data displacement byte. The 8-bit value provided by the instruction object code is added to the 16-bit value
provided by the identified Index register in order to compute the effective memory address:

zao
INDEXED
ADDRESSING

PROGRAM
MEMORY

5d--

, ':::,IY
"

I
0. Cod,
"~~~ D;,~."me",

Effective Address

=

ppqq + dd

I

I

I

•

I

)II'

}

Memory

.

Reference
instruction

P. q and d represent any hexadecimal digits;
dd represents an 8-bit. signed binary value.

This is standard microcomputer indexed addressing and is less powerful than having the memory
reference instruction provide a 16-bit base address or displacement; for a discussion of these addressing modes see
"Volume 1 - Basic Concepts", Chapter 6.
.
The program relative. two-byte Jump instructions provided by the Z80 provide standard two-byte, program relative addressing. A single. 8-bit displacement is provided by the Jump instruction's object code: this 8-bit displacement is added. as a signed binary value, to the contents of the Program Counter - after the Program Counter has been incremented to point to the sequential instruction:
PROGRAM
MEMORY

Memory
Address

XX

ppqq-2
ppqq-l
ppqq
ppqq + 1
ppqq +2

Branch instruction op code ~
Displacement ~

dd

Program Counter

The next instruction object code will be fetched from memory location ppqq+2+dd. p. q. and d represent any hexadecimal digits. dd represents a signed binary. 8-bit value.
For a discussion of program relative addressing. see "Volume 1 - Basic Concepts"

The zao addressing enhancements are of significant value when comparing the zao to the aOaOA.
The value of the Index register comes not so much from having an additional addressing option. but rather IX and IY
allow an efficient programmer to husband his CPU register space more effectively. Look upon IX and IY as performing
memory addressing tasks which the 8080A would have to perform using the BC and DE registers. By freeing up the BC
and DE. registers for data manipulation, you can significantly reduce the number of memory reference instructions ex.
ecuted by the Z80.

7-6

The two-byte program relative Jump instruction is useful because in most programs 80% of the Jump instructions
branch to a memory location that is within 128 bytes of the Jump. That is the rationale for most microcomputers offering two-byte as well as three-byte Jump instructions.

zao STATUS
c

w

~
II:
oD..

The Z80 and 8080A both use the Program Status Word in order to storo status flags. These are the Z80 status
flags:
Carry (C)
Zero (Z)
Sign (S)
Parity/Overflow (P/O)
Auxiliary Carry (AC)
Subtract (N)

II:

o

U

~

u)

w

~

g

Statuses are recorded in the Program Status Word by the Z80. as compared to the 8080A. as follows:

CI)
CI)

7 6 5 '"

all

w

Z

7 6 5 '" 3 2 1 0

II:

III
CI)

o

c(

cc(
@

No.

~ Bit No.

Is Iz IX est X Ip IX Ic ~ a080A Program Status Word

o

::!

3 2 1 0 ~ Bit

Is Iz IX rei X lij N Ic ~ zao Program Status Word

c(

The Parity/Overflow and Subtract statuses differ from the 8080A. All other statuses are the same. Note that
the Z80, like the 8080A, uses borrow philosophy for the Carry status when performing subtract operations. That is
to say. during a subtract operation. the Carry status takes the reciprocal value of any Carry out of the high-order bit. For
details see the 8080A Carry status descriptions given in the 8080A chapter.
The 8080A has a Parity status but no Overflow status. The Z80 uses a single status flag for both operations. which
makes a lot of sense. The Z80 Overflow status is absolutely standard. therefore only has meaning when signed binary
arithmetic is being performed - at which time the Parity status has no meaning. Within the Z80. therefore. this single
status is used by arithmetic operations to record overflow and by other operations to record parity. For a complete discussion of the Overflow status see "Volume 1 - Basic Concepts".
The Subtract status is used by the DAA instruction for BCD operations. to differentiate between decimal addition or
subtraction. The Subtract and Auxiliary Carry statuses cannot be used as conditions for program branching (conditional Jump. Call or Return instructions).

zao CPU

PINS AND SIGNALS

The Z80 CPU pins and signals are illustrated in Figure 7-4. Figure 7-2 providos the direct comparison between
Z80 CPU signals and the standard 8080A, 8228, 8224 three-chip systems.
Let us first look at the Data and Address Busses.
Ttle 16 address lines AO - A 15 output memory and I/O device addresses. The address lines are tristate: they may
be floated by the Z80 CPU. giving external logic control of the Address Bus. There is no difference between Z80 and
8080A Address Bus lines.
The Data Bus lines DO - D7 transmit bidirectional data into or out of the Z80 CPU. Like the Address Bus lines. the
Data Bus lines are tristate. The Z80 Data Bus lines do differ from the 8080A equivalont. The 8080A Data Bus is
multiplexed: status output on the Data Bus by the 8080A during the T2 clock period of very machine cycle is strobed
by the SYNC pulse. The Z80 does not multiplex the Data Bus in this way. The Z80 Data Bus lines operate at normal TTL
levels. whereas the 8080A Data Bus lines do not.
Control signals are described next; these may be divided into system control, CPU control
and Bus control. First we will describe the System control signals.
M1 identifies the instruction fetch machine cycle of an instruction's execution. Its function
is similar, but not identical to the 8080A SYNC pulse. The Z80 PIO device uses the low M1
pulse as a reset signal if it occurs without 10RO or RD simultaneously low.

Z80 SYSTEM
CONTROL
SIGNALS

MREO identifies any memory access operation in progress; it is a tristate control signal.
lORa identifies any I/O operation in progress. When 10RO is low. AO - A7 contain a valid I/O port address. lORa is
also used as an interrupt acknowledge; an interrupt is acknowledged by M 1 and lORa being output low - a u nique combination. since M1 is otherwise low only during an instruction fetch. which cannot address an I/O device.

7-7

RD is a tristate signal which indicates that the CPU wishes to read data from either memory or an I/O device. as
identified MREO or 10RO.
WR is a tristate control signal which indicates that the CPU wishes to write data to memory or an I/O device as indicated by MREO and 10RO. Some laO I/O devices have no WR input. These devices assume a Write operation when
10RO is low and RD is high. RD low specifies a Read operation.
The various ways in which the three control signals. M1. 10RO. and RD. may be interpreted are summarized in Table
7-5. which occurs in the description of the laO PIO device.

RFSH is a control signal used to refresh dynamic memories. When RFSH is output low. the current MREO signal
should be used to refresh dynamic memory. as addressed by the lower seven bits of the Address Bus. AO - A6.
Next we will describe CPU control signals.

All

1

40

2

39

3
4

38

A15

5

36



6

35

AS

7

34
33
32
31
30
29
28
27
26
25
24
23
22
21

A4

A12
~13

A14

D4

D3

~

--

--'"

8

D5

9
10

D6

+5V
D2

D7

DO
Dl
INT

NMi
HALT

37

-

--

ZOO
CPU

11
12
13
14
15
16

MREQ

17
18
·19

iORQ

20

Al0
A9
_

..

A8
A7
A6

A3

A2
Al

AO
GNO

..

RFSH .
.Ml

RESET

WSRQ
WAIT

WSAK

Wii
iID

PIN NAME

DESCRIPTION

TYPE

AO - A15

Address Bus

Trist

CPU clock

Output
Input

+5V.GND

Power and Ground

Figure 7-4. laO CPU Signals and Pin Assignments

7-8

HALT is output low following execution of a Halt instruction. The CPU now enters a Halt state
during which it continuously re-executes a NOP instruction in order to maintain memory refresh
activity. A Halt can only be terminated with an interrupt.

laO CPU
CONTROL
SIGNALS

c
w

WAIT is equivalent to the aOaOA READY input. External logic which cannot respond to a CPU
access request within the allowed time interval extends the time interval by pulling the WAIT input low. In response to
WAIT low. the Z80 enters a Wait state during which the CPU inserts an integral number of clock periods; taken
together. these clock periods constitute a Wait state.

o

a:

INT and NMI are t"\'o interrupt request inputs. The difference between these two signals is that NMI has higher
priority an~ cannot be disabled.

~
a:
oQ.
CJ

~

There are two Bus control signals.

en
w

RESET is a standard reset co!:'trol input. When the Z80 is reset. this is what happens:

g

The Program Counter. IV and

~

CI)
CI)

c(

ell

w
Z

a:

o
en
CI)

o

~

c(

cc(

@

R re~isters'

lao BUS
CONTROL
SIGNALS

contents are all set to zero.

Interrupt requests via INT'are disabled.
All tristate bus signals are floated.
BUSRQ and BUSAK are bus request and acknowledge signals. In order to perform any kind of DMA operation. external logic must acquire control of the microcomputer System Bus. This is done by inputting BUSRQ low; at the conclusion of the current machine cycle. the Z80 CPU will float all tristate bus lines and will acknowledge the bus request
by outputting BUSAK low.

zao -

8080A SIGNAL COMPATIBILITY

If you are designing a new product around the laO CPU, then questions of lao - aOaOA signal compatibility
are irrelevant; you will design for the CPU on hand.
If you are replacing an aOaOA with a laO, then it would be helpful to have some type of lookup table which
directly relates aOaOA signals to laO signals. Unfortunately, such a lookup table cannot easily be created. The
problem is that the Z80 is an implementation' of three devices; the 8080A CPU. the 8224 Clock. and 8228 System Controller; but there are very many 8080A configurations that do not include an 8228 System Controller.

Possibly the most important conceptual difference between the Z80 and 8080A involves read and write control signals.
The a228 System Controller develops four discrete control signals for memory read, memory write, I/O read and
I/O write. The zao has a general read and a 'general write, coupled with an I/O select and a memory select. By
adding iogic. it would be easy enough to generate the four discrete 8080A signals from the two Z80 signal pairs; here
is one elementary possibility:
.

MREa
AD
MREQ
WR

iORci
Ro
IORO
WR

zao·

aOaOA Equivalent

Signals

Signals

D
D

D
0
7-9

MEMR

MEMW

I/OR

I/OW

If your design allows it. however. it would be wiser to extend the Z80 philosophy to the various support devices surrounding the CPU. Recall from our discussion of 8080A supportdevices in Chapter 4 that every device requires separate device select and device access logic. For some arbitrary read operation. timing might be illustrated as follows:
Select
Read

\
______________________________

~r____\~

,

___________________

Strobe

With an 8080A scheme. select logic is decoded from Address Bus lines. while strobe logic depends on one of the four
control lines I/OR. I/OW. MEMR or MEMW. Using the Z80 philosophy. the memory select (MREO) or 1/0 select (lORO)
control, lines become part of the device select logic. while the read (RD) or write (WR) controls generate the strobe.

The zao has no interrupt acknowledge signal; rather it combines IORQ with M1 as follows:

IO:~ _______________~-------------Some Z~O support devices also check fora "Return-from-Interrupt" instruction object code appearing on the Data Bus
during an instruction fetch (when Ml and RD will both be low). This condition is used to reset interrupt priorities
among Z80 support devices.

.The aOaOA HOLD and HLDA signals are functionally reproduced by the zao BUSRQ and BUSAK signals.
The 8080A SYNC pulse has no direc't Z80 equivalent. Ml is pulsed low during an instruction fetch. or an interrupt
acknowledge. but it is not pulsed low during the initial time periods of an instruction's second or subsequent machine
cycles. Frequently the complement of M 1 can be used instead of SYNC to drive those 8080A peripheral devices
.
that require the SYNC pulse.

TheZaO has no signals equivalent to aOaOA INTE, WAIT or <1>2. There is also no signal equivalent to the a228
BUSEN.
If for any reason external logic must know when interrupts have been disabled internally by the CPU. then the Z80 will
be at a loss to provide any signal equivalent to the 8080A control signals. Remember INTE in an 8080A system tells external logic when the CPU has enabled or disabled all interrupts;since external logic can do nothing about interrupts
being disabled. and requesting an interrupt at this time does neither good nor harm. knowing that the condition exists
is generally irrelevant.
The single Z80 WAIT input serves the function of the 8080A READY input. Irrespective of when the WAIT is requested.
a Wait clock period will only be inserted between T2 and T3; moreover. as we will see shortly. there are certain Z80 instructions which automatically insert a Wait state. without waiting for external demand. You would need relatively
complex logic to decode instruction object codes. clock signal and the WAIT input if your Z80 system is to generate the
equivalent of an 8080A WAIT output. In all probability. it would be simpler to find an alternative scheme that did not
require a signal equivalent to the 8080A WAIT output.
The Z80 simply has no second clock equivalent to 8080A <1>2. Any device that needs clock signal <1>2 cannot easily be
used in Z80 configurations.
The 8228 BUSEN input is used by external logic to float the System Bus. In a Z80 system. CPU logic floats the System
Bus; therefore BUSEN becomes irrelevant.

The aOaOA CPU has no signals equivalent 'to zao RFSH, HALT and NMI.
RFSH applies to dynamic memory refresh only; it is irrelevant within the context of a Z80 - 8080A signal comparison.
NMI. being a nonmaskable interrupt request. also has no 8080A equivalent logic.

The zao HALT output needs some discussion. One of the more confusing aspects of the aOaOA is the interaction of Wait, Halt and Hold states. Let us look at these three states, comparing the zao and aOaOA configurations and in the process we will see the purpose of the zao HALT output.
The purpose of the Wait state is to elongate a memory reference machine cycle in deference to slow external memory
or I/O devices. The Wait state consists of one or more Wait clock periods inserted between T2 and T3 of a machine cycle. The 8080A and the Z80 handle Wait states in exactly the same way. except for the fact that the Z80 has no Wait
acknowledge output and under certain circumstances will automatically insert Wait clock periods.

7-10

The purpose of the Hold condition is to allow external logic to acquire control of the System Bus and perform Direct
Memory Access operations. Again both the Z80 and the 8080A have very similar Hold states. The only significant
difference is that the Z80 initiates a Hold state at the conclusion of a machine cycle. whereas the 8080A initiates the
Hold state during time period T3 or T 4. The 8228 System Controller also needs a high BUSEN input in order to float its
Data and Control Busses while the Z80 has no equivalent need.
Q

w

~
a:
oa.
a:

o
u

~

enw

The big difference between the Z80 and the 8080A comes within the Halt state. When the 8080A executes a Halt instruction. it goes into a Halt state. whi,ch differs from a Hold state. There are some complex interactions between Hold.
Halt. Wait and interrupts within 8080A systems. None of these complications exists in the Z80 system. since the Z80
has no Halt state. Afte~ executing a Halt instruction. the Z80 o~tputs HALT low. then proceeds to continuously execute
a NOP instruction. This allows dynamic memory refresh logic to continue operating. If you are replacing an aOaOA
with a zao, you must give careful attention to the Halt state. This is one condition where unexpected incompatibilities can arise.

~

g

zao TIMING AND INSTRUCTION EXECUTION

CI)
CI)

ct

IllS
w
Z

a:
o
m
CI)

o

:!!

ct
Q
ct

zao timing is conceptually similar to, but far simpler than aOaOA timing. Like the aOaOA,

the zao divides its instructions into machine cycles and clock periods. However. al1280 machine cycles consist of either three or four
clock periods. Some instructions always insert Wait clock periods. in which case five or six clock periods may be present ir"a machine cycle. Recall that 8080A machine cycles may,have three.,four or five clock periods.
The 808bA may require from one to five machine cycles in order to execute an instruction: Z80 instructions execute in
one to six machine cycles. If we shade optional machine cycles and clock periods. Z80 and 8080A instruction time subdivisions may be compared and illustrated as follows:

@

} 8080A

ackn~lfIledge

only

During input
or output

machine cycle'
only

7-11

zao clock signals are also far simpler than the aOaOA equivalent. Where the 8080A uses two clock signals the Z80
uses o'ne. Clock logic may be compared as follows:

Tl

T5

T3

T2

} OOOOA

Z80

INSTRUCTION FETCH EXECUTION SEQUENCES

As ~om'pared to the aoaOA, zao instructiol'! timing is '1larvelously simple. Gone is the SyNC pulse a~d the decoding cif Data Bus for status. Every instruction's timing' degenerat~s' into an instruction fetch, optionally followed by
memory orl/O read orwrite. Add to this a few variations for Wait sta'te, interrupt acknowledge and bus floating and you
are.done.'
. .
\,
,,'
..
.
,

.

-

.

'

Let us begin by looking at an instruction fetch. Timing is illustrated in Figure 7-5. Look at the instruction fetch timing
in the 8080A chapter to obtain an immediate comparison 9fthe Z80 and the 8080A.

~I--------- MCl Cycle ----'----~....~

T,

T,

AD - A15

MREQ

RD

MI
DBO - DB7

RFSH

Figure 7-5. Z80 Instruction Fetch Sequence
,

.

"

Referring to Figure 7-5; note that the instruction fetch cycle is identified by M1 output low during T1 and T2 (CD).
Since there is no status on the Data Bus to worry about. the Program Counter contents are output immediately on the
'
Address Bus and stay stable for the duration Qf T 1 and T2.
Since an instruction fetch is also a memory operation, MREO and RD controls are both output low. This occurs half-way
through T 1, at wh'ich time the Address Bus will stabilize. The falling edges of MREO i3nd RD can therefore be used to
select a memory device and strobe data out. The CPU polls data on the Data Bus at the rising edge of the T3 clock ((Z)).

7-12

Clock perods T3 and T 4 of the instruction fetch machine cycle are used by the Z80 CPU for internal operations.
These clock 'periods are also used to refresh dynamic memory. As soon as the Program Counter contents are taken off
the Address Bus (@l. the refresh address from the Refresh register is output on lines AO - A6 of the Address Bus. This
address stays on the Address Bus until the conclusion of T 4 (@).

cw
!;(
a:
oQ.
a:

o
u

~

enw

!;(

g

Since a memory refresh is a memory access operation. MREQ is again output low; however. it is accompanied by RFSH
rather than RD low. Thus memory reference logic does not attempt to read data during a refresh cycle.

A MEMORY READ OPERATION
,

.

,

Memory intenaqe logic respon~s to an instruction fetch and a memory read in exactly the same way. There are,
however, a few differeces between memory read and instruc~ion fetch timing. Memory read timing is illustrated
in Figure 7-~. The principal difference to note is that durin'g a memory read operation. the data is sampled on ,the falling
edge of the T3 clock pulse. wherea~ during an instruction fetch it is sampled on the rising edge of this clock pulse. Also
a normal memory read macbine cycle will consist of three clock periods. while the normal instruction fetch consists of
four «lock pe·rio·ds. R~mel"f1ber, al$9 t~at the Z80 identifies'i,lninstruction fetch machine cycle by outputting M 1 low during the firsttyvo clock periods of the instruction fetch machine cycle.

CI)
CI)

c(

....r . - - -

coli

Memory Read Cycle ----t~

w
Z

a:

oa:I
CI)

o

~

AO - A1S

c(

cc(

MREO

@

RD

-+------i------+--{

DATA BUS

(DO -- p71

Figure 7-6. Z80 Memory Read Timing
Memory Write Cycle

Tl

AO- A1S

n'

--"

T2

T3

\

\

,~
~

MEMORY AD DR

.}OIIIII"

.,

\

MREO

1

Co"'.

"

RD

\

WR
DATA BUS

J
OATA OUT

(DO - D7!

I

I

Figu're 7-7. Z80 Memory Write Timing

MEMORY WRITE

OPE~ATION

Figure 7-7 iIIu!)trates memory write' timing for the zao. Th~ only differences between memory read <:Ind memory
write timing are the obvious ones:' yvR is pulsed low for a write. and can be used as a strobe by memory interface
logic to read'd 9ta off the Data Bu~, '
. .
,

7-13

THE WAIT-STATE

a

Like the 808QA. the Z$O,JlIIQws Wait state to occur betyieen clock periods T2 and 1"3 of a machine cycle. The
Wait state frees external lo~!c or memory from having to,operate at CPU speed.
The Z80 CPU samples th~ WAIT input on the falling edge of $ during T2. Providing WAIT is Iowan the falling edge of
$ during~ait clock periods will be inserted. The number of Wait clock periods inserted depends strictly on how
long the WAlT inP4t is held low. As soon as the Z80 detects WAIT high on the falling edge of $. it will ir"!itiate T3 on
the next rising edge of $.
<

'

•

••

-

Note thft~ the Single'~ap "V~IT signal replaces the READY and WAIT aOaOA signals. As this would imply. no signal is output telling ext~rnallogic the Z80has entered the Wait state, In the event that external logic needs to know
whet"'~r or n~t a Y'aJt'state Ilas been entered, these a~e the rules:'
- .
1)

The Z80 will samp'le ,yv~IT 01') the f~lIin~' edge of $ in T2.

2)

ff WAllis low. then ,~he ~8R will continue to sample the yvAIT inP!Jt for all subsequent ,Wait state clock periods.

3)

The Z80 will not sample the WAIT input during any clock period other than 'T2 or a Wait state.

Figure 7-8 illustrates

.

. ,

I

.

I ,

Z80vyai~ st~'te

,

•

'

~ •• ,

timing.

AO - A15
~REa

RD
~AIT

Figure 7-8. Z80W~it State Ti,rnin9,

INPUT OR OUTPUT GENERATIQN
Timing
for zao input and .output gener~tion
is given in Figures 7·9 and 7·10.
.. '
. '
The important point to note is that Zilog has acknowledged the infrequency with which typical I/O logic can operate at
CPU speed. One Wait clock period is therefore automatically Inserted between T2imd T3 for all inm~t or output
machine cycles. Otherwise timing differs from men:qry read and write operations only in that 10RO is' output low
rather than MREO.
.
:
'

~

.,

Note that there is absolutely nothing to prevent you from'selecting I/O devices within the memory space. This is something we did con'sistently in the 8080A chapter when describing 8080A support devices. But if you adopt this design
policy. remelTlber that your I/O logic must execute at CPU speed. unless you rns~rt Waitstates.

7-14

Forced
Wait
State
~
T1

c

w

~
a:
o

Q.

a:

T2

Tw'

T1

T3



C/)
C/)

oCt
all
w
Z

AO - A15

a:

o

In
C/)

o

~

oCt

MREQ
RD

C

oCt

@

RFSH

Figure 7-14. Z80 Response to a Nonmaskable Interrupt Request

THE HALT INSTRUCTION
When a Halt instruction is executed by the Z80 CPU. a sequence of NOP instructions is executed until an interrupt request is received. Both maskable and nonmaskable interrupt request lines are sampled on the rising edge of  during
T4 of every NOP instruction's machine cycle.
The Halt state will terminate when any interrupt request is detected. at which time the appropriate interrupt
acknowledge sequence will be initiated. as illustrated in Figures 7-13 and 7-14.
Note that the Z80 executes the sequence of NOP instructions during a Halt so that it can continue to generate dynamic
memory refresh signals.
Halt instruction timing is illustrated in Figure 7-15.

--M1

~~~~--------M1

---------~~~--- M1

HALT

iNT or

NMi
HALT INSTRUCTION
IS RECEIVED
DURING THIS
MEMORY CYCLE

Figure 7-15. Z80 Halt Instruction Timing

7-19

The following abbreviations are used in this chapter:
A.F.B.C.D.E.H.L

The 8-bit registers. A is the Accumulator and F is the Program' Status Word.

AF'.BC'.DE'.HL·

The alternative register pairs

addr

A 16-bit memory address

x(b)

Bit b of 8-bit register or memory location x

cond

Condition for program branching. Conditions are:
NZ - Non-Zero (Z=O)
Z
- Zero (Z=1)
NC - Non-carry (C=O)
C
- Carry (C=1)
PO - Parity Odd (P=O)
PE
- Parity Even (P=1)
- Sign Positive (S=O)
P
M
- Sign Negative (S=1)

data

An 8-bit binary data unit

data16

A 16-bit binary data unit

disp

An 8-bit signed binary address displacement

xx(HI)

The high-order 8 bits of a 16-bit quantity xx

IV

Interrupt vector register (8 bits)

IX.IY

The Index registers (16 bits each)

xy

Either one of the Index registers (IX or IY)

of .

LSB

Least Significant Bit (Bit

label

A 16-bit instruction memory address

xx(LO)

The low-order 8 bits of a 16-bit quantity xx

MSB

Most Significant Bit (Bit 7)

PC

Program Counter

port

An 8-bit I/O port address

pr

Any of the following register pairs:
BC
DE
HL
AF

R

The Refresh register (8 bits)

reg

Any of the following registers:

A
B

C
D
E
H
L

rp

Any of the following register pairs:
BC
DE
HL
SP

SP

Stack Pointer (16 bits)

7-20

Statuses

ow

~
a:
oD..

The following symbols are used in the status columns:
X
flag is affected by operation
(blank)
flag is not affected by operation
1
flag is set by operation
o
flag is reset by operation
?
flag is unknown after operation
P
flag shows parity status
flag shows overflow status
I
flag shows interrupt enabled/disabled status

a:

o

(J

~

ui
w

~
C3
o
CJ)

o

CJ)

ct

The Z80 has the following status flags:
C
Carry status
Z
Zero status
S
Sign status
P/O
Parity/Overflow status
Auxiliary Carry status
AC
Subtract status
N

[ ]

Contents of location enclosed within brackets. If a register designation is enclosed within the
brackets, then the designated register's contents are specified. If an I/O port number is enclosed
within the brackets, then the I/O port contents are specified. If a memory address is enclosed within
the brackets, then the contents of the addressed memory location are specified.

[[]]

Implied memory addressing: the contents of the memory location designated by the contents of a
register.

o

A

Logical AND

@

v

o1S

w
Z

a:

o

a:I

CJ)

o

~

ct
ct

Logical OR
Logical Exclusive-OR
Data is transferred in the direction of the arrow·
Data is exchanged between the two locations designated on· either side of the arrow.

The fixed part of an assembly language instruction is shown in UPPER CASE.
The variable part (immediate data, I/O device number, register name, label or address) is shown in lower case.

7-21

-Address Bus: AO-A7: [C)
A8-AI5: [B)

Table 7-2. A Summary of the Z80 Instruction Set
STATUS

TYPE

MNEMONIC

OPERAND IS)

OPERA TION PERFORMED

BYTES
C

g

~

Z

S

P/O

AC

N

IN

A.port

2

IN

reg.IC)

2

X

X

P

X

0

INIR

2

1

?

?

?

1

INDR

2

1

?

?

?

1

INI

2

X

7

7

7

1

INO

2

X

7

7

?

1

1

7

7

7

1

_.

OUT

portA

OUT

IC).reg

,-

2

2
2

OTiR

'.

[A]-[port]
Input to Accumulator from directly addressed I/O port.
Address Bus: AO-A7: port
A8-AI5: [A]
[reg]-[(C))
Input to register from I/O port addressed by the contents of C.If second byte is 70 16 only the flags. will be affected.
Repeat until [B]~:
[[HLll-[[C))
[B]-[B]-1
[HLl-[HLl+ 1
Trensfer a block of data fr~m I/O port addressed by contents of C to memory location addressed by contents of HL. going from low addresses to high. Contents of B serve as a count of
bytes remaining to be transferred.Repeat until [B]-o:
[[HL))-[[Cll
[B]-[B]-1
[HL]-[HL] - 1
Transfer a block of data from I/O port addressed by contents of C to memory location addressed by contents of HL. going from high addresses to low. Contents of B serve as a count of
bytes remaining to be transferred.·
[[HL))-[[C))
[B]-[B]-1
[HL]-[HL] + 1
Transfer II byte of datil from I/O port IIddrllsslld by contents of C to mllmory loclltion addressed
by contents of HL. Decrement bytll count and increment destination IIddress.·
[[HLll-[[C])
[B]-[B]-1
[HL]-[HLl-l
Transfer a byte of data from I/O port addressed by contents of C to memory location addressed
by contents of HL Decrement both byte count lind destination address.·
[port]-[A]
Output from Accumulator to directly addressed I/O port.
Address Bus: AO-A7: port
A8-AI5: [A]
[[C))-[reg]
Output from register to I/O port addressed by the contents of C.Repeat until [B] =();
[(C))-[[HL))
[B]-[B]-1
[H-Ll-[HL]+ 1
Transfer a block of data from memory location addressed by contents of HL to I/O port.addressed by contents of C, going from low memory to high. Contents of B serve as a count of
bytes remaining to be transferred.-

© ADAM OSBORNE &
·Address 8us: AO-A7: [C)
AB-A15: [8]

ASSOCIATES. INCORPORATED

Table 7-2. A Summary of the Z80 Instruction Set (Continued)
STATUS

TYPE

MNEMONIC

OPERANDISI

OPERATION PERFORMED

BYTES
C

Z

S

PIO

AC

N

OTDR

2

1

7

7

7

1

Repeat until [8]=0:
[[C))-[[HL))
[8]-[8]-1
[HLl-[HLl- 1
Transfer a block of data from memory location addressed by contents of HL to I/O port addressed by contents of C. going from high memory to low. Contents of 8 serve as a count of
bytes remaining to be transferred.·

0UJ1

2

X

7

7

7

1

OUTO

2

X

7

7

7

1

[[C))-[[HL))
[8]-[8]-1
[HL]-[HLl + 1
Transfer a byte of data from memory location addressed by contents of HL to I/O port addressed by contents of C. Decrement byte count and increment so.uree address.·
[[C))-[[HL))
[8]-[8]-1
[HLl-[HL] - 1
Transfer a byte of data from memory location addressed by contents of HL to I/O port addressed by contents of C. Decrement bOth byte count and source address.·

'ii
II
:>

~c
0

g

g

LD

A.laddrl

3

LD

HL.laddrl

3

LD

rp.laddrl
xy.laddrl

4

0

LD

laddrl.A

3

a:
w
IL
w
a:

LD

laddrl.HL

3

>
a:

LD

laddrl.rp
laddrl.xy

4

::E
w
::E

LD

A.IBCI
A.IOEI

1

LD

reg.IHLI

.1

LD

(BCI.A
(DEI.A
(HLI.reg

1

1

. LD

reg.(xy + dis pI

3.

LD

(xy + displ.reg

3

w

zw

0

>
a:

""

::E
ii:
a.

LD

[A]-[addr]
Load Accumulator from directly addressed memory location.
[H]-[addr+ 11. [Ll-[addr]
Load HL·from directly addressed memory.
[rp(HIl]-[addr+ 11. [rp(LO))-[addr] or
[xy(HIl]-[addr+ 11. [xylLO))-[addr]
Load register pair or Index register from. directly addressed memory.
[addr]-[A]
Store Accumulator contents in directly addressed memory location.
[addr+ 1J-[Hl [addr]-[Ll
Store contents of HL to directly addressed memory location.
[addr+ 1J-[rp(HIlJ. [addrJ-[rp(LO)) or
[addr+ 1J-[xy(HIlJ. [addr]-[xylLO))
;'Store contents of register pair or Index register to directly addressed memory.
[A]-[[8C)) or [A]-[[DE))
Load Accumulator from memory location addressed by the contents of the specified register pair.
[reg] ..... [[ HL))
Load register from memory location addressed by COntents of HL.
[[BC))-[A] or [[DEJ]-[A]
Store Accumulator to memory location addreaaed by the contents of the specified register pair.
[[HL))-[reg]
Store register contents to memory location eddreaaed by the contents of HL
[reg]-[[xy] +disp]
Load regiSter from memory location using base relative addreaaing.
[[xy] + disp]-[ reg]
Store register to memory location addressed relative to contents of Index register.

Table 7-2. A Summary of theZ80 Instruction Set (Continued)
STATUS
TYPE

MNEMONIC

OPERAND(Sl

OPERATION PERFORMED

BYTES
C

LDIR

:r
u
a:
04:
w

Z

S

2

PIO

AC

N

0

0

0

LDDR

2

0

0

.0

LDI

2

X

0

0

!II

c

!II

Z
.04:
~

[DE]-[DE]+ 1
[HL}-[HLl + 1
[BC]-[BC]-l
Transfer a block of data from the memory location addressed by the contents of HL to the
memory location addressed by the contents of DE. going from low addresses to high. Contents
of BC serve as a count of bytes to be transferred.
Repeat until [BC)=O:
[[DEll-[[HLl],
[OE]-[DE]- 1
'[HLl-[HLl- 1
[BC]-[BC]- 1
Transfer' a block of data from the memory .location addressed by the contents of HL to the
~;-'-''ITlemory location addressed by the contents of DE. going from high addresses to low. Contents
of BC serve as a count of bytes to be transferred.
[[ DEll- [[ HLll
[OEl-[DE]+l
[HLl-[HLl+ 1
-[BC]-[BC]- 1
-Transfer one byt~ of data from the memory-location addressed by the-contents of HL to the
memory location addressed by the contents 'of DE. Increment 'source and destination addresses

Z
04:

a:
w
IL.

...a:

' Repeat until [BC]-C>:
[[DEll"';"[[H'Lll

LOD

2

CPIR

2

X

CPOR

2

X

X

0

0

X

X

X

1

X

X

X

1

u

0

...J

III

--and decrement byte count.
[[ DEll-[[ HLl]
[OE]-[DE]- 1
[HLl-[HL]- 1
'[BC]-[BC]- 1
Transfer one byte of data from'the memory location addressed by the contents of HL to the
memory location addressed by the contents of DE. Decrement source and destination addresses
and byte count,
Repeat until [A]=[[HLll or [BC]=O:
[A]- [[HLl] (only flags are affectedl
[HLl-[HLl+ 1
[BC]-[BC]- 1
Compare c<.>ntents- of Accumulator with those of memory block addressed by contents of HL.
going from low addresses to high. Stop when a match is found or when the byte count becomes
zero.
Repeat until [Al=[[HL]] or [BC]=O:
[A]- [[ HLll (only flags are affectedl
[HL]-[HL]- 1
"[BC]-[BC]- 1
Compare contents of Accumulator with those of memory block addressed by contents of HL.
going from high addresses to low. Stop when a match is found or when the byte count becomes
zero.

.© ADAM OSBORNE &
Table 7-2. A Summary of the

ASSOCIATES. INCORPORATED

zao Instruction Set (Continued)

STATUS
TYPE.

o

z-

. MNEMONIC

OPERAND(S)

BYTES ~---r--~--~~--~--~--~
PIO
AC
N
z
S
C

x

CPI

x

x

x

I A] - [[ HL]].(only flags are affected)
[HLl-[HL] + 1
[BC]-[BC]- 1

c(j

a:

:I

w.s
I&. ..

Compare contents of Accumulator with those of memory location addressed by contents of .HL.

o c

z8
c( - .
a:%
~u

CPO

x

x

x

x

x

X

0

X

Increment address and decrement byte count.
[Af- [[HL)) (only flags are affected)
[HLl-[HL] - 1
[BC]-[BC] - 1
Compare contents .of Accumulator with thOse of memory locatiOO addressed by contents of HL
Decrement address and byte count.

~a:

uC(

OW
..... 0
III

ADD
w

ADC

U

Z

w
a:
w

SUB

I&.

w

a:

>
a:

o

~

SBC
AND

w

~

>
a:

OR

c(

o
Z

XOR

o

U

w

o

OPERATION PERFORMED

CP

. (HL)
(xy+disp)
(HL)

1

o

o

1

(xy +disp)
(HLl
(XV + disp)

3

(HP
(xy+disp)
(HLl
(xy+ disp)
(HL)

1

(xy+disp)
(HLl
(xy+ disp)
(HLl
(xy+disp)

x

3

x

X

X

O.

X

x

X

X

0

X

o

X

X

p.

1

o

o

x·

X

P

1

o

o

X

X

P

1

o

x

X

X

0

X

1

X

X

o

X

3
1
3

X

X

o

X.

1

3
3
1

3
1

3
1

3
1

3

INC
(HLl
(xy+disp)
DEC

(HLl

(xy+disp)

o

[A]-[A]+[[HL)) or [A]-[A]+ [[xy]+disp]
Add to Accumulator using implied addressing or base relative addressing.
[A]-:-[A]+ [[HL))+Cor-[Ah-[A]+ [[xy]+disp]+C
Add with Carry using implied addressing or base relative addressing.
[A]-[A]- [[HL)) or [A]-[A] - [[xy]+disp]
Subtract from Accumulator using implied addressing or base relative addressing.
[A]-[A] - [[HLl- C or [A]-[A]- [[XV] +disp] - C
Subtract with Carry using implied addressing or base relative addressing.
CA]-[A] A [[HL)) or [A]-[A] A [[xy]+disp]
AND with Accumulator using implied addressing or base relative addressing
[A]-[A]V [[HLl] or [A]-[A]V [[xy]+disp]
OR with Accumulator using implied addressing or base relative addressing.
[A]-[ A].y. [[ HL)) or [A]-[ A]¥- [[ xy] + disp]
Exclusive-OR with Accumulator using implied addressing or base relative addressing.
[A] - [[HL)) or [A] - [[XV] + disp]
Compare with Accumulator using implied eddressing or base relative addressing. Only the flags
are affected.
[[HL))-[[HL)) + 1 or [[XV] + disp]-[[xy] +disp] + 1
Increment using implied addressing or base relative addressing.
[[HL))-[[HL))-l or '[[xy]+disp]-[[xy]+disp-]-l
Decrement using implied addressing or base relative addressing.

Table 7-2. A Summary of the

zao Instruction Set (Continued)

STATUS
TYPE

MNEMONIC

RLC

RL

OPERAND(S)

OPERATION PERFORMED::

BYTES
C

Z

S

P/O

AC

N

X

x

P

0

0

(HL)
(xy+disp)

2
4

x

(HLl
(xy+disp)

2
4

X

~7

of:;]

CI

[[HL)) or [[xy]+disp]
Rotate contents of. memory location (implied or base relative addressing) left with branch Carry.

X

X

P

0

0

~7

Ot;]

CI
[[HL)) or [[XV] + disp]

.. O~

Rotata contants of memory location left through Carry.
III

S

RRC

0

(HL)
(xy+ disp)

2
4

X

X

X

P

0

0

[[HL)) or [(xyl+disp]

II:

Rotate contents of memory location right with brench Carry.

C

Z

or(

t:

RR

%
en

. (HL)
(xy+disp)

2
4

X

X

X

P

0

0

>-

III

:::E

!: o~

~7

. [[ HL)) or [( XV] + disp]

..

Rotate contents o(memory Icx:ation right through Carry.

II:

0
:::E

l;47

SLA

(HL)
(xy+ disp)

2

X

X

X

P

0

0

[§}-1----17

4

o t.-o

[[ HL)) or [[ xy] + disp]
Shift contents of memory location left and clear LSB (Arithmetic Shiftl.

SM

(HL) ,
(xy+disp)

2
4

X

X

X

P

0

0

~

"·O~
[[HL)) or ([xy] +disp]

..

Shift contents of memory location right and preserve MSB (Arithmetic Shift).
SRL

(HLl
(xy+ disp)

2
4,

X

X

X

.P,

0

0

O~7

O~

[[ HL)) or ([ xy] + disp]
Shift conte~ts of memory location right and clear MSB (Logical Shift).

III

LO

reg, data

2

Ior(

0

LO

III

:::E

~

Lb

rp,data16
XY,data16
(HL),data
(xy + disp),data:

3
4
2
4

[ reg]-- data
Load immediate into'Tegister,
. [rp]--dat~16 'or [xy]--data16
Load 16 bits of immediate data into register pair or Index register.
[[HL))--data or [[XV] +.disp]--data
, Load immediate into memory location using implied or base relative addressing.

© ADAM OSBORNE &
Table 7-2. A Summary of the

ASSOCIATES. INCORPORATED

zao Instruction Set (Continued)

STATUS
TYPE

MNEMONIC

OPERAND(S)

OPERATION PERFORMED

BYTES
C

Z

S

P/O

Ac

N

[PC]-Iabel
Jump to instruction at address represented 'by label.
[PC]-[ PC] + 2 + disp
,. Jump relative to present contents of Progrem Counter•
[PC]-[HL] or [PC]-[xy]
Jump to address contained in HL or Index register.

JP

label

3

JR·

disp .

2

JP

(HL)
Ixy)

1
2

CALL

label

3

CALL
RET

cond.label

3

RET

cond

1

ADD

data

2

X

X

X

0

X

0

ADC

data

2

X

X

X

0

X

0

SUB

data

2

X

X

X

0

X

1

0

SBC

data

2

X

X

X

0

X

1

'Q"

AND

data

2·

0

X

X

P

1

0

::!
~

OR

data

2

0

X

X

P

1

0

XOR

data

2

0

X

X

P

1

0

CP

data

2

X

X

X

0

X

1

D.

::!

..,:::I

,.

,.

. [(SP]-l]-[PC(HII]
[[SP]-2]-[ PC(lO)]
[SP]-[SP]-2
[PC]-Iabel
Jump to subroutine starting at address represented by labei.
Jump to subroutine if condition is satisfied; otherwise. continue in sequence.
[PC(LOI1-[[SP))
[PC(Hil1-[[sp]+ 1]
[SP]-[SP] + 2
Retum from subroutine.
Return from subroutine if condition is satisfied; otherwise. continue in sequence.

. ...J
...J

'" ...a:
i= a:
Z

u

w

:::I

Z

·W

:::I

0

0

III

'"

a: Z

:::I

II)

1

-....I
I

N
-....I

...

w

'a:"
w

Do

...w

1&1

[A]-[A] + data
Add immediate to Accumulator.
[A]-[A]+data+C
Add immediate with Carry.
[A]-[A]-data
Subtrect immediate from Accumulator.
[A]-[A] - data -.C
Subtract immediate with Cany.
[A]-[A] A data
AND immediate with Accumulaior.
[A]-[A] V data
OR immediate with Accumulator.
[A]-[A]¥data
Exclusive-OR immediate with Accumulator.
[A] - data
Compare immediate data with Accumulator contents; only the flags are affected.

Table 7-2. A Summary of the Z80 Instruction Set (Continued)
STATUS
TYPE

MNEMONIC

OPERAND(S)

OPERATION PERFORMED

BYTES
C

JP

corid,label

3

0

JR

C,disp

2

eZ

JR

NC,disp

2

Z

JR

Z,disp

2

JR

NZ,disp

2

DJNZ

disp

2

Z

Z

s

PIO

AC

N
If cond, then [pe]-Iabel
Jump to instruction at address represented by label if the condition is true.
If C=l, then [PC]-[PC] +2+disp
Jump relative to contents of Program Counter if Carry flag is set.
IfC=(),then [PC]-[PC]+2+disp
Jump relative to contents of Program Counter if Carry flag is reset.
If Z=l, then [PC]-[PC]+2+disp
Jump relative to contents of Program Counter if Zero flag is set.
If Z=(), then [pc]-[ PC] + 2 + disp

i=
0
U
0

IL

~

:)

Jump relative to contents of Program Counter if Zero flag is reset.
[B]-[B]-l
If [B] J'oO, then [pc]-[PC]+2+disp

-,

Decrement contents of B and Jump relative to contents of Program Counter if result is not O.

~

N

OJ

LD

dst,src

1

LD

AN

2

X

X

I

0

0

w

LD

A,R

2

X

X

·1

0

0

0
~

LD

IV,A

2

I/)

LD

R,A

2

c::

. LD

SP,HL

1

LD

SP,xy

2

EX

DE,HL

1

EX

AF,AF

1

>
c::
w

I-

aw
ci:

w

I-

I/)

aw
c::

EXX

1

[dst]-[src]
Move contents of source register to destination register. Register designations src and dst may
each be A, B, C, D, E, H or L.
[A]-[IV]
Move contents of Interrupt Vector register to Accumulator.
[A]-[R]
Move contents of Refresh register to Accumulator.
[IV]-[A]
Load Interrupt Vector register from Accumulator.
[R]-[A]
Load Refresh register from Accumu!ator,
[SP]-[HLl
Move contents of HL to Stack Pointer.
[SP]-[xy]
Move contents of Index register to Stack Pointer.
[DE]-[HLl
Exchange contents of DE and HL,
[AF]-[AF]
Exchange program status and alternate program status.

eBeI) (,Bel)

[DE] [DE']
[HLl
[HL']
Exchange register pairs and alternate register pairs.

©

ADAM OSBORNE & ASSOCIATES. INCORPORATED

Table 7-2. A Summary of the Z80 Instruction Set (Continued)
STATUS
TYPE

MNEMONIC

OPERAND(S)

.:(

a:
0

a:

ri:
au

l-

(/)

6au

a:

~
a:

N

X

X

X

0

X

0

X

X

X

0

X

0

X

~

X

0

X

X

X

X

0

X

0

X

X

P

0

X

X

P

0

X

X

P

,
,
,

X

X

X

0

X

,

7

0

, SUB

reg

SBC

reg

AND

reg

OR

reg

XOR

reg

CP

reg

ADD

HL,rp

ADC

HL,rp

2

X

X

X

0

7

0

SBC

HL,rp

2

X

X

X

0

7

,

ADD

IX.pp

2

X

7

0

ADD

lV,rr

2

X

7

0

1

X

CPL

,

NEG

2

X

INC

reg

a:
~
(/)

INC

6au

DEC

rp
xy
reg

au

AC

reg

OM

w

PIO

ADC

·6
au
a:

S

,
,
,
,
,
,
,
,
,

au

I-

(/)

Z

reg

au

IL

C

ADD

au

I-

'OPERATION PERFORMED

BYTES

IL

0

a:
DEC

rp
xy

,
,
2

,
2

X'

X

X

0
0

0

,

Increment register contents.
[rp]-[rp] +' or [Xy]-[xy] +'
Increment contents of register pair or'lndex register.
[reg]-[reg] - ,

, ,
,

0

X

X

X

0

X

0

X

AND contents of register with contents of Accumulator.
[A]-[A] V [reg]
OR contents of register with contents of Accumulator.
[A]-[A].y. [reg]
Exclusive-OR contents of register with contents of Accumulator.
[A] - [reg]
Compare contents of register with contents of Accumulator. Only the flags are affected.
[HL]-[HL]+ [rp]
'6-bit add register pair contents ,to contents of HL
[HL]-[HL]+ [rp]+C
'6-bit add with carry register pair contents to contents of HL
[HL]-[HL] - [rp] - C
'6-bit subtract with carry register pair contents from contents of HL
[IX]-:[IX]+ [pp]
'6-bit add register pair contents to contents of Index register IX (pp=BC, DE, IX, SP)
[IV]-[IV]+[rr]
'6-bitadd register pair contents to contents of Index register IV (rr-BC, DE, IV, SPI.

Decimal adjust Accumulator, assuming that Accumulator contents are the sum or difference of
BCD operands.
[A]-[A]
Complement Accumulator (ones complement).
[A]-["A] + 1
Negate Accumulator Itwos complement!.
[reg]-[regl+ ,

X

X

X

0

p

X

X

,
,

[A]-[A1+ [reg]
Add contents of register to Accumulator.
[Al-[A1+ [reg] + C
Add contents of register and carry to Accumulator.
[A]-[Aj - [reg]
Subtract contents of register from Accumulator.
[A]-[A] - [reg] ~ C
Subtract contents of register and carry fro~ 'AccumuJ8tor.
[A]-[A] A [reg]

Decrement register contents.
[rp]~[rp] - , or [xy]-[xy] - ,
Decrement contents of register pair or Index register.

Table 7-2. A Summary of the

zao Instruction Set (Continued)

STATUS
TYPE

MNEMONIC

OPERAND(S)

OPERATION PERFORMED

BYTES
C

1

RLCA

Z

S

PIO

X

Ac

N

0

0

@}-Lj 7

.

0

f4J

0

i+l

[A]
Rotate Accumulator left with branch Carry.

1

RLA

0

X

0

c:m:;=t 74
[A]
Rotate Accumulator left through Carry.

1

RRCA

0

X

0

... o~

L;:j 7

[A]
Rotate Accumulator right with branch Carry.

w

1

RRA

0

X

0

I-

0

cr
~

o

0
Z

«

RLC

reg

2

X

X

X

P

0

0

Iu..

l:

~7

(/)

w

I-

.---.:tIP

.

o~

...

o j:;J~.....

[reg]
Rotate contents of registe~ left with branch Carry.

cr
(/)

o

[A]
Rotate Accumulator right through Carry.

«
Iw

..

L;:j7

RL

reg

2

X

X

X

P

0

0

(;
w

LEJ+=j7

[reg]
Rotate contents of register left through Carry.

cr

RRC

reg

2

X

X

X

P

0

0

4.J7

~

O~

[reg]
Rotate contents of register right with branch Carry.
RR

reg

2

X

X

X

p

0

0

.. O~

L;:j7

[reg]
Rotate contents of register right through Carry.

SLA

reg

2

X

X

X

P

0

0

~7

..

o t----O
[reg]

... O~

Shift contents of register left and clear LSB (Arithmetic Shift).
SRA

reg

2

X

X

X

P

0

0

~

[reg]
Shift contents of register right and preserve MSB (Arithmetic Shift).

© ADAM OSBORNE &
Table 7-2. A Summary of the

ASSOCIATES. INCORPORATED

zao Instruction Set (Continued)

STATUS
TYPE

MNEMONIC

OPERAND(S)

SRL

OPERATION PERFORMED

BYTES

2

C

Z

S

PIO

AC

N

X

X

X

P

0

0

I-

<
I0

II:

0_
2"C

2

RLD

X

X

P

0

0

< g:

oI

.-@]

17

41 3

:

..

0

I

..

c
:E
0
Cl)g
II:

w

I-

CI)

(;

RRD

W

17

i

...413

~:

'

oI

([HLl]
[A]
Rotate one BCD digit left between the Accumulator and memory location (implied addressing).
Contents of the upper half of the Accumulator are not affected.

I- .!:

II..

.

o-.J 7

[reg]
Shift contents of register right and c~ear MSB (Logical Shih).

w

reg

2

X

X

P

0

0

II:

17

~I

413

:4 01

17

I

41 3

-:

01

([HL))
[A]
Rotate one BCD digit right b8tween the Accumulator and memory location (implied addre~ing).
Contents of the upper half of the Accumulator are not affected.

BIT

b,reg

2

X

?

?

1

0

BIT

b,(HL)
b,(xy + disp)

2
4

X

?

?

1

0

SET

b,reg

2

<

SET

b,(Hl)
b,(xy + disp)

2
4

iii

RES

b,reg

2

b,(HL)
b,(xy + disp)

2
4

PUSH

pr
xy

1
2

[[SP]-ll-[ priHl)]
[[SP)-2]-[priLO))
[SP]-[SP]-2

POP

pr
xy

1
2

Put contents of register pair or Index register on top of Stack and decrement Stack Pointer.
[priLO))-[[SP))
[priHIl]-[[SP] + 1]
[SP]-[SP1+2

EX

(SP).HL

1
2

2
0
~

<
..J
~

a..

2:

~
'1-

RES

~

u

<
ICI)

(SPl.xy

Z-oeg(b)
Zero flag contains complement of the selected register bit.
Z- ([HL))(b) or Z- ([)(y] +disp](b)
Zero flag contains complement of selected bit of the memory location (implied addressing or
base relative addressing).
reg(b)-l
Set indicated register bit.
[[HLl](b)-l or Hxy]+disp](b)-l
Set indicated bit of memory location (implied addressing or base relative addressing).
reg(b)-O
Reset indicated register bit.
[[HL))(b)-O or [[xy] +disp](b)-O
Reset indicated bit in memory location (i~plied addressing or base relative addressing).

Put contents of top of Stack in register pair or Index register and increment Stack Pointer.
[H]-[[SP] + 11
[Ll-[[SP))
Exchange contents of HL or Index register1md. top of Stack.

Table 7-2. A Summary of the Z80 Instruction Set (Continued)
STATUS
TYPE

MNEMONIC

OPERANDISI

OPERATION PERFORMED

BYTES
C

01
EI
RST

n

Z

S

P/O

AC

N
Disable interrupts.
Enable interrupts.
[[ SP]-1 ] - [ PC(HIl]
[[SP]-2]-[PC(LO))
[SP]-[SP]-2

1
1
1

lll.

:J

[PC]-(8~n)16
Restart at designated location.
Return from interrupt.
Return from nonmaskable interrupt.
Set interrupt mode O. 1. or 2.

II:
II:
W

I-

~

RETI
RETN
1M

0

.-

2
2
2

1
2

CI)

SCF

1

1

0

0

C';""1

CCF

1

X

?

0

Set Carry flag.
C-C
Complement Carry flag.

NOP
HALT

1
1

:J
l-

e(

1-CI)

No operation - volatile memones are refreshed.
CPU halts. executes NOPs to refresh volatile memories.

Table 7-3. A Summary of Instruction Object Codes and Execution Cycles with 8080A Mnemonics
for Identical Instructions
INSTRUCTION

cw

~
a:
o
D.

ADC
ADC
ADC

data
(HL)

ADC
ADC

HL,rp
(lX+disp)
(lY+ disp)

~

ADC
ADD
ADD

reg
data
(HL)

ui

ADD

~

ADD
ADD
ADD

HL,rp
(lX+disp)

a:

o
(J
w

g
en
en

ct
cZI

w
Z

a:

o
III

en

o

~

IX,pp
(lY+disp)

ADD

IY,rr

ADD
AND

reg
data
(HL)

AND
AND
AND
AND

ct.

@

BIT

CALL
CALL
CALL

1
2

FD 8E vy
l000lxxx

3
2

19
15

FD 86 vy

3
2

A6

7

ADC
ADI
ADD

reg

4
7
7

7

data

DAD

M
rp

15
4
7

ADD
ANI

reg
data

4
7

7

ANA

M

7

ANA

reg

4

label
label
label

17

·,0.··/·. ·.•. .• ·• . • \

I

19

1
2
1
3
3

19
19

1
2

4
;2

b,(lX+ displ

01bbb110
DO CB vy
01bbb110

4

20

b,(lY+displ

FD CB vy

4

20

b,reg

01bbb110
CB

2

8

01bbbxxx
CD ppqq
DC ppqq

3
3

17
10/17

CALL
CC

04 ppqq
C4 ppqq

3
3
3

10/17
10/17

CM
CNC

3
3

10/17
10/17
10/17

CNZ
CP
CPE

label

liii. /.(.i .• l/t7·.·····•.. / .••i • •

3
3
1
2
1

10/17
10/17
4

CPO
CZ

label
label

..i>

CMC
CPI

data

CMP

M

7
7

CMP

reg

19

label
C,label
M,label
NC,label
NZ,label
P,label

Fe ppqq

E4 ppqq
CC ppqq

CCF
CP
CP

data
(HL)

CP
CP

(lX+disp)

CP
CPO
CPDR
CPI

reg

(lY+ disp)

3F
FEvy
BE
DO BE vy
FD BE vy
10111xxx

7
7
19

3

19
4

3

label
label
label

ED A9
ED B9
ED Al

2

16
21/16·
16

ED Bl
2F

2

21/16·

~

4

CMA

27

1

4

35
DD2B
DO 35vy

1
2
.3

DAA
OCR

M

FD 2B

2

lQ

rp

FD 35 vy
OOxx1011

3
1

23
6

reg

OOxxxl01

1

DCX
OCR

reg

disp

F3
10 vy

1
2
1

4
4
8/13
4

1
1

4.
4

1

19
23

CPL
OM
(HL)
IX
(lX+disp)
IY
(lY+ disp)

EI

FB
AF,AF'

08

OE.HL
(SP),HL
(SP),IX

EB
E3
DO E3

11
10

........

1'··.·.\i
4

1
2
2

CPIR

EX
EX
EX
EX

data
M

CB

PO,label
Z,label

DI
OJNZ

j

DO 86 vy
DO OOxxl00l

PE,label

DEC

19
4

1

7
11

CALL
CALL
CALL

DEC
DEC

3
3

1

FD OOxxl00l
l0000xxx
E6 vy

ACI
ADC

15
19

2
1

F4 ppqq
EC ppqq

DEC
DEC
DEC
DEC'

7
7

8080A
CLOCK
PERIODS

8080A
MNEMONIC

CLOCK
PERIODS

C6 vy
86
OOxxl00l

FD' A6 vy
10100xxx

BIT

CALL

2

8E
ED 01xxl0l0
DO 8E vy

(lY+disp)

BIT

CALL
CALL

CE vy

DO A6 vy

reg
b,(HL)

BIT

BYTES

(IX + disp)

ct

C

OBJECT CODE

,;

.
4
4

1/./"'"",
2. i'··
1••••. /.i<10/.( .•.••• · .....•

~3

2

7-33

rp

5

01

4

EI

4

XCHG
XTHL

rii.··

4

li.·•.

.....
_ ........_.....

External Devices

Accumulator
Registeris)

, ..............

"i

t
i

)

i

..•.......

i
'.'

l

i.···.

Instruction Register ~
,
~
~
Control Unit

Data Counteris)

•

i>
i.

,~

Stack Pointer

....

i

r(

11

i.
)i

Bus Interface
Logic

.....

•......

~

Direct Memory
Access Control
Logic

Program Counter

,

I

t

System Bus

'~

I

Programmable

i
f

ROM Addressing
and
Interface Logic

I/O Communication
Serial to Parallel
Interface Logic

I

",,'_ _
Ti_m_e_rs_--,r

I'1__

Read Only

...

I

. . /y . •. • . . }. • • .• .• .

M_e_m_o_ry_--,I'

~

J

...

t

r

RAM Addressing
and
Interface Logic

I

...

Read/W~ite
Memory

Figure 7-16, Logic Functions of the Z80 PIO

zao

PIO PINS AND SIGNALS

Z80PI0 pins and signals are illustrated in Figure 7-17. Signals are very straightforward: therefore their functions
will be summarized before we discuss device characteristics and operation.
let us first consider the PIO CPU interface.

All da'ta transfers

between the PIO and the CPU occur via the Data Bus, ~,"hich 'connects to pins DO' - 07.

For the PIO to be selected, a low input must be present at CEo There are two additional address lines. a/A SEl
selects Port A if low and Port B if high. For the selected I/O port, C/O SEl selects a data buffer when low and a
control buffer when high. Device select logic is summarized in Table 7-5.

7-46

Table 7-5.

zao PIO Select Logic

SIGNAL
CE

0
0
0
0
1

Q

w

~
a:
o0..
a:

o
CJ
!:

en
w
~

g
en
en

SELECTED LOCATION

B/A SEL C/D SEL

0
0
1
1

0
1
0
1

X

X

Port A data buffer
Port A control buffer
Port B data buffer
Port B control buffer
Device not selected

zao PIO device control logic is not straightforward. Of the control signals output by the zao CPU. three are input to the
PIO; M1. IORO. and RD. WR is not input to the PIO. Table 7-5 illustrates the way in which Z80 PIO interprets M1,
lORQ and RO. Observe that RD is being treated as a signal with two active states: low RD specifies a read operation.
whereas high AD specifies a write operation. This does not conform to the CPU. which treats RD and WR as signals
with a low active state only.

c(

Let us now look at the PIO external logic interface.

o!I
w
Z

AO - A 7 represent the eight bidirectional I/O Port A lines; I/O Port A is supported by two control signals, A ROY
and A STB.
.

a:

·0
CD

en

o

~

c(

Similarly, I/O Port B is implemented via the eight bidirectional lines BO - B7 and the two associated control lines
B ROY and B STB.
The I/O Port A and B control lines provide handshaking logic which we will describe shortly.

Q

c(

@

Now consider interrupt control signals.
lEI and lEO are standard daisy chain interrupt priority signals. When more than one PIO is present in a system. the
highest priority PIO will have lEI tied to +5V and will connect its lEO to the lEI for the next highest priority PIO in the
daisy chain:
No connection

+5V
lEI

lEO

. PIO

lEI

lEI

lEO
PIO
2

Highest
(first)

lEO
PlO
3

Second

Third

priority

priority

lEI

lEO
PIO
n
Lowest
priority

priority

If you are unsure of daisy chain priority networks. refer to Volume 1 for clarification.
INT is a standard interrupt request signal which is output by the zao PIO and must be connected as an input to the
zao CPU interrUpt request. Observe that there is no interrupt acknowledge line. since M1 and IORO simultaneously low
constitute an interrupt acknowledge and will thus be decoded by the zao PIO.
Clock, power, and ground signals are absolutely standard. The same clock signal is used by the PIO and the zao
CPU.
Observe that there is no Reset signal to the PIO. M 1 low with both RD and IORO high constitutes a reset. We will
describe the effect of a
PIO reset after discussing operating modes.

zao

7-47

D2
D7
D6
CE
C/O SEL
B/A SEL
A7
A6
A5
A4
GND
A3
A2

..,

.....

..

.
.

..

1

40

2

39

3
4

38
37

5

36

6

?

35
34

8
9

33
32

10
11

.

Z80
PIO

31
30

12

29

13

28

A1

14

27

AO

15

26

"'i3Silf

16
17

A RDY

18

25
24
23

DO

19
20

A STB

D1

'"

--

--

.,

D5
M1

iORci
RD
-'"

B7

--'"

B6

,;,

-

D3
D4

~

-

.
.

B5
B4
B3
B2
B1
BO
+5V

-...



iEi
-'"

iNT

22

lEO

21

B RDY

PIN NAME

DESCRIPTION

TYPE

DO - D7

Data Bus

Tristate. Bidirectional

CE

Device. Enable

Input

B/A SEL

Select Port A or Port B
Select Control or Data

Input

M1

Instruction fetch machine cycle
signal from CPU

Input

IORO
RD

Input/Output request from CPU

Input

Read cycle status from CPU

Input

Ad - A7
A RDY

Port A Bus

Tristate. Bidirectional

Register A Ready

Output

A STB
BO - B7

Port A strobe pulse.
Port B Bus
Register BReady

Input
Tristate. Bidirectional
Input

lEI

Port B strobe pulse
Interrupt enable in

..!§Q..

Interrupt enable out

Output

INT

Interrupt request

Output, Open-drain

<1>, + 5V,GND

ciock. Power and Ground

C/O SEL

B RDY
B STB

Input

Output
Input

Figure 7-17. Z80 PIO Signals and Pin Assignments

7-48

zao PIO OPERATING MODES
To the programmer, a Z80 PIO will be accessed as four addressable locations:

r----------,

I

I/O Port A logic

cw

I/O Port A
AO - A7

I/O Port A

~
a:
o
a.

Data

r-~~--~~~~-------A~B
I/O Port A

a:

o(J

t------~I

L.__~co:n~tr~o~I__~t__,--------~ARDY

~

en
~
U
o

I

w

Data 8us

DO - D7

IL-, __________ I

~

/'0----.. . ."

r----------,
I
I
I/O Port 8 logic

CI)
CI)

«

I/O Port 8

~

l.__~c~o~n:tr~ol~__.t-,----~.. 8RDY

w
Z

a:

o

al

I/O Port 8

CI)

o

Data

~

I/O Port 8
80 - 87

«c
«

@
By loading appropriate information into the Control regis~er you determine the mode in which the I/O port is to
operate.
.
The Z80 PIO has operating modes which are equivalent to those of the 8255 PPI, plus an additional mode which
the 8255 PPI" does not have. However. 8255 PPI Mode a provides 24 I/O lines. as against a maximum of 16 I/O lines
.
available with the Z80 PIO.
Zilog literature uses Mode O. Mode 1. Mode 2. and Mode 3 to describe the ways in which the Z8P PIO can operate: in
order to avoid confusion between mode designations as used by the Z80 PIO and the 8255 PPI. mode equivalences are
.
given in Table 7-6.
Table 7-6. Z80 PIO And 8255 Mode Equivalences
Z80 PIO

8255 PPI

INTERPRETATION

Mode 3*
Mode a
Mode 1
Mode 2
Mode 3

Mode a
Mode i
Mode 1
Mode 2
None

Simple input or output
Output with handshaking
Input with handshaking
Bidirectional I/O with handshaking
Poi"! pins individually assigned as controls

*Sp'ecial case of Mode 3
Let us now look at the Z80 PIO modes in more detail.
Output mode (Mode 0) allows Port A and/or Pqrt B to be used as a conduit for transferring data to external logic.
Figure 7-18 illustrates timing for Mode O. An output cycle is initiated when the CPU executes any Output instruction
accessing the I/O port. The Z80 PIO does not receive the WR pulse from the CPU. therefore it derives an equivalent signal by ANDing RD • CE • C/D • 10RG.
This pseudo write pu Ise (WR* in Figu re 7-18) is used to strobe data off the Data Bus and into the addressed I/O port's
Output register. After the pseudo write pulse goes high. on the next high-to-Iow transition of the clock pulse <1>. the
RDY control signal is output high to external logic. RDY remains high until external logic returns a low pulse on the STB
acknowledge. On the following high-to-Iow clock pulse  transition. RDY returns low. The low-ta-high STB transition
also generates an interrupt request.

7-49

WR*
PORT OUTPUT
(8 BITS)

ROY
STB

INT

--~'---MODE 0 (OUTPUT) TIMING

W~·= RD

.'CE • C/O·

iORQ

Figure 7-18. Mode 0 (Output) Timing
The ROY and STB signal transition logic has been designed to let ROY create STB.1f you connect these two signals. the
ROY low-to-high transition becomes the STB low-to-high transition and ROY is strobed high for one clock pulse only.
This may be illustrated as follows:

ROY

I

STB

Timing for input mode (Mode 1) is illustrated in Figure 7-19. External logic initiates an input cycle by pulsing STB
low. This low pulse causes the Z80 Pia to load data from the I/O portpins into the port Input register. On the rising
edge of the STB pulse an interrupt request will be triggered.
On the falling edge of the  clock pulse which follows STB input high. ROY will be output low informing external logic
that its data has been received but has not yet been read. ROY will remain low until the CPU has read the data. at which
time ROY will be returned high ..
It is up to external logic to ensure that data is not input to the.Z80 PIO while ROY is low. If external logic does input data to the Z80 Pia while ROY is low. then the previous data will be overwritten and lost -and no error status will
be reported.
In bidirectional mode (Mode 2), the control lines supporting I/O Ports A and B are both applied to bidirectional
data ~e~ng transferred via Port A; Port B must be set to bit control (Mode 3).
Figure 7-20 illustrates timing for bidirectional data transfers. This figure is simply a combination of Figures 7-18 and
7-19 where the A control lines apply to data output while the B control lines apply to data input. The only IJnique
feature of Figure 7-20 is that bidirectional data being output via Port A is stable only for the duration of the A STB low
pulse. This is necessary in bidirectional mode since the Port A pins must be ready to receive input data as soon as the
output operation has been completed.
'
Once again. it is up to external logic to make sure that it conforms with the ti~ing requirements of bidirectional mode
operation. External logic must read output data while A STB is low. If external logic does not read data at this time. the
data will not be read and the Z80 Pia will not report an error status to the CPU; there is no signal that external logic
sends back to the ZBO Pia following a successful read.

7-50

Also. it is up to external logic to make sure that it transmits data to Port A only while B ROY is high and A ROY is iow. If
external logic tries to input data while the Z80 PIO is outputting data. input data will not be accepted. If external logic
tries to input data before previously input data has been read. the previously input data will be lost and no error status
will be reported.
Q

w

~
oQ..
a:
o

a:

STB

~

PORT INPUT
(8 BITS)

en
w

ROY

u

~

g

INT

CI)
CI)

<
call
w
Z

a:

o

CD
CI)

o

Figure 7-19. Mode 1 (Input) Timing

~

<
<
@
Q

A ROY ________________

~

ASTB

PORT A
DATA BUS
INT

'BsTB
BRDY

WR·= RD • CE • C76 • IORQ
Figure 7-20. Port A. Mode 2 (Bidirectional) Timing
Control mode (Mode 3)does not use control signals. You must define every pin of an 1/0 port in Mode 3 as an input or an output pin. The section on programming the Z80 PIO explains how to do this. Timing associated with the actual transfer of data at a single pin is as illustrated in Figures 7-18 and 7-19. ignoring the RDY and STB signals. If all the
pins of a single port are defined in the same direction. then that port can beused for simple parallel input or output
(without handshaking).

zao PIC INTERRUPT SERVICING
The Z80 PIO ha's a single interrupt request line via which it transmits 'int~rruPt reque~ts to the CPU.
An interrupt request can originate from 1/0 Port A logic, or from I/O' Port B logic.
terrupt requests, 1/0 Port A logic has higher priority.

In the case of simultaneous in.

An interrupt request may be created in one of two ways. We have already seen in our discussion of Modes O. 1 and 2
that appropriate control signal transitions will activate the interrupt request line; that is the first way in which an interrupt request may occur. In Mode 3 you can program either liD port to generate an interrupt request based on the status
of Signals at individual 110 port pins; you can specify which 110 port pins will contribute to interrupt request logic and
what the pin states must be for the interrupt request to occur. In a microcomputer system that has more than one Z80
PIO. interrupt priorities are arbitrated using daisy chain logic as we have already described. But there is a significant
difference between priority arbitration within a Z80 system as compared to typical priority arbitration. Figure 7-21 il7
lustrates interrupt acknowledge timing.

7-51

LAST T
STATE

INT

-IO-R-O AND
,..-____ }

Mi INDICATE

INTERRUPT ACKNOWLEDGE

M1

lEO

lEI

Figure 7-21.

Int~rrupt

Acknowledge Timing

The zao PIO requires the CPU to execute an RETI instruction upon concluding an interrupt service routine.
Following an interrupt. an acknowledged Z80 PIO continously~cans the Data Bus whenever M 1 is pu Ised low. Until an
RETI instruction's object code is detected. the acknowledged Z80 PIO will continuously output lEO low. thus disabling
all lower priority Z80 PIOs. As soon as an RETI instruction's object code is detected on the Data Bus. the Z80 PIO will
output lEO high. thus 'enabling lower priority Z80 PIOs. What this means.is that interrupt priorities extend to the interrupt service routine as well as the interrupt request arbitration logic. Once an interrupt has been acknowledged. all
lower priority interrupt requests will be denied until the acknowledged interrupt service routine has completed execution and has executed an RETI instruction. However. higher priority interrupts can be acknowledged and in turn interrupt an executing service routine. This .is identical to the priority arbitration logic which we described for the 8259
. PICU.
You can. if you wish. enable lower priority interrupts by executing an RETI instruction before an interrupt service
routine has completed execution. But this requires that you execute an RETI instruction in order to return from a
subroutine within the interrupted service routine. This instruction sequence may be illustrated as follows:
;START OF INTERRUPT SERVICE ROUTINE

CALL

ENABLE

ENABLE

RET
RETI

;ENABLE ALL INTERRUPTS AT PIO DEVICES

;END OF INTERRUPT SERVICE ROUTINE

If you simply executed an RETI instruction shortly after entering an interrupt service routine. you would make a hasty
exit from the routine - before completing the tasks that have to be performed in response to the acknowledged interrupt..

PROGRAMMING THE
You program the

zao

PIO

zao PIO by outputting

a series of commands.

Let us start by identifying command format.
If the 0 bit of a command is low, then the receiving I/O port logic will interpret the command as an interrupt vector, with which it must respond to an interrupt acknowledge. assuming that the CPU is operating in interrupt Mode 2:
7 6 5 4.

3

I I I I· I

2

1 0 - - - - - Bit No.

I0 t-----

Command Byte

~""""""''''''''''-''''''''('''~---lnterrUPt

'-,

V

t

vector specified

" ' - - - - - - - - Output these eight bits when
an interrupt request is acknowledged

7-52

Do not confuse CPU interrupt modes with I/O port modes: they have nothing in common.

In order to define an I/O port's mode you must output a Control code to the I/O port's Control buffer. This is the
Control code format:

7 6 5 4 3 2 1 0 - - - - Bit

No.

Tr-rIX=~~~~~o~~:~coo,

Q

w

~
a:
o

Q.

I-------------00
~---

a:

o

(.)

~

Don't Care

III

0

e:(

Output, Mode
01 Input, Mode 1

U

10 Bidirectional, Mode2

w

l-

oCI)

11 Control, Mode 3

CI)

e:(

ciS

w
Z

a:

o
III

CI)

Observe that the same address, the I/O Port A or B Control buffer address, is used when outputting a Control code, an
interrupt vector, or a mode select. The low-order four bits of the Control code determine the way in which the Control
code will be interpreted. The following Control code will enable or disable interrupts:

o

::?!

e:(
Q
e:(

~Bit No.

7 6 5 4 3 2 1 0

.....11-- Control Code

@

~:t:=:o:~r:::-

- - - - - - Interrupt enable control
- - - - - - - - - - Don't Care

' -_ _ _ _ _ _ _ _ _ _--( 0 Disable interrupts
1 Enable interrupts

If a Mode Select Control code is output specifying that an I/O port will operate in Mode 3·, then the next byte
output is assumed to be a pin direction mask. 1 identifies an input pin, whereas 0 identifies an output pin. Here is a
sample instruction sequence:
LD
LD
OUT
LD
OUT

C,(PORTAC)
A,OCFH
(Cl.A
A.3AH
(Cl.A

:LOAD PORT A CONTROL ADDRESS INTO REGISTER C
:LOAD MODE 3 SELECT INTO ACCUMULATOR
:OUTPUT TO PORT A CONTROL REGISTER
:DEFINE PINS 5, 4, 3 AND 1 AS INPUTS,
:PINS 7, 6, 2 AND 0 AS OUTPUTS

If you set an I/O port to Mode 3, th~n you can define the conditions which will cause an interrupt request; you
do this by outputting the following interrupt Control code:

7 6

......f----Bit No.

5

...........--Control Code

~~~--~--~--~

- - - - - - - Interrupt control word
~

_______-<

1 if interrupt select mask follows

o otherwise
1 high input on selected pins is active

o low input on selected pins is active
1 AND selected pins for interrupt

o OR selected pins for interrupt
1 Enable interrupts

o Disable interrupts

7-53

When you output an interrupt Control code. as illustrated above. if bit 4 is 1. Z80 PIO logic will assume that the next
Contr.ol code output is an interrupt mask. An interrupt mask selects the pins that will contribute .to interrupt request
logic. A 0 bit selects a pin. while a 1 bit deselects the pin.
' .
.
Combining the various Control codes that have been described we can now illustrate a typical sequence of instructions
for accessing a Z80 PIO. Assume that PIO 1/0 port addresses are:
Port
Port
Port
Port

A
A
B
B

data
command
data
command

4
5
6
7

We are going to set I/O Port B to Mode 3. with an interrupt request triggered by either pin 6. 3 or 2 high. Pins 6.3. 2
and 1 will be input pins. while pins 7. 5. 4 and 0 are outputs. The Port B interrupt vector will be 04. Port A will be a
bidirectional 1/0 port with an interrupt vector of 02. Here is th'e initialization instruction sequence:
LD
OUT
LD
OUT
.LD
LD
OUT
LD
OUT
LD
OUT
LD
OUT
LD
OUT

A8FH
(5).A
A2
(5).A
C.7
AOCFH
(Cl,A
AAEH
(C).A
A4
(Cl.A
AOB7H
(Cl,A
AOB3H
(C).A

THE

;SET PORT A TO MODE 2
;OUTPUT INTERRUPT VECTOR
;SET PORT B ADDRESS IN C
;SET PORT B TO MODE 3
;OUTPUT PIN DIRECTION MASK
;OUTPUT INTERRUPT VECTOR
;OUTPUT INTERRUPT CONTROL WORD
;OUTPUT INTERRUPT MASK

zao CLOCK TIMER CIRCUIT ·(CTC)

The Z80 Clock Timer Circuit is a programmable device which contains four sets of timing logic. Each set of timinglogiccan 'be programmed independently as an interval timer or an external event counter.
The master Z80

'~ystem

clock is used by interval'timer logic. A time out may be ide'ntified

b~a'n inte~ruPt

request.

An external signal is used to trigger decrement logic when the timer is functioning as an event counter. An interrupt
may be requested when the predetermined number of evel!ts countout.

If you compare the Z80 CTC with the 8253 CounterlTimer described in Chapter 4. you will see that the Z80 CTC
has four sets of counter/timer logic as compared to the three sets of the 8253; however the 8253 has more programmable options. In addition to functioning as an event counter or an interval timer. the 8253 can be programmed to
generate a variety of square waves and pulse outputsignals.
The Z80 CTC is fabricated using N-channel depletion load technology. It is packaged as a 28-pin DIP. All pins are
TTL-level compatible.

zao eTC FUNCTIONAL ORGANIZATION
Before we examine pins, signals, and operating characterics of the Z80 CTC in detail, let us take an overall look
at device logic.
There are four counterltimer logic elements in a Z80 CTC; each is referred to as a "channel".

7-54

Each of the four counter/timer channels may be visualized as consisting of three a-bit registers and two control
signals. This may be illustrated as follows:

cw

~

a:
0

Q.

a:
0

CJ

~

enw

~.

g
en
en
~

o!I

w

z

III

:::>
co
-I

«
z

0

a:
w

en

~

a:
al

Channel 0 only

a-bit
Control
Register

t-

a-bit
Time Constant
Register

0
~

~

C

ClK/TRG

~

@
a-bit
Down Counter
Register

Control logic

An initial counter or timer constant is loaded into the Time Constant register. The value in the Time Constant
register is maintained unaltered until you write a new value into this register.
The initial Timer Constant is loaded into the Down Counter register at the beginning of a counter or timer operation; the contents of the Down Counter register are decremented. You can at any time read the contents of the Down
Counter register in order to determine how far a time interval or event counting sequence has progressed.
The Channel Control register contains a Control code which defines the channel's programmable options. There
are four Control registers. one for each of the four channels. Thus one channel's operations in no way influence operations for any other channel.
There is an Interrupt Vector register which is addressed as though it were part of channel 0 logic. This register
contains the address which is transmitted by the zao CTC upon receiving an interrupt acknowledge. The Z80
CTC assumes that the Z80 CPU is operating in Interrupt mode 2 - in which mode the device requesting an interrupt
responds to an acknowledge by providing the second byte of a subroutine address which the CPU will Call. For details
. refer to our earlier discussion of the Z80 CPU.

zao CTC PINS AND SIGNALS
zao CTC pins and signals are illustrated in Figure 7-22.
DO - 07 is the bidirectional Data Bus via which parallel data is transferred between the CPU and any register of the
Z80 CTC.
CE is the master chip select signal for the Z80 CTC. This signal must be low for the device to be selected .

. ·7-55

While CE is low.

eso and eS1

are used to select one of the four counter/timer logic channels as follows:

CS1

CSO

Channel

o
o

o

o

1
1

1

1

1

2
3

o

D4

1

18

D5
06

2

27

3
4

26

D2
D1

25

DO

5

24

6

23

-

D7
GND

R5
ZC/TOO

7

ZC/T01

8
9

ZC/T02

iO'RQ
lEO
INT
lEI

--

M1

Z80
CTC

22

.

--

21
20

D3

+5V
ClK/TRGO
ClK/TRG1
ClK/TRG2
CLK/TRG3

10

19

11

18

CSO

12

17

REsET

13
14

16
15

.L

CS1

CE

-



PIN NAME

DESCRIPTION

TYPE

DO-D7
CLK/TRGO,

Data Bus

Bidirectional. tristate

}

External Clock or timer trigger

Input

}

Zero Count or timeout indicator

Output

Instruction fetch machine cycle

Input

ClK/TR01.
ClK/TRG2.
ClK/TRG3.
ZC/TOO
ZC/T01
ZC/T02

Mi

signal from CPU

iORQ

Input/Output request from CPU

AD

Read cycle st. + 5V. GND

Clock. power and ground

Figure 7-22. ZBO-CTC Signals and Pin"Assignments

7-56

CSO and CS 1 select registers associated with counterltimer logic. to be accessed by read and write operations. The actual register which will be accessed is determined as follows:
Write to Channel

J•

Q

w

~
a:
o
Q.

•

•

~ ..

Read from channel

•

0

Bit No.

a:
o
o

X

Data written

enw

0 - - -....... X

7 6 5 4

3 2

~

•

•

Down Counter

= O. channel = 0

Select Interrupt

~
C3
o

Vector

en
en

~---~ X = 1. select Channel

Control register on
first access.

ct
oil

w
Z

....- - - -.....-If Y = 0 ~Select Time Constant register
I..:' '.
on next write

a:

o

III

en

If Y = 1 ~ Select Channel Control register

o

~gain

~

ct
Q
ct

on next write

(If Channel = O. select on next
write according to X.I

@
As the illustration above would imply. the Down Counter register is the only location of any channel whose contents
can be read. All other registers are write only locations.
When you write to a channel. bits 0 and 2 of the data byte being written determine the data destination as follows:
1)

If bit 0 is 0 and you are selecting channel O. then ,the data is written to the Interrupt Vector register.

2)
3)
4)

If bit 0 is 0 and you select channel 1. 2 or 3. the data destination is undefined.
If bit 0 is 1. then on the first access of any channel the data will be written to the Channel Control register.
If within the data byte written to a Channel Control register bit 0 is 1 and bit 2 is O. then the next data byte written
to this channel will be loaded into the Time Constant register. irrespective of whether bit 0 is 0 or 1. The data written will be interpreted as a time constant; select logic will immediately revert to selecting the Channel Control
register or the Interrupt Vector register on the next write. depending on the condition of bit 0 of the next data byte.

M 1. IORG and RD are three control signals input to the l80 CTC. Combinations of these three control signals control
logic within the zao CTC. as described for the zao PIO. An exception is the device Reset. The l80 CTC has its
own RESET input. The PIO decodes a Reset when M 1 is low while IORO and RD are high. With the exception of the
RESET function. Table 7-4 defines the manner in which the l80 CTC interprets M1. IORO, and RD signals.
Interrupt logic has three associated signals: lEI. lEO and INT. These signals operate exactly as described for the

l80 PIO.
The l80 CTC requests an interrupt with a low INT output.
lEI and lEO are used to implement daisy chain priority interrupt logic as described for the PIO.
Each of the four counter/timer channels has a CLK/TRG input control. This signal can be used to trigger timer logic;
it is also used as a decrement control by counter logic.
Counterltimer logic channels O. 1 and 2 have a lC/TO output. This signal is pulsed high on a time out or a count out.
When a low input is applied to the RESET pin. the zao CTC is reset. At this time all counterltimer logic is stopped.
INT is output high. lEO is output at the lEI level and the Data Bus is floated. Register contents are not cleared during a
' . ,
reset.

zao CTC OPERATING

MODES

The zao CTC is accessed by the CPU as four I/O ports or four memory locations. Timing for any CTC access conforms to descriptions given earlier in this chapter for the CPU.
Let us begin by looking at a counter/timer operating a~ a timer.

7-57

Using an appropriate Control code (described later) you select Timer mode for the channel and specify that an initial
time constant is to follow.
You load an initial constant into the Time Constant register, after which timer operations begin.
You have the option of using the CLKfTRG input to start the timer, in which case timer logic is initiated by external
logic. The alternative is to initiate the timer under program control. in which case the timer starts on the clock pulse
fo!lowing the Time Constant register being loaded.
When timer operations begin, the Time Constant register contents are transmitted to the Down Counter register. The
Down Counter register contents are decremented on every 16th system clock pu Ise, or On every 256th system clock
pulse. You make the selection via the Control code. Assuming a 500 nanosecond clock, therefore, the timer will decrement the Down Counter register contents every 8 microseconds, or every 128 microseconds.
When timer logic decrements the Down Counter register contents from 1 to 0 a time out occurs. At this time ZC/TO is
pulsed high, the Time Constant register contents are reloaded into the Down Counter register and timer logic starts
again. Thus timer logic, is free running; once started, the timer will run continuously until stopped by an appropriate
Control code.
Here is a timing example for a timer started under progr.am control and decrer:nenting the Down Counter register on every 16th clock pu Ise:

"1

2

3

..

15 16

15 16

15

16

2

4>

ZC/TO

INT

Output
Control

Output
Initial

Time Constant
to Down Counter

Decrement
Down Counter

Code

Time

Register. Start
Timer'

Register

Constant

Down Counter Register

Decrements from 1 to O.
Refoad Down Counter from
Time Constant Register and
restart timer

Here is a timing example for a timer,whose operations are initiated by CLKfTRG, where the Down Counterregister contents are decremented on every 256th clock pu IS8:
2

3

255 256

255 256

1

1

255

256

CLK/TRG

ZC/TO

INT

Output

Output

Time

Decrement

Down Counter

Restart

Control
Code

initial

Constant
to Down

Down Counter
Register

Register decrements

Timer

time
constant

" from 1 to O.

Counter

Reload Down

Register,

Counter from

Start

Time Constant

Timer

register

7-58

Observe that every time out is marked by a ZCITO high pulse. iNf is also output low providing interrupt logic is enabled
at the channel.
In the illustra'tion above ClKITRG is shown as a high true signal. You can specify ClK/TRG as a low true signal via the
Channel Control code; the timer will be initiated as follows:
Q

w

a:
o
u
~

en
w

~
U
o
II)
II)

ct
all

w
a:
2

o

In
II)

o

~

ct
Q
ct

@

2

Itl/

~
a:
oQ.

\

CLK/TRG

I

2~

\

I

\

I

For exact timing requirements see the data sheets at the end of this chapter.
. You can at any time write new data into the Time Constant register. If you do this while the timer is running. nothing
happens until the next time out: at that time the new Time Constant register contents will be transferred' to the Down
Counter register and subsequent time intervals win be computed based on the new Time Constant register contents.
If you are unfortunate enough to output data to the Time Constant register while a time out is in progress and the Time
Constant register contents are being transferred to the Down Counter register. then an undefined value will be loaded
into the Down Counter register; however. following the next time out the new value in the Time Constant register will
apply; that is to say. there will only be one undefined time interval.

Let us now look at a counter/timer operating as a counter.
Using an appropriate Control code (described later) you se'lect Counter mode for the channel and specify that an initial
time constant is to follow.
.You load an initial constant into the Time Constant register. after which counter operations begin.
When counter operations begin. the Time Constant register contents are transmitted to the Down Counter register. The
Down Counter register contents are decremented every time the ClKITRG input makes an active transition. Counter
logic begins on the first active transition of ClKITRG following data being loaded into the Time Constant register. The
active transition of ClKITRG may be s~l~cted under program control as low-to-high or high-to-Iow.
When counter logic decrements the Down Counter register contents from 1 to O. a count out occurs. At this time the
ZCITO si.gnal is pulsed high; an interruPl request occurs. providing the channel's interrupt logic has been enabled. The
Time Constant register contents are reloaded into the Down Counter register and counter operations begin again. That
is to say. counter logic is free running and V'/ill continue to re-execute until specifically stopped by an appropriate Control code. Counter logic timing may be illustrated as follows:

~

.1\.J\JVl....MA...

CLK/TRG

ZC/TO

Output
Control

Output
Initial

Code

Time

Start

Decrement

Down Counter

Restart

Counter

Down Counter

register

Colinter

~~gister •

decrements

Constant

from 1 to 0

7-59

zao CTC INTERRUPT LOGIC
1

Every zao CTC channel has its own interrupt logic. A channel's interrupt logic generates an interrupt request
when the channel counts out or times out. All interrupt requests are transmitted to the CPU via the INT output.
This is true if one, or more than one channel is requesting an interrupt. If more than one channel is requesting an
interrupt, then priorities are arbitrated as follows:
.'
Channel a
Channell
Channel 2
Channel 3

Highest Priority

Lowest Priority

Every channel's interrupt logic can be individually enabled or disabled under program control.
The zao CTC device's overall interrupt logic is identical to that which we have already described for the
PIO.

zao

The interrupt request is transmitted to the CPU via a low INT signal.
The CPU acknowledges the interrupt by outputting M 1 and IORO low as illustrated in the data sheets at the end of this
chapter.
The device requesting an interrupt which is highest in the daisy chain acknowledges the interrupt. Presuming this is a
Z80 CTC, the CTC places its interrupt vector on the Data Bus; it is assumed that the CPU is operating in Interruptmode
2. The Z80 CTC immediately outputs lEO low, disabling all devices below it in the daisy chain.
When an RETI instruction is executed, Z80 CTC logic sets lEO high again.
For more information on Z80 interrupt logic refer to discussions of this subject given earlier in the chapter for the Z80
CPU and the PIO.

PROGRAMMING THE
These
1)

2i

~re

zao CTC

the steps required to program a

zao CTC:

Output an interrupt "ector once, when initializing the zao CTC.
For each active counter/timer channel, output one or more Control codes. Control codes are used initially to
set counter/timer operating conditions and to load the Time Constant register. Subsequently Control codes
are used to start and stop the counter/timer, or to change the initial time conslant.

The interrupt vector is written to a counterltimer by outputting a byte of data to counterltimer channel
low order bit. The interrupt vector may be illustrated as fo'liows:
.. :

7 6

5 4

2

O~BitNo.

r-~~~~~~~

~~-- Interrupt Vector'

~~=~,..

' - - - - Must be 0 to identify Interrupt Vector

'------Ignored by

zao CTC which substitutes

bits as follows:

o 0 for Channel 0 interrupt
o 1 for Channel 1 interrupt
1 0 for Channel 2 interrupt
1 1 for Channel 3 interrupt
......- - - - - - - - - Address bits stored

7-60

a with a a in the

The Control code which must be output to each active channel will be interpreted as illustrated in Figure 7-23.

7 6 5 " 3 2 1 0 ~ Bit

I I I I I 1 1 11: c

...
ct·
w

.,

J

,

~

~

+

No.

Control code

Must be 1 to identify data as a Control code

a::

o0..

RESET

o(J

lOAD

a::

1 stops channel immediately or
leaves it running

o

~

enw

Next data output is a time constant to be loaded into
the Time Constant register. If counter/timer is not

CI)
CI)

running. do not start until time constant has been written.
No time constant follows.
TRIGGER
If timer is stopped. start on ClK/TRG
Timer Mode
Only"
o If timer is stopped. start on 

ct

SLOPE

~

o

g
ciJ
w
Z

l
f

1 ClK/TRG positive edge triggered

o ClK/TRG negative edge triggered
RANGE

a::

1 Decrement Down counter every 256th  pulseol Timer M~de
16th  pulse.
Only
.

o Decrement Down counter every

o
1:0

MODE

CI)

o

~

IE

ct
ct

C

r

1 Counter mode
o Timer mode
Enable channel interrupt
o Disable channel interrupt

@
Figure 7-23. Z80 CTC Control Code Interpretation
Bit 0 must be 1 to identify the data as a Control code. If bit 0 is O. then the data is interpreted as an interrupt vector .
providing Channel 0 is addressed: the data is undefined otherwise.
Bitl is used to stop the channel when it is running. If bit 1 is O. then every time the channel times out the Down
Counter register is immediately reloaded from the Time Constant register contents and channel operations restart according to current options. If bit 1 is 1. the channel stops immediatel'y: the ZC/TO output is inactive and channel interrupt logic is di~abled. The channel must be restarted by outputting a new Control code.
Bit 2 is used to output time constants. If bit 2 is 1. then the next data output to the channel will be interpreted as a time
constant. If bit 2 is O. then the next data output to the channel will be interpreted as another Control code. or an interrupt vector. depending on the pit 0 value.
Bit 3 applies to Timer mode only: assuming that the timer is not running. it determines whether timer operations will be
initiated by the system clock signal <1>. or by ClK/TRG.
If bit 3 is 0 then timer qperations are initiated by system clock signal <1>; the timer will start on the next leading edge of
<1>. unless the current Contrql code specifies (via bit 2) that a new time constant is to be output. in which case the timer
will start on the rising edge of  which immediately follows output of the time constant. Timing for thes'e two cases has
been illustrated ~arlief;
.
I
If bit 3 is 1. then the actiye tran~ition of the ClK/TRG signal initiates the timer. Once again. if bit 2 of the current Control code specifies that a 'new time constant is to be output then timer logic cannotbe started until this new time constant has been output. Tillling ha~ been illustrated earlier.
Bit 4 determines whether the low-to-high or the high-to-Iow transition of ClK/TRG is active. Assuming that bit 6 has
specified Timer mode and bit 3 has specified the timer will be triggered externally by ClK/TRG. the active transition of
ClK/TRG starts the timer. If bit.6 is not 0 or bit 3 is not 1. then the active transition of ClK/TRG decrements the counter.
If bit 4 specifies that a low-to-high transition of ClK/TRG will be active then ClK/TRG may be illustrated as follows:

-----.. .\" _____~---

~---_r;..

CLK/TRG _ _ _ _ _

If bit 4 specifies th~H the high-to-Iow transition of ClK/TRG will be active then ClK/TRG may be illustrated as follows:

ClK/TRG

--~
-c)I.________________..,1
7-61

Bit 5 applies to Timer mode only. If bit 5 is O. Down Counter register contents will be decremented every 16th system'
clock pulse (<1». If bit 5 is 1. the Down Counter register contents will be decremented every 256th system clock pulse

(<1».
Bit 6 determines whether the channel will be operated as a counter or a timer. If bit 6 is O. Timer mode is selected;
Counter mode is selected if bit 6 is 1.
Bit 7 is an interrupt enable/disable flag. If O. the channel's interrupt logic is disabled; if 1. the channel's interrupt logic
is enabled.

Let us now look at the programming example. Here are the assumed operating conditions for the

Z~O

CTC:

1)

Channel 0 is operating as a counter with an ,initial time constant of 8016 and interrupt logic enabled.

2)

Channel 1 is operating as a timer. It decrements on every 16th system clock pulse and has an initial time constant
of 4016; its interrupts are disabled and CLK/TRG starts the tiryler on its low-to-high transition.'
.

3)

Channel2 is operating as a timer. It decrements every 256th system clock pulse and has an initial time constant of
C816; its interrupts are enabled and the system clock starts the timer.
Channel 3 is inactive.

4)

The CPU is operating with interrupt logic in Mode 2. CTC interrupt service routine starting addresses are stored at
memory locations 2C4016. 2C4216 and 2C4416. The CTC is accessed as I/O ports B816. B916. BA16. and BB16.

Here is the appropriate CTC initiation instruction sequence:
LD
LD

A.2CH
I.A

;LOAD INTERRUPT VECTOR REGISTER OF CPU

1M

2

;SELECT CPU INTERRUPT MODE 2
;OUTPUT INTERRUPT VECTOR TO
;CHANNEL 0

LD
A.40H
OUT
(OB8H).A
;ST ART CHANNEL 0
LD
' A.OC5H
OUT
(OB8Hl.A
LD
A.80H
OUT
(OB8H).A
;START CHANNEL 1
LD
A.1DH
OUT
(OB9Hl.A
LD
A.40H
OUT
(OB9Hl.A
;ST ART CHANNEL 2
LD
A.OA5H
OUT
(OBAHl.A
LD
A.OC8H
OUT
(OBAHl.A

;OUTPUT THE CONTROL CODE TO CHANNEL 0
;OUTPUT THE INITIAL COUNT TO CHANNEL 0
;CHANNELO BEGINS OPERATING.
;OUTPUT THE CONTROL CODE TO CHANNEL 1
;OUTPUT THE INITIAL TIMER CONSTANT TO CHANNEL 1
;CHANNEL 1 BEGINS OPERATING. (IF TRANSITION OCCURS)
;OUTPUT THE CONTROL ~ODE TO CHANNEL 2
;OUTPUT THE INITIAL TIMER CONSTANT TO CHANNEL 2
;CHANNEL 2 BEGINS ORERATING

7-62

DATA SHEETS
This section contains specific electrical and timing data for the following devices:

c

w

~
a:
o0..

Z80 and Z80A CPU
Z80 and Z80A PIO
Z80 and Z80A eTC

a:

o

CJ

~

en
w
~

g
en
en
c:(

c1J
w
Z

a:

o

al

en

o

~

c:(

cc:(
@

7-D1

ZBO-CPU

Absolute Maximum Ratings
Spedfied operating range.
-6S·C to + ISO·C
-{).3V to +7V

Temperature Under Bias
Storage Temperature
Voltage On Any Pin
with Respect to Ground
Power Dissipation

·Comment

NOle

l.5W

Capacitance

Z80-CPU D.C. Characteristics
T A =o·C to 70·C. Vcc

=5V t

T A = 2Soc, f = 1 MHz,
unmeasured pins returned to ground

5% unless otherwise specified

Symbol

Parameter

Min.

Max.

Unit

VILC

Clock Input Low Vol .. ge

-0.3

0.45

V

VIHC

Cluck Input High Voltage

Vcc -.6

Vce+·3

V

V IL

Input Low Voltage

-0.3

0.8

V

VIH

Input HIgh Voltage

2.0

Vcc

V

0.4

V

Typ.

VOL

Output Low Voltage

VOH

Output High Voltage

ICC

P~wer

Supply Current

150

rnA

III

Input Leakage ('urrent

10

iJ A

I LOll

Tri·State Output Leakage Current in Float

10

iJA

ILOL

Tri·State Output Leakage Current in Float

-10

iJA

ILO

Data Bus Leakage ('urrent in Input Mode

tlO

iJA

~.4

V

Test Condition

IOH = -250iJ A

VOUT =O.4V

1\1

70 0r.

v\."\.' :; 5 V !

Parameter

VIL(,

P",k Input Luw

VIII(,

Ch.,k Input Iltg,h V"ltJge

Typ.

Max.

Unit

0.45

V

Vee -.6

V ec +·3

V

V IL

Input L"" V"ltage

-0.3

O.H

V

VIII

Inputlllgh VollJge

~.U

V( (

V

VOl

Output Lo" VoltJge

VOII

Outputll'g,1t V"ltJgc

1('('

PII"~r Supply ('lIITl'llt

III

Inpul Lt';JkJgl'

11.011

TU,SIJII' Output LI'JJ..Jgt:' ('urr1.'111 III

lUll.
11.1)

0.4

V
V

~.4

90

200

iliA

IU

iJA

10

iJ/\

TrI·StJt" Outpul I.eakage Current III Float

-10

iJA

IlJtJ ilu, Leakage ('urrent In Input Mode

tlO

iJA

('urrl'lll

FI\I;.t1

Max.

Unit

.~5

pF

/0

pF

('

CIN

Input Capacllanee

COUT

Output Capacitanee

pF

Z80-CPU
Ordering Information
C PS EM-

Ceramic
Plastic
Standard 5V t5%0· to.70·C •
Extended 5V '5% -40 to 85 C
Military 5V ;10%-55· to 125·C

= 2S°e, f = I MHz.
unmca,urcd pins relurncd tll ground

-0.3

Min.
V"lta~e

Parameler
Clock rapacltanee

TA

5'; unl~~~ other" 1St:' ~P~(1 fled

Symbol

Symbol

Capacitance

z8oA.cPU D.C. Characteristics
T A :; 0"'(,

For lNO-CPU all AC and DC characterIStics remain Ihe
same for the mlllli:UY grade puts except Icc'

Stresses above those listed under "Absolute
Maximum Rating" may cause permanent
damage to the device. This is a stress rating
only and functional operation of the device
at these or any other condition above those
indicated in the operational sections of this
specification is not implied. Exposure to
absolute maximum rating conditions for
extended periods may affect device reliability.

Test Condition

Symbol

Parameter

Ma,.

(',~

CI"d.

ClpJl.lld1h.:l'

35

pl'

CI ,-

IIIPUI

('.lrJI,:IIJlh.:\.'

,

1'1

('01'1

OlllPlit l'Jp,II.:II.IIh:l'

IU

I'F

IOL =I.~IIIA

Z80A-CPU
Ordering Information
(-Ceramic

P- Plastic
S - Standard 5V ±5% 0° to 70°C

We reprint data sheets on pages 7·02 through 7-013 by permission of Zilog. Incorporated.

7-02

Unit

Z80-CPU

A.C. Characteristics
TA

=oOe to 700e, Vee =+5V ± 5%, Unless Otherwise Noted.

c

w

~
o
11.

Sia nol

Symbol

a:

I,

a:

Iwl'I'1iI
Iw JLJ

o

11 ,1

u

~

IDIADI
IFIADI

iii

w

~

Ao-15

la~m
la":l

'~a

g

',,-a I

ct

IDIDI
IF IDI
IS4>1D1
ISI>II) + Iw(4)L) + Ir + If

J.JSCI.:

~OOO

30

Address Ouirul Delay
Dela) 10 Flual
Address Stable Pum 10 MRi'Q IMemmy ('ydel
Address Siable Pri,,, 10 JORO. RO or WR % (ydel
Add"ss SI.ble frum
~ I'O'RO or ~
Addn'ss Stable- FhHIl RD nr WR DUling Fluat

145
110
III
III
IJ.
141

!!!i.

Oala OUlpul Delay
Dela)· 10 Flual During Wrile ()'de
Da," SI>1Il + If-75
laci

PI

lea = t~'~L) + Ir - 40

;u
ou

141

leaf = Iw(>I>L) + Ir - 00

I~

151

Idem

6
(71

161

Idci

171

Icdf

181

Iw (MRL) = Ie - 40

19 1

I~MRH) = 1~>I>I1) + If- 30

230

z:

w

In

en

Any Hold Time fur Setup Time

o

~

IDL

I> (MR) IOHI>(1R) 10LI>(1R) tOHI> (RO) 10LI> (RO) IOHL) + Ir -80 IIU . Ro Delay From Rising Edge of Clock. RD Low jill Delay From Falling Edge of Clock.iP Low WR Delay WR Delay =Ie - 210 191 Rising Edge of ('Joek.IORO Low Falling Edge of Clock. 10RO Low Rising Edge of Clock ,I ORO High Falling Edge of Clock. IORO High 10L>I> (WR) IOLI>H) + tf- 80 NOTES: "1-""0 A. Data should bt eniibled t~U the ~data hus when RD IS a~tlve. DUring interrupt acknowledge data should be enaobled when M I and IORO are both aocllve. B. All (ontrol !llgnals are mternally synl.."hruI1lLCd.)() they may be totally asynchronous with re!lpel.."l h) the duck. C The Rl:.SET Signal mU!ll be al.."llv( for it nUllllnum of l dock (ydes. O. Output lXlay V), Luaded ('apa(llan~e TA = 70°C Vce = +5V ±57< Add 10nsec delay for each 50pf increase in load up 10 a maximum of 200pf for Ihe dala bus & I OOpf for address & conlrollines . 1'.. Although \Iall, hy deSign. t("sllng guarantee!l 1w(~H) of ~OO IoIst' maoxlmum 7-03 Load circuit for Output Z80A-CPU A.C. Characteristics T A =oOe to 70°C. Vee SianaJ =+5V ± 5%. Unless Otherwise Noted. Pan_t.. Min Mill Ie Iw(H) Iw(L) Ir,r Clock Period Clock Pulse Widlh, Clock High Clock Pulse Widlh, Clock Low Clock Rise and Fall Time .25 110 110 II ~I IE] 2000 Ao-IS 10(AO) IF(AO) lacm tltci lea leaf Addre .. OulpUI Delay Delay 10 Float Addre .. Slab Ie Prior 10 MREQ (Memory Cycle) Address Siable Prior 10 ~, 1m or WR (I/O Cycle) Address Siable from im. WR. 10RO or JJIrnO Addre .. Stable From Ro or WR During Floal 10(0) IF(O) IS(O) ISi'(O) Idem Idei ledf Dala OuIPUI Delay Delay 10 Floal During Wrile Cycle Dala Selup Time to Rising Edge of Clock ,During MI Cycle Dala Selup Time 10 Failing Edge of Clock Ouring M~ 10 MS Data Slable Prior 10 WR (Memory Cycle) . Dala Slab Ie Prior 10 WIl. (1/0 Cycle) Data Slab Ie From WR IH Any Hold Time for Selup Time 10Li'(MR) 10H (MR) 10Hi'(MR) Iw(MRL) Iw(MRH) MREQ Delay From Falling Edge of Clock, MREQ Low MREQ Delay From Rising Edge of Clock, MREQ High 0 _ 0 7 JlrnJ Symbol Pulse Widlh, MREQ Low Pulse Widlh, MREQ High 10RQ Delay 10RQ Delay 10RQ Delay 10RQ DeIlY 10L (RO) 10Li(RO) 10H (RO) 10Hi'(RO) ~ iW WR Mi RFSH JII ISO 90 lS SO 1'1 6 From From From From nstl.: nsec nsec nsec nsec "sec nsec nsec 0 nsec 85 nstc l!5 "sec 85 nstc nsec nsec I~I I~I 75 85 85 85 ~Low B!? Delay From Falling Edge of Clock.lID Low nsec nsec nsec 85 nsec 9S nsec 85 85 nsec nsec 10L (WR) 10Li'(WR) 10Hi'(WR) Iw{WRL) ~ Delay From Rising Edge of Clock, ~ Low WR Delay From Falling Edge of Clock, WR Low WR Delay Fr~ Falling Edge of Clock, WR High Pulse Widlh, WR Low 65 80 80 nsec nsec nsec nsec 10L(MI) 10H(MI) Mi Delay From Rising Edge of Clock, Mi High 1101 MI Delay From Rising Edge of Clock, MI Low 100 100 ~ Delay From Rising Edge of Clock. ~ Low RFSH Delay From Rising Edge of Clock. RFSH High nsec nsec 130 120 nsec 300 nsec n~c WAIT Is(WT) WAIT SelUp Time 10 Falling Edge of Clock HALT 10 (HT) HALT Delay Time From Falling Edge of Clock INT IS (IT) iNT Selup Time 10 Rising Edge of Clock 80 NMT Iw(NML) Pulse Widlh, NMI Low 80 nsec BUSRQ IS (BQ) BUSRQ Selup Time 10 Rising Edge of Clock SO nstc BiJSAK 10L(BA) 10H(BA) BUSAK Delay From Rising Edge of Clock. BiJSAK Low liiiSAK Delay From Falling Edge of Clock, BUSAK High RESET I,(RS) RESET SelUp Time 10 Rising Edge of Clock IF(C) Delay 10 F10al (MREQ. IORQ, RD and WR) Imr "'I Siable Prior 10 IORQ (lnlerrupl Ack.) CL '50pF C = 50pf L 70 r L• (I) laci' Ie -70 (3) lea = 1w(L) + Ir - SO (4) Icaf = 1w(L) + Ir - 45 (5) Idcm = Ic -170 (6) tdci = tw(L) + tr - 170 (7) tcdf = tw(L) + tr - 70 (8) Iw (MRL) (9) Iw(MRH) = 1w(H) + If - 20 SOpF CL ' SOpF C = 50pF L CL = SOpF CL =50pF CL =50pF nsec C =50pF L nsec 100 100 nsec nstc CL =50pF nsec 60 80 IIII nsec nsec NOTES: A. Dala should be enabled onlo Ihe CPU data bus when RIi is aClive. During inlerrupl acknowledge dala should be enabled when lIT and ~ are bOlh aclive. B. All conlrol signals are inlernally synchronized, so Ihey may be 10lally asynchronous wilh respecI 10 Ihe dock. C. The signal must be aClive for a minimum of 3 clock cycles. D. OUlPUI Delay vs. Loaded Capacilance TA = 70°C Vee = +5V t5% Add IOnsec delay for each 50pf increase in load up to maximum of 200pf for data bus and 100pf for address & control lines. E. Although Sialic by design. lesling guaranlees 1w(H) of 200 "sec maximum mrr 7-D4 lacm c tw(H) + If - 65 (2) nsec RO Delay From Rising Edge of Clock, RO High Ro Deloy From Falling Edge of Clock, Ro High 10L(RF) 10H(RF) (12) Ic = Iw(H) + tw(L) + Ir + t f 171 Rising Edge of Clock, 10RQ Low Falling Edge of Clock, 10RQ Low RiSing Edge of Clock, 10RQ High Falling Edge of Clock, 10RQ High Delay From Rising Edge of Clock, r ..t Condition nSte nsec nsec nsec nsec nstc nsec IJJ Iql mtm Delay From FaUing Edge of Clock, MREO High 10L(lR) 10Li(IR) IDH(IR) 10Hi'(IR) iORO .\() 110 90 Unit ~sec Load eireuil for OUlPUI C Ie - 30 zao-cpu A.C. Timing Diagram cw Timing measurements are made at the following voltages, unless otherwise specified: ~ a: oc. "." "0" CLOCK Vee -.6V .4SV OU1l'UT .NPUT FLOAT 2.0V 2.0V f:.V to.S V .8 V .8 V a: o u ~ ui w ~ g A O-A15 (I) (I) ~ all w Z a: o en (I) IF (0) o ~ ~ c ~ @ _r-- 7-05 ZSO-PIO Absolute Maximum Ratings ·Comment Stresses above those listed under --Absolute Maximum Raling" may cause permanent damage to the device. This is a stress rating only and runctional operation or the device at these or any other condition above those indicated in the operational sections or this specifica· tion is not impl;ed. Exposure to absolute maximum rating conditions for extended periods may arrect device reliability. Temperature Under Bias Specified operating range. _05 0 C to + 1500 C Storage Temperature Voltage On Any Pin With Respect To Ground -0 ..1 V to +7 V Power Dissipation .6 W Note: Z80-PIO and Z80A-PIO D.C. Characteristics TA = 00 C to70° C. Vee = 5 V ± 5':; UIlIeSS All AC and DC characteristics remain the-same for the military grade parts except Icc' Icc = 130mA. otherwise specified Parameter Min. Max. Unit VILC V IHC Clock Input Low Voltage -0 ..1 .45 V Clock Input High Voltage Vcc-.6 Vcc+.3 V V IL Illput Low Voltage -0 ..1 O.X VIII Input High Voltage 2.0 Vl'l' V VOL VOH Output Low Voltage 0.4 V 10L = ~.O mA V 1011 • -250 ~A ICC Power Supply Current 70 mA III Input Leakage Current 10 J.lA VIN ILOH Tri·State Output Leakage Current in Float 10 J.lA ILOL Tri·State Output Leakage Current ill Float -10 J.lA VOUT =2.4 to Vec VOUT = 0.4 V ILD Data Bus Leakage Current in Input Mode ±IO J.lA O';;V 10HD Darlington Drive ('urrent .l.X mA Symbol Output High Voltage 2.4 -1.5 Test Condition V =0 to Vee ';;Vcc IN VOH - I.S V REXT =JQO n Port B Only 7-06 Z80-PIO A.C. Characteristics TA =0 0 C to 700 C, Vcc =+5 V ± 5%, unless otherwise noted SIGNAL C SYMBOL PARAMETER MIN MAX 400 170 (I) 2000 2000 30 UNIT COMMENTS W ~ IX: Ic IW(HI IW ( (CS! Control Signal Set·Up Time to Rising Edge of orWrileCycie I~ During Reid 2BO W ~ IF (01 Data Outpul Delay from Falling Edge of Ro Data Set·Up Time to Rising Edge of IJlOuring Write or M1 Cycle Dala OulPUI Delay from Falling Edge aflORa During INTA Cycle. Delay to Flailing Bus (Ouipul Buller Disable Timel lEI IS (lEII lEI SeI'Up Time 10 Falling Edge aflORa During INTA Cycle lEO IDH(lOI IDL(lOI 10M (101 IEO'Delay Time from Rising Edge of lEI lEO Delay Time from Falling Edge of lEI lEO Del~y..'rom Falling Edge of Mi (lnlerruPI Occurring Jusl Prior 10 Mil See Nole A. lORa tS (lRI lORa Set·Up Time to Rising Edge of During Read or Writ~ Cycle Ml tSol>(MlI Ml Set·Up Time to Rising Edge of During INTA or Cycle. See Note B. Mi 210 RD IS (RDI AD Set·Up Time 10 Rising Edge of During Read or Mi Cycle 240 Port Data Set·Up Time to Rising Edge of STROBE (Mode 11 Port Doto Output Delay from Falling Edge of STROBE (Mode 21 Oelay to Flolting Port Dati Bus from Rising Edge of S'i'iiOBE (Mode 21 . Port Data Stable from Rising Edge of iORQ During WR Cycle (Mode 01 260 tw (ST! Pulse Width. STROBE 150 to (IT! to (lT31 INT Delay Time from Rising Edge of STROBE tDH (RYI Ready Response Time from Rising Edge aflORa t c+ Reidy Response Time from Rising Edge of STROBE Ie+ lOR (01 IS<1>(DI ~ (3 00.0 7 0 (/) (/) 101 (01 ~ o!I W 430 (2) 340 CL' 50pF (31 50 160 140 Z IX: 0 al (/) 0 ~ ~ C ~ @ ts (POI tDS (POI Ao·A7· BO·B7 I'~ '): tF l~~1 tDI(PDI ASTB. BSTB (51 (51 CL' 50pF (51 210 190 300 250 230 (51 n~ec 200 CL • 50 pF (5) 200 (41 iNf ARDY. BRDY 490 420 I NT Delay Time from Data Match During Mode 3 Operation (51 CL' 50 pF 151 ~60 tDL (RYI 400 NOTES;' A. 2.5 Ie >(N·21 tDL (101 + tOM (101 + IS (lEI) + TTL Buller Delay. if any (11 te ".IW (HI + tw (LI + t, + tf B. M1 must be active for. minimum of 2 clock periods to reset the PIO. (2) Outpuf loa~ r~~r~ase tOR (Q) by'10 nsec for e-.ch ~O pF increase in loading up to 200 pF max. (31 incre.se 101 (01 by 10 'nsec for e.ch 50 pF increase in loading up to 200 pFm.x. circuit. (41 For Mode 2: tw (ST!>IS (POI l~J Increase these valut:s by ~ n'sec for each 10 pF increase in loading up to 100 pF max, CR l - CR 4 lN9l4 OR EOUIVALENT C L z 50 pF ON 00. 0 7 = ~O pF ON' ALL OTHERS Capacitance Test Conditiof) Parameter Max. Unit e Clock: Capacitance 10 pF Unme~sure~ (IN COUT Input Ca~acitance 5 pF Returned to Ground 10 pF Symbol O(lIput Capacitance 7-07 Pins Z80A-PIO A.C. Characteristics TA = 0 0 C to 70 0 C; Vcc = +5 V ± 5%, unless otherwise noted SIGNAL SYMBOL tc IW(HI IW(LI tr,lf CS,C£ ETC. PARAMETER Clock Period Clock Pulse Width, Clock High Clock Pulse Widlh, Clock Low MIN MAX 250 105 lOS (1( 2000 2000 30 Clock Rise and Fall Times Ih Any Hold Time for Specified Set-Up Time tS (CSI Control Signal Set-Up Time to Rising Edge of (~ O~ring COMMENTS UNIT 145 Read or Write Cycle tOR (D) tS (01 380 Dala Output Delay From Falling Edge of RD 101 (D) MI Cycle Data OUIPut Delay' from Falling Edge of iCiR'Q DU'ingINTA Cycle 00.0 7 nsec (2J 50 Data Set-Up Time to Rising Edge of (I' During Write or CL' 50pF (3J 250 110 tF (D) Delay to Floating Bus (Output Buffer Disable Time) lEI ts (lEI) lEI Sel·Up Time to Falling edge of lORa DuringlNTA Cycle lEO IDH (101 tDL (101 10M (10) lEO Delay Time from Rising Edge of lEI lEO Delay Time from Falling Edge of lEI lEO Delay from Falling Edge of Mi (lnlerrupt Occurring Just Prior 10 Mi I See Note A. lORa tS (lRI i'O"RO Set-Up Time to Rising Edge of During Read or 140 160 130 190 [5J (5J CL' 50pF [5J 210 (51 115 Write Cycle. Mi Mi tS (Mil Mi AD tS (RDI RD Set·Up Timeto Rising Edge of During R.ad or Ml Cycle 115 ts (POI tDS (POI Port Data Set·Up Tim. to Ri.ing Edge of STROBE (Mode 1) Port Data Ourput Delay from f.!linog Edge of ~ (Mode 21 Delay to Floating PorI O.ta Bus from Rising Edge of STROliE (Mode 2) Port Data Stable from Rising Edge of lORa During WR Cycll (Mode 01 230 tWIST) Pulse Width, STROBE 150 (4J to (lTi to (lTJI i"N'T Delay time-from Rising Edge of STROBE iNf Delay Time from Data Match During Mode 3 Operation tDH (RY) Ready Response Time tDL (RYI Ready Response Time from Rising Edge of STROBE AO·A7· BO·B7 tF (POI tDI (POI ASTB. 1i'ffi iNT ARDY, BRDY Set·Up Time to Rising Edge of During INTA or Cycle See Note B fro~ Rising Edge'of 90 IBO (5( lBO 440 3BO j"Q"R'Q tc. 410 t c+ 360 nsec' (5J CL=50pF (5J NOTES: A. 2.5 t c >(N.21 tDL (10). tOM (10). ts (lEI). TTL Buffer Delav, if any B. MT must be active for a minimum of 2 clock periods to reset the PIO. (lJ tc=tW('~HI.tW('~Ll.tr.tf {2J Increase tOR (0) by 10 nsec for each 50 pFincrease in loading up to 200 pFmax. (3) Increase tOI (O) by 10 nsec for each 50 pF increase in loading up to 200 pFmax. (4J For Mode 2: tw (STI>ts (POI IS) Increase these values by 2 nsec for each 10pF increase in loading up to 100 pFmax. '7-08 ZBO-PIO A.C. Timing Diagram Timing measuremenU are made It the following voltlgeS, unless otherwise specified: INPUT FLqAT ~V OUTPUT Q w !ta: "'" Vee-.S 2.0V 2.0V CLOCK "0" . .45V O.BV O.BV Parameter Clock Capacitance CIN Input Capacitance COUT Output Capacitance Max. Unit 20 pF Unmeasured Pins 5 pF Returned to Ground 10 pF 7-D10 Test Condition Z80-CTC A.C. Characteristics TA = 0° C to 70° C, Vee = +5 V ± 5%, unless otherwise noted Signal Symbol Parameter Min Max Unit tc tW(H) Clock Period 400 [11 ns Clock Pulse Width, Clock High 170 2000 ns tW(l) Clock Pulse Width, Clock low 170 2000 ns tptf Clock Rise and Fall Times 30 ns o(J tH Any Hold Time for Specified Setup Time ~ tS(CS) Control Signal Setup Time to Rising Edge of During Read or Write Cycle tDR(D) Data Output Delay from Rising Edge of RD During Read Cycle 1 tS(D) Data Setup Time to Rising Edge of During Write or M1 Cycle tDI(D) Data Output Delay from Falling Edge of IORO During INTA Cycle w Z tF(D) belay to Floating Bus (Output Buffer Disable Time) o m tSOEI) lEI Setup Time to Falling Edge of IORO During INTA Cycle cw !ia: oQ. a: en w CS, CE, etc. !i oo (/) (/) ct DO-D7 all a: lEI (/) o :!: ct c ct @ lEG 'i'6'Ra M1 RD INT Notes: [1) [2) [3) [4] ns 160 ns 480 60 ns 340 ns 230 ns 200 (2) ns tDHOO) lEO Delay Time from Rising Edge of lEI 220 ns lEO Delay Time from Falling Edge of lEI lEO Delay from Falling Edge of M1 Onterrupt Occurring just Prior to. M1) 190 ns 300 ns tSOR) IORO Setup Time to Rising Edge of During Read or Write Cycle 250 ns tS(M1) M1 Setup Time to Rising Edge of During INTA or M1 Cycle 210 ns tSIRD) RD Setup Time to Rising Edge of During Read or M1 Cycle 240 ns tDCKOT) tDOT) INT Delay Time from Risihg Edge tJf ClK/TRG 2tcl [2) ns tDlOO) tDMOO) [3) [3] [3) Counter Mode Timer Mode tCICK) Clock Period tr,tf tSICKI tSITRI Clock and Trigger Rise and Fall Times Clock Setup Time to Rising Edge of for Immediate Count Trigger Setup Time to Rising Edge of for Enabling of Prescaler on Following RiSing Edge of 210 210 Counter Mode Timer Mode tWICTH) Clock and Trigger High Pulse Width 200 Counter and Timer Modes tWICTll Clock 200 Counter and Timer Modes tDHIZC) ZC/TO Delay Time from Rising Ed~~ of <1>, ZC/TO High 190 tDlIZCI ZC/TO Delay Time from Failing Edge of <1>: ZC/TO low 190 ClK/TRGO_3 ZC/ TO O_2 0 Comments ~nd Counter Mode 2tcIl ,I Trigger low Pulse Width 50 Counter and Timer Modes Counter and Timer Modes tc = twlH) + tW(ll + tr + tf. Increase delay by 10 nsec for each 50 pF increase in loading, 200 pF maximum for data lines and 100 pF for control lines. Increase delay by 2 nsec for each 10 pF increase in loading, 100 pF maximum RESET must be active for a minimum of 3 clock cycles. OUTPUT LOAD CIRCUIT CR l - CR 4 lN9l4 OR EQUIVALENT CL = 50 pF ON ALL PINS :-. 7-011 Z80A-CTC A.C. Characteristics TA = 0° C to 70° C, Vee = +5 V ± 5%, u~less otherwise noted Signal Symbol Min Max Unit Clock Period 250 [1] ns Clock Pulse Width, Clock High 105 ,2000 OS twll) Clock Pulse Width, Clock lo~ 105 2000 tr;tf Clock Rise and Fall Times ns ns tSICS) Control Signal Setup Time to Rising edge of During Read or Write Cycle tDR([») Data Output Delay from Falling Edge of RD During Read Cycle tSID) Data Setup Time to Rising Edge of During Write or Ml Cycle tDlID) Data Output Delay from Falling Edge bf IORG During INTA Cycle tFID) Delay to Floating Bus IOutput Buffer Disable .Time) tsIIEII lEI Setup Time to Falling Edge of lORa During INTA Cycle 00- 0 7 lEI -' tDH(lO) tDl(lO) lEO 30 Any Hold Time for Specifi~d Setup Ti:T,e', tH CS, CE,etc Parameter tc tWIH) tDM(lO) 0 ns 60 'ns 380 160 ns 110 ns 160 lEO Delay Time from Falling Edge of lEI lEO Delay from Falling Edge of M1 (Interrupt Occurring just Prior to M1 ) 130 190 ns ns ns iO'RQ tsci>(lR) lORa Setup Time to Rising Edge of During Read or Write Cycle 115 ns M1 tS(Ml) Ml Setup Time to Rising Edge of During INTA or Ml Cycle 90 ns Ri5 tSIRD) RD Setup Time to Rising Edge of During Re~d or Ml Cycle 115 ns iNf tOCK(lT) tD(lT) INT DelayTime from Rising Edge of tCICK) Clock Period trotf tS(CK) tS(TR) Clock and Trigger Rise and Fall Times ZC/TOO_2 Notes: 2tcl for Immediate Count Trigger Setup Time to Rising Edge of for enabiing of "Prescaler on Following Rising Edge of Clock and Trigger High Pulse Width tW(CTLI Clock and Trigger low Pulse Width tDHIZC) 'ZC/TO Delay Time'from Rising Edge of <1>, ZC/TO High 120 tDlIZC) ZC/TO Delay Time from Rising Edge of <1>, ZC/TO low 120 CLK/TRGO_3 (2) ns " lEO Delay Time from Rising Edge of lEI INT Delay Time from Rising Edge of ClK/TRG (2) ns 50 140 ns Comments 130 Counter Mode Timer Mode 130' 120 Counter and Timer Modes 120 Counter and Timer Modes Counter and Timer Modes Counter and Timer Modes [1] tc = twlH) + twlL1 + tr + tf. • ' , ' [2] Increase delay by 10 nsec for each 50 pF increase in loading, 200 pF maximum for data lines and 100 pF for control lines. [3] Increase delay by 2 nsec for each 10 pF increase in loading, 100 'pF maxirnum. [4] 'i"i'E'S"E'T must be active for a minimum of 3 clock cycles. OUTPUT LOAD CIRCUIT CR 2 CR 3 CR 4 CR 1 - CR 4 lN914 OR EOUIVALENT " CL = 50 pF ON ALL PINS zaO-CTC A.C. Timing Diagram CLOCK OUTPUT Timing measurementS'are made at the following voltages, unless otherwise specified: .SV FLOAT AV ±0.5V ...--t----tC(CK)I-+------i~1 eLKI TRG0-3 (TIMER MODE) ZC/TOO_2 7-013 .SV 2.0V EIO (COUNTER MODE) "0" .45V INPUT lEI  "'" VCC - .6V 2.0V Chapter 8 THE ZILOG Z8 This chapter will be provided at a later date as an update. 8-1 cw Chapter 9 THE MOTOROLA MC6BOO ~ IX: oa.. IX: o CJ ~ en w The MC6800 was developed by Motorola as an enhancement of the Intel 8008, at the same time that Intel was developing the 8080A, also as an enhancement of the 8008. g When comparing the MC6800 to the 8080A, the most Important feature of the MC6800 is its relative simplicity. Here are a few superficial, but illustrative comparisons between the two products: ~ VJ VJ ct clJ 1) w Z IX: o al VJ o 2) :!: ct o 3) ct @ 4) 5) As compared to the 8080A. MC6800 timing is very simple. MC6800 instructions execute in two or more machine cycles. all of which are identical in length. In contrast to the 8080A. which we described in Chapter 4. note that an MC6800 machine cycle and clock period are one and the same thing - each MC6800 machine cycle has a single clock period. Whereas the 8080A has separate I/O instructions. the MC6800 includes memory and I/O within a single address space. Thus all I/O devices are accessed as memory locations. The MC6800 has a simpler set of control signals. therefore it does not mu Itiplex the Data Bus ~ and does not need any device equivalent to the 8228 System Controller. Whereas the 8080A requires three levels of power supply. the MC6800 uses just one - +5V. The instruction set of the MC6800 is much easier to comprehend than that of the 8080A. The MC6800 has fewer basic instruction types. with more memory addressing options: the 8080A. by way o(contrast. has a large number of special. one-of-a-kind instructions. It is very informative to extend the five comparisons above with the enhancements that Intel has made to the 8080A in order to come up with the 8085; Let us take the five pofnts one at a time. 1) 2) 3) 4) 5) 8085 instruction execution timing is far simpler than the 8080A. But MC6800 timing is still far simpler than the 8085. The 8085 retains the separate memory and I/O spaces of the 8080A. The 8085 has separate control signals which do not need to be demultiplexed off the Data Bus. as required by the 8080A. The price paid by the 8085 is a multiplexed Data and Address Bus. Neither the MC6800 nor the 8085 need any device equivalent to the 8228 System Controller: however. the 8085 will need a bus demultiplexer in configurations that do not use the standard 8085 support devices. The 8085. like the MC6800. has gone to a single +5V power supply. The 8085 instruction set is almost identical to that of the 8080A. An additional point worth noting is that the 8085 includes clock logic on the CPU chip. The MC6800 requires a separate clock logic chip. Looking at the 8085, there are grounds for arguing that Intel has acknowledged that the MC6800 has some desirable characteristics not present in the 8080A. In order to compete with the 8085, therefore, Motorola will not be required to make MC6800 enhancements of the same magnitude as Intel made going from the 8080A to the 8085. Specifically, these are the MC6800 characteristics which remain to be addressed by any MC6800 enhancement: 1) 2) Clock logic must be moved on to the CPU chip. Multifunction CPU and support devices must be developed so that Motorola can offer low chip count microcomputers. Additional weaknesses of the MC6800 that have manifested themselves include: 1) 2) An instruction set that makes excessive use of memory as a result of too few Index registers and a lack of data mobility between registers of the CPU. This is a weakness that was identified in the first version of this book. The synchronizing E signal. required by support devices of the MC6800. render these support devices useless in any microcomputer system other than the MC6800. In contrast. 8080A support devices can be used widely in microcomputer systems not based on the 8080A CPU. 9-1 Future Motorola plans address many of the points raised above. The MC6802. described in this chapter. is the first step towards reducing chip counts in MC6800-based microcomputer systems. The MC6809 will be the new enhanced MC6800. to compete with the 8085. The MC6809 will provide additional Index registers. plus instructions that move data between Accumulators and Index registers. The MC6809 will have clock logic on the CPU chip. MC6800 and MCS6500 support devices are interchangeable: that is to say. you can use MC6800 support devices (described in this chapter) with the MCS6500 microprocessor (described in Chapter 10) and you can use MCS6500 support devices (described in Chapter 10) with the MC6800 CPU. Although MC6800 and MCS6500 support devices are interchangeable. they should not be used with other microprocessors. with the exception of parts described in Volume 3. These are the devices described in this chapter: • The • The • The • The • The • The • The • The • The • The MC6800 CPU MC6802 CPU with RAM MC6870 series Clocks MC6820 Peripheral Interface Adapter (PIA) MC6850 Asynchronous Communications Interface Adapter (ACIA) XC6852 Synchronous Serial Data Adapter (SSDA) MC6828 Priority Interrupt Controller (PIC) MC6840 Programmable CounterlTimer MC6844 Direct Memory Access Controller MC6846 Multifunction device - the second part in an MC6802-based two-chip microcomputer. Devices described in Volume 3 include the MC6845 CRT controller, the MC6843 Floppy Disk controller and the MC68488 General Purpose Interface Adapter. Two new series of MC6800 parts offer higher speeds. Standard MC6800 parts use a 1 MHz clock signal. "A" parts use a 1.5 MHz clock signal. while "B" parts use a 2 MHz clock signal. There is. in addition. an MC6821 PIA which is identical to the MC6820 in operating characteristics. but has different physical characteristics. MOTOROLA AAND B SERIES PARTS The principal MC6800 manufacturer is: MOTOROLA INCORPORATED Semiconductor Products Division 3501 Ed Bluestein Boulevard Austin. TX 78721 The second sources are: AMERICAN MICROSYSTEMS 3800 Homestead Road Santa Clara. California 95051 FAIRCHILD SEMICONDUCTOR 464 Ellis Street Mountain View. California 94040 HITACHI Semiconductors And Integrated Circuits Division of Hitachi LTD 1450 Josuihan-Cho-Kodaira-Shi Tokyo. Japan SESCOSEM Thompson CSF 173 Haussmann Blvd. Paris. France 75008 The MC6800 devices use a single +5V power supply. Using a one microsecond clock, instruction execution times range from 2 to 12 microseconds. A one microsecond clock is the standard for MC6800 microcomputer systems. 667 nanosecond clocks are standard for the 68AOO series while 500 nanosecond clocks are standard for the 68BOO series. All MC6800 devices have TTL compatible signals. N-channel silicon gate, depletion load MOS technology is used for the MC6800. 9-2 THE MC6800 CPU c w Functions implemented on the MC6800 CPU are illustrated in Figure 9-1; they represent typical CPU logic. As compared to other microprocessors described in this book. the MC6800 might be considered deficient in requiring external clock logic; however. its principal competitor. the 8080A. requires external clock logic and Data 8us demultiplexing logic. ~ oa.. The need for external clock logic simply reflects the fact that the MC6800 is one of the earlier microprocessors. o (J The MC6800 has two Accumulators, a Status register, an Index register, a Stack Pointer and a Program Counter. These may be illustrated as follows: a: a: ~ THE MC6S00 PROGRAMMABLE REGISTERS enw Accumulator A 8 bits ~ oCI) U Accumulator B 8 bits CI) Index Register X 16 bits ct ci/:I w Z 16 bits Program Counter PC o 16 bits Stack Pointer SP a: IX! CI) Status Register 8 bits o ~ ct C ct @ The two Accumulators, A and 8, are both primary Accumulators. The only instructions which apply to one Accumulator. but not the other. are the instructions which move statuses between Accumulator A and the Status register and the DAA (Decimal Adjust) instruction. /,i,.: /" ~ ". I~. . The Index register is a typical microcomputer Index register, as described in Volume 1. The MC6800 has a Stack implemented in;memory and indexed by the Stack Pointer, as described in Volume 1. 8ecause 'of the nature of the MC6800 instrucUon set. it is more realistic to look upon the MC6800 Stack Pointer as a cross between a Stack Pointer and a Data Counter. Memory reference instructions make it very easy to store the contents of either the Stack Pointer or the Index r~gister in read/write memory; by maintaining a number of base page memory locations as storage for these two Address registers. each can be put to multiple use. The Program Counter is a typical Pr()~ram Counter, as described in Volume 1. MC6S00 MEMORY ADDRESSING MODES MC6800 memory reference instructions use direct ,. . addressing and indexed addressing. The MC6800 has an unusually large variety of three-byte memory referencing inst~uctions; a 16-bit direct address is provided by the second and third bytes of the instruction. Therefore, 65,536 bytes of memory can be directly addressed. The commonly used memory reference instructions also have a base page, direct addressing option; tHis is a two-byte instruction, with a one~byte address which can directly address anyone of the first 256 bytes ,:>f memory. ,. All memory reference instructions are available with indexed addressing. Indexed addressing on the MC6800 differs from indexed addressing as described in Voiume 1. in that the one-byte displacement provided by the memory reference instruction is added to the Index register as an unsigned 8-bit value: Byte 1 Byte 2 ....._ _ o_p_c_o_de_,_ _......_ _ _x_x_ _ _.....llnstruction ________ p_pq_q_ _ _ _ _ _---'llndex Register Effective Address = ppqq + OOxx P. q. and x represent any hexadecimal digits MC6800 programs can use the Stack Pointer as an Address register. but two bytes of read/write memory must be reserved for the current top of Stack address and interrupts mustoe disabled while the Stack Pointer is being used to address data memory. A single instruction allows an address to be ioaded into the Stack Pointer; another single instruction allows the Stack Pointer contents to be stored in read/write memory. In most programs. the Stack is unused for much of the time; therefore. given the low MC6800 overhead involved with swapping addresses between the Stack Pointer and read/write memory. making dual use of the Stack Pointer is advisable. 9-3 I. Clock Logic .. i Logic to Handle Interrupt Requests from External Devices ) ...... ( ......... ....... Ii '•.. :c:;~> ................... ..... Ip~tr~stl?~flegl~!~~ r- [J :iii< : ........ . ... •••••• , .............. /.......... . { c··· • .c:. ...... I·'· .......,..... ....... ....... ...... ..... C .. ........ ....... . Ii>i . .·.·i . . ) · · ·.· . t: '" t .......... i·.·..··// I ....... .... .....> I •••••• ~ ~ ' ••or ~ .. al "lJ lltl > , System Bus t j I/O Communication Serial to Para"el Interface Logic Programmable Timers ROM Addressing and Interface Logic ~ 1\ ... ...... ;~ ... .. .... ....... ( ... ...., ... ....... i .> ... '.{ >""'. ... ···i Interrupt Priority Arbitration i ...... ....... ...... ~ ..... i :C • j<':' L I/O Ports Interface Logic Read Only Memory , Direct Memory Access Control Logic t t ~ 1 RAM Addressing and Interface Logic t 1 I/O Ports Read/Write Memory ~ ~ ,t Figure 9-1. Logic of the MC6800 CPU Device Branch and Branch-on-Condition instructions use program relative, direct addressing; a single byte displacement is treated as a signed binary number which is added to the Program Counter, after Program Counter contents have been incremented to address the next sequential instruction. This allows displacements in the range + 129 to -126 bytes. One note of caution: Motorola's MC6800 literature uses the term "implied addressing" to describe instructions that identify one of the programmable registers. The closest thing the MC6800 has to implied addressing, as the term is used in this book, is indexed addressing with a zero displacement. 9-4 ~ HALT 2 clock input. in which case <1>2 and DBE are identical signals. HALT. When this signal is input low. the CPU ceases execution at the end of the present instruction execution and floats the entire System Bus. Bus Available (BA). This line is output high when the Data and Address Busses have been floated following a HALT input only. When BA is low, the CPU is controlling the Data and Address Busses; information on these busses is identified by the following two control signals: Read/Write (R/W). Whl3n high. this signal indicates that the CPU wishes to read data off the Data Bus; when low. this signal indicates that the CPU is outputting data on the Data Bus. The normal standby state for this Signal is "read" (high). Valid Memory Address (VMA). This Signal is output high whenever a valid address has been output on the Address Bus. THere are three interrUpt processing signals as follows: IRQ. This signal is used to request an interrupt. If interrupts have been enabled and the CPU is not in the Halt state. then it will ~cknowledge the interrupt at the end of the currently executing instruction. Non-Maskable Interrupt (NMJ). This signal differs from IRO in that it cannot be inhibited. Typically. this input is used for catastrophic iriterrupts such as power fail. iiES"E'T. Thi? is a typical reset signal. Note that a number of control signals output by the MC6800 are only capable of driving one standard TTL load. Some form of signal buffering and amplification will therefore b.e required in most systems. 9-6 MC6800 TIMING AND INSTRUCTION EXECUTION MC6S00 CLOCK SIGNALS The MC6S00 uses a relatively simple combination of two clock signals to time events within the microprocessor CPU and the microcomputer system in general. These two clock signals may be illustrated as follows: Q w ~ a: oa. <1>1 ____I \...._ _ _"..,1 \ a: o (J ~ ~ C3 o en en c:( 01:1 w Z a: o I \ (1)2 en w I \ Observe that clock signals <111 and <112 both have high pulses which occur within the width of the other clock signal's low pulse. A further timing signal, given the symbol E, is used by support devices within an MC6S00 microcomputer system. <111, <112 and E timing signals are generated by the clock logic devices described later in this chapter. Each repeating pattern of <111 and <112 signals constitutes a single machine cycle: to en o ~ ~ One Machine c:( Q c:( Cycle @ I 1 <1>1 <1>2 \ , \ -I ... One, Machine Cycle I I' I \1I I --..f MG6S00 MACHINE CYCLE I ~I \ \ I I \: I I I MC6800 instructions require between two and eight machine cycles to execute. Interrupt instructions are an exception. requiring longer instruction execution times. ' So far as external logic is concerned, there are only three types of machine cycles which can occur during an instruction's execution: 1) 2) 3) A read operation during which a byte of data must be input to the CPU. A write operation during which a byte of data is output by the CPU. An internal operation during which no activity occurs on the System Bus. MC6S00 MACHINE CYCLE TYPES All MC6S00 instructions have timing which is a simple concatenation of the three basic machine cycle types .. Let us therefore begin by ,looking at these three basic machine cycles. Figure 9-3 illustrates timing for a standard read machine cycle. Observe that in the normal course of events. neither the Address nor the Data Busses are available for DMA operations. The address output is stable for most of the machine cycle. Data needs to be stable for a short interval of time late in the machine cycle. Exact timing is given in MC6800 data sheets at the end of this chapter. 9-7 MC6S00 READ MACHINE CYCLE <1>1 <1>2 R/iii VMA , AO - A15 Address Out DO-D7 ________________________________~ In _.1 '--_Data __ Figure 9-3. A Standard MC6800 Read Machine Cycle Figure 9-4 illustrates a standard MC6800 write machine cycle. This machine cycle is not as straightforward as the read. The address to which data is being written is stable on the Address Bus for the duration of the machine cycles; however. the data being written is stable for a period within the high DBE pulse. While DBE is low.. the Data Bus is floated. <1>1 <1>2 R/W VMA ~________________________~J AO-A16------~----~ DBE DO - D7 Data Out Data Bus floated Figure 9-4. A Standard MC6800 Write Machine Cycle 9-8 MC6800 WRITE MACHINE CYCLE Under normal circumstances, DBE is identical to <1>2: ~ 2 37 DBE Q 36 w ~ a: oC1. a: o 2 pulse is too short for external logic to respond to the write. the slow external logic can be accommodated in two ways. You can input a DBE signal to the CPU that has a shorter low pulse and a longer high pulse. DBE and <1>2 are no longer identical signals: C/) C/) MC6800 WAIT STATE WITH SLOW MEMORY c( all w Z a: oCD 1 and <1>2 cannot be held constant for more than 9.5 Ilsec; the MC6800 is a dynamic device. and longer static clock periods can result in loss of internal data. During an internal operation's machine cycle, there is no activity on the System Bus. R/W is in its normal high state and VMA is low. Table 9-2 defines the way in which individual MC6800 instructions concatenate machine cycles and use the System Bus during the course of instruction execution. MC6800 INTERNAL OPERATIONS MACHINE CYCLE The VMA and DBE signals require special mention, because their significance can easily be missed. External logic uses VMA as a signal identifying the address on the Address Bus as having been placed there by the CPU. DBE similarly identifies that portion of a machine cycle when the CPU is active at one end of the Data Bus. either transmitting or receiving data. And this is why these signals are so important: MC6800 microcomputer systems rely heavily on clock signal manipulation as a means of accommodating slow memories. implementing Direct Memory Access. or refreshing dynamic memory. On the next few pages we are going to see examples of how this is done. So long as you understand that the VMA and DBE signals identify the unmanipulated portions of a standard machine cycle. you will have no trouble'locating the time slices within which special operations such as Direct Memory Access or dynamic memory refresh are occurring. . 9-9 THE HOLD STATE, THE HALT STATE AND DIRECT MEMORY ACCESS The H~ld state typically describes a CPU condition during which System Busses are floated, so that external logic can perform Dire.ct Memory Access operations. ThoughtheMC6Sd6 iiterature does not talk about a Hold state, this microprocessor does indeed have two equivalent conditions. You can fioatthe Address and Data Busses separately, using the TSC and DBE signals. You can enter an MC6S00 Halt state, which is equivalent to our definition of a Hold state. Let us begin by looking at the use of TSC and DBE signals. The Three State Control signal (TSCl. if input high, will float the Address Bus and R/W line. VMA and BA are forced low. The .unusual feature of the Three State .Control input is that when this signal is input high. you must si'multaneously stop the clock by holding <1>1 high and <1>2 low. Timing is illustrated in Figure 9-5. Now the MC6800. being dynamic device. will lose its data contents if the clock is stopped for more than 9.5 jl.sec. You must therefore float the Address Bus just long enough to perform a single Direct Memory Access. a <1>1 <1>2 TSC AO - A15 Addre,ss Bus. A/Wand VMA floated Figure 9-5. TSC Floating the Address Bus Just as the Three State Control input floats the Address Bus. so the Data Bus Enable input (DBE) floats the Data Bus. When DBE is input low. the Data Bus is floated. The clock devices. which are described later in this chapter. provide all necessary clock stretching logic. There are two very important points to note regarding the use of Three State Control (TSC) and Data Bus Enable (DBE) signals. . First of all. note carefully that the Bus Available (BA) Signal is held low when the busses are floated by the Three State Control (TSC) and Data Bus Enable (DBE) signals. The purpose of the Bus Available signal is to indicate that the System Bus is available during a Halt or Wait state. both of which we have yet to describe. The second important feature of the Three State Control (TSC) and Data Bus Enable (DBE) signals is that they do indeed float the System Bus in two halves. Now in many MC6800 systems <1>2 and DBE are the same signal: in such a configuration you will automatically float the Data Bus whenever you float the Address Bus. as illustrated in Figure 9-6. Now consider the MC6S00 Halt state. The Halt state of the MC6S00 is equivalent to the Hold state of the SOSOA. If a low HALT is input to the MC6800. then upon conclusion of the current instruction's execution. the System Bus is floated. Timing is illustrated in Figure 9-7. Observe that the Bus Available Signal. BA. is output high: VMA is output low. The Address and Data Busses. and the R/W control are floated. In summary, the MC6S00 provides two means of performing Direct Memory Access operations. You can.use the TSC and DBE inputs to gain control of the System Bus for as long as it takes to perform a single DMA access,or you can use the HALT input, following which external logic can gain control of the System Bus for as long as you wish. 9-10 Ill1 Q !l>2 w l- e( a: 0 TSC Q. a: 0 u ~ enw AO - A15 l- e( Address Bus. g R/W and VMA (I) (I) floated e( !Ill w Z a: DBE,·!l>2 0 CD (I) 0 ~ DO - D7 e( Q e( Data Bus floated @ Figure 9-6. TSC Floating the Address and Data Busses When DBE Is Tied to <1>2 Conceptually, the MC6800 scheme for implementing Direct Memory Access or dynamic memory refresh. is very elegant. If you stretch the <1>1 and <1>2 clock signals, then you can transfer the normal CPU generated address, and an extraneous address within one machine cycle. VMA identifies the CPU generated address. Within the one machine cycle can perform two Data Bus transfers; the first is in response to the external address, while the second is in response to the CPU address. Now DBE identifies the CPU response. This scheme may be illustr- \ , I \ ated as follows: I !l>1 (Stretched) !l>2 (Stretchedi. , AO - A 15 ~ ) DMA Address Normal Address I VMA 00- 07 ( ( DMA Data· \ 1 ( Normal Data I DBE\ ) .) \ From this conceptually elegant beginning, some very complex design considerations can arise. Complexities disappear, however, when standard 6800 support devices are used to implement direct memory access logic. Specifically, you should use the Me6875 clock device in conjunction with the 6844 Direct Memory Access controller. 9-11 Last machine cycle of instruction Next I instruction fetch execution : Halt state during which System Bus is floated Figure 9-7. System Bus Floating During the Halt State INTERRUPT PROCESSING, RESET AND THE WAIT STATE MC6800 microcomputer system interrupt logic. as implemented within the 6800 CPU. is based on polling rather than vectoring. The MC6828 Priority Interrupt Control device. described later in this chapter. extends CPU interrupt logic to provide vectored interrupt response. All normal interrupt requests. when acknowledged. result in an indirect addressing Call to a single high memory address. If more than one device can request an interrupt. then the basic assumption made is that the interrupt service routine will initially read the Status register contents of every device that might be requesting an interrupt and by testing appropriate status bits. the interrupt service routine will determine which interrupt requests are active. If more than one interrupt request is active. interrupt service routine logic must decide the .order in which interrupt requests will be acknowledged. But be warned: this type of polling quickly becomes untenable as a means of controlling microcomputer systems with multiple random interrupts. If you have more than two or three competing external interrupts. the time taken to read Status register contents and arbitrate priority will become excessive. If your application demands numerous external interrupts. then you must resort to external hardware which implements interrupt vectoring. We will describe ways in which this can be done. If you casually look at a description of MC6800 interrupt logic. you may at first believe that some level of interrupt vectoring is provided. In reality. that is not the case. 9-12 ' The MC6800 sets aside the eight highest addressable memory locations for interrupt processing purposes. Four 16-bit addresses are stored in these eight memory locations, identifying the interrupt service routine's starting address for the four possible sources of interrupt. This is how the eight memory locations are used: cw ~ a: o FFFS FFFA FFFC FFFE and and and and FFF9 FFFB FFFD FFFF Normal external interrupt Software interrupt Non-maskable interrupt Reset (or restart) 0- The lower address (FFFS. FFFA. FFFC. FFFE) holds the high order byte of the starting address. ~ In the event of simultaneous interrupt requests. this is the priority sequence during the acknowledge process: a: o o u) w Highest ~ g C/) C/) ct a!I w Z a: o III Lowest (1) (2) (3) (4) MC6800 INTERRUPT PRIORITIES Restart Non-maskable interrupt Software interrupt Normal external interrupt Only the lowest priority interrupt is normally used by the typical support device that is capable of requesting interrupt service. The three higher priority interrupt levels represent special conditions and cannot be accessed by the standard . external interrupt request. We will begin our discussion of MC6800 interrupt processing by describing the four interrupts. C/) o ~ ct c ct @ The normal external interrupt request is the standard interrupt present on all microprocessors that support interrupts; it is equivalent to the SOSOA INT input. In very simple systems. the addresses FFFS16' and FFF916 may indeed access real memory locations: in the multiple interrupt MC6S00 microcomputer systems. FFF916 is more likely to select an S-bit buffer within which an address vector is stored identifying the interrupting source. This is essentially how the MC6S2S Priority Interrupt Controller (PIC) works. MC6800 NORMAL EXTERNAL INTERRUPTS A software interrupt is initiated by the execution of the SWI instruction. What theSWI instruction does is cause the MC6S00 to go through the complete logic of an interrupt request and acknowledge. even though the interrupting source is within the CPU. Software interrupts are typically used as a response to fatal errors occurring within program logic. Whenever your program logic encounters a situation that must not. or should not exist. the error condition is trapped by executing an SWI instruction: this causes a call to some general purpose. error recovery program. The non-maskable interrupt cannot be disabled. Otherwise it is identical to the normal external interrupt request. Note that the SOSOA has no non-maskable interrupt: however. the Zilog ZSO and the SOS5 have incorporated this feature. MC6800 SOFTWARE INTERRUPT MC6800 SWI INSTRUCTION MC6800 NON-MASKABLE INTERRUPT A Reset is treated as the highest priority interrupt in an MC6S00. How does the Reset differ from the non-maskable interrupt? Conceptually. the non-maskable interrupt is going to be triggered by a termination condition such as power failure. while the Reset is going to be triggered by an initiating condition such as power being turned on. There are. some differences between the MC6800's response to a Reset as compared to any other interrupt request~ . To contrast the two. we will look at the normal interrupt acknowledge sequence. and then we will look at a reset. Figure 9-S illustrates MC6800 response to a normal external interrupt, a software interrupt, or a non-maskable interrupt.ln each case. the interrupt request will be acknowledged upon completion of an instruction's execution. A normal external interrupt will only be acknowledged providing interrupts have been enabled. If more than one interrupt request exists. then the highest priority interrupt will be acknowledged. Following the interrupt acknowledge. normal interrupts are disabled by the CPU. which then pushes onto the Stack the contents of all internal registers. This process is illustrain Figure 9-S. The Program Counter is then loaded with the appropriate interrupt service routine starting address. which will be fetched from memory locations FFFS16 and FFF916. FFFA16 and FFFB16 or FFFC16 and FFFD16. 9-13 ----------------il L , This is the last,m8chi~e cycle for executio~ of the instruction during which the interrupt was requested. . . . __________~ ;.~;~~st~~~;~U:~~~;~;~:~~: ~~t:;~~:~~~;:~~~s;:~~:~~~~i~~~::UCC;~~ IC;~~I #21 pleted execution. #4 #3 #5 #6 #7 '. #8 #9 #10 ,I' #11 . .. 1 #12 1 #13 1 #14 1 #15 Address ......,....----......- -...... ' - - ' r BUI IRQ or NMi Interrupt Muk ------------------------------+----~ Data Bul ___J~_ _~_ _ _~_ _n_ _ __A_ _J~_ _~_ _ _~_ _J~_ _~~-~-----A-~~ __ __ ~ _N VMA Figure 9-S. MC6S00 Interrupt Acknowledge Sequence Referring to Figure 9-S. note thatan interrupt is acknowledged following the last machine cycle for the instruction during which the interrupt request occurred. During the first two machine cycles following the interrupt acknowledge. an instru'ction fetch is executed. as it would have been had the interrupt not occurred. This instruction fetch is aborted and will reoccur after the interrupt service routine has completed execution. Two machine cycles are expended performing this aborted instruction fetch. Following the aborted instruction fetch. CPU registers' contents are pushed onto the Stack in the following order:, • Lower half of ProgramCounter • Upper half of Program Counter • Lower half of Index register • Upper half of Index register • Accumulator A • Accumulator B • Status register When the SOSOA acknowledges an interrupt. if CPU registers' contents are going to be saved on the Stack. you must execute individual instructions 'to perform the operations which the MC6S00 performs automatically. The advantage of the MC6S00's scheme is that it saves instruction execution time. The disadvantage of this scheme is that there are o"ccas ions when you do not need to bother saving registers' contents. After all CPU registers' contents have been saved on the Stcick. the next two machine cycles are used to fetch an address from the appropriate two high memory bytes. This address is loaded into theProgram Counter. causing a branch to the appropriate interrupt service routine. ' '9-14 I n In 1In + + 21 n + 31 n + 4 I n + 51 m 1m + 11m ~ 21m + 3 ~2JLJLJl; ;:~~h cw ~ a: ofl. a: o(,J !: enw ~ g en en On J -f Pow. ---n-5._25_ _ V ______ SUPPlY. 4. 75 V if ~~--------------------------I~----~------------------~~------~--_; If . ~ II - /iri~----------------l lr----:::;:r f.- 'PC, ~~:,oss \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\1rms\\\\S\\\\\\\\\\\\\\\\\N\\\\\\\\\\\\\\\\\\\\~~d~";"'.~=~",=",d~-.".,('---J\---...A..--...A.."..,.,=,,=..d Am _\\\\\\\\\\.\\\\\lm\\\\~~\\\i\\\\\\\l\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\1 FFF~ :' FFFE FFFE FFFE FFFF Now PC FFFE FFF VMA 0 ••• Bus ~~\\~%\\\\\\\\\\~5\\\~~\\\\\\\\\\\\"@\X\\\\\\\~ . ®\\\\\\\\\\\\\\\\\\\\\\\\\\\\SfMs\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ms~=I-· PC 8-15 PC 0-7 . BA J ' -_ _J ' -_ _...J"-_ _-I Firs. Instruction :fI&:n\\tt'\\ \m\\:n\\tt'\\\m\\:n\\n'\\\m\\:n\\n'\\\m\\:n\\~\t~m\\:n\\n'\\\m\\:n\\n'\\ \m\\:n\\n'\\\m\\:n\\n'\\ \m\\:n\\n'\\\tmI\ \ \\ (( ~ ~ w Z a: ~ "" IndeterminatB o al en o Figure 9-9. The Reset Sequence ~ ~ c ~ @ We will now examine the MC6800 Reset operation. The MC6800 RESET illustrates Reset timing. First of all. note that RESET must be held low for at least Figure OPERATION eight machine cycles to give the CPU sufficient response time. On thehigh-to-Iow transition of RESET the CPU outputs VMA and SA low and R/W is high. On the subsequent low-to-high transition of RESET. maskable interrupts are disabled. then the contents of memory locations FFFE16 and FFFF16 are fetched and loaded into the Program Counter. If RESET is not held low for a minimum of eight machine cycles. then when RESET is input high again. indeterminate program execution may follow. 9-9 It is absolutely vital that the RESET. iiESET rise time is less than 100 nanoseconds on the low-to-high transition of We stated that the difference between a Reset and a non-maskable interrupt is that the Reset represents initiation conditions. This is illustrated in Figure 9-9. which includes the power supply level. When power is first turned on. the MC6S00 will automatically trigger a Reset when power increases above +4.75 volts: this is in response to the normal powering up sequence. The fact that Reset represents initiation conditions also explains why no CPU registers' contents are saved. as occurs with any other interrupt. Clearly. if we are initiating operations. there can be no prior registers' contents to be saved. Therefore pushing registers' contents on the Stack would be pointless an'd impossible: it would be pointless because there is nothing to save: it would be impossible because when powering up. we . have no idea what the Stack Pointer contains. Powering up an MC6800 microcomputer system represents a special Reset case. Those MC6S00 microcomputer system devices that have an external Reset input control. expect this control to be· '1eld low while power is being turned on for the first eight clock cycles following power-up. When designing Reset logic be sure to keep this in mind. MC6800 RESET bURING POWER UP MC6S00 configurations using SOSOA s~pport devices are easy to design and commonly seen. Necessary system bus logic is described later in this chapter. But if you have such a mixed configuration. be sure to satisfy the separate and distinct Reset requirements of the MC6S00 CPU as against the SOSOA support devices. 9-15 Cycle #1 I #2 I ~ 1 ~4 1 #5 I #6 I #7 1 #8 1 #91 1 1 #10 n" 1 n+2 1 n+3 1 n+4 I n+5 I cP2 Address --.,-""""'\. Bus roo---. ,-"""""'\.,----. ,----..,--"""1 R/W VMA Interrupt ------------------------if-tff-----;.-----' Mask IRQ 0' NMI Data Bus -------:..--------------------4.. ~r~---~--------4_~ ==)C=:::x=:::x==>C=::::x==)C=:)(::::=x:=J::::}-~~f------.:.1C=::::x==x:::=:J(~=)4 BA· _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _LJ System Bus Floated Figure 9-10. MC6S00 Wait Instruction Execution Sequence We complete our discussion of the MC6800 interrupt logic with a discussion of the WAI instruction, which puts the MC6800 into a "Wait-for-interrupt" state. MC6800 WAIT STATE A WAI instruction is executed when the CPU has nothing to do except wait for an interrupt. Rather than pushing registers' contents onto the Stack following the interrupt acknowledge. as illustrated in Figure 9-S. the WAI instruction pushes registers' contents onto the Stack while waiting for the interrupt. as illustrated in Figure 9-10. Thus some execution time is saved. MC6800 WAI INSTRUCTION Once all registers' contents have been pushed onto the Stack. the MC6S00 floats the System Bus in the Wait state. This gives rise to another frequent use of the WAI instruction: block data transfers under DMA control. Consider again the sequence of events which follows the WAI instruction execution: 1) All registers' contents are pushed onto the Stack. 2) The System Bus is floated. MC6800 USE OF WAIT FOR DMA This is very convenient if you are going to transfer a large block of data via DMA. because you will announce the end of the DMA transfer with· an interrupt request. This method of handling block DMA transfers has been discussed in Volume I. Now when using an MC6S00 microcomputer system. all you need to do is initiate the actual DMA transfer by executing a WAI instruction; knowing that once the DMA transfer has been completed. an interrupt will be requested and program execution can continue. THE MC6800 INSTRUCTION SET . Table 9-1 summarizes the MC6800 instruction set; this instruction set is characterized by a heavy use of read/write memory and a rich variety of instructions that are able to manipulate the contents of memory locations as though they were programmable registers. Whereas the primary memory reference instructions offer base page direct addressing . . extended direct addressing or indexed addressing. secondary memory reference instructions offer extended direct addressing and indexed addressing only. This simply means that secondary memory reference instructions use three-byte direct addressing even when a base page byte must be accessed. 9-16 Of the microcomputers described in this chapter, the MC6S00 has one of the largest varieties of Branch-onCondition instructions. Note that these and the unconditional Branch instructions are the only MC6800 instructions which use program relative direct addressing. Q w ~ II: oQ. II: o CJ ~ en w ~ g (I) (I) ~ all w Z II: o III (I) o ~ ~ Q ~ When comparing the MC6S00 and SOSOA instruction sets, the conclusion we must draw is that the MC6800 is going to have to rely on a large number of memory reference instructions. You are going to have to set up programs with this in mind. As a result. relatively simple programs will make the MC6800 look better than the 8080A. because the MC6800 has such a diverse variety of memory reference instructions. The moment a program starts to become complicated. the large number of 8080A registers is quickly going to become an advantage. since the MC6800 will be forced to execute memory reference instructions where the 8080A can use register-register instructions. The SWI and WAI instructions within the interrupt instruction group are relatively unusual within microcomputer systems. The SWI instruction initiates a normal interrupt sequence. taking the interrupt service routine's starting address from memory locations FFFA16 and FFFB16. The WAI instruction prepares for an interrupt by saving the contents of all registers and status on the Stack: the System Bus is then floated while the CPU waits for an interrupt request to occur. We have described both the SWI and WAI instructions in some detail earlier In this chapter. The one set of instructions which are missing. and which would greatly enhance the MC6800 instruction set. are instructions that move data between the Accumulator and the Index register. or allow Accumulator contents to be added to the Index register. THE BENCHMARK PROGRAM The benchmark program is coded for the MC6S00 as follows: @ LOOP STS LDX LDX LDS PULL STAA INX DEC BNE STX LDS SSP #T ABLE O.X #IOBUF A O.X 10CNT LOOP TABLE SSP SAVE STACK POINTER CONTENTS IN MEMORY LOAD TABLE BASE ADDRESS INTO INDEX REGISTER LOAD ADDRESS OF FIRST FREE TABLE BYTE LOAD I/O BUFFER STARTING ADDRESS LOAD NEXT BYTE INTO A STORE IN NEXT FREE TABLE BYTE INCREMENT INDEX REGISTER DECREMENT I/O BYTE COUNT IN MEMORY RETURN FOR MORE BYTES STORE NEW ADDRESS FOR FIRST FREE TABLE BYTE RELOAD ~TACK POINTER The memory initialization for the MC6800 interpretation of the benchmark program is identical to the memory initialization for the 8080A benchmark program. The MC6800 assumes that there is some memory location in which the current real Stack address can be stored. so that the Stack Pointer may be used as a Data Counter. In Table 9-1. symbols are used as follows: ACX Either Accumulator A or Accumulator B The registers: A.B Accumulator X Index register PC Program Counter Stack Pointer SP SR Status register Statuses shown: C Carry status Z Zero status S Sign status o Overflow status I Interrupt status AC Auxiliary Carry status Symbols in the STATUSES column: (blank) operation does not affect status X operation affects status o flag is cleared by the operation flag is set by the operation 1 9-17 ADRS ADR16 B2 B3 DATA DATA16 DISP xx(HI) xx(LO) [ ] [[ ]] [ MEM] An S-bit (l-byte) quantity which may be used to directly address the first 256 locations in memory. or may be ah,S-bit unsigned displacement to be added to the Index register. A 16-bit memory address Instruction Byte 2 I nstruction Byte 3 An S-bit binary data unit A 16-bit binary data unit An S-bit signed binary address displacement The high order S bits of the 16-bit quantity xx; for example. SP(HI) mean~ bits 15 - S of the Stack Pointer. The low order S bits of the 16-bit quantity xx; for example. PC(LO) means bits 7 - 0 of the Program Counter. Contents of location enclosed within brackets. Implied memory addressing; the contents of the memory location designated by the contents of a register. Symbol for memory location indicated by base page direct. extended direct. or indexed addressing. That is: [MEM] = [ADRS] or [ ADR16] or [[ X]+ADRS] [M] Symbol for memory location indicated by extended direct or indexed addressing. That is: [M]=[ ADR16] or [[ X]+ADRS] A V Logical. AND Logical OR Logical Exclusive-OR Data is transferred in the direction of the arrow. ¥ 9-18 © AD~M OSBORNE:& ASSOCIATES, INCORPORATED Table 9-1. A Summary of the MC6800 Instruction Set STATUS TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED _BYTES Z S 0 2 3 2 3· 2 3 X X X X X X ° ° ° C g LOA 0 STA "" LOX z UI U Z UI ec UI II. UI ACX,ADRS ACX;ADR16 ACX;ADRB -ACX.ADR16 ~ ADRB ADR16 ec > ec - STX ADRB ADR16 2 3 X X 0 :IE UI :IE > ec :IE LOS ADRB AOR16 2 3 X X ° STS ADRB ADR16 2 3 X X ° ACX.ADRS ACX.ADR16 ACX.ADRS ACX.ADR16 ACX.ADRB ACX.ADR16 ACX.ADRB ACX.ADR16 ACX.ADRB ACX.ADR16 ACC.ADRB ACX.ADR16 ACX.ADRS ACX.AOR16 ACX.ADRS ACX,ADR16 ACX.ADRS ACX.ADR16 ACRS ADR16 2 3 2 3 AC [ACX]-[MEM] Load A or B using base page direct. extended direct. or indexed-addressing. [MEM]-[ACX] Store A or B using direct. extended. or indexed addressing. [X(HIIJ-[MEMJ. [X(LplJ-[MEM+ 1) Load Index register using direct. extended. or indexed addressing. Sign status reflects Index register bit 15. -[MEM]-[X(HlIl [MEM+ 1]-[X(LO)) -Store contents of Index register using direct. extended. or. index8ct addressing: Sign status reflects Index register bit 15. [SPlHII]-[MEMJ. [SPlLOIJ-[MEM+ 11 . load Stack Pointer using direct. extended. or indexed addressing. Sign status reflects Stack Pointer bit 15. [MEM]-[SPlHIIJ. [MEM + 11-[SPlLOIJ 0 ""a: Store contents of Stack Pointer using direct. extended. or indexed addressing. Sign status reflects Stack Pointer bit 15. A. ADD ADC Q I- AND A. BIT > ec 0 :IE CMP ~ EOR ~ UI 0 UI UI U zUI ORA ~- SUB ec UI ec > ec 0 :E UI :IE > ec SBC CPX 2 3 2 3 2 3 2 3 2 3 2 3 2 3 X X -X X X X X X X X X X X X ° ° .X )( X X X 0 X X ° X X X X X X X X X X X 0 l 0 1 X X ° ° X X X X 2 3 c( 0 z CLR 0 u UI III COM NEG ADRS ADR1S ADRB ADR1S ADRB ADR16 2 3 2 3 2 3 X I [ACX]-[ACX]+ [MEM] Add to Accumulator A or B using base page direct. extended direct. or indexed addressing. [ACX]-[ACX1+ [MEM]+C Add with carry to Accumulator A or B using direct. extended. or indexed addressing. [ACX]-[ACX] 1\ [MEM] AND with Accumulator A or B using direct. extended. or indexed addressing. [ACX] 1\ [MEM] AND with Accumulator A or B. but only Status register is affected. [ACX] - [MEM] Compare with Accumulator A or B (only Status register is affected). [ACX]-[ ACX]¥ [MEM] Exclusive-OR with Accumulator A or B using direct. extended. or indexed addressing. [ACX]-[ACX] V [MEM] OR with Accumulator A or B uaing direct. extended. or-indexed addressing. [ACX]-[ACX] - [MEM] Subtract from Accumulator A- or B using direct, extanded. or indexed addressing. [ACX]-[ACX] - [MEMl- C Subtract with carry from Accumulator A or B using direct. extended. or indexed addressing. [X(HII] - [MEMJ. [X(LO)) - [MEM+ 1] - Compare with contents of Index register (only Status register is affeeted). Sign and Overflow statuses reflect result on most significant byte. IM]-OO.. Clear !!!!,mory location using extended or indexed addressing. [M]-[M] Complement contents of memory locltion (ones complement). IM]-:-OO,.- 1M] Negete contents of memory location (twos complement). Carry stltus is set if result is 00.. Ind . reset otherwise. Overflow stltus is set if result is SO,. and reset otherwise. STATUS TYPE MNEMONIC OPERAND IS) OPERATION PERFORMED BYTES C DEC INC AC Z S 0 X X [M]-[M]-1 X Decrement content$. of. memory location. using extended or indexed addressing. Overflow status is set if .operand was BO,. before execution. and cleared otherwise. [M]-[M]+1 ADRB ADR16 2 3 X ADRB ADR16 2 3 X ADRB ADR16 2 3 X I Increment contents of memory location. using extended or indexed addressing. Overflow status is set if operand was 7F 1. before exec\Jtion. and clearect otherwise. iii l- e( ~7~ = 1&1 A. ROL 0 > = 0 ~ X X X X 0j41 .O-S¥C [M] Rotate contents of memory location left through carry. 1&1 ~ ~c ROR Zl&l 1&1::) ADRB ADR16 2 3 X X X X, cm=;:t7 [M] =Z ~;:::: I&IZ =0 >u • ot;J.o-s"o"C Rotate contents of memory location right through carry. ASL = 0 ~ ADRB ADR16. 2 3 X X· X ~7 X .. o t . - O. o --S¥C [M] Arithmetic shift left. Bit 0 is set to 0, 1&1 .'q; ~ > = 0 Z 0 U ASR e( ADRB ADR16 2 X X X X ~ ~ ot---.{]] [M] o --S¥C Arithmetic shift right. Bit 7 stays the same. 1&1 en 0 X TST ADRB Ab~16 2 3 0 X X 0 [M]-OO,. Test contents of memory location for zero or negative value. 'LOA ACX.DATA 2 X X 0 .LDX DATA 16 3 X X 0 LOS DATA16 3 X X 0 [ACX]-DATA Load A or B immediate. [X(HIl]-[B21. [X(LOI1-[B3] Load Index register immediate. Sign status reflects Index register bit 15. [SP(HIl]-[B21. [X(LO)]-[B3] ADD ACX.DATA 2 X X X X X ADC ACX.DATA 2 X X X X X X 0 1&1 0---47 I- Q 1&1 ~ ~, (}t---.{I] X ~DRB ~ogical e( ~ 2 3 X ADR16 LSR O-S¥C shift right. Bit 7' is set to O. Load Stack Pointer immediate. Sign status reflects Stack Pointer bit 15. 1&1 I- 1&1 e( I- Q e( = 1&1 ~ A. 0 1&1' ~ AND ACX.DATA 2 X + [ACX]-[ACX] DATA Add immediate to Accumulator A or B. [ACX]-[ACX] + DATA + C Add immediate with carry to Accumulator A or B. [ACX]-[ACX] II DATA AND immediate with Accumulator A or B. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 9-1. A Summary of the MC6800 Instruction Set (Continued) STATUS TYPE MNEMONIC OPERAND(S) BYTES BIT ACX,DATA 2 CMP ACX,DATA 2 OPERATION PERFORMED C Z X X 0 X X X X S 0 w ~ ~wQ EOR ACX, DATA 2 X X 0 oj ORA ACX,DATA 2 X X 0 w!!: ~~ c(Z -0 SUB ACX,DATA 2 X X X X ~ SBC ACX,DATA 2 X X X X CPX DATA16 3 X X X JMP ADRB ADR16 2 3 JSR ADR8 ADR16 2 3 BRA DISP 2 BSR DISP 2 BCC 8CS BEQ BGE BGT BHI BLE DI5P DISP DISP DISP DI5P DISP DI5P DI5P DISP DISP DISP DISP DISP DI5P 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ~w ~g ~ ~ ~ j ~ Z 0 E Q Z 0 U BLS Z 0 BlT BMI BNE BVC BVS BPl '% U Z c( II: CD AC I [ACX] A DATA AND immediate with [ACX1-DATA Acc~mulator A or B,.but only the Status register is affecttld. . Compare immediate with Accumulator A or B (only the Status register is affected). [ACX]-[ACX]"'t'-DATA Exclusive-OR immediate with Accumulator A or B. [ACX]-[ACX] V DATA OR immediate with Accumulator A or B. [ACX]-[ACX]-DATA Subtract immediate from Accumulator A or B. [ACX]-[ACX] - DATA - C Subtract immediate with carry from Accumulator A or B. [X(HII] - [B21. [X(lO)] - [B3] Compare immediate with contents of Index register (only the Status register is affected). Sign and Overflow status reflect result on most significant byte. [PC]-[X] +ADRB or [PC{HII]-[ B21. [PC{lO)]-[ B3] Jump to indexed or extended address. [[SP]F-[PC{lO)1. [[SP]-ll-[PC{HII], [SP]-[SP]-2 [PC]-[X] +AOR8 or. [PC{HIll-[B21. [PC{lO)]-[B3] Jump to subroutine (indexed or extended addressing). [pc]-[ PC] + DISP + 2 Unconditional branch relative to present Program Counter contents. [[SP]]-[PC{lO)J. [[SP]-ll-[PC{HIIJ. [SP]-[SP]-2, [PC]-[PC] +DISP+ 2 Unconditional branch to subroutine located relative to present Program Counter contents. [pc]-[ PCl+ DI5P + 2 if the given condition is true: C = 0 (Branch if carry clear) C·= 1 (Branch if carry set) Z = 1 (Branch if equal to zero) S J.l-O = 0 (Branch if greater than or equal to zero) Z V (5 J.l-O) = 0 (Branch if greater than zero) C V Z = 0 (Branch if Accumulator contents higher than comparand) Z V (5 J.l-O) = 1 (Branch if less than or equal to zero) C V Z .= 1 (Branch if Accumulator contents less than or same as comparand) S J.l-O = 1 (Branch if less than zero) 5 = 1 (Branch if minus) Z = 0 (Branch if not equal to zero) = 0 (Branch if overflow clear) = 1 (Branch if overflow set) 5 = 0 (Branch if plus) o o Table 9:'1.A Summary of the MC6800 Instruction Set (Continued) STATUS TYPE MNEMONIC OPERAND IS) , OPERATION PERFORMED BYTES C a: .~ !! c:J w ,w a: > Ii: 0 ~ ::E en S w a:, ;;5 encn SSw ww Do a:a:O Z S 0 TAB 1 X X 0 TBA 1 X X 0 tis 1 TSX 1 ABA 1 X X X X CBA 1 X X X X SBA 1 X X X X 0 1 P 0 CLR ACX 1 COM ACX 1 , X X 0 NEG ACX 1 X X X X X .X X X ,X X DAA DEC :1 ACX X 1 t- DEX 1 0 iI:: w t- DES 1 w Do en aw. INC ACX X X X X INS 1 ROL ACX 1 X [A]-[Ah[B] Add content. of Accumulators A and B. [A]- [B) Compare contents of Accumulators A and B. Only'the Status regi.ter i. affected. [A]-[A] - (B) Subtract content. of Accumulator B from tho~ of Accumulator A. (ACX) -00,. Clellr A~ator A or B. (ACX)-(ACX) , Complement cOlltent~ of Accumulator A or B lones complement!. (ACX) -00,. - (ACX) Negate cQntents of Accumulator A or B Itwos complement!. Carry'status is set if result is 00,. and reset otherwise. Overflow status.is set if result is 'SO,. and reset otherwise. Decimal adjust A. Convert contents of A (the binary sun:' of BCD operands) to BCD format. Carry status is set if value of upper four bits is greater than 9, but not cleared if previouslY set. [ACX)-(ACX) - 1 Decrement contents of Stack Pointer. (ACX)-[ACX) + 1 Increme~t 'contents of Accumulator A or B. Overflow status is set if operand was 7F,. before execution, and cleared otherwise. [X)-(X)+1 a: 1 [B]-'[A] . Move Accumulator A contents to Accumulator B. [A]-[B] Move Accumulator B contents to Accumulator A. [SP]-[Xi-l Move Index register contents to Stack, Pointer and decrement. [X]-[SP]+1 Move Stack Pointer contents to Index regiiter and increment. Decrement contents of Index register. (SP)~(SP) - 1 1 INX I Decr~ment contents of Accumulator A or B. OV,erflow status is set if operand was SO,. before execution,and cleared otherwise, (X)....:.(X) -! w < a: AC X Increment contents of Index register. (SP)--(SP) + 1 Increment contents of Stack Pointer. X X X 'X L{tJ:;47 ~ oj;] (ACX) Rotate Accumulator A or B left through carTy. o --S¥C © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 9-1. A Summary of the MC6800 Instruction Set (Continued) STATUS TYPE MNEMONIC ROR OPERAND IS) ACX OPERATION PERFORMED BYTES 1 C Z S 0 X X X X I.e I L+{D+I7 S '"Z ~ j: Z 0 ASL !c'"a: '"0A. ASR C; LSR ACX 1 X X X [J.-t7 X '"a: :It U ...c ACX 1 X X X 41 X ... A. ~ ...'" !' 4 o~o. o --s¥c ~o~. o --S"V"C [ACX) Arithmetic shift right. Bit 7 stays the same. ACX 1 TST ACX 1 PSH ACX 1 PUL ACX 1 X 0 X X 0 X 0--47 X ~O~ O-S"rC Logical shift right .. Bit 7 is set to O. , [ACX] - 00 1, Test con.tents of Accumulator' A or B for zero or negative value. 0 [[SP))-[ACX] [SP]-[SP] - 1 Push contents of Accumulator A or B onto top of Stack and decremimt Stack Pointer. [SP]-[SP] + 1 [ACX]-[[SP)) . Increment Stack Pointer and pull Accumulator A or B from top of Stack. [PC(HI)]-[[SP]+ 11. [PC(LO)]-[[SP}+2]. [SP]-[SP]+2 Return from subroutine. Pull PC from top of Stack and increment Stack Pointer. C/) a: a: o-S¥C [ACX] Arithmetic shift .left. Bit 0 is set 'to O. Y a: ~ C/) • oj:;) [ACX] Rotate Accumulator A or B right through carry. RTS 1 CLI 1 0 SEI 1 1 RTI 1 X X X X X X 1-0 Clear interrupt mask to enable interrupts. 1":'" Set interrupt mask to disabl~ interrupts. [SR]-[[SP]+ 11. lB] - [[ SP] + 2]. [A]-[[SP] + 3]. [X(HI)]-[[SP] + 41 • [X(LO)]-[[SP] + 51. [F'CtHI)]-[[SP] + 61. [PC(LO)]-[[SP] + 71 • [SP]-[SP]+7 Return from interrupt. Pull registers from Stack and increment Stack Pointer. Table 9-1. A Summary of the MC6800 Instruction Set (Continued) STATUS TYPE MNEMONIC OPERAND(S) BYTES OPERATION C SWI Z S 0 AC 1 1 C u.I ::I z Z 0 9 I- WAI 1 1 CLC 1 0 SEC 1 1 CLV 1 0 SEV 1 1 TAP 1 TPA 1 NOP 1 u.I I- ~ e/) ::I I- '" l- [[ sp]]-[ pcilO)). [[SP]-l]-[PC(HIl1. [[ SP]-2] - [X(lO)). [[SP]-3]-[X(HIl1. [[SP]-4]-[A1. [[SP]-5]-[B1. [[SP]-6]-[SR1. [SP]-[SP]-7. [PC(HIl]-[FFFA .. ] [PC(LO))-[FFFB,~) i= a. ::I a: a: PERFOR~ED I e/) X X X X X X Software Interrupt: push registers onto Stack. decrement Stack Pointer. and jump to interrupt subroutine. [[SP]]-[PC(lO)). [[SP]-l]-[PC(HIl1. [[ SP]-2] - [X(lO)). [[SP]-3]-[X(HIl1. [[SP]-4)-[A1. [[SP]-5)-[B1. [[SP]-6)-[SR1. [SP]-[SP]-7 Push registers onto Stack. decrement Stack Pointer. and wiat for interrupt. If [I) =1 when WAI is executed. a non-maskable interrupt is required to exit the Wait state. Otherwise. [I] - 1 when the interrupt occurs. C-O Clear carry C-l Set carry 0-0 Clear overflow status bit 0-1 Set overflow status bit [SR]-[A] Transfer contents of Accumulator A to Status register. [A]-[SR] Transfer contents of Status register to Accumulator A. No Operation MC6800 SUMMARY OF CYCLE BY CYCLE OPERATION This table provides a detailed description of the information present on the Address Bus. Data Bus. Valid Memory Address line (VMA). and the Read/Write line (R/W) during each cycle for each instruction. c w ~ a: oc.. This information is useful in comparing actual with expected results during debug of both software and hardware as the control program is executed. The information is categorized in groups according to Addressing Mode and Number of Cycles per instruction. (In general. instructions with the same Addressing Mode and Number of Cycles execute in the same manner; exceptions are indicated in the table.) a: o(,J ~ enw ~ g CI) CI) oct oIS w Z a: oell CI) o ~ oct C oct @ 9-25 Table 9-2. Operation Summary ADDRESS MODE AND INSTRUCTIONS w ~ Code Addr_ Op~Addr... +l Op cOde Addre .. + 2 Addra.. of Operand Addre.. of Operend + 1 1 1 1 1 1 OpCode Addre.. of Operand (High Order Bytel Addra .. of Operand (Low Order Bylel Operand Date (High Order Bylel Operlnd Oete (Low Order Bytel 1 2 3 4 15 1 1 1 0 1 Op Cod. Addr_ Op Code Addr... + 1 Op Code Addr... + 2 Operend OOl1lnatlon Addr_ Operand Oel1lnatlon Addr_ 1 1 1 1 OpCode Destination Addr_ (High Order Bytel Destination Addr... (Low Order Bytel Irrlll""nt OIW (Notl 11 Daw from Accumulator l' 2 3 4 Ii 6 1 1 1 1 Op Code Addra .. Op Code Addr... + 1 Op Code Addrl .. + 2 .Addrl" of Operand Addr_ of Operand Addr_ of Operand 1 2 3 4 6 6 2 3 4 6 6 7 8 9 a I/O (Notl 31 1 1 1 a 1 1 1 1 1 1 1 1 a a. 1 Op Code Add ..... Op Code Add..... + 1 Op Code Add ..... + 2 AddraII of O~nd Add..... of Operand Add .... of Operand + 1 Op Code Add .... Op Code Add .... + 1 Op Code Add .... + 2 SubroutlneSwrtlng Addr... Stack Pointer Steck Pointer - 1 Steck Pointer - 2 Op Code Addr_ + 2 OP. Coda Addr_ + 2 a 1 1 1 1 1 a 1 1 1 1 0 0 OpCode Addr... of Operand (High Order By tel Addr_ of Operand (Low Order Bytil Currant Operand Oem Irrelevant Oaw (Notl 11 Naw Ope..nd Oltl (Note 31 OpCode 1 1 1 Addrl .. of Operlnd (High Order Bylil Addr_ of Ope.. nd (Low Order Bylil Irralo""nt OIW (NOli 11 Operand Dati (High Order By til Operand Olta (Low Order Bytil OpCodl Addre.. of Subroutine (High Order By til Addrl .. of Subroutlnl (Low Ordlr Bylil Op'Code of Next Inl1ructlon Return Add .... (Low Order Bytil Raturn Addrl .. (High Order Byltl Irrelevant Ooto (Note 11 Irrolavlnt Oato (Notl 11 Addre.. of Subroutine (Low Order Byte' 1 1 1 1 a. a Op Code Addr... Op Code ·Addr... + 1 1 1 OpCode Op Cod. of N.xt Inl1ructlon 4 1 2 3 4 1 1 0 Op Code Addr... Op Code Addr... + 1 Previous Regll1er Contenll New Regll1~r Contenll 1 1 1. 1 OpCode Op Code of NlXt Inl1ructlon Irrelevant Oltl (Note 11 Irrelavlnt Dote (Note 11 4 1 2 3 4 Op Code Addr_ Op Code Addr... + 1 . 1 1 Stack Pointer Stack Pointer·- 1 a a 1 OpCode Op Code of Next Inl1ructlo\'l Accumulator Oall Accu";ulotor Dati 4 1 2 3 4 1 1 0 1 Op Code Addr_ Op Code Addr_ + 1 Stack Pointer StICk Pointer + 1 1 '1 1 1 OpCode Op Code of Next Inl1ructlon Irrelevant Data (Note 11 Operond Data from Stack 4 1 2 3 4 1 1 Op Code Addro .. Op Codl Addr_ + 1 Stack Pointer New Index Regil1ar 1 1 1 1 OpCode Op Code of Next Inl1ructlon Irralevlnt Oato (Notl 1) . Irrelevant Olta (Noto 1) O!'CodeAdd.... Op Code Add .... + 1 Index Regil1ar New Stack Pointer 1 1 1 1 OpCode Op Cod~ of Next Inl1ructlon Irralevant Data 2 (3 w er OpCode Jump Addr_ (High Order Bytel Jump Addr_ (LoW Order Bytel 1 1 PUL ~ , DATA BUS 1 2 PSH er RIW LINE 1 1 , JSR ABA OAA SEC ASL DEC SEI ASR INC SEV C8A LSR TAB CLC NEG TAP CLI NOP TBA CLR ROL TPA CLV ROR TST COM SBA ADDRESS BUS , STAA STAB CI) CI) VMA LINE , 3 ~ a: o0. CYCLE NO. .2 3 JMP cw 011 w Z CYCLES TSX TXS 4 1 2 3 4 a 1 1 1 a a 1 1 a a 9-27 ,rrelevant Data ~ I,:, Table 9-2. Operation Summary (Continued) ADDRESS MODE VMA LINE AND INSTRUCTIONS ADDRESS BUS Address of Ne~t Inrtruction (High Order By tel Address of Next Instruction (Low Order By tel Steck Pointer + 2 Op Code Address Op Code Address + 1 WAI Stack Pointer Stack Stack Stack Stack Stack Stack cw :) Z i= 1 2 3 4 5 6 (Note 41 .!=! a: w Stack Pointer + 2 Stack Pointe, + 3 Stack Pointer + 4 ~ Vl 5w 10 a: r.i: w Stack Pointer + 5 Stack Pointer + 6 5w a: 10 Stack Pointer + 7 Op Code Address Op Code Address SWI OpCode +. 1 Stack Pointer Stack Pointer - 1 Stack Pointer - 2 10 11 Stack Pointer Stack Pointer Stack Pointer Stack Pointer Stack' Pointer Vector Address 3 4 5 6 7 FFFA (He~1 12 Vector Address FFFB (He~1 12 BCC BCS BEC BGE BGT w > BHI BLE BLS BLT BMI BNE BPL BRA BVC BVS BSR « -I W a: Irrelevant Data (Note 11 Return Address (Low Order By tel Return Address (High Order By tel Inde~ Register (Low Order By tel Inde~ Register (High Order By tel Contents of Accumulator A Contents of Accumulator B Contents of Condo Code Register Irrelevant Data (Note 11 Address of Subroutine (High Order By tel Address of Subroutine (Low Order By tel Op Code Address Op Code Address + 1 Op Code Addre .. + 2 Branch Address OpCode Branch Offset Irrelevant Data (Note 11 Irrelevant Data (Note II' o p Code Address Op Code Branch Offset Irrelevant Data (Note 11 Return Address (Low Order By tel Return Address (High Order Bytel Irrelevant Data (Note 11 Irrelevant Data (Note 11 Irrelevant Data (Note 11 Op Code Address + 1 Return Address of Main Program Stack ·Pointer i= Index Register (High Order By tel Contents of Accumulator A Contents of Accumulator B Contents of Condo Code Register Contents of Accu ...",lator A from Stack Index Register from Stack (High Order .Bytel Inde~ Register from Stack (Low Order By tel Ne~t Instruction Address from Stack (High Order By tel Ne~t lAst ruction Addre.. from Stack (Low Order By tel ~ Vl Op Code Op Code of Next Instruction Return Addre .. (Low Order By tel Return Addre .. (High Order By tel Index Register (Low Order'Bytel Op Code Irrelevant Data (Note 21 Irrelevant Data INote 11 Contents of Condo Cod. Regilter from Stack Contents of Accumulator B from Steck Op Code Address Op Code Address + 1 Stack Pointer Stack Pointer + 1 ATI Z 0 . Pointer Point~r Pointer Pointer Pointer Pointer - DATA BUS OpCode Irrelevant Data (Note 21 Irrelevant Data ,(Note 11 Op Code Addr.... Op Code Address + 1 Steck Pointer Stack Poimer + 1 ATS RIW LINE Stack Pointer - 1 Stack Pointer - 2 Return Address of Main Program Subroutine Address Note 1. If device which is addressed during this cycle uses VMA, then the Data Bus will go to the! high impedance three-state condition. Depending on bus capacitance, data from the previous cycle may be retained on the Data Bus. Note 2. Data il ignored by the MPU. Note 3. For TST, VMA· 0 and Operand data doel,not change. Note 4. While the MPU il waiting for the Interrupt, BUI Available will go high indicating the following states of the control lin.l: VMA il low; Addresl BUI, RIW, and Data BUlare all in the high impedance Itlte. 9-28 The following codes a~e used in Table 9-3: aa ffi ~ :5 :5 Q. pp qq x o ~ yy y two bits choosing the address mode: 00 immediate data 01 base page direct addressing 10 indexed addressing 11 extended direct addressing the second byte of a two- or three-byte instruction. the third byte of a three-byte instruction. one bit choosing the Accumulator: 0 Accumulator A 1 Accumulator B two bits choosing the address mode: 00 (inherent addressing) Accumulator A 01 (inherent addressing) Accumulator B 10 indexed addressing 11 extended direct addressing one bit choosing the address mode: o indexed addressing 1 extended direct addressing Two numbers in the "Machine Cycles" column (for example. 2 - 5) indicate that execution time depends on the addressing mode. 9-29 Table 9-3, MC6800 Instruction Set Object Codes MNEMONIC OPERANO(S) ABA ADC ACX, ADR8 or DATA OBJECT CODE AND ACX, ADR8 or DATA ADR16 ACX, 1 2 pp qq 2 2-5 3 4 2 3 2-5 4 2 2-5 4 ASR pp qq BeS BEQ BGE BGT BHI BIT ADR8 7 ADR16 or DATA16 3 6 01yyOlll 1 2 pp qq 24 pp 25 pp 27 pp 2C pp 2 3 2 7 6 4 2 4 2 4 ADR16 ACX ADR16 DISP DISP DISP DISr DISP DISP ACX, ADR8 or DATA BMI DISP DISP BNE BPL DISP DISP B~A DISP BSR DISP BVC DISP DISP 4 ADR8 ADR16 2 3 2 2 2 2 i 2 2 2 PSH ACX 4 PUL 4 6 2 pp qq 2 3 2-5 4 01yyOOll 1 2 PP qq 2 7 3 6 ACX ADR8 ADR16 ADR8 4-6 3 1 1 3-5 2 7 34 2 3 1 09 1 ADR8 ADR16 qq ADR16 or DATA16 DAA ACX DES ACX, ADR8 or DATA ADR16 ACX PP qq 2 3 01yyOOOO 1 pp qq 2 7 6 2 2 7 3 1 6 2 lxaal0l0 2 2 7 ROR 3 1 ADR8 ADR16 PP qq 6 2 7 3 3B 1 6 10 39 10 1 1 5 2 2 3 2-5 4 ACX, SEC SEI SEV STA ~CX, ~DR8 ADR16 STS ADR16 PP qq OD 1 2 OF 1 1 2 2 3 4-6 2 5-7 3 6 2 3 5-7 2 2-5 OB lxaaOlll PP qq PP qq llaallll ADR8 ADRl6 ACX, ADR8 or DATA ADR16 2 4 lxaa0010 lOaallll ADR8 SUB PP qq PP qq · · · 2 5 6 lxaaOOOO PP qq 6 4 12 16 1 2 4 TAP 2 2 2-5 06 17 07 1 TBA TPA 2 2 3 '1 4 TST 1 1 1 2 'i 7 INS 6 4 INX 08 1 4 = 00 is not pp qq 3 1 3 1 PP qq 4-6 01yyOl00 3F 31 AD~16 3-5 PP qq 01yyOll0 2 2 ADR8 2 3 1 pp qq SWI TAB lxaal000 01yyll00 3-5 4-6 ADR8 STX 2 PP qq 19 01yyl0l0 pp 2 3 ADR16 ACX ADR8 or DATA lOaall00 CPX pp qq 4 ADR16 lxaaOOOl 4 1 SBC 1 2-5 01yyl00l SSA 3 2 3 ROL 2 OA pp qq 1 2 7 9 lxaaOll0 00ll00lx 1 1 2 8 ACX ACX OC pp qq 2 3 4 RTS ADR8 pp qq 0011011x 4 2 2 3 2-5 2 1 4 2 Rn 29 2 3 3 1 4 4 1 ADR8 or DATA ADR16 "OR8 or DATA ADR16 4 4 pp qq 01 ~CX, 2-5 4 4 oe ACX, NOP ORA 8 4 PP PP ADR16 ACX 4 4 2 28 ACX ADR8 2 2 01yyllll ADR16 ·aa PP qq 2F PP 23 PP 2D PP 2B PP 26 PP 2A PP 20 PP 8D pp NEG CYCLES llaalll0 ADR8 ADR16 or DATA16 2 ACX CLI INC Pfl pp lxaaOl0l 11 CLC DEX EOR 2E 22 LDX LSR MACHINE BYTE lOaall10 LDS 2 BLT DEC ADR16 2 DISP COM ADR8 or DATA pp qq BLS CLV CMP ADR16 ACX, 01yyl000 BLE CLR ADR8 3 1 CODE 101V 11 0 1 JSR ADR8 ADR16 DISP BVS CBA ADR8 ADR16 LDA OBJECT 011v1l 10 JMP lxaaOl00 pp qq OPERAND(S) ACX ADR8 BCC MNEMONIC lxaal0ll ADR8 or DATA ADR16 ASL CYCLES lB lxaal00l ADR16 ADD MACHINE BYTE ACX 01yyll0l ADR8 PP qq ADR16 permitted, 9-30 4 2 2 7 4 TSX 30 3 1 TXS WAI 35 1 4 3E 1 9 6 SUPPORT DEVICES THAT MAY BE USED WITH THE MC6800 Using 8080A support devices with the MC6800 is very straightforward in terms of control signals generated. You must break out the single MC6800 R/W' control signal into separate RD and WR control signals. Other signal interconnections are self-evident. Here is appropriate logic: cw -Et>O g : . rt>o : R/W ---II~""'------- ~ a: oa.. a: o(J WR ~ enw I- oCt C3 oCI) MC6800 Signals HALT CI) oCt 011 w Z a: IRQ o Decode FFF9 on CI) o Address Bus ~ oCt VMA III AD <1J2 ( T I l l - - - - + - - - - - - - - . . . BuSEN o2 (TTL) 6870 series clocl< a~ follows: ClR <1J2(TIL) Q B 74lS123 A 9-31 ClK (8080AI RESET------------------------~--------~ RESET AODRESS DECODE CIRCUIT A 1 1 - - - - - - - - -..... A1 AO AO MC6800 CPU 8251 or 8253 or 8255 ..-----------.... ,''1 NMOS R/W ~2NMOS~ __________ ClK· ~ <1>2 TTL + 5V. 100pF 5.6KU ........ "-('l'--~""v--+ 5V MC6870 or MC6871 or ClR 220 ns < tw < 300 ns QI---------------__________- - J B MC6875 CLOCK ·8251 ONLY 74LS123 Figure 9-11. Use of 8080A Support Devices With MC6800 CPU Figure 9-11 illustrates the interface for an 8251, an 8253 or an 8255 device connected to an MC6800 CPU. Figure 9-12 provides the timing for 8080A support devices used with an MC6800 CPU. The 8257 DMA device and the 8259 PICU should not be used in an MC6800 since MC6800 DMA and interrupt logic are not compatible with these devices. 8085 support devices could be used with an MC6800 but would require that you multiplex the Data Bus and low order eight Address Bus lines, as required by the 8155, 8355, and 8755. Extra logic needed to perform this bus multiplexing would probably destroy the cost effectiveness of the 8085 support devices in an MC6800 system. The only Z80 support device that is practical in an MC6800 system is the Z80 DMA devlce. This is because the other Z80 support devices decode a Write state from a combination of the M1, INT, and RD control signals. The Z80 DMA device uses separate read and write control inputs: therefore it mqy be used with an MC6800 CPU. The logic needed to create Z80 DMA control inputs from MC6800 con'trol signals is identical to the 8080A control signal logic illustrated above. The Z80 SIO device will probab!, not be effective in an MC6800 system: in preference, use specific MC6800 serial 110 devices. 9.:.32 I \ I <1)2 NMOS \ I \ '1'2 TIL \ ~ •, ct>1 NMOS Q w ~ a: oa.. a: o(J ~ enw R/W. ADDR VMA 6800 1 I } \ le( U o(J) DATA IN r1 ~ 6800 ~~ (J) e( c1J w Z I DATA OUT 6800 ,/ a: o m (J) o R5 ORWR TO I II { 8251. 8253. 8255 \ } \, 1 ~ e( Q e( @ Figure 9-12. Timing for 8080A Support Devices Used With an MC6800 CPU When using non-MC6800 support devices with the MC6800 CPU, remember that there is a particularly pernicious problem associated with MC6800 Reset logic on power-up. As discussed earlier in this chapter. the MC6800 does not internally disable interrupt requests until the trailing low-to-high transition of the RESET signal. Thus external devices capable of requesting an interrupt may randomly do so during the power on Reset sequence; and this may result in an interrupt being acknowledged following the initial system Reset. rather than the expected system initialization program getting executed. You must make certain that all support devices capable of requesting an inter-. rupt are disabled by the leading high-to-Iow transition of RESET during the power-up sequence. THE MC6B02 CPU WITH READIWRITE MEMORY The MC6802 is a combination of the MC6800 CPU, clock logic, and 128 bytes of read/write memory. Figure 9-13 illustrates logic of the MC6802 CPU device. The actual CPU architecture and the instruction set of the MC6802 are identical to the MC6800 which we have already described. The 128 bytes of read/write memory which are present on the MC6802 chip are accessed by memory addresses 000016 through 007F16. The first 32 bytes of this read/write memory maybe protected during power down by a special low power standby input. MC6802 CPU pins and signals are illustrated in Figure 9-14. Pins and signals which differ from the MC6800 illustrated in Figure 9-2 are shaded. We will examine these new signals only. Since clock logic is on the MC6802 chip. three pins are needed for this specific purpose. Normally a crystal will be connected across XTAL 1 and XTAL2. A 4 MHz crystal should be used since the MC6802 has internal divide-by-four logic to create a 1 MHz. system clock signal. (An inexpensive 3.58 MHz color burst crystal may also be used.) A TTL level system clock signal is output via <1>2 (TTL). You can. if you wish. drive the MC6802 using an external clock signal; this signal is input via XTAL2; it must not be faster than 4 MHz. XTAL 1 should be left unconnected in this mode. 9-33 (,< I·'·· ( ,....". Logic to Handle ____ Interrupt Requests ---from External Devices .. \\....,',' Interrupt Priority Arbitration ". . . . ii.i.ii /i'..'·\ ?? Direct Memory Access Control Logic ,, 'sIt .···1 "if( .. ,\,.) ,,:'. '>' . \ ... ... \.\"" System Bus \ ....' / .& ~ ~ , ~ ROM Aejdressing and Interface Logic I/O Communication Serial to Parallel Interface Logic • • • ··.~~~)~~dressing I/O Ports Interface Logic ••••• 1~:lri4it:;: Logic ~ ·""·""'·"'·\\/\·1 , Programmable Timers Read"Only Memory '. . ?t,·j'··. . . i.·'.·'. ' I,.'.'{·.'.'.,.~,e. ad. .1. Write , j it) Memory I/O Ports C(i.ii t, .,.,. Figure 9-13. Logic of the MC6802 CPU Device In order to provide the clock stretching logic that is a standard part of MC6800 microcomputer system, a Memory Ready (MR) signal is present. MR is normally high. In order to stretch <1>2, MR must make a high-to-Iow transition while <1>2 is high: <1>2 then remains high untilMR makes a low-to-high transition. Timing may be illustrated as follows: , I I I I x· <1>2 MR 1 I I I I I I I 200ns I" I ~I I" 9-34 300ns I I I ~I Vss c w ~ a: oQ. a: o o ~ u) w ~ g CI) CI) ct o!I w z a: o m CI) o ~ ct C ct @ HALT MR IRQ VMA NMI BA VCC AO Al A2 A3 A4 A5 A6 A7 A8 A9 Al0 All ..-.... --- - --- ----- - -------- - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 . MC6802 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 ---- --~ 'a .. ..----.. ------ ---- -- ..... --- -..' ..--.... .-.. RESET XTAL1 XTAL2 E RE YCC(~!J R/W . DO 01 02 03 04 05 06 07 A15 A14 A13 A12 Vss TYPE PIN NAME DESCRIPTION ·AO - A15 ·00 - 07 ·HALT ·MR ·RE ·R!W ·VMA ·BA ·IRQ RESET NMI XTAL1.XTAL2 E VSS.VCC VCC (ST) Output Address Lines Tristate. Bidirectional Data Bus Lines Input Halt Input Memory Ready Input RAM Enable Output Read/Write Output Valid Memory Address Output Bus Available Input Interrupt Request ' Input Reset Input Non-Maskable Interrupt Crystal/Clock Connections Input Output Enable Power Standby Power ·These signals connect to the System Bus. Figure 9-14. MC6802 CPU Signals and Pin Assignments Two signals have been added to support the on-chip read/write memroy. RE is an enable signal for the on-chip memory. RE must be input high for the on-chip memory to be accessed. If RE is low. on-chip memory cannot be written into or read. While on-chip memory is disabled its address space is also disabled. and addresses in the range 000016 through 007F16 are deflected to external memory. Thus the address space 000016 through 007F16 is duplicated: it accesses on-chip RAM when RE is high. but it accesses external RAM when RE is low. . The first 32 on-chip read/write memory bytes (with addresses 0000 through 001 F) can have the contents preserved by applying +5V at the V CC standby pin when power is down on the MC6802. But to be of anY value. we must guarantee that the contents of. these 32 read/write memory' locations are not destroyed during any power down sequence: in other words. we must anticipate any power down. In order to preserve the contents of the 32 low-order read/write memory bytes.RE must be input low at least three clock periods before power drops below +4.75V. This is easy enough to dofor a scheduled power down: however. it is impossible during a non-scheduled power down - such as might occur as the result of a power failure - unless power-down-interrupt circuitry is provided. MC6800 signals which have been removed, going to the MC6802. include the clock inputs <1»1 and <1»2, plus the bus control signals TSC and DBE. Obviously. the clock inputs must be removed since clock logic is now on the CPU chip. 9-35 · . .. . " . Removal of the System Bus control signals TSC and DBE reflects the fact that if you are going to need direct memory access. you are not going to use the MC6802. Only larger microcomputer systems need direct memory access; for such systems the MC6800 is available. The MC6802 is intended as half of a two-chip 6800 configuration. witr.in which direct memory access would be meaningless. If DMA is necessary with a 6802-based system. then the use of external tristate bus drivers will be necessary. Bus Available (SA) and HALT are available on the 6802 for this purpose. The MC6846 multi-function device is the other half of the two-chip microcomputer system. However, the MC6846 can be used with the MC6800 CPU or the MC6802 CPU; therefore it is described later in this chapter along with other 6800 support devices. When HALT is input low, the MC6802 enters the Halt state at the end of the current instruction's execution. In the Halt state the Data Bus is floated. Bus Available (BA) is output high. and 'valid memory address (VMA) is output low. The Address Bus outputs the address of the instruction which will be executed when the halt condition ends. Timing may be illustrated dS follows: ~One machine , I I <1>2 HALT BA VMA 00 - 07 AO - A15 Instruction execution ends here The HALT input signal is level sensitive. The level of HALT is sensed 250 nanoseconds before the end of a machine cycle. If HALT is low at this time. then the low level is detected. If HALT makes a high-to-Iow transition within the last 250 nanoseconds ofa machine cycle. then it may not be detected. This may be illustrated as follows: <1>2 --.J I I \ I I I ,--.-;..---\ I \,- - - - - - 1...- - I I I I I HALT HALT low not detected here 9-36 , I 1~50=-1 Halt low detected here I I I ~I 250 ns . Once a Halt has been detected. the current instruction completes execution before the Halt condition starts. In the simplest case this may be illustrated as follows: I " I ~2-1---~\~ cw oD.. I I !;t II: I __~/~~~\~__~/~--~\~__~ I I I \ HALT II: ~.·250ns CJ I o ~ enw !;t g CI). CI) c:( . . End. ot! HALT instruction I begin~ If a Halt transition occurs within the last 250 nanoseconds of a machine cycle. then the HALT will probably not be detected until the next machine cycle. Assuming that the next machine cycle terminates an instruction's exeuction. the Halt condition will begin as follows: ~ w Z II: o al ~2 CI) o ~ I I \ I I I I I I I } ...... \ I I ~ c:( cc:( HALT HALT low : not detected I here \1:j I I I 250ns~ ------, I I I @ ,....................I,."'\ ' ~ ~ ~ HALT low detected here 250ns End of instruction The next machine cycle could be the first of a multi-machine cycle instruction. Now the Halt condition will begin as follows: ~2 HALT here I Next instruction End of I....... , ---executes in three - - -__ instruction : machine cycles :1~;~~j,~i[~;~~llmlllllll .t!IHI~Ll~bElaln,s}.i. Note that if the HALT transition had occurred a little earlier. the HALT condition would have begun a whole instruction exeuction time sooner - three machine cycles sooner in the illustration above. 9-37 The HALT condition terminates on the machine cycle that follows HALT going high again. Once again the HALT signal is sampled 250 nanoseconds before the end of the machine cycle. Thus the HALT may terminate within the machine cycle where the HALT signal makes a low-to-high transition: \ I I But the HALT 'cpndition hlay terminate one machine cycle later if the HALT signal makes its low~to-high transition within the last 250 nanoseconds of a machine cYGle. This may be illustrated as follows: I .), ""'., , <1>2 I \ I I HALT '"'' .'."·,··,i Start next instruction's iA Al2 I I HALT Th" I h;gh-to-~w :::,::.:Y occurring too late, is I not detected I I I \~II_ _ _~_ _ _• r- J",.;, I ~ Th;, I never detected ~250ns I I I I During the HALT condition no interrupts will be acknowledged. If any interrupt requests occur during a HALT condition, they simply stack up waiting for the end of the HALT condition. There are also some differences in MC6802 interrupt and reset logic as compared to the MC6800. INTERRUPTS DURING AN MC6802 HALT Motorola literature recommends that interrupt request inputs IRQ and MNI have a 3K ohm external resistor to This may be illustrated as follows: Vee 3.0Kfl 6802 IRQ or NMI .....t--t~-- 9-38 Vee. The MC6802 RESET input may be a stand-alone input or it may be tied to the RAM enable input (RE). Timing for the RESET signal rise and fall differs in the two cases. as defined in the·9p.t~ sheets at the end of this chapter. Note that by tying RESET to RE you cause the on-chip RAM to be enabled whenever the MC6802 is receiving power. ~ ~ ~ The MC~802, like the MC6800, does not disable interrupts until clo~e to the end of the reset sequence. Thus. if you have non-6800 support devices connected to an MC6802. you must make certain that you have included logic that prevents these !3Upport devices from requesting an interrupt until after the reset operation has gone to completion. If you do not take this precaution. then following RESET you mClY vector to a support deyice's interrupt service routine rather than ex~cuting the intended system initialization program. Q. a: o ~ en ~ § CI) ~ THE MC6870 TWO PHASE CLOCKS Four clock logic:: devices supporting the MC6800 CPU are described. The MC6802 does not need any external clock logic device~ The MC6~70A is' a very elementary device providing minimum clock signal~ needed with an MC6800 microcompute'r system. Its pin assignments are illustrated in Figure 9-15. all w Z a: o m CI) GND 1 24 3 22 o ~ ct ct C @ ct>2 (TTL) -- Vee (+ 5V) (iJ2 (NMOS) - 5 20 MC6870A 7 18 12 13 GND -.. ct>1 (NMOS) Pin Name Description Type <1>1 (NMOS) (1)1 Clock to MC6800 Output <1>2 (NMOS) (1)2 Clock to MC6800 Output. ct>2 (TTLl ct>2 Clock to microcomputer Output system Vee. GND Power and Ground Figure 9-15. MC6870A Clock Device Pins and Signals 9-39 The first enhancement is provided by the Me6S71 A, illustrated in Figure 9-16, which adds clock signal stretching capabilities and a twice frequency clock output. GND MEMORY CLOCK - -- <1>2 (TTL ) Vcc (+ 5V ) <1>2 (NMOS) -- 1 24 3 22 5 20 ... .:.. 2xfc MEMORY READY ~ ~ . MC6871A 7 18 12 13 GND - <1>1 (NMOS) Pin Name Description Type <1>1 (NMOS) <1> 1 Clock to MC6800 Output <1>2 (NMOS) <1>2 Clock to MC6800 Output <1>~ (TIL) <1>2 Clock to microcomputer Output MEMORY CLOCK Select to memory devices Output 2xfc Twice frequency clock Output 'HOL5i Stretch <1>1 high control Input MEMORY READY Stretch <1>1 low control Input Vcc,GND Power and Ground system . ,~Figure 9-16. MC6871A Clock Device Pins and Signals . The Me6S71 B, iIIustr'~.tY~Figure 9~17, is a. varia. tion of the Me6S71 A . ~ GND <1>2 (TTL) --- UNGATED <1>2 (TTL ) Vcc (+ 5V ) <1>2 (NMOS) 24 3 22 ~ 5 20 7 - Pin Name -. 1 MC68718 12 - - 18 13 Description 2xfc GND ------ <1>1 (NMOS) Type <1>1 (NMOS) <1>1 Clock to MC6800 Output <1>2 (NMOS) <1>2 Clock to MC6800 Output <1>2 (TTL) <1>2 Clock to microcomputer Output system <1>2 (TTL) UNGATED Free-run~ing <1>2 (TTL) 2xfc Twice frequency clock Output HOL51 HOL5'i Stretch <1>1 high control Input Stretch <1>1 low control Input Vcc. GND Power and Ground Output Figure 9-17. MC6871 B Clock Device Pins and Signals 9-40 ... --. X1 X2 EXT IN c 4xfc !iII: 2xfc MEM READY w o0. '1>2 (TTL) II: o GND -- - .. -- 1 2 3 4 5 16 15 MC6875 6 7 14 13 12 11 10 -... --leG--.. .- :- V cc (+5V) '1>1 (NMOS) RESET '1>2 (NMOS) SYs REs REF GRANT DMA/REF REO 9 ~ MEMORY CLOCK 8 U ~ iii w !i t3 o (/) Pin Name Description Type e1>1 (NMOS) ct>1 Clock to MC6800 Output '1>2 (NMOS) ct>2 Clock to MC6800 Output ct>2 Clock to micro~om- Output el>2 (TTL) (/) puter system c:( MEMORY CLOCK Free-running ct>2 (TTL) 2xfc Twice frequency clock Output Output II: 4xfc Four Times frequency clock Output al DMA/REF REO Stretch ct>1 high control Input REF GRANT Stretch ct>1 high, acknowledge Output ~ MEM READY Stretch ct>1 low control Input c c:( SvS"RES c:( RESET Asynchronous system reset control Synchronous reset control Output EXT IN External synchronization control Input X1. X2 External crystal connections Vcc. GND Power and Ground ciJ w Z o (/) o @ Input Figure 9-18. MC6875 Clock Device Pins and Signals The MC6875 is the most versatile of the clock devices provided for the MC6800. It is illustrated in Figure 9-18. Since these various clock logic devices represent essentially the same capabilities, but with increasing enhancements, we will describe logic and capabilities in the order of the device illustrations. Much of the clock device logic we are going to describe stretches the <1>1 (NMOS) and <1>2 (NMOS) clock signals. But recall that stretching <1>1 (NMOS) and <1>2 (NMOS), in itself, is only half of the logic needed to stretch the entire System Bus. Additionally, the MC6800 needs a high TSC input to float ,the Address and RIW Bus lines while <1>1 (NMOS) is high. DBE must be input low in order to float the Data Bus lines while the clock is being stretched with <1>1 (NMOS) low. THE MCG870A CLOCK DEVICE This is a minimum clock device; it outputs <1>1 (NMOS) and <1>2 (NMOS), the two clock signals required by an MC6800 CPU. <1>2 (TTL) is also generated. <1>2 (TTL) is used to synchronize support devices; it has sufficient load capacity to drive five devices without signal buffering. The MC6870A contains an internal crystal and oscillator: in its standard form clock Signals with a 1 MHz frequency are generated. A variety of other clock frequencies can also be ordered. THE MCG871 A CLOCK DEVICE In addition to the standard signals output by the MC6870A. the MC6871 A provides two additional TTL output clock signals and externally controlled pulse stretching capabilities. 9-41 HOLD1 is used to stretch the standard clock signals: <1>1 (NMOS), '<1>2 (NMOS) and <1>2 (TTP, which we described for the MC6870A Timing may be illustrated as follows: <1>2 (NMOS) and <1>2 TTL It is very important that HOLD 1 makes its active highcto-Iow transition during a <1>1 (NMOS) high state, Subsequently. <1>1 (NMOS). <1>2 TTL clocks will be stretched until HOLD1 makes a I()w-to-high trahsition within the contraints desc~ibed below. . . ". r.-----~ As illustrated above. HOLD1 stretches clocks with <1>1 (NMOS) high. If you refer back to our dis-MC6800 cussion of the MC6800. you will see that these clock levels identify the portion of a machine cycle STRETCHING when an address is being output. Typically. the clock will be stretched so that two addresses can ADDRESS be output: the first for a Direct Memory Access or dynamic memory r!3fresh operation:' the second TIMING for the normal address output which is required when any :instruction is executed. Device select logic must discriminate between the two addresses being output: DMA or dynamic memory refresh logic must receive . , the first address only. while memory or I/O devices receive the second address only. Two additional clock signals are output by the MC6871A: 2xfc and MEMORY..Qb.Q£.K: they are not part of normal memory addressing logic. therefore these two clock signals are not stretched by HOLD1. 2xfc is it twice frequency clock signal which can be used for various synchronization logic around an MC6800 microcomputer system. MEMqRY CLOCK is identical in waveform to <1>2 TTL e~cept MEMORY CLOCK is not stretched by HOLD1. HOLD1 must make its high-to-Iow transition while <1>1 (NMOS) is high. HOLD1 must subsequently make its low-to-high transition 'while <1>1 (NMOS) would have been high. had it not been stretched. An asynchronous HQ~D~ request must therefore be synchronized with <1>1 (NMOS) in order to' generate a valid HOLD1 clock input. This is asjmple logic operation: here !s one pgsSi~ility: +5V 1r Asynchronous ~_ _ _ _ _ _ _--I R . QLHOL01 10 HOLD reque~t 7402 1/274LS74 MEMORY CLOCK -----01-- c~ 2xfc OMA or Refresh Acknowledge +5V 9-42 This circuit synchronizes the high-to-Iow and the low-to-high transition of HOLD1. The low-to-high clock transition occurs only during .eIl1 (NMOS) high time: (1)1 (NMOS) c w ~ oa.. MEMORY CLOCK a: a: o o 2xfc ~ iii w ~ (3 o In In Observe that synchronization logic can create a time delay of up to one half clock cycle between the unsynchronized and the synchronized HOLD signals changing state. o!I MEMORY READY also stretches clock l:Iignais. Timing may be illustrated as follows: ct w Z a: o ct>1 (NMOS) In In o ~ ct ct (1)2 (NMOS!. ct>2 TTL c @ MEMORY READY 2xfc Clock signal stretching begins with eIl2 (NMOS) high following the MEMORY READY high-to-Iow transition. Clock stretching ends with the falling edge of 2xfc following the MEMORY READY low-to-high transiiibn. Observe that MEMORY READY stretches MEMORY CLOCK: which HOLD.1 does not do. 2xfc. however. is not stretched. either by HOLD1 or by MEMORY READY Also note that MEMORY READY does not require input synchronization. as does HOLD1. If you refer back to the timing diagrams which illustrate MC6800 instructions' execution. you will see that MEMORY READY stretches cloc~ signals during the data access portion of a machine cycle. This is the part of the machine cycle during which external memory has to respond to a CPU access; therefore. this is the portion of the tnachlne cycle which must be stretched for slow memories - which is why MEMORY READY can be visualized as the signal which slow memories must input low in order to .9clin the access time tHt3y require. The MC6871A contains an internal crystal oscillator. In its standard for~. clock signals with a 1 MHz frequency are generated. A variety of other clock frequencies can also be ordered. THE MC6871 B CLOCK DEVICE This device differ~ ,from the MC687iA in two ways. MEMORY READY is replaced by HOLD2 and MEMORY CLOCK is replaced by eIl2 (TTL) UNGATED. HOLD2 stretches clock signals with eIl1 (NMOS) low. just as MEMORY READY did; however. like HOLD1. HOLD2 must have its active transitions synchronized with the clock output - in this case with eIl2 high. eIl2(TTL) UNGATED. however. is not stretched. Timing may be illustrated as follows: ct>2 TTL UNGATED \ 9-43 I THE MC6875 CLOCK DEVICE' This is the most sophisticated of the clock devices offered with the MC6800 microcomputer system. Its principal features are that it performs control input synchronization which must be handled externally by other clock devices; also, the MC6875 allows external timing. As we have already stated. clock signals are stretched with <1>1 and <1>2 low in order to allow a Direct Memory Access or dynamic memory refresh address to be output The MC6875 DMA/REF REO input performs this clock stretching operation, just as HOLD1 does, except that DMA/REF REO can be an asynchronous input. MC6875 internal logic performs the synchronization operations wbich have to be handled externally for the MC6871 A and MC6871 B clocks. In addition. the MC6875 outputs REF GRANT high while the clocks are being stretched with <1>1 (NMOS) high. External DMA or dynamic memory refresh logic can use REF GRANT as an enable strobe: MEMORY READY and MEMORY CLOCK are as described for the MC6871 A. MEMORY READY stretches clocks with <1>1 (NMOS) low. MEMORY CLOCK fOllows <1>2 (NMOS) and is stretched by MEMORY READY but not by DMA/REF REO. . The MC6875 clock signal outputs <1>1 (NMOS) and <1>2 (NMOS) have sufficient capacity to drive two MC6800 CPUs. 4xfc is an additional oscillator running at four times the <1>1 and <1>2 clock rates. X1, X2 and EXT IN are three signals which allow MC6875 clock rates to be controlled externally. You can optionally attach a crystal oscillator or an RC network to Xl. X2 as follows: CRYSTAL OPERATION RC OPERATION You can also input an external clock signal to EXT IN, in which case the MC6875 will adopt the frequency of the external signal. The external clock frequency must be four times the <1>1 and <1>2 clock frequency. The MC6875 is able to take an asynchronous SYSTEM RESET input and convert it into a synchronous RESET, which may be used throughout an MC6800 microcomputer system SYSTEM RESET can be any input Signal which is processed through a Schmitt trigger to create a RESET output. as described for the 8224 clock device in Chapter 4. SOME STANDARD CLOCK SIGNAL INTERFACE LOGIC There are a number of very common ways in which MC6870 series clock signals are used within MC6800 microcomputer systems. You will find that all of the support devices described in the rest of this chapter require an enable synchronizing signal, given the symbol "E". This signal is usually generated as the AND of the MC6800 VMA output and the <1>2 TTL clock output: . ___ <1>2 TTL _ _ _....,~u_· E 'VMA ~ MC6800 ENABLE SIGNAL GENERATION The purpose of ANDing <1>2 with VMA is to make sure that devices receiving signal E are inhibited while VMA is lowat which time the CPU cannot be accessing the support device. 9-44 The HALT signal. which is used in MC6800 microcomputer systems to float the System Bus for extended periods. must be a synchronous input. You can create a synchronous HALT from an asynchronous HALT using <1>2 TTL as follows: MC6800 SYNCHRONOUS HALT GENERATION +5V c w ~ a: o Asynchronous HALT -----t15 a. a: o o Synchronous HALT 1/274LS74 ~ u) w <1>2 TTL 'X)---f)CK ~ g (/) (/) ~ +5V a1J w Z a: o THE MC6820 AND MCS6520 PERIPHERAL INTERFACE ADAPTER (PIA) m (/) o ~ ~ c ~ © This part is manufactured as the MC6820 by the companies listed at the beginning of this chapter. MOS Technology and its second source companies (whose products are described in Chapter 10) manufacture the same part, but call it the MCS6520. The MC6820 PIA is a general purpose I/O device, designed for use within MC6800 microcomputer systems. The MC6820 PIA provides 16 I/O pins, configured as two 8-bit I/O ports. We will refer to these as Port A and Port B. Individual pins of each I/O port may be used separately as inputs or outputs. Each I/O port has two associated control signals, one of which is input only, while the other is bidirectional. The only differences between I/O Ports A and B are in their electrical characteristics, and in their handshaking control capabilities. But these are very significant differences. as we will explain shortly. Figure 9-19 illustrates that part of our general microcomputer system logic which has been implemented on the MC6820 PIA. The MC6820 PIA is packaged as a 40-pin DIP. It uses a single +5V power supply. All inputs and outputs are TTL compatible. The device is implemented using N-channel silicon gate MOS technology. THE MC6820 PIA PINS AND SIGNALS The MC6820 pins and signals are illustrated in Figure 9-20. We will summarize signal functions before describing PIA operations. Consider first the various Data Busses. DO - 07 represents the bidirectional Data Bus via which all communications between the CPU and the MC6820 occur. PAO - PA7 and PBO - PB7represent Data Busses connecting the two 8-bit I/O Ports A and B with external logic. . The 16 I/O port pins may be looked upJn as 16 individual signal lines. or two 8-bit I/O busses. Each I/O port pin can be individually assigned to input or output. but an individual pin cannot support bidirectional data transfers. These are the differences between I/O Port A and B pins: 1) Bits of I/O Port A may be set or reset at any time by voltage levels applied to associated pins. Irrespective of data that may be in a bit position following a Read or Write operation. an I/O Port A bit will be reset to zero any time a voltage of +O.8V or less is applied to a Port A pin. A 1 will be written into a Port A bit any time a voltage of +2V or more is applied to the Port A pin. I/O Port B bit contents are not affected by voltage levels at I/O Port B pins. For example. suppose that a 1 has been output to bit 2 of I/O Ports A and B. Subsequently suppose that pin 2 of I/O Ports A and B are drained excessively. so that voltage levels transiently drop to +O.5V. I/O Port A bit 2 will become O. but I/O Port B bit 2 will retain a level of 1. 2) As outputs. I/O Port B pins may be used as a source of up to 1 mA at +1.5V. to directly drive the base of a transistor switch. This is not feasible using I/O Port A pins. 9-45 Clock Logic '/... Logic to ~a9~1~ ... Arithmetic and Logic Unit 'nterru~:o~2;{f~j I· .:::\. . .>·.-_~ _ External Devices -- Accumulator Registerlsl Instruction Register ~ - Control Unit '-----r---' ~ Data Counterlsl Stack Pointer II Bus Interface Logic ~ Program Counter Direct Memory Access Control Logic ., t System Bus t • I/O Communication . . Serial.to Parallel Interface Logic ROM Addressing and Interface Logic RAM Addressing and Interface Logic t Programmable Timers Read Only Memory Read/Write Memory ... .~ ~ .. Figure 9-19. Logic of the MC6820 PIA. There are five device select pins. CSO, CS1 and CS2 are three typical chip select signals. For an MC6820 device to be selected. CSO and CS 1 must receive high inputs while CS2 simultaneously receives a low input. ' Providing CSO. CS1 and CS2 have selected an MC6820 device. RSO and RS1 address one offour memory locations. Thus an MC6820 device will appear to a programmer as four memory locations. Any of the standard schemes described in Volume I can be used to address an MC6820 PIA. There is nothing unusual about the select logic with which you will assign four unique memory addresses to an MC6820. The're are four timing and control signals which interface an MC6820 with external logic. CA 1 and CA2 are control signals associated with I/O Port A. CA 1 is an input only signal and is usually used by external logic to request an interrupt. CA2 is a bidirectional control signal which is used to implement various types of handshaking'logic. CB1 and CB2 are the control signals which support I/O Port B.. These tw~ signals are analog'o~s to CA 1 and CA2. although there are some differences in the handshaking logic associated with CB2 as compared to CA2. 9-46 Vss PAO PAl PA2 PA3 PM PA5 PA6 PA7 PBO PBl PB2 PBl 0 w ~ II: 0 a.. II: 0 u ~ en w I- ct g PB4 (I) (I) PB5 PB6 PB7 CBl CB2 ct all w Z II: 0 In (I) 0 Vcc --.. -...... -.-. --..-...-. ---.. - --~ -.-. ..- -- .. ..- --- .... - .. --- - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 MC6820 PIA (MCS6520) 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 ~ ct Q ct @ - -.. ----- -- .. -- .-.. .. ---- .."'"- .. .- -----.... -.. ----- CAl CA2 iROA IROB RSO RSl RESET 00 01 02 03 04 05 06 D7 E CSl CS2 CSO R/W Pin Name Description Type 00- 07 PAO - PA7 PBO - PB7 CSO. CSl. CS2 RSO. RSl CAl CA2 CBl CB2 E R/iii iR'QA. IROB Data Bus to CPU Port A peripheral Data Bus Port B peripheral Data Bus Chip Select Register Select Interrupt input to Port A Port A peripheral control Interrupt input to Port B Port B peripheral control Device synchronization Read/Write coritrol Interrupt request Reset Power and Ground Tristate. bidirectional Input or Output Tristate. Input or Output Input Input Input Input or .output Input Input or Output Input Input RESeT Vcc. Vss Output Input Figure 9-20. MC6820 PIA Signals and Pin Assignments There are two control signals associated with the MC6820 CPU interface. E is the standard synchronization signal generated by the various MC6870 series clock devices. The trailing edge of E pulses synchronizes all logic and timing within the MC6820. Manufacturer literature refers to E as a device enable signal. but it is more accurately viewed as a device synchronization signal. R/W is the standard RsadlWrite control signal output by the MC6800 CPU. When RIW is high. a Read operation is specified; that is. data transfer from the MC6820 PIA. to the MC6800 CPU occurs. When R/W is low. a Write operation is specified; that is. data transfer from the CPU to the PIA occurs. There are two interrupt request signals, IROA and IROB. Under program control you can specify the conditions under which an interrupt request can originate at logic associated with 1/0 Port A or 1/0 Port B. The actual interrupt request is transmitted to the MC6800 CPU via signallROA for 1/0 Port A logic. and via IROB for 1/0 Port B logic. Interrupt requests originating at either signal will connect to the MC6800 IRO input. . RESET is a standard Reset input. When it is input low. the contents of all MC6820·registers will be set to zero. 9-47 ffiQA38~~---------------------------------------i INTERRUPT STATUS CONTROL A 40 CAl 39 CA2 DO 33 01 32 0231 0330 04 OS D6 07 DATA BUS BUFFERS (DBB) 29 28 27 26 OUTPUT BUS BUS INPUT REGISTER (BIR) PAO PAl OUTPUT REGISTER A (ORA) 4 PA2 PA3 PM PA5 PA6 9 PA7 10 PBO OUTPUT REGISTER B (ORB) 11 12 13 14 PBl PB2 PB3 PB4 15 PB5 111 PB6 i7 PB7 INPUT BUS CSO 22 CS124 CSi 23 RSO 36 CHIP SELECT AND RS135 R/iN RJW21 ENABLE 25 RESET 34 CONTROL ffiIoB37------------------------------------------~ INTERRUPT STATUS CONTROL B 18 CBl 19 CB2 Figure 9-21. Functional Block Diagram for the MC6820 PIA MC6820 OPERATIONS As compared to the 8255 PPI. the MC6820 PIA has less formalized operating modes. The MC6820-to-externallogic interface consists of two I/O ports. each of which has two dedicated control lines. You have the option of assigning individual I/O port lines to input or output; as a completely separate operation you can use the two control lines to perform a limited amount of handshaking and interrupt processing - or you can ignore the control lines, in which case the I/O port is supporting simple input and/or output. Bidirectional I/O, equivalent to 8255 Mode 2, is not available. Figure 9-21 generally represents MC6820 functional organization and Table 9-4 summarizes the available operating modes. 9-48 Table 9-4. MC6820 Operating Modes OPERATING MODE c MC6800 AVAILABILITY Simple input without handshaking I/O Port A or B Simple output without handshaking I/O Port A or B Bidirectional I/O without handshaking Not available. but individual pins of either I/O port may be separately assigned to input or output Input with handshaking I/O Port'A only Output with handshaking I/O Port B only Bidirectional I/O with handshaking Not Available w ~ oa.. a: a: o(J 21: Iii w ~ g en en ~ 015 w Z a: oCD en o ~ ~ c ~ @ Table 9-5. Addressing MC6820 Internal Registers SELECT LINES ADDRESSED LOCATION RS1 RSO 0 1 0 0 0 0 1 1 X 7 f 0 0 5 4 2 3 1 o ...--Bit No. I I I I I IX I I J I/O Port A Control register 0 I/O Port A DataDirection register 1 I/O Port A Data buffer 7 1 1 6 6 5 4 3 2 1 o I I I I I IX I I t 0 1 ~BitNo. I/O Port B Control register J I/O Port B Data Direction register I/O Port B Data buffer There are six addressable locations within an MC6820 PIA; they are shaded in Figure 9-21. MC6820 Since there are only two register select lines. RSO and RS1. four unique addressable locations can REGISTERS be identified within the MC6820. Table 9-5 summarizes the manner in which the MC6820 uses ADDRESSING four addresses to access six locations. Logic defined in Table 9-5 requires that you first output a Control code to each I/O port Control register: next you access either the I/O port Data Direction register. or the I/O port Data Buffer. You use the same memory address to access an I/O port Data Direction register and I/O port Data Buffer. Which location you access is determined by bit 2 of the I/O port's Control register. 9-49 You must precede any 1/0 port Data Direction register. cjrData Buffer access with a Control code. written to the 1/0 port's Control register. Once you have written a Control code to an 1/0 port Control register: you do not have to write another ,Control, code for addressing purposes until you, wish to switch from accessing the 1/0 port Data Direction register to the Data Buffer. or from accessing the Data Buffer to the Data Direction register. . To illustrate MC6820 addressing. suppose the four addresses C00016. C00116.C00216 and C00316 select an MC6820. This is how addressable locations within the MC6820 would actually be selected if address line AO were connected to RSO and A 1 to RS1: Address Selected , C00016 ' 1/0 Port A Data Direction register. if C00116CF1. bit 2 = 0 1/0 Port A Data buffer. if C00116. bit 2 = 1 C00116 1/0 Port A Control register C00216 1/0 PortBData Direction register. if C00316. bit 2 = 0 1/0 Port B Data buffer. if C00316. bit ;2 = 1 C00316 1/0 Port B Control register If you read from an 1/0 port data buffer. you input from the 1/0 port to the CPU; if you write to anllO port data buffer. you output from the CPU to the 1/0 port. The Data Direction registers identify each pin of an 1/0 port as being dedicated to either input or output. These are write only registers. You must write a control word into each Data Direction register; a 0 in a bit position configures the corresponding 1/0 port'pin as an input. While a 1'results in an output: 654 o "'-BitNo. I/O Port Pins , Observe that 1/0 Ports A arid B will both be configured as 8-bit input ports when the MC6820 is reset. since RESET clears all internal registers. " '. , - 9-50 Control register interpretation is quite complex. The two high-order bits of each Control register are read only locations. which record the status of interrupt requests which may originate from either of two control lines associated with an I/O port: C w ~ 0: 0 D- o: u 0 ~ en ...ctw U 0 en en MC6820 CONTROL CODES Both interrupt requests are ~ I I I output via ,t 6 5 4 3 2 iRciA 0 -4-BitNo. I.--control Register A Status of interrupt requests originating at CA2 logic Status of interrupt requests originating at CA 1 logic ct all w Z 0: 0 III en 0 ~ ct ct c @ Both interrupt requests are J:: output via IROB ,t 6 I I I 5 4 3 0 ....--BitNo. ~ Control Register B Status of interrupt requests originating at CB2 logic Status of interrupt requests originating at CB 1 logic The remaining six control bits may be written into or read: they define the way in which the I/O port will operate. Figures 9-22 and 9-23 describe the Control register interpretation for I/O Ports A and B respectively: since the two Control register interpretations are very similar. the points of difference are shaded so that they are easy to spot. Let us clarify the functions enabled by the two Control registers. Each I/O port has its own interrupt request signal: IROA for I/O Port A and IROB for I/O Port B. Each interrupt request signal has two separate sets of request logic. based on an interrupt request originating with a CA 1/CB 1 signal transition. or a CA2/CB2 signal transition. . MC6820 INTERRUPT LOGIC Control register bit 0 enables or disables IROA/IROB. based on signal CA 1/CB 1 transitions only. Ouite independently. Control register bit 3 enables or disables IROA/IROB based on transitions of signal CA2/CB2. However. Control register bit 3 has an alternative interpretation: the one we have just described only applies if Control register bit 5 is O. Interrupt requests are triggered by the "active transitions" of a control signal. The active transitions of control signals may be a high-to-Iow. or a low-to-high transition: For CA1/CB1. the active transition is selected by Control register bit 1. For CA2/CB2. the active transition is selected by Control register bitA. but only if Control register bit 5 is O. Irrespective of whether interrupt request signals IROA and IROB have been enabled or disabled. Control register bits 6 and 7 will report the interrupt request as a status. that is to say. if a condition exists where CA 1ICB 1 makes an interrupt requesting active transition. then Control register bit 7 will be set to 1. Similarly. if control signal CA2/CB2 makes an interrupt requesting transition. then Control register bit 6 will be set to 1. Once set. Control register bits 6 and 7 will remain set until a Read operation addresses the Control register: at that time Control register bits 6 and 7 will both be reset to O. while other bits of the Control register are left unaltered. If Control register bit 5 is 1. then Control register bits 4 and 3 take on a second interpretation. If Control register bits 5 and 4 are both 1. then control signal CA2/CB2 will be output at all times with the level of control bit 3. 9-51 4 6 o 2 ......-BitNo. I/O Port A Control register .......- - - 0 Disable IRMl 1 Enable IRQA1 ' - - - - - - 0 Set bit 7 andIR%l(if enabled) on high-to-lowC~ltransition 1 Set bit 7 and IRQA 1 (if enabled) on low-to-high .CA 1.transition 1--_ _ _ _ _ _ 0 When RSO, RS1 =OO.select I/O PortA/Direction register 1 When RSO, RS1 =.00 select I/O Porth.Data buffer o Disable IRM2 i:~~iig2~~:;g::: } B;t 00 Selectinp~t interrupt handshaking } 01 Sele~tinputprogrammed handshaking 1X SetCA2to X 1--_ _ _ _ _ _ _ _ _ _ _ _ _ 5~ 0 Bit 5 = 1 Status oflRQA2 ' - - - - - - - - - - - - - - - - - Status of IRM 1 Figure 9-22. I/O Port A Control Register Interpretation 4 6 o 3 I I I I I I I I .~~ ~~ ~~ ~ ~ ~~ ~ .......-BitNo. t I/O Port B Control register ' - - - - - 0 DisablelROB t 1 Enable IROB1 ' - - - - - - - 0 Set bit 7 andl~()~l(if enabled) on high-to-low<::i3ltransition 1 Set bit 7 andlROB1 (if enabled) on low-to-highCBltransition ' - - - - - - - - 0 When RSO, RS1 =Cli select I/O Port~Direction register 1 When RSO, RS1 =.01 select I/O PortBData buffer !:~~~:tl~~~~~:g::: } ~ B" 5 _I--------1..~ 00 Selecto~t~~t. interrupt handshaking 1---4II...... 01 Sele.c. t . . . . o... ~.tpytProgrammed handshaking 1X SetC82 to X ' - - - - - - - - - - - - - - - Status oflROB2 Status oflRClB1 1--_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Figure 9-23. I/O Port'S Control Register Interpretation 9-52 ' } Bit 5 0 - = 1~ If Control register bits 5 and 4 are 1 and 0 respoctively, thon Control rogistor bit 3 specifies an automatic handshaking signal sequenco. Let us doscribo these signal sequences. MC6820 AUTOMATIC HANDSHAKING Input interrupt handshaking applies to I/O Port A only, and may be iIIustratod as follows: cw E IX: R/W ~ IX: o0.. o o ~ enw ----' DO - 02 ~ g CI) CI) CA2 oct 011 w Z CAl IX: o Active CD CI) CAl ~ Transition o oct C oct @ CA2 is output on the trailing edge of E. after the CPU has read the contents of the liD Port A data bllffer; this tells external logic that previously input data has been read and new data may now be input. External logic· receives CA2 low. and upon transmitting new data to liD Port A. must cause an active interrupt requesting transition of input control signal CA 1. What constitutes an active transition will be determined by liD Port A Control register bit 1. When external logic requests an interrupt via signal CA 1. CA2 will be set high again. Input programmed handshaking applies only to I/O Port A, and may be illustrated as follows: E cso·csl-CSi A/iN DO - 07 CA2 Once again control signal CA2 is output low when liD Port A data buffer contents are read by the CPU. This tells external logic that previously input data has been read and new data may be input. External logic does not have to identify newly transmitted data with an interrupt request; rather. CA2 will be resetas soon as the MC6820 is deselected. Using programmed handshaking. external logic may use the CA2 low pulseas a Write strobe. causing new data to be input to liD Port A. 9-53 Output interrupt handshaking applies only to 1/0 Port B, and may be illustrated as follows: R/W DO - 07 ~ eB2 eBl In this instance. control signal CB2 is outpUt Iowan the high-to-Iow transition of E following a Write to I/O Port A Data buffer. In other words. CB2 tells external logic that new data has been output to.I/O Port B and is ready to be read. Externallogic tells the MC6B20 that 110 Port B contents have been read by making an interrupt requesting active transition of the CB 1 signal. Once again. I/O Port B Control register bit 1 will determine what constitutes an active transition of the CB 1 signal. Program logic can use an interrupt to branch to a program which outputs the next byte of data to I/O Port B. Output programmed handshaking applies only to 1/0 Port B, and may be illustrated as follows: CSO ·cs 1-CS2 R/W DO - 07 eB2 CB2 makes a high-to-Iow transition when data is written into the I/O Port B data buffer. just as occurred with output interrupt handshaking. However. CB2 will automatically be set to 1 as soon as the MC6B20 is deselected. External logic can use the CB2 low pulse asa strobe. causing it to read the contents of I/O Port B. Many other handshaking protocols may be created under program control. The four automatic protocols described above are simply four situations which can be specified. and which will subsequently occur without further program intervention. But remember. you can modify the level of control signal CA2/CB2 any time by outputting a Control code with bits 5 and 4 both set to 1: CA2/CB2 will then take the level of Control code bit 3. You can also determine the conditions which will cause an interrupt request as a result of any control signal transition. 9-54 THE MC6850 ASYNCHRONOUS COMMUNICATIONS INTERFACE ADAPTER (ACIA) c w ~ a: oQ. a: o u The MC6800 microcomputer system provides separate devices supporting synchronous .and asynchronous serial I/O. The MC6850, which we are about to describe, provides asynchronous serial 110. The MC6852, which we will describe next. supports synchronous serial liD. Taken together; the MC6850 and MC6852 devices are approximately equivalent to the 8251 USART. The 8251 is a general purpose 8080 device that can be used with a variety of microcomputers. Refer to Volume 3 for a description of 8251' s. ~ Figure 9-24 illustrates that part of our general microcomputer system logic which is provided by the MC6850 and MC6852 devices. l- Having separate synchronous and asynchronous serial I/O devices has advantages and disadvantages, when compared to the 8251 USART which provides both sets of logic on a single device. In a microcomputer system that uses either asynchronous or synchronous serial liD, but not both, separate devices are better, because they come in smaller packages and require less space on a PC card. If your microcomputer system uses both synchronous and asynchronous serial liD, then a single device will be more economical. enw e( oo CI) CI) e( all w a: Z o III CI) o :!: e( ce( @ When comparing the MC6850 with tile 8251, you will find that the 8251 offers more asynchronous serial I/O options, but it is harder to program. In fact. you must program the 8251 defensively: 8251 statuses and control signals simply prompt your program logic, but actually do nothing within the 8251 USART itself. When using the MC6850 and MC685,2, that is not the case: these two devices are much easier to program. The MC6850 ACIA is packaged as a 24-pin DIP. It is fabricated using N-channel silicon gate technology. A single +5V power supply is required. In the discussion of the MC6850 that follows we will frequently refer to the 8251 USART description in Volume 3. If you are unfamiliar with asynchronous sl:trial I/O devices in general, see Chapter 5 of Volume 1, then read the description of the 8251 USART which is given in Volume 3. THE MC6850 ACIA PINS AND SIGNALS MC6850 ACIA pins and signals are illustrated in Figure 9-25. Signals may be divided into the following four categories: . 1) 2) 3) 4) CPU interface and control sign~is Serial inpLit Serial output Modem control We will first consider CPU interface and control signals. DO - 07 constitutes an 8-bit bidiroctional Data Bus connecting the MC6850 with the CPU. When data is output to the MC6850 by the CPU, either a byte of parallel data or a Control code will be transmitted. A byte of paraliel data will be serialized and transmitted according to the protocol which has been selected under program control. Either data or status may be input from the MC6850 ACIA to the CPU via the Data Bus. Data consists of an 8-bit parallel data unit extracted from the serial input data stream. Status consists of the contents of the ACIA Status register. The Status register of the MC6850 ACIA is very important. because the MC6850 uses status flags where the 8251 uses control signals to monitor serial data transfer logic. The MC6850 ACIA is accessed~the CPU as two memory locations. MC6850 select logic consists of the three chip select signals CSO, CS1 and CS2; manufacturers' literature also refers to the enable signal E as being part of the chip select logic; however, E is more accurately visualized as an internal synchronization signal. For the MC6850 ACIA to be selected, CSO and CS1 must be input high while CS2 is simultaneously input low. Once selected, the register select signal RS determines which of the two addressable locations within the MC6850 ACIA will be accessed. When RS is low, a Read will access the ACIA Status register, while a Write will access the ACIA Control register. When RS is high, ACIA data buffers will be addressed. While the MC6850 ACIA is selected, internal logic is synchronized on the trailing edge of the E signal. E is a standard output of the various MC6870 clock devices used to synchronize support logic throughout an MC6800 microcorylputer system. 9-55 Clock Logic ,.. ~ Arithmetic ~nd Logic Unit Accumulator Registerisl' Data Counterisl Stack Pointer Program Counter System Bus I/O Ports Interface Logic Interface Logic Programmable Timers Read Only Memory I/O Ports Figure 9-24. Logic of the MC6850 ACIA or MC6852 SSDA Devices RIW is the control input which determines whether a Read or Write operation is In Ilrogress. When Riw is high. the CPU is reading data out of the MC6850. When R/W is low. the CPU is writing data to the MC6850. The MC6850 has no RESET input; a Control code is used as a master Reset. When power is first detected within the MC6850. internal logic automatically initiates a Reset sequence. Subsequently. before initializing the MC6850 for serial data transfer you should again reset the device by inputting a Reset Control code. 9':'56 VS.S--~ RxD--"'~ RxCLK - -..... TxCLK - -..... c RTs~-~ w ~ a: o0. TxD ....~--t t---I rna .... a: CSO - -..... CS2-~~ o (J ~ CS1 - -....... iii RS ----!. . w ~ VDD g en en oCt o1J 2 3 4 5 6 7 8 9 10 11 12 D5 D4 D6 D7 E R/W Type DO - D7 Tristate, bidirectional Input Input Input Input Input Register Select R/W Read/Write control Transmit Oock Transmit Data Receive Oock C TxCLK TxD @ RxCLK RxD oCt 17 16 15 14 13 Description E ~ D3 Data Bus to CPU Chip Select Internal synchronization RS oCt 19 Pin Name en o DO D2 MC6850 ACIA CSO, CS1, CS2 ocg 0C5 D1 w a: Z CTS 24 23 22 Output Input Receive Data Clear To Send Request To Send CTS RTS 5a5 iRQ Data Carrier Detect Interrupt request VDD, Vss Power and Ground Input Input Output Input Output Figure 9-25. MC6850 ACIA Signals and Pin Assignments ""C6850 DATA TRANSFER AND CONTROL OPERATIONS There are a number of buffers through which data flows in and out of the MC6850 ACIA. These data flows may be illustrated as follows: I Parallel Data In Parallel Control Code Data Out Status Control/Status Address Data Address Buffer RA Buffer TA Register Register RB TB Serial data input Serial data output Control Register 9-57 Status Register Buffer names in the illustration above conform with terminology used for the 8251 in Volume 3; this will make it easier. for you to compare the two devices. Like the 8251. the MC6850 has double buffered serial input and output logic. As described for the 8251. while a data byte is being serialized and output from Buffer TB, you must simultaneously write the next data byte to Buffer TA. Also, while a serial data byte is being assembled in Buffer RB, you must read the previously assenibled data byte out of Buffer RA. Unlike the 8251. the MC6850 has a separate Control register. You can therefore write Control codes and read status at any time without fear of scrambling data waiting to be transmitted. . As compared to the 8251. the MC6850 has very elementary serial I/O logic. TxCLK is an externally provided clock signal which times the serial, asynchronous data . stream which is output via TxD. Similarly, RxCLK is an externally provided clock signal which times the serial, asynchronous data stream which is input via RxD. MC6850 SERIAL I/O DATA AND CONTROL SIGNALS There are no control signals accompanying serial I/O data; rather. a single interrupt request signal is shared by all transmit and receive conditions. You have to write an interrupt service routine which reads the contents of the MC6850 Status register. and thus determine which one of the many serial data transfer interrupt request conditioris has occurred. The fact that you must execute instructions to duplicate the logic which the 8251 provides with its TxRDY. RxRDY and TxE signals will certainly make an MC6800 microcomputer system less attractive in an application that makes hi3avy use of serial I/O. Conversely. the MC6800 system will appear more attractive in simple applications. since you have less interface circuitry to be concerned with. . Three modem control signals are provided: Clear To Send (CTS)' Request To Send (RTS), and Data Carrier Detect (DCD). CTS and RTS are identical to the signals with the same names described in Volume 1. Chapter 5 for the general case. and in Volume 3 for the 8251. RTS is output by the MC6850 under program control when the MC6850 is ready to transmit data. A full duplex line turns RTS around and sends it back as CTS; a half duplex line returns CTS after line turnaround has occurred. ,...---... MC6850 MODEM CONTROL SIGNALS The MC6850 has no bata Set Ready (DSR) signal; this is the signal which many serial I/O devices tra~~mit to modems or any external receiving logic when ready to commence with serial data communications. When using an MC6850. RTS must serve double duty. additionally substituting for DSR. Even though the MC6850 has only three of the normal four control signals, these signals work Hard within the MC6850. The DCD input must be low for serial transmit logic within the MC6850 to be enabled. This is true also of the equivalent 8251 DSR signal: however. if the DCD signal makes a low-to-high transition. the MC6850 will generate an interrupt request. thus effectively halting serial data output. A low-to-high DCD transition implies that the modem has. for sOr1)e reason. disconnected itself; any further data transfer will be lost. In the case of the 8251. if a modem disconnects itself and DSR goes high. this cOr;Jdition will be reflected in a Status register flag. but unless the CPU executes instructions to read the Status register and test for this condition. the 8251 will continue transmitting data - even though the receiving end is dead. The MC6850 uses CTS high to prevent the Status register from reporting a "Transmit Register Empty" condition. The MC6800 CPU determines when to send another byte of data to the MC6850 by testing the Status register. and looking for a "Transmit Register Empty" condition. If this condition never gets reported. no data will ever be uselessly transmitted. Contrast this with 8251 logic. where a misprogrammed 8251 can and will continue to transmit data after CTS has gone high. 9-58 · MC6850 ACIA CONTROL CODES AND STATUS FLAGS Let us now examine the way in which the MC6850 Control and Status registers are interpreted. Here is the Control register interpretation: 7 cw 6 4 3 o ----...... ~BitNo. Control register ~ o Il. a: a: o(J ~ enw I- ct U L..-_ _ _ 00 Isosynchronous,+l clock rate 01 -;-16 clock rate 10-:-64 clock rate 11 Master Reset 1 . . . - - - - - - - - - 0 0 0 7 bits, even parity, 2 stop bits o 001 7 bits, odd parity, 2 stop bits ct D!I 010 7 bits, even parity, 1 stop bit 011 7 bits, odd parity, 1 stop bit w 100 8 bits, no parity, 2 stop bits (I) (I) Z a: oa:I (I) o ~ ct c ct @ 101 8 bits, no parity, 1 stop bit 110 8 bits, even parity, 1 stop bit 111 8 bits, odd parity, 1 stop bit L-------------OO 01 10 11 RTS low, disable transmit interrupt logic FITS low, enable transmit interrupt logic RTS high,·disable transmit interrupt logic FiTS low, disable transmit interrupt logic, output break level ......--------------0 Disable receive interrupt logic 1 Enable receive interrupt logic The CPU neither sends nor receives the parity bit. The MC6850 adds the parity bit to transmitted data and strips or resets the parity bit in received data before it goes to the CPU. Control register bits 0 and 1 determine the data transfer clock rate. Recall that serial data is usually transmitted or received at 1116th or 1/64th of the clock rate, TxCLK or RxCLK. Transferring serial data at the exact clock rate is refer.. red 'to as isosynchronous data transfer. The master reset Control code substitutes for the normal reset input signal. which the MC6850 lacks. A master reset clears all MC6850 registers, with the exception of Status register bit 3, which is unaltered. MC6850 SYSTEM RESET Control register bits 2,3 and 4 identify data bit. stop bit and parity options. Compared to the 8251, MC6850 options are somewhat limited: five and six data bits are not provided and you cannot select 1.5 stop bits. Control register bits 5 and 6 are transmit logic control bits. Control register bit 7 is a receive logic control bit. Transmit logic consists of the RTS modem control and various transmit conditions that can cause an interrupt request. MC6850 SERIAL 1/0 CONTROL LOGIC Receive control logic consists of various receive conditions that can cause an interrupt request. Interrupt logic of the MC6850 is an integral part of status logic. Conditions that can result in an interrupt request are therefore summarized below along with a definition of Status register bits.'A "r is placed in those bit positions that can result in an interrupt request from transmit logic. An "R". is placed in those bit positions that can result in an interrupt request from receive logic. Status register bit pos!tions that have neither a "r nor an "R" identify conditions that do not result in interrupt requests. In those bit positions containing a "r or an "R", a 1 causes an interrupt request to occur. OCO (bit 3) is an exception: here it is the transition from 0 to 1 that causes an interrupt request. In each case, the interrupt request will only occur if interrupt logic has been enabled. If you look back at the Control register, you will see that transmit and receive interrupt logic can be enabled and disabled separately. Control register bits 5 and 6 determine whether transmit interrupt logic is enabled, while Control register bit 7 determines whether receive interrupt logic is enabled, Note that the condition of Status register bit 3 can also disable a TORE interrupt request. 9-59 When an interrupt request occurs. the requesting condition is clearedin various ways depending upon where the request originated. . ' '. . .. .' . . An RDRF or if a reset Control code is output. '. interrupt requ~st will be cleared if the CPU re~dsdata fro~ the .MC6850. , .. . ' A TORE interrupt request will be cleared by writing data to the MC6850 or by issuing a reset Control code. Interrupts requested by DCD or OVRN are cleared by reading the Status register after the error condition has occurred. and then reading the Data register. A Master Reset will also clear these interrupt requests. Let us now take a closer look at the Status register itself. This is how register bits are interpreted: Status register '-----RDRF. Receive Data register full '------TDRE. Transmit Data register empty L...-------DCD. Data Carrier Detect signal status L-----'---'---CTS. Clear To Sendsign&1 status .......- - - - - - - - - · F E . Framing Error .......- - - - - - - - - - - O V R N . Receiver overrun error L . . . - - - - - - - - - - - - - P E . Parity Error L - - - - - - - - - - - - - - - - I R Q . Interrupt request (1 in a bit' position represents "true" condition for bits 7. 6,. 5. 4;'1 and 0.1 Status register bit 0, Receive Data Register Full, goes to 1 when a byte of assembled data is transferred from Receive register RB to Receive register RA. Bit 0 is cleared as soon as the CPU reads the contents of Register RA. The DCD modem control signal. when high. forces Status register bit 0 to stay low so that the CpU 'will not attempt to read nonexistent data. . . ° Status register bit 1, Transmit Data Register Empty~ goes from to .1 as soon as data is transferred from .Register TA data' into RegisterTA. '. '. . to Register TB. This bit is reset to 0 as soon as the CPU writes another bit of Status register bit 2, Data Carrier Detect, is used by the MC6800 to determine the status of external logic communicating with the MC6850. When DCD makes a low-to-high transition. an interrupt request is generated and Status register bit 2 goes high. Bit 2 remains high until the Status register contents are read by the CPU after DCD has gone low again. A Reset will also set Status register bit 2 to O. If the CPU reads the Status register while DCD .is' high. then subsequently Status register bit 2 will track the DCD level; however. another interrupt will not be requested. It is the . actuallow-to-high transition of the DCD signal which causes an interrupt request. not a high level of Status register bit 2. . . . . . ' .. Status register bit 3, Clear To Send, tracks the CTS modem control input. MC6850 logic uses Status register bit 3 to inhibit serial data transfer when external receiving logic is not ready to receive the serial data. When CTS is high. Status register bit 1 will be' held low. A TORE interrupt request cannot occur. and program logic which :tests Status register bit 1 will not transmit another data byte to Register TA until it detects a 1 in Status register bit 1. Thus. for as long as'CTS is high. serial transmit logic will be inhibited. ' Status register bits'4, 5 and 6 report framing, overrun and parity errors, respectively. Recall that ~ framing error is reported when start 'and sto'p bits do not correctly frame a data character; a fra'ming error refers to the data byte currently waiting to be read out of RA. An overrun error is reported if the CPU does not read Register RA contents before a byte of data is transferred from Register RB to Register RA. A parity error is reported if parity has been:enabled by Control register bits 2. 3 and 4. but the wrong parity is detected, ' A framing or parity error is automatically reset as soon as the erroneous data is read out of Register RA. or is overwrit~n. ' An overrun error is cleared by reading data from the t'0C6850, 9-60 Status register bit 7, Interrupt Request, is 1 whenever there is an unacknowledged interrupt request pending at the MC6850 device. One method that an MC6800 will use to determine the source of an interrupt request is to read device Status registers. If the MC6850 has no other method of identifying itself to the CPU when requesting an interrupt. then the CPU determines whether the MC6850 was the requesting device by reading the contents of the MC6850 Status register and testing the condition of bit 7. c W ~ a: oQ. a: o CJ :!:: en 'W ~ g CI) CI) ct o!I w Z a: o In CI) o ~ THE MC6852 SYNCHRONOUS SERIAL DATA ADAPTER (SSDA) The MC6852 SSDA provides MC6800 microcomputer systems with synchronous serial I/O logic. The MC6852 SSDA may be looked upon as a companion device to the MC6850 ACIA which we have just described. Taken together, these two devices provide MC6800 microcomputer systems with total serial I/O capability. Figure 9-24 illustrates that 'part of our general microcomputer system logic which is provided by the MC6850 and MC6852 devices. The most striking difference between the MC6850 and the MC6852 is their respective capabilities. Whereas the MC6850 offers fewer asynchronous serial I/O options than the 8251 USART (described in Volume 3), the MC6852 offers significantly more synchronous serial I/O options. Moreover, the MC6852 provides additional serial I/O options without the penalty of defensive programming which is demanded by the 8251 USART ct' The MC6852 SSDA is packaged as a 24-pin DIP. It is fabricated using N-channel silicon gate technology. ct A single +5V power supply is required. C @ In the discussion of the MC6852 that follows, we will frequently refer to the 8251",U5ART description given in Volume 3. If you are unfamiliar with synchronous serial I/O devices in general, see Chapter 5 of Volume 1, then read the description of the'8251 USART which is given in Volume 3. MC6852 SSDA PINS AND SIGNALS MC6852 SSDA pins and signals are illustrated in Figure 9-26. Most of these signals are identical to those illustrated in Figure 9-25 for the MC6850, therefore we will only describe four signals which differ. The MC6852 has a master Reset input, which. when input low. logically resets the MC6852. We will define how a Reset occurs after describing the MC6852 controls and status flags affected by a Reset. The Data Carrier Detect (DCD) modem control inputperforms two functions. The normal function of DCD is to serve as a control signal transmitted by an external data carrier which is ready to transmit serial data to the MC6852 SSDA. Both the high-to-Iow and the low-to-high transitions of DCD have additional significance. The high-to-Iow signal transition can optionally be used as an external synchronization indicator. while a subsequent low-to-high transition is an error indicator. signaling an unexpected disconnect: RxCLK RxD Rising edge of RxCLK following falling edge of 0C0 can serve as external synchronization. marking the start of data bits incoming on RxD. An untimely low-to-high transition of DCD means the transmitter got disconnected unexpectedly. Using the high-to-Iow DCD pulse for external synchronization is a programmable option. The error condition reported if DCD makes an unexpected low-to-high transition is not a programmable option: it is a permanent part'of the MC6852 error detection logic. 9-61 Vss RxD RxCLK TxCLK SM/DTR TxD iiill TUF 'RESET CS RS VDD .. .-.. p - --- .. ...-. 1 2 3 4 5 6 7 8 9 10 11 12 MC6852 SSDA 24 23 22 21 20 19 18 17 16 15 14 13 --------.. -- ---.. a=s .. Dc5 ..... Dl D2 ..p .. .. p ..... p DO D3 D4 D5 D6 D7 E R/Vi Pin Name Description Type DO - D7 Data Bus to CPU Cs" Chip Select Internal synchronization Tristate. bidirectional Input Input' E Register Select Read1Write control Transmit Oock RS R/W TxCLK TxD RxCLK RxD iRQ Transmit Data Receive Oock Receive Data Master Reset Data Carrier Detect Clear To Send Sync Match/Data Terminal Ready Transmitter Underflow Interrupt request VDD. Vss Power and Ground REsET DcD ffi SM/DTR TUF Input Input Input Output Input Input Input Input Input Output Output Output Figure 9-26. MC6852 SSDA Signals and Pin Assignments Clear To Send (CTS) is the modem control signal which is normally input by external receiving logiC. indicating that the MC6852 may begin transmitting serial data. like DCD. the CTS high-to-Iow transition can be used to synchronize the beginning of data transmission: the low-to-high transition of CTS is an error indicator. Once again. using the highto-low CTS pulse to provide external transmit synchronization is a programmable option. However. an untimely low-tobi9..tJ transition of CTS is an error indicator only if internal synchronization is being used. Therefore. if the high-to-Iow CTS transition is active. then the low-to-high subsequent transition must be inactive: conversely. if the high-to-Iow CTS transition is inactive. then a subsequent low-to-high transition will be active. This is because the high-to-Iow transition. if active. means that external synchronization has been selected - in which case the disconnect error logic is inactive. Note that whereas the CTS signal low-to-high transition is only active during internal synchronization operations. the DCD low-to-high transition is active at all times, This means that external logic disconnecting itself during a serial transmit operation will only cause an error to be indicated if external synchronization has been selected. On the other hand, during a serial receive operation, if external logic disconnects itself, an error will be indicated whether internal or external synchronization has been selected. Since DCD and CTS can both be used for external synchronization. as we might expect. DTR also serves a double function. Under normal circumstances. DTR will be output low by the MC6852 when it is ready either to transmit. or to receive serial data. If the MC6852 has output DTR low before transmitting serial data. then the receiving data carrier will turn DTR around and send back a high-to-Iow DCD pulse as we illustrated. If you have selected external synchronization under program control. then you can additionally program DTR to output a single high pulse as soon as 9-62 synchronization has been detected. This may be illustrated as follows: XC6852 wants to Q Data carrier says it is XC6852 says it has detected ready to transmit data external synchronization SM/DTR w !ta: oD.. a: o o ~ enw RxCLK le:( (3 o RxD U) U) e:( c1:I Rising edge of RxCLK following falling edge of An untimely low-to-high transition of DCD Z a:' DCD can serve as extemal synchronization, mark- means the transmitter got disconnected unex- III ing the start of data bits incoming on RxD. pectedly. w o U) o ~ e:( Q e:( @ Because DTR also acts as a Sync Match acknowledge. it is referred to as SM/DTR. When the MC6852 transmits serial data, it transmits the least significant bit first. The MC6852 also expects to receive the least significant bit first when receiving serial data. MC6852 SERIALIZATION SEQUENCE Transmitter Underflow (TUF) is the fourth unique MC6852 signal. This signal is output when an underflow condition occurs during serial synchronous data transmission. Recall.that during serial synchronous data transmission. if serial transmit logic finds no data ready to be output. then in order to maintain synchronization. a break character or a Sync characterwill be output. A break character is a continuous high level. equivalent to FF16. A Sync character will have some predefined binary pattern. Providing you have programmed the MC6852 to output Sync characters when no valid data is ready for serial transmission. the MC6852 will precede each Sync character with a high TUF pulse. External receive logic can use a high TUF pu Ise as an indicator that the next received character is a Sync and can be discarded. MC6852 DATA TRANSFER AND CONTROL OPERATIONS Like the MC6850, the MC6852 SSDA is accessed via two memory addr~sses; however, these two memory addresses are shared by seven locations within the MC6852, which results in a complex set of data flows, as illustrated in Figure 9-27. These are the seven addressable locations of the MC6852: 1) 2) 3) 4) 5. 6. and 7) Data input - a read only location. Data output - a write only location. Status register - a read only location. Sync Code register - a write only location. Three Control registers - all are write only locations. Data input and data output are self-evident apart from being triple buffered - and we will discuss the implications of triple buffering shortly - there is nothing unusual about MC6852 data input or output. The Status register is absolutely standard. The three 8-bit Control registers provide the MC6852 with a substantial variety of control options. as compared to the MC6850. which was somewhat limited in this respect. The Sync Code register stores the 8-bit synchronization character code: this is the character which must appear at the beginning of any synchronous serial data stream and may also be transmitted when data is unavailable during a normal transmit sequence. 9-63 Status Out Write Data Control Code 1 Parallel Data In Higher Address Lower Address' Control Code 1 5 6 Status X X 4 3 2 0 Buffer RA II ... '-v- - J-~--------" XX=OO Byte Received Buffer RT Control Code 2 Byte Received -· ++ ·· XX~I~ ,+ Control Code 3 Buffer RB Sync Code Shift Register Byte to transmit _...:.._ _...z.._ Buffer TT Byte to transmit Buffer TB . Shift Register Figure 9-27. Data Flows Within an MC6852 SSDA 9-64 Serial Data Output Serial Data input cw !ia: o Of the seven addressable locations. two are read only. while five are write only. Each memory address can ac::cess two locations, providing one is exclusively read only, while the other is exclusively write only. Since there are just two read only locations. one is assigned to each memory address. Since there are five write only Idcations. one (Control Code 1) is assigned to the lower address. which leaves four assigned to the higher address; the two high-order bits of Control Code 1 are used to select one of the four write only locations assigned to the higher address. While this may look like a complex scheme. in reality it is not: all it means is that you have to observe a rigid programming sequence when using an MC6852. In fact. understanding the MC6852 depends completely on understanding the Control and Status registers; therefore we wiil describe these registers first. then look at data transfer sequences. a: MC6852 STATUS REGISTER u The MC6862 Status register may be illustrated as follows: D. o ~ en w !i g en en ct .a MC6852 Status register w Z a: o III en o :E ct c ct @ ' - - - - - RDA. Receive data available; read RA L - - - - - T D A . Transmit data register available; write to TA ' - - - - - - - - DC~. Data Carrier Detect signal status L-----....;.-.--CTS. Clear To Send signal status ' - - - - - - - - - - - T U F . Transmitter' 'Und~rflow error indicator L - - - - - - - - - - - O V R N . Overrun error indicator L -_ _ _ _ _ _ _ _ _ _ _ _ ' PE. Parity Error indicator L - - - - - - - - - - - - - - - I R Q . Interrupt request status (1 in a bit position represents "true" condition for bits 7, 6. 5, 4. 1 and 0.) Conditions that may generate interrupts are marked with letters In appropriate Status, register bit positions. An interrupt request initiated by an error condition is represented by the letter E. Interrupt requests originating at transmit . or receive logic are represented by the letters T and R. respectively. Status register bit 0 (RDA) indicates when the MC6862 Status register has a byte of data ready to be read. Similarly Status register bit 1 (TDA) indicates when the MC6862 is ready to receive another byte of data which will be output as a serial data stream. As indicated in Figure 9-27. MC6852 transmit and receive logic is triple buffered. This differs from the MC6850 which uses double buffering . MC6852 TRIPLE DATA BUFFERS . You Ccln use the triple buffering of the MC6862 in one of two ways which you select using appropriate Control register codes. You can select a single byte option, in which case as soon as a single byte of data can be written to Buffer TA or read from Buffer RA. the appropriate status flag will be set -and if interrupts are enabled. an interrupt request will be made to the CPU. The program controlling MC6852 operation must respond by reading or writing a single byte of data. A byte of data written to Buffer TA will automatically be rippled through Buffer TT to Buffer TB. whence it will output as a serial data stream. Data arriving at Buffer RB will be rippled through Buffer RT to Buffer RA. whence it must be read by the CPU. if you select the two byte option under program control, then no status flags will be set. nor will interrupt requests occur untiLtwo of the three 8-bit buffers are empty. Thus. status bit 0 will be set and a receive interrupt request will occur when Buffers RA and RT are both full. Under program control you must. at this time. read two bytes of data. So long as a Single pulse of the timing E signal separates the two read commands. MC6852 logic will transfer Buffer RT contents to Buffer RA so that the second read accesses what had been in Buffer RT. In fact. you should read RA contents. then status. then RA contents again. If there are errors associated with the data byte in RT. they will not be reported until RT contents have been transferred to RA. 9-65 · . When using the tWo byte option with transmit logic, Status register bit 1 will not be set and the appropriate interrupt request will not occur until Buffers TA and TT-are both empty. At this time the executing program must write two bytes of data to the higher MC6852 address, while Control code 1, bits 7 and 6 are both 1. The first byte of data written to the higher MC6852 addr'e.ss will store dat~ in BufferTf.. The next pulse of the E clock will transfer the content§ df BufferTA to Buffer TT. The second write will again load Buffer TA whose previous contents are now in Buffer TT, Status register bits 2 an~ 3 are associ&t,ed with signals DCDand CTS, respectively. If DCD or CTS makes a low-tohigh transition, then Its corresponding Status register bit will iatch high - that is, it will maintain a level of 1 until it is reset by the CPU. Once bit ,2 (or 3) has. been reset. it will track DCD (or CTS) until the ne'xt low-to-high transition. Note that in Sync mode; if Status register bit 3 is 1, then Status register bit 1 will be held at MC6852 suppresses subsequent transmit iogic. 0; this is how the Status register bits 4, 5 and 6 indicate Underflow, Overrun or Parity errors, respectively. An Underflow error occurs when transmit logiC; does not have a byte of data ready to transmit and has to insert a Sync character. The Underflow error is reported just before the SyhC character is transmitted. When Status register bit 4 is set. the TUF signal is simultaneously pulsed;high. An Overrun error occurs when a byte of data is written into BuffEd' RA before prior buffer contents have been read. An Overrun error therefore indicates that a single byte of data has been lost. A Parity error indicates that a Parity option has been selected, but the wrohg Parity was detected for the data byte currently in Buffer RA. These three error conditions are completely standard;'however, the way they are handled within the MC6852 is not standard. When anyone of these error conditions occurs, the appropriate Status register bit will be set and simultaneously an interrupt request will be generated, providing you have ehabled these three error interrupts. An error status is not cleared automatically. To clear Status register bits 4,5 or 6, you have to read Status register contents, then issue an appropriate Control code to reset the selected bit. We can summarize the fUnctions performedtlY MC6852 Status register bits by looking at the manner in which each bit is set or reset; then we can separately examine the way in which interrupt logic is assbciated with each status bit position. Table 9-6 summarizes the conditions which cause each bit to be set and then reset. Table 9-7 summarizes interrupt requests associated with each status bit, indicating the way the interrupt is enabled or disabled and the way in which an interrupt request occurs. You wili find Table 9-7 following the three Control registers' description, because interruptlogic is equally dependent upon the Status register's contents and the three Control registers' contents. THE MC6852 CONTROL REGISTERS Now 'consider the three MC6852 Control registers. . , Control register 1 is normally the first to be ~ccessedand h'as to be written into in cirder to select any other write only MC6852 location, Control register 1 format may be illustrated as fdllows: 6 4 3 2 o +-=-Bit No. r-~~~--~~~~~ MC6852 Contr~1 Register 1 '-----RxRS. Reset and inhibit receive logic L..------TxRS. Reset and inhibit transmit logic '--------STSYNC. Strip SYNC characters when detected I...---------CLSYNC. Inhibit all SYNC character logic " - - - - - - - - - - - T I E . Enable transmit data interrupts ' - - - - - - - - - - - - - R I E . Enable receive data interrupts 00 Select Control Code 2 01 Select contr,ol Code 3 10 Select Sync Code 11 Select Transmit Buffer TA (1 in a bit position represents "true" condition for bits 5, 4, 3, 2, 1 and 0.) 9-66' } High address write . select Control register 1, bits 0 and 1 reset and inhibit receive and transmit logic, respectively. You use these two Control reg!ster bits in order to disable transmit and receive logic while modifying the contents of any Control register or the Sync register.. o w ~ oQ. a: a: o u ~ iii Control register 1, bits 0 and 1 are very impc;»rtant. It is easy to miss the significance of these two control bits. If you alw<;lYs inhibit transmit and receive logic before modifying the contents of Control or Sync register? you can make sure that spurious data is n'e)!er transmitted or received. The 8251 USART described in Volume 3. does flOt have any inhibit logic of this type; and as resl:llt. you have to adopt elaborate precautions to avoid data transmission errors. a While transmit and receive logic is inhibited. Status register bits 2 and 3 will still track the DCD and CTS signals; however. no gat~ transfers will occur and interrupts associated with the inhibited logic will be disabled. Using Control register 1. bits a and 1 to inhibit transmit and/or receive logic also affects Status register bits and inter-. ; rupt requests. as summarized in Tables 9-6 and 9-7. w Table 9-6. MC6852 Status Register Bit Set/Reset Conditions le:( g (I) (I) '" e:( all w RDA - B!t 0 Z 1) (I) o ~ TDA- Bit 1 e:( o RESET If Control register 2 bit 2 is 1. when Buffer RA is full. if Control register 2 bit 2 is O. when Buffers RA and RT are full. 1) 2) Write 1 in Control regis~er 1 bit O. Read Buffer RA contents. 1) It' Contr.ol register ~ ~it 2 is 1 when Buffer T A is empty. " 1) 2) If Control register 2 bit 2 is 0 when BHtfer:;; TA and TT are empty. 1 occurs in Status register bit 5. together with 0 in Control register 3 bit O. Write 1 in Control register 1 bit 1. Write into Buffer TA. 2) a: oCD .. SET &TATUS 2) 3) e:( A low-ta-high DCD input transition when Control register 1 bit 0 is O. @ 'Dc5 - Bit 2 1) 2) A low-to-high CTS input transition when Control regi~ter 1 bit 1 is O. CTS - Bit 3 1) 2) Head~tatus register. then read Buffer RA. Status will subsequently go low when DcDinput goes low. Write 1 into Control register 1 bit O. Status will subsequently go low when i5CD input goes low. Write 1 to Control register 3 bit 2. Status will subsequently go low when CTs input goes low. Write 1 into Control register bit 1. Status will subsequently go low when ffi input goes low. TUF - Bit 4 Underflow when Control register 3 bit 0 is 0 'and Control register 2 bit 6 is 1. 1) 2) Buffer RT contents is transferred to Buffer RA before Bu~fer RA contents is read by CPU. 1) OVRN - Bit 5 Read'Status register. then read Buffer RA. 2) Write 1 imo Control register 1 bit PE- Bit 6 Parity error for data in RA'. providing Control register 2 bits 3. 4 and 5 identify a parity option. 1) 2) Read data out of Buffer RA. Write'1 into Control register 1 bit O. IR,Q- Bit 7 Any interrupt request occurs. No active interrupt requests exist. 9-67 Write 1 into Control register 3 bit 3. Write 1 into Control register 1 bit 1. O. Table 9-7. MC6852 Interrupt Summary INT~RRUPT RDA - TDA - REQUEST ENABLE Read Buffer RA or Buffers RA and RT contents Control register 1 bits 0 and 5 must be o and 1 respectively Write into Control' register 1 bits 1 and 4 must be o and 1 respectively. Buffer TA or flA and IT " DCD :- Transmitting data carrier' disconnected Status register bit 0 = 1 " Status register bit 1 = 1. This will not occur if Status register i?it 3 . .Control register 2 bit 7 must be .1 = 1. On low-to-high transi1ion of PCD . CTS - Receiving external logic disconnected Control register 2 bit 7 must be 1. On low-to-high transition of CTS. TUF - Transmit underflow has occurred Control register 2 bit 7 must be 1. Status register bit 4 = 1. Control register 2 bit 7 must be 1. St!ltus register bit 5 = 1. Control register 2 bit 7 must be 1 . Status register bit 6 = 1. OVRN - ~E - Receive overrun error has occurred Parity Error : Control register 1, bit 5 allows you to enable or disable receive data interrupt logic. Control register 1, bit 4 allows you to enable or disable tran~mit data interrupt logic. There is no connection between Control register 1. bits a and 1. and Control register 1. bits 4 and 5. Obviously. if transmit or receive logic has been inhibited. then it makes no difference whether interrupt logic has been enabled or disabled; in either case an interrupt cannot occur. However. if transmit or receive logic is enabled. then interrupt logic may be separately enabled or disabled. . . Control register 1, bits 2 and 3 deter"1i(1e the way the Sync character will be handled. If Control register 1 bit 2 is high. thEln all Sync characters in a serial receive data stream will be stripped. so that only non-Sync characters are read by the CPU. If Control register 1.. bit 2 is low. then the entire data stream will be transmitted to the CPU. including data and ~ync characters. Note that the initial Sync character is always stripped: Control register 1, bit ~ allows you to completely inhibit all Sync character logic. Now the Sync character will be cleared. and the MC6852 must use external synchronization. Control register bits 6 and 7 determine which write only location will be accessed when the CPU writes to the ~~gh'er memory location of the MC68~2 .. 9-68 Now consider Control registers 2 an'd 3, which are best looked upon as a single 12-bit control unit. These two Control. registers may be illustrated as follows: --·-7 6 5 4 3 2 0 ~BitNo. MC6852 Control Register 2 ' Q w ~ < a: 0 a. 00 Output continuous high at SM/DTR 0 01 Output a high pulse at SM/DTR upon detecting a Sync match 10 Output continuous low at SM/DTR 11 Ou~put a continuous low at SM/DTR and inhibit Sync match", a: 0 ~ enw o Read/Write data two bytes at a time ~ < 1 Read/Write data one byte at a time (3 0 000 001 010 . 011 II) II) < ol:J w Z a: Select Select Select Select 6 6 7 8 data data data data bits bits bits bits plus even parity plus odd parity and no parity and no parity, 100 Select 7 data bits and even parity 101' Select 7 data bits and odd parity 110 Select 8 data bits an'd even parity 0 In II) 0 ~ 111 Select 8 data bits and odd parity Q o Transmit break code (all < < @ 1 bits) on underflow 1 Transmit Sync character on underflow o Inhibit all error interrupt requests 1'1. 1 Enable all error interrupt requests j( 7 6 4 3 2 0 .-BitNo; MC6852 Control Register 3 o Select internal Sync mode 1 Select external Sync mode o Select two Sync characters 1 Select one Sync character 1 Clear CTS interrupt request 1 Clear transmitter underflow interrupt request Unassigned Control register 2, bits 0 and 1, and.Control register 3, bits 0, 1, 2 and 3 are used to define synchronization logic. Control register 3 .•bit 0 is used to determine whether internal or external synchronization will be employed. If internal synchronization is selected. then Control register 3. bit 1 determines whether one or two Sync characters must precede a serial data stream for initial synchronization to occur. Control register 2. bits 0 and 1 must now be set so that SM/DTR logic conforms to the synchronization options selected by Control register 3. bits 0 and 1. You also use Control register 2. bits 0 and 1 to select the signal level that will be output for a standard DTR modem control. Control register 2, bits 2,- 3, 4, 5 and 6 define the data transfer options. Recall that when the CPU reads received data. or writes data to be transmitted. data may be read and written one byte at a time. or two bytes at a time. We discussed this option when describing Status register bits 0 and 1. You select the one byte or two byte mode via Control register 2, bit 2. Control register 2, bits 3, 4 and 5 allow you to define the number of data bits per word, and parity options. These are standard selections which have been described in detail in Volume 1. Chapter 5. Notice that the MC6852 provides a much wider variety of data and parity options than the MC6850. 9-69 Sontrol register 2. bit 6 determines the response of MC6852 transmit logic when no data is ready to be transmitted. If Control register 2. bit 6 is O. then a break code will be output on underflow; if this bit is 1. then a Sync character code will be output on underflow. Remember. an Underflow error will be reported in the Status register only if you transmit Sync character codes on Underflow. Therefore. Control register 2. bit 6 must be 1 if Underflow errors are to be reported in the Status register. Recall that an underflow error is reported before a Sync character is transmitted; also. the underflow error status is accompanied by a high TUF output signal pulse. MC6852 Along with Control register 1, bits 4 and 5, which we have already described, Control INTERRUPT register 2, bit 7 and Control register 3, bits 2 and 3 apply to MC6852 interrupt logic. lOGIC MC6852 interrupt logic is quite complex. There are a number of interrupt sources and no standard procedure for enabling. disabling. acknowledging or processing different in'terrupt requests. Rather than describing the Control register bits that pertain to interrupts. therefore. various interrupt options provided by the MC6852 are summarized in Table '9-7. PROGRAMMING THE MC6852 let us now look at the normal sequence of events when programming the MC6852. First the MC6852 must be initialized. Initialization begins by resetting the MC6852 using the RESET control input. When the MC6852 is reset this is what happens: 1) 2) 3) 4) 5) MC6852 Control Register 1. bits 0 and 1 are set to 1. inhibiting transmit and receive logic. RESET Control register 2. bits 0 and 1 are reset to O. causing SM/OTR to be output high. OPERATION Control register 2. bit 7 is reset to O. disabling OCO andCTS interrupt requests. and all error interrupt requests. Control register 3. bit 0 is reset to O. selecting internal synchronous mode. Status register bit 1 is cleared and held low so that the CPU never reads a status that requests data be written to the MC6852. Control register bits affected by the RESET control input cannot be modified until RESET goes high again. Following device Reset. you must load Control registers 1. 2 and 3 and the Sync Code register. The only caution concerns Control register 1; remember. Control register 1. bits 6 and 7 must be modified so that you can access Control registers 2 and 3 and the Sync Code register. When modifying Control register bits 6 and 7. be sure not to inadvertently modify the remaining six bits of Control register 1. Once the MC6852 has been initialized, you are ready to start transmitting or receiving data. The only complications associated with transmitting or receiving data involve the way in which you select the programmable options of this device. There is nothing intrinSically different or complicated about the MC6852. as compared to any other synchronous serial I/O device. These are the only rules to observe: 1) 2) 3) Always inhibit transmit and receive logic via Control register 1. bits 0 and 1 before modifying the contents of any Control register or the Sync register. Unless you have enabled error interrupts. always precede any data read or write operation by reading the contents of the Status register and checking for errors .. Remember, the MC6852 transmits serial data least significant bit first. This is the inverse of IBM format; and it is up to you to invert the data stream when usinga~ MC6852 with external IBM protocol logic. 9-70 Clock Logic Q ILl ... Accumulator Register(s) Arithmetic and Logic Unit c( a: 0 Q. a: 0 0 ~ Data Counter(s) enILl ... g c( Stack Pointer CI) CI) c( oil ILl Z a: Program Counter 0 Direct Memory Access Control 10 CI) 0 ~ c( Q c( @ Interface Logic Interface Logic Programmable Timers Read Only Memory I/O Ports Interface Logic I/O Ports Figure 9-28. Logic of the MC6828 Priority Interrupt Controller THE MCS607 (OR MC6S2S) PRIORITY INTERRUPT CONTROLLER (PIC) This Priority Interrupt Controller ha.s two part numbers, identifying the fact that it is a bipolar part, and also compatible with the NMOS family of the MC6800 microcomputer devices. We will use the part identification MC6828 in the discussion that follows. The MC6828 Priority Interrupt Controller processes up to eight external interrupt requests, creating a vectored response to an interrupt acknowledge. Interrupt priorities are determined by pin connections, but under program control you can set a priority I.evel below which all interrupts are inhibited. Figure 9-28 illustrates that part of our general microcomputer system logic which is provided by the MC6828 PIC. 9-71 The MC6828 PIC canriot be compared to the 8259 PICU which is available with 8080A microcomputer systems. The briefest inspection of the two devices will indicate that the 8259 offers a significantly wider range of options - which can be a good thing or a bad thing. As we have often stated. an excessive dependence on interrupt processing in microcomputer .applications is hard to justify; in all probability the more limited capabilities of the MC6828 will adequately serve the needs of any reasonable microcomputer application. The MC6828 is packaged as a 24-pin DIP. It is fabricated using bipolar LSI technology. A single +5V power supply is required. Me6828 PINS AND SIGNALS MC6828 pins and signals are illustrated in Figure 9-29. In order to understand this device, you must first look at the 'way in which it is used within an MC6800 microcomputer system. .. . CS1 STRETCH cso iNa iN1 iN2 iN3 iN4 INS ---..-.---- iNS iN7 GND Pin Name 1 2 3 4 5 6 7 MC8507 MC6828 PIC 8 9 10 11 12 VCC 24 23 22 21 20 19 18 17 16 15 14 13 - .. -.. -.--. -.-. iRci Z4 Z3 Z2 Zl E R/w ----- A1 A2 A3 A4 Type Description A1 - A4 Zl - Z4 Input Output Input Input Input Input Output Output Termination of system Address Bus lines A 1-A4 Continuation of system Address bus lines A 1-A4 External interrupt requests Device Select Read/Write control Device Enable . Clock stretching signal Interrupt request Power and Ground iNa-iN] CSo. CS1 R/W E STRETCH iFffi VCC.GND Figure 9-29. MC6828 Signals and Pin Assignments Recall that when any standard external interrupt is acknowledged by an MC6800 CPU. the CPU will fetch the starting address for the interrupt service routine from memory locations FFF816 and FFF916. These two addresses may be illustrated as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 o 2 o 0 '-BitNo. I I X t .... - -~-Address .. 0 for FFF8 1 for FFF9 9-72 The MC6828 PIC is positioned serially, preceding the external memory device which is to be selected by the addressesFFF816 and FFF916' Address lI.nesA1, A2, A3 and A4 terminate at the MC6828. Logic within the MC6828 appropriately manipulates these four address lines and outputs some value which may differ from the input value. This may be illustrated as follows: Q w !( a: 0 0.. a: 0 (,) ~ en w !( g CI) CI) < alJ w Z a: 0 m CI) 0 :! < Q < @ Address transmitted by CPU A15 A14 A13 A12 All Ala AS A8 A7 A6 A5 A4 A3 A2 . Al AO Address received by memory ----------------------------------------~ 1 a a X 1 . Y} Y Y Y X· Address lines modified by. MC6828 -- ..... ~ MC6828 '--- Thus. what the MC6828 does is extend the two addresses FFF816 and FFF916 into 16 addresses. FFE816 through FFF716· . The CPU knows nothing about the address manipulation which istaking place within the MC6828. So far as the CPU is concerned. upon acknowledging an external interrupt. it reads two bytes of data from memory locations FFF816 and FFF916: the fact that there are eight possible responses to these two addresses is of no concern to the CPU. . Conceptually. the MC6828 is acting as an 8-way switch. The CPU addresses the switch by its "stem". via a single address. The actual conduit for the transfer of two bytes of data depends on the switch position at the time the CPU accesses the switch stem: and the switch position is going to be determined by the highest priority active interrupt request. This may be illustrated as follows: - FFF8. FFF9 - IN7:- . IN6 ::: IN5 ,.. iN4~ im~ iNi-= . iNi: N _ TNO"'- FFF6. FFF7 FFF4. FFF5 FFF2. FFF3 FFFO. FFFl FFEE. FFEF FFEC. FFED FFEA. FFEB FFEB. FFE9 Let us now look at the device pins and signals. A 1 - A4 represents the termination of System Address Bus lines A 1 - A4 at the MC6828. The continuation of the four address lines is via pins Z1 - Z4. The eight external interrupt requests are connected to INO - IN7. Interrupt priorities are in ascending level, from INO which has lowest priority through IN7 which has highest priority. Device select logic consists of CSO and CS1. For this device to be selected. csa must be low while CS1 is high. There are additional select requirements that depend on the operation being performed. as we will describe shortly. 9-73 RIW is the read/write control output by.the MC6800 CPU. E is the standard enable signal required by all support devices of an MC6800 microcomputer system. You can extend the response time available to the MC6828 by extending the E input. A STRETCH output is created and can be connected directly to the clock device of the microcomputer system in order to provide as much response time as needed by the MC6828. The actual interrupt request which generates the entire response process occurs via the IRO output from the MC6828. This output will normally be connected to the MC6800 IRO input. THE INTERRUPT ACKNOWLEDGE PROCESS When anyone of the eight interrupt request lines INO -IN7 is low, an interrupt request is generated via IRQ. This interrupt request is passed on to the M,C6800 CPU. As is normal. the MC6800. upon acknowledging the interrupt request. will perform two read operations; during these read operations the contents of memory locations FFF816 and FFF916 are read. The MC6800 CPU interprets the contents of these two memory locations as a 16-bit address. identifying the beginning of the interrupt service routine which is to be executed following the acknowledge. When the MC6800 CPU is reading the contents of memory locations FFF816 and FFF916, these are the signal levels for the control and select inputs to the MC6828: R/W 1 CSO o CS1 A4 A3 1 1 1 A2 A1 o o The MC6828 interprets the signal combination RIW·CSO·CS1·A1.A2.A3·A4, as a special select, causing it to output binary data on the Z1, Z2, Z3 and Z4 pins representing the highest priority active interrupt request occu rring on any of the interrupt request pins INO -IN7. Table 9-8 defines the binary data output corresponding to each interru pt level. If RIW is high, CSO is low and CS1 is high, but A 1, A2, A3, A4 are not 0011, then the MC6828 will simply output, via Z1 - Z4, whatever is being input via A 1 - A4. Also, when the MC6828 is not selected, A 1 - A4 is simply output via Z1 - Z4, whatever values are input via A 1 - A4: that is to say, 0011 input to A1- A4 will be output via Z1 - Z4 if the MC6828 is not selected. Thus. the presence of the MC6828 on the A 1 - A4 address lines of the Address Bus will be transparent until either the address FFF816 or the address FFF916 appears on the Address Bus. In order to guarantee that the MC6828 remains synchronized with the rest of the MC6800 microcomputer system. logic internal to the MC6828 uses the E synchronization signal as part of internal enable logic. The way in which the E synchronization signal is used is of no particular concern to you. as an MC6828 user. Providing the E synchronization Signal which drives the rest of the MC6800 microcomputer system also drives the MC6828. problems will not arise. Table 9-8. MC6828 Address Vectors Created for Eight Priority Interrupt Requests PRIORITY PIN Z4 Z3 Z2 Z1 Highest 7 6 5 4 3 2 1 Lowest 0 IN7 IN6 IN5 IN4 IN3 IN2 1 1 1 1 0 0 0 O· 0 0 0 0 1 l' 1 1 1 1 1 0 1 0 1 0 1 0 TNT INO 0 0 1 1 0 0 9-74 EFFECTIVE ADDRESSES FFF6 FFF4 FFF2 FFFO FFEE FFEC FFEA FFE8 and and and and and and and and FFF7 FFF5 FFF3 FFF1 FFEF FFED FFEB FFE9 INTERRUPT PRIORITIES Q w ~ a: oIl.. a: o CJ ~ enw ~ (3 o(I) (I) ct all w Z Table 9-8 defines the priorities that will be applied to simultaneous interrupt requests occurring at pins INO IN7. This table also indicates ~he exact memory addresses which will be created by the MC6828 in response to each of the interrupt requests. In order to use the MC6828 PIC in an MC6800 microcomputer system. 16 bytes of PROM or ROM. selected by the addresses given in Table 9-8 must be connected to the MC6828. Within these 16 bytes of'PROM or ROM. you must store the starting addresses for the eight interrupt service routines which are going to be executed following acknowledgement of each possible external interrupt request. For example. suppose that interrupt req'uests arriving at the IN5 pin of the MC6828 must be serviced by an interrupt service routine whose first executable instructi"on i~ stored in memory location 2E0016. The value 2E0016 must then be stored if! the two PROM or ROM bytE!s select~d by memory addresses FFF216 and FFF316, Remember. the high-order byte of an address is always stored at the lower address. Thus 2E16 will be storeg in memory location FFF216 while 0016 is stored in memory location FFF31~· . In simple configurations the 16 bytes of PROM or ROM selected by the MC6828 will be part of the MC6800 address space; the MC6828 simply sits on the Address Bus. Logic may be illustrated as follows: A1S AS A4 a: o CD (I) o ~ ct Q ct Al AO VMA R/W <1>2 (E) I~Q @ · ..·-.. ··· - ··· ··· = :. A4 Al ~ - =. - ... 'U' ,-. CSO . ... . .. --- INO IN7 ··· . Z4 ~ Zl ~ IRQ Al A4 MC6828 CSl <1>2 (E) R/W .+..... ~ Chip select logic generates CSO as the NAND of address lines A5 through A 15; thus. the MC6828 will be selected only when these address lines are all high. VMA is used to generate select line CS 1. Since VMA is high only while a valid memory address is being output. valid select logic is completed. Address lines A4 through A 1 physically terminate at the MC6828. which re-generates them via the Z4 through Z1 outputs. Z4 through Z1 will exactly reflect A4 through A 1. unless the MC6828 is selected and A4 through A 1 is 1100. Thus. the presence of the MC6828 will add a slight propagation delay on the Address Bus. but otherwise it will have no effect on addresses being transmitted until FFF816 or FFF916 appear. 9-75 It is also possible to move the MC6828 PIC out of the main Address Bus path, in which case its 16 bytes of PROM or ROM 'are 60t within the main microcomputer address space. This scheme may be illustrated as follows: A15 A5 A4 A3 A2 A1 AO VMA R/W <1>2 (E) IRQ ·· .- ··· .. MC6800 SYSTEM BUS : .:.= .. -.., -.. L,. CSO .- A1 Z1 '- A2 Z4 .. .- --..- ..-.. · :... · ..... ROM ENABLE AO A1 A4 SEPARATE ROM ENABLE AND ADDRESS LOGIC A3 MC6828 A4 CS1 <1>2 (E) Riw IRQ . +...... ~ INO~----------------------------~ IN7~'----------------------------------~ In the ah6ve'scheme it is only necessary that memory addresses FFF816 and FFF16 be reserved for the MC6828 PIC: This is be~aus.e A4, A3, A2 and A1 contribute to CSO logic; they must be 1100 for CSO to be low. CS 1 is generated ,by thehigh'VMA'pulse, Address Bus lines A 1, A2, A3 and A4 now branch to form a new five-line Address Bus -AO with, Z1 thro~gh;Z4. This five-line Address Bus is input to a separate ROM or PROM which is enabled by the same logic'that' enabIJS"the'MC6828. ' If you move the MC6828 PIC out of the main Address Bus. then you can have more than one MC6828 device'within a single MC6800 microcomputer system. Each MC6828 device must have its own 32 byte$ of PROM or ROM. and device priority must be established by conditioning lower priority MC6828 select logic with higher priority interrupt request logic. This may be illustrated as follows: :' A15 0 w I- ct a: 0 Q., a: 0 u ~ enw I- ct A5 M A3 A2 Al AD VMA IRQ .. ..-.. ··· -.. :. 00' U 0 (/) (/) ~ a: 0 a:I (/) "r 'r$ ct w Z ...t, un A '.:---... ~- -- 0 ::! ct 0 ct @ -:-;, ::: -.. t:1) -- .- If CSO } Highest priority CSl MC6828 iRQ CSO} Second highest fS 1 priority MC6828 IRQ ~ " Anyone interrupt request being true at a higher priority MC6828 PIC will suppress the high VMA pulse and automatically prevent a lower priority MC6828 PIC from being selected. INTERRUPT INHIBIT LOGIC The Mf:6828 provides a very elementary level of interrupt inhibit logic. You can output a mask to the MC6828 identifying a priority level below which all interrupts will be inhibited. Now the mask is written out to the MC6828 in a very unusual way. Recall that the MC6828 requires memory addresses FFE816 through FFF916 to access PROM or ROM. Any attempt to write into these memory addresses will be ignored. The MC6828 takes advantage of this fact by trapping attempts to write into memory locations FFE816 through FFF916. That is to say. when R/W is low while CSO is low and CS 1, IS high. the MC6828 considers itself selected. but it interprets the four address lines A 1. A2. A3. A4 as data. defining the mask level below which interrupts will be inhibited, Table 9-9 defines the way in which the mask specified by address lines' A 1, A2, A3 and A4 will be interpreted. ', ' , 9-77 Table 9-9. MC6828 Interrupt Masks - Their Creation and Interpretation Which will inhibit all interrupts. including and below: and Address Bus lines A 1-A4 will have this value: Write anything to this address: FFEO or FFE1 FFE2 or FFE3 FFE4 or FFE5 FFE6 or FFE7 FFE8 or FFE9 FFEA or FFEB FFE<:; of FFED FFEE or FFEF FFFO through· FFFF 0000 0001 0010 0011 0100 0101 0110 0111 1000 through 1111 All interrupts enabled IN1 IN2 IN3 IN4 IN5 IN6 IN7 All interrupts disabled THE MC6840 PROGRAMMABLE COUNTER/TIMER This is a programmable device which contains three sets of counter/timer logic. Each set of counter/timer logic can be programmed independently to perform a vari9ty of time interval, pulse width measurement and signal generation operations. The MC6840 programmabie counter/timer is described in this chapter rather than in Volume 3 because, like other 6800 support devi~es, it requires the enable clock signal as an input.. The MC6840 is somewha.t more versatile than the 8253 programmable counter/timer, which was first developed as an Intel 8080 support"aevice; the 8253 counterltimer is described in Volume 3. Within an MC6800 or MCS6500 microcomputer system. the 8253 is probably preferable to the MC6840; this is because capabilities of the MC6840 are not sufficiently superior to the 8253 to compensate for the enable clock signal and its attendant synchronization problems . The MC6840 is fabricated using N-channe! silicon gate depletion load technology; it is packaged as a 28-pin DIP. THE MC6840 COUNTER/TIMER PINS AND SIGNALS MC6840 counter/timer pins and signals are illustrated in Figure 9-30. These pins and signals are described in conjunction with a general discussion of the MC6f;140 organization logic and capabilities. !,. • t ' . ' . . " Each of the three sets of timer logic has a 16-bit Counter, a 16-bit Latch and three control signals, illustrated as follows:' . ' , . IRQ~~--------------------------------------------------------------------------------~---------------~-------------------------- Data In C Clock (Decrement Control) Counter/ Timer Logic Data Out 0 Output G <1>2 (E) Data In Gate/Control l..-----------------------------:-----------------------------------------,..',i.i(.·•. re~Jist~~r/ iii 9-78 Shaded registers are addressable (GND) Vss G2 2 02 3 4 c C2 ~ G3 03 w a: a 0 a.. a: RESET IRQ 0 CJ ~ RSO RS1 RS2 R/W enw I- < C3 0 VCC C/) C/) 5 6 7 8 9 10 11 12 13 14 MC6840 28 27 Ci 26 25 24 G1 01 23 22 21 20 19 18 17 16 15 ,J:.: DO 01 02 03 04 05 06 07 <1>2 (E) CS1 CSO < o/l w Z PIN NAME DESCRIPTION TYPE 0 DO - 07 C1 01 G1 C2 02 G2 C3 03 G3 RSO, RS1, RS2 CSO, CS1 R/W RESET IRQ <1>2 (E) Data Bus Timer 1 clock Timer 1 output Timer i gate Timer 2 clock Timer 2 output Timer 2 gate Timer 3 clock Timer 3 output Timer 3 gate Register select Chip select Read/Write control System reset Interrupt request Clock input Power and Ground Tristate, bidirectional Input Output Input Inp~t Output Input Input Output Input If'!put Input Input Input Output Input a: ell C/) 0 ~ < < @ c VCC,VSS Figure 9-30. MC6840 CounterlTirner Signals a~d Pin Assignments When any counter or timer operation is initialized, the 16-bit Latch contents are loaded into the associated 16-bit Counter. The Counter is then decremented either on high-to-Iow transitions of the external clock signal (Cl. or on high-to-Iow transitions 'of the int~rnal <1>2 clock signal; selecting one or the other is a programmable option. Thisrnay be illustrated as follows: MC6840 COUNTER/TIMER INITIALIZATION Initialize <1>2 or C i --1 + XXXX from Latch to Counter I \ + XXXX-1 in Counter I \ 4 XXXX-2 in Co~~ter I L + XXXX-3 in Counter XXXX represents any initial 16-bit value. If the external clock signal is used to decrement the counter/timer, then it is being used as an event counter; if the internal synchronization clock is used to decrement the counter/timer, the!" it is being used as a tim~r. The external signals quences. C and G are sampled on the trailing edge of ~. This has important synchronization conse- 9-79 Timing for external clock signal C or G may be illustrated 'as follows: MC6840 EXTERNAL SIGI'IAL TIMING 1 I <1>2 (E) \ 1 I~------ 1 I .y,: CorG I I _~-II""-------':\ ' ~ :i;;r. I ' . ~' I One machine cycle ' C must be stable low before start of machine cycle, and must not start returning high until after end of machine cycle. Thus. external clock signal frequencies may vary from Q (DC) to somewhere less than half of the internal <1>2 clock frequency. It is very important that external signal timing conform to the illustration above. If insufficient setup time is provided. MC6840 logic will possibly recognize the initial high-to-Iow signal transition twice: once assuming that the setup time just made it. and again assuming that it did n~t;· this may be illustrated as follows: . , \ 1 <1>2 (E) I I I \ ~ C orG sign~i. C or G ~ mllY be detected ' ~ or <1>2 (E) Actual \)'ffi O'~ffi ..J___ :) ~ detected here or here C or G A similar problem may occur on the trailing edge of the external This may be illustrated as follows: This may result in clock pulses being missed. ' G. - l ~/h'; 1 1 1 I C or G' - - - - - - - . \ h'f i =v may be detected 0' 1 I I ______________- - J I Some or all of these four Cor G interpretations ! are possibl~ / L ,.....----------:"----------- 1 I·~ I ,I~------~ - - - - - - -I -----l\ \ 'I ------~\-------~--------­I , 1 ,I I I I 1 I I I I \ 9-80 I I Any transition of the C or G input signals is not recognized by internal MC6840 logic for four CSl VMA A15 A3 :~ Select Logic· ~CSO ~RS2 ~RSl A2 Al AO ... RSO --..- ~ Signals output by the MC6800 CPU Signals input to the MC6840 Counter /Timer a Once the MC6840 has been selected. the level of the RIW signal determines whether a read (R/W high) or write (R/W low) operation is to occur. If R/W is low. the CPU will write into the selected MC6840 location: if R/W is high. . the contents of the selected MC6840 location will be read. Any data transferred to or from the MC6840 is transferred via the Data Bus. The MC6840 Data Bus connection is three-state: when a read or a write operation is not in progress. the MC6840 disconnects itself from the Data Bus. The MC6840 is reset by applying a low input signal to the RESET pin. Necessary reset timing may be illustrated as follows: 9-81 IMC6840 RESETI RESET signal timing requirements are the same as the C and G requirements which we just described. The RESET is recognized by internal logic two clock pulses after a low level is ~e~ected. Following a valid reset. all Latches are loaded with the value FF16. and this value is transferred to the Counter registers. All Control registers are reset to O. with the exception of Control Register 1 bit O. which is set to 1. This is a system initialization bit which we will describe later. The Status register is als6 cleared. Thus. following a reset. those programmable options which are selected by 0 bits in the Control registers will be enabled. MC6840 ADDRESSING . . Addressable locations within the MC6840 are all read-only or write-only locations. Table 9-10 identifies MC6840 add~essable ,locations.' Table 9-10. MC6840 Addressable Locations Operations Register Selected Label Address R!W=O (Write) R/W'=1 (Read) RS2 RS1 RSO 0 0 0 DEV Write to Control Register 3 if Control Register 2. bit 0 is 0 Write to Control Register 1 if Control Register 2. bit 0 is 1 No operation 0 0 1 DEV+ 1 Write to Control Register 2 Read Status register 0 1 0 DEV+2 Write to MSB register Read Counter Register 1 0 1 1 DEV+3 Write to Latches 1 Read LSB register 1 0 0 DEV+4 Write to MSB register Read Counter Register 2 1 0 1 DEV+5 Write to Latches 2 Read LSB register 1 1 0 DEV+6 Write to MSB register Read Counter Register 3 1 1 1 DEV+7 Write to Latches 3 Read LSB register '. There are sgme nonobvious aspects to r'v1C6840 addressing. We will first look at write addresses. If we number the three counterltimer logic elements 1. 2 and' 3. counterltimer logic element 2 has a unique write-only a(jdress for its Control register. (I~ is address DEV+ 1). Counterltimer elements 1 and 3 share a single write-only address (DEV) .. The level of Control register 2 bit o determines whether Control Register 1 or 3 will be selected by addr~ss DEV. This may be illustrated as follows: " ' , . 7 Address DEV + 1 Address DEV 6 5 4 3 2 o ....--BitNo. ,J----. ~,,_.&.._...&I_..a..__~...._ .....-",I___ Control Register 2 ------------..;,.c--~;~---1:~ Co~trol Register 3 ! - 9-82 Control Register 1 Following a device reset. Control Register 2. bit 0 will be O. Therefore. initially Control Register 3 will be selected by address DEV. Thus. you will normally access Control registers in the sequence 3. 2. 1. as follows: 1) Select address DEV. access Control Register 3. 2) Select address DEV+ 1. access Control Register 2. Set Control Register 2. bit 0 to 1. c 3) Select address DEV. access Control Register 1. ~ a: oa.. Three write addresses select an "MSB" register. All three write addresses select the same temporary "Most Significant Byte" buffer. This buffer allows 16 data bits to be written into anyone of the three 16-bit latches when a single 8-bit write is executed. This may be illustrated as follows: w a: o o ui w O~ 7 ~ MSB buffer ~ g CI) CI) L / ' I - - - - - - - - - - - y Write Address ....----_--1 15 oCt Bit No. 'v----------~ o .. B 7 all w Z Latches 1 MSB LSB a: o en DEV + 2, DEV + 4, DEV + 6 Bit No. L / ' I - - - , Write Address Iv-----"DEV+3 CI) o o .. 15 ~ oCt C oCt Latches 2 MSB LSB Bit No. 1 / ' - - - - , Write Address '\r---~ DEV + 5 @ Latches 3 O~ B 7 15 MSB LSB . . . .- - -_ _ _ _ _ ~ Bit No. 1 / , - - - . . Write Address _ _ _ _ _ _ _ _ _ __ _ JIv--~DEV+7 MSB means Most Significant Byte LSB means Least Significant Byte 9-83 The Most Significant Byte (MSB) buffer allows the MC6840 to be accessed by MC6800 16-bit write instructions. You can. for example. use an STX or STS instruction to transfer the contents 'of the Index register or the Stack Pointer tathe selected MC6840 location. There are three MC6840 locations which can receive a 16-bit data value: they are the three counterltimer latches illustrated above as Latches 1. Latches 2 and Latches 3. You address these counter/timer latches via their associated Most Significant Byte buffer address. Now when you output a 16-bit value (for example. from the Index register). first the high-order byte is transferred to the Most Significant Byte (MSB) buffer. For Latches 2 this may be illustrated as follows: 15 o 87 . STX MSB Buffer O~BitNo. 8 7 Latches 1 DEV+3 15 8 7 15 8 o ....-..Bit No. Latches 2 DEV+5 o 7 Latches 3 DEV+7 9-84 ~BitNo. DEV+4 Then the low-order byte' is transferred to the low-order byte of the addressed counterltimer latches. while simultaneously the Most Significant Byte (MSB) buffer contents are transferred to the high-order byte of the addressed counterltimer latches. This may be illustrated as follows: 15 cw CPU "d., R.g'''.' !ia: I fl. a: 0 CJ ~ MSB Buffer ...ct g .a o '--BitNo. 8 7 CI) CI) ct Latches 1 w Z DEV+3 a: 0 III CI) 0 ~ ct C ct 0 STX 0 en w 8 7 Latches 2 @ O...-BitNo. 8 7 Latches 3 DEV+7 9-85 DEV+4 You can. of course. access counterltimer latches using single byte instructions. You could. for example. transfer a 16bit value one byte at a time from Accumulator A. via the following instruction sequence: LDA STA LDA STA A.#HI A.DEV+4 A.#LO A.DEV+5 LOAD ADDRESS HIGH-ORDER BYTE AS IMMEDIATE DATA STORE IN MSB BUFFER LOAD ADDRESS LOW-ORDER BYTE AS IMMEDIATE DATA WRITE 11 DATA BITS TO LATCHES 2 This instruction sequence may be illustrated as follows: 7 O"--BitNo. 7 MSB Buffer DEV + 2. DEV + 4 DEV+6 15 8 O,--BitNo. 7 Latches 1 DEV+3 15 8 04--BitNo. 7 DEV+5 8 O~BitNo. 7 Latches 3 . DEV+ 7 #HI Memory 9-86 o o c w I- < a: 0 a. MSB Buffer a: 0 0 ~ en w o ..-.- Bit No. B 7 I- < (; 0 CI) CI) OEV+3 < 011 w Z a: 0 15 O~BitNo. B 7 Latches 2 III CI) OEV+5 0 :!: < < @ 15 c 8 o '--BitNo. 7 Latches 3 OEV+7 Memory 0 LOA A.#LO 7 o .......-BitNo. MSB Buffer o . - - B i t No. Latches 1 OEV+3 0 ...-BitNo. 1) Latches 2 OEV+5 o .--BitNo. Latches 3 OEV+7 #LO Memory 9-87 7 o MSB Buffer O.--BitNo.. Latches 1 p-------------~----------~ Latches 2 Latches 3 oev+ 7 Memory As illustrated by the instruction sequence above. you must first transfer the high-order byte of data to the Most Significant Byte (MSB) buffer. then you must transfer the low-order byte of data to the timer/counter Latches address: when you write to the timer/counter Latches address. the data moves into the low-order byte of the timer/counter Latches. while simultaneously the Most Significant Byte buffer contents are transferred to the high-order byte of the timer/counter Latches. There are seven read-only locations within the MC6840. Address DEV does not select any read-only location. Address DEV+1 reads the contents of a Status register: this register records time out and interrupt request status for the three sets of counterltimer logic. The Status register is described later. . 9-88 The remaining six read-only addresses are used to read the contents of the counter/timer counters in a manner that is analogous to the way in which you write into the cou~ter/timer latches. This m~y be i~lustr~Wd as folloyvs: Bit No. ~7 0 LSB Buffer 0 w ~ II: 0 a.. BitNo.~:15 8 7 0 II: 0 0 Counter 1 ~ ui .g w « Adejress: DEV+2 . 8 7 Bit No.----' 15 0 CI) CI) Count~r 2 « 011 w z Address: 0 Bit No.----' 15 ·DEV+.4 II: m 8 7 0 CI) 0 ~ «c « Counter 3 Address: DEV+6 @ ?-89 The three addresses which select the Least Significant Byte (LSB) buffer once again address the Si3me location. Consider the LDX' instruction which loads a 16-bit data value into the CPU Index register. When' this instruction addresses an MC6840 counter/timer. you first read a Countj3r regi~lgr high-order byte into the Index register high-order byte while simultaneously transferring the Counter register low-order by tEl into the Least Significant Byte (LSB) buffer. For Counter 2 this may be illustrated as follows: 15 8 o 7 LSB Buffer Bit N o . - - " 15 8 7 Co~nter Address: 1 DEY,;-': Counter 2 Address: Bit No.----" 15 8 7 Counter 3 Address: DEV'..:j.y 9-90 The Least Significant Byte (LSB) buffer contents are then transferred to the low-order Index register byte: 15 0 8' 7 Q w ~ II: 0 a. II: 0 LSB Buffer (J ~ en w ~ BitNo.~15 ~ g 8.7 Counter 1 CI) CI) ~ Address: oil w Z DEV+2 II: 0 III CI) Counter 2 0 ~ ~ Q ~ Address: Bit N o . - . - 15 ~ Counter 3 Address: DEV+6 You c~n. of course. read Counter register contents one byte at~ time. but you must make sure that you read the highorder byte mst by addressing the counter itself: ,then you must ~ead the low-order byte by addressing the next addressable location. This may be illustrated for Counter 2 by the following instruction sequence: ' LOA LOA A.DEV+4 B.DEV+5 LOAD dbuNTEA HIGHcdRDER BYTE TO ACCUMULATOR A LOAD COUNTER LOW-ORDER BYTE TO ACCUMULATOR B ThEm! are some' ways of getting into tro~ble, whe~ acc~;sing the .MC6840. As illustrated for Counter read and Latch write oper~tions. whe~ 'reading or writing to the MC6840 you must first s~lect an even address location. and ,then address the next sequential lobation. If, you write first toah odd address; you will transfer into the seiected latches eight bits of data plus whatever happens to be in the Most Significant Byte buffer. If you read first from an odd address. you will read whatev~r happens ,to be in the Least Significant Byte (LSB) buffer. You must never access the MC6840 with an instructiori that modifies the contents of a memory location; these instructions read the contents of the addressed memory location to the CPU. modify its contents. and then write the contents back to the same. addressed memory location. For an increment memory instruction:, INC bEV+4 9-91 this may be i1lust~ated as follows: Step 1 To CPU and increrneht Bit No. MSB Buffer DEV+2.DEV+4. DEV+6 Bit No. LSB Buffer DEV+3. DEV+5 DEV+7. Bit No.: Latches 1 DEV+3 o Counter 1 ~~----------~------------- Bit No. 15 Latches 2 Counter 2 ~it No. Latches 3 O· Counter 3 Bit No. Step 2 Incremented value from CPU cw ~ a: oa. a: Bit No o u ~ enw MSB Buffer ~ DEV + 2. DEV + 4 DEV+6 g CI) CI) ~ LSB Buffer CI/:I w a: DEV + 3. DEV + 5 DEV+7 Z o m CI) o ~ ~ 15 c Bit No <: @ Latches 1 DEV+3 Bit No Counter 1 15 Bit No Latches 2 DEV+5 15 DEV+4 8 7 o Bit No Counter 2 15 Bit No Latches 3 o Counter 3 9-93 Bit No As illustrated above. the same address accesses different MC6840 locations on a read or write: you will read the contents of one location. modify them. and write them back to a totally different location. Therefore. when accessing the MC6840 under program control. you must be sure not to use instructions that modify memory: use only instructions that read from memory or write to memory. ivlC6840 COUNTER/TIMER PROGRAMMABLE OPTIONS We will begin our discussion of the MC6840 counter/timer options by describing the Control code which must be written into each Control register. Subsequently, the various operating modes will be discussed along with appropriate examples. MC6840 CONTROL REGISTERS This is the general format for the Control code: 3 6 o ,,--SitNo. 2 I I I I I I I I .~ j~ .• I~ I ~ . ~ Control Register I~ Control Register 1 - 0 1 Control Register 2 - 0 1 Control Register 3 - 0 1 No operation Initialize all counter/timers Write address 0 selects Control Register 3 'Write address 0 selects Control Register 1 No operation Select +8 prescalar for Counter/Timer 3 o - Select external clock 1 - Select internal <1>2 clock 0- Select 16-bit counting mode 1 - Select 8-bit counting mode o - Continuous or Single-shot mode o - With programmed start 1 - Without programmed start o - Select Continuous mode 1 - Select Single-shot mode 01 - Frequency Comparison mode 11 - Pulse width Comparison mode o - Interrupt or Gate pulse shorter 1 - Interrupt on time out shorter o - Disable interrupts 1 - Enable interrupts o -: Disable Output signal 1 - Enable Output signal Bits 0 of the three Control registers are unusual in that they have different interpretations for the three Control registers. Control Register 1. bit 0 is a system initialization bit. System initialization is identical to a system reset. with the exception that latches are not effective. Thus. as soon as a 1 is written to Control Register 1. bit O. all three counterltimers are stopped. the contents of all three Latches are transferred to their associated Counter registers. the Status register is cleared. and all Control register bits (with the 'exception of Control Register 1 bit 0) are reset to O. MC6840 PROGRAMMED INITIALIZATION Control Register 2. bit 0 is an addressing bit. When this bit is O. a write to the lowest MC6840 address (DEV) will access Control Register 3: when this bit is 1. a write to address DEV will select Control Register 1. This was graphically illustrated in our earlier discussion of MC6840 addressing. 9-94 a Control Register 3. bit is unique to counter/timer 3. When this bit is 1. every eighth clock pulse will be active at cQunterltimer 3. This may be illustrated as follows: c w ~ o0. MC6840 DIVIDE-BYEIGHT CLOCK Actual <1>2 or C a: a: o o I --------~--~--~------------------~~ ~ I' n' Effective <1>2 or C 3 2 Iii 4 I 5 I 7 6 I 8 fL I~------------~----~~----~ 4 3 2 I 5 6 7 w ~ g (I) (I) ct ail w Z a: oaI (I) o :E ct c ct @ Control register bits 1 through 7 serve identical functions. but apply only to one set of counter/timer logic. Each of the three counter/timer logic elements operates quite independently. and is in no way influenced by conditions at either of the other counter/timer elements. Control register bit 1 determines whether Counter register contents will be decremented by external clock signal (C) transitions., or by the internal <1>2 clock. In either case the counter,will be decremented on high-to-Iow clock transitions. Control register bit 2 determines the way in which the Counter register will decrement. There are two options: 16-bit counting mode and 8-bit counting mode. In 16-bit counting mode. the 16-bit counter contents are treated as a single 16-bit entity. Once an initial value has been loaded into the counter. it decrements on each active clock transition. When the clock decrements to O. a time out occurs. This may be illustrated as follows: 20rC 'Jn n~wn ~ U' -......., Ilill.talize. Load latches contents into Counter L _e •••• ____ e o _ e o _ e . MC6840 16-BIT COUNTING MODE ~ ~ V' Decrement Counter on each clock pulse. This may occur automatically. or following another initialization Decrement Counter on each clock pulse Counter decrements to 0 Reload Counter with Latches contents .... ...... ~~ ~~~ ~~ This is a time out There are a variety of ways in which you initialize a counter/timer. These are programmable options which depend on the selected operating mode - which we will describe .Iater. ' A time out occurs after a Counter register decrernents toO. On the next clock pulse the Counter register is reloaded with the contents of the latches. Under program control you can determine whether a time out will be marked by an interrupt request. and whether the counter/timer will stop or run continuously. 9-95 In 8-bit counting mode the high-order and low-order bytes of the counter are treated as separate entities. On each active clock transition the low-order counter byte is decremented; when the loworder byte decrements from 1 to O. nothing happens. On the next active transition of the clock. the low-order byte is reloaded from the low-order byte of the latch and the high-order byte is decremented. This may be illustrated as follows: ~,--------~~~--------~~ Decrement Counter loworder byte on each clock pulse Initialize. Load latches contents into Counter. Counter low-order byte decrements to 0 Decrement Counter highorder byte and re-Ioad Counter low-order byte from latch MC6840 8-BIT COUNTING MODE '-....._ -.....'V,.---",/ Decrement Counter loworder byte on each clock pulse Counter low-order byte decrements to 0 Counter high-order byte decrements to 0 last time and now contains O. Reload both Counter bytes from latches ~'-------~~~--------"'~ , This is a time out Initialization logic. time out logic and programmable options are identical in 16-bit and 8~bit modes. What differs are the events between initialization and time out. . We can contrast 8-bit and 16-bit modes aecrement logic by looking at what happens after an initial value of 040A16 has been loaded into a counter/timer latch. In 16-bit mode a time out will occur after 101110 clock pulses. Assuming a 1 microsecond clock. a time out will occur every 1.011 milliseconds: 040A16 = 101010 Time out occurs one clock pulse later. that is. after 101110 pulses 101110 microseconds = 1.011 milliseconds' , In 8-bit mode a time out will occur after 55 clock pulses, With reference to the 8-bit mode illustrated above. let us see how we derive this value. The low-order Counter register byte contains OA16. which is equal to 1010, It takes 1010 clock pulses to decrement the low-order byte to O. On th'e, 11 th clock pulse the high-order byte is decremented. while the low-order byte is reloaded from the low-order byte of the latches. The high-order byte is therefore decremented once every N+1 clock pulses. where N is the initial value which is loaded into the Counter register low-order byte. The Counter register high-order byte decrements to O. On the next attempt to decrement the Counter register highorder byte. if it already contains O. a time out occurs. Thus. the Counter register high-order byte is decremented M+1 times. where M is the initial Counter register high-order byte contents .. Thus. you can compute the number of clock pulses until a time out occurs in 8-bit mode via the followin'g 'equatiqn: '" (M+1) * (N+1) where M is the initial Counter register high-order byte contents and N ,is the initial Counter register low-order byte contents. For each counter/timer you can selilct one of eight operating methods via Control registers bits 3, 4 and 5. For any MC6840 operating mode, interrupts and/or the output signal (0) mayor may not be enabled. If interrupts have been enabled (via Control register bit 6). then on every time out (and for certain other special conditions) an interrupt request will be made to the CPU by outputting a low IRO signal. Simultaneously. appropriate Status flags are set in a Status register. If interrupts are disabled. the Status register bit settings occur. but no interrupt request is output via IRO. 9-96 -MC6840 ----, INTERRUPT ENABLE If the output signal (0) is enabled. then during Continuous and Single Shot operating modes an output signal is generated. The output signal (0) is not used in frequency comparison and pulse width comparison operating modes. The Status register of the MC6840 reports time outs and interrupt request status. Status register bits are interpreted as follows: Q w 6 ~ oQ. 5 4 3 2 o MC6840 OUTPUT SIGNAL ENABLE STATUS REGISTER ......-BitNo. a: Status Register a: u o ~ Counter/TImer 1} 1 = Interrupt or time Counter/TImer 2 out condition . 0 = No interrupt or ~------ Counter/Timer 3 time out condition. L--_ _ _ _ _ _ _ _ _ _ Not Assigned en w L--_ _ _ _ ~ g en en ~------------- 1 - Active interrupt pending c( o - No active interrupt pending alS w Z a: The MC6840 Status register is a read-only location accessed via the address DEV+ 1. as shown in Table 9-10. m There are some nonobvious consequences of Status register organization. We will therefore describe the in. dividual Status register bits and then the way in 'which they should be used. o en o :!: c( Q c( @ Status register bits 0, 1 and 2 will be set to 1 if an interrupt condition exists at counter/timer 1, 2 or 3, respectively. This will occur whether or not interrupts have been enabled. For example. if a time out occurs at counterltimer 2. then Status register bit 1 will be set. irrespective of whether counterltimer 2 interrupts have or have not been enabled via Control Register 2. bit 6. Thus. Status register bits O. 1 and 2 do not report an interrupt pending from a counterltimer: rather. they report the existence of a condition capable of generating an interrupt request. Status register bit 7 indicates the presence of a valid interrupt request. Status register bit 7 will be set to 1 if a valid interrupt request has been generated by one or more of the counter/timers. That is to say. if Status register bit O. 1 or 2 he..:. been set to 1 while the associated Control register bit 6 is 1. then Status register bit 7 will be set to 1. This may be il., lustrated via the following logical equation: S7, = (SO. C16) + (S1 • C26) + (S2 • C36) In theequation above. SO~ S1. S2 and S7 represent Status register bit~ O. 1. 2 and 7. respectively. C 16. C26 and C36' represent bit .6 of Control Registers 1. 2 and 3. respectively .• and + signs represent logical AND and OR operations. respectively. ' Now. in an MC6800 microcomputer system that is using vectored interrupt acknowledge logic. Status register bit 7 is useless. This is because the'vectoring logic associated with the interrupt acknowledge allows the executing program to branch directly to an interrupt service routine dedicated to this particular MC6840 device. For example. in an MC6800 microcomputer system that includes an MC6828 Priority Interrupt Controller (PIC). the interrupt request line from the MC6840 would terminate at one of the MC6828 interrupt request pins: the MC6840 interrupt service routine's start address would be fetched by the MC6828 PIC following an interrupt acknowledge.. Upon acknowledging the interrupt request. the MC6800 knows that this particular MC6840's interrupt has been acknowledged: therefore the high-order Status register bit contains no useful information. In MC6800 microcomputer systems that use polling logic following an interrupt acknowledge. the interrupt acknowledge process will begin with a general purpose interrupt service routine that reads the contents of every device Status register - checking for devices with an active interrupt request. Now Status register bit 7 of the MC6840 is useful. The initial general purpose interrupt service routine will read the contents of the MC6840 Status register and check bit 7. If this bit is 1. then an active interrupt request exists. Here is an appropriate instruction sequence: LDA BIT BNE LOA A.DEV+1 A.#80H MC6840 A.NEXT READ STATUS REGISTER TEST HIGH-ORDER BIT IF NOT O. BRANCH TO SERVICE ROUTINE READ NEXT DEVICE'S STATUS REGISTER You cannot use the MC6800 Status register to create interrupt request priorities within the MC6840. One or more counterltimer int~rrupts must be enabled via the Control register bit 6 for an interrupt request to be generated. but if more than one counter/timer can generate an interrupt request. you have no way of determining which counterltimer generated the interrupt request. Suppose. for example. that only counterltimer 1 has its interrupt request logic enabled via Control Register 1. bit 6. Now if a time out (or other condition capable of generating an interrupt 9-97 request) occurs at counterltimer 2, and then at counter/timer 3, and then at counter/timer 1, this is how Status register bits will be set: Comment Event Status Register Counter/Timer 2 times out I0 I0 I0 I0 I 0 I0 I 1 I0 I Counter/Timer 2 interrupts are disabled so there is no interrupt request and Status register bit 7 is 0, Counter/Timer 3 times out I I0 I 0 I0 I 0 I I I I Counter /Timer 3 interrupts are disabled so there is no interrupt request and Status register bit 7 is O. Counter/Timer 1 times out I Counter/Timer 1 interrupts are enabled so there is an interrupt request and Status register bit 7 is 1. 1 0 1 1 0 I 0 I 0 10 I 0 I I I 1 1 1 I An interrupt request is generated only after counterltimer 1 encounters an interrupt condition, but there is no way of reading the Status register in order to find out what happened. All the Status register. says is .that all three counterltimers have active interrupt conditions and at least one of them has its interrupt request logic enabled. Program logic within the interrupt service routine must therefore take care of arbitrating priorities between the three counter/timer elements of an MC6840 counter/timer. Therefore, use the MC6840 interrupt enable/disable logic to select the counter/timers that can cause an interrupt request to occur, but make sure that your MC6840 interrupt service routine uses program logic to arbitrate interrupt priorities between the three counter/timer elements. Status register bits are reset to 0 by a reset operation (RESET is input low) or by a general initialization (Control Register 1 bit 0 is 1). Logic that resets individual Status register bits has been carefully designed to avoid missing interrupt requests. In order to reset Status register bit 0, 1 or 2 to 0, you must read the Status register and then read the particular counterltimer's Counter register. This may be illustrated for counterltimer 2 as follows: LDA LDX A.DEV+1 DEV+4 READ STATUS REGISTER CONTENTS READ COUNTER 2 CONTENTS AND RESET STATUS REGISTER BIT 1 TO 0 By reading the contents of one particular Counter register, you also identify the Status register bit to be reset. If all Status register bits were reset when you read Status register contents. you might miss pending interrupts that you are not currently processing. You can also reset individual Status register bits by writing to a counterltimer's counter latches, providing the counter/timer's Control register bit4 is 0 - which results in the counterltimer being initialized when data is written to the counterltimer's latches. Let us now look at each of the operating modes in turn. Options are defined by the Control register, whose bits we have already described. Table 9-11 provides an options summary. We will first examine Continuous mode. 9-98 © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 9-11. A Summary ofMC6840 Options and Control Register Settings Options Control Code Options Mode Initialize Counter 16-Bit 8-Bit Continuous XXOXOOXX XXOX01XX XX010XXX XXOOOXXX One Shot XX1XOOXX XX1XOlXX . XX110XXX .. XX100XXX Gl+R Gl+W+R Enabled 1XOXOXxx... 1X1XOXXX Disabled OXOXOXXX . OX1XOXXX Enabled .~ . Disabled Special Conditions Clock Internal External " i;XlOXOXXX XOOXOXXX XXOXOX1X XXOXOXOX 8-bit counter with L=O generates 16bit waveform. N =0 generates square. wave output with half clock frequency X11XOXXX X01XOXXX XX1XOX1X XX1XOXOX Land M=O in 8-bit mode or N=Oin 16bit mode disables output G pulse versus TO.· Frequency. Comparison. Gless Pulse Width Comparison Interrupts Output Output signal is not significant in these modes. W is always part of initialization Gmore XXX010XX XXX011XX NA NA XXOO1XXX . XX101XXX X1X01XXX XOX01XXX XXX01X1X XXX01XOX XXX110XX XXX111XX NA NA :XX011XXX XX111XXX X1X11XXX XOX11XXX XXX11X1X XXX11XOX G 1refers to --"L on G input W refers to a write into counter/timer latches N is the 16-bit value written into counter/timer latches; it has a high-order byte- 1M) and a low-order byte IL) . NA means not applicable Table 9-12, MC6844 DMAC Register Addresses Address : r' ['",,4 , Accessed Location, A3 A2 A1 AO Label " 0 0 0 0 0 OEV Channel 0 Address register, high-order byte ,,··O"'~;' 0 0 0 1 OEV+ 1 Channel 0 Address register, low-order byte 0 0 0 1 0 OEV+2 Channel 0 Byte Count register, high-order byte 0 0 1 1 OEV-I:3 Channel 0 Byte Count register, low-order byte 0 0 1 0 0 OEV+4 Channel 1 Address register, high-order byte 0 0 1 0 1 OEV+5 Channel 1 Address register, low-order byte 0 : 0 1 1 0 OEV+6 Channel 1 Byte Count register, high-order byte .. 0 1 1 1 OEV+7 Channel 1 Byte Count register, low-order byte 0 1 0 0 0 OEV+8 Channel 2 Address register, high-order byte o ' 'I~i 1 0 0 1 OEV+9 Channel 2 Address register, low-order byte 0 1 0 1 0 OEV+A Channel 2 Byte Count register, high-order byte t, () 1 0 1 1 OEV+B 0 1 1 0 0 OEV+C 0 0 '" , ~ Channel 2 'BYte Count register, low-order byte 'Channel 3 Address register, high-order byte 0 1 1 0 1 OEV+O Channel 3 Address register, low-order byte "t 0 1 1 1 0 OEV+E Channel 3 Byte Count register, high-order byte Channel 3 Byte Count register, low-order byte \0 ,1 " '·,1'1 ,1 \"1 , , 1 1" 1 ",r., \", i ' , 1 1 1 1 OEV+F 0 0 0 0 OEV+ 10 Channel 0 Control register 0 0 0 1 OEV+ 11 Channel' 1 Control register 0 0 1 0 OEV+ 12 Ch~nnel 0 0 1 1 OEV+ 13 Channel 3 Control register 0 1 0 0 OEV+ 14 Priority Control register 0 1 0 OEV+ 15 Interrupt Control register 0 1 1 1 0, OEV+ 16 Data Chain Control regist~r 2 Control register In Continuous Operating mode with 16-bit counting. a time out will occur after N+1 active clock transitions; recall that you may select the internal <1>2 clock, or the external clock (C): In each case the high-to-Iow transition of the selected clock is an active transition, If the outpu't signal (0) is disabled. then Continuous Operating mode with 16-bit counting simply generates a time out every N+1 active clock transition, This may be illustrated as follows: . 2 <1>2 or C 3 N-1 N MC6840 CONTINUOUS MODE N+1 J\J\..J1J\.. _____ J\.J1JVL __ _ !J +"!v Initialize. Load N into Counter register Decrement· Counter +L 1 Time Out If irter~u:Pts are enabled for the cQu.nter/timer wh~ch tin;es out. then ,the time out causes an interrupt request t~ be transmitted to the CPU and appropriate Status register bits are set. If Interrupts are not enabled. then the appropriate Stcitus.register bit is set. but no interrupt request is transmitted. to the CPU, In Continuous Operating mode with 16-bit counting. if the output signal (0) is enabled'.' then this signal will change level on each time out. thus creating a square wave. Here is the exact waveform: N 2 N N+l ~ a: oa.. N+l __...f\.J\.Jl._.. < I > 2 0 r c . n r \ J l . _ •• cw N N+l o a: o tJ ~ en w ~ ~ lriiiialize. Load N from latches into Counter . g (I) (I) ct alJ w Z a: o aJ Decrement Counter register Time but and initialize again Time out and initialize again Decrement) Counter register Decrement Counter register Time out and initialize again. II') Continuous mode. observe that following each time out the value held in the counter latches (N in the illustration above) is transferred to the Counter register. If the output signal 0 is enabled. therefore. the following square wave is generated: . (I) o ~ 0 ct C ct J \ I ' I I @ P I I p TO TO TO I \ I r _I _ I I \ I -1-- ~P I _I_ I I I I _I_ p p -I'- P~ TO TO TO I TO TO identifies a time out. P represents the time interval between time outs; it is equal to (N+ 1)*t where N is the initial 16-bit value loaded irlto the Couhter register and t is the time interval between active transitions of the clock (<1>2 or C). In Continuous Operating mode with 8-bit counting. the interval to time out is (N+1) * (M+1) clock transitions. where M is the initial Counter register byte and N is the initial low-order Cpunter register byte. We have already described this time out logic. If the output signal (0) is disabled. then a time out will occur after the appropriate number of active clock transitions. When the time out occurs. an interrupt will be requested via IRQ if interrupts are enabled for this counter/timer by setting its Control register bit 6 to 1. Simultaneously. appropriate Status register bits will beset. If interrupts are disabled. then a Status register bit will be set. but rio interrupt request will occur. If the output signal (0) is enabled. then it generates pulses as follows: ~ ~ ~ ~ ~ ~ ~ N ~+ 2 2orC N+l N 3 N+2 N+3 ~ ,+ ~ + ~ + ~ ~ + + + + + + ~ '.1VVVl_.1VVVl.J\...JlJlll. o '\,.,r u .. r .••• v~-- Decrement Counter register. low-order byte Initialize. Load MN into Counter register . . . . . . .__....v-- ".~ Decrement Counter register in 8-bit 'mode Decrement Counter register low-order byte Decrement Counter register high-order byte. It is O. Reload' low-order byte from latches Decrement Counter register high-order byte and reload low-order byte from iatches 9-101 Decrement Counter register in 8-bit mode Time out. Reload both bytes of Counter register from latches Thus. in 8-bit counting mode you use the low-order Counter register byte to define the pulse width. and you use the high-order Counter register byte to define the interval between pulses. This may be illustrated as follows: 0 \ n I n I ,.... _1 P ·i P 4 ., I I P 4 TO TO TO rL I I I I w w w TO In the illustration above. TO identifies atime out.P represents the time interval between time outs. In 8-bit counting mode P is equal to (M+ 1)* (N+ 1) * 1. where M is the initial value for the high-order byte of the Counter register. N is the initial value for the low-order byte of the Counter register. and t is the time Interval between active transitions of the clock (<1>2 of C). W represents the time interval of the high 0 pulse; it is equal to N * T. Suppose. for example. OAOC 16 is the initial value loaded into the Counter register which is being operated in 8-bit counting mode. 0 will generate a pulse output where the high pulse is 1210 clock periods long and the frequency is 14310 clock periods: , 0\ I TO I -\ I \ I TO I i I I I I TO I ~I i "-- l I I v There are some further options available to you when operating the MC6840 in Conti~uous mode. Having loaded the counter latches by writing out data to the appropriate address, there are two ways in which you can initialize the counter. A high-to-Iow transition of the Gate (G) input will always start the counter: <1>2 or C , \ I G ~ ___-", Initialize 9-102 MC6840 HARDWARE INITIALIZATION \ You can always initialize any counterltimer via its Gate input (3) as illustrated above. Once a counterltimer has been initialized via i.ts Gate input (G). G mUst remain low. If (3 goes high at any time this will stop the counterltimer immediately. When IT subsequently makes a high-to-Iow transition. the counterltimer will be re-initialized. This may be illustrated as follows: cw !( 0:: oa. 0:: <1>2 or C G o(J ~ ui w e:( g en en e:( oil w Z 0:: o rD en o :!: e:(' c e:( @ Initialize. Reload OAOC 16 from latches into Counter Stop. Assume 020416 currently in Counter. This value is lost Initialize. Assume OAOC16 is loaded from latches into Counter l- Note carefully that the Gate signal (G) going high does not suspend counterltimer operations: it stops these operations. then restarts them with are-initialization. You can also initialize a counter/timer under program control. Programmed initialization is an option. whereas hardware initialization via the Gate input (G) is always available. whether or not programmed initialization has been selected. You select programmed initialization via bit 4 of the counterltimer element's Control register. If Control register bit 4 is O. then the process of writing a 16-bit value to the counter/timer's latches will start the associated counter/timer logic. That is to say. as soon as the 16-bit value has been written to the latches. this value is transferred to the 16-bit Counter register and the counter begins operation. MC6840 DIVIDE BY 8 MODE When using counter/timer 3 only, you can select a "divide by 8" mode; this is done by setting Control Register 3. bit a to 1. Now every eighth active clock transition (of either the internal <1>2 clock or the external clock) will be considered active. as illustrated earlier. All other options remain available when operating counterltimer 3 in "divide-by-S" mode. The clock has effectively been slowed down by a factor of S - and that is all. When operating in Continuous mode with 8-bit counting, two special options that depend on the initial value loaded into the latches are available. If the low-order byte of the initial counter value is O. then. as we might expect. there is no high output signal (0) pulse (assuming that the output signal is enabled); however. on each time out the output signal changes levels to create a square wave that is similar to a 16-bit counting. This may be illustrated as follows: \~ ___~I I \ 0 I I 1-- p TO MC6840 CONTINUOUS 8-BIT COUNTING SQUARE WAVE OPTION I I I I "'1" TO -I- p I I --I p TO TO MC6840 CONTINUOUS MODE WITH o INITIAL VALUE When operating in Continuous mode with either S-bit or 16-bit counting. if the initial value loaded into the latches is O. then Counter registers are not decremented and a square wave is output with half the clock frequency. This may be illustrated as follows: <1>2 or C ---1 o --..J \ I \ \ I \ I I I I I I TO TO TO I 9-103 I L Time outs occur on every transition of O. Since interrupts could not possibly be serviced every other clock pulse. they should be disabled (by having 0 in Control Registets 1 to 6) for any counter/timer element operating in the form illustrated above. Note again that in any operating mode, continuous or otherwise, when the external clock (C) is selected, you are in fact counting events, Hot time. Although all of our illustrations show a synchronous clock signal with all active transitions evenly spaced. in reality active transitions could be quite rahdciin. This may be illustrated as fbllows: MC6840 EVENT COUNTING n1~1 C--1 COUNT COUNT COUNT COUNT If random timing is present on the external clock (C). then wave forms. if output via the output signal (0). will not be uniform. This is something you may wish to use when counting external events. You could. for example. use continuous operating mode with 8-bit counting to count a fixed numbe~ of events. but to signal shortly before this fixed number of events has occurred. Suppose you wish to count 100 events. with a signal identifying the 90th event. This could be done loading 090916 as the initial Counter register value: TO Event Numbers ...... \-------------~ +4 + I \ a ~ + 90 100 90 0 TO I I 100 The low-to-high 0 signal transition must now be used to generate an interrupt request. Time Out (TO) interrupt requests mayor may not be disabled. Note again that the three sets of counter/timer logic are totally independent of each other. The manner in which you operate one set of counter/timer logic has no bearing whatsoever on the manner in which you operate either' of the other two sets of counter/timer logic. The primary difference between one shot mode and continuous mode is that following the first time out the output signal (0), if enabled, is disabled. In single shot. 16-bit counting mode. the output signal (0) docs not make its lo\'v-to-high transition until he end of the first clock pulse. This may be illustrated as follows: -----FU <1>2 or C r---------- a MC6840 ONE SHOT MODE ----~ Initialize Time out Re-initialize Time out In single shot. 8-bit counting mode. the output ~ignal is simply disabled after the first time out. The counterltimer continues to run and time outs continue to be generated. but the output signal (0) remains disabled until the counterltimer is re-initialized. Another difference between One shot mode and continuous mode is that in one shot mode you do not stop the counterltimer by inputting the Gate signal (G) high. Recall that in continuous mode. if the counter/timer has been initialized by inputting a high-to-Iow Gate (G) pulse. you can stop the counterltimer at any time by inputting the Gate signal (G) high again. This property of the IT input applies only in continuous mode. 9-104 Notice that the two special continuous mode conditions that result when the low-order Counter register byte is initially o or the entire Counter register contents are initially 0 do not apply in one shot mode. This is because in continuous mode nothing happens to the output signal until the end of the first time out. at which time in one shot mode the output signal is disabled anyway. Q w ~ oIl.. II: II: o CJ ~ MC6840 frequency comparison and pulse width measurement modes are almost identical; they differ only in the active levels of the G input. The frequency comparison and pulse width measurement modes both compare the time interval of a pulse. input via the IT signal. with the time interval to a time out. In frequency comparison mode a highG pulse is measured. You can select frequency comparison mode with Gate pulse by having 001 in control register bits 5. 4. and 3 as described earlier; then an interrupt request will be generated if the G signal makes a high-to-Iow transition before a time out occurs. This may be illustrated as follows: en w I- ct <1>2 or C _J\.J\JL G --~ (3 oCI) CI) ct call MC6840 FREQUENCY COMPARISON AND PULSE WIDTH MEASUREMENT MODE 5 w Z II: oIn CI) o :E ct c ct @ Initialize Time out, no interrupt Re-initialize Request interrupt since time out has not occurred As illustrated above. if the G signal makes its high-to-Iow transition after the time out occurs. then no interrupt is requested. The Counter register is reloaded from the latches and continues to decrement. but time outs do cause interrupt requests or Status register bit settings. Until the counter/timer is re-initialized by a high-to-Iow transition of the G input signal. it continues to run freely as though it were in continuous mode. but time outs lose their significance. Once the counterltimer is re-initialized by a high-to-Iow G transition. then frequency comparison logic begins again. If following an initialization or re-initialization the G input does make a high-to-Iow transition before a time out occurs. then an interrupt will be requested and the counterltimer logic is stopped; it cannot be re-initialized until the interrupt has been cleared. Clearing interrupts is described in conjunction with our discussion of the Status register. Once an interrupt has been cleared. then on the next high-to-Iow transition of the gate input. counterltimer logic will be re-initialized. In other words. between the time an interrupt request occurs and the interrupt is serviced. high-to-Iow transitions of the IT input are ignored. Observe that you can select either 8-bit or 16-bit counting modes in order to generate time outs when operating'the MC6840 in frequency comparison or pulse width measurement modes. You select frequency comparison mode with time out shorter by loading 101 into bits 5, 4, and 3 of the Control register. Now an interrupt request will occur if the G input makes its high-to-Iow transition after the time out has occurred. We can compare the previous illustration for frequency comparison mode with Gate pulse shorter. using the illustration below for frequency comparison mode with time out shorter: Time out .JlJU <1>2 or C ---j G Initialize Request interrupt since time out precedes Gate high-tolow pulse 9-105 Re-initialize Gate high-to-Iow pulse precedes time out. No interrupt request occurred Once again, if an interrupt occurs the counter/timer will stop, It cannot be restarted until the interrupt is cleared and the G input makes a high-to-Iow transition, Pulse width comparison modes are identical to frequency comparison modes, with the exception that once'a counter/timer is operating, low-to-high transitions of the gate input are active. The frequency comparison modes may ,therefore be reproduced for pulse width comparison equivalents, as follows. First. here is pulse width comparison mode with Gate pulse shorter: _nnJ <1>2 or C G Initialize Time out, no interrupt Re-initialize Request interrupt since time out has not occurred Next. here is pulse width comparison mode with time out shorter: <1>2 or C G Initialize Requ~st interrupt since time out precedes Gate high-tolow pulse Re-initialize Gate high-to-Iow pulse precedes time out. No interrupt request Notice that in pulse, width comparison mode, initialization and re-initializatioh require a high-to-Iow although the end of the G pulse is marke'(j by a low-to-high'G transition, G transition. THE MC6844 DIRECT MEMORY ACCESS COf\JTROLLER' The MC6844 Direct Memory Access controller provides MC6800-based microcomputer systems with logic to support four direct memory access channels. This device has been designed to work with the unique timing logic of MC6800 and MCS6500 microcomputer systems; it, should therefore be used with MC6800 and MCS6500 microcomputer systems only. That is why, the MC6844 is described in this chapter rather than in Volume 3. From our discussion of the MC6800 CPU, recall that this microprocessor alloVlfs its system clock to be stretched s,C? that direct memory access operations may be intermingled with normal instruction execution. Alternatively, the MC6800 may be put into a Halt state during which the CPU disconnects itself from the system busses; externallogic then accesses memory by mimicking CPU signals on the Address, Data and Control Busses. Logic of the MC6844 DMA controller allows you to perform Direct Memory Access operations using either clock stretching or Halt state techniques. Two noteworthy features of the 8256 DMA controller, described in Chapter 4, are also available with the MC6844 DMA controller. These noteworthy features are: 1) The ability to assign permanent priorities to the four DMA channels or to rotate priorities on a round-robin basis. 2) By reducing the number of DMA channels to three, one DMA channel can be used for the recursive DMA transfer of fixed length or chained records. Figure 9-31 illustrates that part of our general microcomputer system logic which has been implemented on the MC6844 DMA controller device. 9-106 Clock Logic Q w Ie( a: 0 na: Logic to Handle Interrupt Requests from External Devices Accumulator Registens) 0 0 ~ Data Countens) u) w le( g Stack Pointer (/l (/l e( G!I w Z a: 0 ID Interrupt Priority Arbitration Program Counter (/l 0 ~ e( Q e( System Bus @ Interface Logic Interface Logic . Programmable Timers Read Only Memory I/O Ports Interface Logic I/O Ports Figu re 9-31. Logic of the MC6844 DMA Controller The MC6844 DMA controller chip is fabricated using N-channel silicon gate MOS technology. It is packaged as a 40-pin ceramic or plastic DIP. All signals are TTL-compatible. MC6844 DMA CONTROLLER PINS AND SIGNALS Figure 9-32 summarizes MC6844 DMA pins and signals. Many of these signals have MC6800 counterparts; therefore we will describe them within the context of a general MC6844 device discussion. 9-107 (GNO)VSS CS/TxAKB R/YV AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 VDD .... ....-.. -- .... . ---- -..... ---- - --~ .... --- --.. ---.. 1 40 2 3 4 39 38 37 5 6 7 36 35 34 8 9 10 11 33 32 31 MC6844 OMA CONTROLLER 30 12 13 14 15 16 17 29 28 27 26 25 24 18 19 20 23 22 21 .- ----- ---- --. .--. .. ---.... .. ---- -.... --. ---- .--.. --- _a 2DMA RES DGRNT ORQT ORQH TxAKA TxSTB IRQ/OENO TxRQO TxRQ1 TxRQ2 TxRQ3 DO 01 02 03 04 05 06 07 PIN NAME DESCRIPTION TYPE DO - 07 AO - A4 A5 - A15 R/W IRQ/DENO ORQH ORQT DGRNT CS/TxAKB TxAKA TxSTB TxRQO - TxRQ3 2DMA RES Bidirectional Data Bus Four low-order Address Bus lines and Register Select lines Address Bus lines Read/Write Control Interrupt request and end of OMA indicator DMA Hold Request DMA Clock Stretch Request DMA Acknowledge Chip Select and Device Acknowledge Device Acknowledge DMA I/O Device Strobe OMA Service Request Clock Input . System Reset Power and Ground Tristate, bidirectional Tristate, bidirectional Output Bidirectional Output Output Output Input Bidirectional Output Output Input Input Input VSS' VOO Figure 9-32. MC6844 DMA Controller Signals and Pin Assignments 9-108 MC6844 ADDRESSABLE REGISTERS Logic associated with each DMA channel consists of a 16-bit Address register, a 16-bit Byte Count register and an 8-bit Control register. There are three additional registers which are shared by the four DMA channels. These are a Priority Control register, an Interrupt Control register and a Data Chain Definition register. These may be illustrated as follows: c w S-bit Control ~ o Do a: ~--------------------~ u) w S-bit Priority ~_ _ _ _.... Control register I ~ g U) o Cha~nel 1 Registers I These three Control Registers apply to all four DMA channels 16-bit Byte Count ~-------------------~ S-bit Interrupt _ _ _ _ _ _ Control register I '1 S-bit Control } 16-bit Byte Count Cha~nel 2 Registers 16-bit Address I .......-----------1- ::!: « c « @ } 16-bit Address « oa:I S-bit Control t---------------I. U) U) w Z Registers 16-bit Address !: a: Cha~nel 0 I t---------------I- a: o o all } 16-bit Byte Count ---------------------~ S-bit Data Chain Definition register I ~_ _ _ _--' S-bit Control 16-bit Byte Count I t---------------I. } Cha~nel 3 Registers 16-bit Address ---------------------~ The transfer of any block of data via DMA begins with an initial memory address. byte count and DMA mode being specified via the registers illustrated above. As each byte of data is'transferred. the method of data transfer is controlled by options selected via the Control register. The Address register identifies the memory location which will be accessed during the DMA transfer; Address register contents may either be incremented or decremented following each DMA transfer. The Byte Count register contents are always decremented following each data transfer. and the DMA operation ends when the Byte Count register contents reach O. The MC6844 DMA controller is accessed by the CPU under program control as 23 memory locations. Individual memory locations are selected via address lines AO - A4, as defined in Table 9-12. When writing into or reading out of 16-bit registers. you will usually use the LDX and STX instruction; that is to say. the most efficient method of transferring 16-bit data between the CPU and MC6844 DMA controller is via the CPU Index register. r-------_ Note carefully that addresses given in Table 9-12 apply only when the CPU accesses the MC6844 DMAC MC6844 DMAC under program control to initialize a DMA transfer or to monitor DMA DATA BUS operations. These memory addresses have no significance to actual DMA logic. Furthermore. the MC6844 DMAC Data Bus connection to the MC6844 DMA controller plays no part during a DMA operation. Data ADDRESS BUS is transferred between the CPU and the MC6844 DMAC, via the Data Bus (DO - 07) only while the CPU is accessing MC6844 addressable locations under program control. Actual data transfers between an external device and memory occur via the microcomputer system Data Bus. completely bypassing the Data Bus connection to the MC6844 DMA device. However. during DMA data transfers. addresses and control signals are output from the MC6844 DMAC to the System Bus via the Address Bus lines AO - A 15 and appropriate control Signal outputs. This is standard DMA logic. If you do not understand these DMA operations. see the discussion of direct memory access given in Volume 1 before proceeding further with this description of the MC6844 DMAC device. MC6844 The CPU may access the MC6844 DMAC under program control at any time by simply executing an instruction which references one of the 23 memory addresses set aside for the MC6844 DMAC DMAC device. The MC6844 DMAC is selected by a low CS pulse. This low pulse must be generated by DEVICE appropriately decoding Address Bus lines A5 through A 15. together with VMA. VMA must conSELECT tribute to MC6844 device select logic to guarantee that spurious selections do not occur during a DMA transfer or while the Address Bus is floated. In this context it is important that only a VMA Signal output by the 9-109 MC6800 CPU be used by MC6844 device select logic. During a DMA operation. the MC6844 DMAC generates its own VMA equivalent via TxSTB. TxSTB must be excluded from MC6844 device select logic. Here is one possibility: ..------ T~~! -------tlT~D "System" VMA MC6844. SELECT - - - - - - - - ' CONTRIBUTION Depending on the number of active MC6844 DMA channels, CS may become a bidirectional signal; TxAKB is output via the same pin as the CS input. In this case remember that CS must be generated as an open collector gate output. . We will discuss the individual MC6844 addressable locations and the way in which you will program them after describing MC6844 operating modes. MC6844DMA TRANSFER MODES You can select, under program control, one of three modes via which DMA transfers will occur for each of the four MC6844 DMA channels. You can mix and match' separate and distinct modes for each of the four channels in any way since each channel has its own Control register. We will begin our discussion of modes by looking at all three modes superficially before examining each one in detail. First there is Three-State Control, Cycle Stealing mode. In this mode the MC6800 CPU clock is stretched with <1>2 low while the MC6844 device transfers a single byte of data via direct memory access. This may be illustrated as follows: <1>1 <1>2 <1>2 (DMA) Transfer one byte of data. via DMA Normal program execution Normal program execution We have discussed clock stretching logic of the MC6800 microco'mputer earlier in this chapter. The second and third MC6844 DMA transfer modes both force the MC6800 CPU into a Halt state which floats the System Bus. The Halt state may last long enough for a single byte of data to be transferred via direct memory 9-110 access. in which case the mode is referred to as Halt, Steal mode. This may be illustrated as follows: <1>1 cw ~ oDo <1>2 a: Normal program execution a: o Halt long enough to transfer one byte of data via DMA CJ ~ iii w ~ g (I) (I) Normal program execution The Halt state may be maintained for as long as it takes to transfer an entire block of data; that is to say. until a channel's Byte Count register decrements to O. This is referred to as Halt Burst mode. c( MC6844 DMAC THREE-STATE CONTROL, CYCLE STEALING MODE "' Let us now look at the different DMA modes in detail beginning with the three-state control cycle stealing mode. Timing for this mode is given in Figure 9-33 and appropriate pin connections are given in Figure 9~34. w Z a: o III (I) c o C U D U c c c ~ c( c <1>1 c( @ <1>2 <1>2 (DMA) TxRQN DROT DGRNT 'iXSTB . TxAKA.TxAKB AO - A15 R/W C - CPU operations machine cycle U - Unused machine cycle D - DMA machine cycle Figure 9-33. Timing for Three State Control. Cycle Stealing Direct Memory Access wi!h the MC6844 9-111 c --. _. HALT IRO en 0 6 6 ~ ;e: ~ N 0& ~ - 07 ;:: AO ;;.. Al ;;. A2 A3 A4 A5 • •• VMA BA TSC DBE R/W ··· .--:. . .- j~ ~ ~ .~ -- , ~ .....A5 .~ <1>2 (TTL) R/W A15 lit CS - -- + DMA/REF REO REF GRANT BA SYSTEM VMA r- . RESET DMA/REF REO A15 HALT .~ SELECT~: DEVICE LOGIC Ii '---", DO : :. - MC6800 CPU en 0 .--- ~ -- MEMORY CLOCK_ MC6875 CLOCK ii CS/TxAKB DROT REF GRANT --:..- j AO A4 DGRNT A15 DO <1>2 (DMA) MC6844 TxAKB TxAKA TxSTB ~ -. . -.. . 07 DMAC R/W ~ IRO/DEND TxAKA TxSTB TxRQO - REF GRANT bO- DEND TxROO TXR03 14d------..,...------=---TXR03 ... Figure 9-34. An MC6844 DMAC Connected for Three State Control. Cycle Stealing Direct Memory Access A DMA operation begins when an external device makes a DMA access request by inputting a MC6844 DMAC high signal via one of the four inputs TxROO through TxR03. This input to the MC6844 DMAC TxRON, DQRT may be asynchronous. The MC6844 responds by outputting DROT low. This low output must DGRNT SIGNALS be connected to the MC6875 clock CMA/REF REO input. This connection causes the MC6875 MC6844 DMAC clock device to stretch the <1>1 and <1>2 clocks at the end of the next machine cycle - with <1>1 high and <1>2 low. The onset of the stretched clocks is identified by the MC6875 device output-' <1>2 DMA CLOCK ting REF GRANT high. This signal must be input to the MC6844 DGRNT pin. The DMA data transfer now occurs. taking three machine cycles to transfer one byte of data. Machine cycles are timed by <1>2 DMA. which is the memory clock output of the MC6875 device. Recall that when the MC6875 clock device receives a low input via DMA/REF REO it does not stretch the memory clock output. The MC6844 DMAC needs a <1>2 DMA input only while a DMA data transfer is in progress. <1>2 DMA is therefore frequently the AND of MEMORY CLOCK and REF GRANT: REFGRANT-----~~&_---------DGRNT MEMORY CLOCK ------:--u-~------<1>2DMA 9-112 ow ~ a: oQ. a: o o ~ u) As soon as clock stretching begins. the MC6800 CPU must float the System Bus. This may be done by inputting the REF GRANT signal to the MC6800 TSC pin as well as to the MC6844 DGRNT pin. Now REF GRANT input to TSC will cause the MC6800 CPU to float its Address Bus and three-state control signals. If DBE is connected to <1>2. as is usually the case. then the low <1>2 signal will automatically cause the MC6800 CPU to float the Data Bus. Now as soon as REF GRANT goes high. the MC6800 CPU is disconnected from the System Bus and the MC6844 DMAC can become bus master. The MC6844 DMAC takes control of the System Bus for three machine cycles. during which it transfers a single byte of data. The first and third machine cycles represent setup time. The actual DMA transfer occurs during the second machine cycle. For the memory end of the DMA transfer. the MC6844 DMAC outputs a memory address via the Address Bus. For the I/O device end of the DMA transfer. the DMAC identifies the direct memory access channel being acknowledged via the output signals TxAKA and TxAKB. as follows: w TxAKB TxAKA g o 0 1 1 0 1 ~ o (/) (/) c( ell ILl Z a: o CD (/) o :E c( o c( @ 1 MC6844 DMAC TxAKA AND TxAKB SIGNALS Acknowledged TxROO TxROl TxR02 TxR03 Timing for signals output by the MC6844 DMAC conform to normal MC6800 System Bus timing for a memory read or memory write operation. The low TxSTB pulse substitutes for VMA at the memory and I/O device ends of the DMA. transfer. : The direction of the DMA transfer is defined by the level of the R/W signal: the interpretation of this signal conforms to normal memory read and write operations: MC6844 DMAC fiSTS SIGNAL R/W low causes data to flow from the I/O device to memory. RIW high causes data to flow from memory to the I/O device. Data may flow freely across the Data Bus during the direct memory access operation. since both the MC6800 CPU and the MC6844 DMAC are disconnected from the Data Bus at this time. As each byte of data is transferred. the Byte Count register contents for the selected DMA channel are decremented; but the Address register contents may be either incremented or decremented. depending on the Control register option selected. When the Byte Count register contents decrement to O. a low pulse is output via IRO/DEND. This pulse can be used to generate an interrupt at the MC6800 CPU and/or it may be used to tell the external device that the current data transfer has gone to completion. MC6844 DMAC iRQ/DEND SIGNAL The interrupt request output IRO/DEND will pulse low when the Byte Count register decrements to 0 only if interrupts have been enabled for this DMA channel via its Interrupt Control register. If interrupts have been enabled. it is a good idea to guard against spurious interrupt requests by conditioning IRO/DEND with the DGRNT high pulse. The interrupt request input to the MC6800 CPU should be an open collector signal generated as follows: ~___'f - - - - - - - DGRNT _ _ _ _ _ _ IRQ (open collector) IRQ/DEND The DEND signal output to I/O devices may be ANDed with REF GRANT or with TxSTB. An AND with TxSTB is illustrated in Figure 9-34. . Assuming that the acknowledged DMA channel is transferring data at less than maximum speed. it must use the low TxSTB strobe to remove its TxRON high request. If the channel keeps its TxRON DMA request active. then the next DMA transfer will occur during the next machine cycle. Using Three-State Control. cycle stealing direct memory access. therefore. it is possible to transfer a byte of data during every machine cycle;. however. each machine cycle will have its length increased by three machine cycles. Thus. any executing program will be reduced to executing at one quarter of its normal execution speed. MC6844 DMAC HALT MODES The next DMA operating mode we are going to look at is the Halt Cycle Stealing mode. In this mode the CPU is halted for three machine cycles. during which a single byte of data is transferred. Timing is illustrated in Figure 9-35 and appropriate pin connections are illustrated in Figure 9-36. 9-113 C C C U o U C C <1>1 <1>2 TxRQN BA-OGRNT VMA TxAKA,TxAKB ------------------------~~~--------~~~~--------------~ R/W AO - A15 DO - 07 C - CPU operations machine cycle U - Unused machine cycle, o - OMA machine cycle Figure 9-35. Timing for Halt. Cycle Stealing Direct Memory Access with the MC6844 A DMA transfer is initiated by one of the four DMA request signals TxRO through TxR3 going high. These signals are sampled on the rising edge of <1>2. The MC6844 responds to a high DMA transfer request by outputting DROH low. In the Halt. Cycle Stealing mode, DROH must be input as the MC6800 CPU halt request. As explained earlier in this chapter, when a low input occurs at HALT, the MC6800 CPU complet~s executing its current instruction, then enters a Halt state, During the Halt state, VMA is output low while the Address and Data Busses, along with the R/W control signal. are floated. In Figure 9-35 the Halt state is shown beginning one full machine cycle after DROH goes low. MC6844 DMAC TxRO - TxR3 SIGNALS MC6844 DMAC DRQH SIGNAL The MC6800 CPU indicates the onset of the Halt state by outputting BA high. This output MC6844 DMAC becomes the DGRNT input to the MC6844. Once DGRNT goes high, the MC6844 assumes DGRNT, TxSTB, control of the System Bus. TxSTB is pulsed low as a substitute for the VMA signal. The address TxAKA AND of the memory location to be accessed during the DMA transfer is output on the Address Bus TxAKB SIGNALS along with the R/W, which indicates the direction of the DMA data transfer (as described for three-state control cycle stealing mode). The DMA channel being acknowledged is identified via the TxAKA and TxAKB signals, which are decoded as described earlier. 9-114 --.-.. • __ DO · - c w !;( a: oc. MC6800 CPU • ; -:. 07 AO ;,;. A1 ~----------------------~j~--~+----------------~~A2 ~------------------------~--~+----------------~~A3 ~------------------------~~~+----------------~"A4 __ ~--------------------~~~j-4-+--------------.~"A5 ~~:____________________~J~~~+-____________~.~~~ A15 a: o o ~ enw !;( (3 oen en ct olS w a: Z oIn en o DEVICE SELECT LOGIC Ii SYSTEM VMA ' - - -......- - - ' A15 CS :!: ct c ct -_. e---------~~~~~--~~--------~.. RESEft @ CLOCK I...-. ~ L---,-~ oRQH oGRNT -+--------~ O--------~~ CS/TxAKB TxAKB TxAKA TxSTB AO~. A4 _. A15 • _. <1>2 (oMA) MC6844 .....:-1-=-.______~ oMAC 07 ~O. R/'iiiWJ 1oI_d---------...J IRQ/oENo ~oENo TxAKA~--------------~ TxSTB~--------------~ TxRQO~~~:----------------------~:-- TxRQ3 _ TxRQO TxRQ3 Figure 9-36. An MC6844 DMAC Connected for Halt. Cycle Stealing or Halt Burst Direct Memory Access MC6844 DMAC The VMA signal used by the system must now be the OR of VMA and TxSTB. The external device whose DMA request has been acknowledged must detect the low TxSTB signal and use TxSTB SIGNAL it to reset its DMA request. If the DMA request is still active after a single byte of data has been transferred via DMA. then a single instruction will be executed before the next byte of data is transferred via direct memory access. One instruction will be executed even if TxRON remains high. because in Halt Cycle Stealing mode the MC6844 will return its DROH Signal high as soon as a single byte of data has been transferred via direct memory access. This will free the CPU. to execute another instruction. and while this new instruction is being executed the whole timing process illustrated in Figure 9-35 will begin again. When the Byte Count register contents decrement to O. the IRO/DEND signal will output low. As was the case for Three-State Control Cycle Stealing mode. this signal can be used to request an interrupt and/or to identify the end of a data transfer block to external logic. It is a good idea to condition interrupt requests and DEND outputs with TxSTB in ' order to avoid generating spurious signals. The third and last MC6844 DMA mode is the Halt Burst mode. This differs from Halt Cycle Stealing mode in that once a Halt condition has been initiated. it is maintained while data is transferred via direct memory access until the Byte Count register has decremented to O. Thus. Halt Burst mode timing will differ from Figure 9-35 only in that DROH will remain low until the channel's Byte Count register decrements to O. This will happen irrespective of the level on the DMA request line TxRON. Note that. as illustrated in Figure 9-35. one byte of data will be transferred via direct memory access in three machine cycles. even when operating in Halt Burst mode. Pin connections for Halt Burst mode are as il. lustrated in Figure 9-36. 9-115 COMPARING MC6844 DMAC MODES You will use Three-State Control. Cycle Stealing mode when program execution time is critical but data transfer rates are not. You will use Halt-Cycle Stealing mode when data transfer rates are not critical. program execution time is important and you do not have an MC6875 clock device. You will use Halt Burst mode when data transfer rates are criticai and program execution time is not. Table 9-13 summarizes maximum data transfer rates for the three modes. A /-Lsec machine cycle time is assumed. Table 9-13. MC6844 DMAC Modes' Response Times and Transfer Rates Mode Response Time (/-Lsec) Maximum Transfer Rate KHz TSC Steal Halt Steal Halt Burst 2.5 to 3.5 3.5 to 15.5 2.5 to 3.5 250 200 - 67 1000 USING AN MC6844 DMAC WITH MIXED MODES If you are going to use Three-State Control and Halt modes with a single MC6S44 DMAC device. the only special precaution ne~dedi~ to generate DGRNT as the OR of BA and REF GRANT. The Three-State Control and Halt modes have separate DMA request lines. DROT and DROH. respectively: therefore no special logic is needed to handle DMA requests using mixed modes. THE MC6844 CONT~OL REGISTERS AND OPERATING OPTIONS· As summarized in Table 9-12. the MC6S44 DMAChas a number of programmable Control registers. which are used to select the DMA transfer modes which we have already described. plus additional operating options. '-M-C-6S"'44---' The best place to begin a discussion of Control registers is with the Enable/Priority Control ENABLE/ register. Bit settings for this register may be illustrated as follows: PRIORITY 654 3 o 4--BitNo. CONTROL REGISTER Enable/Priority Control Register f Channel OJ L--_ _ _ _ L........_ _ _ _ _ _ Channel 1 Channel 2 0 - Disable Channel. 1 ~ Enable channel "----------Channel 3 '------------Unused ~------------- 0 - Fixed priority 1 - Rotating priority Each DMA channel that is to be active must have a 1 placed in its enable bit within the Enable/Priority Control register. A 0 in any channel's enable bit will disable the channel. It is important to understand that if a channel is disabled. this simply means that DMA requests arriving via the associated TxRON input will be ignored. Disabling a DMA channel has no effect on your ability to write into the channel's registers or read from the channel's registers. If more than one DMA channel is enabled. then two or more DMA requests can occur simultaneously. You arbitrate priority in one of two ways. If bit 7 of the Enable/Priority Control register is O. the following fixed priorities will always be used: Highest Priority: Lowest Priority: Channel Channel Channel Channel 9-116 0 1 2 3 MC6S44 FIXED DMA PRIORITY ARBITRATION c Rotating priority may be selected by writing a 1 into bit 7 of the Enable/Priority Control register. Rotating priority initializes the four channels with the fixed priority illustrated above. As soon as any DMA channel has been serviced. however. it becomes the lowest priority channel - and associated channels are rotated in a round-robin fashion. In order to illustrate rotating priority mode. let us assume that DMA Channel 2 is serviced and then DMA Channel 0 is serviced. This is how priorities would be assigned: UJ Initial Priority: Highest Priority: ~ 0: ono: o CJ Lowest Priority: ~ en UJ ~ Highest Priority: en ~ UJ Lowest Priority: 0: Highest Priority: o IX! en o ~ Lowest Priority: c( @ Channel Channel Channel Channel 3 0 1 2 Channel Channel Channel Channel 1 2 3 0 Channel 0 is serviced. These are the new priorities: Z cc( 0 1 2 3 Channel 2 is serviced. These are the new priorities: g o!I Channel Channel Channel Channel MC6844 ROTATING DATA PRIORITY ARBITRATION The next Control register we will look at is the Data Chaining Control register. because this also contributes to channel enable logic. Data Chaining Control register bit assignments may be illustrated as follows: 7 6 4 2 o -4--BitNo. MC6844 DATA CHAINING CONTROL REGISTER Data Chaining Control Register ' - - - - 0 - Disable data chaining function 1 - Enable data chaining function ~----- 00 - Chain Channel 3 to Channel 0 01 - Chain Channel 3 to Channell 10 - Chain Channel 3 to Channel 2 11 - Illegal ' - - - - - - - - - - 0 - Select 2 channel mode 1 - Select 4 channel mode '------------Unused Bit 3 of the Data Chaining Control register is. in fact. an enable/disable bit for the TxAKB output function associated with the CS/TxAKB signal. TxAKB is disabled if the Data Chaining Control register bit 3 is O. This is referred to as Two-Channel mode. because with only TxAKA enabled it is only possible to acknowledge DMA requests from channels 0 or 1. This may be illustrated as follows: TxSTB TxAKA' rt;;=D______ ~ 9-117 SELECT 1 SELECT 0 MC6844 DMAC TWO-CHANNEL MODE If the Data Chaining Control register bit 3 is 1, then the TxAKB signal is active, allowing anyone of the four DMA channels to be acknowledged. This is referred to as Four-Channel mode, and may be illustrated as follows: MC6844 DMAC FOUR-CHANNEL MODE TxSTB-------------------------~~r--------------------------~ C TxAKA-----------------------------------------------~~ A YO SELECT 0 Y1 SELECT 1 Y2 SELECT 2 Y3 SELECT 3 74155 CS/TxAKB~----------------------------------------_e~~ B G CS-------I DGRNT----------~ - (open collector gate here) The logic above uses the TxSTB pu Ise as a strobe for a 2-to-4 decoder. The four decoder outputs become individual select lines for the four devices capable of requesting DMA access. In order to rotate CS/TxAKB requirements. chip select creation logic is shown. This logic has nothing to do with generationof the Select 0 through Select 3 lines: however. unless the chip select input portion of the CS/TxAKB signal is correctly generated. TxAKB will either be held at ground or pulled to a level of 1. in which case the four~channel select logic will not work. . It is very important to note that there is no direct connection between the logic of the Data Chaining Control register bit 3 and the Enable/Priority Control register bits 0 through 3. Whether you select Two-Channel mode or Four-Channel mode via bit 3 of the Data Chaining Control register. you can independently enable or disable each of the individual channels via Enable/Priority Control register bits 0 through 3. Clearly. there are certain combinations which are not reasonable. Options may be illustrated as follows: Data Chaining Control Register Bit 3 Enable/Priority Control Register Bit3 Bit 2 Bit 1 BitO 0 0 0 0 0 Select Two-Channel mode. but channels 0 and 1 are disabled. 0 0 0 0 0 0 0 1 1 0 Select Two-Channel mode. but only channel 0 or channel 1 is enabled. 0 0 0 1 1 Normal Two-Channel mode with both channels active. 0 0 1 X X 0 1 1 X X In Two-Channel mode you can enable channels 2 and 3. Their DMA requests will be accepted via TxR02 and TxR03. but DMA requests will not· be acknowledged via TxAKB. Channels 0 and/or 1 must be enabled. 1 0 0 X X Four-Channel mode with channels 2 and 3 disabled makes no sense. Use Two-Channel mode instead. 1 0 1 X X Four-Channel mode with channel 2 and/or 3 enabled. and any enable/disable combination for channels 0 and 1 is alright. 1 1 1 X X - 9-118 If you enable data chaining by writing a 1 into the Data Chaining Control register bit 0, then DMA operations at channel 0, 1 or 2 become continuous. Via bits 1 and 2 of the Data Chaining Control register. you select channel O. 1 or 2 to operate in Chained mode. cw ~ a: oa.. a: o CJ ~ ui w ~ g en en c:( o!I w z a: o en en o ~ c:( c c:( @ MC6844 DATA CHAINING Chained mode simply means that as soon as the selected channel's Byte Count register decrements to O. the selected channel's Byte Count and Address registers will be reloaded with values stored in the Channel 3 Byte Count and Address registers. Suppose. for example. you want to continuously transfer. via direct memory access. 256 bytes of data. The data is to flow via Channel 0 to memory. with the data being loaded in memory locations OA0016 through OAFF16. To perform this task you would store 00FF16 in the Channel 3 Byte Count register. and OA0016 in the Channel 3 Address register. lyIJe assume that the Address register is going to be incremented.) Every DMA transfer will begin with 00FF16 being loaded into the Channel 0 Byte Count register from the Channel 3 Byte Count register. while OA0016 is loaded into the Channel 0 Address register from the Channel 3 Address register. This is an automatic operation which requires no program intervention once data chaining has been enabled. Thus. DMA transfer via Channel 0 will continue endlessly with the DMA transfer rate determined by the DMA mode selected. It is important to note that a data chaining specification is to MC6844 DMAC logic an isolated event. The fact that data chaining has been enabled does not automatically disable DMA Channel3 logic. You must do this by writing 0 into the Enable/Priority Control register bit 3. Also. if you specify chaining. you in no way affect the manner in which registers can be accessed. You can write into Channel 3 registers. or you can read the contents of Channel 3 registers. This can be very useful. If 256 bytes of data are continuously bOeing read into memory locations OA0016 through OAFF16. it wou Id take complex program logic to access all data that gets written into this buffer before the data gets overwritten on the next DMA pass. A better way would be to have two buffers: for example. the first from OA0016 through OAFF16 and the second from OB0016 through OBFF16. Now. following each end of block interrupt. you would write the new address into the Chan-' nel 3 Address register. This is illustrated in Figure 9-37. There are some nonobvious aspects of Figure 9-37. Observe that when you are initializing the MC6844 operating in Chained mode. you must load initial addresses and byte counts in Channel 3 Address and Byte Count registers as well as in the Address and Byte Count register for the chained channel. The actual chaining operating does not occur until the chained channel's Byte Count register decrements to O. When you start the chained channel. the first DMA operation uses initial Byte Count and Address values loaded into the chained channel's Byte Count and Address registers. After the first end-of-block interrupt. the byte count and address values loaded into the Channel 3 registers will be transferred to the chained channel registers for the next operation. Let us now consider the Channel Control register which is associated with each DMA channel. Channel Control register bit assignments may be illustrated as follows: 7 6 5 4 3 2 o ~BitNo. MC6844 CHANNEL CONTROL REGISTERS Channel Control register L..-_ _ _ _ _ _ _ 0 - Increment Address register 1 - Decrement Address register ' - - - - - - - - - - - - - Unused 0- DOne} . 1 _ Busy Read-only, Status bit o - Not end of DMA block l 1 - End of DMA block f Read-only, DEND status bit Channel Control register bit 0 simply reflects the level which will be output on the RIW pin during DMA operations that is to say. while R/W is an output from the MC6844 DMAC. Channel Control register bit 0 has no effect on R/W while the MC6800 CPU is accessing the MC6844 DMAC under program control. The level of the R/W Signal during a DMA operation determines whether data will be transferred from the I/O device to memory (R/W is low). or from memory to the I/O device (R/W is high). Since each DMA channel has its own Control register and therefore its own Control register bit O. channels may be programmed independently to generate DMA transfers in either direction. 9-119 C , Start ) , Load 00FF16 into Channel 0 and Channel 3 Byte Count registers Load OAOO16 into Channel 0 Address register t , Load 0800 16 into Channel 3 Address register Start Channel 0 _ l --""J Channel 0 Interrupt. 080016 is transferred from Channel 3 Address register to Channel 0 Address register. OOFF16 is loaded from Channel 3 Byte Count register to Channel 0 Byte Count register , Load OAOO16 into Channel 3 Address register l Process data in buffer OAOO16 through OAFF16 l Channel 0 Interrupt. OAOO16 is transferred from Channel 3 Address register to Channel 0 Address register. OOFF16 is loaded from Channel 3 Byte Count register to Channel 0 Byte Count register + Load 080016 into Channel 3 Address register l Process data in buffer 080016 through OBFF16 I Figure 9-37, Logic for MC6844 DMAC with Channel 3 Chained to Channel'O and Data Flowing into Alternate Memory Buffers 9-120 Channel Control register bits 1 and 2 are used to select one of the three DMA transfer modes which we have just described. Channel Control register bit 3 determines whether the channel's Address register contents will be incremented or decremented following each DMA transfer. Thus you can perform a DMA operation specifying the highest address or the lowest address of a memory buffer as the starting address.· c w Channel Control register bits 4 and 5 are unassigned. a: Channel Control register bits 6 and.7 are read-only status bits which should be looked at in conjunction with the Interrupt Control register. Interrupt Control register bits are assigned as follows: ~ a: o 0. o (J ° 65432 ~ MC6844 INTERRUPT CONTROL REGISTER -4--BitNo. iii w Interrupt Control register ~ g en en °- ChannelO} ......- - - - Channel 1 Disable interrupt request ' - - - - - - - - Channel 2 1 - Enable interrupt request ~ all w Z ......- - - - - - - C h a n n e I 3 a: ocg ......- - - - - - - - - - Unused No interrupt request pending 1 - Interrupt request pending . . . -------------°- en o ~ ~ c ~ @ You can. at any time. examine a DMA channel to find out if it is "busy" or if it is "done". If "busy". the channel is in the middle of transferring a block of data. If "done". the channel is currently idle. You determine a channel's status by reading the contents of the Channel Control register and examining the level of bit 6. When you reach the end of a data block. that is. a DMA channel's Byte Count register decrements to O. the channel's Control register bit 7 will be set to 1. If the channel's interrupt logic has been enabled via bit O. 1.2 or 3 of the Interrupt Control register. then an interrupt request will occur via a low output at IRQ/DEND. This interrupt request will not occur if thechannel's interrupt logic has been disabled within the Interrupt Control register. If an interrupt request does occur. then bit 7 of the Interrupt Control register will be set to 1. Irrespective of whether a channel's interrupt logic has or has not been disabled. the channel's Control register bit 7 Vfill be set to 1 when the channel's Byte Count register decrements to O. Bit 7 of the Channel Control register remains set to 1 until the CPU reads the contents of the Channel Control register. The process of reading the Channel Control register contents automatically resets bit 7 to O. The Interrupt Control register bit 7 is reset to 0 as soon as the Channel Control register for the DMA channel requesting the interrupt is read by the CPU. Suppose. for example. Channels 0 and 1 are active. with Channel 0 interrupts enabled and Channel 1 interrupts disabled. Here are appropriate Interrupt Control register settings: 76543210 76543210 I ° I° I° I° 10/110/11 01 1101 11 10 I ° I° I °101110/ 110/11 0/11 ° ,01010101010101 Interrupt Control Register Channel 1 Control Register Channel Control Register ° 765432 011 means the bit may be 0 or 1. Now suppose Channel 1 becomes active. Its Control register Busy bit will be set: 6 5 4 3 2 ° 1 ° 1 ° 10/110/110/110/11 I °1 ° ° Channel Control Register 6 1 I° I 5 4 3 2 ° I° I° 10/110/110/110/11 Channel 1 Control Register 9-121 6 5 4 3 10101010101 Interrupt Control Register 2 ° ° I° I Next. suppo~e Channel a becomes active. The Channel a Busy bit will. also be set: 6.(0543 2 1 0 I 0 11}'1 0 10 10/110/110/110/11 6 5 4 3 2 1 6 0 4 3 o 2 10 10 10 10 \0\0\0\ o Interrupt Control Register Channel 1 Control Register Channel 0 Control Register When the Ch~nnel , DMA operation ends. no interrupt request will occur. since the Channel' interrupt.logic has been disabled. Thus. the Chclnnel 1 Control register Busy bit will be reset to the DEND bit will be set to' and the Interrupt Control register will not change: a., 7 6'i5 4 3 2 1 0 765 10 11 J0 10 \0/110/1101110/ 11 !i11'a;1 0 4 10 32· 1 6 0 10/110/110/110/11 4 3 2 0 10101010101010 I· Interrupt Control Register Channel 1 Control Register Channel 0 Control Register, 5 As soon as toe CPU read~ the contents of the Channel , Con~rol registe'r, the Channell DEND bit (bit 7) will be reset to a. . ' Suppose Channel a now reaches the end of a data block; it will request an interrupt. The Channel a Control register's Busy bit will,be reset to O. the DEND bit will be set to 1.cwd the activ~ interrupt request bit of the Interrupt Control register will ?Iso be set to:4': ,I . ' ~-' 7 ,; 654 . 321 7' 0 l)ll.Q:l,o I 0 10/110/110/110/g ·.Chann~1 6 4 3 '. 2 1 '0 11:1 0 10 10 10 10 10 1 o· Interrupt Control Register Control Regist~r Reading the contents of the Cha,nriel a Control register ~illreset the' Ch~nnel 0 DEND bit (bit 7). Reading the Channel 0 Control regi$ter contents will also reset the Interrupt Control register bit 7. since the Channel 0' interrupt request caused this bit to be set. Reading the Channel' Control register will have no effect on the I nterrupt Control register bit 7. since Cha!,mel , dld not cause the interrupt request to: be generateq. ',', . If more than one active interrupt is present. then your program must arbi.trate priorities by examining the DENO status of each channel's Control register. Also. bit 7 of the Interrupt Control register will be reset when you read the contents of the Control register for the first channel to request an jnterrupt.· For example. suppose all channel interrupts have been enabled. and Channel O. then Channel 2. then Channel' request .interrupts- before the CPU acknowledges an interrupt. The CPU can determine which channels have requested interrupts by reading Control register contents for Channels O. 1 and 2. But it is the act of reading Channel 0 Control register contents that will reset bit 7 of the Interrupt Control register. RESETTING THE MC6844 DMAC The MC6844 DMAC is reset when a low signal is input at the Reset pin. When the MC6844 DMACis reset, all Control registers have their contents reset to O. Address and Byte Count registers' contents, however, are not altered. PROGRAMMING THE MC6844 DMAC Programming the MC6844 DMAC is quite straightforward. The first step is initialization. If you have reset the MC6844. then all Control registers' contents will be 0 - in which case all DMA requests and interrupt requests have been disabled. If,yOU have not reset the MC6844 DMAC. then you should do so under program control by OU1Putti'ng 0 tQ the Enable/Ptiority Control register and the Interrupt Control register. Once the MC6844 DMAC has been disabled, then 100tlalize channe,1 Address and Byte Count registers by loading appropri.ate initl~1 values into these registers. ; Next, definEt the DMA operating modes by loading a~propriat~,.cQges into the channel Control registers for the .,: enabled cha~nels. and into the D~ta Chain Cpntrol register. 9-122 Initialization is now complete. You start OMA channels by outputting an appropriate code to the Interrupt Control register and then to the Enable/Priority Control register. cw ~ a: oQ. a: o(.) ~ ui w l- e( Monitoring DMA operations while they are in progress is also quite straightforward. Normally you will wait until the end of a OMA transfer is signaled by an interrupt request. at which time if more than one channel could have requested the interrupt. the interrupt service routine arbitrates priorities by reading all active channel Control registers' contents. The interrupt service routine must now respond to the active interrupt request according to the requirements of your program logic. This mayor may not require restarting the same channel or another channel. You can monitor DMA operations while they are in progress by reading the contents of Address and Byte Count registers while a DMA operation is in progress. However. this is something you should only do while operating a DMA channel in one of the Halt modes. If you read register contents on the fly while operating in Three-State Control mode. you may read the wrong answer. and determining what the right reading should be is not easy. This is because an instruction that reads 16 bits of data executes in two machine cycles. If this read operation occurs while a, Three-State Control. Cycle Stealing OMA transfer is occurring. this is what happens: ' g CI) CI) e( 011 w Z a: ~2 I I I I I LDX I JlJ1 , I I instr. I I fetch I o III CI) I o I :E ,I I e( c e( @ I I I I I I Read I I I I n,--_ Inn I Increment 16 bits to 032A16 I I I high- I order I I byte I I ' Increment 16 bits to 032816 Read I low- I order I byte I I Next I instr. I f~tch I I Increment 16 bits to 032C16 ~. 03? , ct .. In the illustration above. an LOX instruction loads the contents of a 16-bit register (we will assume it is the Channel Address register) into the Index register of the CPU. First the high-order byte of the Address register (03) is transferred to the high-order byte of the Index register. At the end of this machine cycle. however. the Address register is incremented. Now. you may say that this is no problem since you have read the valid Address register contents as they were at the end of the LOX instruction's execution. But unfortunately there is a special case. Suppose the Address register contained 020016 and was decrementing. Now you will read 02FF when 01 FF was the correct value: I I I ~2JiJ1. II I LDX I I instr. I I fetch I I I I I ! Decrement 16 bits to 020016 I I n r1 I I I Read I I high- I I order I I byte I Decrement 16 bits to 01FF16 I Read I low- I order I byte I ! Decrement 16 bits to 01FE16 4' I = I )r.FF I o. I I I I I I I n--- Next I instr. I fetch I I I I The error illustrated above cannot occur when operating OMA in a Halt mode. since the OMA transfer occurs in between instruction executions. Thus. the contents of any 16-bit registers within the MC6844 OMAC will not change while an LOX instruction is being executed. because no OMA transfer can occur until the LOX instruction has completed execution. You can. if you wish. write into any MC6844 OMAC register at any time. For example. you can write into an Address or Byte Count register for a channel that is busy. Once again. you can get into trouble if you write into Address or Byte Count registers for a channel that is operating in Three-State Control. Cycle Stealing mode. since you will write the loworder byte. all 16 bits may be incremented or decremented. and then you will write the high-order byte; and who knows what the results will be. Writing into registers on the fly will not cause error's if you are operating in one of the Halt modes. , 9-123 THE MC6846 MULTIFUNCTION SUPPORT DEVICE The MC6846 multifunction support device is designed to work with the MC6802 as a two-chip microcomputer. However, the MC6846 can be used just as easily in any other MC6800 microcomputer system. Figure 9-38 illustrates that part of our microcomputer system logic which is implemented on the MC6846 multifunction device. This device provides 2048 bytes of read-only memory, a single 8-bit para"ell/O port with handshaking control signals, and a counter/timer. ' The MC6846 multifunction device is packaged as a 40-pin DIP. It uses a single +5V power supply. A" inputs and outputs are TTL-compatible. The device is implemented using N-channel silicon gate depletion load technology. MC6846 MULTIFUNCTION DEVICE PINS AND SIGNALS MC6846 pins and signals are illustrated in Figure 9-39, The device select lines CSO and CS1 work in two ways: they activate the MC6846, and they select which function is in use - ROM or I/O and counter/timer. The user specifies as a mask option two active combinations of CSO and CS1 levels: one to enable the ROM and one to enable the I/O and counter/timer. For example. you might wish to enable ROM when CS 1 is high and CSO is low. and enable the 1/0 and counterltimer when both select lines are high, This combination would then disable the MC6846 when CS1 is low. When ROM is' selected, the eleven lines AO - A 10 will address one of the 2048 bytes of read-only memory. These 2048 memory bytes may be located anywhere in the memory space. In addition to CSO and CS1. certain of the address lines are used to select the I/O and counter/timer functions. Lines A5. A4. and A3 must be low to select the 1/0 and counterltimer operations. You select as a mask option what level at line A6 enables I/O and the counterltimer. and whether or not one of the lines A 10. A9. A8. and A7 must be high to enable these functions. Here is how address lines are used to select 1/0 and the counterltimer: A 10 A9 A8 A7 A6 A5 A4 A3 A2 A 1 A O . . . - Address Lines L...-_ _ _ _ L -_ _ _ _ _ _ _ _ _ Internal register address (See Table 9-14) These three lines must be low to select I/O and counter/timer ' - - - - - - - - - - - - - User decides whether high or low selects I/O and counter/timer L -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ All four "don't care" or user may assign one line on which a high level selects I/O and the counter/timer Once an MC6846 has been selected as an I/O device, address lines AO, A1, and A2 select one of seven registers in eight I/O addressable locations. Table 9-14 ,identifies the locations accessed with each address. Note that addresses 0 and 4 access the same location, Table 9-14. MC6846 1/0 Addressable Locations Address Line Internal Register Selected A2 A1 AO 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 Composite Status register Peripheral Control register Data Direction register Peripheral Data register Composite Status register Timer Control register Timer register (high-order byte) Timer register (low-order byte) 9-124 Clock Logic c w ~ IX: oa.. Logic to Handle Interrupt Requests from External Devices Accumulator Registerts) IX: o U ~ Data Counterts) enw ~ g Stack Pointer U) U) ct oCS w Z IX: o Interrupt Priority Arbitration Program Counter CD U) o ~ ct C ct © Figure 9-38. Logic of the MC6846 Multifunction Device 9-125 Direct Memory Access Control (GND) VSS --- A7 A6 A5 -- A4 CSO R/W DO Dl D2 D3 D4 D5 D6 -.. ..- - .. --- --- ...... --.. -- ~ 1 2 3 4 5 6 7 8 9 -.. 10 -.. 11 12 13 14 -. ~ MC6846 D7 15 CSl --.. 16 CTG ---I> 17 CTC 18 CTO 19 20 E - -- 40 ---- 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 -- 21 --- .. ---- .. -- .. -.. --. --- .--. -- -.. .- -~ A8 A9 AlO RES IRQ CP2 CPl AO Al A2 A3 VCC PP? PP6 PP5 PP4 PP3 PP2 PPl PPO PIN NAME DESCRIPTION TYPE csa, CSl Device select Address lines Data lines Read/Write Device synchronization I/O Port lines Interrupt/Strobe Peripheral Control Counter/timer output External clock for counter/timer Counter/timer gate Interrupt request fleset Power and Ground Input Input Bidirectional Input Input Bidirectional Input Input or Output Output Input Input Output Input AO - Al0 DO - D7 R/W E PPO - PP7 CPl CP2 CTO CTC CTG IRQ RES VCC, VSS Figure 9-39. MC6846 Multifunction Device Signals and Pin Assignments 9-126 All data transfers between the CPU and the MC6846 device occur via the bidirectional Data Bus (DO - 07). This is a three-state Data Bus: when the device is not selected the MC6846 holds these lines in the high-impedance state. The R/W control determines whether data will flow into the MC6846 (a Write operation with RtW low) or from the MC6846 (a Read operation with RIW high). stand~rd c E is the !;( The 8-bit parallel 110 port of the MC6846 is very similar to I/O Port B of an MC6820 Peripheral Interface Adapter (PIAl. Differences are described later. Lines PPO - PP7 constitute an 8-bit bidirectional parallel I/O port. Control lines CP1 and C~2 are the ~wo handshakin,g and interrupt control signals associated with the parallel I/O port. w IX: o a.. IX: o o ~ enw !;( oo (I) (I) oCt a!I w Z IX: oCD (I) o ~ oCt C oCt © synchronizing clock signal used throughout an MC6800 microcomputer system. The counter/timer of the MC6846 is very similar to counter/timer 3 of the MC6840 counterltimer, which has been described earlier in this chapter. CTO is the output signal, CTC is the external clock and CT~ is the gato in- put . Interrupt requests originating from the parallel I/O logic of the counter/timer logic are output via IRQ. The device is reset by inputting a low level at RES. The actual operation of the reset logic is described after the registers which it affects have been discussed. MC6846 COUNTER/TIMER LOGIC Before reading this section. you should be familiar with the MC6840 counter/timer device described earlier in this chapter. We are only going to examine the differences between counter/~jmer logic of the MC6846 and channel 3 of the MC6840. Note ttlat channel 3'of the MC6840, like the counter/timer logic of the MC6846, can be operated in divide-by-ejght mode. The MC6846 counter/timer has its own Control register, Most Significant Byte register, and Least Significant Byte register. As illustrated in Table 9-13. these three registers are accessed via addresses DEV+5. DEV+6. and DEV+ 7 respectively. The counter/timer logic does not have its own Status register; this is shared with I/O port logic.' . The counterltimer Control register address is not the same as any of the three addresses set aside for Control registers of the MC6840. The Most Significant Byte register and Least Significant Byte register addresses. however. are the same as two addresses allocated to these two registers by the MC6840. Bits of the MC6846 counterltimer Control register are not assigned in the same way as they are for any MC6840 Control register. Here are the counter/timer Control register bit assignmel'!ts for the MC6846: 65432 o ",-BitNo. Counter/Timer Control register ' - - - - - 0 Enable timer 1 I;'reset counter ' - - - - - - - 0 Timer uses CTC as clock input 1 Timer uses E as clock input 1.-_ _ _ _ _ _ 0 Use input clock frequency 1 Use input frequency divided by 8 !----------- Select operating mode: ~ 000 Continuous (program initiated) 00 1 Cascaded single-shot 010 Continuous 011 Normal single-shot _ _ _ _ _ _ _ _ _ _ _ _ _ Frequency comparison: 100 CTG changes before counter times out 101 Counter times out before CTG changes Pulse width comparison: 110 CTG changes before counter times out 111 Counter times out before CTG changes ~-------------- 0 Mask timer interrupt 1 Enable timer interrupt oSet CTa low .' l except during cascaded 1 Enable coun~er ou~put single-shot operation 9-127 r BitO is the internal reset bit. This is the same as bit 0 of the Control register of MC6840 counterltimer logic 1. Bit 1 determines whether the external clock (CTC) 'or the system clock (cI>2, viaE) will be the timing signal. This is the same as in MC6840 Control registers. Bit 2 enables or disables the divide-by-eight prescaler; bit 0 of counterltimer 3's Control register performs the same task in the MC6840. Bit 6 enables or disables interrupt logic, and bit 7 enables or disables the output signal for thecounterltimer as described for the MC6840. Control register bits 3, 4 and 5 determine the operating mode of the counterltimer. There is just one difference between the interpretation of these three bits in the MC6846 as compared to the interpretation of these three bits in the MC6840. The MC6846 has no program-initiated sillgle-shot mode. Only a high-to-Iow transition of the gate input will initiate single-shot mode. This missing variation of'Single-shot mode is replaced by a cascade mode. In the cascade mode, Control registElr bit 7 is connected to the output signal CTO. When Control register bit 7 is 0, the output signal is set low on the next timeout;' when Control register bit 7 is 1, the next timeout sets the output signal high. This is called a "cascade" mode because it allows you, under program 'control. to count timeouts which generate interrupt requests in the usual way and then, under program control. to change'the level of the output based on the time interval computed via timeouts. ' ' MC6846 I/O PORT LOGIC Before reading this section, you should be familiar with the MC6820 PIA described earlier in this chapter. We are only going to examine t~e differences between I/O port logic of the M~6846 and I/O Port B of the MC6820. The MC6846 I/O Port can provide programmed handshaking on either input or output. . . , ' I ! Any of the data lines PPO - PP7 can directly drive the base of a Darlin9t~n NP!'I transistor. The control line CP2 al~o has this capability. . , The MC6846 I/O Port has its own Control register, Data Direction regist~r, and Peripheral Data register. As illustrated in Table 9-13, these three registers are accessed via addresses DEV+ 1, DEV+2, and DEV+3 respectively. The I/O port logic does not have its own Status register; this is shared with the counter/timer logic. We will describe the Composite Status register later on. In the MC6846, the Data Direction register and the Peripl1eral Data register have separat~ addresses., Recall that in the MC6820 PIA these two registers share one address, an'd Bit 2 of the Control register determines which location is accessed by that address. " . , ' Bits of the MC6846 Peripheral Control register are not assigned in the ~ame way as they are for either of the MC6820 Control registers. Here are the Peripheral Control register bit assignmenls for the MC6846: i I I I I I I I j~ .~ j~ .~ ~ ~~ , o 432 6 ~ .....--BitNo. Peripheral Control register o Disable CP1 interrupt , 1 Enable CP1 interrl!pt o CP1 high-to-Iow transition generates interrupt request 1 CP1 low-to-high trarisition generates interrupt request 000 not latch input data 1 Latch input data on active tram.ition of CP1 CP2I, '"pot o Disable CP2 interrupt } 1 Enable CP2 interrupt Bit 5 = 0 - o CP2 high-to-Iow transition generates interrupt request -- -~ 1 CP2 low-to-high transition generates interrupt request CP2 is output 00 CP2 serves as an interrupt acknowledge 01 CP2 serves as an input/outPUl acknowledge 1x set CP2 to x Not used o Normal 0Peration 1 Reset I/O port 9-128 \ f . (Blt5=1~ • If Bit 0 is set to 1. then an active transition (as defined in Bit 1) at CP1 will set IRO low. Bits 0 and 1 are used in the same way in the Control registers of the MC6820. . Bit 2 selects the input latch function. When bit 2 is set. an active transition at CP1 will latch data input on lines PPO PP7. The MC6820 does not provide an input latch function. Q w ~ a: oB- Bits 3.4. and 5 control the CP2 line in the same way that MC6820 Control Register B bits 3.4. and 5 control line CB2 of that device. Bit 6 is not used in the MC6846. a: Bit 7 serves as an internal reset for the I/O port. The CPU may set this bit by writing a 1 into it. but it will also be set automatically when the MC6846 receives a low level at the reset input. RES. You clear bit 7 by writing a 0 to it during a CPU write to the Peripheral Control register. . iii w ~ The interrupt flags for both the timer/counter and the I/O port appear in the Composite Status register, which the CPU accesses via either of the addresses DEVor DEV+4. This register is a read-only location. en en Here are the bit assignments for the Composite Status register: all 6 o(.) !: g MC6846 COMPOSITE STATUS REGISTER c:( 4 3 2 1 0 ~Bit No. w Z Composite Status register a: o CD en o ""----- Timer interrupt ~ c:( Q c:( ~---- CPl interrupt " " - - - - - - - - - CP2 interrupt ""--_ _ _ _ _ _ _ _ _ _ Not Used @ " " - - - - - - - - - - - - - - - Composite interrupt Note that interrupt conditions will appear in bits O. 1. and 2 of the Composite Status register. whether or not interrupts are enabled in the corresponding Control register. A counter/timer interrupt will set bit 0 of the Composite Status register. Any of the following actions will reset the counterltimer interrupt flag to 0: • • • • Timer reset' via either Timer Control register bit 7 or RES input Initializing ~he counter Writing to the timer latches in Frequency Comparison mode or Pulse Width Comparison mode Reading the Timer register after reading the Composite Status register while the timer interrupt bit was set. That is. the following sequence resets bit 0 of the Composite Status register: bit 0 is set by the counterltimer interrupt: the CPU reads the Composite Status register (location DEVor DEV+4): then the CPU reads the Timer register (locations DEV+6 and DEV+ 7). Interrupt transitions at CP1 and CP2 will set bits 1 and 2. respectively. of the Composite Status register. Each of these bits will be reset to 0 by a Read or Write to the Peripheral Data register (location DEV+31. but only if the flag was already set when the CPU last read the Composite Status register. This is analogous to the fourth counterltimer flag reset condition described above. Bit 7 yvill be set to 1 only when IRO is set low: that is. anyone of the three interrupt bits described above will set bit 7. but only if that interrupt has been enabled in the appropriate Control register bit. Bit 7 will be 0 only when all three of bits O. 1. and 2 are reset to O. Bits 3. 4. and 5 of the Composite Status register are not used. The Data Direction register and the Peripheral Data register work in the same way as those in the MC6820 do. MC6846 DEVICE RESET When the MC6846 receives a low level on RES, all the I/O and counterltimer logic enters the Reset state. I n addition. the I/O port and the counter/timer can be reset individually via the internal reset bits of their respective Control registers - bit 0 of the Timer Control register and bit 7 of the Peripheral Control register. 9-129 These are the results of a counter/timer reset: • The counter latches take on the maximum count (65.536). This occurs only during external reset (RES low). • The counter clock is disabled. • Bits 1 through 6 of the Timer Control register are reset to O. as are the output line CTa and the interrupt flag (bit 0 of the Composite Status register). The net effect is that the counter/timer becomes inactive until the CPU writes a 0 to bit 0 of the Timer Control register. These are the results of an I/O port reset: • All bits of the Peripheral Data register and Data Direction register are reset to O. as are the interrupt flags (bits 1 and 2 of the Composite Status register) . .• Bits 6 through 0 of the Peripheral Control register are reset to O. The net effect is that the port is in input mode, and its interrupts are disabled. 9-130 DATA SHEETS This section contains specific electrical and timing data for the following devices: cw ~ 0: oD- o: o u ~ en w ~ gen • MC6800 CPU • MC6802 CPU/RAM • MC6870A Clock • MC6871 A Clock • MC6871 B Clock • MC6820 PIA • MC6850 ACIA • MC6852 SSDA • MC6840 PTM • MC6844 DMAC • MC6846 ROM-I/O-Timer en c:( alS w Z 0: o m en o ~ c:( C c:( @ _9-01 MC6800 . TABLE 1 - MAXIMUM RATINGS Symbol Value VCC -0.3 to +7.0 Vdc Input Voltage Vin -0.3 to +7.0 Vdc Operating Temperature Range-TL to TH MC6800, MC68AOO, MC68BOO MC6800C, MC68AOOC MC6800BOCS, MC6800COCS TA Rating Supply Voltage Storage Temperature Range TstQ Thermal Resistance (}JA Plastic Package Ceram ic Package o to +70 -40 to +85 -55 to +125 -55 to +150 Unit °c This device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be· taken to avoid application of any voltage higher than maximum rated voltages to this high impedance circuit. °c °C/W 70 50 TABLE 2 - ELECTRICAL CHARACTERISTICS (VCC = 5.0 V, ± 5%, VSS = 0, TA = TL to TH unless otherwise noted) Symbol Min Typ Max Unit Logic ¢1,<:>2 VIH VIHC VSS + 2.0 VCC -0.6 - Vdc - VCC VCC + 0.3 Logic <:>1,<:>2 VIL VILC VSS - 0.3 Vss - 0.3 - VSS + 0.8 Vss + 0.4 Vdc - 1.0 2.5 100 - 2.0 Characteristic Input High Voltage Input Low Voltage Input Leakage Current (Vin = 0 to 5.25 V, VCC (V in = 0 to 5.25 V, VCC }JAdc lin = max) = 0.0 V) Logic· <1>1,<:>2 Three·State (Off State) Input Current (Vin = 0.4 to 2.4 V, VCC = max) Output High Voltage (ILoad = -205 }JAdc, VCC (ILoad = -145 }JAdc, VCC (I Load = -100 }JAdc, VCC ITSI - - VSS + 2.4 VSS + 2.4 VSS + 2.4 - 10 100 00-07 AO-A15,R/W,VMA BA V CC = min) VOL Power Dissipation Po Capacitance (Vin = 0, T A Cin = 25 0 C, f = 1.0 MHz) AO-A15,R/W,VMA - - - - - VSS + 0.4 0.5 1.0 - 25 45 10 6.5 35 70 12.5 10 - - 12 - Cout - Vdc W pF - <:>1 ¢2 00-07 Logic Inputs }JAdc Vdc VOH = min) = min) = min) = 1.6 mAdc, Output Low Voltage (I Load 00-07 AO-A15,R/W - pF TABLE 3 - CLOCK TIMING (VCC = 5.0 V, ± 5%, VSS = 0, TA = TL to TH unless otherwise noted) Symbol Min Typ Max Unit MC6800 MC68AOO MC68BOO f 0.1 0.1 0.1 - 1.0 1.5 2.0 MHz MC6800 MC68AOO MC68BOO teyc 1.000 0.666 0.500 10 10 10 }JS PW¢H 400 230 180 9500 9500 9500 ns tut 900 600 440 - ns Ch aracteristics Frequency of Operation Cycle Time (Figure 1) Clock Pulse Width (Measured at VCC - 0.6 V) <:>1,¢2 - MC6800 ¢1,<:>2 - MC68AOO ¢1,¢2 - MC68BOO Total ¢1 and <1>2 Up Time MC6800 MC68AOO MC68BOO Rise and Fall Times (Measured between VSS + 0.4 and VCC - 0.6) t¢r, t¢f Delay Time or Clock Separation (Figure 1) (Measured at VOV = VSS + 0.6 V @ tr = tf';; 100 ns) (Measured at VOV = VSS + 1.0 V@ tr = tf';; 35 n5) ® td 0 0 - - - 100 9100 ns ns 9100 MOTOROLA Semiconductor Products Inc. Data sheets on pages 9-D2 through 9-D30 reprinted by permission of Motorola Semiconductor Products, Inc. 9-D2 Me6S00 TABLE 4 - READ/WRITE TIMING (Reference Figures 2 through 6) MC6S00 Characteristic Symbol Address Delay C = 90 pF C =30 pF cw ~ a: o Il. Peripheral Read Access Time o Input Data Hold Time CJ Output Data Hold Time en Address Hold Time (Address. R/W. VMA) ~ Enable High Time for DBE Input a: ~ w g C/) C/) c( oil w 2 a: o III C/) o ~ c( Typ Max Min Typ - - 270 250 - - - 60 tAD MC6SBOO MC6SAOO Min Min Typ 180 165 - - 250 ns - 40 - 10 25 30 50 - ns 10 - 220 - - ns 200 - - 160 ns - 110 - 100 ns ns tace - tDSR 100 tH 10 - tH 10 25 tAH 30 50 tEH 450 tDDW - - 200 - - - 140 - 100 - - 100 - - 250 270 - 120 - 165 270 - - - 75 25 - - 25 - 530 - 360 Max Uh~": Max ns - 150 135 tac = tut - (tAD + tDSR) Data Setup Time (Read) Data Delay Time (Write) Processor Controls Processor Control Setup Time Processor Control Rise and Fall Time Bus Available Delay Three-State Delay Data Bus Enable Down Time During <1>1 Up Time Data Bus Enable Rise and Fall Times tpcs tPCr. tpC! tBA tTSD tDBE 150 - tDBEr. tDBEf - - - 10 - 10 25 30 50 - 280 225 - -', - C c( @ FIGURE 1 - CLOCK TIMING WAVEFORM Aeference Tables 2 and 3 FIGURE 2 - READ DATA FROM MEMORY OR PERIPHERALS ,...., Start of Cycle <1>1 <1>2 A/Vii Address From MPU Data 2.0 V --:=~_====;, From Memory ------------------:::::~\' or Peripherals 0.8 V --="""i'""===;;:;;1~ K\\\\,§\i ® Data Not Valid MOTOROLA Semiconductor Products Inc. 9-03 - ns - ns ns ns 25 ns 135 220 - ns ns MC6800 FIGURE 3 - WRITE IN MEMORY OR PERIPHERALS , - - Start of Cycle _____________________ tCYC ____________________ ~ ~ 4>1 4>2 R/W Address FromMPU~~~~~~~~i-~ ______~________________________-4~~ VMA _____-I'""~ ~----------tEH----------~~ DBE Data From MPU -----------------j--O:::::S~'" ~~~ Data Valid Data Not Valid FIGURE 4 - TYPICAL DATA BUS OUTPUT DELAY versus CAPACITIVE LOADING (TDDW) 600 . 500 FIGURE 5 - TYPICAL READIWRITE. VMA. AND ADDRESS OUTPUT DELAY versus CAPACITIVE LOADING (TAD) 600 10H =-205 jJA rnax@ 2.4 V 10L = 1.6 rnA rnax@0.4V VCC=5.0V TA = 25°C 500 vr 400 400 ] 10H =-145 jJA rnax@2.4 V 10L = 1.6 rnA rnax@0.4 V VCC = 5.0 V TA = 25°C UJ UJ ::;; ::;; ;:: 300 > g 200 , 100 --100 k-I-" -- -- ;:: > 300 .-f.;-- g 200 100 .------ -I-" -- --- ......-.-- V ....- 300 400 500 100 600 200 300 400 CL LOAD CAPACITANCE (pF) CL LOAD CAPACITANCE (pF) ®. I CL includes stray capacitance CL includes stray capacitance 200 VMA Address, RNI-- f - - MOTOROLA Semiconductor Products·lnc.. 9-04 500 600 M~OOO . FIGURE; 6 - BUS TIMING TE;ST LOADS Q w ~ o a.. Vee II: R L - 2.2 k TEST CONDITIONS II: o U Test Point o--......_....---toI~t--. , ~ ui w C'I' The dynam Ie test load for the Data Bus Is 130 pF and one standard TTL load as shown. The Address, RIW, and VMA outputs are tested under two conditions to allow optimum opera· tlon in both buffered and unbuffered systems. The resistor (R) Is chosen to Insure specified load currents during VOH measurement. Notice that the Data Bus lines, the Address lines, the Interrupt Request line, and the DBE line are all specified and tested to guarantee 0.4 V of dynamic noise immunity at both "1" and "0" logic levels. MMD6150 or Equiv. R l- ~, e:( MMD 7000 or Equlv. g CI) CI) e:( o!I C = 130 pF for 00-07, E - 90 pF for AO-A15, R/W, and VMA (Except tAD2) w Z = 30 pF for AO-A 15, R/W, and VMA • oCD (tAD2 only) = 30 pF for BA II: CI) o ~ e:( Q e:( R= 11.7knforDO-D7 = 16.5 kn for AO-A15, RIW, and VMA = 24 kn for BA @ 9-05 - v MC6800\ , I, FIGURE 12 - THREE STATE CONTROL TIMING Cycle #1 "2 #3 =4 =5 :=7 =6 =8 =9 System cJ>1 MPU ,/.1 Address Bus RfW VMA Data Bus c,')2 - DBE .TSC --J f4"'- tTSE tTSE ~ FIGURE 13 - HALT AND SINGLE INSTRUCTION EXECUTION FOR SYSTEM DEBUG lnst;uction Fetch tSA BA VMA __________________-J! jJ I I Instruction Execute I \I:....._ _ _ _ _-J( ~-----l\-----~{ff---------'I X . . . .__. . .) - R/Vil ~-------Iffl----------/,---..... Fetch. Address Bus Data Bus Execute ~~~1(----'-------------~~-----------«Addr M+l)(~____-J) ------1r-,,----y--~----------------~~----------------~ Inst y Inst X Note: Midrange waveform indicates high impedance state. ® MOTOROLA Semiconductor Products Inc. 9-D6 MC6802 . ' ' . ' MAXIMUM RATINGS c w Rating Supply Voltage Symbol Value Unit VCC -0.3 to +7.0 Vdc Vin -0.3 to +7.0 Vdc ~ a: oD.. Operating Temperature Range TA Oto+70 °c Storage Temperature Range T stg -55 to +150 °c o Thermal Resistance IJJA 70 °C/W a: o Input Voltage This device contains circuitry to protect the inputs against damage due to high static volt· ages or electric fields; however, it is advised that normal precautions be taken to avoid applica· tion of any. voltage higher than maximum rated voltages to this high impedance circuit. ~ enw ~ ELECTRICAL CHARACTERISTICS (VCC= 5.0 V ± 5%, VSS = 0, TA = 0 to 70 0 C unles otherwise noted.! CI) CI) Input High Voltage Logic, EXtal Input Low Voltage Logic, EXtal, I nput Leakage Current (Vin = 0 to 5.25 V, VCC = max) Logic· g < all w 2 a: o m CI) o ~ < C < @ Characteristic Max Unit - VCC VCC Vdc - VSS + 0.8 Vdc 2.5 /lAdc Min VIH VSS + 2.0 VSS + 4.0 .- VIL VSS - 0.3 lin - 1.0 VSS + 2.4 VSS + 2.4 VSS + 2.4 - 'ReSet Output High Voltage (I Load = -205/lAdc, VCC = min) (I Load = -145/lAdc, VCC = min) (I Load = -100/lAdc, VCC = min) Typ Symbol I1eSet Vdc VOH 00·07 AO·A 15, R/Vi, VMA, E BA - - - Output Low Voltage (I Load = 1.6 mAdc, VCC = min) VOL - - VSS + 0.4 Power Dissipation PO"" - 0.600 1.2 Capacitance # (V in = 0, TA = 25 0 C, f ='1.0 MHz) - AO-A15, R/Vi. VMA Cout f Frequency of Operation (Input Clock 74) (Cry~tal Frequency) fXtal Clock Timing Cycle Time Clock Pulse Width (Measured at 2.4 V) W pF Cin 00-07 Logic Inputs, EXtal Vdc 12.5 10 - 10 6,5 - - 12 pF 0.1 1.0 - 1.0 4.0 MHz tcyc 1.0 - 10 /lS PWq,Hs PWcpL 450 - 4500 ns - - 25 ns Fall Time (Measured between VSS + 0.4 V and VSS - 2.4 V) tcp "Except IRQ and NMI, which require 3 kn pullup load resistors for wire-OR capability at optimum operation. Does not include EXtal and Xtal, which are crystal inputs. "In power·down mode, maximum power dissipation is less than 40 mW. #Capacitances are periodically sampled rather than 100% tested. READ/WRITE TIMING (Figures 2 through 6; Load Circuit of Figure 4) Symbol Min Typ Max Address Delay tAD - - 270 ns Peripheral Read Access Time tacc - - 530 ns tacc = tut - (tAD + tOSR) Data Setup Time (Read) - ns - ns Characteristic Unit tOSR 100 Input Data Hold Time tH 10 Output Data Hold Time tH 20 tAH 20 - toow - 165 225 ns tpcs tPCr, tpCf 200 - 100 ns ns Address Hold Time (Address, R/W, VMA) Data Delay Time (Write) Processor Controls Processor Control Setup Time Processor Control Rise and Fall Time (Measured between 0.8 V and 2.0 V) ® MOTOROLA - ~ern;conductor Products 9-D7 Inc. ns ns MC6802 . FIGURE 2 - READ DATA FROM MEMORY OR PERIPHERALS Address From MPU Data From MPU 2:!~~~~"":::"-""""'t-------------------4-~~- 2.0 V or Peripherals ----::::::;;;;...J.-==='*'''- --------------------------------c:~~~ O.B V --=~-=;=:::::;;;;;:;;;~~ t\\\%\\'f Data Not Valid FIGURE 3 - WRITE DATA IN MEMORY OR PERIPHERALS R/Vi Address FromMPU~~~~~~~~~~-----+_--~-------~~~ .J.._-----H, Data 2.4 V _ _ From MPU----------'--------------f--0-.4-V~~-~"~r__ _ _ _ _1_f ~~ ~ Data Not Valid FIGURE 4 - BUS TIMING TEST LOAD 4.75 V c - = = R = = = ® 130 pF for 00-07, E 90 pF for AO·A15, RiW, and VMA 30 pF for BA 11.7 kn for 00-07, E 16.5 kn for AO·A15, RiW, and VMA 24 kn for BA Test Point 0-.............--1'.....- . MMD6150 " or Equiv. c;~ R V " MMD7000 or Equlv. MOTOROLA Serniconducf:or Producf:s Inc. 9-08 r. • MC6802 ' . FIGURE 5 - TYPICAL DATA BUS OUTPUT DELAY versul CAPACITIVE LOADING 600 Q w ~ a: oB- 500 a: ... ~ :Ii! o(,) enw ~ g FIGURE 6 - TYPICAL READIWRITE. VMA. AND ADDRESS OUTPUT DELAY versulCAPACITIVE LOADING 600 IOH 1=-20~ jJA m!x@2.14 V IOL' 1.6 mA max@0.4V VCC' 5.0 V TA' 2S·C 500 ... 400 2.~ l IOH 1=_14S jJA m!x @ V 10 L • 1.6 mA max @0.4 V VCC = 5.0 V TA' 2S"C 400 w w ;:: 300 ;:: >- 300 Address. VMA :Ii! >- g '. , - 200 I-- I-- ,..... 100 CI) CI) - -I-- g 200 100 < -- -_V I-~ k- f-- r-- CL includes stray capacitance 100 oC5 w 200 300 400 500 CL includes stray capacitance 600 200 100 CL LOAD CAPACITANCE (pF) Z RNi 300 400 500 600 CL, LOAD CAPACITANCE (pF) a: oIII CI) o ~ < Q < @ FIGURE 10 - POWER-UP AND RESET TIMING Vee E 20ms Min ~tPes >4.0V ,-------------~~------~1-~~-----1--O.S V Reset Option 1 (See Note below) 20 ms Min :-=------------- Reset ' rL OV 0.8 V RE - - - - - - - - ) - VMA ---------,~ ® Option 2 I I II tper";;100ns II See Figure 11 for Power Down condition I ~~I------------\_----- NOTE: If option 1 is chosen, Reset and RE pins can be tied together. MOTOROLA Se,"iconduc1:or Produc1:s Inc. 9-09 MC6802 F.IGURE 11 - POWER·DOWN SEQUENCE VCC tpCf 0;;;;100 ns 2.0 V RE FIGURE 13 - MEMORY READY CONTROL FUNCTION A - SETUP B - _____2_.~;r~--------------~1I ~ 0;;;;200n$ RELEASE \0.4V ;/2;;;'300n$ tPCf 0;;;;100 ns tPCr 0;;;;100 n$ MR ® MOTOROLA Sernicond!.!cto~ P~ad!.!ete 9-010 Ine. MC6870A +5V DC GND limited function microprocessor clock 250 kHz to 2.5 MHz ~ MC6870A ~~ ~I ~2 ~2 L . . ._ _ _- - - ' NMOS NMOS TTL cw ~ 0: on- specifications DIMENSIONS o: PIN o (J 1 GND ~ 3 Ne en w 5 0, TTL 7 v" (+5VDC) 12 13 0, NMOS 0, NMOS 18 GND 20 NC w 22 NC 0: 24 NC ~ g en en ct PIN II LOCATION _~~;;;;;;:~~\ i" .t"... .221, .0'01 •u nnn 1fL.Q20~ .010 --015071(01." PINS) Rating Supply Voltage Operaling Temperalure Range Siorage Temperalure Power Supply Drain (max.) CONNECTION ,005 Z ocg ~;eC~~i~~;~;~al~',~%~~;'~tve V/o ::!:.Ul NMOS Oulputl at 1.0 MHz Operation" Hl,H Pulse Widlh (meas. al V,,= -.3V de level) T0 , H Logic Levels VOLC VQt", NMOS MC6~ HOLl) 1 HOLD 2 80 1120 1 160 I I 5 I 50 I I I NOle. A.II dlmenSlon •• re In Inches WAVEFORM TIMING• ALL TIME IN NANOSECONDS. pi ttl pi -.2 +.4 Vdc -.2 +.4 Vdc TEST DIAGRAM InfO spec.lled lesl load "Musl be eltternally held at "'" level (2 4V min. S OV mall, lit nol used ···Apply the tollowlng parameters for freQuenCies other Ihan 1 MHz ro,H=O 5 (P.140) ns T02H=O 5 (P.IOD) ns h:(P'60) ns where P=desl1ed period of operation In nanoseconds . L------(H5Lo1 '-------(HOLD2 CIIL - M.4.)(CAPACITY50pF C,.MQ~ - ~22fFl6A48 ~A~...~~i;~~~IFIED THAT SIMULATES THE MOTOROLA Rs-(22n) SIMULATES REAL PART Of MPU Me6S00 MPU INPuT ·~~:l~~ ~~~g !TM.UIS\~~El ~~~~~~i~s~g"DC MAX I MOTOROLA INC. 2553 N. Edgington COMPONENT PRODUCTS DEPT. Franklin Park, III. 60131 9-013 312/451-1000 .1 MC6820 ELECTRICAL CHARACTERISTICS (Vcc = 5 0 V ±5% vss =0 TA =0 to 70 0 C unless otherwise noted ) Symbol Typ Min Max Unit Vdc - VCC VCC VSS + 0.4 V!;!; + 0.8 - 1.0 2.5 I'Adc 'TSI - 2.0 10 I'Adc PAO·PA7, CA2 I'H -100 -250 - I'Adc PAO·PA7, CA2 I,L - -1.0 -1.6 mAdc VSS + 2.4 VSS + 2.4 - - - - VSS + 0.4 Vdc -205 -100 - - - /JAdc /JAdc Characteristic Input High Voltage Enable Other Inputs VIH VSS + 2.4 VSS + 2.0 - Input Low Voltage Enable Other Inputs VIL VSS -0.3 VSS -0.3 lin 00·07, PBO·PB7, CB2 Input High Current (V,H = 2.4 Vdc) Input Low Current (VIL = 0.4 Vdcl Output High Voltage (I Load - -205 I'Adc, Enable Pulse Width < 25 I's) (I Load = -100 /JAdc, Enable Pulse Width <25I's) R/W,Reset, RSO, RS1, CSO, CS1, CS2, CAl, Input Leakage Current (Vin = 0 to 5.25 Vdc) Three·State (Off State) Input Current (Vin = 0.4 to 2.4 Vdc) - Vdc CB1, Enable VOH 00·07 Other Outputs Output Low Voltage (I Load = 1.6 mAdc, Enable Pulse Width < 25 /Js) Output High Current (Sourcing) (VOH = 2.4 Vdc) VOL IOH 00·07 Other Outputs (VO = 1.5 Vdc, the current for driving other than TTL, e.g., Darlington Base) PBO·PB7, CB2 Output Low Current (Sinking) (VOL = 0.4 Vdc) Output Leakage Current (Off State) (VOH = 2.4 Vdc) Power Dissipation IROA,IROB Input Capacitance (Vin = 0, TA = 25 0 C, f Enable = 1.0 MHz) 00·07 PAO·PA7, PBO·PB7, CA2, CB2 P./W, Reset, RSO, RS1, CSO, CS1, CS2, CAl, CBl Output Capacitance (V in = 0, TA = 25 0 C, f = 1.0 MHz) Peripheral Data Setup Time (F igure 1) IROA,IROB PBO·PB7 -1.0 Vdc - -2.5 -10 mAdc IOL 1.6 - - mAdc ILOH - 1.0 10 /JAdc Po - Cin - - 650 20 12.5 10 7.5 mW pF 5.0 10 pF Cout - - - - - - - tPDSU 200 ns tCA2 - - - Delay Time, Enable negative transition to CA2 negative transition (Figure 2, 3) 1.0 /JS Delay Time, Enable negative transition to CA2 positive transition (Figure 2) tRSl - - 1.0 /JS Rise and Fall Times for CA 1 and CA2 input signals (Figure 3) tr,tf - - 1.0 I'S Delay Time from CA 1 active transition to CA2 positive transition (Figure 3) tRS2 - - 2.0 I'S tpDW - - 1.0 I'S tCMOS - - 2.0 I'S Delay Time, Enable positive transition to CB2 negative transition (Figure 6, 7) tCB2 - - 1.0 I'S Delay Time, Peripheral Data valid to CB2 negative transition (Figure 5) tDC 20 - - ns Delay Time, Enable positive transition to CB2 positive transition (Figure 6) tRSl - - 1.0 I'S - 1.0 I'S 2.0 I'S 1.6 /JS - I'S Delay Time, Enable negative transition to Peripheral Data valid (Figures 4, 5) Delay Time, Enable negative transition to Peripheral CMOS Data Valid (VCC - 30% VCC, Figure 4; Figure 12 Load C) PAO·PA7, CA2 Rise and Fall Time for CBl and CB2 input signals (Figure 7) tr,tf - Delay Time, CB 1 active transition to CB2 positive transition (Figure 7) tRS2 - Interrupt Release Time, TFiQA and IROB (Figure 8) Reset Low Time· (Figure 9) tlR - tRL 2.0 - ·The Reset line must be high a minimum of 1.0 I'S before addressing the FlA. @ MOTOROLA Semiconductor Products Inc. _ _ _ _ _ _ _.....J 9-014 MC6820 MAXIMUM RATINGS Rating Symbol Value Unit -0.3 to +7.0 -0.3 to +7.0 Vdc Storage Temperature Range VCC Vin TA T stg a: o u Thermal Resistance °JA en w BUS TIMING CHARACTERISTICS Q Supply Voltage w Input Voltage a: Operating Temperature Range ~ oQ. ~ ~ (I) (I) Enable Pulse Width, High Enable Pulse Width, Low a: Data Hold Time o (I) Address Hold Time Rise and Fall Time for Enable input ~ WRITE (Figures 11 and 12) Q ct ct @ 82.5 °C/W Min 1.0 leycE PWEH PWEL w oCO °c Symbol Setup Time, Address and R!W valid to Enable positive transition Data Delay Time Z °c -55 to +150 Characteristic Enable Cycle Time o!I Vdc o to +70 READ (Figures 10 and 12) g ct This device contains circuitry to protect the inputs against c.amage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than maximum rated voltages to this high impedance circuit. 10 tAH 10 - Enable Cycle Time Enable Pulse Width, High leycE PWEH 0.45 Enable Pulse Width, Low PWEL ,",s - - 320 - 195 tAH tEr, tEf 10 10 - - ,",S ns ns ns ns 25 ns - ,",s ,",s 25 - ,",s - ns ns 25 ns ns ns FIGURE 2 - CA2 DELAY TIME (Read Mode; CRA·5 = CRA·3 = I:CRA-4 = 0) PAO-PA7=12.0 V PBO-PB7 ._...;;0.;.;.8;...V.;....-_ _ _ _ _ __ Enable 0.4 V tCA2 tPDSUt: '-'2-.4-V---L Enable 25 - 0.43 160 tDSW tH FIGURE 1 - PERIPHERAL DATA SETUP TIME (Read Mode) . . Unit ,",s 1.0 tAS Address Hold Time Rise and Fall Time for Enable input - - tDDR tH tEr, tEt Data Hold Time Max - 0.45 0.43 160 tAS Setup Time, Address and R!W valid to Enable positive transition Data Setup Time Typ CA2 ./ _ _ _ _----I {v P' 2.4 V .• Assumes part was deselected during the previous E pulse. FIGURE 3 - CA2 DELAY TIME (Read Mode; CRA-5 = 1, CRA-3 = CRA-4 Enable = 0) 0.4 V " CA1 N M2.0V. ft~0';...8_V_ __ 2L~RS2 1 .4V 2 _ _ _ _--_t_C_A...... CA2 0.4 V @ MOTORO.LA Semiconductor Products Inc. - - - - - - - - ' 9-015 MC6820 FIGURE 5 - PERIPHERAL DATA AND CB2 DELAY TIMES (Write Mode; CRB-5 .. CRB·3 ,. 1, CRB-4 ·01 FIGURE 4 - PERIPHERAL CMOS DATA DELAY TIMES (Write Mode; CRA·5 = CRA·3 ~ 1, CRA-4 01 g Enable PBO·PB7 tDC-j CB2 2. 4V 'L.- CB2 Note: CB2 goes low as a result of the positive transition of Enable. FIGURE 6 - CB2 DELAY TIME (Write Mode; CRB·5" CRB·3" 1, CRB-4" FIGURE 7 - CB2 DELAY TIME (Write Mode; CRB·5" 1, CRB·3" CRB-4 ,. 01 01 CBl 2.4J!v~· CB2 tCB2 l--------' CB2 "Assumes part was deselected during the previous E pulse. FIGURE 8 - ~ 2 7 -' - R S . 2"" " ,. 2.4 V 0.4 V ' iRa RELEASE TIME FIGURE 9 - RE'SEf LOW TIME '4V ~ Enable _ ---.. Reset r---tRL~ r- ~ tlR .2.4F V IRQ _ _ _ _ _ _ _- J "The Reset line must be a VIH for a minimum of 1.0 IlS before addressing the PIA. FIGURE 11 - BUS WRITE TIMING CHARACTERISTICS (Write Information into PIA) FIGURE 10 - BUS READ TIMING CHARACTERISTICS (Read Information from PIAl '-------- @ , "Assumes part was deselected during any previous E pulse. MOTOROLA SenJiconductor Products Inc. - - - - - - - - - ' 9-016 MC6850 MAXIMUM RATINGS . Symbol Valua . Unit Supply Voltage VCC -0.3 to +7.0 Vdc Input Voltage OperatinCl Temperature Range Vln TA -0.3 to +7.0 Vdc o to +70 Storage Temperature Range TstQ -55 to +150 °c °c Thermal Resistance liJA 82.5 '!C/W R~lng c w ~ a: oa.. a: o (J ~ en w ~ g CI) CI) ct olI w Z a: o m CI) o ~ ct c ct @ ELECTRICAL CHARACTERISTICS (VCC - 5 0 V 15% VSS Characteristic a This device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, it is ad· vised that normal precautions be taken to avoid application of any voltage higher than maximum rated voltages to this highimpedance circuit. 0 T A - 0 to 70 0 C unless otherwise noted,) Typ Min Symbol Max Unit Vdc 1.0 VCC VSS + 0.8 2.5 IlAdc - 2.0 10 IlAdc VSS + 2.4 VSS + 2.4 - - Input High Voltage VIH VSS + 2.0 Input Low Voltage VIL VSS -0.3 - lin - R/W,CSO,CS 1,CS2,Enabie Input Leakage Current (V in = 0 to 5.25 Vdc) Three-State (Off State) Input Current (Vin a 0.4 to 2.4 Vdc) 00-07 ITSI Output High Voltage (I Load - -205 IlAdc, Enable Pulse Width <25 IlS) (I Load a -100 IlAdc, Enable Pulse Width <25Ils) 00-07 VOH Tx Data, RTS Vdc VOL - ILOH - Power Dissipation Po Input Capacitance 00-07 (Vin = 0, T A = 25 0 C, f = 1.0 MHz) E Tx Clk. Rx Clk, R/W, RS, Rx Data, CSO, CS1, CS2, CTS. DCD Cin Output Capacitance (Vin = 0, TA = 25 0 C, f = 1.0 MHz) Minimum Clock Pulse Width, Low (Figure 1) Minimum Clock Pulse Width, High (Figure 2) RTS, Tx Data IRQ C out +16, +64 Modes Output Low Voltage (I Load = 1.6 mAdc, Enable Pulse Width <25 IlS) IRQ Output Leakage Current (Off State) (VOH = 2.4 Vdc) +16, +64 Modes +1 Mode +16, +64 Modes Clock Frequency Clock-to-Data Delay for Transmitter (Figure 3) Vdc 1.0 10 IlAdc - 300 525 mW - 10 7.0 12.5 7.5 - - 10 5.0 pF - PWCL PWCH 600 .:... - - ns 600 fC - 500 800 kHz tTDD - - 1.0 IlS - ns - pF - +1 Mode tRDSU 500 Receive Data Hold Time (Figure 5) +1 Mode tRDH 500 tRTS tr,tf Input Transition Times (ExcePt Enable) - - tlR Request-to-Send Delay Time (Figure 6) - VSS + 0.4 Receive Data Setup Time (Figure 4) Interrupt Request Release Time (Figure 6) Vdc ns - ns 1.2 IlS 1.0 IlS 1.0" IlS "1.0 IlS or 10% of the pulse width. whichever is smaller. BUS TIMING CHARACTERISTICS READ (Figures 7 and 9) Characteristic Enabhi Cycle Time Symbol Min Typ tcycE PWEH 1.0 - Enable Pulse Width, Low Setup Time, Address and R/W valid to Enable positive transition PWEL 0.45 0.43 tAS 160 Data Delay Time tDDR tH 10 tAH 10 tEr, tEf - - tcycE PWEH 1.0 - 0.45 Enable Pulse Width, Low Setup Time, Address and R/W valid to Enable positive transition PWEL 0.43 tAS 160 Data Setup Time tDSW tH 195 tAH 10 tEr, tEf - Enable Pulse Width, High Data Hold Time Address Hold Time Rise and Fall Time for Enable input . WRITE (Figure 8 and 9) Enable Cycle Time Enable Pulse Width, High Data Hold Time Address Hold Time RiSe and Fall Time for Enable input @ - 10 - Max - Unit :lb IlS - IlS ns 320 ns IlS ns ns 25 ns IlS 25 IlS - - IlS ns - - ns 25 ns ns ns MOTOROLA SenJiconduct:or Product:s Inc. _ _ _ _ _ _ _......1 9-017 MC6850 FIGURE 2 - CLOCK PULSE WIDTH. HIGH·STATE FIGURE 1 - CLOCK PULSE WIDTH. LOW·STATE Tx Clk Tx Clk or Ax Clk Ax Clk FIGURE 4 - RECEIVE DATA SETUP TIME (+1 Mode) FIGURE 3 - TR"ANSMIT DATA OUTPUT DELAY TxClk ~ Tx Data --------..~ro-2:-;-:----- 0.8 V AXDat~2'OV -------------------- / r::: 0.8V ~ 'RD'" Ax Clock _ _ _ _¥0.8V FIGURE 5 - RECEIVE DATA HOLD TIME (+1 Mode) FIGURE 6 - REQUEST·TO·SEND DELAY AND INTERRUPT·REQUEST RELEASE TIMES Enable ATS tlA-L IRQ FIGURE 7 - BUS READ TIMING CHARACTERISTICS (Read information from ACIA) ________~ _ ___Jj22.4.4 V FIGURE 8 - BUS WRITE TIMING CHARACTERISTICS (Write information into ACIA) Enable AS,CS,A/W Data Bus @ MOTOROLA Setniconductor Products Inc. _ _ _ _ _ _ _..J 9-018 , MC6852 . . , ~ ' . . ' , MAXIMUM RATINGS Rating 0' w ~, 0::' oa. 0:: o Symbol Supply Voltage Input Voltage V.lu. -0.3 to +7.0 VCC Yin TA T stg Operating Temperature Range Storage Temperature Range Thermal Resistance -0.3 to +7.0 o to +70 °C OC -55 to +150 70 ()JA This device contains circuitry to protect the inputt against damage due to high static voltages or electric fields; however, is is advised that normal precautions be taken to avoid epplicatlon of any voltage higher than maximum ratad voltages to this hlgh-Impedanca circuit. Unit Vdc Vdc Ocm U ~ iii ELECTRICAL CHARACTERISTICS (VCC w ~ g en en c( all w Z 0:: o m en o ~ c( o c( @ = 5.0 V ±5%, VSS = 0, T A = 0 to 70 0 C unless otherwise noted.l Characteristic Input High Voltage Input Low Voltage Symbol Min Typ Max Unit VIH VIL lin VSS + 2.0 - - - 1.0 VSS + 0.8 2.5 Vdc Vdc SlAde - 2.0 10 SlAde' VSS + 2.4 - - VSS + 2.4 Tx Clk, Rx Clk, Rx Data, Enable, Input Leakage Current (Vin = 0 to 5.25 Vdc) Reset, RS, RIW, CS, OCD, CTS 00-07 Three-State (Off State) Input Current (Vin = 0.4 to 2.4 Vck, VCC = 5.25 Vdc) Output High Voltage 00-07 il Load = -205 SlAdc, Enable Pulse Width <25/As) ULoad = -100 SlAdc, Enable Pulse Width <25/As) _ _ Tx Data, OTR, TUF Output Low Voltage (lLn..n = 1.6 mAdc, Enable Pulse Width <25/As) IRQ Output Leakage Current (Off State) (VOH = 2.4 Vdc) Power Dissipation I nput Capacitance 00-07 (Vin = 0, T A = 25 0 C, f = 1.0 MHz) All Other Inputs Output Capacitance Tx Data, SM/OTR, TUF IRQ (Vin = 0, TA = 25 0 C, f = 1.0 MHz) Minimum Clock Pulse Width, Low (Figure 1) Minimum Clock Pulse Width, High (Figure 2) Clock Frequency PWCL PWCH fC 700 700 Recaive Data Setup Time (Figure 3, 7) Receive Data Hold Time (Figure 3) Sync Match Delay Time (Figure 3) Clock-to-Oata Delay for Transmitter (Figure 4) Transmitter Underflow (Figure 4,6) OTR Delay Time (Figure 5) tROSU tROH tSM tTOO tTUF tOTR 350 Interrupt Request Release Time (Figure 5) Reset Minimum Pulse Width CTS Setup Time (Figure 6) OCO Setup Time (Figure 7) Input Rise and Fall Times (except Enable) (0.8 V to 2.0 V) '1.0 SlS or 10",(, of the pulse width, whichever is smaller. FIGURE 1 - CLOCK PULSE WIDTH, LOW-STATE ITSI VOH Vdc - VOL - - VSS+0.4 Vdc ILOH - 1.0 10 SlAdc Po - 300 525 mW pF - - 12.5 7.5 10 5.0 Cin Cout 350 - - - - - - 600 - - - 1.0 1.0 1.0 1.0 - 1.2 - IIR tR ... 1.0 - - tCTS toco tr.tf - - 200 500 1.0' - pF ns ns kHz ns FIGURE 2 - CLOCK PULSE WIDTH. HIGH-STATE -PWCL- TXClk~ or ' Rx Clk O.BV V- TXClk~ or 2.0V ' Rx Clk ~L -PWCH- MOTOROLA Semiconductor Products Inc. 9-019 ns /AS /AS /AS /AS /AS /AS ns ns /AS MC6852 '. . . . . BUS TIMING CHARACTERISTICS READ IF'Igures 8 an d 101 Symbol Min Typ Max Unit Enable Cyele Time teyeE PWEH 25 En~ble PWEL tAH 10 10 - IlS Enable Pulse Width, High 1.0 0.45 0.43 160 tEr, tEf - - Enable Cycle Time teyeE Enable Pulse Width, High PWEH Enable Pulse Width, Low PWEL 1.0 0.45 0.43 160 - Characteristic Pulse Width, Low Setup Time, Address and R/W valid to Enable positive transition Data Delay Time tAS tDDR tH Data Hold Time Address Hold Time Rise and Fall Time for Enable input - - Il s IlS ns 320 ns - ns 25 ns - ,IlS ns WRITE (Figures 9 and 101 Setup Time, Address and R/W valid to Enable positive transition tAS Data S!ltup lime tDSW Data Hold lime tH Address Hold Time tAH Rise and Fall Time for Enable input tEr, tEf 195 10 10 - 25 - Il S I'S ns ns - ns 25 ns ns FIGURE 3 - RECEIVE DATA SETUP'AND HOLD TIMES AND SYNC MATCH DELAY TIME DO Rx Clk Rx Data Number of bits in character ~= Don't care 0.4 V Sync Match t-----~ ~e~l~dClk--_~ FIGURE 4 - TRANSMIT DATA OUTPUT DELAY AND TRANSMITTER UNDERFLOW DELAY TIME FIGURE 5 - DATA TERMINAL READY AND INTERRUPT REQUEST RELEASE TIMES 2.0 V Enable tlR ---J}--~__' 2.4 V TUF _______________- J _________ n = Number of bits in character ® MOTOROLA Semiconductor Products Inc. 9-020 . , , MC6852. • ~ • FIGURE 6 c 'f , CLEAR-TO-5END SETUP TIME \ I FIGURE 7 - DATA CARRIER DETECT SETUP TIME w !ia: o0. a: o(.) ~ ui w !i C3 oC/) Tx elk O.B V Rx elk --Ir C/) « olJ w Z Tx oata _ _ _ _ _ _ _ _ _ _ _ a: )fUlV Rx Data _ _ _ _ _ _ _....'~ V DO DO o III C/) o ~ «c « FIGURE 8 - BUS READ TIMING CHARACTERISTICS (Read information from SSDAI FIGURE 9 - BUS WRITE TIMING CHARACTERISTICS (Write information..,into SSDAI @ Enabl. Data BUI FIGURE 10 - BUS TIMING TEST LOADS Load B (IRQ Onlvl Load A (00-07, OTR, Tx Data, TUF) RL ... R a 3 k MMD6150 ~, or Equiv. ~, ~, e = 2.5 k -+ Test Point 0-:........_--I0Il .......... Test Point MM07000 or Equiv. 130 pF for 00-07 pF for OTR, Tx Data, and TUF R = 11.7 k!1 for 00-07 = 24 k!1 for OTR, Tx'Oata, and TUF ~ 30 ® ~roo" 5'OV 5.0 V MOTOROLA Semiconductor Products Inc. 9-D21 . MC6840 MAXIMUM RATINGS Rating Symbol Value Unit VCC -0.3 to +7.0 Vdc Input Voltage Vin -0.3 to +7.0 Vdc Operating Temperature Range TA o to +70 °c Supply Voltage Storage Temperature Range Tstg liJA Thermal Resistance . ELECTRICAL CHARACTERISTICS This device contains. circitry to protect the inputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than maximum rated voltages to this high-impedance circuit. -55to+150 °c 82.5 °C/W (Vee = 5.0 V ±5%, VSS = 0, TA = 0 to 70 0 e unless otherwise noted) Max Unit VCC Vdc Symbol Min Typ Input High Voltage VIH VSS +2.0 Input Low Voltage VIL VSS -0.3 - VSS +0.8 lin - 1.0 2.5 J..tAdc ITSI - 2.0 10 J..tAdc VSS +2.4 VSS +2.4 - - - - - - VSS +0.4 VSS+0.4 Characteristic Input Leakage Current (Vin = 0 to 5.25 V) Three-State (Off State) Input Current (Vin = 0.4 to 2.4 V) 00-07 Output High Voltage (I'oad = -205 J..tA) (I'oad = -200 J..tA) . Vdc VOH 00-07 Other Outputs Output Low Voltage (I load = 1.6 mAl (I load = 3.2 mAl VOL 00-07 01-03,IRQ Vdc ILOH - 1.0 10 J..tAdc Power Dissipation Po - - 550 mW Input Capacitance (V in = 0, TA = 25 0 C, f = 1.0 MHz) Cin - - - 12.5 7.5 - - - -. 5.0 10 Symbol Min Max Unit J..ts Output Leakage Current (Off State) (VOH = 2.4 Vdc) IRQ Output Capacitance (V in = 0, TA = 25 0 C, f = 1.0 MHz) 00-07 All others pF pF Cout IRQ 01,02,03 BUSTIMINGCHARACTERISTICS Characteristic READ (See Figures 2 and 8) Enable Cycle Time tcycE 1.0 10 Enable Pulse Width, High PWEH 0.45 4.5 Enable Pulse Width, Low PWEL 0.43 J..ts tAS 160 - Data Delay Time to DR - 320 ns Data Hold Time tH 10 - ns tAH 10 - ns tEr, tEf - 25 ns Setup Time, Address and R/W valid to enable positive transition Address~old Time Rise and Fall Time for Enable input J..ts ns WRITE (See Figures 3 and 8) Enable Cycle Time tcycE 1.0 10 J..ts Enable Pulse Width, High PWEH 0.45 4.5 J..ts Enable Pulse Width, Low PWEL . 0.43 Setup Time, Address and R/W valid to enable positive transition tAS 160 Data Setup"Time tDSW 195 Data Hold Time tH 10 tAH tEr, TEf Address Hold Time Rise and Fall Time for Enable input ® J..ts ns ns ns 10 - - 25 ns MOTOROLA Serniconducf:or.Producf:s 9-022 - In~.· ns MC6840 ' .... t _ ... "" ........ ___ " " . ~, " .!." . . . . ''''' '" _ - . . ......." ' " . . • " , • • cw ~ a: oQ. a: o u AC OPERATING CHARACTERISTICS Characteristic Symbol C, G and Reset Input Rise and Fall Times Input Pulse Width Low (Figure 4) e, G and Reset e,G e, G and Reset ~ Input Pulse Width High (Figure 5) u) w Input Setup Time (Figure 6) (Synchronous Mode) - C3 (-;-8 Prescaler Mode only) gen Input Hold Time (Figure 6) (Synchronous Mode) -C3 ~ en c:( o!I w 2: e, G and Reset (+8 Prescaler Mode only) Output Delay, 01-03 (Figure 7) (VOH = 2.4 V, Load A) (VOH = 2.4 V, Load C) (VOH = 0.7 VDD, Load C) TTL MOS CMOS a: Interrupt Release Time IJl 't r and tf .; 1 x Pulse Width or 1.0 IlS, whichever is smaller. o en Min tr,tf PWL tcycE + tsu + thd PWH tcycE + tSi . + thd ~ tsu 200 thd 50 - - - tco tcm tcmos - tlR Max Unit 1.0' IlS - ns - ns - ns 700 450 2.0 ns ns IlS 1.6 IlS ns o :E c:( cc:( @ FIGURE 2 - BUS READ TIMING CHARACTERISTICS (Read Information from PTM) FIGURE 3 - BUS WRITE TIMING CHARACTERISTICS (Write Information into PTM) FIGURE 5 - INPUT PULSE WIDTH HIGH FIGURE 4 - INPUT PULSE WIDTH LOW C1-C3 C1-C3 G1-G3 Gi-G3 Reset ® MOTOROLA Serniconduc-tor Produc-ts' Inc. 9-023 MC6840 FIGURE 6 - INPUT SETUP AND HOLD TIMES FIGURE 7 - OUTPUT DELAY Enable C1-C3, G1-G3, RESE'f FIGURE 8 - IRQ RELEASE TIME ,",,,·t.,"~, TAO _ _ _ _ _ _ _ _ _---J _ 2.4 V FIGURE 9 - BUS TIMING TEST LOADS Load A (00-07) Load B (01,02,03) 5.0 V VCC RL= 2.5 k 130 pF;;;;; . RL= 1.25 k MM06150 .... Test Point ~, 11.7 k ~ , ........ Test Point or Equiv. 11.7 k 40 pF MMO 7000 or Equiv. ~ -= ":::- MM06150 ~, , I ~ -= of device under test or Equiv. MM07000 or Equiv. Load C (IRQ Only) 5.0 V Test Point d" Load 0 (CMOS Load) Test Point ,,,,, I ® 1 r" MOTOROLA Semiconductor Products Inc. 9-024 MC6844 '.'-, '··-'V". .. ,,' . ...;. ' . . " ...' ~.', " ',- " 0 ' . "'" •• • cw !ia: o0. a: o o MAXIMUM RATINGS Rating Symbol Value Unit VCC· -0.3 to +7.0 Vdc Vin' -0.3 to +7.0 Vdc TA o to +70 Storage Temperature Range Tstg -55 to +150 °c uc Thermal Resistance ROJA 82.5 uC/W Supply Voltage ~ Input Voltage en w Operating Temperature Range !i g CI) CI) Permanent device damage may occur if ABSOLUTE MAXIMUM RATINGS are exceeded. Functional operation should be reuricted to RECOMMENDED OPERATING CONDITIONS. Exposure to higher than recommended voltages for extended periods of time could affect device reliability. 'In respect to Vss. c( o!I w Z RECOMMENDED OPERATING CONDITIONS a: o a:I Symbol Value Unit Power Supply Voltage VCC +4.75 to +5.25 Vdc Input Voltage VIL VIH -0.3 to +0.8 2.0 to VCC Vdc Operating Ambient Temperature Range TA o to +70 uC Rating CI) o ~ c( c c( @ ELE.CTRICAL CHARACTERISTICS (VCC - 5.0 V ± 5%, VSS = 0, TA = -20 to +75 0 C unless otherwise noted) Symbol Min Typ Input High Voltage VIH VSS +2.0 Input Low Voltage VIL VSS -0.3 VSS +0.8 Vdc lin - - 2.5 /JAde ITSI -10 - 10 /JAde VSS +2.4 VSS +2.4 VSS +2.4 - - Characteristic Input Leakage Current (Vin = 0 to 5.25 V) TXIRQO-3,2 DMA, RES, DGRNT Three-State Leakage Current (Vin ~ 0,4 to 2.4 V) AO-A15, RIW 00-07 Output High Voltage (I Load = -205 /JAde) (I Load = -145 /JAde) (lLoad = -100 /JAde) Unit Vdc Vdc VOH 00-07 AO-15, R/Vii All Others Max VCC - - VOL - - VSS +0.4 ICSS - 10 - Power Dissipation Po - 500 - Capacitance (V in ~O, TA = 25 0 C, f = 1.0 MHz) Cin - - Output Low Voltage (lLoad = 1.6 mAde) Source Current (Vin = 0 Vdc, Figure 10) Cs/Tx AKB 2DMA 00-07, Cs, AO-A4, R/Vii All Others Cout ® Vdc - - MOTOROLA Semiconductor Products Inc. 9-D25 mW pF 20 12.5 10 12 pF ",. MC6844 . . . \. "', .- ~ " . . _, . BUS TIMING CHARACTERISTICS (Load Condition Figure 11) ·1 Characteristic Symbol Min Max Unit READ TIMING (Figure 4) Address Setup Time AO-A4~RIW,CS tAS 160 - ns Address Input Hold Time AO-A4, RIW, CS tAHI 10 ns Data Delay Time' 00-07 tOOR - 320 ns Data Access Time 00-07 tACC - 480 ns Data Output Hold Time 00-07 tOHR 10 - ns WRITE TIMING (Figure 4) Address Setup Time AO-A4,RIW,CS tAS 160 Address Input Hold Time AO-A4, RIW,CS tAHI 10 Data Setup Time 00-07 tosw 195 Data Input Hold Time 00-07 tOHW 10 - Symbol' Min Max Unit tCYC PWH PWL 1000 - ns Pulse Width-High Low 450 430 - Rise and Fall Time t¢r,t¢f - 25 Tx RQ Setup Time (Figure 5) ¢2 OMA Rising Edge ¢2 OMA Falling Edge tTQSl tTQS2 120 210 - Tx RQ Hold Time (Figure 5) ¢2 OMA Rising Edge ¢2 OMA Falling Edge tTQHl tTQS2 20 20 OGRNT Setup Time (Figure 6) tOGS 155 OGRNT Hold Time (Figure 6) tOGH 10 ns ns ns -. ns CLOCK TIMING Characteristic ¢2 OMA (See Figure 4) Cycle Time ns ns OMA TIMING (Load Condition Figure 11) ns ns Address Output Delay Time (Figure 15) tAD - AO-15, R/W Tx STB tAHO 30 35 AO-A15, RIW tATSO AO-A15, RIW, Tx STB Address Output Hold Time (Figure 15) Address Three-State Delay Time (Figure 8) Address Three-State Recovery Time (Figure 8) Delay Time (Figure 7) tATSR ORQH,ORQT tOQO Tx AK Delay Time ¢2 OMA Rising Edge (Figure 7) OGRNT Rising Edge (Figure 10) tTKOl tTK02 IRQ/DENO Delay Time ¢2 OMA Falling Edge (Figure 8) OGRNT Rising Edge (Figure 10) tOEOl tOE02 ® - - - - 270 - ns ns ns ns 700 ns 400 ns 375 ns ns 400 190 ns - - 300 190 MOTOROLA, Semiconductor Products Inc. , 9-026 MC6844 . '" ..... . • .• ..' , cw ~ a: oA- FIGURE 4 - READ/WRITE OPERATION SEQUENCE FIGURE 7 - DiffiH. DRQT. TxAK OUTPUT TIMING a: o tJ>2DMA CJ ~ enw ~ g U) U) ct tJ>2DMA AO-A4 (Input) R/ON (Input) TxAKA CS/Tx AKB (Output) _ _ _ _ _....J -,:.;:;.;...;.....;...._ _ __ Cs (Input) 011 w Z a: FIGURE 8 - ADDRESS. IRO/DEND OUTPUT TIMING oCD U) o :IE (Write Operation) ct c ct AO-A15 (Output) R/ON (Output), Tx STB _ _+-J @ .,.~~-------r FIGURE 5 - Tx RQ INPUT TIMING FIGURE 9 - ADDRESS THREE·STATE TIMING tJ>2DMA (or DGRNT) AO-A15, RM FIGURE 6 - DGRNT INPUT TIMING Satup Timing ::: F tJ>2DMA~ DGRNT ._ tJ>2DMA (or DGRNT) ~ ~~l-tDGS FIGURE 10 - Tx AKB, IRO/DEND OUTPUT TIMING FROM DGRNT INPUT jO.8V 'DGH DGRNT _ _ _ _ _ _.....JI 0.8 V Hold Timing tJ>2DMA tATSD~ ---------2- 2.4 V AO-A15, R/ON 2.0 V 0.8 V ® K= DGRNT CS/Tx AKB (Output) MOTOROLA Semiconductor Products Inc. 9-027 0.4 V '" MC6844 ' ..,.. •. . • . . . , . . '- FIGURE 12 - Cs/TxAKB SOURCE CURRENT TEST CIRCUIT FIGURE 11 - TEST LOADS 1---------------, 5.0 V 01 Test Point ... ~ o-...._-~I_ e R I .Vee 2.5 k 02 TxAKB 03 I 04 Meter C=pF Rckn 00-07 130 11.7 Test Pin AO-A15, R/W 90 16.5 eS/Tx AKB 50 24 Others 30 24 Vss Enable es Input L- _ _ _ _ _ _ _ _ _ _ _ _ 9-028 ..J MC6846 .... A'. • __ _."! ....,. ~" , I _ MAXIMUM RATINGS Rating Q w ~ a: oQ. a: o o Symbol SupplV Voltage Input Voltage Operating Tempera!uni Range Storage Temperature Range VCC Vin TA T stg Thermal Resistance °JA Value -0.3 to +7.0 -0.3 to +7.0 o to +70 -55 to +150 70 Unit Vdc Vdc This device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, is is advised that normal precautions be taken to avoid application of any voltage higher than maximum rated voltages to this high·impedance circuit. °C oC 9C/W ~ en w ~ g CI) CI) ~ ai:S w Z a: oa:I CI) o ~ ~ Q ~ @ ELECTRICAL CHARACTERISTICS (VCC = 5.0 V ± 5%, VSS = 0, TA = 0 to 70 0 C unless otherwise noted.l Characteristic Input High Voltage All Inputs All Inputs Input Low Voltage Clock Overshoot/Undershoot - Input High Level - Input Low Level Input Leakage Current RlW, Reset, CSO, CSl (Vin = 0 to 5.25 Vdc) CP1, CTG, CTC. E. AO-Al0 Three-State (Off State) Input Current 00-07 (Vin 004 to 204 Vdc) PPO-PP7. CP2 Output High Voltage (I Load = -205 !lAde.) 00-07 (I Load = -200 !lAdc) Other Outputs Output Low Voltage (I Load = 1.6 mAde) (I Load = 3_2 mAde) Output High Current (Sourcing) (VOH = 204 Vdc) Min TVp Max Unit VIH - VIL VOS VSS + 2.0 VSS -0.3 VCC -0.5 VSS -0.5 Vdc Vdc Vdc lin - 1.0 VCC VSS + O.B VCC + 0.5 VSS + 0.5 2.5 !lAdc ITSI - 2_0 10 !lAdc VSS + 204 VSS + 204 - - - - VSS + 004 VSS + 004 -205 -200 - - - - -1.0 - -10 1.6 3.2 - - ILOH - - 10 /lAde Po - - mW pF - 1000 20 12.5 10 7.5 0.1 5.0 10 1.0 pF f - MHz "leveE 1.0 !lS 2 - - tRL tlR VOL - Vdc VOH 00-07 Other Outputs Vdc /lAde IOH 00-07 Other Outputs (VO = 1.5 Vdc, the current for driving other than TTL, e.g .• Darlington Base) CP2. PPO-PP7 Output Low Current (Sinking) (VOL = 004 Vdc) 00-07 Other Outputs IRQ Output Leakage Current (Off State) (VOH = 204 Vdc) Power Dissipation Capacitance (Vin = O. TA = 25 0 C. f = 1.0 MHz) 00-07 PPO-PP7. CP2 AO-Al0. RiW. Reset. CSO. CS1. CPl. CTC. CTG IRQ PPO-PP7. CP2. CTO Frequencv of Operation Clock Timing Cvcle Time Reset Low Time Interrupt Release ® Svmbol IOL Cin Cout - - MOTOROLA Semiconductor Products Inc. 9-029 mAde mAdc - !lS 1.6 !lS MC6846 READ/WRITETIMING (Figures 3 and 4) Characteristic Enable Pulse Width, Low Enable Pulse Width, High Set Up Time (Address eso, CS1, Rm) Data Delay Time Data Hold Time Address Hold Time Rise and Fall Time Data Set Up Time " Symbol Min Typ Max PWEL PWEH 430 430 160 - - - - 320 10 10 - - tAS tDDR tH Unit ns ns ns ns 195 - 25 tDSW - ns, ns ns ns Symbol Min Typ Max Unit tPDSU tPr' tpc 200 - - ns 1.0 IlS 1.0 IlS tAH tEf,tEr - - BUS TIMING Peripheral 1/0 LInes Characteristic Peripheral Data Setup Rise and Fall Times CP1, CP2 Delay Time E to CP2 Fall tCP2 tDC Delay Tme 1/0 Data CP2 Fall Delay Time E to CP2 Rise ,Delay Time CPl to CP2 Rise Peripheral Data Delay Peripheral Data Setup Time for Latch tRSl tRS2 tPDW tpsu tPDH Peripheral Data Hold Time for Latch Timer-Counter Lines Input Rise and Fall Time ,!nput Pulse Width High (Asynchronous Mode) Input Pulse Width Low (Asychronous Mode) Input Setup Time (Synchronous Mode) Input Hold Time (Synchronous Mode) Output Delay CTC and CTG 20 - - - 100 15 - - - ns 1.0 2.0 1.0 IlS - ns ns IlS IlS tCR, tCF !eyc + 250 - 100 tPWH - ns ns tPWL t cyc + 250 - - ns tsu 200 - ns thd 60 - - tCTO - - 1.0 FIGURE 3 - BUS READ TIMING Read Information from MC6846) ns IlS FIGURE 4 - BUS WRITE TIMING (Write Information from MPU) Am, A, CS Data Bus Aiw,A,CS FIGURE 5 - PERIPHERAL PORT LATCH SETUP AND HOLD TIME Data Bu. PPO·PP7 2.0 V CPl 0.8 V L-~'--:"; ___ ® MOTOROLA Semiconductor Products Inc. 9-D30 c w ~ o0. a: a: o o !: u) w ~ oCI) U CI) ct o!I w Z a: o 10 CI) o ~ ct C ct @ Chapter 10 THE MOS TECHNOLOGY MCS6500 In many ways the MCS6500 microcomputer systems can be compared to the Zilog zao, which we described in Chapter 7. Just as the zao is an enhancement of the aOaOA, which is described in Chapter 4, so MOS Technology's products are enhancements of the MC6aOO, which we described in Chapter 9. But there are some interesting conceptual differences between the way MOS Technology went about enhancing the MC6aOO, as compared to the product enhancement philosophy adopted by Zilog. The zao is indeed an enhancement of the aOaOA, but only to the extent that the aOabA instruction set is a subset of the zao instruction set; there are architectural similarities between the zao and the aOaOA, but System Bus philosophies are markedly different. It would be hard to look upon the zao as simply another mem~ ber of the aOaOA ,family of microcomputer devices. The MCS6500 product line, by way of contrast, can be looked upon as a CPU whose philosophical concepts agree closely with the MC6aOO product line -without being in any way compatible, either in terms of instruction set or System Bus philosophy. While on the surface it may appear as though MCS6500 CPUs represent some form of an MC6800 superset. this is not the case. System Busses are sufficiently different that you could not consider replacing an MC6800 CPU with an MCS6500 equivalent. leaving other logic unaltered. Instruction sets are similar. but deceptively so. In reality. the instruction sets are sufficiently different that converting an MC6800 source program to its MCS6500 equivalent is nosimple task. It would be completely impossible to take an MC6800 program ROM and use it to drive an MCS6500 CPU. Recall that you can take an 8080A program ROM and use it to drive a Z80 CPU. Since this chapter is devoted to the MOS Technology product line, let us begin by summarizing the components of this product line, and the principal CPU enhancements that have been made. The MaS Technology devices described in this chapter consist of nine CPUs. plus two support circuits. A third support circuit is described in Chapter 9. The nine CPUs share the same instruction set and addressing modes. but have minor differences in packaging and system interface. Table 10-1 summarizes the nine CPUs. The two support circuits which are described in this chapter are the MCS6522 Peripheral Interface Adapter and the MCS6530 combination logic device. Another PIA. the MCS6520 PIA. is identical to the MC6852 PIA; for a description of this device see Chapter 9. MCS6500 support devices are described in this chapter rather than in Volume 3, because, like the MC6aOO, the MCS6500 relies on a synchronizing clock signal. While it would be possible to use MCS6500 support devices with other microprocessors, the extra 'Iogic needed in order to create MCS6500 compatible bus interfaces would not be sufficiently rewarded by the specific capabilities of the support parts themselves. MCS6500 support devices can be used with MC6800 microprocessors and. conversely. MC6800 support devices can be used with the MCS6500 CPU. In order to enhance the MC6aOO CPU, MOS Technology made a number of useful yet obvious instruction set changes; they also made a number of subjective architectural changes which might have significant impact in particular applications, but which in general result in products that adhere quite closely to MC6aOO philosophy. The most important enhancement that MOS Technology has made is to develop a whole family of CPU devices. The second most important feature of the MCS6500 line of CPU devices is the fact that the MCS650X series CPUs contain on-chip clock logic; therefore. when using these CPUs.you do not need an MC6870 series clock device. However. you will need an external crystal oscillator or RC network - which is typical of any microprocessor with onchip clock logic. Another important feature of all MCS6500 series CPUs is that you cannot float the Address and Data Busses separately during <1>1 high and <1>1 low clock pulses, and there is no HALT condition. Also, you cannot stretch clock pulses. Slow memories are accommodated in the more traditional manner. by allowing you to insert extra machine cycles. equivalent to 8080A Wait states. 10-1 If you are making extensive use of clock stretching. or DMA data transfers during Halt states. in an MC6800 microcomputer system. switching to an MCS6500 CPU will require considerable system redesign. In order to refresh dynamic memory in an MCS6500 system, you must "steal" machine cycles by inserting Wait states, as you would for slow memories. MOS Technology, the principal manufacturer of the MCS6500 product line, is located at: MOS TECHNOLOGY. INC. 950 Rittenhouse Road Norristown. PA 19401 Second sources are: SYNERTEK. INC. 1901 Old Middlefield Way Mountain View. CA 94043 ROCKWELL INTERNATIONAL Microcomputer Division 337 Miraloma Avenue Anaheim. CA 92803 The MCS6S00 devices use a single +5V power supply. Using a 1 microsecond clock, instruction execution times range from 2 to 12 microseconds. All MCS6500 devices have TTL compatible signals. N-channel, silicon gate, depletion load MOS technology is used for MCS6500 devices. THE MCS6500 SERIES CPUs Functions implemented on each of the MCS6500 CPUs are illustrated in Figure 10-1. As this figure would imply, capabilities offered by the various MCS6500 CPUs differ in scope rather than function. Table 10-1. A Comparison of MCS6500 Series and the MC6800 CPU Devices , III ::I cg !aw a: c . I~ III ~ « « C ~ c 6502 6503 6504 6505 6506 6512 AO-A15 AO-All AO-A12 AO-All AO-All AO-A15 00-07 00-07 00-07 00-07 00-07 00-07 6513 6514 6515 MC6800 AO-All AO-All AO-All AO-A15 00-07 00-07 00-07 it u CPU PINS 'AND SIGNAls 00-07 i e; I I I I I ~ ~ a: I 0 0 0 0 0 0 I I/O I I I I, ! 0 I I I i~ I I I I I I I I I I I I I I I I I u z ~ ~ ~ 0 I I I I COMMENTS 01 I~ w cg c a: i 0 0 I I I I 0 0 0 z !: 40 28 28 28 28 0 I III I 40 I I I I I I 0 0, 0: 0 28 2~ I 28 40 ·The second name is the name used by MC6800 literature for the same signal. This is the on-chip-clock version of the 6512. This is the on-chip-clock version of the 6513. This is the on-chip-clock version of the 6514. This is the on-chip-clock version of the 6515. On-chip-clock version. 4K memory. 1. <1>2 DBO - DB7 ABO- AB15 ROY Input Input Output Tristate. bidirectional Output Data Bus Address Bus Singl~ cycle contr~1 Set Overflow flag Identify op code fetch cycle Power and Ground SO SYNC VCC.VSS Input Input Output Figure 10-2. MCS~502 Signals and Pin Assignments RESET Vss rna NMi VCC ABO ABI AB2 AB3 AB4 AB5 AB6 AB7 AB8 8 9 10 11 12 13 14 MCS6503 .28 27 26 25 24 23 22 21 20 19 18 17 16 15 <1>2 2 DBO- DB7 ABO-ABll Vcc. Vss Reset CPU clock System clock Data Bus Address Bus Power and Ground Figure 10-3. MCS6503 Signals and Pin Assignments 10-8 RESET 28 Vss 27 <1>0 26 R/W 25 24 DBl rna Q w ~ 4 5 AB1 6 7 AB2 AB3 a: 0 a. a: 8 23 MCS6504 AB4 0 0 ~ u) ... g Vee ABO w 4( 22 21 20 10 <1>2 000 DB2 DB3 DB4 DB5 000 ABS AB6 AB7 11 12 17 DB7 AB12 AB8 AB9 13 14 16 15 AB11 AB10 19 18 CI) CI) Pin Name Description Type 4( R/W GIS iRa RESeT Read/Write control Interrupt request Reset Output Input Input CPU clock System clock Input W Z a: 0 <1>0 III <1>2 0 DBO~DB7 CI) ~ 4( Q Output Tristate. bidirectional ABO-AB12 Data Bus Address Bus VCe. Vss Power and Ground Output 4( @ Figure 10-4. MCS6504 Signals and Pin Assignments ReSET 28 Vss ROY IRQ 27 26 25 3 4 24 5 6 VCC ABO AB1 AB2 MCS6505 ·AB3 AB4 ABS AB6 9 .20 10 11 19 18 17 12 13 14 ·AB7 ABS 23 22 ·21 '<1>2 <1>0 R/W 000 DBl DB2 DB3 DB4 DB5 DB6 DB7 16 AB11 AB10 15 AB9 Type Pin Name Description R/W Read/Write control Output iRci RESET Interrupt request Input Reset <1>0 CPU clock System clock Input Input Output <1>2 ROY Data Bus Address Bus ::;ingle cycle control VCC. Vss Power and Ground DBO - DB7 ABO-AB11 Tristate •. bidirectional Output Input Figure 10-5. MCS6505 Signals and Pin Assignments 10-9 · R'ESEi' <1>2 Vss <1>1 IRQ VCC ABO ABI 27 c1JO 26 25 24 R/Vii 23 MCS6506 AB2 AB3 AB4 10 AB5 AB6 AB7 11 AB8 14 22 DB3 21 20 DB4 19 18 17 12 DBO OBI DB2 DB5 ·DB6 DB7 ABll 16 AB10 15 AB9 Pin Name Description Type R/Vii Read/Write control Interrupt request Output Input c1JO <1>1. <1>2 Reset CPU clock System clocks Input Input OBO - DB7 Data Bus ABO - ABll Address Bus Power and Ground iRci RESET VCC.VSS Output Tristate. bidirectional Output Figure 10-6. MCS6506 Signals and Pin Assignments 1 2 40 39 3 38 37 36 35 4 5 6 7 8 9 10 11 12 13 34 33 32 MCS6512 31 30 29 28 27 14 2~ 15 16 25 24 17 23 22 21 18 19 20 Pin Name Description Type DBE Output Input NMi Data Bus Enable Read/Write control Interrupt request Non.maskable interrupt RESET Reset <1>1. <1>2 R/Vii IRQ Input Input Input Input <1>2 (OUT) CPU clocks System clock DBO- DB7 Data Bus ABO-ABI5 ROY Address Bus Single cycle control Tristate. bidirectional Output Input SO SYNC Set Overflow flag Identify op code fetch cycle Output VCC.VSS Power and Ground Output Input Figure 10-7. MCS6512 Signals and Pin Assignments 10-10 Vss 2 «1>1 rna R/W 4 DBO ABO 5 6 AB1 7 OBI OB2 OBJ Vce AB2 ABJ AB4 AB5 AB6 AB7 ABS MCS6515 10 11 12 13 14 0B4 OBS OB6 OB7 AB11 AB10 AB9 Pin Name Description TVpe R/W iRa Read/Write control Intemipt request Output Input RESET «1>1. «1>2 Reset CPU clockS • Inp.ut Input OBO - OB7' ABO-AB11 ROY Data Bus Address B'us VCC.VSS Single cycle control Power and Ground . Tristate•. bidirectional Output Input Figure 10-10. MCS6515 Signals and Pin Assignments DATA BUS ENABLE (DBE). Only the MCS6512 CPU supports this signal. This signal is input low in order to float the Data Bus. DBE is frequently tied to the <1>2 clock input. in which case <1>2 and DBE are identical signals. READIWRITE (R/W). When high. this signal indicates that the CPU wishes to read data off the Data Bus: when low. this signal indicates that the CPU is outputting data on the Data Bus. Thencirrrial standby state for this signal is "read" (high). . INTERRUPT REQUEST (IRQ). This signal is used by external logic to request an interrupt. If interrupts have been enabled. then the CPU will acknowledge an interrupt at the end of the currently executing instruction. There is a small difference between MCS6500 and MC6800 interrupt acknowledge logic. The MC6S00 cannot acknowledge an interrupt while it is in the Halt state. The MCS6500 has no Halt state, therefore this situation cannot arise. NONMASKABLE INTERRUPT (i"iviJ). This signal differs from IRQ in that it cannot be inhibited. Typically this input is used for catastrophic interrupts such as power failure. .. RESET. This is a typical RESET signal. Reset logic within an MCS6500 microcomputer system is identical to Reset logic within an MC6800 microcomputer system. Next consider MC6S00 signals which are the same on some MCS6500 CPUs, but not on others. The clock signals <1>1 and <1>2 are identical to MC6S00 clock signals for the MCS651X series CPUs. These CPUs require external clock signals whose waveforms are identical to the MC6800. The MCS650X series CPUs have clock· logic on the CPU chip; these CPUs output <1>2; the MCS6502 and the MCS6506 output <1>1 as well. The Data Bus of the MCS6500 series CPUs is identical to that of the MC6S00. The' Data Bus is a tristate. 8-bit bidirectional bus via which data is transferred between memory and all MCS6500 microcomputer system devices. However, only the MCS6512 has a DBE input for external control of the bus. On MCS6500 CPUs other than the MCS6512. an internal Data Bus Enable is connected to <1>2; in these devices the Data Bus is always floated during the first part of a machine cycle. . We will now look at the CPU signals which are unique to the MCS6500 microcomputer system. The Address Bus in MCS6500 microcomputer systems is not a tristate bus and cannot be floated. Also. the 28-pin MCS6500 series CPUs have either 12 or 13 Address Bus lines. allowing a total memory space of either 4K or 8K bytes. The Address Bus is used in the normal way by the CPU to output memory addresses. READY (RDY) is an input control signal which. in MCS6500 microcomputer systems. performs the task of MC6800 TSC. DBE and HALT signals. The RDY input causes the equivalent of a Wait machine cycle to be inserted within the normal machine cycle sequence. In order to generate a Wait machine cycle. RDY must make a high-to-Iow transition 10-12 during a ~1 high clock pulse in any machine cycle other than a write. We will illustrate the use of the ROY signal. and discuss a number of its non-obvious ramifications. following this summary description of MCS6500 signals. The Set Overflow flag (SO) signal can be used to set to 1 the Overflow bit of the Status register. When the SO input makes a high-to-Iow transition. the Overflow status is set to 1. The SO input can make a high-to-Iow transition at any time: this is an asynchronous input. Q w ~ a: o D. a: You cannot use the SO input signql to reset the Overflow bit of the Status register to O. The SYNC signal is used to identify instruction fetch machine cycles. There are a number of important uses for this signal. which we will discuss along with general instruction timing. o CJ ~ en w MCS65QP TIMII"G AND INSTRUCTION EXECUTION g MCS6500 CPUs execute instructions using exactly the same clock signals, machine cycles and machine cycle types as described for the MC6800 in Chapter 8 . ' ~ en en ct Recall that the two clock ~ signal~'; ~1 and ~2, define machine cycles as follows: w Z a: 4>1 en o ~ ct Q ct 4>2 @ n n· I I I I I I '1 I I I oIII n Machine Cycle 1 ,h h- ·h n I I I 1 1 1 I n Machine Machine Cycle 2 Cycle 3 I So far as external logic is concerned, there are only three types of machine cycles which can occur during an in~": struction's execution: . ' 1) 2) 3) A read operation during which a byte of data must be input to the CPU. A write operation during which a byte of data is output by the CPU. An internal operation during which no activ~ty ~ccurs on the Sy§tem ~us. As was the case with the MC6800, all MCS6500 instructions have timing which is a simple concatenation of the three basic machine cycle types. See Figures 9-3 and 9-4 and the accompanying text in Chapter 9 for a description of these three basic machine cycles. ' Instruction execution differences between the MC6800 and MCS6500 arise only when we depart from simple instruction execution logic. The MCS6500 SYNC signal is'also a difference to be noted: the SYNC signal identifies MCS6500 machine cycles during which any instruction object code is being fetGhed. SYNC timing may be illustrated as follows: <1>1 4>2 SYNC Instruction fetch machine cycle MCS6500 CPUs do not allow the ~1 and ~2 clocks to be stretched. nor do they allow the Address Bus to be floated: some MCS6500 CPU versions do not allow the Data Bus to be floated. Also. there is no Halt state. The single ROY sig- nal is used to interface slow memories, to refresh dynamic memories or to perform Direct Memory Access operations. 10-13 What the ROY input signal does is allow you to insert one or more Wait machine cycles in between two normal instruction execution machine cycles: MCS6500 WAIT STATE I ....~ 1 high clock pulse. This transition may occur during any nonwrite machine cycle. Timing may be illustrated as follows: 2 high pulse. If a ROY high-to-Iow transition occurs during a write machine cycle, then the Wait states will still be inserted, but the insertion will occur following the next nonwrite machine cycle. A non-obvious feature of the MCS6500 ROY signal is the fact that there is no acknowledge response from the CPU to external logic. This can be a problem. To guarantee that the machine cycle following'the ROY high-to-Iow transition will be a Wait. you must make sure that ROY never makes a high-to-Iow transition during a write cycle. Fortun.ately, yo~ pan use the R/Wo!.lip~t t9 detect write cycles and thus Q~nerate a safe ROY input. Here is simple sample logic: ," , +5V PRE ROY----11 0 (MCS6512) (MCS6502) --{>o- 7474 t ~ Q Q C ROY to cPU CLR +5V 10-14 R/W Since the same cI>2 clock pulse that triggers the 7474 flip-flop also triggers any change in RIW signal level. RIW is NAN Oed with IT after taking the 7474 settling delay -which also gives R/W time to acquire its new level. If you are interfacing slow memories. performing Direct Memory Access or refreshing dynamic memories. in each case the extra time provided for the secondary operation is the Wait state generated via the ROY input. as we have just described. Q ·MCS6500 SLOW MEMORY w When interfacing slow memories, the logic of the Wait state is self-evident. The slow memory simply has additional machine cycles in which to respond to the memory access. and memory select logic holds ROY low for any required time delay. a: When using a Wait state to perform Direct Memory Access or dynamic memory refresh operations, there is a further complication. During the Wait state. the Data and Address Busses are not floated. Alternate Data and Address Busses must therefore be provided. connected via a tristate buffer to any memory device which is being accessed. ~ a: oc. o (J ~ en w ~ U o UJ UJ ct coli w z a: o m INTERRUPT PROCESSING AND SYSTEM RESET The MCS6500 microcomputer system handles interrupts and resets exactly as the MC6800. For a discussion of ~ this subject, therefore, see Chapter 9 - with the following provisos: 1) UJ o ::i: ct Q ct @ ~NT~RFACE Neither the MCS6500 nor the MC6800 will acknowledge an interrupt if the interrupt enable status bit has been se~ to 1. Additionally. the MC6800 will not acknowledge an interrupt while in the Halt state. The MCS6500 has no Halt state. but Wait states induced by the ROY line may be looked upon as equivalent. If an interrupt request occurs while Wait states are being created by an MCS6500 CPU in response to the ROY control input. the'n thEil interrupt acknowledge process will begin with the first non-Wait machine cycle. 2) When the MCS6500 executes a software interrupt. the Break status is set. The MC6800 has no such status flag. 3) The MCS6500 Stack is 256 bytes long and is implemented in memory locations 010016 through 01 FF16. The MC6800 Stack can have any length within the allowed memory space. and can be located anywhere i~ memory. The MCS6500 series microcomputers have no interrupt acknowledge signal. You must create this signal by decoding off the Address Bus the interrupt acknowledge address FFF916. which is the second address to be output during theinterrupt acknowledge sequence. Creating an interrupt acknowledge signal in this fashion is descriq~d later in this chapter. MCS6500 CPU CLOCK LOGIC Clock logic required by the MCS651X series of CPUs is identical to that which has already been des~rilJed for the MC6800 in Chapter 9. Indeed, you can use any of the MC6870 series clock devices in order to create timing inputs. . . . The MCS650X series CPUs have on-chip logic; all they need is an external crystal or RC network. A number of possible circui~s, described in MOS Technology literature, are reproduced in Figure 10-11. . MCS6500 CPU INTERFACE LOGIC Look again at Table 10-1 and you will see that the 28-pin CPUs are remarkable in that they output so few control signals: in fact. the MCS6513. MCS6514. and MCS6515 output just one control signal: RIW. The remaining 28-pin CPUs additionally output clock signals only. There is no interrupt acknowledge. no synchronization output. nor any control signal which external logic can use to determine what is going on within the CPU. Of all the microprocessors (fescribed in thi~ book, none provides so few control output signals. So long as you are building relatively straightforward microcomputer systems. this does not present a problem. The Address and Data Busses are never floated by 28pin CPUs: therefore. external logic. upon detecting a select address on the Address Bus. will simply respond by reading or writing - depending upon the level of the R/W signal. The fact that this signal is high in its idle state. indicating a read. simply means that selected external logic will place the contents of its addressed memory location on the Data Bus. If the R/iN signal is really in its standby state. then the CPU will ignore the Data Bus contents and no harm is done. Thus. for simple microcomputer systems. the MCS6500 series CPUs are remarkably simple devices to work with. If a microcomputer system becomes complex. however. problems may arise. DMA logic must account for the fact that there is no detectable standby' state for memory or 1/0 devices to detect; any device selected by the address of the Address Bus is continuously ~esponding to a read or write command. 10-15 X 1-------........ o ~--.... SYSTEM <1>2 CRYSTAL PIN -- VCC A) :>e:l-_.......('lII X <1>0 (IN) Y 2/0UT) Parallel Mode Crystal Controlled Oscillator XI-------~~ ~)-..........(:'II ~~-.......__ CRYSTAL SYSTEM <1>2 PIN X O(lN) Y <1>2 (OUT) VCC B) Series Mode Crystal Cornrolled Oscillator I ·:I~ u PIN X <1>0 (IN) Y <1>2 (OUT) C) Time Base Generator - RC Network X is pin 39 for the MCS6502. or pin 28 . for any other MCS650X CPU Y is pin 37 for the MCS6502. or pin 27 for any other r,t1CS650X CPU Figure 10-11. Time Base Generation for MCS650X CPU Input Clocks 10-16 When designing microcomputer systems around an MCS6500 CPU, if you are going to share the System Bus in any way, you must be very cautious about ensuring that you have accounted for the passive role of support logic surrounding the CPU. c w ~ oQ. a: a: o o Despite the paucity of control signals on the MCS6500 bus. you can. in fact. do anything that you could do on any other bus. Using the MCS6500. it is simply going to take a little more logic. Some suggestions are given later in this chapter. when we explain how you can use non-6500 support devices !in particular 8080A support devices) with a 6500 CPU. THE MCS6500 INSTRUCTION SET ~ Table 10-2 summarizes the MCS6500 instruction set. This instruction set follows the philosophy of the MC6800 very closely. ~ The benchmark program is coded for the MCS6500 as follows: enw g (I) (I) ~ all w Z a: o IX! (I) o ~ ~ c ~ @ THE BENCHMARK PROGRAM LOOP LOY LOA STA DEY BNE LOA CLC ADC STA 10CNT (lOBUF).Y (TABLE).Y LOOP 10CNT LOAD BUFFER LENGTH INTO Y INDEX LOAD NEXT SOURCE BYTE STORE IN NEXT DESTINATION BYTE DECREMENT Y RETURN FOR MORE BYTES AT END ADD NUMBER OF BYTES TO CURRENT TABLE BASE ADDRESS TABLE+1 TABLE+1 This is the memory map assumed: DATA MEMORY Number of bytes ----- Source table base address ~ Destination ta ble first ~ free' byte address pp 00 RR IOCNT}. . . .IOBUF . TABLE Page 0 55 Start of source table Start of destination table First free destination table byte The programming example illustrated above makes use of indirect addressing. Somewhere in the first 256 bytes of memory we store the number of bytes to be transferred. the beginning address for the source table. and the address for the first free destination table byte. By loading the byte count into the Y Index register. we can use this register both as an index for moving data from source to destination. and as a counter. 10-17 After moving the block of data. we must add the number of moved data bytes to the destination table first free byte address; this accounts for the fact that the destination table has been incrementally filled. When comparing the MCS6500 with the MC6800, we see that we have indeed reduced the number of instructions from 11 to 9; the number of instructions within the iterative loop has been reduced from 5 to 4. We cannot make a more substantial reduction in the number of instructions because the fYlC6800 program uses the Stack Pointer as an Index register - which is not an option with the MCS6500. We might argue that the MCS6500 has an advantage by not immobilizing the Stack while the instruction sequence is executed; hqwever. the MCS6500 has the disadvantage of requiring both the source and destination, tables to have a maximUr1ne'lgth of 256 bytes; the MC6800 program ' makes no such demand. Symbols are used in Table 10-2 as follows: Registers: A X Y PC SP SR Accumulator Index Register X Index Register Y Program Counter Stack Pointer Status register. with bits assigned as follows: 7 6 5 .. 3 2 1 0 ~ Islal IBlol' Izlc' + Bit No. Reserved for expansion {unused at this time} Statuses: S Sign status Z Zero status C Carry status a Overflow status Symbols in the column labeled STATUSES: (blank) operation does not affect status X operation affects status operation clears status 1 operation sets status 6 status reflects bit 6 of memory location 7 status reflects bit 7 of memory location o ADR 8 bits of immediate or base address ADR16 16 bits of immediate or base address a8 Any of the ADR ADR.X (ADR.X) (ADRl.Y following operands and addressing modes: Base Page Direct Base Page Indexed via Register X Pre-Indexed Indirect Post-Indexed Indirect a16 Any of the ADR16 ADR16.X ADR16.Y following operands and addressing modes: Extended Direct Absolute Indexed via Register X Absolute Indexed via Register Y B Break status D DATA DISP 8 bits of immediate data Decimal Mode status An 8-bit. signed address displacement Interrupt disable status lABEL M( ) PC(Hi) PC(lO) [ ] 16-bit immediate address. destination of Jump-on-Subroutine call The memory location addressed via the mode specified in parenthesis The most significant 8 bits of the Program Counter The least Significant 8 bits of the Program Counter Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. 10-18 [[]] A V o Y- Implied memory addressing; the contents of the memory location designated by the contents of a register or address calculation. Logical AND Logical OR Logical Exclusive-OR w Data is transferred in the direction of the arrow e:( Data is exchanged between the two locations designated on either side of the arrow l- a: 0 a. a: 0 tJ a: enw l- e:( C3 0 (I) (I) e:( olI w Z a: 0 !Xl (I) 0 ~ e:( 0 e:( @ 10-19 Table 10-2. A Summary of the MCS6500 Microcomputer Instruction Set STATUSES TVPE MNEMONIC OPERAND(SI ADR16.V 2 2 2 2 3 3 3 a8 a16 ADR or ADR.V ADR16 or ADR16.V 2 3 2 3 ~ LOA AOR ADR.X a8 (ADR.XI (ADRI.V. ADR16 } ADRI6.X a16 OPERATION PERFORMED BVTES S Z X x C 0 [A]-[ADR] or [A]-[[X] +ADR] or [A]-[[[X]+ADR)) or [A]-[[ADR + I.ADR] + [V)) or [A]-[ADRI6) or [A)-[ADR16+ [X)) or [Al-[ADR16+ [V)) Load Accumulator from memory using any of the following addressing modes: Base page direct Base page index.ed (X register I Pre-index.ed indirect Post-index.ed indirect Ex.tended direct Absolute'indexed (Register X or Register VI Mla81-[A] or Mla161-[A] Store Accumulator to memory using any of the addressing modes permitted with LDA. [X]-[ADR) or [X]-[ADR16].or [X]-[[V] +ADR] or [X]-[ADR16+ [V] w (J 2 w II: w u. w II: > II: 0 ~ STA w ~ > LDX II: < ?N o X X 2 { 3 Load Index Register X from memory using direct. extended. base page indexed or absolute indexed addressing. indexing through Register V. [ADR]-[X] or [ADR16]-[X] or [[V]+ADR]-[X] 2 3 Store Index Register X to memory using direct. extended or base page indexed addressing. indexing through Register V. [V)-[ADR] or [V]-[ADR16) or [V]-[[X]+ADR] or [V]-[ADR16+ [X)) ~ a: IL C STX 2 < ADR or ADR.V ADR16 g LDV ADR or ADR.X ADR16 or ADR16.X X X Load Index Register V from memory using direct. extended. base page indexed or absolute indexed addressing. indexing through Register V. STY ADR or ADR.X ADR16 [ADR]-[V] or [ADR16]-[V] or [[X] +ADR]-[V] 2 Store Index Register V to memory using direct. extended. or base page indexed addressing. indexing through Register X ADC a8 a16 2 3 X X AND a8 a16 2 3 X X [A]-[A] + Mla81+ Cor [A]-[A] + Mla161+C Add contents of memory location. with carry. to those of Accumulator. using any of the addressing modes permitted with LDA. Zero flag is not valid in Decimal Mode. . [A]-[A] A M(a81 or [A]-[A] A Mla161 ADIl8 ADR16 2 3 7 X AND contents of Accumulator with those of memory location addressed via any of the modes permitted with LDA. [A] A [ADR8] or [A] A [ADR16] ...w < X X II: w IL 0 > a: 0 ~ w ~ BIT 6 AND contents of Accumulator with those of memory location. Only the status bits are affected. Direct or extended addressing modes may be ~sed. © ADAM OSBORNE & ASSOCIATES,INCORPORATED Table 10-2. A Summary of the MCS6500 Microcomputer Instruction Set (Continued) :STATUSES TYPE MNEMONIC CMP EOR ORA sse iii '~ . OPERAND(S) -- OPERATION PERFORMED BYTES a8 at6 3 a8 at6 3 a8 at6 3 a8 at6 3 2 2 2 2 Z C X X x X X [A]-[A]-Y-Mla8) or [A]-[A]-Y-Mlat6) X Exclusive-OR contents of Accumulator with those of memory location, using any of the ad-, dressing modes permitted with LOA. [A]-[A]VM(a8)or [A]-[A]VM(at6) X X 'X' X ,x 'X ,X 'X X X X X X' < a: w D.. 0 IN~ > a: 0 ADR8 or AD~,X ADRt6 or ADRt6,X 2 ADR or ADR,X ADRt6 or ADRt6.X 2 ADR ADRt6 2 3 ~ w ~ ?N w u C w Z w w u. w a: :J DEC Z ~ 3 Z a: 0 g > a: 0 ~. CPX w ~ > a: < CPV c Z 0 uw ADR ADRt6 3 2 X 3 , en ROL ASL LSR ADR or ADR,X ADR16 or ADR1S.X ADR or ADR,X ADRtS or ADRtS,X ADR or ADR,X ADRt6 or ADRtS',X 2 X X X X X X 3 2 3 2 3 0 S [A] - Mla8) or [A] - Mlat6) Compare contents of,Accumulator with those of memory location, affecting statiJs bit only. Any _ of the addressing modes permitted with LOA may be used. X OR contents of Accumulator with those of memory location, using any of the addreSsing modeS permitted with L[)A. [A]-[A] - MIaS) - Cor [A]-[A] - Mlat6) - C Subtract contents of memory location, with borrow, from contents of Accumulator. Any addr~ssing mode permitted with LOA may be used. Note that carry reflects the complement of the borrow. [ADR]-[ADR]+ tor [ADRt6]-[ADRt61+ tor [(X1+ADR]-[[X]+ADR]+ tor [ADRt6+ [X]]-[ADR16+ [X]]+ t Increment contents of memory location using direct, extended, base page indexed or'absolute indexed addressing, indexing through Register X. [ADR]-[ADR] - t or [ADRt6]-[ADRt6] - t or [(X]+ADR]-[[X]+ADR]-t or [ADRt6 + [X]]-[ADRt6 + [X]] - t Decrement contents of memory location using direct, extended, base page indexed or absolute indexed addressing, indexing through Register X. [X] - [ADR] or [X] - [ADRt6] Compare contents of X register with those of memory location, using direct or extended addressing. Only the status flags are affected. [V] - [ADR] or[Y] - [ADRt6] Compare contents of V register with those of memory location using direct or extended eddressing. Only the status flags are affected. [ADR) or [ADRt6) or [[ X1+ ADR] or r::m:=I7 ~ [ADRt6+ [X]] Rotate contents of memory location left through Carry, using direct, extended, base page indexed or absolute indexed addressing, indexing thro!Jgh Register X. oj;] []].-I 7 01( 01+-- 0 [ADR] or [ADRtS] or [[X1+ADR] or [ADRtS+ [X]] Arithmetic shift left contents of 'memory location using direct, extended, base page indexed or absolut~ indexed addressing, indexing through Register X. 0 X X 0~7 oJ.---+l]] [ADR] or [ADRt6) or [(X)+ADR) or [ADRt6+ [X)) Logical shift right cqlltents of memory,location, using direct, extended, base page indexed or absolute 'indexed addressing. indexing through Register X. ~ Table 10-2. A Summary of the MCS6500 Microcomputer Instruction Set (Continued) STATUSES TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES S Z C 0 [A)-DATA ... LOA DATA 2 X X is LOX DATA 2 X X LOY DATA 2 X X ADC DATA 2 X X AND DATA 2 X X ...w 0 ~ 1 X X [A]-[X] TXA 1 X X Move Accumuiator ·contents to Index Register X. [X]-[A] TAY. 1 X X Move contents of Index Register X to Accumulator. [A]-[Y] TVA 1 X X Move Accumulator contents to Index Register Y. [Y]-[A] TSX 1 X X Move contents of Index Register Y to Accumulator. [SP]-[X] TXS 1 DEX 1 X X DEY 1 X X INX· 1 X X INY 1 X X 1 X X III I- c; III II: ci:: III I- (/) c; Move contents of Stack Pointer to Index Register X. [X]-[SP] III II: [PC]-[ pc] + 1 + DISP TAX II: (/) 0 = 1. then Branch.relativeif Overflow flag is set. Z lOZ II: ID u~ e( III OPERATION PERFORMED 0 Move contents of Index Register X to Stack Pointer. [X]-[X]-1 ? N W III I- Decrement contents of Index Register X. [Y]-[Y]-1 Decrement contents of Index Register Y. [X]-[X]+l Increment contents of Index Register X. [Y]-[Y]+l Increment contents of Index Register Y. e( II: III Q. 0 ROL A II: X III m c; III II: ~7~ oi+J [A] Rotate contents of Accumulator left through Carry. I- ASL A 1 X X X oI-f-o ~7 4 [A] Arithmetic shift left contents of Accumulator. LSR A 1 0 X X )to~ O~7 [A] . Logical shift right contents of :.=: (.) e( PHA 1 PLA 1 PHP 1 I- m ~ccumulator. [[SP]]-[A1. [SP]-[SP]-l X X Push Accumulator contents onto Stack. [A]-[[SP] + 11. [SP]-[SP] + 1 Load Accumulator from top of Stack (PULL). [[SP)]-[SR1. [SP)-[SP)-l Push Status register contents onto Stack. Table 10-2. A Summary of the MCS6500 Microcomputer Instruction Set (Continued) TYPE MNEMONIC OPERAND(S) STATUSES BYTES PLP 1 RTS 1 S Z C 0 X X X x C ~ 0 w :J Z OPERATION PERFORMED [SR]-[[SP] + 11. [SP]-[SP] + 1 Load Status register from top of Stack (PULL). [PC(LOI]-[[SP] + 11 [PC(Hil]-[[SP] + 21. « i= ~ (/) z [SP]-[SP] + 2. [PC]-[PC]+ 1 0 ~ Return from' subroutine. CLI 1 1-0 SEI 1 Enable interrupts by clearing interrupt disable bit of Status register. 1-1 RTI 1 X X X X Disable interrupts. [SR]-[[SP] + 11. [PC(LO)]-[[SP] + 21. [PC(Hil]-[[SP] + 3]. ~ 11- :J cc cc [SP]-[SP]+3. [PC]-[PC]+ 1 w ~ Return from interrupt; restore Status register and Program Counter from top of Stack. ~ BRK [[SP]]-[pC(Hil1. 1 [[SP]-I1-[PC(LOI1. [[SP]-2]-[SR1. [SP]-[SP]-3. [PC(LO)]-[ FFFE1. [PC(HI)]-[ FFFFJ. l-l.B-l Programmed interrupt. BRK cannot be disabled. CLC 1 0 C-O SEC 1 1 Clear Carry flag. C-l CLD 1 Set Carry flag. D-O SED 1 Clear Decimal Mode. D-l CLV 1 en :J ~ « ~ (/) Set Decimal Mode. 0 0-0 Clear Overflow flag. NOP 1 No Operation. The following symbols are used in the object codes in Table 10-3. Q W ~ II: 0 no II: 0 (J ~ en 'W ~ < U 0 en en < GiS w zII: 0 al en 0 ~ < Q < @ Address mode selection: aaa 000 pre-indexed indirect - (ADR.X) 001 direct -, ADR 010 immediate - DATA 011 extended direct - ADR16 100 post-indexed indirect - (ADR).Y 101 base page indexed - ADR.X 110 absolute indexed -ADR16.Y 111 absolute indexed - ADR16.X bb 00 direct-ADR 01 extended direct-ADR16 10 base page indexed - ADR.X 11 absolute indexed - ADR 16.X bbb 001 direct-ADR 010 accumulator -A 011 extended direct-ADR16 101 base page indexed - ADR.X 111 absolute indexed - ADR16.X cc 00 immediate-DATA 01 direct-ADR 11 extended direct - ADR 16 ddd 000 immediflte - DATA 001 direct-ADR 011· ext~nded direct - ADR16 101 base page indexed - ADR. Y in LDX; ADR.X in LDY 111 ab~olute indexed-ADR16.Y in LDX; ADR16.X in LDY pp the second bYtr of a two- or three-byte instruction. qq the thir~ byte of a three-byte instruction. x one bit choosing the address mode. Two numbers in the "Machine Cycles" column (for example. 2 - 6) indicate that execution time depends on the addressing moge. 10-25 Table 10-3. Summary of MCS6500 Object Codes. with MC6800 Mnemonics OBJECT MNEMONIC OPERAND(S) DATA or a8 a16 AND DATA or a8 a16 BCC BCS BEQ A ADR or ADR.X ADR16 or ADRl6.X DISP DISP DISP BIT ADR (x~~O) ADR16 BMI BMI BNE BPl l' N en BRK BVC BVS (x~l) DISP DISP DISP DISP PP qq oolaaaOl pp qq OoobbblO pp qq 90 pp BO pp FO pp 0010xloo pp qq 30 pp 30 pp pp MACHINE MCSSOO CYCLES INSTRUCTION 2 3 2-6 4 2 3 1 2-6 4 ADCA ADR8 or DATA ADR16 ANDA ADR8 or DATA ADR16 2 5-6 ASL A ADR8 2 3 2 6-7 ADR16 DISP 2 BCC BCS BEQ 2 2 2 2 2 3 4 3 2 2 CLI B8 110aaaOl pp 2 ClV CMPA 2 2-6 a16 qq 3 4 DATA or ADR ADR16 1110ccoo pp qq DATA or ADR l100ccoo pp CMP DATA or a8 CPX CPY ADR16 DEC ADR or ADR.X . ADR16 or ADR16.'\( DEX DEY EOR DATA or a8 a16 INC ADR or ADR.X ADR16 or ADR16.X qq 110bbll0 pp qq CA 88 01OaaaOl pp 2 3 2-3 2 3 2-3 4 2 5-6 3 1 1 6-7 2 qq lllbbllO pp qq 3 E8 C8 1 1 2 3 4 2 5-6 6-7 2 2 3-5 LABEL 3 6 2 3 2-6 4 2 2-4 3 4 2 2-4 4 LOX BVC BVS ADR or ADR.X lSR pp qq 010bbbl0 pp qq EA oooaaa01 pp qq 48 08 68 28 oolbbbl0 pp qq 40 60 lllaaaOl pp qq 38 F8 78 -l00aaaOl DISP DISP DISP ClC ADR80r DATA ADR or ADR.X ADR16 or ADR16.X NOP ORA DATA or a8 a16 PHA PHP PLA PlP ROl DATA 16 or ADR16 RTI RTS SBC DATA or a8 a16 SEC SED SEI STA DEC ADR8 STX - STY ADR16 ADR(bb~~oo) or ADR.Y(bb~~10) ADR16 (bb=Ol) ADR (bb ~·OO) or ADR.X (bb~10) ADR16 (bb~·Oll EORA ADR8 or DATA INC ADR8 (aaa ~·010) a8 a16 ADR16 _DEX ADR16 A ADR or ADR.X ADR16 or ADR16.X ADR16 CPX ADR8 lNX • DATA or a8 a16 DATA or • ADR or ADR. Y 101aaaOl pp qq 101dddl0 pp ADR16 or ADR16.Y A .2 2-6 4 3 JSR . 01xOlloo ppqq 20 ppqq DISP BMI 2 58 LABEL (x· 0) or (LABELXx . 1) DISP BMI DISP BNE DISP BPl DISP (SWn 1 1 CLI ClV JMP qq 101dddoo 2 2 2 2 2 18 08 BYTES ADR16 or ADR16.Y DATA or 2 2 2 1 1 DISP DISP CODE ADR8 or DATA ADR16 2 2 7 PI) 00 50 pp 70 pp OPERAND(S) LOA 2 3 1 2 3 1 1 1 1 1 2 2 5-6 6-7 2 2-6 4 3 3 4 4 2 5-6 3 1 1 6-7 2 3 2-6 4 1 2 1 2 6 6 JSR ADR16 LDAA ADR8 or DATA ADR16 lOX ADR8 ADR16 or DATA16 LSR A ADR8 ADR16 NOP ORA ·ADR8 or DATA ADR16 PSHA PULA ROl A 'ADA8 ADR16 RTI RTS SBCA ADR8 or DATA ADR16 SEC 2 SEI STAA ADR8 ADR16 STX ADR8 ADR16 3 l00bbl00 pp 2 3-4 qq 3 4 AA A8 BA 2 2 SA 1 1 1 1 9A T 2 2 2 1 2 -- ADR16 3-6 4-5 3-4 4 98 JMP 2 2 - - INSTRUCTION 1 3 TSX TXA TXS TYA 3 1 . CYCLES l00bbll0 TAX __ TAY Messoo MACHINE OBJECT . MNEMONIC _DY BITA 2 2 1 DO 10 ClC CLD INX -INY BYTES 011aaaOl ADC ASL CODE TSX TXS SUPPORT DEVICES THAT MAY BE USED WITH THE MCS6500 SERIES MICROPROCESSORS cw The MCS6500 and MC6S00 microprocessors are similar enough for MC6S00 support devices to be used with an MCS6500 series central processing unit. ~ a: oD.. The similarities between the MC6S00 and MCS6500 extend also to the way in which you use other support devices with these two microprocessors. Therefore, you should read the MC6S00 section in Chapter 9 that describes using the MC6S00 CPU with other support devices before you read this text. Comments regarding SOSOA and ZSO support devices being used with the MC6S00 apply for the most part to the MCS6500. ~ But the MCS6500 does' have some limitations. The most prominent limitation is the fact that no MCS6500 microprocessor floats its System Bus. Only the MCS6512 has any bus floating capability at all; you can float its Data Bus. Within an MCS6500 microcomputer system. if you wish to float the System Bus or perform direct memory access operations, you must have an external tristate buffer. This tristate buffer receives as inputs the System Bus from the MCS6500; it creates as outputs the System Bus which will be used by support devices. This may be illustrated as follows: a: o o enw ~ U o en en oCt all w Z t a: o en en Address Bus o . Address Bus , ~ oCt oCt o Data Bus MCS65XX @ .. .. r ... Control Bus A Tristate Buffer .. Data Bus .... ) , Float control from external logic equivalent to 8080A BUSEN ... ) r '" A Control Bus ... ) r r '" Tristate System Bus If you are going to use an MCS6500 CPU with support devices from other microprocessor families, you will in all probability use the MCS6502 or the MCS6512. It would make little sense to begin with the limitations of a 2S-pin 6500 CPU and then expand it to interface with non-6500 support devices. We will therefore consider only MCS6502 and MCS6512 busses expanded to generate SOSOA compatible interfaces. Logic may be illustrated as follows: MCS6502 or MCS6512 Bus 8080A Bus R/W <1>2 (TTL) +5V ROY (Asynchronous) +5V PRF "'-+--4~""D 7474 PRF 0 o 7474 01 (B) (A) ....-+---IC IT C CLR CLR +5V +5V HOLD ROY to MCS65XX CPU .....t - - - - i t - - - - - - - - - ' t - - - - - - ' IRO INT Decode FFF9 on Address Bus 10-27 The logic illustrated above is quite similar tb thilt which we described for the MC6800 in Chapter 9. The Read (RD) and Write (WR) control signals are generated by separating out R/W via two NAND gates that are conditioned by <1>2 (TTL). This is the same logic that we illustrated for the MC6800. HOLD and Bus Enable (BUSEN) signals require more complex generation out of an MCS6500 bus - but still the logic is quite simple. Since the MCS6500 has no Hold condition. we must use the Wait State created in response to a RDY input. The 7474 D-type flip-flop marked (A) synchronizes an asynchronous RDY input to ensure that it makes a high-tolow transition while <1>1 is high. as is required by MCS6500 lOgic. To ensure that the synchronous Ready output does not.occur during a Write cycle. the (A) flip-flop output is NAN bed with R/Vii to create a valid MCS6500 RDY input. We use thenext high-to-Iow transition of <1>2 (TtU to identify the beginning of the Wait State. Timing may be illustrated as follows: <1>1 <1>2 ROY R/W Q(A) D(S) HOLD WAIT STATE I. As iliustrated by the timing ab~ve. the ~bLD and BUSEN Signals will accurately identify time intervals when the MCS6500 CPU is in aWait State. But remember. busses are not floated by the MCS6500 CPU While it is in the Wait State. You must therefore use either the HOLD or BUSEN signal as a float control strobe on a tristate buffer (as illustrated earlier!. If we look at the interrupt request and acknowledge signals of the 8080A bus. the interrupt request represents no problem; we simply invert INT to' create IRO. Generating an int~rrupt acknowledge is not so straightforward. We must decode the second address byte.of the interrupt atknowledge sequence (FFF916) off the Address Bus. without the comfort of.a valid memory address (VMA) signal. The logiC shown uses the combination of R/W high. indicating a necessary read condition. together with the initial asynchronous RDY high. indicating no Wait request. to validate the FFF916 address on the Address Bus. Thus. a 7474 D-type flip-flop together with four NAND gates and two inverters will create an 8080A-compatible System Bus for an MCS6502 or MCS6512 CPU. You can generate an 8080A-compatible system clock from tP2 (TTL) as follows: +5V 5.6 Kn 100 pF +5V CLR B 11>2 (TIll Q 74LS123 A 10-28 CLK The clock logic illustrated above is identical to that which we described for the MC6800. THE MCS6522 PERIPHERAL INTERFACE ADAPTER Q w The MCS6522 PIA is an enhanced version of the MC6820, which is also manufactured by MOS Technology as the MCS6520. Peripheral Interface Adapter. As such, the MCS6522 PIA can be used interchangeably in MC6800 or MCS6500 microcomputer systems. a: This description of the MCS6522 will concentrate on highlighting device enhancements, relying on the discussion of the MC6820, given in Chapter 9, for a detailed explanation of functions common to both parts. ~ a: ono o ~ en w I- oCt (3 oen en oCt all The MCS6522 PIA is a general purpose I/O device which, like the MC6820 PIA provides 16 I/O pins, configured as two 8-bit I/O ports. As compared to the MC6820 PIA the MCS6522 provides more handshaking logic associated with parallel data transfers occurring via I/O Port A. Counter/timer and elementary serial I/O logic have been added to MCS6522 Port B. Figure 10-12 illustrates that part of our general purpose microcomputer system logic which has been implemented on the MCS6522 PIA. w Z a: o III en o :E oCt Q oCt @ Clock Logic .. Logic to Handle Interrupt Requests from External Devices ri> Arithmetic and Logic Unit - . -_ ... Accumulator Registerts) j Instruction Register ~ l..t> Control Unit ~ Data Counterts) f Stack Pointer ~ Program Counter • 11 7 Interrupt Priority Arbitration Bus Interface Logic Direct Memory Access Control Logic <2-t> 7 $ ... System Bus e i·~ I/O Communication Serial to Parallel Interface Logic ROM Addressing and Interface Logic Programmable Timers Read Only Memory ~ I/O Ports Interface Logic * I/O Ports ~ Figure 10-12. Logic of the MCS6522 PIA 10-29 *t ~ RAM Addressing and ~ Interface Logic t Read/Write Memory ~ The MCS6522 PIA is packaged as a 40-pin DIP. It uses a single +5V power supply. All inputs and outputs are TTL compatible. I/O Port A and B pins are also CMOS logic compatible. I/O Port B pins may be used as a power source to directly drive the base of a transistor switch. The device is implemented using N-channel, silicon gate MOS technology. THE MCS6522 PIA PINS AND SIGNALS The MCS6522 PIA pins and signals are illustrated in Figure 10-13. Signals which are identical to the MC6820, both in function and pin assignment, are shaded. We will summarize all signal functions, those which are unique to the MCS6522 as well as those which are common to the MC6820, before describing the various MCS6522 PIA operations which can be performed. Consider first the various Data Busses. DO - 07 represents the bidirectional Data Bus via which all communications between the CPU and the MCS6522 occur. This Data Bus is identical to that of the MC6820. When the MCS6522 is not selected. the Data Bus buffer is placed in a high impedance state - which is absolutely necessary. since MCS6500 CPUs (with the exception of the MCS6512) cannot float the System Data Bus. PAO - PA7 and PBO - PB7 represent Data Busses connecting I/O Ports A and B with external logic. In terms of simple data transfers, these two I/O ports are identical on the MCS6522 and MC6820 devices. In each case the 16 110 port pins may be looked upon as 16 individual signal lines. or as two 8-bit I/O busses. Each I/O port pin can be individually assigned to input or output. but an individual pin cannot support bidirectional data transfers. There are differences between I/O Ports A and B. Some of these differences are found in MC6800 I/O ports; others represent enhancements of the MCS6522. Let us first look at I/O port differences which are connom to the MC6820 as well as the MCS6522: 1) An I/O Port B pin which has been assigned to output will enter a tristate condition during an input operation. this is not the case for an I/O Port A pin. This means that loads placed on I/O Port B pins will not modify data waiting to be read by the CPU. 2) I/O Port A pins will register logical 1 when +2V or more are input: logical 0 results from an input of +OAV or less. I/O Port B pins will register logical 1 when power levels below +2V are input. 3) As outputs. I/O Port B pins may be used as a source of up to a milliampere. at +1.5V. to directly drive the base of a transistor switch. This is not feasible using I/O Port A pins. The different I/O Port A and B characteristics are a function of port pin design. I/O Port A pins contain "passive" pullups which are resistive and allow the output voltage to go to +5V for logic 1 : +5V )LPA ---f: The PA pins can drive two standard TTL loads. 1 I/O Port B pins are push-pull devices; the pullup is switched "off" in the +5V 10-30 a state and "on" for a logic 1: The pullup can source up to 3 ma at 1.5V: that is why an I/O Port B pin can drive a diode. LED or similar device. ", Vss 'PAQPAl Q w ~ ,'PA2 o ou PM " .. PA3 III: D. III: PAS ·"PAS , PA7 :!: en w PBO Pel ~ ,PSi en en ct , PB4 g ... .. : -- Pal "PBS -. P86 III w Z - ~ '...- PB1 III: o CSI CD C82 en 'VOD o .. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 MCS6522 PIA @ 33 32 31 ..... , .. RS3 ,-. ..' ~ RESET DO 01 02 " 03 D4 30 29 28 27 26 25 24 23 22 21 CA1 , CAl RSO RSI RS2 34 ~ ct Q ct ',. OS' 06 07 «P2. CS1 -- .W2 R/W iRQ Pin Name Description Type DO-07 Data Bus to CPU Port A Peripheral Data Bus Port B Peripheral Data Bus Chip Select Register Select Interrupt input to Port A Interrupt input/Peripheral.control output Interrupt input/Shift register access lilterrupt input/Peripheral control/Shift register access Device synchronization Read/Write control' Interrupt request Reset Power and Ground Tristate. bidirectional Input or Output Tristate. Input or Output Input Input Input Input or Output Input or Output Input or Output Input Input Output Inp'Jt· PAO- PA7 PBO - PB7 CSI. CS2 RSO - RS3 CAl CA2 CBl CB2 $2 R/W iRQ RESET VOO.vss Figure 10-13. MCS6522 PIA Signals and Pin Assignments Let us now look at differences between MCS6522 I/O Port A and B pins which are the result of MCS6522 logic enhancements: 1) There are two programmable counters connected to I/O Port B logic. The MC6820 has no counter logic. 2) There is an 8-bit Shift register associated with I/O Port B logic. The Shift register provides an elementary serial I/O capability which may be adequate for certain types of control logic. but falls short of what is needed to support serial data communications. The MC6820 has no serial I/O capability whatsoever. 3) I/O Port A provides CA2 as an output control signal when the CPU reads or writes data. I/O Port B provides CB2 as an output control signal when the CPU writes data only. The MCS6522 PIA has six device select pins. CS1 and CS2 are two typical select signals, exactly equivalent to MC6820 signals bearing the same names. Note that the MCS6522 has no CSO select. For the MCS6522 device to be selected. CS1 must receive a high input while CS2 simultaneously receives a low input. RSQ, RS1, RS2 and RS3 address one of 16 locations within the MCS6522. Thus an MCS6522 device will appear to a programmer as 16 memory locations. Note that the MC6820 has only two address lines. RSO and RS 1. and appears to a programmer as four memory locations. Addressing logic associated with the MCS6522 is. in fact. quite simple. Combining the two chip MCS6522 select signals. CS 1 and CS2. with the four address select Signals. RO. R1. R2 and R3. simply means ADDRESSING that total device logic will be derived from six of the 16 Address Bus lines - and to the programmer, the MCS6522 PIA will appear as 16 contiguous memory locations. Table 10-4 identifies the 16 addressable 10-31 locations of the MCS6522. For the moment it is not important that you understand the nature of these addressable locations; rather. let us concentrate on the select lines RSO - RS3. Throughout this description of the MCS6522. we are going to identify addressable locations by a label and a "select code".The "select code" consists of the signal levels given in the left-hand column of Table 10-4. To a programmer. a "select code" will simply become some index which must be added to a base address. Suppose. for example. that your interfacing logic will cause an MCS6522 to consider itself selected when any address is output in the range C00016 through COOF16. Select code 00002 now corresponds to memory add ress COOO 16; select code 1112 now corresponds. to memory address C00716. That ·is the relationship between select code and memory address. a There are four timing and control signals which interface an MCS6522 with external logic. These four signals are CA 1, CA2, CB1 and CB2. Superficially, these four signals are identical to their MC6820 equivalents. But there are some secondary differences. CA 1 and CA2 are control signals associated with 1/0 Port A. CA 1 is an input signal whereas CA2 is bidirectional. CBl and CB2 are equivalent signals associated with 1/0 Port B. however. CB 1 is bidirectional. although it is used as an input by Shift register logic only. There are two control signals associated with the MCS6522 CPU interface. <1>2 is the phase two clock which is output by any of the MCS6500 CPUs. The MCS6522 uses <1>2 as a standard synchronization signal, equivalent to the E signal used by the MC6820. The trailing edge of each <1>2 pulse synchronizes all logic and timing within the MCS6522. <1>2 is used optionally by Shift register logic to clock serial input or output data. RIW is the standard read/write control signal output by all MCS6500 CPUs. This signal is identical to that on the MC6820. Recall that when RIW is high. a read operation is specified and data transfer from the MCS6522 PIA to the CPU will occur. When RiW is low. a write operation is specified and data transfer from the CPU to the PIA will occur. The MCS6522 has a single interrupt request signal IRa. In contrast, the MC6820 has two interrupt requests IRaA and IRaB. If you are simply going to wire-OR interrupt requests and connect them to the CPU IRO pin. then having two requests. IROA and IROB. makes no sense; combining them is preferable: On the other hand. if you are going to include any type of interrupt priority arbitration logic. such as the MC6828. then by combining IROA and IROB into a single interrupt request. you can no longer vector separately to interrupt requests arising at either I/O Port A or I/O Port B logic. You must vector a single interrupt request. arising fromeither of these ports; then you must execute instructions to test status bits and determine the exact interrupt source. Table 10-4. Addressing MCS6522 Internal Registers LABEL SELECT LINES RS3. RS2. RS1. RSO DEV DEV+1 DEV+2 DEV+3 DEV+4 0000 0001 0010 0011 0100 DEV+5 0101 DEV+6 DEV+7 DEV+8 0110 0111 1000 DEV+9 1001 DEV+A DEV+B DEV+C DEV+D DEV+E DEV+F 1010 1011 1100 1101 1110 1111 ADDRESSED LOCATION Output register for 1/0 Port B Output register for 1/0 Port A. with handshaking 1/0 Port B Data Direction register 1/0 Port A Data Direction register. Read Timer 1 Counter low-order byte Write to Timer 1 Latch low-order byte Read Timer 1 Counter high-order byte Write to Timer 1 Latch high-order byte and initiate count Access Timer 1 Latch low-order byte Access Timer 1 Latch high-order byte Read low-order byte of Timer 2 and reset Counter interrupt Write to low-order byte of Timer 2 but do not reset interru pt Access high-order byte of Timer 2; reset Counter interrupt on write Serial 1/0 Shift register AuxiliaryControl register Peripheral Control register Interrupt Flag register Interrupt Enable register Output register for 1/0 Port A. without handshaking 10-32 RESET is a standard Reset input. When input low. the contents of all MCS6522 registers will be set to O. Reset logic of the MCS6522 and MC6820 is identical. MCS6522 PARALLEL DATA TRANSFER OPERATIONS Q w ~ a: oa. a: o u ~ Because there are significant differences between the logic associated with MCS6522 I/O Ports A and B, we will begin by examining I/O Port A operations. When you examine 110 Port A operations. the first addressable location to look at is 0011 (DEV+3) -the I/O Port A Data Direction register. You must load a mask into this register in order to assign individual 110 port pins to input or output. A 0 in any bit of the Data Direction register will cause tQe corresponding I/O Port A pin to input data only. A.1 in any bit position will cause the corresponding I/O Port A pin to output data only. . MCS6522 I/O PORT A DATA TRANSFER enw You access I/O Port A. either to read or write data. via select code 00012 (DEV+1) or 11112 (DEV+Fl. g But before we discuss why I/O Port A has two select codes. we must describe the way in which read and write operations occur in conjunction with pins having been assigned to input or output. Read and write logic is best il. lustrated as follows: ~ CI) CI) ct ~ w z a: o CD CPU writes data·. Buffer CI) o I/O Output -{ ~ ct Q ct Eight I/O Port A @ Pins - - - - - - - - - - - - CAl latches data Data being output is written to the I/O Output buffer: signal levels are created immediately at those I/O pins which have been declared as output pins. I/O pins which have been declared as input pins are. in effect. disconnected from the 110 Output buffer - and are in no way affected by I/O Output buffer contents. I/O Input latches will reflect the signallevelof every I/O Port A pin. whether it has been assigned to input or output: I/O Input latches will acquire I/O Port A pin levels when latched by an active transition of the CA 1 control input. For the most part. this scheme is inconsequential toyou as an MCS6522 user. since whatever you write to output pins will be output.·and you will read whatever external logic inputs to input pins. The only caution is that you cannot read back what you write to output pins. Latch timing and transient signal levels at output pins can modify data as it travels from I/O Output buffers to I/O Input latches. Irrespective of whether I/O Port A pins havebeen assigned to input or output. control signals CA 1 and CA2 can be used to provide handshaking. External logic uses CA 1 to communicate with the microcomputer system: CA2 may be a control input or a control output signal. First you must enable I/O Port A by writing a 1 into bit 0 of the Auxiliary Control register (select code 1011 or location DEV+B), which is illustrated in Figure 10-14. Next you select your CA1 and CA2 control options by writing appropriate codes into bits 0 - 3 of the Peripheral Control register, which is illustrated in Figure 10-15. When you access I/O Port A via select code 00012 (DEV+ 1l. then as soon as data is written into the I/O Port A buffer.. the CA2 signal may output low. or it may pulse low; you determine how CA2 will respond by the code you load into the Peripheral Control register. Bits 1. 2 and 3 of the Peripheral Control register determine the way in which control signal CA2 will function. If these three bits are 100. then when you address I/O Port A via select code 00012. CA2 will go low as soon as the I/O port is accessed: 10-33 rcpu '"" CAl re'" f~m. ~ ~" " I/O Port A via select code 0001 2 7 6 5 " 3 2 1 0 ... I I I I I I I I -.-......-... , Bit No. Auxiliary Control register I + o Disable inputs at I/O Port A 1 Enable inputs at I/O Port A o Disable inputs at I/O Port B 1 Enable inputs at I/O Port B 000 001 010 011 100 101 110 111 Disable Shift register Shift in a.t Counter 2 rate Shift in at <1>2 clock rate Shift in at external clock rate Free-running output at Counter 2 rate Shift out at Counter 2 rate Shift out at <1>2 clock rate Shift out at external clock rate oDecrement Counter 2 on <1>2 clock, in one-shot mode 1 Decrement Counter 2 on external pulses input via PB6 o Disable output via PB7} 1 Enable output via PB7 o One-shot mode Counter 1 controls 1 Free-running mode Figure 10-14. Auxiliary Control Register Bit Assignments L 7 6 5," 3 2 1 I , -- "" , o ~BitNo. I I . Peripheral Control register 0transition _"""" ;moo'" of CA 1 00 higIHo-l~ } ,1 Request interrupt on low-to-high Interrupt Flag register bit 1 , transition of CA 1 ,"000 CA' 'op", mod. On interrupt request set } _,,~I ,,,,,,,,,, 001 CA2 'independent input mode '.. 010 CA2 input 'mode' ,00 } Do 'o"~,, high'-to-Iow CA2 transition Request interrupt on request set Interrupt Rag 011 CA2 independent input mode } low-to-high CA2 transition 100 CA2 output low on CPU read or write 101 CA2 output low pulse on CPU read or write , 110 Output CA2 low register bit 0 111 Output CA2, high . 0_",,,, 'm"Np' 00 h'9h_"_I~} transition of CB 1 1 Request interrupt on low-to-high transition of CB 1 000 CB2 lop", modo On interrupt request set Interrupt Flag register bit 4 } _"""" '0"""" 00 001 CB2 independent input mode 010 CB2 input mode high-to-Iow CB2 transition Request interrupt on 011 CB2 independent input mode } low-to-high CB2 transition 100 101 110 111 CB2 output low on CPU write CB2 output low pulse on CPU write Output CB2 low Output CB2 high Figure 10-15. Peripheral Control Register Bit Assignments 10-34 } Dorequest 'moo,,, set ' Interrupt Flag register bit 3 If bits 3. 2 and 1 of the Peripheral Control register contain 101. then CA2 will pulse low for one clock period when you access the I/O Port via the select code 00012: <1>2 c w CA2 ~ a: o0. a: ~ ~ U o (I) (I) ct all w Z a: o aI (I) o ~ ct c ct @ ~ I CPU just read from. or wrote to I/O Port A via select code o(J en w " 0001. If bits 3. 2 and 1 of the Peripheral.Control register contain any other values. CA2 will not be affected by the CPU accessing I/O Port A via select code 00012 (DEV+1). If CA2 makes an active transition when you access 1/0 Port A, then any interrupts pending for CA 1 or CA2 be cleared. will If you access I/O Port A via the select code 11112 (DEV+Fl. then CA2 is unaffected. whatever Peripherai Control register bits 3. 2 and 1 contain. Notice that bits 3. 2 and 1 of the Peripheral Control register primarily determine whether control signal CA2 will be an input or an output control. We have seen two of the output control options. The remaining two output options force CA2 to be either output high or low. Let us look at the CA2 input options. which are also specified via Peripheral Control register bits 3. 2 and 1. If any input option has been specified. then it makes no difference whether you access I/O Port A via the select code 00012 (DEV+1) or 11112 (DEV+F); since CA2 has been specified as input control. it cannot be output low or pulsed low when you access I/O Port A. . The CA2 input options available to you are as follows: 1) You can specify that a CA2 input high-to-Iow. or low-to-high transition will generate an interrupt request. 2) You can specify that any interrupt pending from a CA2 active transition will. or will not be cleared when I/O Port A is accessed via the select code 00012 (DEV+1). Accessing I/O Port A via the select code 11112 (DEV+F) will never affect any pending interrupt statuses. In Figure 10-15, CA2 "input mode" means prior CA2 active transition interrupt requests are cleared when you access 1/0 Port A via select code 00012 (DEV+1); no such interrupt reset occurs in "independent input" mode. Peripheral Controi register bit 0 determines whether input control signal CA 1 will generate an interrupt request on a hig h-to-Iow. or a low-to-high transition. One or the other transition will always cause an interrupt - and the only way of ignoring CA 1 interrupts is to individually disable them. We will describe how this is done later when we discuss interrupt logic in general. If you access 110 Port A via the select code 00012 (DEV+11. and you cause CA2 to output low by storing 100 in bits 3.2 and1 of the Peripheral Control register. then CA2 will return high again when CA 1 makes its active transition. This may be illustrated as follows: CAl CA2 -----.)1---------,.'( . CPU accesses I/O Port A External logic acknowledges with active CA I transition While handshaking options available with 1/0 Port A may seem complex, in reality they are quite simple. For easy reference, options are summarized in Table 10-5. Next, consider 1/0 Port B. If you look upon 1/0 Port B simply as a data transfer conduit, then it is very similar to 1/0 Port A, simply lacking a few 1/0 Port A features. MCS6522 I/O PORT B Like I/O Port A. I/O Port B has a Data Direction register (select code 0010 2 or label DEV+21. DATA TRANSFER which you use to identify input and output pins. You must load a mask into this register in order to assign individual I/O port pins to input or output. A 0 in any bit of the Data Direction register will cause the corresponding I/O Port B pin to input data only. A 1 in any bit position will cause the corresponding I/O Port B pin to output data only. 10-35 Table 10-5. Summary of I/O Port A Handshaking Control Signals I/O Port A Select Code' (Binery) 0001 or 1111 . Peripheral Control Regilter Bits 3 2 1 0 ,CD CA1.- On 0001 select code eccess or programmed reset On 0001 select code access or programmed reset " 0 0 0 CA2~ 0001 or· 1111 0 0 0·1 CA1~ ,0 0, CA2~ ,CD 0001 or 1111 0 0 0001 or 1111 0 0 0001 or 1111 0 0001 or 1111 0 0001 or 1)11 0 0001 or 0 0 1 0 CAl \CD \CD ...- CA2 ~ 1 1 1 0 0 1 (j), ,(]) , CAl -4- CA1~ Programmed reset only (]), 'CD , (]) CA2.- 1 0 0 0 On'OOOI select code access or . programmed . reset (])/ CA2..-. 1 1 1 On 0001 'select code access or programmed reset (]), CA2 . - 1 1 0 reset only \ CD CA1...- CA1...- Programmed \CD CA2·...- 1 0 Programmed reset only 'CD CA1~ CA2.- 1111 0001 Interrupt Reset CONTROL SIGNALS Programmed reset only I CD ~ CA1.- CA2~\0 At@or programmed reset .(]) 1111 1 0 0 0 ~ CA1...CA2~ 10-36 Programmed reset only Table 10-5. Summary of 1/0 Port A Handshaking Control Signals (Continued) Q w ~ oa. I/O Port A Select Code (Binary) Perlpherat Control Regl.ter Blta 3 0 1 2 a: 0001 1 0 0 1 a: o o ~ .~ CAt~ CA2-...,0 ~ en w 1111 1 0 0 1 g ;:cr CAl~· CA2~ (I) (I) < ciI w 0001' Z 1 0 1 0 CAl~ CD l::.- CA1~ L- CA2-+~ a: o m (I) o ~ < < @ Q 1111 0001 1 0 1 0 1 0 1 1 1 0 1 1 CA2-. unaffected CAl~ <. CDr- , 0001 or 1111 0001 or 1111 0001 or 1111 0001 or 1111 J)lnterrupt request CDr- CAl~ CA2~ CA2 \ 1 0 1 2 clock pulse. The initial value loaded into the Counter' registers identifies the interval of the Counter. An active time-out of the Counter is' marked by an interrupt request. . . If the Counter is connected to pin 7 of 1/0 Port B. then an active time-out will also cause the signal output at pin 7 of 1/0 Port B to invert or pulse low. depending on the mode in which the Interval Timer is operating. A 1 in bit 6 of the Auxiliary Control register will connect Counter logic to pin 7 of 1/0 Port B. A 0 in bit 6 of the Auxiliary Control register disconnects Counter logic from pin 7. Via bit 7 of the Auxiliary Control register. you can connect or disconnect Counter and Latch logic. A 0 in bit 7 of the Auxiliary Control register is a disconnect. whereas a 1 is a connect. . Referring to Figure 10-14. "One-Shot Mode" refers to disconnected Latch and Counter logic. while "Free RJnning Mode" refers to connected Latch and Counter logic. If Counter logic is disconnected from the Latch registers. then following Counter initiation there will be oneactive timeout. after which the Counter will continuously redecrement from 000016. through FFFF16. and back to 000016. Subsequent counts are inactive - which means that no interrupt will be requested. and if connected to pin 7 of 1/0 Port B. no signal changes will be output. If Counter logic is connected to the two Latch registers. then. every time the Counter times out. it is immediately reloaded wi'th the contents of the Latch registers - and begins another active time out. Under these circumstances. every Counter time out is active - and will be marked by an interrupt request. plus a signal level change at pin 7 of 1/0 Port B. if this pin is connected to Counter logic. While the Interval Timer 1 options may appear complicated. in fact they are very simple. To you. as a programmer. there is only one option that you must define when using Interval Timer 1 of the MCS6522: do you want the Interval Timer to operate in one-shot or. free running mode? . Let us first c~nsi~er One-Shot Mode. which is selected by having Control register. ~ 0 in bit 7 of the Auxiliary' MCS6522 INTERVAL TIMER 1 ONE-SHOT MODE' Recail that in One-Shot Mode the Counter is disconnected from the Latch registers. For practical reasons. however. this disconnection is not complete: you have to initiate a time out by loading an initial value into the high-order and low-order Counter bytes; but the Counter is continuously running. Were you to load the low-order byte. and then the high-order byte to the Cou nter register. problems could arise. because the. low-order byte wou Id start decrementing before you had completed loading the high-order byte. To resolve this problem. you initially load the lowcorder Counter register byte value into the low-order Latch register byte: then you directly load the high-order Counter register byte. You do this by writing into the memory addresses associated with select codes 01002 (DEV+4) and 01012 (DEV+51. When you write into select code 01002 (DEV+41. you load the low-order byte of the initial Counter valueinto the low-order Latch register byte. When you write into select code 01012 (DEV+51. you load the high-order Latch register byte. but immediately the 16 Latch register bits are loaded into the Counter. which starts decrementing. As soon as the Counter times out. an interrupt is requested: and if. via Auxiliary Control register bit 6. you have connected 1/0 port pin 7 to the Counter. then a low pulse will be output via pin 7. the low pulse will have a width of one <1>2 clock period: <1>2 Pin 7 Time out Initiate a Line interval Note that when using an MCS6522. the onuS is upon you to make su re that all programmable signal levels are at their correct level. In the illustration above. <1>2 is not a programmable signal. so you can ignore it. The pin 7 level is programmable: it is up to you to make sure that a high level is being output at pin 7. or else a low pulse will not occur. Whatwe are saying is that Interval Timer 1 logic will not insure that pinTis normally outputting a high level. You must firstdefinepin 7 as an output by writing a 0 into bit 7 of the 1/0 Port B Data Direction register. Then you must output a 1 to bit 7 of 1/0 Port B. Having thus established acontiHuous high level being output at pin 7; you can be sure of a low pulse marking an active time out. . 10-40 Following a time out in the One-Shot Mode. the Counter decrements continuously via FFFF16 to 000016. On subsequent time outs no interrupt request occurs and no low pulse is output via pin 7 of liD Port 8. p---------~--~ Q w ~ a: o Il. a: o o ~ en w ~ g CI) CI) ct IIi:I w 2 If you have specified the free running mode by loading 1 into bit 7 of the Auxiliary Control register, then as soon as the Counter times out. Latch register contents are immediately transferred to the Counter register. which again decrements to an active time out. Thus a sequence of interrupt requests. with optional signal output via pin 7 of liD Port 8 will occurbut there are some differences. When using Interval Timer 1 in free running mode. you initialize exactly as you do for the one-shot mode; you load the low-order and high-order Counter bytes via select codes 01 002 (DEV+4) and 01012 (DEV+5). As soon as you write into select code 01012. the Latch contents are transferred to the Counter. which starts decrementing. While the Counter is decrementing you can reset the next Counter initial value by writing into the Latch register using select codes 01102 (DEV+6) and 01112 (DEV+ 7). Now as soon as the Counter times out. the new value you have loaded into the Latch register becomes the next initial Counter value. If you have connected I/O Port 8 pin 7 to the Counter by storing 1 in Auxiliary Control register bit 6. then each time the Counter times out. the signal output via pin 1 of liD Port 8 is inverted. generating a square wave; this may be illustrated as follows: , ( a: o I/O Port B Pin 7: III CI) o ~ TmeOut 1 ct Q ct @ MCS6522 INTERVAL TIMER 1 FREE RUNNING MODE Time Out 2 Time Out 3 Time Out 4 etc Remember. you can. at any time. read the contents of Interval Timer 1 Counter or Latch registers. This gives you a complete ability to test and modify Timer intervals in any way. under program control. while Interval Timer 1 is operating. Now consider Interval Timer 2. MCS6522 Interval Timer 2 has logic which is markedly different from Interval Timer 1, which we have just described. Interval Timer 2 offers two modes of operation: 1) 2) One-shot mode with no signal output. Pulse counting mode. MCS6522 INTERVAL TIMER 2 You select one of the two Interval Timer 2 options by appropriately setting bit 5 of the Auxiliary Control register. as il,/ lustrated in Figure 10-14. One-shot mode. with no signal output. is identical in operation to one-shot mode with no signal output. as described for Interval Timer 1. Pul.se counting mode is an alternative one-shot mode; the Interval Timer 2 Counter decrements onhigh-to-Iow transitions of signal input via pin 6 of liD Port B. Thus. in the pulse count mode. Interval Timer 2 will count out after the number of high-to-Iow transitions specified by the initial Counter value. For example. if you initially load 200016 into the Interval Timer 2 Counter. then after 8192 high-to-Iow transitions of the signal input via pin 6. an active time out will occur. Following an active time out. an interrupt is requested. Subsequently. Interval Timer 2 continues to decrement continuously from 000016 through FFFF16 and back to 000016; on subsequent time outs however. no interrupt request is generated. Subsequent time outs are passive. Since the logic capabilities of Interval Timer 2 differ from Interval Timer 1. as we might expect. the register organization and addressing logic associated with Interval Timer 2 also differs. It may be illustrated as follows: Low-Order Latch Byte Permanent connection , Hig!).Order Low-Order Counter Byte Counter Byte 'r~--""----~~ 16-Bit Counter register ·10-41 ~:[r Connection enabled by selecting Pulse Counting Mode Interval Timer 2 is accessed via two select codes. 10002 (DEV+8) and 10012 (DEV+9);addressing may be illustrated as follows: Select Select ,-Code~ I I 1001 Read Write Low-Order Latch Byte High-Order Counter Byte Low-Order Counter Byte Since Interval Timer 2 has no free running option. there is no need for a high order Latch register byte; the sole purpose of such a location is to store a high-order CoUnter byte. waiting to be loaded into the Counter register when it times out. You do need a low-order Latch register byte. because when loading the Counter register. you still have to make two accesses. You cannot load the low-order Counter byte. and then load the high-order Counter byte; the Counter is continuously decrementing and would start decrementing the low-order Counter byte while you were loading the highorder Counter byte. The initiation procedure for Interval Timer 2. whether you are in one-shot mode or pulse counting mode. is to write the low-order Counter byte to select code .10002 (DEV+8L then the high-order Counter byte to select code 10012 (DEV+9). As soon as you write the high-order Counter byte to select code 10012 (DEV+91. Interval Timer 2 logic transfers the contents of the low-order Latch byte to the low-order Counter byte - and initiates decrementing. If you are in one-shot mode. the Counter register is decremented on each high-to-Iow transition of the 2 clock pulse. If you are in pulse counting mode. the Counter decrements on each high-to-Iow transition of a signal input via pin 6 of I/O Port B. That is the orily difference between the two modes. MCS6522 SHIFTER LOGIC MCS6522 Shifter logic may be illustrated as follows: Interval Timer 2 active time out Shifter ..P Strobe CB" =~ssi~e sources for Shift Enable Strobe ./ . - ~ d~ta in~ Serial or out via CB2 As illustrated above, serial data may be shifted into bit 0 or out of the Shift register bit 7. Serial data is transferred via controi signal CB2. When you shift into bit 0 the data transfer is accompanied by a one-bit left shift of the Shifter contents. When you shift out of bit 7. the data transfer is accompanied by a one-bit left rotate of the Shifter contents. ,10-42 Every serial bit data transfer is enabled by a strobe signal. The strobe may be derived from: 1) 2) A signal input by external logic via CB1. The <1>2 clock signal. 3) Interval Timer 2 active time-outs. cw If the enable strobe is derived from external logic via CBl or from <1>2. then the high-to-Iow transition of either signal triggers the enable strobe. a: If the shift enable strobe is derived from Interval Timer 2. then only the low-order eight Counter bits for Interval Timer 2 are decremented. ~ a: oa.. o u ~ en w I- ct g (I) (I) ct all w Z a: o !XI (I) o ~ ct C ct @ There are seven modos in which the Shifter can be operated; three are input modes and four are output modes. You select an appropriate mode by the code loaded into bits 5. 4 and 3 of the Auxiliary Control register. Let us examine the response of Shifter logic to the eight possible Auxiliary Control register bit combinations. Mode 000; disable Shift register. When Auxiliary Control register bits 5. 4 and 3 are 000. the Shift register is disabled. Control signals CB 1 and CB2 respond as defined by bits 7. 6 and 5 of the Peripheral Control register. While the Shift register is disabled. the CPU can still write into it and read from it: you. as a programmer. can therefore use it as a storage location for a single data byte. Mode 001; input under Interval Timer 2 strobe. Auxiliary Control register bits 5. 4 and 3 set to 001 specify serial data shifted in. as timed by Interval Timer 2. However. only the low-order byte of Interval Timer 2 is active. which means that 256 is the maximum initial Interval Timer 2 count which can be used. A low pulse with a width of one <1>2 clock is output via CBl on each Interval Timer 2 time-out. as a signal that external logic must provide the next serial data bit to be input. Interrupts are generated. as usual. following each time-out: an additional interrupt is generated after eight bits in the Shift register have been serially output. When Interval Timer 2 is being used to strobe the Shift register in Mode 001. then it operates in a unique mode which is not available at any 'other time. Whenever Interval Timer 2 times-out. the contents of the low-order Latch byte are immediately transferred to the loworder Counter byte - and decrementing resumes. Thus. Interval Timer 2 is operating in a free-running mode. with only the low-order Counter byte active. As this would imply. you must initiate Interval Timer 2 by loading the appropriate initial count into the low-order Timer 2 Latch byte - before enabling the Shift register in Mode 001. Followinga time-out you can. of course. reload the Interval Timer 2 low-order Latch byte to modify the next time interval. Timing may be illustrated as follows: Interval Timer 2 time-outs strobe shifter 1,1 CB2 Shift o l,! til Shift 1 Shift 2 Shift Shift I I I , Shift Shift Shift 5 6 7 J Shift 8 or next shift Interrupt request CPU must read shifter contents _ _ _within this time interval Note that it is your responsibility as a programmer to ensure that all logic needed by the Shifter has been appropriately set for operations illustrated above. This means that you must program Interval Timer 2 to redecrement following each time-out by writing a a into select code 10012 (DEV+9). the high-order Timer 2 Counter byte. Since control signals CBl and CB2 are being used by the Shift register in this mode of operation. Shift register requirements will override any CBl and CB2 control Signal specifications that have been made via bits 7. 6. 5. and 4 of the Peripheral Control register. 10-43 Mode 010; input under <1>2 clock strobe. This mode is specified by 010 in bits 5. 4 and 3 of the Auxiliary Control register. In Mode 010. and in all other Shift register modes that are clocked by <1>2. shifting stops on the eighth shift marked by an interrupt request. Timing may be illustrated as follows: which is , Shifting stops <1>2 .CB2 Shift register bit at final interrupt: 0 0 0 3 4 0 , 0 0 . Interrupt request Mode 011; input under external pulse strobe. This mode is specified by 011 in bits 5. 4 and 3 of the Auxiliary Control register. This mode is equivalent to the standard serial input found in most serial I/O devices. where external logic provides the clocking signal which is used to time in serial data. In this case. external logic provides a clocking signal via CB1; a high-to-Iow transition of CBl is interpreted by the Shift register as a strobe to input the next serial data bit from CB2. . . Timing may be illustrated as follows: .., m'~~ Shift 6 Shift 7 Shift 0 ,-' Shift 1 Shift 2 --- ~ Interrupt request As was the case with Mode 001. shifting is continuous. So far as external logic is concerned it is shifting in an endless stream of serial data bits. Shifter logic generates an interrupt request every eighth shift so that the CPU will know when to read the contents of the Shifter. The CPU has the time interval between a Shifter interrupt and the next high-to-Iow transition of CB 1 within which to read Shifter register contents. If the CPU does not read Shifter register contents in this time interval then an error will occur but no error status will be reported. Shift register use of control signals CBl and CB2 overrides specifications made for these Signals via bits 7. 6.5 and 4 of the Peripheral Control register; however. the policy of overriding adopted by the designers of the MCS6522 is somewhat subtle. Since control Signal CB2 is used as a serial data input signal. any specifications made fei this Signal via the Peripheral Control register are totally ignored. Specifications made for control signal CB 1. however; remain. If you have enabled I/O Port B via bit 1 of the Auxiliary Control register. then the active transition for control signal CB 1 which is 10-44 specified by bit 4 of the Peripheral Control register will apply. Thus you will generate an interrupt whenever CB 1 makes an active transition in the process of clocking in serial data. The two possibilities may be illustrated as follows: CBI Q CB2 w ~ o0.. a: a: o Interrupt request o ~ en w ~ g (I) (I) ct Data Read Interrupt request Data read and interrupt request Data Read You can disable interrupts occurring as a result of active CBl transitions via the Interrupt Enable register. which we have yet to describe. Let us now look at the output modes of the Shift register. In all output modes. the Shift register transfers the contents of bit 7 to control signal CB2. Simultaneously.bit 7 contents are shifted back into bit O. This may be illustrated as follows: cIS w z a: oa:I 7 6 5 ... 3 2 1 0 ~ Bit No. fEll 111 I... ) (I) o Shi"" ~ ct Q ct Out to CB2 @ Depending upon the serial output option you choose. CBl mayor may not be used as a companion control signal. Mode 100; free-running output under Interval Timer 2 strobe. This mode is selected via 100 in bits 5.4 and 3 of the Auxiliary Control register. Data is shifted out of Shift register bit 7. clocked by Interval Timer 2. as described for input mode 001. Data shifted out appears on' CB2. Shifting is continuous. which means that the bit pattern in the Shift register will output endlessly. . . Mode 101; output under Interval Timer 2 strobe. This mode is specified by 101 in bits 5. 4 and 3 of the Auxiliary Control register. It differs from Mode 100. which we have just described. in that once eight bits have been shifted out of the Shifter. an interrupt is requested and shifting halts. You can output continuously under Mode 101 by making appropriate use of Shift register interrupts and Interval Timer 2. The Shift register interrupt occurs on the eighth shift out of the Shifter; but within the time it takes for Interval Timer 2 to again time-out. you can reload the Shifter. If you reload the Shifter during this time interval. then on the next timeout of Interval Timer 2. shifting will begin again. and thus become an uninterrupted bit stream on signal CB2. Mode 110; shift out under <1>2 pulse. This mode is selected via 110 in bits 5. 4 and 3 of the Auxiliary Control register. In this mode eight bits are shifted out of the Shift register. clocked by <1>2. Then shifting ceases. These are the steps you must adopt when using the Shifter in Mode 110: 1) 2) 3) 4) Disable the Shifter by loading 000 into bits' 5. 4 and -3 of the Auxiliary Control register. Load a byte of data into the Shifter. Remember the data you load will be shifted high-order bit first. Enable the Shifter by loading 110 into bits 5. 4 and 3 of the Auxiliary Control register. Again disable the Shifter by loading 000 into bits 5. 4 and 3 of the Auxiliary Control register. In Mode 110. data will be Shifted out on every high-to-Iow transition ofthe <1>2 clock pulse. Thus the entire shift operation will be completed in eight clock pulses. ' . Mode 111; shift out under external pulse strobe. This mode is identical to Mode 101. except that instead of output being timed by Interval Timer 2. external logic provides the output timing pulse via control signal CB 1. As was the case for input mode 011. the high-to-Iowtransition of the external timing signal input via CB 1 causes serial data to be shifted out of the Shift register. Once again. unless you have disabled CB 1 interrupts via the Interrupt Enable register. the condition of bit 4 in the Peripheral Control register will cause the interrupts to be requested each time control Signal , . CBl makes a high-to-Iow or a low-to-high transition. . 10-45 MCS6522 INTERRUPT LOGIC Interrupt logic is one of the first things you must initialize when starting to use an MCS6522. It is the last subject we describe. because in 'order to understand MCS6522 interrupts. you must first be aware of the numerous ways in which interrupt requests may originate within this device. There are two addressable locations within the MCS6522 dedicated to interrupt logic: 1) 2) The Interrupt Flag register. selected by 11012 (DEV+D). The Interrupt Enable register. selected by 11102 (DEV+E). These two registers have individual bits assigned to the different interrupt requesting sources as follows: 7 6 5 ... 3 2 1 0 ~ Bit No. Interrupt Flag register Interrupt Enable register ' - - - - - Active transition of CA2 ' - - - - - - Active transition of CA 1 ' - - - - - - - Active transition of CB2 ' - - - - - - - - Active transition of CB 1 ' - - - - - - - - - Shift register eighth shift ' - - - - - - - - - Interval Timer 2 time-out ' - - - - - - - - - Interval Timer 1 time-out ' - - - - - - - - - - - - - - - Enable/disable specification .....- - - - - - - - - - - - - - Any active interrupt request The Interrupt Flag register identifies those interrupts which are active. A1 in any bit position indicates an active interrupt. whereas a 0 indicates an. inactive interrupt. You can selectively enable or disable individual interrupts via the Interrupt Enable register. You enable individual interrupts by writing to the Interrupt Enable register with a 1in bit 7. Thus you could enable "time-out for Timer 1" and "active transitions of signal CB1" by outputting C816 to the Interrupt Enable register: . 7 6 5 .~ 3 2 1 0 ~Bit No. 11 I ] I0 I0 11 I0I0 10 J...--Interrupt Enable Register l ' f '" 3, "'Ne "'..."" of CS 1 '--- - - - - - - - - B l t 6. Interval Timer 1 time-out ' - - - - - - - - - - - - E n a b l e specified You selectively disable interrupts by writing to the Interrupt Enable register with bit 7 set to O. Thus you would disable time-outs from Timer 1 and active transitions of signal CB 1 by outputting 4816 to the Interrupt Enable register. If an active interrupt exists in the Interrupt Flag register for an interrupt which has been enabled via the Interrupt Enable register. then bit 7 of the Interrupt Flag register will be set -.:. and an interrupt request will be passed on to the CPU by setting IRO low. The interrupt service routine executed in response to an interrupt request from the MCS6522 must read the contents of the Interrupt Flag register in order to determinethe source of the interrupt. and thus the manner in which the interrupt must be serviced. You can clear any bit in the Interrupt Flag register. except bit 7. by writing a 1 to that bit. Writing a 0 to a bit has 'no effect. Thus. if interrupt requests were being made from time-out of Timer 1 and an active transition on CA 1: 7 6 5 4 3 2 1 0 ~ Bit No. 11'1110 01010 Il.IO~lnterruPt I Flag register Writing either 8216 or 021 6 (DEV+D) to select code 11012 (DEV+D) would 'clear the interrupt due to' an act"ive trans.ition on CA 1 (bit 1); however. bits 7 and 6 wou Id remain set. . . There are a number of ways in which interrupt requests are automatically cleared. and the corresponding Interrupt Flag register bits get reset. These are summarized in Table 10-6. 10-46 Table 10-6. A Summary of MCS6522 Interrupt Setting and Resetting CLEARED BY SET 6 Time-out of Timer 1 Reading Timer 1 Low Order Counter or writing Tl .High Order Latch 5 Time-out of Timer 2 Reading Timer 2 Low Order Counter or writing T2 High Order Counter 4 Completion' of eight shifts Reading or writing the Shift register 3 Active transition of the signal on CBl Reading from or writing to I/O Port B 2 Active .transition of the signal on CB2 (input mode). Reading from or writing to I/O Port B in input mode only 1 Active transition of the signal on CA 1 Reading from or writing to I/O' Port A using address 00011 0 Active transition of the Signal on CA2 (input mode) Reading from or writing to I/O Port A Output register (ORA) using address 0001, in input mode only Q w ~ I%: oIl.. I%: o Co) ~ enw le:( c::; oCI) CI) e:( ~ w Z I%: oCD CI) o ~ e:( Q e:( " @ THE MCS6530 ,MULTIFUNCTION SUPPORT LOGIC DEVICE This is a device which appears to have been designed by MOS Technology as an answer to one-chip microcomputers. In order to compete inlow-end: high volume. price sensitive markets. MOS Technology came up with the MCS65'30. which provides 1K bytes of ROM. 64 bytes of RAM. two I/O ports. a Programmable Interval Timer and interrupt logic. The realities of the MCS6530 are such that if you use the Interval Timer and interrupt logic. one of the I/O pdrts is only partially functional. Nevertheless. an MCS6530 multifunction support device. together with an MCS6500 series CPU. can compete effectively with the two-chip microcomputers described in this book. If we look at the MCS6530 simply as a member of the MCS6500 microcomputer family of devices. it is best visualized as a memory device which. in addition. provides a significant subset of the MCS6522 logic capabilities. Figure 10-16 illustrates that part of our general purpose microcomputer logic which has been implemented on the MCS6530 multifunction logic device. Figure 10-16 also applies to the MCS6532. which we will describe next. . The MCS6530 is packaged as a 40-pin DIP. It uses a single +5V power supply. All inputs and outputs are TTL compatible. 1/0 Port A and B pins are also CMOS compatible. PAO and PBO may be used as a power source to directly drive the base of a transistor switch. The devices are implemented using N-channel silicon gate MOS technology. Figure 10-17 illustrates the logic provided by an MCS6530 multifunction logic device. THE MCS6530 MULTIFUNCTION DEVICE PINS. AND SIGNALS The MCS6530 multifunction device pins and signals are illustrated in Figure 10-18. These signals are identical to signals with the same names which we have already described for the MCS6522: DO - 07 <1>2 RiW' RESET the bidirectional Data Bus the system clock input the Read/Write control output by the CPU which is a standard reset input I/O port pins PAO - PA7 and PBO - PB7 are functionally similar to equivalent I/O port pins of the MCS6522, but there are some differences. Pin 17 may be specified, when you order the MCS6530. as IRQ only, PB7 only, or as the programmable dual function pin IRQ/PB7; 10-47 Electrical characteristics of all 16 MGS6530 I/O port pins are equivalent to MCS6522 I/O Port B pins, rather than I/O Port A pins. MCS6530 pins '18 and 19 may implement I/O Port B pins PB6 and PB5. or they may serve as chip select pins. Note carefully that these are not programmable dual function pins. Each pin will either have one function or the other; and when ordering the part. you must indicate which function the pin is to serve. Pins 18 and 19 are logically independent. and the function assigned to one in no way restricts the choices available to you when assigning functions to the other pins. . If pins 18 and/or 19 have been assigned to chip select logic, then they contribute to device addressing in a unique way. The MCS6530 has ten address lines. AO - A9; this is sufficient to address 1024 bytes of ROM. MCS6530 In addition, the MCS6530 has 64 bytes of RAM plus assorted I/O and Interval Timer logic which ADDRESSING needs to be addre'ssed. RSO, CS 1 and CS2 are used to discriminate between ROM addresses, RAM LOGIC addresses and additional logic addresses. But there is no predefined way in which the different - - - - - -.. addressable locations of the MCS6530 will be accessed - which is only to be expected since CS 1 and CS2 are not permanent features of every MCS6530 device. When RSO is high, ROM will always be selected. When RSO is low, RAM or additional logic may be accessed- and 'the way in which the access works is entirely up to you. ~ Clock Logic Logic to Handle . . . Interru~:o~qUests ~ Arithmetic and . Logic Unit External Devicesf jii.i. - Accumulator Registerisl Instruction Register ~ ~ Control Unit , I Interrupt Priority Arbitration Bus Interface Logic ~ Data Counterisl ~ Stack Pointer ~ Program Counter , r··· ." ~ X/ •. I J . . i . . / ;( > I/O Communication . . . Serial to Parallel Interface Logic Direct Memory Access Control Logic , System Bus ji.·. . · ·. .· ·.·. · · . ..\\ . MCS6530 Only ihF
i.> ............. Figure 10-16. Logic of the MCS6530 and MCS6532 Multifunction Support Devices 10:'48 _ o c.. ~ ........ ..... c.. g ••• ~ c.. ..... ~ Cl c.. c.. Q w ~ oIl.. ~ a: a: o u I/O Port A ~ 1-4- ~ ~ I/O Port B en w Control and Select logic ~ g I/O Port A Data Direction register en en ct ~ ~ I/O Port B Data Direction register ail w Z a: oen Interval Timer 8 ........ 2i en o ~ f....... ~ ~ ~ ct Q ct @ Data Buffer . Data ; , 64 Bytes of RAM ~ - 1024 Bytes of ROM Figure 10-17. Logic Provided by the MCS6530 Multifunction Device RAM and additional logic each have an internal master select: and what you specify is the way in which these master selects will be derived. As you will see upon examining Table 10-7. master selects for RAM and additional logic each will consist of the following: 1) 2) 3) RSO set to O. Address lines A4 - A9 with specific values which you define. CS 1 and CS2. if implemented. with specific values which you define. As seen by a programmer. the address space of an MCS6530 can be divided in many flexible ways. 10-49 Vss 40 ....II-....~PAI 39 ..............~ PA2 'PAO <1>2 38 ....- -.....~ PA3 37 ....- - - . - PA4· 36 ....1f-.....~PA5 35 ....11--.- PA6 34 .....I l -....~ PA7 RSO A9 A8 A7 DO A6 R/W A5 33 .....I -.....~ 32 01 31- ....1-......... 02 30 ....II-.....~ 03 A4 A3 A2 10 11 12 ;3 Al AO 14 29 ....1-....~04 28 ................ 05 27 ....l'-....~ 06 15 26 07 iRa/PB7 16 17 ·CS1/PB6 ·CS2/PB5 18 19 25 24 ....I -.....~ 23 ..... -.....~ 22 ....11-...... PBO PBl PB2 PB3 VCC 20 21 ................ PB4 RESET MCS6530 Pin Name Description DO - 07 <1>2 Data. Bus to CPU System Clock Read/Write control Reset R/W RESET PAO- PA7 Tristate, bidirectional Input . Input Input "Port A Peripheral Data Bus Tristate, Input or Output . Port B Peripheral Data Bus Tristate, Input or Output iRa Interrupt from Interval Timer; Input special function of input pin PB7 CSl, CS2 Chip Select Input AO-A9 Address lines Input RSO ROM Select Input .Power and Ground VCC, Vss ·Mutually exclusive functi!:lns. One or ,he other must be specified whim the chip is ordered . PBO - PB7 .f Figure 10- i 8. MCS6530 Multifunction Device Signals and Pin Assignments Usually RSO will be connected to a high-order address line: let uS assume it is A 10, so that we can develop real examples. Now ROM .v,.'ill be accessed by addresses in the range 040016 through 07FF16. A 15 A 14 A 13 A 12 A 11 Al 0 A9 A8 A 7 A6 A5 A4 A3 A2 Al AO ~...... V' ~ RSO 1 ______ A9 - AO______ l "_~ o 000 O· ~~~ ~, 10000000000 lower ROM limit ~~ o 4 0 0 ~ 0000011111111111 Upper ROM limit ~~ o RAM may respond to any 64 contiguous addresses in the range 000016 through 03FF16· Similarly, 1/0 and timer logic will be selected by 16 contiguous memory addresses in the same address space. 10-50 In summary. we may illustrate addressing and select options as follows: ~15A~¥.~;A11A11A9 ASA' A6(', A::,:;;~T' ~2 Q w ~: these address: lines I !iII: o0. RA~ address II I ' I II: I Gener~te RAM o I o ~ select and : I/O Tomer select enw \"" !i V g I : I : ~ ROM address (fJ (fJ c( There are a number of Clspects to MC56530 addressing which need clarification. all First of all. you may ~ell ask why pins 18 and 19 can optionally be assigned as additional chip select inputs. After all. with RSO low. you have more than enough address lines to access RAM plus I/O and timer logic. The purpose of having CS1 and CS2. as additional chip selects. is to allow a number of MCS6530 devices to interface with a single CPUwithout requiring complex device select logic. If the additional chip select signals CS1 and CS2 are not available. you can still have more than one MCS6530 connected to a CPU. but additional support logic must selectively suppress <1>2 for all but' one MCS6530 device. Remember. RSO. R/W and the Addre~s Bus are all'signals with two active and no passive states. These signals are always selecting some MCS6530 location. w Z II: oCD (fJ o :!: c( Q c( @ Since the whole purpose of the MCS6530 is to support very low cost. simple microcomputer configurations. the ability to minirrlize device select logic becqmes very important. ' , Observe that address logic is used n()t only to access individual addressable locations within the MCS6530. but also to perform certain programming functions, We will describe these programming functions in greater detail I?lter. It is interesting ~o note that both the MC6800 and MCS6500 microcompu~er devices use address logic to provide control functions in support devices. In contrast. 8080Adevices will be very spartan when it comes to device addressing. frequently having two I/O or memory addrEjsses to access numerous 'differ~nt locations - with complex sequencing " ' schemes determining how locations will be accessed. MCS653()' PARALLEL DATA TRANSFER. OPERATIONS , ' . :',. . Parallel data transfer operations. when using the MCS6~3Q are e~ac~ly as described for the MCS6522 I/O Port B. Each I/O port of the MCS6530 has a Data Direction register. Into this register you load a mask which ~as a 1 in every bit position corresponding to an output I/O portpin and a 0 corresponding to an inpu~ I/O port pin. Subsequently the CPU reads and writes data' by accessing the assigned I/O port address. . , MCS6530 INTERVAL TIMER AND INTERRUPT LOGIC MCS6530 Interval Timer logic differs significantly from MCS6522 logic. The MCS6530 Interval Timer is a single 8-bit registerwhic'h can be loaded w'ith any initial value, The (nitial value decrements on high-to-Iow transitions of the <1>2 clock ·pulse. or multiples of the <1>2 clock pulse: and on decrementing to O. an interrupt request is generated. Thus the larQest time interval generated by loading 0 into t~e Interval Timer register. ' in 10-51 Table 10-7. Addressing the MCS6530 Multifunction Support Logic Device. PRIMARY SELECT ACCESSED LOCATIONS RAM I/O TIMER RSO SELECT" SELECT" 1 0 X X AO - A9 directly address one of 1024 ROM bytes 1 0 AO - AS directly address one of 64 RAM bytes SECONDARY SELECT , A3 INTERPRETATION A2 A1 AO 0 0 0 0 0 1 Access I/O Port A Access I/O Port A Data Direction register 0 1 0 1 1 Access f/O Port B Access.!L2. Port B Data Direction register Disable IRQ Enable 0 0 0 1 1 0 0 0 0 1 1 X X X X 0 0 0 1W 0 0 1 1W 1 1 X X X X 0 1W 1 0 ,.,0 0 1W 1W .X X X X X X 1 1 0 1 1 0 1 0 0 0 0 0 '0 0 0 0 o" lW 1R 0 0 1R 1 1 1 X X 1 iRQ ,Write to timer,then'decrement every <1>2 pulse Write to timer, then decrement every 8 <1>2 pulses Write to timer, then decrement every 64 <1>2 pulses 0 Write to timer, then decrement every 1024 4>2 pulses Read timer 1 Read interrupt flag • RAM select and I/O select are "true" if 1,or "false" if 0; true and false are functions of your specifica-,' tion. You specify the combination of address lines that create a "true" line condition. ' X represents "don't care". Bits may be 0 1R represents Select during a read. 1W represents Select during a write. 0'" '1: As defined in Table 10-7, the IntervalTimer has four addresses which you can usewhen loading an initial timer value. Each address specifies a. different decrement interval. The four decrement intervals are 1, 8, 64 Or 1024 <1>2 clock ' , . , " pulses. Suppose the MCS6500 microcomputer system is being driven by a 500 nanosecond clock. The four decrement options mean that the I nterval Timer may be decremented once every 1/2, 4, 32 or 512 microseconds. The timeout will occur anywhere from 1 to 256 decrements following the write into the Interval Timer. Following a timeout. an interrupt will be requested. When an interrupt request occurs, the interrupt flag will be set.. Thisflag ma,y be read by the CPU using the address shown in Table 10-7. T~e interr~pt request wHI appear as a low level on pin17 if the following conditions are met: 1i, Address lineA3 is 1 when reading from or writing to the timer. 2) PB7 has been programmed as an input by loading a 0 into bit 7 of the I/O Port B Data Direction register. (This is not necessary if the pin is factory masked to be IBO only.) The interrupt to pin 17 is disabled when address line A3is 0 on,a timer read or write. The !!1terrupt request is cleared (that is, IRO returns high) the next time the timer is written or read. Once the Interval Timer has timed out. it will decrement once mor~, from 0 back to O. Then it will stop, Post-interrupt decrementing occurs on every <1>2 clock cycle, regardless of whether pre-interrupt decrements occurred every 1,8.64 or 1024 <1>2 clock cycles. 10-52 o « .•••.••• ....« CI. CI. o IE •••••••• ....IE I~ t c w !ia: I/O Port A f4- Interrupt Logic ~ I/O Port B o D. Control and Select Logic a: o o ~ en w !i(j I/O Port A Data Direction Register ~ Interval Timer 4~ I/O Port B Data Direction Register oU) U) 2 System Clock Read/Write control Tristate. Bidirectional Input Input Input Riw RESET PAO - PA7 PBO - PB7 iRa CS1.Cs2.RS AO-A6 VCC. Vss Reset Port A Peripheral Data Bus Port B Peripheral Data Bus Interrupt Request Device or internal register select Address lines Power and Ground Tristate. Input or Output Tristate. Input or Output Output Input Input Figure 10-20. MCS6532 Multifunction Device Signals and Pin Assignments MCS6532 MULTIFUNCTION DEVICE PINS AND SIGNALS The MCS6532 multifunction device pins and signals are illustrated in Figure 10-20. These are the only differences bet.' ween MCS6532 and MCS6530 signals: 1) IRQ. CS1 and CS2 are assigned. unique pins by the MCS6532: the MCS6530 requires you to choose individually between these three Signals and the three high order bits of 1/0 Port B. 2) For the MCS6532 to beselected. RS and CS2 must be low while CS 1 is high. Recall that with the MCS6530. RSO is a signal which discriminates between ROM and other addressable locations: you define the way in which CS1 and CS2. if present. will function when you order an MCS6530 part. Addressing the MCS6532 is a good deal simpler than addressing the MCS6530. since the MCS6532 MCS6532 has no ROM present. 'and it has separate Chip Select signals. You still must define RAM ADDRESSING select and 1/0 timer select as a function of RS. CS1 and CS2 and address lines AO - A6. By connecting RS. CS1 and CS2 to higher address lines. you can assign RAM or 1/0 timer logic various address spaces. This ability to define RAM and 1/0 Timer select as a mask option is a convenience. where with the MCS6530 it was frequently a necessity. With the MCS6532 you can accept whatever standard "off-the-shelf" option is being provided. and still have enough flexibility using RS. CS1 and CS2 to include a number of MCS6532 devices in a microcomputer config u ration. 10-54 Table 10-8, Addressing the MCS6532 Multifunction Support Logic Device PRIMARY SELECT c w ~ a: o Do a: o o ~ en w ~ g CI) CI) ~ ciS w z a: o RAM SELECT I/O TIMER SELECT 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 IW lW IW lW IW IW IR IR 'IW 0 lW~ O. lW IW 0 aI 1 1 SECONDARY SELECT INTERPRETATION A4 X X' X X X 1 1 1 1 1 1 X X 0 0 0 0 A3 X X X X 'X 0 1 X X X X X X X X X X A2 . Al AO X X X 0 O' 1 1 0 ·0 0 0 0 1 1 1 1 X X 1 1 1 1 1 1 1 1 1 0 0 1 X X X X 0 I. 1 0 1 X X 0 1 0 1 0 1 0 1 X X AO - A6 directly addresses one of 128 RAM byt~, Access I/O Port A .. Access I/O Port A Data Direction·register Access I/O Port B: . Access I/O Port B Data Direction register Disable rna . Enablema Write to timer, then decrement every 412 pulse Write to. timer, then decrement' every 8 412 pulses Write to timer,then decrement every 64 412 pulses Write. to timer, then decrement every 1024 412 pulses Read timer Read interrupt flags Request interrupt on high-to-Iow PA7 transition Request interrupt onJow-to-high PA7 transition Enable PA7 interrupt request Disable PA7 interrupt request CI) o ::!l ~ X 1R represents "don't care", Bits may be .0 or 1. represents Read access. 1W represents Write· access, c ~ @ MCS6532 LOGIC FUNCTIONS Table 10-8 summarizes the way in which addressing is used both to access locations within the MCS6532 and to provide various logic functions. The only logic of the MCS6532 which differs from the MCS6530 and needs to be described is the external interrupt request capability. External logic requests interrupts via I/O Port A pin PA7. I/O Port A pin PA7 must be declared an input pin by loading 0 into bit 7 of the I/O Port A Data Direction register, Data Direction registers have been described in conjunction with the MCS6522. A low-to-high or high-to-Iow transition on a signal input to PA7 will generate the interrupt request. An interrupt request will be accompanied by bit 6 of the Interrupt Flag register being set. Table 10-8 defines the way in which you select interrupt options, MCS6532 interrupt acknowledge logic requires the CPU to read the Interrupt Flags register. This read operation resets MCS6532 interrupt logic. 10-55 DATA SHEETS This section contains specific electrical and timing data for the following devices: Q w • MCS6500 Series CPUs • MCS6530 Multifunction Device ~ a: oa. a: o(J ~ ui w ~ g en en c( 011 w Z a: oCO en o ~ c( Q c( @ 10-01 MCS65XX Microprocessors ICOMMON CHARACTERISTICS I MAXIMUM RATINGS I RATING SYMBOL SUPPLY VOLTAGE -0.3 to +7.0 Vdc Vin T A STORAGE TEMPERATURE T STG 0 -55 to +70 ·C to +150 ·C This devicE' contains input protect ion against damage due to high st at ic voltages or elect ric fields; however, precaut ions should be taken to avoid applicat ion of voltages higher than the maximum rat ing. (Vee = 5.DV ± 5%, Vss = 0, TA = 25° C) applies to MCS6512, 13, 14, 15, CHARACTERISTIC Input High Voltage SYMBOL ~o (in) applies to MCS6502, 03, 04, 05 and 06 MIN. TYP. MAX. Vss + 2.4 Vee - 0.2 - - Vee Vee + 0.25 Vss - 0.3 Vss - 0.3 - Vss + 0.4 Vss + 0.2 Vss + 2.0 - - Vde - - Vss + 0.8 Vde - - 2.5 100 IJA uA - 10.0 uA - - 10 Vss + 2.4 - - Vde - - Vss + 0.4 Vde - .25 .70 V IH LogiC,0 0 (in) 01,0 2 Input Low Voltage Input High Threshold Voltage Vde V IHT RES ,NMI ,RDY, IRQ ,Data, S.O. Input Low Threshold Voltage V ILT RES ,NMI ,RDY, IRQ ,Data, S.O. Input Leakage Current (V in - 0 to 5. 25V, Vee = 0) Logic (Exel.RDY,S.O.) 01,02 lin - 0 0 (1n) Three-State (Off State) Input Current (V c 0.4 to 2.4V, Vee = 5.25V) in Data Lines I Output High Voltage (ILOAD • -lOOuAde, Vee· 4.75V) SYNC, Da ta, AO-Al5, R/W V OH Output Low Voltage (I • 1.6mAde, Vee = 4.75V) LOAD SYNC,Data,AO-A15, R/W VOL Power Dissipation P Capaei tanee 0 (V • 0, T = 25 C, f = lMHz) in A Logic C Data AO-A15,R/W,SYNC uA TSI D Cin - C out W pF - - 15 12 10 15 0 0 (in) C0O (in) 01 C"1 - 30 50 C"2 - 50 80 02 UNIT Vdc V IL Logic ,0 0 (in) 01,02 ~nte: UNIT Vdc INPUT VOLTAGE ~l' ~2 I VALUE -0.3 to +7.0 OPERATING TEMPERATURE ELECTRICAL CHARACTERISTICS I Vcc IRQ and NMI require 3K pull·up resistors. Data sheets on pages 10-02 through 10-07 reprinted by permission of MOS Technology. Inc. 10-02 © ADAM OSBORNE & MCS65XX Microprocessors ASSOCIATES. INCORPORATED COMMON CHARACTERISTICS_ -REF"B" 00(IN) 1;:::_0\"--_~~~:v_ ~"" ~-P-W-H-"-O-L----' I~ 0.4V- - - .. 0z(OUT) R/W PWH00W----J j-I.5V=\. _ _; - -----1.- .4V ADDRESS . MPU FROM PWH01-...j" ~5V /i'-L5V - \ ~[.~.4~:-E-F-"-A-"----·-4-V~I~F:::02~ -------- DATA FROM MEMORY RDY,S.O -Clock Timing ~ MCS6502, 03, 04, OS, 06 SYNC o TSYNC b _ REF "A" w Timing for Reading Data from Memory or Peripherals Ten: - REF "B" .4V " R/W ADDRESS MPU DATA MPU FROM FROM -REF"B" Clock Timing - MCS6512, 13, 14, 15 Note:· "REF.1l means Reference Points on clocks. Timing for Writing Data to Memory or Peripherals MCS65XX Microprocessors 1 MHz TIMING 2 MHz TIMING Clock Timing -'- MCS6512, 13, 14, 15,,16 , Clock Timing - MCS6512, 13, 14, 15 S\"!1BOL CHARACTE RI S TI C TYP. MIS. L"NlT 1000 \:yc1e Time nsec CHARACTERISTIC ~yc1e S\"!1BOL Time Mrs. 500 ~.----------------------~--------+-------~----~-----+------~ Clock Pulse Width (Measured at Vee - O.2v) 01 02 PI.'H 01 PI.'H 02 (10~~~:~~~:d~~~t~C(: '_ 430 470 CLOCK TIl'.INr. - MCS6502, 03. 04, 05. 06 SYMBOL Cycle Time 6 ~ MIN. TYP. !-lAX. UNITS 1000 Pulse Width (measured at 1.5V) ~o(IN) Rise, Fall Time 12 D.,.!a ... Timp betwe~n' Clo~ks (Measured at O.2v) CLOCK TIl'.INr. -MCS6S02, 03, 04, 05, 06 ~o(IN) 'nsee (Measured from O.2v to Vn' - O~2v) 2; De: a.v Time between Clocks (Measured at O.2v) o :~ ·215 235 Fall Time fall Time (He3sured from O.2v to Vee - O.2v) CHARACTERISTIC O.2v) PI," 01 PI.'H 02 PWH~o 520 460 Delay Time Between Clocks (measured at 1.5V) PI.'H~\. 4>2 (OUT) Pulse Width (measured at 1.5V) PWH~2 SYMBOL MIN. Cycle Time TCYC 500 TYP. MAX. UNITS ~ 0 (IN) Pul s e Wid t h (measu,_r_e_d_a_t_I_._5_V_)-1-'_PWH __ ~:::..o__-+___2_4_0__-1-___+--2....,:-=~---+------l 10 ¢\ (OUT) Pulse Width (measured at 1.5V) CHARACTERISTIC PI.'H~oL ~ 0 (IN) Rise, Fall Time TR~ 0' TF~ 0 Delay Time Between Clocks (measured at J.5V) TD (OUT) Pulse Width (measured at 1.5V) PWH~\ 4>2 (OllT) Pulse width (measured at 1.5V) PWH4>2 ¢\ PI.'II~oL .25 25 READ/WRITE TINING READ/WRITETINING ,...--' CHARACTERISTIC SYMBOL MIN. Read/Write Setup Time from MCS6500 Address Setup Time from MCS6500· Memory Read Access Tirr.E" Data ~tabil tty Time Period Data Hold Time - Read TYP. MAX. 100 300 100 TACC Tnsu 100 THR 10 UNITS CHARACTERISTIC R/W Hold Time T,m'~ UNITS Memory Read Access Tirr.e Data Stabil tty Time Period Data Hold Time - Read 350 60 MAX. 300 ns ~A-d~d-re-s-s-H~O~1~d~T~i-m-e--------·--------~TH~A~---4--~3~0---r~6~0~~--'-'-~ 30 TYP. 575 Da ta Setur Time from MCS6500 ______--I--T..!.r-'D~S____+-______+1._5_0-+__2_0_0---t-----j RDY, 5.0. Setup TimE' TRDy 100 T SY~C MIN. T 100 .150 RWS Address Setup Time -from MCS6500A -·--I--T...!'A:!!.D"'-S----+---------I--I-00--+--1-50.,----+-----1 Data Hold Time - Write SYNC Setup Time from MCS6500 SYMBOL Read/Write Setup Time from MCS6500A T ACC T DSU THR T HW Data Setur Time from MCS6500A Tr-'DS ""RDY,'S:O:set~Tim-e---'-· ----.J........'TR~n~Y- 300' 50 10 10 60 75 100 50 SYNC Setup Time from MCS650_0.A _______.l-T5!..SY~r-;~C'_____I_------+_--_+_--17-5---..,..t_--__l Address Hold Time THA 30 60 ns R/W Ho ld Time ------. - . ---------II-T..!Il~R-'~----+----30----I1--6-0 -+-------+-----l MCS662X and MCS663X MAXIMUM RATINGS RATING SYMBOL VOLTAGE UNIT Supply Voltage VCC cw Input/Output Voltage a: o Operating Temperature Range a: o o Storage Temperature Range V IN Top T STG u) w g All inputs contain protection circuitry toprevent.damage due to high static charges. Care should be exercised to prevent unnecessary,. application of voltage outside t~e specification range. . olI ELECTRICAL CHARACTERISTIC~ (VCC !;i D. -.3 to +7.0 V -.3 to +7.0 V °c °c 0 to 70 -55 to +150 ~ !;i en en c( w Z a: oa:I en o ~ c( C c( @ =5.0v ± 5%, VSS = Ov, TA =25° C) CHARACTERISTIC Input High SYMBOL MIN. TYP . .Vol~age MAX. UNIT VCC V 2.5 llA ±10.0 llA Input Low Voltage Input Leakage C~rrent; VIN = VSS + 5v A0-A9, RS, R/W, RES, 02,PB6*, PB5* Input Leakage Current for High Impedance State (Three State); V = .4v to 2.4v; D0-D7 IN Input High Current; VIN = 2.4v PA0-PA7, PB0-PB7 · Input Low Current; VIN = .4v PA0-PA7. PB0';"'PB7 ... Output High Voltage VCC =. MIN, I LOAD -:. ~100u~(PA0-PA7 ,PB0-PB7 ,D0-D7). ILOAD ~ -3 MA (PA0,PB0) Output Low Vol~age VCC = MIN, I LOAD .2 1.6MA Output High Current (Sour~ing);· VOH :: 2. 4v (PA0~PA7, PB0:""PB7 ,D0-n7) :: 1.5v Available for other. than TTL (Darlingtons) (P40,PB0) Output Low Current ·(Sinking); VOL 2 .4v~~~~:~~~~ Clock Input Capacitance Input Capacitance ±1.0 IIH -100. -300. -1.0 IlL 10-05 MA V VSS+2.4 VSS+1. 5 VSS+.4 VOL lOR -100 -3.0 IOL -1000 -5.0 V llA MA 1.6 MA ~Clk 30 C IN 10pf 500 *When programmed as address pins All values are D.C. readings ~1.6 VOR Output Capacitance Power Dissipation llA pf 10 pf 1000 MW MCS652?- end MCS6536 ~ • .. c')' , WRITE TIMING CHARACTERISTICS SYMBOL MIN. TYP. MAX. UNIT CHARACTERISTIC " " 1 10 )JS 25 NS C+ock Period TCYC Rise & Fali Tifues ... TR, TF Clock Pulse , . , . Width TC 470 NS R/W va+id before positive transition of clock TWCW 180 NS Addie~'s TACW 1~0 NS TDCW 300 NS 11IW 10 NS ,. ' val~d before positive transition of clock Data Bus valid before negative transition of clock " Data Bus Hold Time r ~er~pheraldlita' valid after negative transition ~ of clock . • I Peripheral data valid after negative transition of clock driving CMOS (Level=VCC-30%) TCPV! 1 )JS TCMOS 2 )JS , READ TIMING CHARACTERISTICS CHARACTERISTIC SYMBOL MIN. TYP. MAX. UNIT R/W valid before positive transition of clock TWCR 180 NS Address v'alid befo~epositive transition of clocl5- TACR n~o NS , Pe~ipherq.r data valid before positive transition . , of clock ; TPCR 300 NS '" ',"'1 ',., ~ ~.1 :~ " " ; ';". Dat'a :Bus valid after positive transition of clock ~ TCDR 395 NS " " Data Bus Hold Time THR 10 NS IRQ' (Interyal Timer Interrupt) valid before ·p.os~tive . trans~tion of,clock TIC 200 NS , Loading = 30 pf + 1 TTL load for PA~-PA7, Ea~-PB7 =130 pf + 1 TTL load for D0-D7 10-06 MCS662X and CLOCK MCSI!63~R--Ji: INPUT Tc M204V j l ~~;c Oo4~ Y Q w ~ a:: oQ. _ - - - - - - - - - - 2.4V R/W O.4V a:: o u ~ ui w ~ _----------2.4 V ADDRESS ~----------------O.4V g II) II) --------------------- 2.4 V c( all w Z DATA BUS ' - - - - - - - - - - - - - - - - - - - 0.4 V a:: o TDCW--~--~~--~~ II) o ~ c( Q c( _ _ _ _ _ _ _Vc.:.._-30% Tcpw 10 J~~~-------------2.4V PERIPHERAL DATA '-+~~------- O. 4 V @ WRITE TIMING CHARACTERISTICS Figure 2 CLOCK INPUT .4V R/W -----+---------- O.4V ,.~~------~-----------+----------2.4V ADDRESS ---~------~--------r-------------O.4V PERIPHERAL DATA ~~--~--------~----------r------------2.4V -----+--------4--------~-----------O.4V 2.4V DATA BUS O.4V PB7(TRQ) ~~T_I_C_______________ 2.4V ______________________ - READ TIMING CHARACTERISTICS Figure 3 10-07 O.4V ow Chapter 11 ~ a:: o Il. THE SIGNETICS 2660A a:: o (J ~ en w I- < U oCI) CI) < all w Z a:: m o CI) o :!: The 2650A is functionally identical to the 2650 microprocessor which has been described in previous editions of this book; The 2650A is a, redesigned chip that is smaller and cheaper to produce than the old 2650., The 2650A-1. is a new higher-speed version of the 2650A. Within· the frame of reference of the microcomputers being described in this book, the Signetics 2650A is a very minic:;omputer-like device. The Signetics 2650A has a wealth of memory addressing modes; a large number of CPU-generated control signals are ·aimed at allowing TTL logic to surround the microcomputer device itself, rather than requiring a family of support devices, as do most products described in this book. However. you will have very little trouble using support devices of the SOSOA with the Signetics 2650A CPU. MC6S00 support devices can be used with the Signetics 2650A - but with more difficulty. < o < There are two support devices designed by Signetics specifically for the 2650A. They are: @ 1) The 2656 System Memory Interface (SMI). This is a mu Itifunction support device that provides read-only memory. rea,d/write memory and parallel I/O logic on a single chip. 2) ,The 2651 Programmable Communications Interface (PCI). This is a universal synchronous/asynchronous data communications controller. The 2656 and 2651 are both described in Volume 3. This is because the two devices can be used as easily with a 2650A. or with any other microprocessor. Interesting features of the 2650A, which are described on the following pages, are the imaginative use of status flags, a rich variety of very informative control signals, and the use of the second object code byte, in multibyte instructions, to encode memory addressing options. ' Figure 11-1 illustrates the logical functions implemented on the 2650A CPU chip. Memory and other external logic will connect directly to the 2650A address, data and control lines, without need for interface devices (other than buffer amplifiers needed to meet signal loads). The 2650A uses a single +5V power supply. Using a clock with a O.S microsecond period. 2650Ainstruction execution times vary between 4.S and 9.6 microseconds. Using a clock with a 0.5 microsecond period. instruction execution times vary between 3.0 and 6.0 microseconds . All 2650A signals are TTL compatible. Signetics has a second sourcing agreement with National Semiconductor. whereby National Semiconductor is supposed to second source the 2650A. At the present time it does not look as though National Semiconductor will exercise this second source option. THE 2650A CPU LOGIC The 2650A CPU has a typical microcomputer organization. The Arithmetic and Logic Unit, the Control Unit and programmable registers are all implemented on the 2650A CPU. The additions and omissions shown in Figure 11-1, as compared to typical CPU logic, need some preliminary explanation. Although the 2650A has just one interrupt request line and one interrupt acknowledge line. CPU logic allows every interrupting device to force a vectored branch to its own unique interrupt service routine: for this reason. logic to handle interrupt requests is shown as an integral part of CPU chip logic. 11-1 Clock Logic { .............. Direct Memory Access Control Logic Interrupt Priority Arbitration System Bus ~ I/O Communication Serial to Parallel Interface Logic Programmable Timers ~9~~d~res~,;js Ii .,~i~.~~~~~~i~ I Interface Logic i Read Only Memory I/O Ports Read/Write Memory !, Figure 11-1. Logic of the 2650A Microcomputer CPU Standard ROM and RAM devices can be connected directly to 2650A bus lines: therefore. the 2650A is shown as providing complete memory interface logic. Note. however. that TTL load levels will almost certainly require that signal buffer amplifiers interface memory devices to the 2650A CPU. I/O port interface logic is shown as only partially implemented on the 2650A CPU chip. A 2650A-based microcomputer system with one or two I/O ports will require no special I/O port logic: control signals allow the Data Bus to be used either as a conduit to external devices or to memory. But if a 2650A-based microcomputer system has more than two separately addressable I/O ports. external I/O port select logic must be added. Figure 11-1 excludes clock logic from the CPU chip. The 2650A CPU does indeed require external logic to create its clock signal; however. a single TTL level clock signal with relatively lax tolerances is required. Therefore. external generation of the clock signal will be both inexpensive and free of problems. 11-2 2660A PROGRAMMABLE REGISTERS In addition to a 16-bit Program Counter, the 2660A has seven 8-bit programmable registers which may be illustrated as follows: B Register Bank selected A Register Bank selected ,,-,,, , ...... c w Primary Accumulator !ia: , ................. -:::. ~ ... ~ • . """ I 4,~ .~its """l~o'':' ......... ( '-, .................. ..... '- ............ -:::::-' . oa. ...... ,~ a: o o ~ en w ........... !i ,........ .::..:::.. .................. ' , ..... a bits·· ..... R1A g CI) CI) a bits R1B ...... :al:!its .... "- R2A a bits . · R2B ...... a·bits.' a bits R3B R3A c:( w Z '-__________________________ \. a: o In J ~y~---------------------------J Six Secondary Accumulators/Index Registers Provided by Register Banks A and B CI) o ~ c:( Register Bank B Register Bank A CI/l c RO is a primary Accumulator. This register is always accessible. @ The remaining six 8-bit registers form two 3-register banks. A status bit (which will be described lat~r) is used to identify one of the two register banks as accessible at any given time. Thus. depending on the status bit setting. Registers RO. R1 A. R2A and R3A may be accessible. or else Registers RO. R1 B. R2B and R3B may be accessible. oCt 2660A ACCUMULATOR 2650A INDEX REGISTERS The six secondary registers serve as both secondary Accumulators and Index registers. The 2650A has no Data Counters. as do most microcomputers; rather. it uses the minicomputer philosophy of adding an index. out of an Index register. to a memory address which is computed from information provided by every Memory Reference instruction. The Program Counter is 15 bits wide: therefore up to 32.768 bytes of memory may be addressed in the normal course of events. The two high-order bits of the Program Counter represent page select bits. 2650A memory is divided into four pages with 8192 bytes of memory per page; this scheme is illustrated as follows: 2650A PROGRAM COUNTER 2650A MEMORY PAGES Program Counter 14 13 12 11 10 9 8 7 6 5 .. 3 2 1 0 I I .......I I I I I I I I I I I I I ~ Bit No. J------- ----- ---- --.. J "- ./ -\ -- f\ Page Select MEMORY Memory Address 0000 - \ lFFF -------------~--·f 2000 -t -----------------.- ] f \ t -----------------... j f \ \ ------------- ----Address within page 11-3 3FFF 4000 5FFF 6000 7FFF Pages are selected by Branch instructions, but we will defer to the discussion of addressing modes a description 'of how this is done. I I The 2650A has a primitive Stack, implemented on the CPU chip; this Stack is eight addresses 2650A STACK deep, and its use is limited to storing subroutine return addresses and interrupt return addresses. Subroutines and interrupts may therefore be combined to a nested level of eight. There are no Push and Pop type instructions, and the Stack is indexed via three bits of a Status register. THE 2650A MEMORY ADDRESSING MODES The 2650A has an extensive and versatile range of memory addressing modes. Primary and secondary memory referencing instructions each provide two sets of addressing options, one based on program relative addressing and a two-byte instruction code, the other based on direct addressing and a three-byte instruction code. These options are referred to in Table 11-1 as the program relative addressing op' tions and the extended addressing options. Instructions with program relative addressing options have the following object code: o II '-. RELATIVE ADDRESSING OPTIONS ~ByteNo. ~ 76543210 r .-------------------. 2660A PROGRAM A r'....~~~....~, 7 6 5 4 3 2 1 0 ~Bit No. I I I I_.., I I ...... j • 7-bit, signed binary displacement (-64 to + 63) which i~ added to PC contents ' - - - - - - - - - - - - - I n d i r e c t bit. If 1, program relative, indirect addressing is specified; if 0, direct program relative addressing is specified. ~--------------One of four registers selected as source or destination of 'memory reference operation. The four registers are RO, R1A or R1B"R3A or R3B. " -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Instruction operation code. In the above illustration, the second byte of the instruction code provides a program relative displacement in the range +63 to -64. The displacement is provided as a 7-bit signed binary number; bit 6 is treated as the ·sign bit. The highorder bit of the displacement byte specifies direct or indirect addressing. If direct. program relative addressing is specified, then the effective memory address is created by adding the 7-bit signed binary displacement to the Program Counter contents ~after the Program Counter contents have been incremented. Direct and indirect program relative addressing have been described in Volume I, Chapter 6; 2650A program relative addressing differs only in the shorter displacement which is allowed. If we are to relate the 2650A to our hypothetical microcomputer of Volume I. Chapter 7, or to any of the other microcomputers described in this book, then the task of specifying direct or indirect addressing should fall to a bit within the first object program byte. The fact that the 2650A uses a bit of the displacement byte to specify direct or indirect addressing means that. in effect. the 2650A instruction set has more than 256 object code options available to it. This feature of the 2650A allows it to have a much more powerful instruction set - in the minicomputer sense of the word - than any of the other devices described in this chapter. The price paid is that most instructions generate two or three bytes of object ·code. There are very few one-byte object codes. Consequently, memory utilization is not as efficient as it might initially appear to be. 11-4 In all probability. indirect program relative addressing will be more commonly used than direct. program relative addressing. This is because microcomputer programs usually reside in read-only memory. If direct. program relative addressing is used. then data bytes must be located within 64 bytes of the memory reference instruction. That excludes having instructions in ROM and data in RAM: therefore. only unalterable constants can be addressed using program relative direct addressing. ow ~ a: oa. PROGRAM MEMORY XXXX-40 16 § · . a: o o ~ ui w ~ : 8 (I) (I) c( oil w Z I • • 1-----41 l Program relative. memory Addressing range. all likely to be within one ROM chip o c:a (I) o ~ c( o c( @ XXXX+3F 16 r reference instruction here · XXXX a: >-t------I . I'~ Indirect. program relative addressing. on the other hand. only requires memory addresses to be pOSitioned within 64 bytes of the memory reference instruction: this is illustrated as follows. using arbitrary memory addresses to make the illustration easier to understand: Memory ROM Add~;; 8 t:::::::::J M.m",v ",,,,n,, 'n"ruorion ood. 0412 E~~ I I Displacement = + 2A 16 7A 043E 043F :• 2178 2179 217A 2178 217C RAM 11-5 O.,3 + 002A =043D 21 l~ .• = ~ ) Extended addressing options of the 2650A microcomputer may be illustrated as follows: o 2 r~"""~~'''''''' 7 6 5 .. 3 2 II I I r "" 1 0 7 6 5 .. A ""0 3 2 I I ""-. ~ 'T~ .A r . IIII 7 6 5 l 2650A EXTENDED· ADDRESSING OPTIONS .. "" .. 3 2 1 0 Byte No. Bit No. I / 13 -bit direct address 00 No indexed addressing 01 Index with auto-increment 10 Index with auto-decrement 11 Simple indexed addressing ' - - - - - - - - - - - - - - - - 0 Direct addressing 1 Indirect addressing If indexing is specified. postL -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ indexed. indirect addressing occurs 00 Register RO 01 Register R1A or R1B 10 Register R2A or R2B 11 Register R3A or R3B This is the source/destination register. if direct addressing is specified. This is the Index register. and RO is the source/ destination. if indexed addressing is specified. ' - - - - - - - - - - - - - - - - - - - - - - - - - I n s t r u c t i o n operation code All of the addressing options illustrated above have been described in Volume I, Chapter 6. To summarize, however, these are the addressing combinations which are allowed: 1) 2) 3) 4) 5) 6) 7) 8) Direct addressing (absolute or program relative) Direct indexed addressing Direct indexed addressing with auto-increment Direct indexed addressing with auto-decrement Indirect addressing Indirect addressing with post-index Indirect addressing with post-index and auto-increment Indirect addressing with post-index and auto-decrement There is a small difference between indexed addressing as described in Volume I, Chapter 6, and indexed addressing as implemented by the 2650A. The 2650A memory reference instructions provide a 13-bit absolute address. which represents the full addressing range of any memory bank; an 8-bit index value is added to this displacement. as follows: 12 11 10 9 7 6 5 .. 3 2 1 0 8 ~Bit No. ·,...I-..I....,~I. . . I~I . .......,-..,...I-I......I-..1...~Address 7 6 5 .. 3 2 I 1 0 ~Bit No. I I I I I I I.. Effective address = 13-bit absolute address + 8-bit Provided By Instruction index. 11-6 Index register If you are not clear on the difference between pre-indexed. indirect addressing and post-indexed. indirect addressing. refer again to Volume I. Chapter 6. before proceeding with this discussion of the 2650A microcomputer. ~ ~ ~ ~ o ~ en ~ U o(/) The fact that the 2650A has a 13-bit absolute address and an 8-bit index means that post-indexed. indirect addressing is very viable. The 13-bit absolute address identifies the memory location. anywhere within an 8192-byte program page. where an indirect address will be found. The indirect address becomes the base of a 256-byte table. which may be indexed via anY'one of the six Index registers. The Index register contents are treated as an unsigned binary number. Now look again at indexed addressing the way it is in most microcomputers. and the way it is described in Volume I. Chapter 6. A 16-bit Index register indexes tables that are up to q5.536 bytes in length. and that is clearly ridiculous in microcomputers. The usual programming procedure. when using microcomputers that have a 16-bit Index register. is to use only the low-order byte of the Index register for indexing. The base address is created out of the high-order byte of the Index register. plus the displacement: . w Index (/) ct ciS I II w Z Index register IX: o III (/) o Displacement ~ ct Q ct @ - - - - - - - - - - - - - - - - - - - - Base Address If the base address is created half out of an Index register and half out of a displacement. then clearly post-indexed. in. direct addressing is impossible. Any minicomputer programmer will attest to the fact that post-indexed. indirect addressing is far more usefu I than preindexed. indirect addressing. The 2650A has a wide variety of Branch and Branch-on-Condition instructions, which have the following object code and format: 0 r7 A ~ByteNo. ~ r "'- 1 1 1 1 A "'7 6 5 4 3 2 1 0 6 5 4 3 2 1 0 II I 2650A BRANCH INSTRUCTION ADDRESSING I It(2 II 1 r7 ~I A "'" 6 5 .. 3 2 1 0 ~Bit No. I I I 1 11) L 1..-_ _ _ _ _ _ _ _ _ _ _ 15-b;1 d;ceot ,dd,." 0 Direct addressing 1 Indirect addressing L..._ _ _ _ _ _ _ _ _ _ _ _ _ _ Absolute Branch and Jump instructions interpret these two bits as identifying an Index register. as described for bits 5 and 6. Byte l' of Extended Memory Reference instruction addressing. Conditional Branch and Jump instructions interpret these two bits as identifying the test conditions. ' - - - - - - - - - - - - - - - - - - - - - I n s t r u c t i o n operation code 11-7 Most 2650A Jump and Branch instructions are conditional; that means that only direct or indirect addressing may be used. Notice that the branch direct address is 15 bits wide. Therefore, a Branch instruction may reference any byte within the maximum 32K-byte memory allowed by the 2650A. Branch instructions are, in fact, the means provided by the 2650A microcomputer to select. a page of memory. The two high-order bits of a Branch instruction's direct address select an 8Kbyte memory bank, which remains selected until another Branch instruction modifies the selection. 2650A MEMORY PAGE SELECTION The 2650A has two unconditional Branch instructions. These nstructions also have a 15-bit direct address: therefore, they also select a memory page. In addition to allowing direct or indirect addressing. these two instructions allow indexed addressing to be specified. as described for the extended addressing options. Since Branch instructions specify a 15-bit direct address, in the vast majority of cases simple direct addressing will be used. Indexed addressing will be valuable only in special logic sequences, such as branch tables. Branch instructions with indirect addressing will rarely have any justifiable value. Conditional Branch instructions use bits 0 and 1 of byte 0 to determine if a test condition has been met. The way in which these two bits are used is discussed beiow. along with the description of 2650A Status registers. THE 2650A STATUS FLAGS The 2650A microcomputer has two a-bit Status registers as follows: 5 2 1\ SP2 SPl SPO 3 2 1 0 wc 0 3 " I I> Memory Register X < Memory = Register X > Reg ister X < Register X Register X Register X 11-8 IDC is a standard intermediate Carry bit, reflecting the carry' out of bit 3. 0, the Overflow bit, and C, the Carry/Borrow bit, are standard Overflow and Carry statuses as described in Volume I, Chapter 2. . Q w t- < a: 0 a. a: 0 CJ :!!: en w t- g< (I) (I) < c/J w Z a: 0 al (I) 0 :E < c < © SENSE A12 All A10 A9 AS A7 A6 A5 A4 A3 A2 Al AO AOREN RESET iNi'REQ A14-0/C A 13-E/NE M/iO 3 4 5 6 7 8 9 10 11 12 13 2650A 14 15 16 17 18 19 20 FLAG 40 39 38 37 .36 35 34 33 32 31 30 29 28 VCC CLOCK PAUSE OPACK RUN/WAIT INT~CK DO 01 02 03 04 05 06 07 OBUSEN OPf,lEQ 26 25 24 23 22 21 Fi./w WRP GNO Pin Name Description Type *AO-A12 *A13-A14 *00-07 *SENSE * FLAG *AOREN *i5iillSEN *RESET *O/C *M/iO ·R/W *OPREO *OPACK *E/NE *WRP *INTREQ *INTACK *RUN/WAIT *PAUSE CLOCK VCC.GNO Address Bus lines Page Select lines Data Bus lines Control input Control output Address Bus float Data Bus florlt Reset Oata/Controi output Memory /10 Reference Read/Write Operation Request Operation Acknowledge I/O Instruction length Write Pulse Interrupt Request Interrupt Acknowledge Run status Wait Timing Power and Ground Output Output Bidirectional Input Output Input Input Input Output Output Output Output Input Output Output Input Output Output Input Input *These signals become the System Bus. Figure 11-2. 2650A CPU Signals and Pin Assignments RS, the Register Bank Select bit, specifies the current bank of Accumulator/Index registers: either R1A. R2A and R3A or R1 B. R2B and R3B. Recall that addition. subtraction. shift and rotate instructions optionally mayor may not include the Carry status; in other words. a microcomputer may have an Add-with-Carry or an Add-without-Carry instruction; it may have a Rotatesimple or a Rotate-through-Carry instruction. The WC bit specifies whether the Carry will or will not be included in 2650A instructions of this type. If the C status is included in a rotate, the IDC status will also be included, operating as a branch carry out of bit 3. This is a unique 2650A feature. 11-9 The Compare status determines whether Compare instructions will treat data as signed or unsigned binary numbers. Consider an instruction which compares the contents of Register RO with the contents of memory byte. Clearly the result of the comparison vilill differ significantly, depending on whether the high-order bit of each byte is beiflg interpreted as a ~ign bit or whether positive numbers only are being compared. If the COM status flag is set to 1, the two bytes are assumed to be positive numbers. If the COM status is set to 0, the two bytes ~re assumed to contain signed binary numbers. a The WC .and COM statuses of the 2650A microcomputer are very powerful features; their significance is that they double the available number of Arithmetic and Compare instructions. respectively. without increasing the . . . number of in~fr!-lction object c o d e s . ' THE 2650A CPU PINS AND SIGN~LS The 2650A CPU p!ns and signals are illustrated in Figure 11-2. A description of these signals will highlight the underlying philosophy of the 2650A chip design: that this device can be used with standard off-the-shelf TTL logic. rather than tequiring a family of support devices. There are applications where the Sigll f3 tics philosophy is viable· and will work; there are other applications "\Ihere the specialized devices providect by Signetics and other microcomput~r manufacturers cannot be repro~!Jced at equiv~lently low. co~t. The Address Bus is 13 lines wide; it is used to address a single byte .within 8192 bytes of memory. The low-order eight address lines may also be used to address an external device. " A13 and A 14 are page select lines. As described in the discussion of addressing modes, only Branch instructions provide 15-bit memory addresses. When a Branch instruction is executed, the two high-order bits of the address, output on pins 1Band 19, are used by external memory to select or peselect 8K memory pages. Subsequent memory reference instructions that provide only a 13-bit memory address will refere~ce the most recently selected 8K memory bank. This may be illustrated as follows: . A12.-----------------------------------, A11.----------------------------------A10.-____ ~--------------------~-----A9.-________________________________ ____ AB.-__________________________________ A7.-______________________ ~--------- A6 . -__________________________________ A5 .-----------________ ~---------------A4.-____ __________________________ ____ ~ General Address Bus A3.---------------------------------A2 . - - - - - - - - -____________________________ A1 .---~--------~------------------~ AO~----------------~----------~----) A14 t-~"'-I A 13 I -__-+--I Page 0 select ~K>-"'HL Page 1 select These selects must be latched since the A 13 and A 14 pins are shared with control signals Page 2 select Page 3 select Control lines of the 2650A microcomputer may be grouped into categories as follows: 1) 2) 3) 4) 5) CPU execution control Data and Address Bus access control Data and Address Bus contents identification Interrup,t processing Direct. external device interface 11-10 CPU execution control signals, being of primary importance, will be discussed first. CLOCK is the master timing signal required by the 2660A CPU. Depending upon the way in Q w which external logic is implemented. CLOCK mayor may not be needed by other devices that surround the 2650A; in most cases CLOCK will not be needed by other devices. since system control will normally be handled by 2650A control iHputs and outputs. 2650A CPU EXECUTION CONTROL SIGNALS ~ oQ. RESET is the master raset input which every microcomputer has. As is standard for most microcomputers. when the CPU is reset. the Program Counter is cleared. with the result that the instruction stored in memory location Is executed. The CPU will typi,cally be reset when first powered up. o PAUSE causes the CPU to enter a Wait state. PAUSE is an input signal which may be used by external direct memo- ~ ry access logic to stop the CPU while memory is being accessed. The Halt instruction also causes the CPU to enter the Wait state. A Wait state will be .terminate,d by a Reset or by external logic removing its PAUSE input. ' a: a: u ui w a . ' '.~,; , --- , . ~ There are two bus access control signals on the 2650A: DBUSEN and ADREN. These two signals float the Data and Address Busses, respectively. On the Address Bus, only the 13 Ad- en en dress Bus lines AO - A 12 are floated: the, two page select lines A 13 and A 14 are not floated. Cio:I Z The most interesting feature of 2660A control signals is the scheme employed for identifying events on the Data and Address Busses. o en o The inception" of any operation which will involve external devices is identified by OPREQ going high. g c:( w a: III ~ c:( o c:( @ -------. 26.50A BUS ACCESS CONTROL SIGNAlS 2650A BUS CONTENTS .' IDENTIFICATION SIGNALS Normally.' the first step in any operation that involves axternal,logic is for an address to be output on'the Address Bus. If memory is being accessed, then M/ffi is output hi~h. RIW is output high to identify a write operation or low to identify a read operation. As soon as memory has responded to the memory read or write operation. it inputs OPACK low. If OPACK low does not arrive in time for the e~L.J to conti!lue proces~he current instruction at the next clock cycle. then the CPU temporarily enters the Wait state and outputs RUN/WAIT low to indicate this condition. Now as soon as OPACK is input low. the Wait state will end and the CPU will continue execution. The CPU will also output a write strobe, WRP, when writing to memory. This strobe is output wh~n data is steady on the Data Bus. I/O instructions, M/iO is output low. You will see in Table 11-1 that the 2650A instruction set includes two sets of I/d instructions; one set does not identify an I/O port. and has a one-byte object code; the other set identifies an I/O port via a second byte of object code. Let us assume that the short I/O instructions will always reference I/O Port O.while the long I/O instructions will specify one of 256 I/O ports. The E/NE signal, if low. identifies a short I/O instruction. therefore an instruction which accesses I/O Port 0; if high, this signal indi.catE!s that the current contents of the low-9~der eight address lines contain an I/O port address. and should be so decoded. In fact. the I/O port which is selected:by a short I/O instruction can be defined by you. You can look upon E/NE as a signal which. when low. is a unique select line. When high. E/NEidentifies the low-order eight Address Bus lines as providing the I/O port address. Thus. you can generate I/O port select logic as follows: When an 1/0 deyice is being accessed by one of the -.. A7 ... Select Logic (low true) ... tHigh enable E/NE ..- } Individual I/O select lines (low true) Single I/O select line (low true) Once an 1/0 port has been selec~ed, and external logic knows from the MIlO and EINE controls whic'h 1/0 port is selected, I/O logic needs to know whether an input or output I/O operation is to occur, and whether data or control/status information is to be transmitted. (Volume I. Chapter 5 discusses at length the difference between data, controls and status.) The'R/W control indicates whether data Is being transmitted from the CPU to external devices, or whether external devices are supposed to transmit data to the CPU; then D/e identifies the output as either data or control Information. Conversely. when Ff/w identifies the CPU as requiring input from an I/O device. indicates whether the input should be data or status~ o/e 11-11 When' external. device logic responds to the I/O request, it concludes by inputting OPACK low. Figu re .11-3 illustrates how control signals may be used to interpret events on the Address and Data Busses. 2650A iriterrupt ha'ndling is very straightforward. An interrupt is requested by setting INTREQ low. The interrupt is acknowledged by the CPU outputting INTACK high. . The SENSE and FLAG signal~ allow the 2650A to directly control external devices. The condition of a SENSE input is ir.lmediately translated into a 0 or 1 within the Sense bit of the 2650A Status register. A 0 or 1 in the Flag bit of the 2650A Status register is immediately reflected by a low or high signal output at the Flag pin. INTERFACING MEMORY TO THE 2650A MICROCOMPUTER 2650A. INTERRUPT CONTROL SIGNALS 2650A EXTERNAL DEVICE CONTROL SIGNALS Given the wealth of control signals provided by the 2650A microcomputer, mosttypes of memory can be interfaced with very little difficulty. The only peculiarity of the 2650A which external logic must be able to cope with is the fact that memory is paged into 8192-byte pages. Any memory device whose addressing range is smaller than a page must have select logic which takes into account not only high-order address lines on the 13-line Address Bus but. in addition. the two page select lines. The two page select lines change status occasionally when a new page is being selected; therefore, 'page select must be stored in an external buffer. The 2650A CPU also expects to receive an OPACK acknowledgement from memory. If memory can respond to an access within the allowed time,then you can simply tie OPACK to ground for all memory accesses. 110 accesses must still be able to respond with a high or low OPACK, depending upon prevailing conditions. Here is appropriate logic: I/O OPACK (norm~lIy low) ~-----cr-""r::)-__ OPACK to CPU Memory OPACK lio OPACK is normally low. 110 logic drives OPACK high at the beginning of an 1/0 access if the 1/0 device requires extra time to respond to OPREO. The OPACK input during memoryaccess operations is equivaient to the 8080A READY input. You should refer to the extensive discussion of the 8080A READY input given in Chapter 4 in order to find ways of using OPACK logic in a 2650A microcomputer system. INTERFACING I/O DEVICES TO THE 2650A MICROCOMPUTER The simplest way of interfacing exter~al devices to the 2650A rriicro~omputer is to use the microcomputer's I/O instructions, plus the control signals which identify I/O operations. in A very small microcomputer system may only have one 1/0 port. this case the 1/0 port can connect directly to the Data Bus and can always consider itself selected. A larger system may have up to 257 8-bit ports, with select lines that simply connect to the Data Bus and use EINE as a select enable signal. THE 2650A MICROCOMPUTER INTERRUPT PROCESS The 2650A has a single interrupt request line and a single interrupt acknowledge line. Interrupt priorities will therefore be handled via a daisy chain .. When the CPU acknowledges an interrupt, first it disables all further interrupts. Next, it pushes the contents of the Program Counter onto the address Stack and zeros the Program Counter. The CPU will now insert the first byte of a ZBSR instruction code into the Instruction register; this instruction code is a Branch-to-Subroutine using program relative addressing. The interrupting device must submit a byte of data on the Data Bus, which will be interpreted as the second byte of the ZBSR instruction.· 11-12 OPREQ = 1 The next two clock c periods require memory or 1/0 access w I ~ a:: o D. a:: o (.) ~ en w ~ U MilO =1 Memory is referenced M/iO =0 An 1/0 device A memory address is is referenced on the Address Bus oCI) CI) ct = all R/W =0 R/W =1 w Z Transmit data Write data on E/NE == 0 A one-byte liD 1 E/NE Read 1/0 port number a:: on the Data Bus Data Bus into instruction off the low order eight III to the CPU memory o Address Bus lines CI) o -......... ~ ct ct c @ 1 R/W=O R/W=1 Transmit a byte Receive a byte on the Data Bus output by the CPU to the CPU on the Data Bus V D/<:=O D/C= 0 Transmit Receive Status Control 1" D/e= 1 DIC =1 Tra.nsmit Receive Data Data' ii, ' - - - - -... __ ~~ At conclusion of operjation input OPACK low; otherwise CPU will enter ' -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _. a . . . . WAIT state and output _ • RUN/~ 0 . .-~~~~~~~~ Figure 11-3. How Control Signals Identify Address' and Data Bus Use for the 2650A Microcomputer Look again at the discussion of 2650A addressing modes and you will see that with the Program Counter set to 0, the byte of data input by the interrupting device becomes a displacement vector. 11-13 Assume that each,external device has the beginning address of its interrupt service routine st'ored somewhere within the first 64 bytes of the zero memory page. The interrupting device must input the following byte of data: . 7 6 5 .. 3 2 1 0 ~Bit No. o ' - - - - - - - - S l x · b l t device select code: must be twice the device number. since two bytes will be needed for each device address . .....- - - - - - - - - - Must be 0 since only positive displacements from memory location 0 are being used. (Negative values. with addressing the top 64 bytes of memory also feasible.) . ' - - - - - - - - - - - - - I n d i r e c t addressing must be specified This byte of data causes an indirect program relative jump to the interrupting device's interrupt service routine. as follows: 5 .. 3 O.~BitNo. .......- . ...............""""1"".. Memory PROGRAM Address MEMORY :l::::::::j ~2t===:1 Displacement of . 1A 16 is specified E oolA I Indirect. addressing specified oolB OA .. A .i oolC 0010 00lE oolF Program execution continues with instruction stored in memory location OA4A 16 2650A MICROCOMPUTER DIRECT MEMORY ACCESS Direct memory access .ina 2650A system is left up to external logic. Two schemes are possible. External iogic may stop' the CPU, using the PAUSE input; while the CPU is disabled, external logic may take control of Data and Address Busses to access memory in any way. Alternatively, DMA logic may be implemented to operate in parallel with the CPU. The 2650A has periods when both the Data Bus and the, Address Bus are floated. Handling DMA in parallel with normal instruction execution is made possible if Y0L! combine the OPREQ and OPACK handshake signals with normal timing sequences. The only economical way of handling direct memory access in a 2650A microcomputer system is to use one of the direct memory access control devices described in Volume 3. Timing requirements are given with the discussions of these devices. The flexibility of the 2650A System Bus is such that you will have very'little difficulty generating an interface with any of these direct memory access control parts. THE 2650A MICROCOMPUTER INSTRUCTION SET The 2650A microcomputer instruction set is the most minicomputer-like of the microcomputers discussed in this book. It is particularly rich in addressing modes and memory reference instructions. The instruction set is listed in Table 11-1. Memory reference instructions are shown as offering program relative addressing options or extended addressing options. See the discussion of 2650A addressing options for a definition of these terms. Note that in the statuses coiumn. CC identifie~ cco and CC 1 statuses. These two statuses are ~sed to test for a zero. positive or negative branch condition: these two statuses are described along with the· 2650A Status registers. the 11-14 The TMI Immediate Operate instruction compares a register's contents with a mask provided by the instruction operand. This instruction allows any bit combination to be tested for. in any CPU register. cw ~ II: oc.. II: The Decimal Adjust (DAR) instruction of the 2650A differs from the instructions with the same name as implemented on a number of other microcomputers. The Decimal Adjust instruction can be used to perform binary decimal arithmetic. Referring to. the discussion of binary decimal arithmetic given in Volume I. the 2650A DAR instruction performs Step 3 of the binary-coded-decimal addition operation described in Chapter 3. THE 2650A BENCHMARK PROGRAM This is how the 2660A may implement our benchmark program: o o ~ enw LOOP ~ g en en c( II/J w Z LODA.R1 LODA.R2 LODA.RO STRA.RO BDRR.R2 STRA.R1 TLENGTH 10BFL *IOBUF.R2 *TABLE.R1.+ LOOP TLENGTH LOAD DISPLACEMENT TO FIRST FREE TABLE BYTE LOAD I/O BUFFER FILLED LENGTH LOAD NEXT I/O BUFFER BYTE STORE IN TABLE. AUTO-INCREMENT R1 DECREMENT R2. RETURN TO LOOP ON NON-ZERO AT END. RESTORE NEW TABLE LENGTH The benchmark program. as illustrated for the 2650A. assumes that both the data table and the I/O buffer have maximum lengths of 256 bytes. II: The displacement to the first free byte of the data table is stored in a memory location identified by the label TLENGTH. en The number of filled I/O buffer bytes is stored in a memory location identified by the labellOBFL. It is assumed that the I/O buffer can be read backwards: in other words. the last I/O buffer byte becomes the first byte stored in the permanent data table. oa:I o :!: c( c c( @ The instruction with label LOOP begins by loading the last byte in the I/O buffer. using indirect. indexed addressing without auto-increment or auto-decrement. Subsequently. Index Register R2 is decremented: if it does not decrement to O. execution returns to the instruction labeled LOOP.· The instruction which stores data in TABLE uses indirect. post-indexed addressing. with the contents of Index Register R1 auto-incremented. Thus. at the conclusion of data movement. Index Register R1 contains the displacement to the next free byte of TABLE. Comparing the 2650A benchmark program with other benchmark programs shown in this book might suggest that the 2650A has the shortest. and therefore the fastest and most efficient benchmark program. This is not necessarily the case. Certainly the 2650A instruction set provides a source program which is likely to be shorter than any other microcomputer's source program. but that is because instructions are very minicomputer-like. The number of bytes required to implement the 2650A object program. and the time taken to execute the program. may bear no relationship to the length of the source program. For example. the program loop. although it contains only three instructions (LODA. STRA and BDRR). will require eight bytes of object program. Once ~gain. we caution against drawing fast conclusions from benchmark programs. The following symbols are used in Table 11-1: ,* ADDR(X) 16-bit extended addressing mode: '·1 I I I ., ·1 ...... V 1 1 ~-- (X) ~ 1 II ~ .ADDR 1 for indirection *BADD (X) 00 for 01 for 10 for 11 for ADDR 13-bit absolute address non-indexed indexed with auto-increment indexed with auto-decrement indexed only 16-bit absolute addressing mode: 11 1 1 1 1 ..I......1.......&.."""1_·""-......""-... 1~I ~~..........~~'vr~--..........,~ BADD BADD C 1 for indirection 15-bit absolute address Carry status 11-15 CC The two Condition Code bits CC1 and CCO CC1 CO CCO CIDC The Carry and Inter-Digit Carry C.CO IDC dataNE The non-extended data port DATA2 2-bit data unit DATA8 8-bit data unit *DISP 8-bit relative addressing mode: I 1 1 ·1 1 1 1 1 I --~ DISP DISP 1 for indirection 7-bit signed displacement EAA Effective address generated by *BADD EAD Effective address generated by *ADDR(X) EAR PC relative address generated by *DISP IDC Inter-Digit Carry status o Overflow status P An 8-bit port number PC Program Counter PSU Upper byte of Program Status Word PSL Lower byte of Program Status Word RAS(SP) The Return Address Stack location indicated by the Stack Pointer RO Accumulator One of the seven CPU registers SP Stack Pointer status NE The Non-Extended status port ZEA A zero page relative address generated by DISP x Bits y through z of the quantity x; for example, RO<3,O> represents the lower 4 bits of the Accumulator. [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets, then the designated register's contents are specified. If an I/O port number is enclosed within the brackets, then the I/O contents are specified. If a memory address is enclosed within the brackets, then the contents of the addressed memory location are specified. [[ ]] 'Implied memory addressing; the contents of the memory location designated by the. contents of a register. A .Logical AND V Logical OR 4/- Logical Exclusive-OR Data is transferred in the direction of the arrow Data is exchanged between the two locations designated on either side of the arrow. Under the heading of STATUSES in Table 11-1, an X indicates statuses which are modified in the course of the instruction's execution. If there is no X, it means that the status maintains the value it had before the instruction was executed. 11-16 © ADAM OSBORNE 8t ASSOCIATES. INCORPORATED Table 11-1. Summary of Signetics 2650A Instruction Set STATUSES TYPE MNEMONIC OPERAN'D(si OPERATION PERFORMED BYTES C > w cc .r 1 X REDC .r 1 X 2 X . ,r P WRTD .r 1 WRTC .r 1 WRTE .r P 2 LODR It 0 ::E IDC REDO REDE g 0 .,r ,eDISP [r]-[dataNE] Read data at non-exteridad port Into sp8clfied register. r] ~ [ stlitusNE] Read non-extended status into specified register. [r]-[P] t Read into specified register from Port P. [dataNE]-[r] Write specified register contents to non-extended data port. [ statusNE] - [rJ Write specified register contents to non-extended status port. [P]-[r] Write specified register contents to Port P. 2 X X I [rJ-[EAR] Load sp8cifled register from relative location. [r]-[EAD] w CJ LODA .r eADDR(X) 3 > It It w w u.. w STRR ,r eDISP 2 Loacl specified register from extended iocation. [EAR]-[r] ~ ,It STRA .r eADDR(X) 3 Store specified register contents in relative location. [EAD]-[r] Z ~ < a: ~ Store Specified register contents in extended ioca1ion. AD DR .r eDISP 2 X X X X [rJ-[r]+ [EAR] ADDA .r eADDR(X) 3 X X X X Add contents of relative location to specified register. [r]-[r] + [EAD] SUBR ,r eDISP 2 X X X X > It ffi~ SUBA .r eADDR(X) 3 X X X X ~ It > ANDR ,r eDISP 2 w It 0 ANDA ,r eADDR/X) 3 X IORR ,r eDISP 2 X lORA ,r eADDR(X) 3 X ,r eDISP 2 X ,r eADDR(X) 3 X w _: CJ ~, ffi < Q u.. (J II) w' ~ w 0 )0 o X It ~ ~ w· w ~ ~- Add contents of extended location to specified register. [r]-[r] - [EAR] Subtract contents of relative location from specified register. [r]-[r) - [.EAD) Subtrect contents of extended location from specified register. [r)~[rJ A [EAR] AND contents of relative location with those of specifaed register. [r]-[r] A [EAD] AND contents of extended loc.ation with those of specified register. [r]-[r]V [EAR] OR contents of relative location with those of specified register. . EORR llr]-[r]V [EAD] OR contents of extended location with those of specified register. [r]-[r]-Y-[EAR] Exclusive-OR contents of relative location with those of ,specified register. EORA [rJ-[r]¥ [~D] Exclusive-OR contents of extended location with those of specified register. Table 11-1. Summary of Signetics 2650A Instruction Set (Continued) STATUSES MNEMONIC TYPE OPERAND(S) OPERATION PERFORMED BYTES C > > S II: W IDC CC ,r ·DISP 2 X COMA ,r. *ADDR(X) 3 X LODI ,r DATAB 2 X [r]-DATAB Load immediate into specified register. AQPI ,r DATAB 2 X X X X SUBI ,r DATAB 2 X X X X w 'A~DI ,r DATAB 2 X " IORI ,r DATAB 2 X "C EaRl ,r DATAB 2 X [rJ-[r] + DATAB Add immediate to specified register contents. [rJ-[rJ- DATAB Subtract immediate from specified registers contents. [rJ-[rl A DATAB AND immediate with specified register contents. [rl-[r]VDATA8 OR immediate with specified register contents. [r]-[r]] VDATAB Exclusive-OR immediate with specified register contents. :E ~ COMI ,r DATAB 2 X TMI /DATAB 2 X 0 ;:) :E :E z w w i= :E ~ 0z > If [rJ > [EAR]; then CC =01 If [rl = [EAR]; then CC =00 If [r] < [EAR]; then CC = 1() Compare contents of relative location with those of specified register; set the CC accordingly. If [r] > [EAD]; then CC =01 If [rl = [EAD]; then CC = 00 If [rJ < [EAD]; then CC = 10 Compare contents of extended location with those of specified register; set the CC accordingly. COMR II: 0 0 w g .11: u 0 Z 0 II: "z W w IW U II.. III II: w w " II: W Q. 0 w I- "C w :E ~ I co I- 11:. w Q. 0 w I- w If [r] > DATAB; [CC]-01. If [rJ =DATAB; [CC]-OO If [rl < DATAB; [CC]-10 Compare immediate· with specified register; set the CC accordingly. If all selected bits are set, CC = 00; otherwise CC = 10 Test bits in specified register corresponding to Is in immediate data. If all tested bits are CC accordingly. Q. ZBRR ·DISP 2 BXA ·BADD 3 ZBSR ·DISP 2 BSXA "BADD 3 ~ ..,. ;:) [PC]-ZE.A Branch to zero page address. [PC]-EAA Branch to extended address. [SP]-[SP] + 1 [RAS(SP)]-[PC] + 2 [PC]-ZEA Call zero page subroutine. [SP]-[SP] + 1 [RAS(SP)]-[PC}+ 3 [PC]-EAA Call extended subroutine. IS set © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 11-1. Summary of Signetics 2650A Instruction Set (Continued) STATUSES TYPE MNEMONIC OPERAND(S) OPERATION F!ERFORMED BYTES C Z 0 ~ is BCTR' ,DATA2 eDISP 2 BCTA ,DATA2 eDISP 3 BCFR ,DATA2 eDISP 2 BCFA ,DATA2 eBADD 3 BIRR ,r eDISP ·2 Z 0 9 BIRA ,r eBADD 3 ::t Z a: CC If DATA2 =CC, then [PC]-EAR Branch relative if DATA2 equals CC. If DATA2 =CC, then [PC]-EAA Branch absolute if OATA2 equals CC. If DATA2 ~CC, then [PC]-EAR Branch relative if OATA2 is not equal to CC. If DATA2 'ICC, then [PC]-EAA Branch absolute if OATA2 is not equal to CC. [r]-[r]+l Increment specified register. If nonzero rasult, branch relative. [r]-[r]+ 1 If [r] ,lO, then [PC]-EAA CJ c( IDC If [r] ~O, [PC]-EAR CJ Z 0 BDRR ,r eDISP III 2 Increment specified register. If nonzero result, branch absolute. [r]-[r] -1 If [r] ,l.O, then [PC]-EAR BORA ,r eBADD 3 Decrement specified register. If nonzero result, branch relative. [r]-[r]-l If [r] # 0;" then [PC]-EAA I CD BRNR ,r eDISP 2 BRNA ,r eBADD 3 Decrament specified register. If nonzero result, branch absolute. If [r] ~O; then [PC]-EAR If specified reglstertis nonzero, branch relative. If [r] #0; then [PC]-EAA If specified register is nonzero, branch absolute. BSTR ,DATA2,eDISP 2 If DATA2 = CC; then [SP]-[SP] + 1 [RAS(SP)]-[ PC] + 2 [PC]-EAR BSTA ,DATA2 eBADD 3 If DATA2 BSFR ,DATA2 eDISP ·2 BSFA ,DATA2 eBADD 3 ::t CJ if DATA2 equals CC, Z then call subroutine at ralative addrass. c( a: III W z ~ ::l 0 a: III ::l ell ..:i c( Z 0 ~ is z 0 CJ = CC; then [SP]-[SP] + 1 [RAS(SP)]-[ pc] + 3 [PC]-EAA If DATA2 equals CC, then call subroutine at absolute addrass. If DATA2 ,lCC; then [SP]-[SP] + 1 [RA5(SP)]-[ PC] + 2 [PC]-EAR If OATA2 not equal to CC, then call subroutine at relative address. If DATA2 ~CC; then [SP]-[SP]+ 1 [RAS(SP)]-[PC] + 3 [PC]-EAA If DATA2 riot equal to CC, call subroutine at absolute address. Table 11-1. Summary of Signetics 2650A Instruction Set (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES~--~---r---r--~--~--~ C w- ~ C w BSNR ,r °DISP BSNA ,r °BADD RETC ,DATA2 0 IDC If'[rJ ~ 0; then [SP]-[SP] + 1 [RAS(SPI1-[PC] + 2 [PC]-EAR ::I o ::I a: Z ~ Z ID ::I 0 CI) If specified register is nonzero, call subroutine at relative address. If [r] 10; then [SP]-[SP]+ 1 [RAS(SPI1-[PC] + 3 [PC]-EAA :.#. 9 Z :z: o CJ ~ If specified register is nonzero, call subroutine at absolute address. If DATA2 =CC, then [PC]-[RAS(SPI1 [SP]-[SP] - 1 If DATA2 equals CC, then return from subroutine. Z is ~ Z ID o OPERATION PERFORMED CC CJ LODZ x [RO]-[r] STRZ x Load Accumulator (Register 0) with specified register contents. [r]-[RO] x [RO]-[RO]+ [r] Store contents of Accurnulat9r (Register 0) into specified register. w ADDZ ,r x x x A. SUBZ ,r x x x I- ANDZ ,r S w IORZ ,r ri: w EORZ ,r x sw COMZ ,r x 5 w I N o o a: w Add specified register to Register O. [RO]-[RO] - [r] x CI) a: Iii a: $ubtract specified register from Register O. [RO]-[RO] A [r] AND specified register with Register O. [RO]-[RO]V [r] OR specified- register with Register O. [RO]-[RO] ..... [r] Exclusive-OR specified register with Register O. If [RO] > [r]; then ec = 01 If [RO] = [r]; then ec =00 If-[RO] < [r]; then ee = 10 e w I- cs: a: RRL ,r x x x x w -_ ec- accordingly. J I=tJiJi4i I -l o - Compare specified register with Register,o; set the 7 0 IDC 0 WC=o Or A. o a: w Iii S w II! If WC is 0, rotate the specified register left. If we is 1, rotate through Carry and Intermediate Carry. © ADAM OSBORNE & ASSOCIATES, INCORPORATED Table.11-1. Summary of Signetics 2650A Instruction Set (Continued) STATUSES TYPE MNEMONIC OPERAND IS) OPERATION PERFORMED BVTES C 0 IDC C~ - oL, C Ci 1&1 ::I z z RRR ,r 1 i= X X X x - ~ 0 - 1&1 ~ I- ct II: 1&1 A. 0 .- 11:- 0--1 1&1 Itil C5 1&1 ::I I N 0 t£tf"ff'fI ~ 7 - 0 We"l DAR ,r 1 Decimal adjust the specifoed register. RETE ,DATA2 1 If DATA2'=CC; then [PC)-[RAS(SPI1 [SP)-[SP) - 1 . Enable interrupts If DATA2- equals CC, then retum from subroutine and enable interrupts. LPSU 1 [PSU)-[RO) LPSl. 1 ~PSL1-[RO) SPS~ 1 [RO)~[PSU) II: II: 1&1 I- ~ Load Register 0 into·PSU. Load ~egister 0 into PSL. Load PSU into Register 0: SPSL 1 til ~ PPSU DATAS, 2 I- '" PPSL DATAS'·· 2 CPSU DATA8 2 CPSL DATA8 2 TPSU DATA8 2 X TPSL DATA8' 2 X. en .wc =0 If WC is O,rotate the:specified register right. If we is 1, rotate through Carry and Intermediate Carry. _II: A. O· _ 7 Or g I- ~- J 0 fgrliib;tl J IDC NOP 1 HALT 1 I:' [RO)-[PSL)' Load PSL into Register 0: . If [DATA8 llllllaa 2 3 3 3 I1qqqqqqq 1 2 3 CPSU DATA8 74 pp 2 :) "ADDR(X) EORA.r EORI.r DATA8 ·DISP lllllOaa ·BADD 1101-l,laa 110110aa "BADD 010111a8 2 3' 3 3 2 3 3 3 010110a8 2 3 .,BSFR,DATA2 "DISP 101111ff 3 3 ·BADD 011,111aa 2 3 3 3 bqqqqqqq "DISP 0111108a 2 3 3 3 beeeeeee BSTA.DATA2 "BADO BSTR.DATA2 "DISP ool111ff -"BADD ·DISP· 3 011000aa 1 2 0000llaa 3 4 2 2 2 3 OOOOOOS!I 1 93 1 2 2 0110108a IORZ.r ·ADDR(X) LODA.r bccqqqqq ~ODI.r DATA8 00000laa PP ·DISP LODR.r 0000108a LPSL LPSU 92 2 co 1 NOP 1 2 77 1 3 76 pp 2 3 REDC.r oo11ooaa 1 2 REDD.r 011100aa 1 2 010101aa 2 3 DATA8 PPSU DATA8 P PP RETC.DATA2 000101ff 1 3 RETE.DATA2 ool101ff 1 3 RRL.r, 110100aa 1 2 QQ R~R.r 010100aa 1 2 SPSL 13 1 12 ; 2 11oo11aa 3 4 2 3 1 2 oo1110ff 2 3 SPSU BF ;3 3 3 3 STRA.r "ADDR(X) 9F bqqqqqqq QQ 2 bccqqqqq QQ QQ "BADD 2 pp bqqqqqqq BXA 2 Olloolaa bqqqqqqq beeeeeee BSXA 2 DATA8 REDE.r QQ BSNR.r 4 PP beeeeeee BSNA.r 2 3 IORI.r PPSL bqqqqqqq 00 10111~ 2 1 011011a~ bccqqqqqQQ LOD!.r beeeeeee BSFA.DATA2 "BADD 1 baeeeeee QQ "DISP 3 QQ bqqqqqqq BRNFl.r 2 oo1010aa beeeeeee -beatiMee BRNA.r 2 ·ADDR(X) QQ "DISP 2 ooloolaa ool000aa _ 40 bqqqqqqq sI~R,r 3 4 HALT IORA.r- IORR.r beeeeeee 81M,r 1 3 beeeeeee QQ tDISP loo101aa oo1011aa bccqqqqq 00 " BORR,r 3 2 QQ. 000llOff 2 75 pp EORZ.r bqqqqqqq BCTR.DATA2."DISP 111010aa l11000aa EORR.r 2 beeeeeee 000lllff 2 pp QQ l00llOff 2 DATAl! bqqqqqqq BCr=R.bATA2 "DISP ;llOOlaa COMZ.r CPSL DAR.r b8eeeeee ANDZ.r 4 beeeeeee bccqqqqq ANDI.r CYCLES 3 PP beeeeeee ADDZ.r ANDA.r MACHINE QQ 2 pp ADDR.r 111011aa BYTES bccqqqqq QQ ADDI.r OBJECT CODE STAR.r "DISP l1oo108a beeeeeee STRZ.r 11-22 ll0000aa Table 11-2. Signetics 2650A Instruction Object Codes (Continued) INSTRUCTION SUBA.r ·ADDR(X) OBJECT CODE BYTES MACHINE CYCLES 10101188 3 4 INSTRUCTION TPSU DATAB bccqqqqq cw II: o(.) ~ en w ~ g BYTES MACHINE CYCLES. B4 2 3 1 1 2 2 2 3 2 3 2 3 PP 00 ~ oIl. SUBl.r . DATAB 10100laa pp 2 2 SUBR.r ·DISP 2 3 SUBZ.r TMI.r 1 DATAB 10101088 beeeeeee 10100088 11110188 2 3 TPSL DATAB II: OBJECT CODE 2 WATC.r WRTD.r WATE.' P ZBRR ·DISP 1011008a llll00aa 11010188 pp 9B beeeeeee ZBSR ·DISP BB beeeeeee PP B5 PP 2 3 (I) ~ alJ The following symbols are used in Table 11-2: Two bits which. in conjunction with the Register Bank Select bit in the PSL. choose the register w aa II: b One bit selecting the indirection option cc Two 00 01 10 11 eeeeeee 7-bit signed address displacement Z oen (I) o :!: « c « @ bits choosing the indexing mode: No indexing Indexing with auto-increment Indexing with auto-decrement Indexing only ff 2-bit test value PP eight bits of immediate data q One bit of absolute or extended address o One byte (eight bits) of absolute or extended address SUPPORT DEVICES THAT MAY BE USED WITH THE 2650A MICROPROCESSOR Interfacing the 2650A with 8080A support devices is very straightforward. Figure 11-4 shows how 8080A con, trol signals may be generated from 2650A control signals. Figure 1 i -5 provides the same information for the , MC6800. But there are some ambiguities not immediately apparent when you look at Figure 11-4. To begin with. the 2650A uses a request/acknowledge handshaking control protocol which is alien to an 8080A-based . system. Thus OPACK. which is shown creating RDYIN in Figure 11-4. may well be grounded in a.cibnfiguration that is not going to insert Wait states into 2650A instruction execution cycles. OPREO will be used as a ctintributor to the chip select logic of 8080A support devices. M/iO. which is shown discriminating between memory and I/O control signals in Figure .11~4. may alternatively be used as a contributor'to chip select logic. Figures 11-6 through 11-9 illustrate 8251 and 8255 devices connected to a 2650A CPU, being selected within memory or 1/0 spaces. Note that where devices are selected within the 2650A I/O space. C/O could be generated from the 2650A C/O control output rather than using address line ADRO. . , ' Figure 11-10 shows how 2650A prio'rity interrupts may be generated UShlg an 8214 Priority Interrupt Control Unit. " a " Interfacing MC6800 support devices to 2650A CPU is again "complicated by the synchronizing signal required by MC6800 support devices. But the 2650A is flexible enough to make, ~his.interface possible. "', We must use OPREO in order to generate the synchronizing enable signal for MC6800 support devices. Unfortunately. there is a significant variation In the leading edge of OPREO. Therefore. logic to create an ENABLE synchronizing sig- nal must have the following three parts: 1) Create a continuous clock signal to substitute for the MC6800 ENABLE synchronizing signal. 2) Make sure tha"t during a write cycle MC6800 device select logic is true across one pulse of the ENABLE signal. Chip select logic must be true from shortly before thebeginning ofthe ENABLE signal positive transition until shortly after the end of the negative transition. " 11-23 3) During a read cycle. again make sure that chip select logic for the MC6S00 support device is valid for one ENABLE cycle only; but this time stretch the ENABLE true pulse so that the 2650ACPU can latch the data on the negative transition of OPREQ before ENABLE goes low. Timing for the above three conditions is illustrated in Figure 11-11. But note that since the minimum cycle time for MC6S00 support devices is 1 microsecond. the 2659A CPU must also operate at this frequency - rather than using a O.S microsecond clock. which is the fastest allowed. . Figure 11-12 illustrates a' 2650A-6850 ACIA interface. Figure 11-13 illustrates a 2650A-6820 PIA interface. Important aspects of 2650A interface timing are defined in Figure 11-14. : l [>0 ~-------------~[>0 ~---------~~ ~ o0 OPACK------------~[>0 RESET------------ .. ... o----------__ ~ ~---------~ IIOR ~---------~ MEMW ~---------~ I/O'vV 8080A 3-chip CPU Signals WRP---------~~+_~L__J 2650A Signals BUs'EN '-------L_, Figure 11-4. 2650A-SOSOASighal Equivalents PAuSE -----------------------~-~.. ~ HALT [>0 ~-.-------------[>0 ADREN ------------------ OPREQ-----~--------------- [>0, Riw----------~ .. .. .. TSC lit DBE __~ VMA .. Ii- RESET-------------------~ R/Vi RESET ~-----------------------~ IRQ 2650A Signals Figure 11-5. 2650A-MC6S00 Signal Equivalents '11-24 MC6800 Signals ADRO w OPREO ADR13-E/NE a: M/iO Q ~ 0 ~------------------------------~~C/D &>----...... Cs' 11. a: 0 0 ~ iii w l- 8251 2650A Logic R/WR ~------~--------------------------...~RD e( g ~----...... WR WRP en CIl e( O!I 1'\..I,......____________________.....____oI'lOO-07 w a: Z 0 co en 0 :E e( Q e( SYSTEM @ CLOCK Figure 11-6. An 8251 US,A.RT Accessed by a 2650A as an I/O Device ADRO.------------------------~~C/D OPREO 1-----------...... M/Io~---------~ K>----__ooICS Address Decoding Logic 2650A 'R/WR 8251 ... Ro t - - - -. .~-----------__!J WRP~---------------_4 D----...... WR DBUSO- U'l.....- - - - - - - - - - - - - - - - - - - -....-~'_I 00-07 DBUS71~~------------------~-~~. SYSTEM CLOCK Figure 11-7. An 8251 USART Accessed by a 2650A as a Memory Device 11-25 AORO AO AORl Al OPREQ AOR13-E/NE CS M/iO 8255 2650A CPU PPI AD 'R/WR \iVA WRP OBUSO- 00-07 OBUS7 OPACK -=Figure i 1-8. An 8255 PPI Accessed by a 2650A as an I/O Device :I:~ ADROI I 0:: CS M/iO Address 8255 Decoding 2650A CPU PPI Logic AD R/WR WR. WRP OBUSO- 00-07 OBUS7 Figu re 11-9. An 8255 PPI Accessed by a 2650A as a Memory Device 11-26 DBUSO - ·· ---: · -·· ·· -: · Q w ~ oQ. a: a: o u ..... , DBUS7 .. -=.. ~ .. 1 ~ g -, ~ ~ enw ~ (Inverting fP. .-. 'OPAEO INTACK bus driver) G1 (I) (I) ~ 81LS95 ail w Z a: oto (I) o ~ Q ~ G2 ~ - :!: @ 2650A Jl... VCC ,- VCC 4.7K . j~ j 'V v .. 'v..v ..v ..v.." .... "vv .. > 4.7K .... ~ . INTREO ' "filw ole WRP OPACKrJ. -- SGS ....- INT L£>oE/Ne ~ A2 Al AD -- M/iO , ~ 'r+- CLK 8214 CLOCK PlCU D-- -.. - Bi SYSTEM - B1 ECS ElR AD.· •••••• ~ j ,I R7 J all' - 00 i1 ~ INTERRUPTING DEVICES Figure 11-10. Vectored Interrupt Using the 8214 PICU with a 2650A CPU 11-27 I ) I <1>1 - D r-- CK Q 2 MHz OPREQ D - 74LS74 Q (50% DUTY) 2650A CLOCK IS DRIVEN FROM <1>1 CK -.. Q - <1>2 74LS74 q;;- --Q I - - -__~ LOR ~------------------~--------------~J <1>2 R/W Q 74LS107 ~~'---------------~--------------~K CLR Q I - -__ J CK ~ EN 74LS107 D------t K L--------------------~R/W Figure 11-11. Synchronization Circuits in a 2650A-MC68XX Interface 11-28 VCC 4.7K c w iRa i'N'T'REQ 8 ~ a: o 00-07 0. a: o(.) AORO RS ~ iii w ~ g CI) CI) 2650A CPU M/iO "' a: CI) CS2 Logic INTACK oa:I 6850 ACIA AOR13-E/NE ~ w Z Address Decoding CS1 To Riw } Interface Circuitry OPREQ o ~ ct>1 From Interface ~ c - ~ @ From {LOA Circuitry Interface EN Circuitry R/W CSO ENABLE R/W (See Figure 11-11) Figure 11-12. An MC6850 ACIA Connected to a 2650A i"R'QA iNTREo 4.7K vcc iiffiB 8 DBUSO-7 00-07 RSO RS1 ADRO ADR1 Address Decoding 2650A CPU 6820 CS2 Logic ADR13-E/NE M/iO CS1 INTACK To Riw } Interface Circuitry OPREQ ct>1 From Interface Circuitry From {LOAEN R/W Interface - Circuitry (See Figure 11-11) • Figu re 11-13. An MC6820 PIA Connected to a 2650A 11-29 CSO ENABLE P,/W PIA 2MHz 4>1 4>2 PROCESSOR WRITE OPREQ \1 . _r...-_ . _ _ _ ,--- I LOR ~, EN PROCESSOR READ OPREQ I LOR EN 1) MC68XX latches data internaliy on negative transition. 2) Processor latches data on the negative t'ransition of OPREO; thereafter LOR and EN go to zero (but NOT before). ·OPREO can make a transition any time within this 600 nsec. region. Figure 11-14. Important T'iming Con~iderations When Interfacing a 2650A C;:PU with MC68XX Ser'ies Devices 11-30 DATA SHEETS This section contains specific electrical and timing data for the 2650A. c w ~ a: oD. a: o u ~ enw ~ g en en c( ~ w Z a: o CD en o ~ c( c c( @ 11-01 2650A, 2650A-1 PRELIMINARY SPECIFICATION ABSOLUTE MAXIMUM RATINGS 1 PARAMETER TA TSTG Po Operating temperature Storage temperature Package power dissipation 2 All input. output. and supply voltages with respect to GND3 RATING UNIT o to 70 °C °C W V -65 to +150 1.6 -.5 to +6 DC ELECTRICAL CHARACTERISTICS TA = O°C to 70°C. Vee = 5V ± 5%. LIMITS PARAMETER ilL ILOH ILOL V,H V,L VOH VOL Icc C'N . COUT Current Input load Output high leakage Output low leakage Voltage levels Input high Input low Output high Output low Power supply current Capacitance Input Output TEST CONDITIONS MIn Typ Max UNIT IJ.A Y,N = 0 to 5.25V ADREN. DBUSEN = 2.2V VOUT = 4V ADREN. DBUSEN = 2.2V VOUT = 0.45V 10 10 10 V IOH = -1001J.A IOL = 1.6ma Vee = 5.25V TA = O°C 2.2 -0.5 2.4 0.0 Y,N = OV VOUT = OV NOTES 1. Stresses above those listed under "Absolule Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or at any other condition above those indicated in the operation sections of this specification is not implied. 2. For operating at elevated temperatures the device must be derated based on +150'e maximum junction temperature and thermal resistance of 50° CIW junction to ambient 140 pin IW package!. 3. This product includes circuitry specifically designed for the protection of its internal devices from the damaging effects of excessive static charge. However. it is suggested that conventional precautions be taken to avoid applying any voltages larger than the rated maxima. ' 4. Parameters valid over operating temperature range unless otherwise specified. 5. All voltage measurements are referenced to ground. 8. Preliminary specification 7. Manufacturer reserves the right to make design and process changes and improvements. We reprint data sheets on pages 11-02 through 11-06 by permission of Signetics Corporation. 11-02 Vee 0.8 0.45 150 10 10 mA pf 2650A, 2650A-1 PRELIMINARY SPECIFICATION AC ELECTRICAL CHARACTERISTICS TA = O°C to +70°C, VCC = +5V ± 5%. LIMITS PARAMETER UNIT Min c w 2650A-l 2650A 180 220 TAH Address hold TAS TABO Address stable Address bus delay TOH Data out hold en w TOls Data in stable Tos Data stable 50 g TOIH TOBO Data in hold Data bus delay 50 < TCH Clock high phase w TCl Clock low phase Tcp Clock period .. ~ a: o Il. a: o (J ~ ~ en en oil z a: oen en o :iE < c < @ TpC(5) Processor cycle time TOR OPREQ pulse width7 TCOR Clock to OPREQ time Toso TOAD OPREQ signal delay OPACK delay time OPACK setup time TOAS TOAH OPACK hold time Tcss Control signal stable TCSA Control signal available 50 - ns - ns 180 ns 2TcH +TCl -200 ns - ns 150 ns 160 200 2650A-l 2650A 2650A-l 2650A 2650A-l 2650A 2650A-l 2650A 250 400 250 400 500 800 2650A-l 2650A 1500 2400 2 TCH + TCl 100 150 ·2650A-l 2650A 2650A-l 2650A 2650A-l· 2650A ns 2TcH+Tcl+ 100 - 200 300 230 0 - 50 - ns ns ns ns ns ns ns ns ns ns ns 50 100 100 .400 500 200 100 100 TCH - 100 - ns 200 300 TCH + 150 ns ns Twpo Write pulse delay Twpo Write pulse from OPREQ Twpw Write pulse width7 INTREQ set up time TCH - 75 TCH - 150 ns INTREQ hold time Control signal delay 0 - ns ns TIRS T~H Tcso - NOTES 1. 2. 3. 4. 5. 6. 7. Ma~ Input levels swing between 0.80 and 2.2 volts. Input signal transition times are 20ns. Timing reference level Is 1.5 volts. Output load is -100 p.A at 100pf and 1 TTL load. Processor cycle time consists of three clock periods. Output buller rise time is 1SOns maximum. These values assume that OPACK is returned in time to not cause the processor to idle. Otherwise, the specified maximum will increase by an internal number of clock cycles. 11-03 180 ns ns 2650A. 2650A-1 PRELIMINARY SPEciFICATION MEMORY READ SEQUENCE '1-·,_TC~_T;_P_TCL~ .----T.--L.....___....I. T, T. ' /. TO I-rcOR-f-----T!R------- OPREO . ADRO·ADR 14 T_C~;.;.S_.___,·:1_ _ _ _ _ _ i-_ _-+___--..,;._-I-_ _ _ _ _ _....;.,_-I-_ _ ._----MiiO . -------- ~--' ~w _ ...:..:... _.~ ____ -+_____-+-_____________...... _____ _ L -_ _ --'---- ---.------'~~--=-~'''"~ --..:.---___ 0_·_' _'~_. .. _ _,.' ---------- - - - DATA IN " TOAS TOAH I ~------------------------~------------~ 11-04 2650A, 2~60A-1 . PRELIMINARY SPECIFICATION. MEMORY WRITE SEQUENCE T. c ~ a: o D. -1 a: o o ~ en w CI) CI) ~ IllS TCOR 1----'._ T O R - - - I l OPRfO =.=,.-- - - - .- I TAS ~T~H-I - -Ir--+--+-------------+----~----;J _ _ _ _ _ _ _ L.-.........;_-+_ _ _"'"""':'"_ _ _ _ _ _-+-__ ~ g T. T, T. w ~TCSA- ~ oCD CI) o ~ TCSS _--~/W.-==- _I ~ c ~ @ T'CSS -_ _ - _- -I - - - - -.--,...---+---+-------------4-----...; -- - - - -~.~---~ I~~_--~ w Z a: ~-..:..----I WRP _ DBUSO·7 ' .= -~-TWPO \_TCSA- _TwPO ~ -I ==' =- TOS TCSS-jl== ~Twpw-l 1 ~I _. ."-. . I ~ --I 1;----- f- TDH -1 L_-:-+-____~---_:_---------....I =.==__ OPACK ~TOAD__rTOASl-.- I TO.,AH -----------------~~I ~--------~------------- II 11-05 2650A, 2650A- 1 PRELIMINARY SPECIFICATION INTERRUPT TIMING CLOCK OPREO _Tcss_1 R/W TCSS E/NE L-..-+-------t---..... - -jTCSA _ TCSS - --- I~ ___ - L-..-+__________..... ______ _ 'NTACK -'". i'""r- -----D------- DATA 'N - -- - - - t - -;TE=Y;:R-- -- -- TRI-STATE TIMING I-TABO -TIoOO-1 I ____ I'--____S_'G_N_AL_S_YA_L_'O_________+-___....JI ____ -.-""7"--,-.--,----------------1-------.- - - - - - - =_~s~ T~A~ __ _ ~TCSO-I CONTROL ~NALS _- TS -_ ~---S-'G-NA-L-S-YA-Ll-O---------T"L----.,I- 1"'1 -;;;;;A-;;- - - - l=,"."~~---- I-Toso-I -OP-RE-a -- - - - -- ---Ir---S-,G-N-A-LS-Y-AL-,O------------~-----,I-- - - - _ _ _ _ _ _ _ _ I..._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _- - ' • •_ _ _ _ _ _ _ _ , _ NOTE Toso ALWAYS> Tcso, TABO or TOBO OBUSENI!-_ _ _ _ _ _ _ _~------------~I I-ToBo-1 I-TOBOt ::S- -:;:s;:;--- - Ir----S-'G-N-AL-S-Y-AL-'O---------------il-- '-TR;:;;;TE- ---- 11-06 c w Chapter 12 oD- THE RCA COSMAC !ia: a: o o ~ ui w !i g CI) CI) -t a15 w Z a: o en CI) o ~ -t C -t @ We are going to describe the single-chip CPU referred to as the CDP1802. This is a one-chip implementation of the previous two~chip CPU, consisting of the CDP1801 and CDP18101. COS MAC is a "low end" microprocessor: it is well suited to simple. high-volume applications with limited programming needs. As compared to many other microprocessors described in this book. COSMAC is a poor choice for lowvolume. program intensive applications: this is because COS MAC is relatively difficult to program optimally. But where does the transition from a simple application to a complex application occur? For COSMAC. it is sudden ' an application either is or is not suited to COSMAC. with very little grey area. The principal advantage of COSMAC is that it requires very little power, since it is fabricated using CMOS technology. If your application is going to be battery powered for any length of time, CMOS logic is strongly favored. In addition. if speed is not essential in your application. then power consumption can be further reduced by using a lower clock frequency. The advent of one-chip microcomputers has clouded the previously clear-cut power supply advantage associated with CMOS technology. There are occasions when a multi-chip COS MAC (or IM6100) microcomputer system, even though it is all CMOS, will use approximately the same amount of power as a single-chip NMOS microcomputer; the single-chip microcomputer will be capable of doing the same job. Before immediately assuming that your application demands CMOS technology for power supply purposes, it is worth checking the power supply requirements of an equivalent NMOS one-chip microcomputer. Both the power and the inflexibility of COSMAC are based on a subtly clever use of CPU logic, coupled with a somewhat primitive interface between CPU and external memory. Providing you can accommodate all "program housekeeping" using CPU registers for your read/write memory, COSMAC is a superb microprocessor. "Program housekeeping" includes maintaining the program and data memory address required by subroutines, interrupts, and data accesses in general. A large class of microprocessor applications fit these restrictions and are well suited to COSMAC. Devices described in this chapter include the CDP1B02Centrai Processing Unit and the CDP1852 8-bit input/output port. There is also a CMOS Universal Asynchronous ReceiverlTransmitter (UART) - the CDP1854 device. This part is described in Volume 3. COSMAC is fabricated using CMOS technology. It operates with a single power supply and is very insensitive to noise. The power supply can vary between +3V and +12V. CMOS technology also results in COSMAC 'having a very low power consumption and a broad operating temperature range. It is one of the few products described in this book that operates within the full military specification temperature range of -55°C to +125°C. You should be cautious with your power supply when using COSMAC. CMOS is indeed immune to noise in the power supply: the power supply can swing wildly between +3V and +12V without affecting the 1 and 0 levels at individual gates. However. timing swings accompany power supply swings. This would not be a problem if all signals changed frequency together: however. as we will discuss later in this chapter. signals do not change in unison. Thus. it is quite possible that a COS MAC system which works perfectly well with a +5V power supply is inoperable with a +8V power supply, because signal transitions have shifted sufficiently for +5V logic to no longer apply. Using a +10V power supply. a 155 nanosecond clock results in instruction execution times of 2.5 or 3.75 microseconds. In reality. a 200 nanosecond (or slower) clock should be used. Even though faster clocks are allowed. users have experienced design problems when attempting to run COS MAC microcomputer systems with clocks that are faster than 200 nanoseconds. The principal manufacturer for the COS MAC is: RCA SOLID STATE DIVISION P.O. Box 3200 SomerVille. N.J. 08876 12-1 The second sources are: HUGHES AIRCRAFT INC. Industrial Electronics Group 500 Superior Avenue Newport Beach. CA 92663 SOLID STATE SCIENTIFIC INC. Montgomeryville Industrial Park Montgomeryville. PA 18936 THE COS MAC CPU Functions imple!llented on the COP1802 CPU are illustrated. in Figure 12-1. . Logic to handle an external interrupt request is provided by the COSMAC CPU; along with an elementary ability to handle interrupt priority arbitration. An unusual feature 'of COSMAC. as compared to other CPUs described in this book. is the fact that COSMAC provides an elementary DMA capability u~ing CPU logic. COSMAC PROGRAMMABLE REGISTERS t~e ~rograri1ma~leregisters of the COSMAC These 'are CPU: 16 Bits r ... A ..... - _..., •8 Bits 8 Bits ~~ ter~. 4-bit. Program count. er, pOin. 4-bit. Data Counter Pointer 8-bit buffer for P and X X T R(O).l R(O).O R(l).l R(1).O R(2).1 " R(2).O R(3).1 R(3).O R(4).1 R(4).O R(5).1 R(5).O R(6).1 R(6).O R(7).1. R(7).O R(8).1 R(8).O R(9).1 R(9).O R(A).l R(A).O R(B).1 R(B).O R(C).l R(C).O R(D).l R(D).O R(E).1 R(E).O R(F).1 R(F).O o '\ i Sixteen 16-bit Address registers or thirtytwo 8-bit Data registers. No permanently assigned Data Counters or Program Coun-· ters. I) . 8-bit Primary Accumulator The 0 register functions as a primary Accumulator. The sixteen 16-bit registers may serve as Program Counters, Data Counters, or scratchpad memory. As scratchpad me~o~. each 16-bit register consists of two 8-bit registers whose contents can be transferred to or from the primary Accurriulatqr (D register). The nomen~lature RN is used to define a 16-bit general purpose register. N may be any number in the range 0 - 15. When general purp. If additional registers are dedicated to serving as Data Counters. then the contents of these reciisters may also have to be saved on the external stack. Afterregister contents have been appropriately saved. the' CALL subroutine must select the required subroutine. T~ere are many ways in which you can identify the required subroutine: one technique would be to use an additional register as a pointer tp a data table within which all subroutine :addresses are 12-2'2 stored. For example. R7 might point to such a data table. Now the calling program must load into R7 the address of the location in the cjata table where the required subroutine address is'stored. Now the CALL subroutine will use R7 as a pointer to two bytes of data. which,must be loaded into R3 before the CALL subroutine terminates execution by selecting R3 as the next Prog~am Counter. cw When a subroutine completesexecution. it returns by selecting Register R5 as the Program Counter in order to call a RETURN subroutine. The RETURN subroutine must r~load R3. and any dedicated Data Counter registe~s' contents from the external stack. 'which is addressed by R6. Having done this. the RETURN subroutine selects R3 as tHe next Program Counter. ~hus affecting a return from subroutine. a: , It takes' 128 microseconds to execute a well-:....,~itten CALL' subroutine. It takes 1 i 2 microseconds to execute 'a well-written RETURN subroutine. These times assume a 2 MHz Clock. ~ a: oQ. o CJ ~ en w ~ g II) II) ~ ail w Z a: oCO II) o ~ ~ c ~ @ RCA:s COSMAC Programming Manual describes some additional techniques for handling nested subroutines. ':. , . , " . . , Programming interrupt service, routin~s is, quite simple - provi~ing you do not use cds MAC. subroutines within ,the, interrupt service routine. Remember. as soon as an interrupt is INTERRUPT acknowledged. R1 becomes the Program Counter and R2 becomes the b,ata Counter: the previous SERVICE, Program Counter and, Data Counter pointers are stored in the memory location which was adROUTINE. dressed by the Data Counter when the interrupt occurred. Now. providing there are no PROGRAMS subroutines in the interrupt service routine. you can simply execute a program which is addressed by R1. while using R2 to access data m'emory. If you do execute subroutines, you must consider,all althe problems associated with using subroutin,es in a main program, but you must add Ii new complication: R1 is now the, main Program Counter. You must either have special subroutines,that are called only by the interrupt service routine. or you must write some type of instruction sequence ,which switches to using the main Program Counter register,within the interrupt service routine befor~ you start calling subroutines. COS MAC I/O instructions are quite unusual. The most unusual (and useful) aspect of COSCOS MAC MAC I/O instructions Is the fact that th~y transfer data between memory and an I/O device. INPUT/ Most microprocessors transfer data between the ~PU and I/O devices. When you are inputting or OUTPUT outputting one byte of data at a time. it makes more sense for the data transfer to occur between PROGRAMS the CPU and the I/O device. since the single byte of data is likely to be generated inthe CPU. for an ., output operation. or is likely to be ope'rated on by the CPU after being input. When blocks of data are being, inputor output. it makes more sense for the data transfer to occur between memory and an I/O device. since the block of data must be held in a memory buffer. COSMAC input instructions transfer the d~Ha to the'CPU Accumulator and the memory location addressed'by the Data Counter. t~Lisgiving you the benefit of both possibilities. If your program is in read-only memory. you can avoid input data being writt~ninto memory by selecting the'same' register to act as Program Counter and DataCounter. Now the input data will be stored in the Accumulator (D register!. but the attempt to write the input byte into memory wili be th' warted. since the selected mem~ry location will be a read-only memory location. . COSMAC,output instructions increment the Data Counter after performing the output operation. This makes it easy to output a block of data from data ,memorY: ' ' . . . r , • " " . " I If you select the syXXPP. is ,derived by adding thecontents of the fIrst ,IOBUF table byte to the origin address, Thus. the first byte of IOBUF siores that length of table IOBUF which is currently filled. COSMAC program logic can now decrement the initiallOBUF address from XXPP and. upon testing the low-order byte equal to zero. logic knows that all data has been transferred. The destmation table stores the displacement to the first free table byte in the first byte of TABLE. Thus the address of the first free byte equals the origin plus the contents of the first TABLE byte. . Since the displacement to the first free byte of TABLE is stored in a single' da'ta byte. clearly TABLE cannot be more than 256 bytes long. Thus. IOBUF mustcontnin less than 256 bytes at any time. , ' If you look at the COSMAC program. it appears rather long. The instruction loop itself contains only six instructions. which compares well with many other benchmark programs. What is deceptive about the benchmark program is the' fact that we have taken a large number of instructions in order to ioad initial addresses into general purpose registers. Remember. COSMAC has sixteen such general purpose 'registers. and the' whole programming philosophy of this microcomputer is that you load addresses into general purpose registers once.at the beginning of the program. and never again. In fact. the benchmark program points up both the strength and the weakness of the COSMAC instruction set. Its strength is that large numbers of addresses can be permanently stored within CPU registers. thence memory access becomes a trivial task. Its weakness is that it takes a lot of instructions to get memory addresses into general purpose registers in the first place ~and that becomes a liability if you have to re~use the same general pUrpose register in a number of different ways within one program The following symbols are used in Table 12-1: ADR8 8-bit address ADR16 16-bitaddress D D reg!ster DATA8 8-bit data unit DEV 3-bit code: 1 through 7 DF Data Flag or Carry EFn Pin statUs: EF1. EF2. EF3. or EF4 IE interrupt Enable bit 12-24 cw n One of the numbers 1. 2. 3. 4 N 4-bit register select unit N210 Three output pins. N2. Nt NO P 4-bit Program Counter Pointer register Q Q status output flip-flop R{z) Specifies a register: if z is N the instruction operand specifies the register P the contents of the P register specify the register X the contents of the X register specify the register en w T ! X 4-bit Data Counter Pointer register g x Bits y through z of a register or memory location. For example. T <7.4> represents the high-order four bits of the T register. [] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If an I/O port number is enclosed within the brackets. then the I/O port contents are specified. If a memory address. is enclosed within the brackets. then the contents of . . the addressed memory location are specified. fI) [[]] Implied memory addressing: the contents of the memory location designated by the contents of a register. ~ ct ct A Logical AND C V Logical OR @ ¥ Logical Exclusive-OR ~ a: o 11. a: o u ~ ~ fI) fI) ct ~ w z a: o m o register Data is transferred in the direction of the arrow. Under the heading of STATUSES in Table 12-1. an X indicates statuses which are modified in the course of the instruction's execution. If there is no X. it means that the status maintains the value it had before the instruction was executed. 12-25 Table 12-1. COSMAC Instruction Set Summary STATUSES TYPE MNEMONIC. OPERAND(S) OPERATION PERFORMED BYTES, . OF INP OEV IE; [[ R(X)))-[D]- BUS 1 N210-[N<2.0>] Input data from Bus to Register D and memory. Output device number (DEV) at pins N2. Nl. NO. g OUT OEV BUS - 1 [[ R(x)11. I R(X)) -'- I R{X)) +1 N210-[N<2.0>] . [R{X))-[ R(X)) +: 1 Output memory to Bus; output device number (DEV) at pins N2. Nl. NO; increment Data Counter. LON N 1 [O]-[[R(N))) LDA N 1 Load 0 register via specified register. N may not be O. [D]-[[R(N))) w· Co) zW [R{N)) - [R(N)) +'1 II: W " Load·O register via specified register. Increment specified register. "[[.RIN}]] - [ D) u. W II: STR N 1 > LOX 1 Store 0 register via specified register. [ D F- [[ R(X))) LOXA. 1 Load 0 register using implied addressing; [O]-[[R{X))) II: 0 ~ W :::E >' [R(X))-[R(X)) + 1 II: ~. Load 0 register using implied addressing. Increment Data Counter. [[R{X)])-[O] :::E a: STXD II. 1 [R{X)]-[ R{X))-1 Store D register using implied addressing. Decrement Data Counter. OR 1 [D1-[[R(X))) V [D) XOR 1 OR with 0 register using implied addressing. [0]-[[ R(Xlll..... [D] AND 1 Exclusive-OR with D register using implied addressing. [O]-[[R(X))) A [D) II:~ ADD 1 X AND with 0 register using implied addressing. [O]-[[R(X)))+ [0] a!w 011. AOC 1 X Add to 0 register using implied addressing. [O]-[[R(X)))+ [0]+ [OF] :::E~ SO 1 X Add with Carry to 0 register using implied addressing. [O]-[(R(X)))-[O] . SOB 1 X Subtract 0 from memory using implied addressing. [0]"";'[[ R(X)))"'[ O]+[ OF] SM 1 X" Subtract with borrow from memory using implied addressing. [01-[ 0]- [[ R(X))) 5MB 1 X Subtract memory from 0 using implied addressing. [0]-[ 0]- [[ R(X)])_·[ OF] W Co) Z W II: W u. W w ... >11: :::EO w > >:::E II: w ~:::E Z 0 w Co) (/) ," SiJbtract memory with borrow from O"using implied addressing. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 12-1. COS MAC Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND!S) BYTES OPERATION PERFORMED OF IE w ~ < 0w LDI OATAB [O]-OATAB 2 Load immediate tD 0 register. ~ ~ ORI OATA8 2 [O]-OATABV [D) XRI OATAB 2 OR immediate with 0 register. [0]- OATAB¥ [D) ANI OATAB 2 Exclusive-OR immediate with 0 register. [O]-OATAB A [D) AOI OATAB 2 X [O]-OATA8+ [D) AOCI DATAB 2 X Add immediate tD 0 register. [O]-DATAB+ [0]+ [OF] SOl OATAB 2 X Add immediate with Carry to D register. [O]-OATA8-[D] SOBI OATAB 2 X Subtract 0 register from immediate data. [0]- OATAB- [0]- [OF] SMI DATAB 2 X Subtract D register with borrow from immediate data. [O]-[D]-OATAB 5MBI DATAB 2 X Subtract immediate from 0 register. [0]-[ D]-OATAB- [OF] AND immediate with 0 register. w w ~ < ~ 0 < w a: w Q. :i! 0 ~ Subtract immediate with borrow from 0 r.egister. BR ADRB 2 LBR AOR16 3 Q. ~ (/) , , Q Z SKP < :I: U LSKP z < a: III Q. ~ z Q i= z 0 < z· (/) :I: U Z 0 0 U Z < a: 0 III NBR AORB 2 NLBR ADR'6 3 BZ ADRB 2 BNZ AOR8 2 BDF AOR8 2 [R(P)<7,O>]- AORB Branch within same page to given address. [R(P))-ADRI6 Branch to given address [R(P))-[R(P)) +' Skip next byte, [R(P))-[ R(P)) + 2 Skip next two bytes. Same as SKIP Same esLSKP If [0]=0; then [R(P)<7,O>]-AORB Branch within same page on 0 register zero. If [D)#(); then [R(P)<7,O>]-AOR8 Branch within same page on 0 register nonz.ero. If [DF]='; then [R(P)<7,O>]-AOR8 Branch within same page on Carry set. Table 12-1. COSMAC Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES OF Z CJ z e C LIJ II. ::;) (/) ~ Z i2 z C z e < ~ If [OF]=O; then [R(P)<7,O>]-AORB AORB 2 BO AORB 2 BNO AORB 2 Bn AORB 2 BNn AORB 2 LBZ AOR16 3 LBNZ AOR16 3 Branch within same page on Carry reset. If 0=1; then [R(P)<7,O>]-AORB Branch within same page on output flip-flop set. If 0=0; then [R(P)<7,O>]-AORB Branch within same page on output flip-flop reset. If EFn=l; then [R(P)<7,O>]-AORB Branch within same page on specified external flag set. If EFn =0; then [R(P) < 7,0> ] - AORB Branch within same page on specified external flag reset. If [0]=0; then [R(P)]-AOR16 Branch absolute on 0 register zero. If [0] olO; then [R(P)]- AOR16 LBOF AOR16 3 Branch absolute on 0 register nonzero. If [OF]=l; then [R(P)]-AOR16 LBNF AOR16 3 Branch absolute on Carry set. If [OF]=O; then [R(P))-AOR16 LBO AOR16 3 Branch absolute on Carry reset. If [0]=1; then [R(P))-AOR16 LBNO AOR16 3 BNF e ~ C Z e IE Branch absolute on output flip-flop set. If [0]=0; then [R(P)]-AOR16 Branch absolute on output flip-flop reset. If [0]=0; then [R(P)]-[R(P)) + 2 l: CJ LSZ 1 < II: LSNZ 1 LSOF 1 Skip two bytes if 0 register zero. If [O]~O; then [R(P)]-[R(P)) + 2 Skip two bytes if 0 register nonzero. If [OF]=l; then [R(P))-[R(P)]+2 LSNF 1 Skip two bytes if Carry set. If [OF]=O; then [R(P)]-[R(P)]+2 LSO 1 LSNO 1 LSIE 1 Z !XI Skip two bytes if Carry reset. If [0]=1; then [RlP))-[RlP))+2 Skip two bytes if output flip-flop set. If [0]=0; then [RlP)]-[RlP)]+2 Skip two bytes if output flip-flop reset. If [IE]=l; then [RlP))-[ RIP)] + 2 Skip two bytes if interrupts are enabled. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 12-1. COSMAC Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OP'ERAND(S) BYTES OPERATION PERFORMED OF GlO N 1 GHI N 1 PlO N 1 PHI N 1 INC N 1 DEC N 1 [D]-[R(N)<7.0>] load D with low byte of.specifled register. [O]-[RlN)<15.8>] load D with high byte of specified register . [R(N)<7.0>]-[O] Store 0 to low byte of specified register. [R(N)<15.8>]-[O] Store 0 to high byte of specified register. 1&1 > Ii: 0 1&1 :E ... II: ... CIl 1&1 C; CIl 1&1 II: C; 1&1 IE II: [R(N))-[R(N))+ 1 Increment specified register. [ R(N)) - [ RlN))-l Decrement specified register. [R(X))-[R(X))+ 1 IRX Increment Data Counter. 7 SHR 1 X 0..-1 0 OF tft-&tktl~O Shift 0 register right one bit. Shift bit 0 into Carry; reset bit 7. ...ct 1&1 II: 1&1 SHRC 1 A. X 0 l, );;nml~DJ Shift 0 register right one bit through Carry. II: ... a 1&1 CIl OF 1&1 II: SHL 1 X 7 0 D~ 1f.Ji.J4";J.4" I~o Shift 0 register left one bit. Shift bit 7 into Carry; reset bit O. SHLC 1 X LD~'m4±4f IJ Shift 0 register left one bit through Carry. · Table 12-1. COSMAC Instruction Set Summary (Continued) STATUSES TYP! MNEMONI~ OPERAND(S) OPERATION PERFORMED BYTES OF SAV 1 MARK 1 RET 1 DIS 1 ~ u ~ I- I/) ~ I/) [X]-[[ R(X)) <7.4>] [P]~[[ R(X)) <3.0>] [R(X))-[ R(X)) + 1 [IE]-l Pop memory into X and P using implied addressing. Increment Data Counter. Enable interrupts. [X]-[[R(X)) <7.4>] [P]-[[R(X)) <3.0>] [R(X))-[R(X(] + 1 [IE]-O Pop memory into X and P using implied addressing. Increment Data Counter. Disable interrupts. 1 [P]-N SEX N 1 Sat P register to N. [X]-N SE~ 1 Sat X register to N. [0]-1 REO 1 Set output flip-flop. [0]-0 IDL 1 NOP 1 I~ Save T register in memory. [T<7,4>]-[X] [T<3.0>]-[p] [[ R(2)]]-[T] [R(2)]-[R(2))-1 [X]-[P] Save X and P i~ T; then push onto Stack via R8gister 2. Decrement Register 2. Move P to X. N ::;) l- [(R(X)]]-[T] SEP w o IE I/) Reset output flip-flop. Idle CPU. Wait for Interrupt/DMA-IN/DMA.OUT. No Operation The following symbols are used in Table 12-2: c w ~ a: o11. aaaa 4 bits selecting one of the 16 registers bbb pp 3-bit' data unit output to N2. N 1. NO lines 00 XX Second 8 bits of a 16-bit address 8-bitaddress 8-bit immediate data unit a: o(J Table 12-2. COSMAC Instruction Set Object Codes ~ enw ~ g ADC en en ADCI 01:1 ADD w Z ADI DATA8 ~ OATA8 AND o ANI OATA8 BDF AOR8 ~ ~ c ~ @ BYTES, CYCLES 74 1 2 7C 2 2 F4 1 2 FC 2 2 F2 1 2 FA 2 2 2 2 INSTRUCTION lBNF ADR16 ADR16 ADR8 3B ADR8 39 BNZ AOR8 3A AOR16 ADR16 3C 2 AOR8 3D lBR 2 2 2 2 ADR16 AOR8 3E AOR8 3F 3. 3 3 3 3 3 3 0100aaaa 1 2 F8 2 2 OOOOaaaa 1 2 FO 72 1 2 1 2 Cl CO 00 LBZ ADR16 C2 PP 2 00 2 LOA 2 ,lDI 2 N DATA8 XX 2 lON 2 N LOX PP BN4 3 CA pp PP BN3 3 pp 00 2 PP BNZ 3 C9 pp PP AORe 3 00 lBO PP. BNI 3 pp pp BNO CYCLES C3 00 lBNZ pp BNF BYTES 00 LBNO XX 33 OBJECT CODE pp XX III en OBJECT CODE XX a: o MACHINE MACHINE INSTRUCTION 2 2 lOXA 2 2 LSOF CF 1 3 LSIE CC 1 3 LSNF C7 1 3 LSNO C5 1 3 PP sa AORB 31 PP BR ADR8 30 2 2 pp Eiz AOR8 Bl ADR8. B2 AOR8 B3 AOR8 32 2 2 2 2 2 2 2. 2 PP 34 PP 35 pp B4 ADR8 37 C6 J 3 CD 1 3 LSKP C8 1 3 LSZ CF 79 1: 3 2 MARK PP 36 lSNZ LSO 2 2 PP 2 2 3 3 NOP C4 1 3 OR Fl 1 F9 2 2 2 0010aaaa 71 1 2 GHr 'N l00laaaa 1 2 ' OUT P 01100bbb 1 GlO N 'l000a88a . 1 2 PHI N 1011aaaa 1 00 1 N 1010aaaa 1 N 000laaaa 1 2 2 PlO INC REO 7B 1 INP P 01101bbb 1 2 RET 70 1 60 1 2 SAV 78 C3 3 SE~ 7A , '015 IOL IRX LBOF AOR16 2 38 C8 N OEC 1 NBR NlBR ORI DATA8 XX 3- 1 PP SEP N 1101aaaa 1 00 SEX N 1110aaaa 1 12-31 2 2 2 2 2 2 2 2 2 Table 12-2. COSMAC Instruction Set Object Codes (Continued) OBJECT CODE BYTES MACHINE CYCLES F7 1 1 2 2 MACHINE INSTRUCTION OBJECT CODE BYTES CYCLES F5 75 1 1 2 70 2 2 so SOB SOBI OATA8 INSTRUCTION SM 5MB 5MB! 2 77 7F XX DATA8 XX SOl FD OATA8 XX FE . SHL SHLC SHA 2 2 SMI STR STXD XOR XRI 1 1 1 2 2 2 SHAC 7E F6 76 1 SKP 38 1 2 2 N DATA8 2 FF XX .2 01018888 73 F3 FB XX 1 1 1 ·2 2 '" 2 2 2 '2 2 USING COS MAC WITH OTHER MICROPROCESSOR SUPPORT DEVICES Using the COS MAC microprocessor with other microprocessor support devices will rarely make economic sense. We are therefore not going to describe how other microprocessor system busses can be generated from the COS MAC System Bus. The principal advantage of COSMAC is its CMOS technology. The architecture. instruction set. and signal timing of COSMAC are not in themselves attractive enough to warrant selecting this CPU. as compared to many other popu lar 8-bit microprocessors described in 'this book. Thus. the principal reason for describing bus-to-bus conversion logic does not exist in this case. If you are going to use 8080A or 6800 support devices in your microcomputer application. you will almost certainly want to use the 8080A or 6800 CPU in preference to COSMAC. ' , in The one ~ther CMOS microprocessor described this book. the IM61 00. has support devices which are very dependent on the pecu lia rities of the IM61 00; therefore. they are not usefu I in a COS MAC microcomputer system. CS1 MODE 010 000 011 001 012 002 013 003 ClK VSS .... ... - -- ..... -~ -- '. -- 1 2 3 .4 5 6 7 8 9 10 11 12 COP1852 24 23 22 21 20 19 18 17 16 15 14 13 Voo - --.. -- .-·. - ---· ~ - --· -- SR/SR 017 007 016 006 015 005 014 004 CLEAR CS2 Pin Name Description Type 010 - 017 000- 007 MODE CS1. CS2 Data Input Data Output Input or Output mode select Device Select External logic data input strobe Service Request Master Reset Power, Ground Input or high impedance Output or high impedance Input Input Input Output Input ClK SR/SR CLEAR VOO, VSS Figure 12-10. CDP1852 I/O Port Pins and Signals 12-32 THE CDP1852 PARALLEL 1/0 PORT cw ~ oQ. a: a: o (J ~ enw ~ g en en c( oil w Z a: o en en o ~ c( c c( @ The CDP1852 parallel I/O port provides a COSMAC microcomputer system with bidirectional parallel I/O logic. Although we classify the device as bidirectional, it must be operated in input mode or output mode at any given time. Figure 12-1 illustrates that part of our general microcomputer functional logic which is implemented by the CDP1852 device. The CDP1852 is fabricated using CMOS technology; it is packaged as a 24-pin DIP. There are two versions of the CDP1852 I/O port, differentiated by their power supplies. The CDP1852D will operate with power supplies ranging between +3 and +12 volts. The CDP1852CD requires a power supply ranging between +4 and +6 volts. CDP1852 PINS AND SIGNALS CDP1852 I/O port pins and signals are illustrated in Figure 12-10. There are two Data Busses. Data is input to the CDP1852 device via DI0-DI7; data output occurs at DOOD07.lf the COP1852 device is operating in input mode. then 000-007 will be connected to the CPU Data Bus (BUSO-BUS7). If the COP1852 device is operating in output mode. then 010-017 will be connected to the CPU Data Bus (BUSO-BUS71. The mode of the CDP1852. devic,e is determined by the MODE input. If MODE is low. then the COP 1852 device is operating in input mode. In this mode. data will be transferred from external logic to the COP1852 device via the 010-017 signals; this data will be read by the CPU via the 000-007 signals, When MODE is high. the COP1852 device is operating in output mode. In output mode data will flow from the CPU to the COP1852 device via the 010-017 signals. while external logic will read this data via the 000-007 signals. External logic strobes data into the CDP1852 device via a high-to-Iow transition of the ClK signal in input mode. ClK high is a prerequisite for data input when the CDP1852 device is operated in output mode. CS1 and CS2 are select signals used by the CPU to access a CDP1852 device. CS 1 is high true in input mode and low true in output mode. CS2 is always high true. SR/SR is a handshaking control signal; in input mode SRis used by the CPU. while in output mode SR isused by external logic. CLEAR is a master reset input. When input low. it resets all data bits within the COP1852 to 0 and it outputs SR low. CDP1852 OPERATIONS OVERVIEW The CDP1852 I/O port can operate in input mode or output mode. Input mode is specified by a low MODE input and output is specified by a high MODE input. In input mode. external logic transmits data to the COP1852 I/O port via 010-017. External logic uses ClK to strobe data into the I/O port. Data is output via 000-007. which holds valid data whenever CS1 and CS2 are both high, In the general case, input mode timing may be illustrated as follows: DATA IN ClK SR CSl CS2 DATAOUT----------------------------------------------~ 12-33 SR is an acknowledge signal sent ba~k to external·logic. SR goes low as soon as external logic provides a highto-low ClK transition. SR returns high as soon as the COP 1852 I/O port ceases to be selected via CS 1 and CS2. Thus, external logic can look upon SR low as a "device busy" signal. and the low-to-high SR transition as an input acknltage Range Input Voltage Range "C"Types Non-"C" Types VOO UNITS (V) Min. - 4 12 4 6 V VSS VDD VSS VDD V Max. Max. Min. ELECTRICAL CHARACTERISTICS TEST CONDITIONS CHARACTERISTIC TYPiCAL VALUES AT TA =25°C Vo (V) VOO (V) COP18520 COP1852CO COP18530 - 5 10 15 50 100 500 100 50 100 500 100 - Any Output 0.4 0.5 5 10 1.6 3.6 1.6 1.6 3.6 1.6 Any Output 4.6 9.5 5 10 -1.6 -3.6 -1.6 -1.6 - -1.6 -3.6 - 5 10 200 100 200 - - 5 10 200 100 200 - - 5 10 - COP- UNITS 18~~0 Static Quiescent Device Current. I l Max. Output low (Sink) Current. IOl Min. Output High (Source) Current. IOH Min. Dynamic: - - - p.A rnA - t,. tf-10 nl. CL~100 pF Propagation Delay Time: Output from CS. teA Data to Output. too CE to Output. tEOH. tEOl N to Outputs. tNOH. tNOl - 5 10 12-05 - - - - 200 100 200 250 120 120 - - ns nis ns ns Q Chapter 13' w ~ oD.. a: a: o(J ~ en w ~ g II) II) « oil w Z a: o al II) o ~ « o « @ IM6100 MICROCOMPUTER DEVICES 'S The IM6100 an almost exact reproduction of the PDP-SE minicompu~er. The IM6100 has the same instruction set as the PDP-8E; however. there are differences in direct memory access logic. Also. the IM6100 cannot use the PDP-8E exten~ed arithmetic element or user flag options, . Rather than concentrating on differences between the IM6100 and the PDP-8E. we will in this chapter relate the IM6100 to other microprocessors described in this book, This reflects the fact that minicomputer concepts are simply not viable in the microcomputer world. The PDP-8E was developed at a time when Central Processing Units were very expensive and it was reasonable to demand that controllers surrounding the Central Processing Unit contain a lot of internal intelligence. This intelligence. in turn. demanded complex System Bus signals that identified the state of the CPU as it progressed through an instruction's execution, Microcomputers a're inexpensive. and their low cost is defeated if they have to be surrounded by expensive device controllers. Therefore. it will be more valuable in this chapter to show how the IM61 00 can be used in a microcomputer system with a simple bus and standard microcomputer support devices. rather than comparing it with the PDP-8E minicomputer. The PDP-S is a 12-bit minicomputer, therefore the IM6100 is a 12-bit microcomputer. The very existence of the IM6100 is testimony to one of the less well understood aspects of minicomputers versus microcomputers: people tend to place too much emphasis on "creeping featurism". The majority of applications that are going to use a microcomputer could be impleme.nted with almost any microcomputer described in this book. The economics of exact chip counts and product development expense is worth exploring. but in most cases detailed comparative evaluations of instruction sets and addressing modes are a waste of time and money; enhancement of one product as compared to another will r~rely have any significant ecof1omic impact. This is true of microcomputers today. and it was also true of minicomputers yesterday. The PDP-8 was the first popular minicomputer. Compared to nearly any other minicomputer on the market today. the PDP-8 is a very primitive device. Yet there are more PDP-8s in the world than any other minicomputer. Despit~ the large number of new. more powerful minicomputers that are available. the PDP~8 continues. from year to year. to rank among the leaders in minicomputer sales volume. It is this popularity of the PDP-~. for all its shortcomings as a minicomputer. that has given birth to the IM6100. Many design features of the IM6100 are dubious. when looked upon from the microcomputer user's point of view. It is safe to say that no microcomputer deSigner wo'uld have seen fit to develop a product even remotely like the IM6100. but for the predecessor PDP-8. The IM6100 exists to participate in the continuing sales volume of PDP-8. and' to take advantage of the huge library of PQP-8 software which is available - much of it at no cost. You must look at the IM6100 (and the microNOVA) from a totally different perspective. as compared to any other microcomputer described in'this book; do not look for justification of IM6ioo design features in terms of a microcomputer application's needs; rather. accept the IM61 00 for what it is - a very low-cost reproduction of something which already exists; a' product whose existence is justified by a large established product market and a prior base of existing software. ' . In addition to the IM61 00 CPU, we are going to describe the IM61 01 Parallel Interface Element anC;i the IM61 02 MEDIC multifunction s~pport device. The IM6402 UART is also available: it is described in Volume 3. AIIIM6100 microcorpputer devices !Jse a single power supply which may range between +4V and +11V. Using a 250 nanosecond c!ock inPl!t. instruction execution times range from 5 to 11 microseconds. AIIIM6100 microcomputer devices use CMOS technology. which means that they are highly imml,Jne to noise in the power supply and they'consume very little power. Recall that COS MAC is the only other microprocessor described in this book that offers CMOS technology~ The second source is: The principal manufacturer of the IM6100 is: INTERSIL. INC. 10900 North Tantau Avenue Cupertino. CA 95014 HARRIS SEMICONDUCTOR DIVISION , P.O. Box 883 Melbourne. FLA 32901 13-1 THE IM6100 CPU Functions implemented on the IM6100 CPU are illustrated in Figure 13-1. IM6101 Parallel Interface Element logic is also shown. . D Clock Logic ~ Arithmetic and Logic Unit IM6100CPU IM6101PIE Accumulator Registerlsl Data Counterlsl Stack Pointer Program Counter Interface Logic Interface Logic Programmable Timers IRead.Only Memory Fig~re I/O Ports Interface Logic 13-1. Logic of the IM6100 CPU and the IM6101 Parallel Interface Element Bus interface logic is shown as implemented by the IM61 01. This is because the bus control signals input to and output by the CPU do not conform with the standard PDP-8 bus. or with typical microcomputer busses. You are going to need additional logic either to create a PDP 7 8 bus equivalent. or to reduce IM61 00 control signals to manageable microcomputer bus proportions. The IM61 01 creates a microcomputer type of System Bus. Direct memory access control logic is shown as absent. The CPU has logic which will respond to a DMA request by floating the System Bus: however. the actual DMA transfer. including creation of memory addresses. is the responsibility of external logic. Observe that clock logic is provided on the CPU chip. 13-2 IM6100 PROGRAMMABLE REGISTERS The IM61 00 has just three programmable registers as we define them: an Accumulator, a Program Counter and the MQ register. All three registers are twelve bits wide. cw !;i a: o0.. a: o (.) ~ u) w !;i (j o (/) (/) c( all w Z a: o to (/) o ~ c( c c( @ The Accumulator is a typical primary Accumulator. With a single exception. it is the only source or destination within the CPU for data being operated on. . The MQ register is a simple buffer for the Accumulator. The only operation you can perform on the MO register contents is to OR them with the Accumulator contents; the result is returned to the Accumulator. You may also exchange the contents of the Accumulator and the MO register. The Program Counter, being 12 bits wide, limits .the IM6100 to an address space of 4096 memory words. The IM6102 allows this address space to be expanded to 32.768 memory wor~s. Intersilliterature describ!,!s additional registers, but these are not programmable registers as we define them. The IM61 00 has no Data Counter. There is a Memory Address register within the CPU. but you have no direct access to this register. It is a simple depository for addresses which are automatically computed by CPU logic during the execution of memory reference instructions. IM6100 MEMORY SPACE Memory addressing modes that we are about to describe apply to a single 4096-word memory bank. If you have more than one such memory bank. then each one must be considered as a separate and distinct entity. This is important. because the nature of the IM6100 demands that ifprogram memory is in ROM. then both ROM and RAM must be present in external memory. Thus. if you have more than one bank. each memory bank must include ROM and RAM. IM6100 MEMORY ADDRESSING MODES IM6100 memory reference instructions use absolute, paged, direct addressing and indirect addressing. AIIIM6100 instruction object codes occupy a single 12-bit word. There are no two-word or three-word object codes. All memory reference instructions have the following object code format: 11 10 9 8 7 6 5 4 3 2 1 Q4-Bit No. . I 1 I I 1 1 1 I 1 I I, I 'I ~ Memory reference instruction object code 1___•_ t _ Address 1 = Address current page o = Address Page 0 1 = Indirect address o = Direct address Instruction operation code A memory reference instruction that uses direct addressing has seven address bits; thus memory is divided into 128-word pages. The memory page bit gives you the option of directly addressing a memory word on Page 0, or within the instruction's page: pp{ . 8. } Page (Base 0Page) ,}page1 • I I I I Ixl I I I I I • }pageN Address' =PP II } PageN + l' This object code resides in Page N 13-3 This is standard. absolute paged direct addressing. ~s described in Volume 1. C~apter 6. A memory reference instruction with indirect addressing simply takes the 12·bit word accessed by the direct memory address and interprets this 12·bit word's contents as the effectiv'e memory address. This is standard indirect addressing. In the case of the IM61 00. a memory reference instruc~ion can access an indirect memory address either on the base page or on the instruction's current page. You· can use indirect addressing to create the equivalent of a two-word, nonpaged direct addressing Jump instruction. . ' . ' To do ~his. store the 12-bit absolute direct address directly following the jump Indirect instruction. This may be illustrated as follows: ' ~~~~~+ AOOR ~' ' J u m p ooouos 10 Ih;, momo"! worn which may be anYwhere within 4096-word memory You cannot use this technique with any memory reference instruction other than a JU!'T1P. That is because any other instruction would leave the Program Counter pointing to the indirect address as the next object code to be executed. For memory reference instructions other than a Jump. reserve a few memory words at the end of the current page to " store indi~ect addresses. This may be illustrated as follows:' Arbitrary 31A 318 Memory Address §to . TAD I 7D . Access memory location AOOR 1 31C 310 . 37C 370 37E 37F New Page . •- JMP 1+ 1 Jump indirect via next word. i.e .• to New Page 380 AOORl AOOR2 ADDR3 } Store addresses at end of page 380 381 382 The IM6100 also has auto-indexed indirect addressing. If you store an indirect address in anyone of the eight memory words with addresses 00816 through 00F16 then. when the IM61 00 CPU fetches this address. it will also increment and r~turn it. For example. you can store the beginning address of a table in mem'ory location 00816. You can subsequently read sequential table words by indirectly accessing the table. The IM61 00 benchmark program illustrates this use of auto-indexing: . It is ju~t as well that the IM61 00 has indirect addressing with auto-increment. because it has no Data Counter or implied memory addressing. Volume J. Chapter 6 discusses the' problems that result from using direct addressing to access sequential memory loc~tions when programs are stored in read-only memory. . Note that t~e IM6100 makes no distincti~n between program and data memory. Thus Jump instructions use exactiy. the same memory addressing options as memory read or write instructions. The concept of separate program and 13-4 data memory is a microcomputer phenomenon. because it was only with the advent of the microcomputer that programs started to be stored in read-only memory. Minicomputers use read/write memory for programs and data - and frequently a minicomputer will make no clear separation between the memory spaces that will be assigned to programs as against data. cw ~ a: o D. a: o CJ ~ enw ~ g fI) fI) The way in which the IM6100 handles subroutine calls represents an excellent illustration of the fact that minicomputer concepts can run into trouble in the world of microcomputers. When a JMS instruction is executed, the return addross is stored in the first word of the subroutine's object code. IM6100 SUBROUTINES IN READ-ONLY MEMORY The scheme certainly made sense to the PDP-8 designers: they visualized memory as a general read/write depository for programs and data. This scheme is nonviable when programs are stored in read-only memory. since you cannot write a return address in read-only memory. In order to use subroutines with an IM6100. you must origin all subroutines in read/write memory. then jump to a program sequence stored in read-only memory. This may be illustrated as follows: /BASE PAGE STARTS HERE c:( ail w Z a: oca fI) o SUBA o JMPI PPO ·+1 /FIRST WORD OF SUBROUTINE SUBA /JUMP INDIRECT TO SUBROUTINE IN ROM /PPO REPRESENTS THE STARTING ADDRESS IN ROM ~ c:( c c:( @ ·PPO /SUBROUTINE ORIGIN IN ROM JMP I SUBA /LAST INSTRUCTION OF SUBROUTINE IN ROM /MAIN PROGRAM WHICH CALLS SUBROUTINE SUBA JMS DCA . SUBA DATA /SUBROUTINE CALL /EVENTUAL SUBROUTINE RETURN Let us examine the path of instruction execution illustrated above. Begin by looking at the JMS SUBA instruction in the main program which calls subroutine SUBA. SUBA is a label representing a location in the base page of memory. When the JMS SUBA instruction is executed. the address of the next instruction. arbitrarily illustrated above as a DCA instruction. will be stored in the memory word with label SUBA. The first instruction executed following the Jump-to-Subroutine is the instruction stored in the memory location following SUBA: this is the JMP I .+1 instruction. This instruction jumps indirect via the address stored in the next memory location: we represent this memory location's contents with PPO. PPO is the address of the first instruction to be executed within the subroutine. This instruction. and all subsequent subroutine instructions are stored in read-only memory. The last instruction executed by the subroutine in read-only memory is the JMP I SUBA instruction. This instruction per- 13-5 forms an indirect jump via the address stored at SUBA. This is the address of the DCA DATA instruction. This execution sequence may be illustrated as follows: /BASE'PAGE STARTS HERE /FIRST WORD OF SUBROUTINE SUBA /JUMP INDIRECT TO SUBROUTINE IN ROM /PPO REPRESENTS THE STARTING ADDRESS IN ROM /SUBROUTINE ORIGIN IN ROM JI'iI1P'I-S BA /LAST INSTRUCTION OF SUBROUTINE IN ROM /MAIN PROGRAM WHICH CALLS SUBROUTINE SUBA -----1 r SUBA DATA /SUBROUTINE CALL /EVENTUAL SUBROUTINE RETURN Handling subroutine calls through RAM has some non-obvious repercussions. First of all. at least the first page of every 4096-word memory bank must be read/write memory; this is due to the way the IM6l00 handles interrupts. which we will discuss later. In all probability. there will be more than one page of , ' read/write memory. ' Next. if you are going to initiate subroutines in Page 0 RAM. then when you power up the system. you must load this RAM from ROM. This is because RAM will lose its contents when powered down. Thus. every restart or reset procedure must include the execution of an instruction sequence which moves a block of data from ROM to Page 0 RAM. Possibly the most serious problem associated with calling subroutines through Page 0 RAM is the fact that. apart from interrupt handling. existing PDP-8 software does not do that. Thus. if you are going to implement programs in readonly memory. the existing PDP-8 software base is not available to you - and that is one of the principal reasons for the .IM6100·s existence. Converting existing PDP-8 programs. so that subroutines are called·through Page 0 RAM. is not a simple task. If you look again atthe discussion of direct. paged addressing given in Volume 1. Chapter 6. you 'will see that there are very significant problems associated with memory, mapping. Programs 'cannot lie ,across page boundaries; therefore. the addition of a few instructions to anyone program can have serious consequences. In some cases it may be possible to generate special assemblers and compilers that convert existing source programs into object programs which partition memory into ROM for programs and RAM for data, allowing subroutinesto be called via the base page - but that a~sumes the ~ase page has free space available for this purpose. There is a hardware solution to the IM6100 Jump-to-Subroutine problem. This solution uses an external read/write memory Stack to store subroutine return addresses in the manner of a conventional stack. Necessary logic and minor programming ramifications are described later in this chapter. IM6100 STATUS FLAGS The IM6100 has a single Carry status; it is called the Link or L status in PDP-8 and IM6100 literature. IM6100 CPU PINS AND SIGNALS IM6100 CPU pins and signals are illustrated in Figure 13-2. Once again, the minicomputer ancestry of the IM6100 is evident from the complex control signals input and output by the CPU. Minicomputer designers favor a rich variety of control signals on a System Bus because that makes the job ,of designing peripheral device controllers easier. Microcomputers rely on low-cost support devices. and complex System Busses simply increase the complexity and cost of surrounding the CPU with support logic. After reading this summary of IM6100 pins and signals, compare it to the 80BOA described in Chapter 4; then compare it with the MCS6500 described in Chapter 10. The MCS6500 represents the ultimate in simplicity. 13-6 Q VCC RUN DMAGNT ~ ~ 0:: RUN/HLT cmm w ... --... -- .. ..- mET 0 D- o:: INTREQ XTA LXMAR WAIT XTB XTC OSC OUT OSCIN (DX11) DXO (DX10) DX1 (DX9) DX2 (DX8) DX3 (DX7) DX4 0 0 ~ u) w ... c( g (I) (I) c( oIJ w 2 0:: 0 m (I) 0 :E c( ... .. ... ..- - --- ....- --...- -..... .. ----- -..-.. - - 1 2 3 4 5 6 7 8 9 10 11 12. 13 14 15 16 17 -18 19 20 IM6100 CPU 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 ... ..-.... - -... ..- DATAF INTGNT CPSEL MEMSEL IFETCH SKP C2 cr ... -- . - CO --... LINK ... -... -- -.-. - .. -- - SWSEL DEVSEL DX11 (DXO) DX10(DX1) GND DX9 (DX2) DX8 (DX3) DX7 (DX4) DX6 (DX5) DX5 (DX6) Q c( @ Pin Name Description Type DXO - DX11 OSC OUT OSCIN XTA.XTB.XTC LXMAR DEVSEL IFETCH MEMSEL DATAF Data and Address Bus Crystal or extemal clock Crystal in or extemal clock ground Machine cycle timing External memory address strobe I/O device select strobe Instruction Fetch machine cycle identifier Memory select strobe Execution phase of indirect addressing instruction Link status Run/Halt control CPU running status Reset Wait state control CPU control during I/O operation DMA request DMA grant Interrupt request Interrupt grant Control panE!! interrupt request Con~rol panel memory select Switch register select Power and Ground Bidirectional Input Input Output Output Output Output Output Output Output Input Output Input Input Input Input Output Input Output Input Output Output LINK RUN/HLT RUN RESET WAIT CO. C1. C2. SKP DMAREQ DMAGNT iNTREQ INTGNT CPREQ CPSEL SWSEt VCC.GND· Figure 13-2. IM6100 CPU Signals and Pin Assignm-ents The IM6100 has a single 12-bit multiplexed Data and Address Bus, represented by pins DXO - DX11. Memory and I/O interface logic must use appropriate control signals in order to demultiplex data and addresses ·off this single bus. . Intersil literature numbe·rs the bits of registers and memory words from left to right; that is to say. with the 0 bit representing the high-order bit. In this book we consistently number bits of registers and words from right to left that is to say. with .the low-order bit represented by the. 0 bit Data/Address Bus lines are confusing when you compare the discussion in this chapter with Intersilliterature. In Figure 13-2! DXO - OX 11 signals are identified first wit~ .Iabels that conform tol~tersil literature; the bracketed labels that 13-7 follow show the signal name that agrees with bit numbering as used in this book. The two bit-numbering and signalnaming systems may be compared as follows: x o o en co .,..... x x x X o 000 co It) ' The yth bit of the quantity x. For example, A specifies the low bit of the Accumulator. a!I [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets, then the designated register's contents are specified. If a memory address is enclosed within the brackets, then the contents of the addressed memory location are specified. (I) A Logical AND ~ v (I) (I) w Z a: o en o ct Q ct @ a 12-bit register external to the CPU. Logical OR Data is transferred in the direction of the arrow. Under the heading of STATUS in Table 13-2, an X indicates that the Link is modified in the course of the instruction's execution. If there is no X, it means that the Link maintains the value it had before the instruction was executed. 13-39 Table 13-2. IM6100 Instruction Set Summary TYPE MNEMONIC OPERAND(S) g lOT DEV,CMND >w > a: a:(,J DCA *ADDR oct OZ ~ a: 12-BIT WORDS STATUS OPERATION PERFORMED C [DEV]-[CMND] Issue the command to the device. "" 1 [EA]-[A], [A]-O Deposit the Accumulator in memory; then clear Accumulator. ~~ WW a. ~:!; a: ...oct W [A]-[A] A [EA] AND *ADDR 1 TAD *ADDR 1 ISZ *ADDR 1 JMP *ADDR [PC]-EA JMS *ADDR Branch unconditional. [EA]-[PC]+ 1 a: W a. 0 > a:. 0 ~ X Add memory to Accumulator. [EA]-[EA] + 1 If [EA] = 0; skip Increment memory and skip if zero." W ~ a. ~ .., ;:) AND Accumulator with memory. [A]-[A]+ [EA] [PC]-EA+ 1 Jump to ·subroutine unconditional. lAC X 1 [A]-[AJ+l Increment Accumulator. RAL X 1 Rotate Accum"ulator ieft one bit through Link. ...oct W a: W a. lo_;~;:t*lliO ,J RTL 1 X 0 a: ... W III 5W L'~ o ,--,--. ~ II '-" '--'" I~t I11111111 I~ 0 I a: Rotate Accumulator left two bits through Link. RAR 1 X lD--i±+fit~i;£t,J Rotate accumulator right one bit through Link. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 13-2. IM6100 Instruction Set Summary (Continued) TYPE MNEMONIC RTR OPERAND(S) 12·81T WORDS STATUS OPERATION PERFORMED C x Rotate Accumulator right two bits through Link. w BSW ~ '" w 0 z a: C w Q. [A) ~ a: ~ w Z 0 (; g w ~ II) Swap the two halves of the Accumulator. a: CMA [A)-fA) CIA [A)-l'Ai+ 1 CLA Negate (twos complement) Accumulator contents. (same as CMA lAC) [A)-O Complement Accumulator contents. w 1. CLA lAC STA SZA SNA Skip on Accumulator zero. If [A);o!O; [pC]-[PC]+2 SZL ~ C z- 0 u z 0 Skip on Accumulator nonzero. If [A]=O or [LJ=l; [PC)-[PC]+2 SNA SZL Skip if either Accumulator zero or Link set. If [A);4) and [LJ=O; [PC)-[PC]+2- U '" a: cc [PC)-[PC)+2 Link set. [pC)-[PC)+2 Link reset. [pC)-[PC)+2 SZA SNL :I: Z Clear, th!ln increment Accumulator. [A)-FFF,. Set Accumulator bits to all ones. (same as CLA CMA) If [LJo'l; Skip on If [LJ=O; Skip on If [A)=O; SNL Z 0 Clear Accumulator. [A)-l SMA SPA Skip if Accumulator nonzero and Link reset. If A=1; [PC)-[PC)+2 Skip if Accumulator negative. IfA=O; [PC]-[PC)+2 Skip if Accumulator positive or zero. Table 13-2. IM6100 Instruction Set Summary (Continued) TYPE Z MNEMONIC 0 0 Z 0 X 0 Z ~ z ~ 0 ~ In IfA=lor [L1=l;then [PC]-[PC]+2 Skip if Accumulator negative or Link set. SPA SZL 1 SMA SZA 1 SPA SNA 1 If A< 11> = 0 and [L1=O; then [PC]-[PC] + 2 Skip if Accumulator positive and Link reset. If [A] ~O; then [PC]-[PC]+2 Skip if Accumulator zero or negative. If [A] >0; then [PC]-[PC]+2 Skip if Accumulator positive. If [A] ~O or [L1'1 Skip if Accumulator less than or equal to zero or if Link set. SMA SZA SNL 1 SPA SNA SZL 1 If [A] > 0 and L"O Skip if .Accumulator positive and Link reset. . SZA CLA 1 If [A]"O; [pC]-[PC]+2. [A]-O SNA CLA 1 SMA CLA 1 SPA CLA 1 Skip on Accumulator zero. Clear Accumulator. If [A]tO; [pC]-[PC]+2. [A]-O Skip on Accumulator nonzero. Clear Accumulator. If [A] <0; [PC]-[PC]+2. [A]-O Skip on Accumulator negative. Clear Accumulator. If [A] ;;':0; [PC]-[PC]+2. [A]-O Skip on Accumulator greater than or equal zero. Clear Accumulator. LAS 1 [A]-[SR] MOL 1 Load Accumulator from Switch register (same as CLA OSR). [MO]-[A] Z 0 ~ C W 0 0 < a: Z Z 0 X 0 ~ W Q. 0 OPERATION PERFORMED C 1 Z < a: STATUS 12·BIT WORDS SMA SNL 0 ~ C C z W OPERAND(S) c z Z < < a: In [A]-O Load MO register from Accumulator. Clear Accumulator. W SWP 1 ffi~ ~ffi CAM 1 ACL 1 > ,,~ WI/) a:- "a: W CLA SWP 1 [A]-[MO] Exchange Accumulator and MO (same as MOA MOll. [A]-O [MO]-O Clear Accumulator and MO (same as CLA MOL). [A]-[MO] Load MO into Accumulator (same as CLA MOAI. [Al;"'O~-' ... [A]-[MO] Clear Acc'!mulator; then swap Accumulator imd MO. © ADAM OSBORNE & ASSOCIATES, INCORPORATED Table 13-2. IM6100 Instruction Set Summary (Continue9) TYPE .... .c:wwa: MNEMONIC OPERANDISI ·12·BIT WORDS w OSR 1 SS~ 0 MQA 1 Cll RAl 1 .. ~ Cl)CI)a: STATUS OPERATION PERFORMED C [A]-[A] v [SA] OR Accumulator with Switch register. [A]-[A]V [MO] OR Accumulator with MO . a: a:. X . [L]-O [G.-it-;;"'.,.•.,.;;!J c Clear Link. then rotate Accumulator left one bit through Link. Cll RTl 1 X G-'" - . w ct a: w . au ~~~~c I~II I 1 I~'-""--' Clear Link. then rotate Accumulator left two bits through Link. D. 0 II: w CI) II I Cll RAR 1 X [L]-O w a: 0 11 l C; ~~I++-w.:::::==~ 0 Z ct ... in :::I Clear Link. then rotate Accumulator right one bit through Link. ct CI) Cll RTR 1 X [Ll-o ~ l ~ 11~~~~ II I U I I II ~~H] '--+~~ '-" 10 -......J ' - " Clear Link. then rotate Accumulator right two bits through Link. CLA Cll 1 GTl 1 [A]-O [L]-O Clear Accumulator and Link. [A]-O [A]-[L] Oear Accumulator. then rotate Link into low bit (same as C.~ RAll. Table 13-2. IM6100 Instruction Set Summary (Continued) TYPE :r u z ct MNEMONIC SKP OPERAND IS) 12-BIT WORDS. STATUS OPERATION PERFORMED C [PC]-[PC] +2 t Skip next instru"ctiol1- _ II: III Execution of any of the following instructions will reset'INTGNT. SKON t If [IE]=t; [PC]-[PC]+2 ION t If interrupts enabled; skip next instruction. [IE]-t 10F t Enable interrupts. [IE]-O ... Q. SRO t Disable interrupts . Skip next instruction if Interrupt Request bus is low. :l II: II: GTF t RTF. t SGT t CAF t ...w A - [Ll A <9 > . A<7> -[IE] Get flags. [Ll-A; [IE]-t Return Link and enable interrupts after the execution of the next sequential instruction. iNTRffi ~ X I/O device logic determines operation [Ll-O [A]-O X [IE]-O Clear all flags. CMl t X Cll t X STl t X HlT NOP t [Ll-fTI . Complement Link. [Ll-O Reset Link_ [Ll-t Set Link. (/) ... :l .... ct (/) Halt No Operation t I The following- symbols are used in Table 13-3: a b c w ~ a: oQ. ccccccc dddddd eee One bit which determines if indirect addressing is used. One- bit which determines if current or zero page is used. Seven-bit page address. Six-bit device code. Three-bit I/O command. Most instructions are described in this manner: mnemonic a: o (,J ~ iii w le( g (I) (I) e( a1J w Z xxx x yyy where xxxx is the octal object code associated with the mnemonic and yyy is the hexadecimal object code associated with the mnemonic. IM6100 literature uses octal notation. Some instructions have this form in the input clock cycles column: albic a b c is the number of cycles required using direct addressing. is the number of cycles required using indirect addressing. is the number of cycles required using auto-indexed addres.sing. a: o In (I) o ~ e( c e( @ 13-45 Table 13-3. IM6100 Instruction Set Object Codes INSTRUCTION ACl AND "ADDR BSW OBJECT CODE 7701 FCl OOOabccccccc 7002 12-BIT CLOCK CYCLES 1 20 20/30/32 30 1 34 CAM 1 20 CIA F91 7041 1 20 CLA E21 7200 1 20 E80 7300 1 20 1 20 1 20 FDl 7100 1 20 CLA Cll' CLA lAC CLA SWP Cll RTl 1 34 SKP 7410 1 20 SMA F08 7500 1 20 7700 FCO 7520 F50 1 20 1 20 F40 SMA ClA SMA SNl SMA SZA 7540 1 20 SZA F60 7560 1 20 1 20 E44 7110 1 30 Cll RTl E48 7106 1 30 Cll RTR E46 7112 1 30 1 20 1 20 SPA 1 1 22/32/34 34 SMA 1 1 CLA 7650 FA8 1 20 SNA SZl 7470 F38 1 20 7420 FlO 7510 F48 1 20 1 20 CLA 7710 FC8 1 20 SPA SNA 7550 F68 1 20 20 SPA SNA 7570 F78 1 20 20 SPA SZl 7530 1 20 F58 6003 C03 1 34 7240 EAO 7120 E50 1 20 1 20 7521 F51 7440 1 20 1 20 SNl SPA lAC F02 7001 1 20 SRQ IOF EOl 6002 1 34 STA ION CO2 6001 1 34 STl lOT ISZ COl 110ddddddeee 010abccccccc 1 1 20 20 SWP 1 1 20/30/32 SZA JMP JMS DEV,CMND "ADDR "ADDR MQA 101 abccccccc l00abccccccc 7604 F84 7501 MQl F41 7421 LAS F70 7450 F28 SNA HlT "ADDR SNl SNA C04 7204 E84 7402 GTl SZl 1 22/32/34 30 F20 SZA CLA 7640 FAO 1 20 1 20 SZA SNl 7460 F30 1 20 1 20 SZl 7430 F18 1 20 1 20 TAD 00 1abccccccc 1 20/30/32 Fll NOP 30 coo RAR GTF 1 6000 Cll El0 011 abccccccc 6004 30 SKON 30 "ADDR 1 34 1 DCA 34 1 E40 7104 CMl 1 6006 C06 RAl E4A 7040 E20 7020 6005 SGT Cll CMA INPUT CLOCK CYCLES EOA ECO 7201 E81 7721 12-BIT WORDS C05 7006 E06 7012 RTR E02 6007 C07 7621 CAF INSTRUCTION RTF 1 1 OBJECT CODE INPUT WORDS OSR 7000 EOO 7404 1 30 RAl F04 7004 1 30 RAR E04 7010 1 30 "ADDR I E08 13-46 SOME SPECIAL IM6100 HARDWARE CONSIDERATIONS o w The apparently complex System Bus of the IM6100 has some non-obvious advantages. The wealth C?f bus signals makes it very easy to generate System Busses compatible with other micr9processors and to circumvent certain limitations of the IM6100 instruction set. !;t IMPLEMENTING A HARDWARE STACK o11. Consider first the problem of the Jump-to-Subroutine instruction, which we described earlier in this chapter. Recall thai the IM61 00 Jump-to-Subroutine instruction cannot work when programs are stored in read-only merrl6ry; because the subroutine return address is stored in the first word of the subroutine - which will be a read-onlY. memory location. We can circumvent this pr9blem by creating a special read/write memory stack which is adaressed by an up. down counter. Appropriate logic is illustrated in Figure 13-28. a: a: o CJ ~ en w !;t g en en c( Gil w Z a: o CO en o :i! c( Q c( © Before examining the logic in this figure. let us look at what we are trying to accomplish. Remember. a Jump-to-Subroutine instruction contains a write machine cycle during which the Program Gounter cqntents are stored in the first memory location of the subroutine. Timing for execution of the Jump-to-Subroutine instruction with indirect addressing, along with the logic that accompanies the instruction's execution, is iilustrated in Figure 13-26. Timing for direct addressing or auto-increment addressing variations of the Jump-to-Subroutine instruction can be readily deduced from Figures 13-12 and 13-13. . . . . ' . ./ We are going to identify the Jump~to-Subroutine object code; then, for the rest of the Jump-to-SJbroutine instruction's execution, we will deflect memory write accesses to an external read/write memory stack. Timing and an appropriate event sequence are illustrated in Figure 13-27. Figure 13-28 illustrates the logic used to implement timing in Figure 13-27. Figure 13-28 also shows the logic used to return from subroutines; we will describe this later. In Figures 13-27 and i 3-28 we Lise a 7474 D-type flip-flop to generate a low true select signal (GSEll. This select signal is used to differentiate between stack and normal memory accesses; the trailing low-to-high transition of this select signal is also used to increment the up-down counter. which generates the stack address. Thus. any "write to stack" operation will be a "write and then increment address" operation. The write select signal GSEL is generated low true by decoding 100 on DatalAddress Bus lines 11. 10 and 9. while the Datal Address Bus is carrying an instruction object code. We can identify this condition by the combination of IFETCH high and XTC high. This combination geHerates the DIN input to the 7474 flip-flop. which is clocked by DCLK. the AND of MEMSEL and IFETCH. Since the low~to-high clock transition is active. it is very important that data be stable on the Datal Address Bus until well after MEMSEL has made its low-to-high transition. This may be illustrated as follows: XTC 13-47 INSTRUCTION FETCH T1 T2 FETCH SUBROUTINE ADDRESS T4 T3 T5 T1 T2 T3 T4 WRITE RETURN ADDRESS,. TO FIRST SUBROUTINE WORD T5 T1 T2 T3 T4 T5 T6 CLOCK rl XTA XTB~ XTC 'f ~ 00 --1 \ LXMAR~ MEMSEL \ I DXO_DX11~~i ~._"""'" IFETCH Output address of JMS instruction ~~------~----------------~~--------------------------~----~ Input JMS instruction object code .. Bits 11. 10 and 9 are 100 Output address where· subroutine starting address is stored Input subroutine starting address as data. Output as an address Figure 13-26. IM6100 Jump-to-Subroutine Instruction Timing with Indirect Addressing Write Program Counter contents; as data. to first word of the subroutine © ADAM OSBORNE & ASSOCIATES. INCORPORATED . FETCH SUBROUTINE ADDRESS INSTRUCTION FETCH WRITE RETURN ADDRESS TO FIRST SUBROUTINE WORD I I T1 T2 : TJ T4 T5 T1 T2 TJ : T4 T5 Tl T2 : TJ T4 T5 T6 CLOCK XTA XTB XTC LXMAR DXO - DXll IFETCH DCLK DIN QSEL Output, address of JMS instruction Input JMS instruction object code. Bits 11. 10 and 9 are 100 so DIN pulses low and QSEL is clocked low Output address where subroutine starting address is stored main memory. Output as an address Write Program .Counter' contents. as data. to current Stack location. Figure 13-27. IM6100 Jump-to-Subroutine Instruction Timing with Stack Access Logic Increment counter. Tl XTC Low-orde r DXO --.. DX9 _ . ';" "" !" , ... ,,- .~ , ~ Strobe 'If - ..- DSEL ADDRESS SELECT r Up count on ' end 'of Q select CLR Q D DIN QSEL C ~' =-':. ... I, ()O "--- DCLK .- 4 DX10 .: High-orderDXll _ IFETCH RESET LXMAR MEMSEL t :... • to Stack logic below DSEt down count on start of select ,_ true ... , ...-, Address ....... UP-DOWN COUNTER 7474 STACK RAM ~ Input Q QSEL XTC ~ :- ~L .Ii t.....r ..J, > (>0 I/OW READY ~ IRQ .. INTA ~__----------~-----------------::... :~~:N ·OMAGNT------------------------~----------~----~------------~~~HlOA RESET-------------------------~~ .. ~------------------------------~.... RESET Figure 13-29. IM6100 System B~s Con~erted to an aOaOACompatible System Bus· 13-52 cw !;( a:: o D. a:: o o ~ . Generating 8085-compatible signals from the IM6100 bus is not so straightforward. This is because the 8085 generates state signals SO and S 1. and an 10/Memory discriminator (lO/M) whose levels must be specified for the entire duration of read and write machine cycles that access memory or I/O devices. The IM61 00 generates RUN and IFETCH signals that extend for the duration of a machine cycle. but memory or I/O access control signals are not generated in this fashion. If you look at timing for the 8085 support devices - the 8155, the 8355 and the 8755 - it would appear that the IM6100 System Bus can generate adequate control inputs for these support devices. However, we have no experimental verification of this fact. We do not recommend using MC6800 or MCS6500 support devices with the IM6100 because of the peculiar synchronous nature of the MC6800 and MCS6500 microcomputer systems. It would be very hard to make IM61 00 machine cycle timing conform to MC6800 or MCS6500 machine cycle timing. Moreover. MC6800 and MCS6500 support devices are not attractive enough to make this logic exercise worthwhile. iii w !;( g CI) CI) ct cIS w z a:: o m CI) o ~ THE IM6101 PARALLEL INTERFACE ELEMENT (PIE) The IM61 00 CPU, being a copy of the PDP-8 minicomputer, has a number of features which are not well suited to the average microcomputer application; but that is no fault of the IM6100 chip designer - his product was specified for him. The IM61 01, on the other hand, is a well thought out part that goes a long way towards roctifying the problems that you are likely to encounter if you try to design logic around the IM6100 CPU. The IM6101 is best visualized as a control signal interface on the IM6100 System Bus, connecting an IM6100 CPU and its support devices. This concept may be illustrated as'follows: . ct C ... oCt ~ @ ... Data/ Address Bus ) ... -< > "< ~ A ... IM6l0l PIE ..) r > -< >' Memory devices and typical microprocessor I/O support devices IM6l00 CPU Complex control signals -< P' ... Simple control signals ... .... r Conceptually. what is important about the illustration above is the fact that the IM61 01 does not lie on the address or data path of the microcomputer system. Like a typical DMA controller. the IM61 01 generates and receives control signals. while memory and I/O devices communicate directly with the System, Data and Address Busses. Functionally, Figure 13~1 illustrates that part of our general microcomputer system logic which is implemented on the IM6101 Parallel Interface Element (PIE). The IM6101. like all members of the IM6100 family. is fabricated using CMOS technology: it requires a single power supply that may range between +4V and + 1OV and is packaged as a 40-pin DIP. 13-53' VCC INTGNT PRIN SENSE4 SENSE3 SENSE2 SENSE1 SEL3 SEL4 LXMAR SEL5 SEL6 XTC SEL7 (DX11) DXO (DX10) DX1 (DX9) DX2 (DX8) DX3 (DX7) DX4 (DX6) DX5 1 2 3 4 5 6 7 40 8 9 10 11 12 13 14 15 16 17 18 19 20 33 32 31 30 29 28 27 26 25 24 23 22 21 39 38 37 36 35 34 IM6101 PIE POUT SKP/INTREO WRITE2 ~ WRITE1 READ1 C2 CT FLAG 1 FLAG2 FLAG3 FLAG4 DEVSEL GND DX11 (DXO) DX10(DX1) DX9 (DX2) DX8 (DX3) DX7 (DX4) DX6 (DX5) Pin Name Description Type DXO - DX11 LXMAR. 5EVSE[ XTC SKP/INTREO INTGNT C2 READ 1. READ2 WRITE1. WRITE2 SEL3 - SEL7 FLAG 1 - FLAG4 SENSE 1 - SENSE4 PRIN POUT VCC. GND Data and Address Bus Control signals from CPU CPU control/interrupt request Interrupt acknowledge CPU control signals Read pulse lines Write pulse lines Individual IM6101 select Control flags Status lines Priority in Priority out Power and Ground Bidirectional Input Output. open drain Input Output. open drain Output Output Input Output Input Input Output CT. Figure 13-30. IM6101 Parallel Interface Element Signals and Pin Assignments 13-54 Flag Outputs ~ .C) N C) M C) ~ C) ~ ~ ~ ~ Q w !ia: o0. t---_.WRITE1 t---_.WRtTE2 1----.,....·REAQl 1------11-. READ2 I/O INTERFACE a: o o ~ } Read control pulses 1-------4 en w 14~---SEL3 ....~---SEL4 ....~---SEL5 .....~---SEL6 ....t----SEL7 !i g IM6100 INTERFACE LOGIC CI) CI) ~ } Write control pulses IM6100 BUS aIS w Z a: ocg ....t----PRIN INTERRUPT LOGIC CI) o ~ 1 - - - - _.. POUT ~ Q ~ @ w CI) zw ~ CI) zw &J CI) zw ~ CI) zw ~ Sense/Interrupt Request Inputs Figure 13-31. Logic of thelM6101 PIE IM6101 PARALLEL INTERFACE ELEMENT PINS AND SIGNALS Figure 13-30 illustrates the pins and signals of the IM6101 Parallel Interface Element. Figure 13-31 illustrates the important logic components of the IM6101. We will begin by summarizing IM6101 signals. The IM6101 communicates directly with the IM6100 CPU via the Data/Address Bus (DXO - DX11) together with the three control signals LXMAR. DEVSEL and XTC. As per our discussion of the IM61 00 Data/Address Bus. remember that we number bus lines. register bits and word bits in an opposite sense to Intersil literature. Thus. in Figure 13-30. Data/Address Bus lirie signals are shown as they appear in Intersilliterature. with our equivalents. in brackets. adjacent to them. Interrupt requests are transmitted to the CPU via INTREO (which shares a pin with response the CPU interrupt acknowledge signal INTGNT. SKPl. The IM6101 receives in The CPU communicates with the IM6101 PIE via lOT instructions. The IM6101 therefore returns CT. C2 and SKP as I/O controls. Recall that IM61 00 I/O logic demands that the selected I/O device return I/O control signals which specify the I/O operations to occur. The IM61 01 does not return CO; this signal must be generated externally. SKP shares a pin with INTREQ. The fact that INTREO and SKP outputs share a pin presents no problem since the two signals are active at different ' times in any machine cycle. You could. if you wish. separate the two signals via the following logic: ""Kiii7iiiDEjiV'RSFi'E1L'~~~~~~~~~~~~~~Eb:=' S~P/INTREQ . - I-_ _ _ _ _ _ INTREQ SKP 13-55 There is. in fact. no need for SKP/INTREQ to be separated as illustrated above. The CPU distinguishes the two signals on the single line via instruction timing. External devices capable of transmitting data to or .from the IM6100 CPU use the IM6101 READ1, READ2, WRITE1 and WRITE2 control outputs as read/write strobes and device select signals. That is to say. each of these signals will connect to a single device. A READ signal pulse will cause data to transfer from the connected device to the IM61 00 CPU. A WRITE pulse will cause data to flow from the CPU to the connected device. This may be illustrated as follows: Data/ Address Bus JI .. . :~ . -< }- '< ~ .. READ .. IM6100 CPU ... .) ..... I···.,'······· Control Signals A -"- . IM6101 PIE .,.) I/O Device .WRITE .. t, tt' The IM61 01 has five select inputs, SEL3 - SEL7.lnter~allogic compares the levels at these five IM6101 signals with five I/O instruction object code bit levels (described in detail later) in order to deterSELECT LOGIC' mine whether the IM61 01 is or is not selected when an I/O instruction is being executed. In other words. the five signals SEL3 - SELl allow you to specifya unique device codefor the IM6101 by tying signals selectively to power or ground. A device code of 0 is not allowed. since special internal CPU I/O instructions use this device code. The five select lines SEL3 -.SELl therefore allow 31 uniquedevice codes to be specified for. IM6101 devices. . . .' The IM61 01 PIE provides eight any-purpose control signals. FLAG 1 - FLAG4 constitute fou r flag outputs which may be set or reset under program control. SENSE1 - SENSE4 represent four status inputs which may optionally be used as interrupt request lines. .. When more than one IM6101 PIE is present in a microcompute~ s;stem. the PRIN and POUT signals chained priority interrupt logic to be generate~. For a discussion of daisy-chain logic. see Volume 1: allo~ daisy. Figure 13-36 illustrates a large IM6100 microcomputer system that includes more than one IM6101 PIE. IM6101 FUNCTIONAL LOGIC You access an IM6101 Parallel Interface Element using I/O instructions; this is how the IM6101 will interpret an I/O instruction code as it appears on the Data/Address Bus: I/O instructiOn} '.' r - - - - - - - - - - - - - D e v i c e Select Standard PDP-8 Interpretation . . r-----Control Code . --....~i,--....'''~ _ -L. 11 11 10 11 9 8 7 6 5 4 3 2 I I I I I I I I I I 0 IM6101 PROGRAMMING o 4--BitNo. I~I/O Instruction '-'~~~L.-' t· ~ .. S~"t ...--------------------1/0 -Control Code Devloe Instruction } 'M6,O, ""","'''''0' Note that the IM6101 and the PDP-8 differ in their interpretation of the I/O instruction code. IM6101 logic identifies an I/O instruction object code by examining Data/Address Bus bits 9,'10 and 11 during an IOTA machine cycle. Timing is illustrated in Figure 13-16. c( Now. if you look at Figure 13-16 and then examine the signals input to the IM61 01. there appears to be a possibility for confusion. The only control inputs received by, the IM61 01 are LXMAR."'E5't"VSEI and XTC. What is to stop the IM61 01 from being confused by an address output during the instruction fetch machine cycle? LXMAR will be high at this time. An address can certainly look like an I/O instruction object code: in fact. any address in the range C 1016 through DFF16 will look like an I/O instruction object code. Since the IM61 01 does not receive the IFETCH signal as an input. it cannot identify an instruction fetch machine cycle. There is no problem. however. because the PIE detects the subsequent DEVSEL low pulse - ~r lack of low pulse. Indeed. an address in the range mentioned above. output during an instruction fet'ch machine cycle. may match an IM61 01 selection code: however. without the subsequent 10w15EVSTI. pulse. the IM6101 will not respond to this selection. Since DEVSEL is pulsed low during IOTA. but not during'an instruction fetch machine cycle. possible problems of ambiguity are resolved. ' CI) CI) In order to determine whether or not it is selected. IM6101 logic compares I/O instruction object code bits 8 through 4 with select inputs SEL3 through SEL7. as described earlier. ' c w ~ a: oa.. a: o u ~ en w ... u o c( ail w 2 Here is how the bits are compared: a: o CD 11 o CI) o 10 2 9 3 8 4 6 6 5 4 8 3 9 2 10 1 11 . - OX line (lntersil numbe~ing) 0 " ' - OX line (our numbering) "'1-1.,..1-1....I-O..,I-......-.....-..,........,......,I....c-..,..I-C.,..I-C....I-C....I~ I/O Instruction ~ c( 3 C c( T @ 4 5 6 7 ~'-.SEL inputs +L.._ _ _ _ _ Control Code I/O Instruction The low-order four bits of the 1/0 instruction object code are used by IM6101 logic to generate 16 s'pecific I/O instructions, which are defined in Table 13-4. This table shows the standard instruction mnemonics recognized by the Intersil assembler. together with the low-order four object code bits' settings. . Table 13-4. IM6101 Interpretation of I/O Instruction Control Bits 3-0 Instruction Mnemonic Control Bit 3 2 1 0 READ1 READ2 WRITE1 WRITE2 SKIP1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 SKIP2 0 0 1 SKIP3 1 0 1 0 SKIP4 1 0 1 1 RCRA 0 1 0 0 WCRA WCRB WVR SFLAG1 SFLAG3 CFLAG1 CFLAG3 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 Interpretation Generate a low pulse output on READ1. Generate a low pulse output on READ2. Generate an' active pulse output on WRITE1. Generate an active pulse output-on WRITE2. Test the SENSE1 status. If it is active. output a low pulse via SKP/INTREO. to , be interpreted by the IM6100 CPU as an SKP pulse. Test the SENSE2 status. If it is active. output a low pulse via SKP/INTREO. to be interpreted by the IM6100 CPU as an SRP'pulse. ' Test the SENSE3 status. If it is active. output a low pulse via SKP/INTREO. to be interpreted by the IM6100 CPU as an SKP pulse. Test the SENSE4 status. If it is active. output a low pulse via SKP/INTREO. to be interpreted by the IM6100 CPU as an SKP pu Ise. Place the contents of· Control Register A on the Data Bus as data. The IM6100 CPU will OR Control Register A contents with the Accumulator contents. Write the contents of the Accumulator to Control Register A. Write the contents of the Accumulator to Control Register B. Write the contents of the Accumulator to the Interrupt Vector register. Set Output Signal ~LAG1 high and set Control Register A bit 8 to one. Set Output Signal FLAG3 high and set Control Register A bit 10 to one. Reset Output Signal FLAG1 low and reset Control Register A bit 8 to zero. Reset OutpUt Signal FLAG3 low and reset bit 10 of Control Register A to zero. 13:-57 Let us look at the operations which may be performed when the instructions identified in Table 13-4 are executed. IM6101 I/O INSTRUCTIONS The two read instructions, READ1 and READ2, cause data to be transferred from an exIM6101 READ ternal device to the CPU. Timing is illustrated in Figure 13-32. The IM6101 outputs a low INSTRUCTION READ1 or READ2 pulse. which acts as both a select signal and a strobe signal for the external devicewhich'is to transmit data to the IM6100 CPU. The IM6101 transmitsC1low andU high to the CPU in order to identify the 110 instruction as a Read. The actual data transfer occurs directly between the selected device an'd the IM61 00 CPU via the Data/Address Bus, .. . The two write instructions, WRITE1 and WRITE2, cause the IM6101 to send back TI and IT high at data. input time in order to signal a write operation to the IM61 00 CPU. Subsequently the IM6101 outputs'a WRITE pulse via WRITE1 or WRITE2. Under program control you may select a high write pulse or a low write pulse. An external device will use the write pulse both as a select and as a signal identifying stable data on the Data/Address Bus. which is to be read by the selected illustrated, in Figure 13-33. IM6101 WRITE OPERATION device. Timing is Remaining IM6101 I/O instructions affect control signals and interrupt logic. The IM61 01 has eight control signals: four Flag outputs and four Sense inputs. The Flag outputs. FLAG 1 through FLAG4. are simple control outputs. Under program control. the levels of these four outputs can be set or reset. but the manner in which external logic uses these four signals is undefined. IM6101 FLAG OUTPUTS The four Sense inputs. SENSE1 through SENSE4. a,re shar'ed by interrupt logic and control logic. These signals can be used by external devices to transmit control information to an IM6101. and/or they can be used to generate interrupt requests. When used to 'generate interrupt requests. the four Sense inputs constitute four independent interrupt request lines which can be individually enabled and disabled. Under program control. you can specify that an interrupt request sense line is. high. low. makes a high-to-Iow transition. or makes alow-to-high transition. IM6101 SENSE INPUTS The various programmable options of the IM6101 are specified by writing control codes to two control registers. . r-----..... IM6101 Control Register A can be written into (by WCRA)or its contents can be read (by RCRA). Control Register A contents are interpreted as follows: 11 10 9 8 6 5 4 o 3 will occur when a . CONTROL REGISTERS "--SitNo. r-"-T"-,...""'T"-,...""'T"-,........,-x. .,-.,......,,-.,.. . . . f.--,. . Control Register A 1.1 . ~--~~~~~~-~~-~l~-l~-l~-l~ 1. - L .. 1 = enable. 0 = disab.Ie SENSE1 Interrupts 1 = enable. 0 = disable SENSE2 interrupts 1 = enable. 0 = disable SENSE3 interrupts 1 = enable. 0 = disable SENSE4 interrupts '--_ _ _ _ _ _ _ _ _ _ j 1 = output high pulses via WRITE1 10 = output low pulses via WRITE1 '--_ _ _ _ _ _ _ _ _ _ _ _ _ { 1 = output high pulses via WRITE2 o = output low pulses via WRITE2 "----------------~FLAG1 output level ' - - - - - - - - - - - - - - - - - F L A G 2 output level - - - - - - - - - - - - - - - - - - - F L A G 3 O\ltput level ' - - - - - - - - - - - - - - - - - - - - - F L A G 4 output level 13-58 © ADAM OSBORNE & ASSOCIATES,INCORPORATED IFETCH IOTA IOTB I I Tl T2 T3 T41 T5 T1 T2 T3 T4 T5 T6 Tl T2 T3 T4 T5 T6 CLOCK XTC .:LXMAR DXO-DXll~.--~~~----~--------------~~~~~------~--~--------------------------------------------------~ REABT or READ2 FLAGlorFLAG3 ______________________________________~~~~------------~----~~--------------------______________________~ 'ITer ----------------------~~------~~~~~--~--------~----------------------------~ SFLAG and CFLAG instructions change FLAG 1 or'fLAG3level here ,IM6l0l is selected by appropriate 1/0'instruction object code IO instruction object code low-order four bits identify a READ instruction. READl or REA52 is ' pulsed low. CT is input .. low and C2 high to the U The device on the receiving ,e,nd of the low READ pulse must place data on the Datal Address Bus CPU Figure 13-32. An IM6101 I/O Read Instruction's Timing IFETCH 10TB IOTA I Tl T2 T3 T4 T5 T1 T2 T3 T4 T5 T6 Tl I T2 ;1 T3 T4 CLOCK XTC LXMAR n"""--______ Cf en o DXO - DXll WRITEl or WRITE2 FLAGl or FLAG3 /' 1/0 instruction object IM610 1 is selected by appropriate I/0instruction object code code low-order four bits identify a WRITE instruc( tion. WRITEl or WRITE2 -is pulsed (high or low). CT and C2 are both input high to the CPU. Figure 13-33. An IM6101 1/0 Write Instruction's Timing The device on the receiving end of, the WRITE pulse must read data off the Datal Address Bus. T5 T6 The levels of the four Flag outputs. FLAG 1 - FLAG4. are determined by the contents of the four high-order Control Register A bits. In addition. specific control instructions shown in Table 13-4 allow FLAG 1 and FLAG3 to be set or reset (by SFLAG 1. SFLAG2. CFLAG 1. CFLAG2). You can therefore modify FLAG 1 and FLAG3 in two ways - by executing specific I/O instructions. or by loading appropriate information into th.e flag bits of Control Register A. c w !;( IX: oIl.. IX: o CJ ~ enw l- e{ Bits 5 and 7 of Control Register A determine whether the Write ou·tput signals WRITE1 and WRITE2 will pulse high or low when a write lOT instruction is executed. Note that you cannot program read pulse levels: a read lOT instruction pulses one of the read lines low. . ' You use bits 0 through ~ of Control Register A to determine whether the status inputs SENSE1 - SENSE4 are to function as ,interrupt requests or as statuses which will trigger IM61 00 CPU skip control logic. You can define the function of each signal in any way and trus create any combination of interrupt requests and skip controls. Control Register B determines what will constitute an "active" state for each of the four individual sense inputs. Each sense input has two control bits in Control Register B. one of which determines whether signal level or transition will constitute the active state,: the other control bit determines polarity. Here is Control Register B format: U o(I) (I) .7 e{ o!I w Z IX: o a:I (I) o ~ e{ c e{ 6 5 4 3 2 o I I I I I I I I I X I X I X IX • • ~ .. ~ ~ j t ....-BitNo. cantral Register B s ~~~~~ } S SENSE3 5 ENSE4 1 = A high level. or a low-to-high transition is active 0 = A low iavel. or a high-to-Iow transition is active @ .... :~~:~ } .S SENSE3 SENSE4 1 = Sense a high or a low level 0 = Sense a high-to-Iow. or a low-to-high transition By appropriately setting the two bits of Control Register B which are assigned to any sense input. you can cause a high level. a low level. a high-to-Iow transition or a low-to-high trpnsition to be the active sense signal state. ' Note carefully that Control Register B determines only what will constitute an active sense condition. Control Register B does not hold sense input information. You write to Control Registers A and B by executing the WCRA and WCRB instructions, respectively. Timing is as illustrated in Figure 13-15 for a standard device output operation. You can read the contents of Control Register A by executing the RCRA instruction, but you cannot read the contents of Control Register B. When the RCRA instruction is exe~cuted. timing conforms to Figure 13-14. Recall that instructions which transfer data between the IM6100 CPU and the IM61 01 PIE treat the IM61 01 PIE as a standard I/O 'device - selected by a 5-bit device code. READ1. READ2. WRITE1 and WRITE2 instructions. in contrast. select an IM6101 via a 5-bit device code. but subsequently cause a da'ta tr'1nsfer to occur between the IM61 00 and the I/O device' which is connected to the selected IM6101 READ 'or WRITE control signal. There are four instructions which directly control the level of FLAG1 and FLAG3 flag outIM6101 FLAG puts. These four instructions areSFLAG1, SFLAG3,CFLAG1 and CFLAG3. When anyone INSTRUCTIONS of these four instructions is executed. the flag output-changes state during 12 of IOTA. as illustrated in Figure 13-32, In addition to changing the level of the flag output. these instructions modify the associated Control Register A bit. When you write to Control Register A (via a WCRA instruction) you can modify all four flag output levels, since the four flag outputs reflect associated bit levels in Cont'rol Register A. However. any changes in flag levels will occur . during T6 of IOTA. as illustrated in Figure 1 3 - 3 3 . ' You cannot sample the level of the Sense inputs. since there is no register which stores Sense IM6101 SKIP input levels in the form of binary data. You must execute a SKIP instruction in order to test INSTRUCTIONS a Sense input's level. A SKIP instruction tests for an "active" Sense signi31 condition. This "active" condition is defined within Control Register B. As explained for Control Register B. the "active"Sense signal condition may be a high level. a low level. a high-to~low transition. or a low-to-high transition. 13-61 A particular Sense line can be used with skip logic or with interrupt logic. If interrupt logic has been enabled for the Sense line. then as soon as the active condition occurs at the Sense line. an interrupt will be requested. If interrupt logic has not beenenab!ed for the Sense line. then the active cOrJdition of the Sense input will be ~ecorded in an internal flip-flop. Subsequently. when a SKIP instruction identifying t~e Sense line is executed. skip pulse will be retLir,,!ed to the IM6100 CPU if the "~ctive"Sense input has occurred. The Sense flip-flop is then cleared. a IM61 Q1 INTERRUPT HAI\!DLlNG LO~IC The IM6101 has ~ypical daisy-chain ~ri9rity interruRt I~gic, im~lemented via the PRIN and POUT signals. PRIN must be a high input if an IM6101 is to generate an interrupt request based on one of the four sense lines. Therefore. the IM61 01 electrically closest to the CPU must have its PRIN input connected to 13 high logic level so that its interrupt request logic will qlways be enabled. So long as no interrupt request is active at this highest priority IM61 01. a high signal will be ~utput via POUT; it pe~omes the pRI~input for the' next IM6101 in the daisy chain. M ' ~ ••• ~ ~ ~lalu ~ x~1- o ~ CPU Accumulator bits x through y inclusive. For example. AC <4-0> represents bits 4.3.2.1. and 0 of the CPU Accumulator CAR Curren! Address register CBR Clock Buffer register CC Clock Counter register COF Clock Overflow status DF Data Field register ECAR Extended Current Address register EN Clock Enable register \ H Hig h level voltage - IB Instruction Field buffer positive logic "1" IE CPU Interrupt Enable status IF Instruction Field register 13-85 IIFF .Interrupt Inhibit Flip-Flop (lM6102 internal interrupt enable/disable status) L Low level voltage - LINK CPU Link status bit '. positive logic "a" n An octal operand digit in the range SF Save Field register a through 7 SF <2.1.0> Save Field register bits 2.1. O' SF <5.4.3> Save Field register bits 5. 4, 3 SR DMA Status register SR6 . DMA Status register bit 6 - SR5 DMA Status register bit 5 - VR Interrupt Vector register the Field 7 wrap around carry error bit the Word Count Overflow error bit WCR DMA Word Count register xxx Three bits of object code corresponding to "n", described above [] Contents of location enclosed within brackets A Logical AND V Logical OR ....,;.. Data is transferred in the direction of the arrow 13-86 © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 13-6. IM6102 MEDIC I/O Instructions TYPE MNEMONIC OPERAND CAF CONTROLS TO - CPU OBJECT OPERATION PERFORMED CODE 6007 ·H H H H C07 CDF nO CIF nO CDF,ClF nO t ' 62nl ll00IOxxxOOl 62n2 ll00IOxxxOl0 62n3 . Clear all flags: clear Word Count Overflow error bit, Reid 7 wrap around carry error bit, and Clock Overflow flag; clear Clock Enable register and Clock Buffer. H H, H H H H H H H H H H H H ll00IOxxxOll GTF [SRS]-{), [SR6]-{), [COF]-{), [EN]-{), [CBR]-{) 6004 C04 [DF]-" Load Data Field register immediate [IB]-" Load Instruction Field buffer immediate [DF]-", [IB]-" Load Data Field register and Instruction Field buffer immediate Read flags into CPU Accumulator as follows: 11 10 9 8 7 6 5 4 3 l I 1 JxJ 1 Save Field INTREQ UF RDF 6254 CAC 6214 H H H H H H H H H H cac RIB 6234 H L e9C RIF RMF RTF 6224 C94 6244 CA4 H H H H H 600S H H H H COS Bit No. - register~ These are from IM6102 MEDIC ~ These are from IM6100 CPU IE lIF]-[IB] Load Instruction Field register, re-enable interrupts [AC]-[AC<5-3>]V [OF] OR Data Field register into bits 6, 5, 4, and 3 of the CPU Accumulator 'l-AC<5-0>]-[AC<5-0>] V [SF] Sa~e Field register into the low-order 6 bits of the CPU Accumulator [AC]-[AC]V [IF] OR Instruction Field register into bits S, 4, and 3 of the CPU Accumulator. lIB]-[SF1. [OF]-[SF<2,I,O>] Restor~ memory field. The Instruction Buffer will load the Instruction Field after the n8l(t JMP, JMS, or UF instruction. Return flags from CPU as follows: , 11 '.', 4-- CPU Accumulator " .t, i '" - - UNK o 2 10 9 8 7 6 5 4 3 2 1 0 4-- IX I I I I I I I I I I I I UNK -r--. X X [IB] X X X X Bit No. CPU Accumulator [OF] After the next JMS, JMP, or UF instruction, interrupts wil be enabled and the Instruction Buffer will load the Instruction Field. Table 13-6. IM6102 MEDIC I/O Instructions (Continued) TYPE MNEMONIC OPERAND LCAR .... LEAR Z LFSA .. i 0 U nO CONTROLS TO OBJECT CODE 6205 Ca5 62n6 ll0010xxxll0 6245 CA5 Co C1 SKP L H H H [CAR]-[AC]; [AC]-o H H H H Transfer CPU Accumulator contents to Current Address register, then clear Accumulator. [ECAR]-n L H H H L H H H L L H H H L H H H L H H en en U U ... LWCR > a:: '" RCAR ...~ REAR 'U RFSA 0 ~ .. '"a::Q W I 00 00 .... .. H H L/H CLAB. 6133 C5B H H, H H CLBA 6136 C5E 6137 C5F L L H H [CBR]-[AC]; [CC]-[CBR] Transfer the CPU Accumulator contents to the Clock Buffer register, then transfer the Clock Buffer register contents to the Clock Counter register. [AC]-[CBR] L L H H Transfer the Clock Buffer register contents to the CPU Accumulator [CBR]-[CC]; [AC]-[CBR] CLCA ..... CLOE' '"~j::: CLEN ''"a::" CLSA CLSK CLZE ~ .... :;)0 a:: a:: a::" ",2 .. 0 ~U Transfer Current Address register contents to the CPU. [AC<5-3 > ] - [ AC<5-3 >] V [ECAR] OR Extended Current Address register contents with CPU Accumulator bits 5, 4, and 3. [AC<6-0>]-[AC<6-0>]V [SR]; [SR6]-o OR OMA Status register contents with CPU Accumulator bits 6-0; then clear bit'6 of the OMA. Status register. If OMA Word Count register has overflowed, return low SKP pulse. H Transfer the Clock Counter register contents to the Clock Buffer register, then transfer the Clock Buffer register contents to the CPU Accumulator. ~ .:., Accumulator. [WCR]-[AC]; [AC]-o Start DMA and clear Word Count Overflow status. Transfer CPU Accumulator to OMA Word Count register then clear Accumulator. [AC]-[CAR] 6265 CB5 2 0 U U 0 U Load the Extended Current Address register immediate. [SR]-[AC<4-0>]; [AC]-o Transfer low-order five bits of CPU Accumulator contents to OMA Status register, then clear SKOF 0 a:: 6225 C95 6215 CaD 6235 C90 6255 CAQ CPU OPERATION PERFORMED C2 WRVR 6132 ' C5A H H H H 6134 C5C 6135 C50 L L H H L L H H 6131 C59 6130 C58 H H H L/H H H H H L H H H 6275 CBO [EN]-[EN]V [AC] ' Set to 1 all Clock Enable register bits which correspond tol bits in the CPU Accumulator [AC]-[EN] Transfer Clock Enable register contents to the CPU Accumulator [AC]-o; [AC]-[COF]; [COF]-o Clear CPU Accumulator, transfer Clock Overflow Rag to high bit of Accumulator, and then reset Clock Overflow Flag If Clock Overflow FI\lg is set return a low SKP pulse. [EN]-[EN] A [AC] Reset to 0 all Clock Enable register bits which correspond to 1 bits in the CPU Accumulator. [VR]-[AC<11-1 >]; [AC]-o Transfer upper 10 bits of CPU Accumulator to the Interrupt Vector register, then clear Accumulator. DATA SHEETS This section contains specific electrical and timing data for the following devices: cw ~ o a. ·IM6100 CPU • IM6101 PIE • IM6102 MEDIC a: a: o CJ ! en w ~ Q en .~.., w z a: o m ~ :E g c( @ 13-01 IM6100 ABSOLUTE MAXIMUM RATINGS Supply Voltage Input or Output Voltage Applied Storage Temperature Range IM6100/C t4.0V tOr 7.0V IM6100A t4.0V to 11.0V GND -0.3V to Vee +0.3V -65 C to +125 C DC CHARACTERISTICS Vee = 5.0V ': 10% (IM6100). 10.0V SYMBOL PARAMETER Logical "1" Input Voltage Logical "0" Input Voltage Input Leakage Logical "1" Output Voltage Logical "1" Output Voltage Logical "0" Output Voltage Logical "0" Output Voltage Output Leakage Supply Current V,H V,l I'l VOH , VOH , Vou Val' 10 lee Input Capacitance Output Capacitance C'N Co :!: Operating Temperature Range Commercial .. ' Industrial Military O'Cto +75°C -40°C to +85°C' -55°C to +125'C 10% (IM6100A). TA = Commercial. Industrial or Military CONDITIONS MIN MAX TYP 70% Vee OV.;; V,N .;; Vee 10uT=0 IOH=-0.2mA lOUT =0 10l =1.6 mA OV.,,; Vo '" Vee Vee = 5.0 volts Vee = 10.0 volts Cl = 50 pF; TA = 25°C FeLOe • = Operating Frequency 200/0Vee 1.0 -1.0 Vee- 0.01 2.4 GND +0.01 0.45 1.0 2.5 10.0 -1.0 5.0 8.0 UNITS V V /LA V V V V /LA mA mA pF pF CRYSTAL FREQUENCY·fe STATES LX MAR MEM/OEV/SW/CP SELECT ---+--,1I'-:-__ ~ __ 'os!--i ox (0·11) t-tOH WRITE DATA XTA _ _ _ _ _..J XTe XTC - ' IM51CO TIM!~lG AND STATE S!GNALS AC CHARACTERISTICS (TA = 25° C), Derate O.390/oC SYMBOL PARAMETER '.• ~Stal9'nme LXMAR Pulse Width "~Mir8ee SetUP 'Ib8;'; Address Hold Time ACcetii 1Tme FrOm 1.XMAR .'.':': '. 'f . Output Enable TirTl.e,., • ,; tl tM··;.~·;: IM6100A IM6100C Vee = 10.0 Vee = 5.0 Ie = 4MHz 'e=BMHz f.:'= 3.3MHz 240 ;.';'.:>::', 250 t' H 50(F , tA;' 700 Write Pulse Width . Data Setup TIme .: Data Hold Time twp 240 tOH . ns :':;~.:~;".~; ~:~!75: i 240 . 100 Data sheets on pages 13·02 through 13·06 reprinted by permission of Intersil. Incorporated. '13-02 .( ::.~t.~,:~~ ;)~~.Q ':~~:!~i2 ~;t:,~~ :.~:: ,~~;~~";;:"':::~~::~ 240 tEN . . Read Pulse 'Mdlh ..... Ie. ., ,':r "f50,>.).. t..l: ; UNITS ::~;,.~.,.;~~:;; .,.500' T. " IM6100 Vee = 5.0 280 .. >;\~:':=(' ~'.C~:~l~; ns ;f~;:::::~."':~L: ~;:_;:;):·:Y:'N:;,:·::r·:·~;~:!~f~ 160 ns IM6101 ABSOLUTE MAXIMUM RATINGS Supply Voltage IM6101 IM6101A Q w ~ a: oa. a: o u +8.OV +12.0V Applied Inp'ut or Output Voltage GNO --0.3V to Vee +0.3V Storage Temperature Range -6So e to 150°C DC CHARACTERISTICS PARAMETER SYMBOL en w Logical "1" Input Voltage VIH Logical "0" Input Voltage VIL Input Leakage IlL Q en ~ elf w Z a: oa:I en o -40°C to 85°C -55°C to 125°C Operating Voltage Range IM6101 IM6l01A Vee == Operating Voltage Range ~ ~ Operating Temperature Range Industrial , Military TA 4V to 7V 4V to 11V =Temperature Range CONDITIONS MIN TVP MAX V 70% Vee OV ~VIN ~Vee Logical "1" Output Voltage VOH2 lOUT ~ 0 Logical "1" Output Voltage VOH1 IOH = -0.2 mA Logical "0" Output Voltage VOL2 lOUT = 0 logical "0" Output Voltage VOL 1 UNITS -1.0 20% Vee V 1.0 Il A V Vce - 0.01 2.4 V ,- 'IOL -= 2.0 mA QV ~VO ~Vee GNO+O.Ol V 0.4S V 1.0 Il A Il A Output Leakage 10 ~ Supply Current leel VIN = Vee leC2 Vce = 5V flM6100 @ Input Capacitance CI, 5 7 pf Output Capacitance Co 8 10 pf Input/Output Capacitance elD 8 10 pf ~ c( AC CHARACTERISTICS PARAMETER TA = 2soe SYMBOL eL -1.0 1.0 =4 MHz mA '1.0 = 50pf CONDITIONS MIN TYP MAX UNITS Delay from OEVSEl to READ tOR IM6l01 Vee = SV IM6101A Vee = 10V lS0 - 7S' ns ns Delay from OEVSEL to WRITE tow IM6101 Vee IM6101A Vce = 5V = 10V lS0 75 ns ns Delay from OEVSEL to FLAG , tOF IM6101 Vee IM6101A Vee = 5V = 10V 200 100 ns ns Delay from OEVSEL to el. e2 me IM6101 Vee IM6101A Vee = 5V = 10V 200 100 ns ns Delay from OEVSEL to SKP/INT tOI IM6l0l Vee IM6101A Vee = SV = 10V 200 100 ns ns Delay from OEVSEL to OX tOA IM6l0l Vce IM6l01A Vee = SV = 10V 200 100 ns ns LXMAR pulse width tLXMAR IM6101 Vee IM6101A Vce = 5V = lOV 200 100 ns ns Address setup time tAOOS IM6101 Vee IM6101A Vee = 5V = 10V SO 25 ns ns Address hold time tAOOH IM6101 Vee IM6101A Vee = SV = 10V 100 SO ns ns Data setup time tos IM6101 Vee = SV IM6101A Vee"; 10V 200 100 ns ns Data hold time tOH IM6l01 Vee IM6101A Vee = SV = 10V SO 2S ns ns 13-03 IM6101 TIMING DIAGRAM Timing for a typical lOT transfer is shown below. During IFETCH the processor obtains from memory an lOT instruction of the form 6XXX. During the IOTA the processor places that instruction back on the OX lines @ and pulses LXMAR transferring address and control information for the lOT transfer to all peripheral devices. A low going pulse on DEVSEL while XTC is high @ is used by the addressed PI E along with decoded control information to generate Cl, C2, SKP and controls for data transfers to the processor. Control outputs ~EADl and READ2 are used to gate peripheral data to the OX lines during this time. A low going pulse on DEVSEL while XTC is low is used to generate WRITEl and WRITE2 controls. These signals are used to clock processor accumulator instruction data into peripheral devices. ® I + - - - - - - - - - - - - - - I O T INSTRUCTION - - - - - - - - - - - - - - - - l \\...___--J! \\..._ _....J! XTC r LXMAR I-tLXMAR .... tAOOS OX (0-11) ( (j) X ---+-- (i) '.' ~tAOOH Q) @ ItOA· I- ~A@ toS~'~tOH I'-f-tORREAD (NEGATIVE POLARITY) i- -l--tOR I'-- H tOF __ ~-tow tow-I- ,......, WRITE (POSITIVE POLARITY) WRITE (NEGATIVE POLARITY) \\..._--~ '-" I- CFLAG SFLAG .... ------------------------ tOI'" --~:. SKP/INT tOC'" ~_______________________ --~toi------' INTERRUPT DATA SKIP INTERRUPT DATA tOF :t FLAG (VIA WCRA COMMAND) ~::t i--toc I'--- Sense FF are sampled when LXMAR is high by the PIE_ Interrupts are sampled by the IM6100 on the rising edge of T2_ All PIE timing is generated from IM6100 signals LXMAR, DEVSEL, and XTC,' No additional timing signals, clocks, or one shots are required. Propagation delays, pulse width, data setup and hold times are specified for direct interfacing with the IM6100, 13-04 OX data, CO, C1, C2, and SKI> are read by the IM6100 on the rising edge of T3_ IM61Q2 ABSOLUTE MAXIMUM RATINGS Supply Voltage Input or Output Voltage applied Storage Temperature Range Operating Temperature Range cw ~ a: oIl. a: o Operating Voltage Range DC CHARACTERISTICS U ~ en w ~ g en en II( III w Z a: PAR~METER VCC =.5.0V ±.10% VIH VII.. IlL VOH VOL 10 ICC ::!: c II( MIN MAX TYP UNITS V VCC-2.0 OV ..;;; VIN ..;;; VCC except pins 15.29,31 I OH = -0.2 mA except pins 32, 33. 34 IOL = 2.DmA OV";;; VO";;; VCC VCC = 5.DV 0.45 1.0 2.5 V I1A V V pA mA 8.0. 10..0 pF pF O.S l.0 -1.0 2.4 -1.0 I o en o III II( T A = Industrial or Military CONDiTIONS SYMBOL Logical "1" Input Voltage Logical "a" Input Voltage Input Leakage Logical "'" Output Voltage Logical "a" Output Voltage Output Leakage Supply Current IM61021 IM6102M SV GND -0.3V to V CC + 0.3V _65°C to +150°C IM61021 -40°C to +S5°C IM6102M _55°C to +125°C 4-7V CL = 50 pF; TA = 25°C FCLOCK = Operating Frequency 7.0. Input Capacitance Output Capacitance 8.0 @ AC CHARACTERISTICS VCC = 5.0V ± 10% TA = Industrial or Military PARAMETER LXMAR pulse width IN XTA pulse width IN SYMBOL MIN tUN tXAI 250 500 Address setup time IN: OX·LXMAR H) IAIS Address hold time IN: LXMAR H)·OX tAIH CL = 50pF TYP 100 100 tDEN 200 tCEN 100 Write pulse width IN tDVW 75 RESET input pulse width O. .DMAG~T to EMA linu <. MEMSEL * pulse width - DMA READ MEMSEL' pulse width - OMA WRITE MEMSEL * pulse widthDMA REAO/REFSH MEMSEL * pulse widthDMA WRITE/REFSH MIN TYP tLD 250 OMA READ access time: LXMAR* (~)·UP (t) IDRAT 500 OX & EMA addr.ess setup time wrt LXMAR* W tOXAS tEMAS 375 375 OX & EMA address hold time wrt lXMAR* (~) IOXAH tEMAH 125 125 DMA READ enable time: MEMSEL * (~)-UP It) tOREN 375 tRUP 250 tOWAT 500 DMA WRITE enable time: UP (U-MEMSEl* It) tOWEN 375 100 MEMSEL * setup tim. DMA WRITE MEMSEL·U)-LXMAR* (U tMWS 125 'OEM 100 DMAEN setup time w.r.t: XTA (t) DMAEN hold time w.r.t. XTA (f) tOMS tOMH 50 tMOR tMOW 500 625 UP pulse width DMA WR ITE twuP 500 tRST 100 tSID 100 , Eriable/Di~bl~ 'time from· SYMBOL UP pulse width DMA READ DMA control signals delay: XTC-XTC*; MEMSEL- MEMSEL*, LXMARlXMAR* tDMlX ','!,;. PARAMETER LXMAR* pulse width DMA WRITE access time: LXMAR· U)-MEMSEL· (t) 50 .' '. ~KP/INTX to SKP/INT propagation delay MAX All times iri ns MAX 150 Data output enable time: . DEVSELW-DX Controls output enable time: DEVSEL (~Hines CO, Cl, C2, 5/1 Data Input setup time: DX-DEVSEL (t) tOIS Data input hold time: DEVSEL (t)-OX tOIH fc = 4MHZ : TS = 2/fc = 5DDns . ~,'. tMDRR 500 tMDWR 375 ., 50 t"\'r '13-05 IM6102 SOMA OPERATIONS TIMING DMAREAD LXMAR· .--f\'~--------------------~RV'L ~~~----tO-RA-T---'---------------- MEMSEL· UP DMAWRITE LXMAR· ------towAT--.j MEMSEL· --~. tMDW--- UP DMA READ/REFRESH tOMLX MEMSEL· UP ------i----------------------------------- VIH DMA WRITE/REFRESH UP ----~----------4_-~------------~-------VIH LXMAR MEMSEL tAIS tAIH ox 13-06 c w Chapter 1.4. . THE 8X300 (OR SMS300) ~ II: o II. II: oCJ ~ en w We have described this product in previous editions under the designation SMS300. However, its manufacturer now calls it 8X300, and that is the standard part riumber. g The 8X300 is described by its manufacturer as a "microcontroller" rather than a "microprocessor". This distinction draws attention to the unique capabilities of the 8X300 which make it the most remarkable device described in this book. ~ en en .·. . . . . . . . . \ . . . . . . ..•..i•..•• ,.·• •·•. ·•.• i·. ·\. . .•.•,r 1'<' ..... ·"···.··L .'" ~.~~ ;ri< J-.i I··.· ':.~:9i£< i\.]< U"1~·'·~'; . ·.0;~:·• • •·.. \. <[.Jp~e?~SeLo~IG: I····:.•· > •••••••• .... , "1,( ir';j;;~ ..;~~1~~J%f~~:).~~ l~ ~ J~;~~;;;,;; ';XJ;:::~. >;x;V/;:;:;;~ ::;: ;g;:rpzZ>eral Purpose Registers (B bits) R6 Rll Auxiliary Re gister (B bits) I Program Counter (13 bits) IVB Bus Buffer (B bits) 14-3 The seven General Purpose registers and the Auxiliary register constitute eight primary Accumulators. The result of any ALU operation may be stored in the Auxiliary register. or in anyone of the seven General Purpose registers. ALU operations that require a single data input may receive this input from any General Purpose register. or from the Auxiliary register. ALU operations that require two data inputs will receive the second data input from the Auxiliary reg ister on Iy. . The aX300 IVB Bus is equivalent to a microprocessor Data Bus. The IVB Bus buffer operates as a source or destination for data in the same way as a general purpose register: it can be the destination of an ALU operation. or it can be the source for one ALU input. Strictly speaking. the IVB Bus buffer is not a programmaple register. in that there are no instructions that will simply load data into the IVB Bus buffer or read data out of the IVB Bus buffer. However. any instruction that outputs data on the IVB Bus or reads data off the IVB Bus will also write into the IVB Bus buffer. The strange general purpose register numbering reflects instruction object code interpretations which we will describe later in this chapter. 8X300 assembly language uses register designations to identify a number of operations that have nothing to do with programmable registers: do not be confused. . . The Program Counter is thirteen bits wide; thus, a total of a192 program memory words may be acidressed. The Program Counter is one feature of 8X300 logic which is not unusual: at all times. this register addresses the next program memory location from which an instruction c~de will be fetched. Manufacturer's literature describes an Instruction Address register. but this is not a programmable register: it is simply. a location within which effective program memory addresses are computed before being output to the program memory. Obs~rve that the aX300 has no Data Counter, Stack Pointer, or other logic via which external data memory can' be a d d r e s s e d . ' . . 8X300 STATUS FLAGS The aX300 has a single status flag, referred to in the manufacturer's literature as the Overflow (OVF) flag. This flag is. in fact. a Carry status, as we woul~ define it. In keeping with the generally unusual architecture of the 8X300. the Overflow status flag is addressed as though it were the low order bit of General Purpose Register 8 (10 octall. ADORESSI~G 8X300 MEMORY The aX300can access program memory and I/O devices; the aX300 has no logic capable of addressing data memory. Program memory is addressed in 16-bit words: up to 8192 words of program memory can be addressed. You can address program memory in order to fetch instruction object codes. but that is all. You cannot store data tables in program memory. because there is aosolutely no way of transferring the contents of a program memory word to any data register. Also. there is ~bsolutelY no way in which you can w.rite into program memory. aX300 PROGRAM MEMORY ADDRESSING All data and external logic is addressed as a-bit data units, via 512 I/O port addresses. If 'aX300 youwant to have read/write mElmory present in an 8X300 system. you must set aside a block DAT~ AND I/O of contiguous I/O port addresses in order to select individual bytes of, read/write memory: ADDRESSIN~ alternatively. you must access 8-bit buffers. via I/O port addresses. in order to create the . memory address and Data Busses which are needed by external read/write memory. For example. you could adqress 65.536 bytes 'of external read/write memory by allocating two 8-bit I/O ports to hold 16 bits of data which will create a memory Address Bus: a third 8-bit I/O port must be set aside as a buffer. holding data being written out to external memory or being read from external memory. . . ~ , '. . . , The 8T32/3/5/6 Interface Vector Bytes (IV Bytes). which are described later in this chapter. have been designed to operate as I/O ports. read/write memory and the 8X300 Microcontroller external logic interface. Because of the unique architecture of the 8X300. and particularly because of its very high speed. you will probably find that the IV Bytes currently have no substitutes in any 8X300 microcomputer . system. Looking at the 8X300 from the frame of reference 'of any other microcomputer described in aT~2/3/5/6 this ~ook. an IV Byte is a simple. 8-bit parallel I/O port. But unlike the I/O ports of other IV BYTE microprocessors. 8X300 instructions that access an I/O port do not identify the I/O port that is ADDRESSING to be accessed. You must first execute an instruction which selects an I/O port: then any instruction which specifies an I/O port access will acc~ss the most recently selected I/O port. You can have two I/O ports simultaneously selected. since the 8X300 divides a total of 512 addressable I/O ports into a left bank and a right bank -:- within each bank a single IV Byte can be s·elected. 14-4 Q w ~ a: o 0. As we have already stated. if you want to have read/write memory present in an 8X300 microcomputer system. you must create the address and Data Bus required by the external read/write memory using IV bytes. This is no different than using I/O ports of any other microcomputer system described in this book in order to create Address and Data Busses. The reason the 8X300 can get away with such an apparently clumsy method of accessing read/write memory is because of the very high speed of instruction execution - and because of the fact that the 8~300 is simply not designed for data manipulations that use a lot of read/write memory. For the type of signal processing and logic control applications that are well su ited to an 8X300. 512 bytes of external read/write memory will be more than sufficient. a: o u !: en w ~ g (I) (I) c( alS w Z a: VCR 50 VREG (A51:A7 (A61,A6 (A71:A5 (ASI.A4 (A9).A3 (A10)iA2 ("11I1Al (A12IAO Xl X2 49 48 47 46 45 44 43 42 41 A8 (A4) A9 (A31 A10(A21 A11 (A11 A12 (AOI GND o m (1151· 10 (1141 11 (1131 12 (1121 13 (111114 (110115 (19116 (lSI 17 (I) o :iE c( Q c( @ (17118 (16119 (151110 (141111 (131,112 3 4 6 7 8· 10 11 12 ·13 14 15 16 17 18 40 SX300 39 38 37 36 35. 34 33 32 31 30 29 28 27 26 21 22 23 24 25 . iiAlT RESET MCLK iVO W7I iVi Wsl M(iVs) iV3li\i4l Vcc iV4 (lV31 iVs1iV2) iViliVT) iV7 (IVai . Rii . iB wc SC 115 (101 114 (111 113 (121 Pin Name Description Type AO-A12. Program Memory Addraaa Bus._ Output iVa -M RB. ii. wC. sc Interfece Vector Byte.Bus Control Signals Bidirectional Output MCLK Synchronizing Clock CPU Halt RESET X1. X2 10-115 Reset· Crystal Connections Instruction Bus. VREG VCR Vee.GND Reference Voltage to Pasa Transistor Regulated Supply Voltage from Pasa Traneiator Power and Ground HALT' Output Input Input Input. Input Figure 14-3. 8X300 Microcontroller Signals and Pin Assignments 8X300 PINS AND SIGNALS 8X300 pins and signals are illustrated in Figure 14-3. Signetics literature numbers bits and busses beginning with 0 for the high-order bit or line. We number bits and busses in the opposite direction. with 0 representing the low-order bit or line. In Figure 14-3. therefore. signals are identified fJrst with the nomenclature used by Signetics documentation. then in parentheses with the Signal name using our numbering system. Furthermore. all bit numbers throughout this chapter refer to our numbering system. All addresses are output to program memory via the Address Bus lines AO - A 12. Note carefully that addresses cannot be output via AO - A 12 to data memory. The only time an address will be output via the Address Bus is during an instruction fetch operation. The fetched instruction object code will be returned via the sixteen instruction pins, 10 - 115. . IVO -IV7 is a combined Address and Data Bus via which external logic is accessed by the 8X300,' You will find it easiest to understand this bus if you visualize it as a multiplex I/O port address and I/O Data Bus.' . 14-5 The two control signals, RB and LB, may be looked upon as an extension to the IVB Bus when an I/O port address is being output via this bus. Whenever an address is being output on the IVB Bus. either RB or LB will be low. while the other signal is high. You can use these two signals in order.to decode the address on the IVB Bus as selecting one or two of the 256 I/O port banks. We will describe how to output 110 port addresses. as against data. later in this chapter. The WC and SC control outputs further define the contents of the IVB Bus as follows: .SC .0 o 1 1 WC 0 1 0 1 Data is input to the 8X300 via the IVB Bus Data is output on the IVB Bus by the 8X300 An I/O port address is output on the IVB Bus by the 8X300 Never output MCLK is a synchronizir)g clock signal which is output as a high pulse during the last quarter of every instruction cycle. The HALT and RESET signals are absolutely standard. When HALT is input low. the 8X300 will cease executing instructions until HALT is input high again. When RESET is input low and is held low for at least one machine cycle. the Program Counter contents are set to zero; subsequently. program execution will begin again with execution of the instruction stored in memory location zero. The two inputs X1 and X2 are used either to connect a crystal or a capacitor. If the 8X300 Microcontroller is being used at maximum speed (125 nanosecond signal frequency) then you must connect a crystal across X 1 and X2. If you are using a slower clock. then a capacitor connected across these two inputs will suffice. 8X300 INSTRUCTION EXECUTION AND TIMING 8X300 instructions are executed in either one or two machine cycles. Minimum instruction cycle time is 250 nanoseconds. Each instruction' cycle is divided into 62.5 nanosecond quarters as follows: One machine cycle (250 ns) ~ rI I I I I I I ~ I I I I I MClK I I ~ I First Quaner Input instruction via 10-115 Second Quaner I I I I I I I Third Quaner I I I) -....r' I Input data via IVB Bus \ '" ) I I '\ I I Founh Quaner Output next instruction address via AO-A12 and data via IVBO-IVB7 LI I I I I I I I I I Perform internal logic operations During the fourth quarter of a machine cycle. the address for the next machine cycle's instruction object code is output via the Address Bus. AO - A 12. During the first quarter of the next machine cycle. the addressed instruction object code is input via the Instruction Bus. 10 -115. . During the second and third quarters of a machine cycle. data is input off the IVB Bus by the 8X300. if necessary; then any internal operations on data are performed. D~ring the fourth quarter.' in addition to the next address being output to program memory. data is output to the IVB Bus. if necessary. Within the rather simple-looking instruction timing illustrated above. some very complex event sequences can occur as a result 'of the 8X300 Microcontroller's unique internal logic organization. Timing and propagation delays are quite complex and must be examined with care ~si~g ~endor data sheets as your guide. The 8X300 Microcontroller's internal logic is unique because a good deal of it is distributed along various data paths. This is illustrated in ~igure 14-2. 14-6 Consider the implications of the shift. merge. rotate and mask logic positions. Data entering the Arithmetic and Logic Unit. either from the IVB Bus Buffer. or from a general purpose register. mu'st pass through both the rotate and mask logic. The rotate logic optionally allows the entering eight data bits to be right-rotated by any number of bit positions: 8X300 ROTATE AND MASK LOGIC c w ~ a: o a. a: o u ~ iii w The mask logic optionally allows you to take the output from the rotate logic and mask off any number of bits. beginning with the high-order bit: ~ g A MaskOut ~ I \ ~ .Keep ./ \ en en ., c( ........ ..",., /' Range ~f ~, , .... mask optiOnS -..", w Z a: 1 1 1 1 1 1 I· 1 I o co en o Mllsked out bit positions .are replaced by O. ~ c( c c( @ Thus. the data entering the ALU from either a general purpose register or the IVB Bus register may be rotated and/or masked before being operated on. Combining the rotate and mask logic that we have just described. the input to the ALU may be illustrated as follows: Bit N u m b e r s0Q 1 7 4 \ high order bit 3 2 Incoming data shown as a continuous cylinder to illustrate right rotate capability. Any boUndary~..c : : : : s of bits data bits Zero bits ~ ~ -... . , _/ '- ..... 1II I I I IfI ,/ range of "\ boundary 76 Result of rotate/mask logic !'i 4 3 2 1 0 ",-BitNumber Suppose an input is right-rotated three bit pOSitions. then the two high-order bits are masked off: this would be the result: 7 Initial value: A7 After right rotate: A2 After mask: 0 6 A6 A1 0 5 A5 AO AO 4 A4 A7 A7 3 A3 A6 A6 2 1 .0 A2 A 1 AO A5 A4 A3 A5 A4 A3 Bit No. The result of the rotate/mask logic illustrated above becomes an Arithmetic and Logic Unit (ALU) input: it may be the only ALU input. or it may be one of two ALU inputs. If it is the only ALU input. it will simply be passed through the ALU. 14-7 If it is one of two ALU inputs. then the second input is the unmodified contents of an 8-bit Auxiliary register: You may Adci.' AND or XOR the two operands: Auxiliary register contents mask/rotate logic Thus. the ALU output may be the unmodified result of rotate and mask logic. or it may be the output from an arithmetic or logical operation. as illustrated above. In either case. the ALU output may be stored in the Auxiliary register. or in one of the general purpose registers; or it may be output to thelVB Bus. Data being transferred to the IVB Bus passes through shift and merge logic. This shift and merge logic combines in a very unusual way. ALU output. if shifted. may be shifted left from one to seven bits. However. zeros are not shifted in to the low-order bits; rat\1er. any prior contents of the IVB Buffer are moved into the vacated bit positions. " , 8X300 SHIFT AND MERGE LOGIC In addition. you can specify the number of high-order bits which will retain their IVB Buffer values. This may be illustrated 'as follows:" . ,, " , Bit Bit 7 B7 Bs etc. 0 I.tc.~~ I etc. B, 1 t So t .....- - - - { These low-aider bits equal the number of left shifts Spe.Cified. and retain prior'lVB buffer bit contents. .....- - - - - - - - - Merge specification specifies this bit field width. I- - - - - - - - - - - - - - { If sum of shift left and merge fiald'width is 1;;55 than 8, rem~ining high-order bits retain prior IVB buffer values. Thus you create a new IVB Bus output by inserting f'rom one to eight new data bits anywhere in the old data bit field. In the illustration above. Ai represents new data bits; Bi represents old IVB Buffer bits. Suppose you specify a 2-bit left shift and a 3-bit merge; this would be the result: 14-8, Figures 14-4 through 14-T illustrate the four possible data paths that may be specified by 8X300 instructions. In all four figures. data entering the ALU .from. the Auxiliary register is optional. but. if present. requires an Add. AND or XOR operation to be performed. THE 8X300 INSTRUCTION SET We cannot neatly categorize Instructions as we have done for any other product described In this book: one 8X300 Instruction may perform a data move, plus five additional operations. Therefore, In order to summarize the 8X300 Instruction set in Table 14-2, we list Individual Instructions that perform many operations under each of the Instruction classes that may apply. Table 14-2 will h~lp you understand what the true comparison is between the aX300 instruction set and other microcomputer instruction sets. However. Table 14-2 will do nothing to help you understand 8X300 assembly language. This is because of the strange assembly language mnemonics adopted by Scientific Micro Systems for the aX300 Assembler. But without.some understanding ofaX300 instruction codes. any further discussion of assembly language mnemonics will have little meaning: therefor~ let us take a look at these object codes. and simultaneously look at the assembly language syntax that goes with them. The one general statement that can be made for all 8X300 Instructions is that every instruction has a single, 16bit object code: the 3 high-order object code bits define the Instruction class, while the next 13 bits provide additional operand or qualifying data. This may be Illustrated as follows: . Bit No. T' II ~ +. ---------operand Instruction C'-ss Now we are going to make the discussion which follows conform to the rest of this book by numbering instruction words and data byte bits trom right to left: and we are going to use hexadecimal object code notation. Signetics' literature. by way of contrast. numbers data words from left to right. and uses a form of bastardized octal notation to describe instruction object codes. The first four classes of 8X300 Instructions have Identical object code formats which may be illustrated as follows: IS 14 13 12 11 10 9 B 7 6 5 .. 3 2 1 0 I I I II II I I I II II I II Bit No. Instruction Object Code ~ Destination definition t Source rotate or mask, and destination merge definition Source definition '------~: 010 . 011 MOVE ADD AND XOR The "Source definition" and "Destination definition" are defined as registernu'mbers; since each definition is five bits wide. a register number in the range 0016 through 1F16 (OOa through 37a) may be specified. But you get to specify a lot more than a source or destination register. Table 14-1 summarizes the possibilities. 14-9 Table 14-1. 8X300 Source and Destination Object Code Interpretations .. INTERPRETATION CODE BINARY OCTAL HEX SOURCE DEFINITION 00000 00 00 Auxiliary register DESTINATION DEFINITION 00001 01 01 General Purpose Register R 1 , 00010 02 02 General Purpose Register R2 00011 03 03 General Purpose Register R3 00100 04 04 General Purpose Register R4 00101 05 05 Generel Purpose Register R5 General Purpose Register R6 00110 06 06 00111 07 07 All zero input OVF status Uow-order bit only) I Output an 8-bit I/O port address to a left bank IV Byte 01000 10 08 01001 11 09 01010 through 01110 12 OA 16 OE 01111 17 OF All zero input Output an 8-bit I/O port address to a right bank IV Byte. 10XXX 2X 10 to 17 Contents of left bank IV Byte selected by most recent 07 output is loaded into IVB buffer: this data is then right rotated X bit ALU output is shifted left 7-X bit positions. After passing through merge logic. merge logic output will be stored in IVB ' positions. on its way to the ALU. IVB buffer holds unrotated input. buffer. and in left bank IV Byte most recently selected by an 07 output. l1XXX 3X 18 to IF Not allowed General Purpose Register R 11 } No operation Identical to 10XXX. except that right bank IV Byte most recently selected by a OF (or 17) output 'is accessed. 8X300 assembly language syntax closely follows the object code format: this may be illustrated as follows: LABEL O P S . N. 0 LABEL represents any normal assembly language instruction label: as usual. LABEL is optional. OP represents the operation or instruction mnemonic. OP may be MOVE. ADD. AND. or XOR. depending on which of the four instructions is being executed. OP corresponds to bits 15. 14 and 13 of the instruction code. The assembly language operand field consists of three terms: S. Nand D. With reference to the instruction object code we have illustrated above. S represents bits 8 through 12. the source definition. N represents bits 5 through 7 which may provide rotation. mask or merge parameters. depending on the nature of S and D. o represents bits 0 through 4 of the instruction object code and provides the destination definition. The problem with the S. Nand 0 terms of the operand field is that they are not really operands as one would normally define them in an assembly language instruction set. These three fields also help identify part of the instruction operation. or mnemonic. If you approach 8X300 assembly language realizing that its operand field is really an extension of the mnemonic field. you will have less trouble understanding individual instructions. The various ways in which a Move. Add. AND.or XOR instruction may be executed are illustrated in Figures 14-4 through 14-7. Let us look at these possibilities in more detail. When a register is specified as both the source and destination of data, Figure 14-4 defines the operation. Referring to this figure. note that the source data is rotated. but it is not masked. The second ALU input will only occur if you are executing an Add. AND. or XOR instruction: and in each case the second ALU input will be the unmodified contents of the Auxiliary register. 14-10 The classes of instruction illustrated in Figure 14-4 can be listed under the following categories: 1) . A Register-Register Move. This involves specifying a Move instruction with different registers as the data source . and destination. but no right rotate. 2) Register Operate. By specifying the same register as the source and destination for a MOVE. you can create a Register Operate instruction if you also specify some degree of right rotation. You can create additional Register Operate instructions by specifying the Auxiliary register as both source and destination for an Add. AND or XOR instruction. 3) Register-Register Operate. By specifying an Add. AND or XOR operation that does not use the Auxiliary register as both source and destination. you create Register-Register Operate instructions. Q w ~ a: o a: o D. a; u Consider some possibilities. enw In order to complement any register's contents. load FF16 into the Auxiliary register (using an XMIT instruction). then XOR the General Purpose register contents with the Auxiliary register contents. returning the results to the General Purpose register: These two instructions can be executed in 500 nanoseconds. ~ g (I) (I) ct ail w Z a: .0 m (I) o You can AND or XOR Auxiliary register bits with other data bits from the same Auxiliary register by specifying the Auxiliary register as the source and destination for an AND or XOR instruction with right rotate. The ability to perform logical operations on bits within a single 8-bit unit is very useful if you are treating the contents of a register as status. representing individual signal levels rather than treating the bits contiguously. as data items. Apparently absent instructions. such as Register Increment. Register Decrement. OR and Compare. can be generated by using the Auxiliary register to hold appropriate intermediate data. ~ ct Q ct @ General Purpose Register 2 3 Data Bus 011 010 C , .I --~ I I I I I I I I I I I I II I I I MOVE:: 15 1" 13 12 11 10 9 8 76· 5 " 3 2 1 0 blatructkH1~(Ade Bit No. Figure 14-4. An 8X300 Register-to-Register Instruction's Execution 14-11 IVB7 Figure 14-5 illustrates Move, .Add, AND and XOR instructions wher~ the IVB Bus is the data source and a general purpose register is the. data destination. Referring to Figure 14-5. observe that the mask and right rotate logic are both involved. Bits 5. 6 and7 of the instruction object code. which in Figure'14-4 specify the amount of right rotation. in Figure 14~5 specify the degree of masking which will occur. Bits 8.9 and 10 in Figure 14-5 specify the ' , amount of right rotation which will occur. 8X300 assembly language mnemonics do not discriminate between this new use of bits 5. 6 and 7. You will ,still write assembly language instructions with the format: LABEL OP S.N. D S now defines the right rotate while N defiries the masking operation. Now consider instructions which specify an IV byte as the data destination.' Figure 14-6 illustrates instruction's where a General Purpose ,register is the instruction source; Figure 14-7 illustrates IV byte-to-IV byte operations. General Purpose Register 2 3 IVB7 MOVE 010 001 000 9~ _____ I I I I I I I I I I II I I I II 15 14 13 12 11 10 9 8. 7 6 5 4 3 2 1 0 Instruction Object Code Bit No. Figure 14-5. An 8X300 IV Byte-to-Register Instruction's Execution There are three instruction classes which include immediate data. The XEC instruction, identified by 100 in the three high-order object code bits. uses the 13 operand bits to compute a' temporary program memory address out of which the next instruction object code will be fetched. When an XEC instruction is executed the Program Counter contents are not incremented, 14-12 The NZT instruction, specified by 101 in the three high-order object code bits, provides the 8X300 with its conditional logic. The XMIT instruction, represented by 110 in the three high-order object code bits, provides the 8X390 with its immediate instructions. . c w !ia: oQ. a: o o ~ en w !i g en en ~ ci:I w Z a: en en o o ~ ~ c ~ @ 010 .001. 000 II I 'I '" I I, 1 I I I ,I \ 1 II J I 1 1.5 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Figure 14-6. An 8X300 Register-to-IV Byte Instruction's Execution 14-13 Register 000 I I I I II I I I I I I I I I I I Instruction lS 1413 12 11 10 9·8 7 6 S .4 3 2 1 0 Ob~ct Code Bit No. Figure 14-7. An 8X300 IV Byte-to-IV Byte Instruction's Execution· All three instructions, XEC, NZT and XMIT, use one of the two following instruction object code formats: Format A: 15 14 13 12 11 10 9 8 II 6 5 4 3 0 lololvlvlvl I I II I I I I ~, t -- t'-_____ j __ Bit No. Instruction object code .8 bits of immediate data ' - - - - - - - - - - - - - - - - - R e g i s t e r specified by yyy L------------------------------------{:~~~T 14-14 Format B: 15 14 13 12 11 10 9 8 II I IIIIII 7 6 5 4 3 2 1 0 Bit No. I I I I I I I Instruction object code ~1· ! t' L ~:::::: :d:';c~: t;O" cw ~ a: o0a: o CJ !: Right rotate or left shift specification _ en w j 10 Left bank IV Byte 111 Right bank IV Byte ~ 100 XEC (rotate and mask) g ------------------ (/) (/) { 101 NZT (rotate and mask) 110 XMIT (shift and merge) c:( 01:1 w Z a: oa:I (/) o :;: c:( c c:( @ For all three instructions. XEC. NZT and XMIT. the Format A object code uses bits 8 through 12 to specify a General Purpose register. or the Auxiliary register. The Format B instruction object code uses bits 5 through 12 to specify the currently selected left bank or right bank IV byte. where byte contents will be subject to a mask and a rotate. as illustrated in Figure 14-5. Let us take another look at how the XEC, NZT and XMIT instructions use the data generated by their operand bits. The XEC instruction allows you to stay at one object code. continuously re-executing this single object code. while it points to another object code which actually gets executed. The address of the object code which actually gets ex. ecuted is computed in one of two ways: 1) For the Format A object code. the current five high-order Program Counter bits are concatenated with the 8-bit sum of the specified register contents. plus the immediate data: . ~ 12 11 10 9 8 7 6 5 .. 3 2 1 0 PC 11 10 9 8 7 6 5 .. 3 2 1 0 III I I IIIIII III 1 I I II I I I I I 12 11 10 9 8 7 6 5 .. 3 2 1 0 14-15 Register yyy 2) With the second object code format. the 8 high-order current Program Counter bits are concatenated with the 5bit sum of the immediate data. plus the rotated and masked IV byte data: 12 11 10 9 8 PC I 7 6 5 4 3 2 1 0 I II I 1 IIIIII 765432 0 II I I I I I I I Object Code ~ ::~::: I I --------_ .. ~ I I I I II I I I I I I '12 11 10 9 8 7 6 5 4 3 2 0 Low-order five bits of rotated and masked IV Byte contents You may use XEC instructions in one of two ways: ' 1) 2) You may create a branch table of Jump instructions: based on the contents of any General Purpose register or IV byte. you may jump to one of 256 locations using Format A instruction object code.' or one of 32 locations using Format B instruction object code. . External logic may directly control the sequence in which instructions are executed. The XEC instruction is equivalent to a Single instruction which requires 500 nanoseconds to execute: 250 hanoseconds to process the XEC instruction's object code and another250 nanoseconds to execute the object code fetched in respqnse to the XEC instruction. If you are using the Format B instruction. external logic can use the second 250 'nanosecond time interval to load newdata into the selected IV byte. Thus. external logiccan' indefinitely control instruction execution sequence within an 8X300 microcomputer system. ' The NZT instruction uses the 13 operand bits to identify a data byte that will be tested for a zero or a nonzero value. Additional operand bits are used to identify a branch address. If the identified data has a nonzero value. then the branch address is used to generate an absolute paged jump. The Format A NZT instruction object code tests the contents of a general purpose register; upon detecting a nonzero value. the eight immediate data bits are loaded into the eight low-order Program Counter bits - thus causing an absolute paged branch to occur within a 256-word program memory page. For zero general purpose register contents. the ' next sequential instruction is executed' in the normal way. The Format B NZT instruction tests the contents of a selected IV byte. subject to rotate and mask logic. Upon detecting a nonzero result. the five immediate data bits are'loaded into the 100N-o~der five Program Counter bits thus causing an absolute. paged branch to occur within a 32-word program memory page. If a zero result is detected. program execution continues with the next sequential instruction. Thus the NZT instruction allows you to base branch logic on the contents Of .the Overflow status. or on any bit field. in any general purpose register. auxiliary register or external addressable location. We cannot classify s!Jch a wide-ranging instruction as a single instruction; it would not conform with the definition of a single assembly language instruction as used by any other microcomputer described in this b o o k . ' ' In the case of the XMIT instruction, the immediate data gets loaded into the general purpose register specified by a Format A instruction. or the external IV byte specified by a Format B instruction. In the case of a Format B instruction. the immediate data is shifted and merged. as illustrated in Figure 14~7. before being output to the identified IV byte. Recall that the identified IV byte will be the byte most recently selected by a Move instruction that ~pecifies Register 7 or F as the destination. The Jump instruction is the only one which remains to be described: it is also the simplest to describe. When this instruction is executed. the 13 operand bits are loaded directly into the Program Counter: thus you perform a simple unconditional jump to any location in program memory. Observe that the 8X300 has no subroutine or interrupt handling logic. Subroutine logic can be created using the XEC instruction and an appropriate jump table. but this is rather clumsy. In most cases it will be Simpler to do without subroutines. The lack of interrupt logic is probably inconsequential. Given the fact that the 8X300 can execute instructions in 300 nanoseconds. polling on status will invariably be a satisfactory way of allowing external logic to control events within the 8X300 microcomputer system. 14-16 A very effective way of allowing external logic to control the 8X300 microcomputer system is to have the system continuously re-execute an ineffective instruction as the result of an XEC. For example. the XEC could point to an instruction which simply moves the contents of a General Purpose register back into itself. Using Format B for the XEC instruction. external logic could modify the contents of the selected external IV byte in order to force program execution to . branch in one of 31 different directions. c w THE 8X300 BENCHMARK PROGRAM ~ a: oDo a: o u The benchmark program we have been using throughout this book is particularly ill suited to the 8X300: in fact. it could well illustrate a benchmark program that a competitor would select in order to make the 8X300 look bad. This is because the 8X300 is not good at memory addressing. The 8X300 would never be used in an application that principally reads blocks of data into read/write memory. then moves blocks of data around read/write memory. ~ enw ~ g U) U) c( alS The 8X300 has no ability to address read/write memory; as we have already described earlier in this chapter. should you require the presence of read/write memory in an 8X300 system. you are going to have to create a memory Address Bus and Data Bus for the external read/write memory: IV bytes must be used to create these busses. We will therefore change the benchmark program so that a sequence of data bytes entering via the left bank IV byte must immediately be output via a right bank IV byte. The first byte read will be interpreted as identifying the number of data bytes to follow. Now the benchmark will appear as follows: w Z a: o CD U) o ~ c( LOOP C c( @ XMIT XMIT XMIT· MOVE MOVE ADD NZT AUX.377 . 20.0.SRCE 30.0.DST R1.0.SRCE SRCE.O.DST R1.0.R1 R1.LOOP LOAD 377 OCTAL INTO THE AUXILIARY REGISTER TO DECREMENT COUNTER SELECT SOURCE IV BYTE IN LEFT BANK SELECT DESTINATION IV BYTE IN RIGHT BANK LOAD COUNTER INTO R1 MOVE NEXT DATA BYTE DECREMENT COUNTER The following symbols are used in Table 14-2: A ADDR DATA5 DATA8 DISP5 DISP8 IV1. IV2 Auxiliary register 13-bit address value 5-bit data unit 8-bitdata unit 5,bit address value 8-bit .address value IV Byte (L) Optional Field length for IV Byte PC Program Counter. (R) Optional rotate value for register· RX. RY Any General Purpose registers x Bits y through z of the specified value. For example. PC <7.0 > is the low byte ofthe Program Counter. [[]] Conte~ts of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. A Logical AND ¥ Logical Exclusive-OR Data is transferred in the direction .of the arrow. Under the heading of STATUS in Table 14-2. an X indicates OVF is modified in the course of the instructions execution. If there is no X. it means that the status maintains the value it had before the instruction was executed. 14-17 Table 14-2. 8X300 Instruction Set STATUS TYPE MNEMONIC MOVE ~~ S w g~ I- II) a: II: BYTES IV1,tLI,IV2 2 [IV2]-[IVl] OV MOVE IV1,(LI,RX 2 Move data from IV Byte.to IV Byte. [RX)-[IVl1 MOVE RX,(Ll.IVl 2 Move data from IV Byte to register. [IVl]-[RX] ADD IV1,tL),IV2 2 X Move data from register to IV Byte. [IV2]-[IV1] + [A] ADD IV 1,(L),RX 2 X Add IV Byte to Auxiliary register, store result in IV Byte. [RX)-[IVl1+ [A] ADD RX,(LI,IVl 2 X Add IV Byte to Auxiliary register, store result in register. [lVl]-[RX] + [A] AND IV 1,(L),IV2 2 Add register to Auxiliary register, store result in IV Byte. [IV2]-[IVI1 A [A] AND. IV1.ILl.RX 2 AND IV Byte with Auxiliary register, store result in IV Byte. [RX]-[IVI1 A [A] AND RX,(L),IVI 2 AND IV Byte with Auxiliary register, store result in register. [IV1]-[RX] A [A] XOR IV1,tL),IV2 2 , AND register with Auxiliary register, store result in' IV Byte. [IV2]-[IVI1'o'-[A] XOR . IV 1,tLl,RX 2 Exclusive-OR IV Byte with Auxiliary register, store result in IV Byte. [RX]-[IVI1"'t [A] XOR RX,(L),IVI 2 Exclusive-OR IV Byte with Auxiliary register, store result in register. [IV1]-[RX]-Y- [A] XMIT DATA5,(LI.IVI 2 Exclusive-OR register with Auxiliary register, store result in IV Byte. [lvl1-DATA5 Transmit immediate to IV Byte. MOVE 'RX,(R),RY 2 [RY]-[RX] g Ii: a: ·w Ww OPERATION PERFORMED OPERANDtSI Move contents of one General Purpose register to anpther. .' © ADAM OSBORNE & ASSOCIATES,INCORPORATED Table 14-2. 8X300 Instruction Set (Continued). STATUS OPERATION PERFORMED TYPE MNEMONIC OPERANDISI BYTES a: .... w lI- ~ CI) a: c:; .... w IL a: 0 MOVE RX,lRj,RX 2 ADD RX,IRI,RY 2 X [RY]-[RX]+ [A] I-I-~ AND RX,(RI.RY 2 X Add Register X to Auxiliary register, store result in Register Y. [RY]-[RX] A [A] ~~o XOR RX.(RI,RY 2 X AND Register X with Auxiliary register, store [RY]-[RX] ¥ [A] a:a:w wWI- aa~ OV Rotate contents of a general purpose register and store result in the same register. r~sult in Register Y. Exclusive-OR Register X with Auxiliaiy register, stor~ result in Register Y. w I~ i5 w XMIT DATAS,RX 2 :=!: [RX]-DATAS Load immediate to General Purpose register. ~ Z :z: 0 NZT RX.DISPS 2 ~.o 0 NZT IV 1,(L1,DISP5 2 ID 0 JMP ADDR 2 ~zE a: Z Branch if IV Byte is nonzero. Co) IL :=!: If [RX] 1'0; [PC<7,O>]-DISPS Branch if register contents nonzero. If [1V1] l' 0; [PC<4,O>]-DISP5 [PC]-ADDR Unconditional jump. ;:) ..., XEC RX,DISPS 2 XEC IV1.IL),DISP5 2 ExeciJte instruction at the following address: [ADDR < 12;S > ] - [ PC < 12,S >] [ADDR <7.0> ] - [ RX] + DISPS. Do not increment PC. Execute instruction at the following address: [ADDR < 12,5> ] - [ PC < 12,5 >] [ADDR<4,O>]-[IV1] + DISP5 Do not increment PC The following symbols are used in Table 14-3. a ddddd !II rrr sssss one bit of immediate address. 5 bits choosing destination reg'ister' or IV Byte.' one bit of immediate data three bits specifying length of IV Byte field. three bits specifying the number of rotates performed. 5 bits choosing source register or IV Byte. The sssss and ddddd fields a're restricted in the following ways: , If sssss or ddddd -represents a register, it must be in'the range 008 - 178 If sssss or ddddd represetns an IV Byte, it must be in the range of 208 - 378 Table 14-3. 8X300 Instruction Set Object Codes INSTRUCTION OBJECT CODE B'f.TES MACHINE CYCLES IV1,(L),IV2 IV1,(L),RX RX,(L),IVI RX,(R),RY IV 1,(Ll,IV2 IVI,(Ll,RX RX,(LI.IVl ' RX,(R),RY 001 ssssslllddddd 2 1 00 1sssssmddddd o1Ossssslllddddd 2 2 1 1 010sssssmddddd 1118888888888888 OOOssssslllddddd 2 2 . 2 1 1 1 OOOsssssmsss5s OOOsssssmddddd lO15sss511188888 lO15ssss88888888 lOOsss5s11188888 l00s55ss88888888 110dddddllliiiii 110dddddiiiiiiii 011sssssIIIddddd 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 011 sssssmddddd 2 1 ADD ADD AND AND JMP MOVE MOVE MOVE NZT NZT XEC XEC XMIT XMIT XOR XOR ADDR IV1,(Ll,IV2 IV1,(L),RX RX,(L),IVI RX,(R),RX RX,(RI.RY IV l,(Ll,DISPS RX,DISP8 IV 1,(Ll,DISP RX,DISP DATAS,IVI DATA8 IV 1,(L),IV2 IV1,(Ll,RX RX,(L),IVI RX,(R),RY 14-20 (UDO) (UDll (UD2) (UD3) (UD4) (UDS) (UD6) (UD7) 0 w ~ a: 0 D. a: 0 u UD7 UD6 UD5 UD4 UD3 UD2 UD1 UDO BOC BIC ME GND ~ ui w ~ g 24 2 3 4 8T32 8T33 8T35 8T36 5 6 7 8 9 10 11 IV BYTE 23 22 21 20 19 18 17 16 15 14 13 12 VCC IV7 (iVO) IV6 (Wi) IV5 (m) IV4(1V3) IV3 (iV4) i\i2(iV5\ IV1 (iVa) IVO(lV7) WC SC MCLK en en Pin Name Description Type lIS iVa - ivi IVB Bus External Logic Data Bus Master Enable Tristate, Bidirectional Tristate or Open Collector, Bidirectional Input External IV Byte Control Lines Master Clock Input Input IVB Bus Control Power and Ground Input c( w a: UDO- UD7 Z ME 0 SiC,soc CD en 0 MCLK SC,WC :iE c( VCC,GND 0 c( @ Figure 14-8. 8T32/3/5/6 Interface Vector Byte Signals and Pin ASSignments THE ST32, ST33, ST35, AND ST36 INTERFACE VECTOR BYTE (IV BYTE) This device serves as an I/O port and IVB Bus interface for all external logic communicating with the 8X300 Mlcrocontroller. The various Interface Vector Bytes are summarized in Table 14-4. This table identifies part differences. Table 14-4. Interface Vector Byte Options Part Name Data Input via UDO - UD7 UD Pins Logic IV Byte Address Logic 8T31 Tristate None Tristate Present Open Collector Present Open Collector Present Tristate Present 8T32 8T33 8T35 8T36 Synchronous. when MCLK is high Synchronous, when MCLK is high Synchronous. when MCLK is high Asynchronous. independent of MCLK Asynchronous. independent of MCLK The IV Byte is implemented using bipolar LSI technology and is packaged as a 24-pin DIP. It requires a single +6V power supply. 8T32/3/6/6 IV BYTE PINS AND SIGNALS Figure 14-8 illustrates the pins and signals of the IV Byte. Figure 14-9 illustrates how an IV Byte will normally be used. As described for Figure 14-3, we show signal numbers in Figure 14-8 first as given in Signetics literature, then In brackets as we would number these signals. 14-21 IVO - IV7 represent the pins via which the IV Byte communicates with the IVB Bus. These pins represent the IV Byte interface with the aX300 microcomputer system. Pins UDO - UD7 represent the a-bit bus via which the IV Byte communicates with logic beyond the aX300 microcomputer system. These pins may be tristate or open collector. as defined in Table 14-4. ME is a master enable signal. This signal is connected toTB or RB. output by the aX300 Microcontroller to distinguish between two banks of I/O ports with 256 I/O ports addressable in each bank. ME is just one contributor to device select logic: we will describe the whole IV Byte select process later. I IV BYTE - EXTERNAL LOGIC INTERFACE I ...-;-. IV BYTE - INTERPRETER INTERFACE I I I I IV BYTE MCLK ME Controls input by external logic { Master Clock Master Enable BIC Controls input by 8X300 Microcontroller B6C UDO Data Bus Data Bus to 8X300 Microcontroller to external logic UD7 ~ ~ Figure 14-9. aT32/3/5/6 IV Byte Control Signals and Interfaces BIC and BOC are signals which control data flow between the IV Byte and external logic, via the UD Bus. SiC and BOC must be input to the IV Byte by external logic. MCLK. output by the aX300 Microcontroller. synchronizes actual data transfers. BIC. BOC. and MCLK combine to control events on the UD Bus as follows: BIC 1 o o o 1 BOC 0 X X X 1 MCLK X 1 X 0 X IV Byte output data to external logic External logic input data to IV Byte (synchronous parts) External logic input data to IV Byte (asynchronous parts) Disable UD Bus for aT31. aT32. aT33. Input data to IV Byte for aT35. aT36 No operation X signifies "don't care": the signal may be low or high. SC and WC control the IVB Bus which connects alllVB bytes with the 8X300 Microcontroller. Control signals SC and WC are automatically output by the aX300 Interpreter. BIC contributes to IVB Bus logic in order to resolve access conflicts: external logic accessing the IV Byte via the UD Bus will have priority over an aX300 Microcontroller access occurring via the IVB Bus. MCLK synchronizes data transfers occurring via the IVB Bus for synchronous and 14-22 asynchronous parts. IVB Bus control logic also requires ~ to be low; observe that UD Bus logic ignores 'fiifE. Combining SC. WC. BIC. MCLK and ME. this is how IVB Bus interface logic responds to control signals: c w ~ II: oa. II: o o ~ enw ~ g CI) CI) < "' w Z II: o en CI) o ~ < c < @ SC X 0 0 WC X 0 BIC X X 1 0 1 X 0 MCLK X X ME 1 0 0 ~} 0 IV IV IV IV Byte Byte Byte Byte not selected; no operation. must place data contents on IVB Bus. reads IVB Bus as data. reads IVB Bus as a select address. (not 8T31). IV Byte reads IVB Bus as a select address. and as data. 8T31 reads IVB Bus as data only. Data is inverted when it flows across an IV Byte. If data is input by external logic via UDO - UD7. then the complement of this data will be read by the 8X300 on IVBO - IVB7. Conversely. if the 8X300 outputs data via IVBO - IVB7. then external logi~ will read the complement of this data via UDO - UD7. If the 8X300 Microcontroller reads back data which it wrote out. then it reads back the exact data it wrote out. and not the complement of the data it wrote out. Conversely. if external logic reads back the data it wrote out. then it too will read back the exact data it wrote out. and not the complement of the data it wrote out. aT32/3/S/6 IV BYTE OPERATION There is no device address logic on the external logic interface of any IV Byte. The IV Byte inputs and outputs data via the UDO - UD7 lines depending on the condition of the BIC and BOC signals. Synchronous IV Bytes. as identified in Table 14-4. will input data via UDO - UD7 only while MCLK is high. Asynchronous IV Bytes ignore MCLK when recieving data input from external logic. All data output viC! UDO - UD7 is asynchronous. On the Microcontroller interface of an IV Byte, all devices (with the exception of the 8T31) have address logic and select logic. The 8T31 will always respond on the Microcontroller interface if the SC. WC. ME. BIC. and MCLK Signals are at the correct levels. All IV Bytes (with the exception of the 8T31) have an internal Address regiser. The contents of this internal Address register are usually created when the IV Byte is manufactured. You can buy an IV Byte whose internal address has not been set. in which case you may set the address followirig a procedure described later. The Microcontroller must output select addresses to select IV Bytes. Any IV Byte that detects a select address coinciding with its internal address will consider itself selected. It will remain selected until a new select address that does not coincide with its internal address is detected. Once an IV Byte has been selected. it will respond to data input or output operations specified by control Signals on the Interpreter interface. An IV Byt~ which is not selected will not respond to input or output operations specified by control signals on the Interpreter interface. Select logic has no effect on the external logic interface of the IV Byte. . Address and select logic does not exist in the 8T31 IV Byte. which will therefore always respond to control signal levels on the Interpreter interface. Let us now look at dialogue occurring between an IV Byte and the 8X300 Interpreter via the IVB Bus. Note carefully that the following discussion applies only to the IV Byte-8X300 interface. The IV Byte-external logic interface is controlled entirely by external logic manipulating the BIC and BOC control signals. 8T32/3/5/6 IV BYTE ACCESS LOGIC At any time. just one IV Byte should consider itself selected on the left bank of IV Bytes. and just one IV Byte should consider itself selected on the right bank of IV Bytes. In order to select an IV Byte. you execute a Move instruction which outputs data to Register 7 fhe left bank. or F for the right bank. There is no Register 7 or F; in response to either of these Move instruction destination definitions. the 8X30() outputs data on the IVB Bus. just as it would for any normal data output operation. but control signals SC and WC are set to 1 and O. respectively. A destination Register of 7 causes LB to be output low. while the destination address F causes RB to be output low. Thus. the net effect of executing a Move instruction specifying Register 7 or F as the destination is that the data moved is the address of the IV Byte which is going to consider itself selected; all other IV Bytes will at this time deselect themselves. If no IV Byte has CI select address equal to the address output. then all IV Bytes will be dE;lselected. Once an IV Byte selects itself. it will remain selected until a subsequent Move to Register 7 or F causes a new Byte to select itself. Remember. the 8T31 has no select logic; it always considers itself selected. 14-23 AllaX300 instructions that specify the IVB Bus as the source or destination of data will automatically access 'the single selected IV Byte - on the left or right bank of IV Bytes. whichever is being accessed by the Move instruction. Table 14-1 describes the way in which you specify whether the IV Byte selected on the left bank or right bank will be accessed. . Observe that external logic will always have priority over the aX300. should both simultaneously attempt to output data to an IV Byte. SiC will be input low by external logic whenever it is attempting to write to the IV Byte: but BIC low inhibits any attempt by the aX300 Microcontroller to write data into the IV Byte. When inputting data from external logic using a synchronous IV Byte. you will have no timing problems. Data'will be input only while MCLK is high. at which time the aX300 is guaranteed not to be accessing the IV Byte. When using asynchronous IV Bytes. data will be input by external logic to the IV Byte at any time. Unless you provide your own logic to guard against it. there is nothing to prevent external logic from inputting data to an asynchronous IV Byte while the aX300 is partway through acceSSing the same IV Byte. in which case the aX300 operation will be inaccurate. 8T32/3/5/6 IV BYTE ADDRESSES IV Bytes can be bought from Signetics with pred~fined 'addresses 01 through OA16. IV Bytes with addresse's OB16 through 3216 are held in smaller quantities. You can, if you wish, buy an IV Byte whose address has not been set. This IV Byte will. in fact have an address of FF16. You must create the address you want by resetting individual address bits to O. This is an operation you can do just once. Once an address bit has been resetto O. it cannot be set to 1 again. The following procedure is described by Signetics for re~ettingindividual address bits to 0: " 'Table 14-5. Specifications for Signals Illustrated in Figures 14-10 and 14-11 TEST, CONDITIONS PARAMETER VCCP ICCp Min Programming supply voltage Address Protect PULSE , , a.o V V 250 1.0 mA s la.O 14.0, V V 75 150 mA mA 1 100 1 5 1 p.s p.s ms 0 Veep =8.0V 17.5 13.5 1 '. r---\-Lov 1/;:"\'1 ld'C.·. . 7.75V "I~'" I PROGR":~~~,~' UNITS Max 7.5 Programming supply current Max time Veep> 5.25V Programming voltage Address Protect Programming current Address Protect Programming pulse rise time Address Protect Programming pulse width Vccp, LIMITS Typ '.' '" . .'8V 10% I ' , I -Itrl-' lOOns < tr < llJS I I I r-< lmS-t OV Figure 14-10. aT32/3/5/6 IV Byte Address Programming Pulse 14-24 PROTECT PROGRAM~ING PULSE ~JL 90% ' ,I " I 10% I I L ~trl cw ~ a: tr <100¢) " 14V I OV r-C I 1- LB/~~:~~UCTT~~~~~Ol 1_-_ o ---1--1 TO SCIWC \ =D a: oIII @) : I INSTRUC;~~~ : I I I I 1--- ~ ~ PAgC~~INQ I I I I INSTRUCTION ADDRESS lAO-AU) CJ ui w I I I MCl'1( TO lBIRS OUTPrCONTAOL "CL~TOL.'AB : :1 iI I I INPUIT CONTAOL 1--'NSTRUCTIONTO'VBUSSTA~lE --_III I I I ~- ~ ADDRESS STABLE IVBUS.! ~Ir--: I ~ I!O-I I - IV BUS -----... I I I 1_- INPUT ACTI\lE --'~I ---+-1 I - - - - M C L K TO IV BUSSTABlE---- - IV BUS -- OUTPUT ACTIvE DEVICE CROSSHATCHED ~ ACCESS ,~Ri~S'~~:~~~~~ ~ SOLID AREA INDICATES CHANGING DATA Figure 10 AC ELECTRICAL CHARACTERISTICS VCC = 5V ± 5% and O°C DELAY DESCRIPTION PROPAGATION DELAY TIME X1 falling edge to MCLK (driven from external pulse generator) MCLK to SC/WC falling edge (input phase) MCLK to SCIWC riSing edge (output phase) MCLK to LS/RS (input phase) Instruction to LS/RS output (input phase) MCLK to LS/RS (output phase) MCLK to IV data (output phase) IV data (input phase) to IV data (output phase) Instruction to Address MCLK to Address IV data (input phase) to Address MCLK to IV data (input phase) MCLK to Halt falling edge to prevent current cycle Reset riSing edge to first MCLK ~ T A < 70°C CYCLE TIME LIMIT 75ns 25ns % cycle + 25ns 35ns 35ns % cycle + 35ns % cycle + 60ns 185ns 115ns 185ns 185ns 115ns % cycle + 40ns % cycle + 40ns % cycle.;.. 55ns % cycle - 40ns o to 1 cycle NOTE 1. Reference to MCLK is to the falling edge when loaded with 300pF. 2. Loading on Address lines is lS0pF. Si!)DotiCS 14-03 8X300lNTERPRETER SYSTEM INSTRUCTION CYCLE TIME MCLK ICD Program storage access time. I@ MCLK to LBIRB "nput pha.el 10-115 or instruction to LB/RS (Input phase). I :~ I LB. RB IV Byte output enable.tTOE) @J IV dala !Input phase) to address. IV 0-.7 Figure 7 SYSTEM INSTRUCTION CYCLE TIME MCLK 10-115 I _ I I I INSTRUCTION PROGRAM STORAGE AOORESS TO _ _ _ I ACCESS 1 __ I I I I I I I I I I I I I I I I I I I I Figure 8 SmDotiCS 14-04 I ST32/ST33/ST36/ST36 DC ELECTRICAL CHARACTERISTICS vee = 5V ± 5%, ooe PARAMETER C VIH VIL Vie au 5~ a: VOH VOL o u ~ ui au IIH IlL g lOS. !;i en ~ lec IIJ ~ T A ~ 70 0 e unless otherwise specified TEST CONDITIONS Input voltage High Low elamp Output voltage High Low Input currenP High Low Output current4 Short circuit UD bus IV bus Vec supply current LIMITS Typ Min Max UNIT V 2.0 .8 -1 II =-5mA Vee =4.75V V 2.4 .55 p.A Vee'" 5.25V VIH =5.25V VIL =.5V <10 -350 100 -550 rnA =4.75V VCC 10 20 '.' VCC =5.25V 100 150 mA au Z ~ PROGRAMMING SPECIFICATIONSs a:I en o PARAMETER ~ c( C c( Vecp @ lecp TEST CONDITIONS Programming supply voltage Address Protect Programming supply current LIMITS Min Typ 7.5 Max 8.0 V V 250 mA 1.0 s 18.0 14.0 V V 75 150 mA mA .1 100 1 Il s Il s .5 1 ms 0 Veep =8.0V Max time V cep > 5.25V Programming voltage Address Protect 17.5 13.5 Programming current . Address Protect Programming pulse rise time Address Protect Programming pulse width NOTES 3. The input current includes thetri-statelopen collector leakage current of the output driver on the data lines. 4. Only one output may be shorted at a time. S. If all programming can be done in less than 1 second. vee may remain at 7.75V for the entire programming cycle. SillBUliCS .14-05 UNITS 8T32/8T33/8T35/8T36 8T32/8T33/8T35/8T36-NA,F AC ELECTRICAL CHARACTERISTICS PARAMETER INPUT TEST CONDITION UDX MCLK' BICt C L = 50pF LIMITS Min UNIT Typ Max 25 45 40 38 61 55 ns tpD User data delay (Note 1 ) tOE User output enable BOC C L = 50pF 18 26 47 ns taD User output disable BIC BOC C L = 50pF 18 16 28 23 35 33 ns tpD IV data delay (Note 1) IVBX MCLK C L = 50pF 38 48 53 61 ns tOE IV output enable ME SC WC C L = 50pF 14 19 25 ns taD IV output disable ME SC WC C L = 50pF 13 17 32 ns tw Minimum pulse width tSETUP t HOLD Minimum setup time Minimum hold time MCLK BICt 40 35 ns UDo BIC' IVX ME SC WC (Note 2) 15 25 55 30 30 30 ns (Note 2) 25 10 10 5 5 5 ns UDXo BIC' IVX ME SC SC • Applies for 8T32 and 8T33 only. t Applies for 8T35 and 8T36 only. o Times are referenced to MCLK for 8T32 and 8T33, and are referenced to BIC lor 8T35 and 8T36. NOTES: 1. Data delays relerenced to the clock are valid only ilthe input data is stableatlhe arriyal 01 the clock and the hold time requirement is met. 2. Set up and hold times given are lor "normal" operation. BIC setup and hold times are lor a user write operation. SC setup and hold times are lor an tV Byte select operation. WC setup and hold tomes are for an IV Bus write operation. Me setup and hold limes are lor both IV write and select operations. S!!Inotics 14-06 8T32/8T33/8T36/8T36 8T32/8T33/8T36/8T36-NA,F ABSOLUTE MAXIMUM RATINGS PARAMETER Q w ~ o Vee VIN Va TA T stg Power supply voltage Input voltage Off-state output voltage Operating temperature range Storage temperature range I a: Q. a: u ~ ~ g UNIT Vdc Vdc Vdc °e °C ADDRESS PROGRAMMING PULSE o enw RATING -0.5 to +7 -0.5 to +5.5 -0.5 to +5.5 -55 to +125 -65 to +150 VCCP ~r-\ 1-, ----..l AOOREss-IL SEC. 1 (I) (I) PROGRAMMING c( PULSE all w Z I 10% 90% I ~ I _I.,L a: oa:I l00nl"l,~ 1.1 I 18V OV, ov I 1--<.. 1m I ....: 7'75V .. FIgure 1 (I) o ~ PROTECT PROGRAMMING PULSE c( cc( @ PROTECT PROGRAMMING PULSE -ILJL I 10% 90% I I -I I, I- " I, • l00~1 Figure 2 smootms 14-07 I I I I J-> 1m.--+i '4V OV ST32/ST33/ST35/ST36 ST32/ST33/ST35/ST36-NA, F PARAMETER MEASUREMENT INFORMATION LOAD CIRCUIT FOR TRI-STATE OUTPUTS LOAD CIRCUIT FOR OPEN COLLECTOR OUTPUTS ~r ; ... VCC: .. . . ALL DIODES ARE lN914 OR EQUIVALENT 390!! ,. , 0"""' . . M'" TEST FROM ~~~~~T _ _ _......_ _.. TEST NOTE: CL includes fixture capacita~ce. INPUT WAVEFORM tr~ CLOCK PULSE WIDTH 5ns tf" 5 ns DATA DELAY TIMES Input Data Reference DATA DELAY TIMES - ·Clock Referenced SIC INPUT DATA ~:~: - + ' - - - - - ' OUTPUT DATA :Y ISV OUTPUT DATA 14:'08 ST32/ST33/ST35/ST36 ST32/ST33/ST35/ST36-NA,F PARAMETER MEASUREMENT INFORMATION (Cont'd) SETUP AND HOLD TIMES OUTPUT ENABLE AND DISABLE TIMES (Tri-State Outputs) Q LOW LEVEl w ~ a: oa. a: o (J ENABLING .," _______ JX':-------- ,I CONTROL OUTPUT ' /15V 15V I , HIGH LEVEL : ' - _1 _____ - / : -'OE--1 'f/' OUT~~J ~.;, ~ r/,' ./ 1 ENABLING ~'oo..l 1 1 I 1 / /' / / I ..:.....:;+.:.....:.....:...;-lo------+--.:r:..lf..:....~ u) -VOL w ~ g en OATA ' OUTPUl2 1-'00-1 en ct WAVEFORM =1 IS FOR AN OUTPUT WITH INTERNAL CONOITIONS SUCH THAT THE CI/S OUTPUT IS lOW WHEN THE TRI STATE DRIVER IS ENABLED. WAVEFORM "2 IS FDA THE OPPOSITE CONDITION w z a: oCD en o ~ ct Q ct @ 14-09 ST39 BUS EXPANDER TEST LOAD CIRCUIT Type for All resistors values are tYPical and In ohms NOTES A. C L includes probe and iig capacitance. B. All diodes are lN916 or lN3064. DC ELECTRICAL CHARACTERISTICS PARAMETER VIL VIH VIC VCC = 5V ± 5%, O°C ~ T A ~ 70°C TEST CONDITIONS Input voltage Low High Clamp 2.0 -1 IlL IIH lOS ICC Short circuit output current Supply current VCC = 4.75V VCC = 5.25V Path delay Data tpd Control V .55 2.4 uA VCC = 5.25V VIL = .5V VIH = 5.25V AC ELECTRICAL CHARACTERISTICS tpd UNIT Max V VCC = 4.75V 10L = 16mA 10H = -3.2mA PARAMETER LIMITS Typ .8 Output voltage Low High Input current Low High VOL VOH Min TO DOX DIX KifE (out) MCLK (out) SC (out WC (out) < 10 -250 100 -40 mA mA 200 VCC = 5V ± 5%, O°C ~ T A ~ 70°C, CL = 300pF FROM TEST CONDITIONS DIX DOX. ME (in) MCLK (in) SC (in) WC (in) SmontiCs 14-D10 Min LIMITS Typ Max UNIT ns 15 15 8T39BUS EXPANDER VOLTAGE WAVEFORMS CONTROL PATH DELAY (THREE-STATE OUTPUTS DATA PATH DELAY TIMES INPUT c w ~ a: o OUTPUT CONTROL Il. a: o z (J u) w IN PHASE OUTPUT WAVEFORM 1 ~ PHL WAVEFORM 2 OUT OF PHASE OUTPUT I- < oCI) tpLH . t.3V --- [) VOH 1.3V VOL CI) < ell w Z a: o en 8T58 TRANSPARENT BUS EXPANDER ABSOLUTE MAXIMUM RATINGS CI) o ~ c< < @ PARAMETER Vee VIN Va TA TSTG Power supply voltage Input voltage Off-state output voltage Operating temperature range Storage temperature range RATING UNIT +7 +5.5 +5.5 o to +70 -65 to +150 Vdc Vdc Vdc °C °C NOTE Includes tri-state leakage. AC ELECTRICAL CHARACTERISTICS Vee = 5V ± 5%, O°C:5 TA:5 70°C, CL = 300pF LIMITS PARAMETER TO FROM TEST CONDITIONS UNIT Min tpd tpd Path delay Data Control DOX DIX DIX DOX ME(OUT) MCLK(OUT) SC(OUT) WC(OUT) ME(JN) MCLKUN) SC(JN) WC(JN) toe Data Output Enable DIX DOX tod Data Output Disable DIX DOX ME(JN) SC(JN) WC(JN) ME(JN) SC(JN) WC(IN) SmnotiCs 14-D11 28 15 Typ Max 15 ns 15 ns 56 ns 8T58 TRANSPARENT BUS EXPANDER PARAMETER TEST CONDITIONS Min LIMITS Typ UNIT Max V,L V,H Vie Input voltage' Low High Clamp -5mA at Vee min -1 VOL VOH Output voltage Low High Vee = 4.75V 10L = 50mA 10H = -3.2mA .55 IlL IIH Input current Low 1 High 1 Vee =c 5.25V V,L = .5V V,H = 5.25V los lee Short circuit output current Supply current Vee = 4.75V Vee = 5.25V V .8 2.0 V 2.4 /loA <10 -250 100 -40 mA mA 200 VOLTAGE WAVEFORMS PROPAGATION DELAY TO THREE-STATE OUTPUTS PROPAGATION DELAY TIMES OUTPUT CONTROL INPUT WAVEFORM 1 IN PHASE OUTPUT WAVEFORM2 TEST LOAD CIRCUIT TYPICAL APPLICATION USING 2 BUS EXPANDERS TO CREATE 33 1/0 PORTS PLUS WORKING STORAGE TEST POINT SI Cl . (SEE NOTE 1 '1_ t2 BUS EXPANDER BUS EXPANDER 110 PORT Address 6 Ali resistors values are typical and in ohms. WORKING STORAGE NOTES 1. el includes probe and jig capacitance. 2. All diodes are 1N916 or 1N3064. 110 PORTS SrnnOliCS 14-012 110 PORTS BIC BOC USER DATA c w ~ a: oa. a: o o ~ Chapter 15 THE NATIONAL SEMICONDUCTOR PACE AND INS8900 iii w ~ g CI) CI) ct 011 w Z a: o III CI) o :i: ct c ct @ PACE was developed by National Semiconductor as a single-chip implementation of the multi-chip IMP-16. Since it was the first 16-bit, single-chip microprocessor, PACE is the first 16-bit microprocessor described in this b o o k . ' , As might be expected of an early entry product. PACE had a number of problems - both in design and fabrication technology - which limited its acceptance. Therefore the INSS900 was recently introduced by National Semiconductor. The INS8900 is a redesigned, NMOS PACE, with internal logic problems resolved. In this chapter we will describe both PACE and the INS8900. Specifically. we will identify the problemsfaced by a PACE user. which have been eliminated in the INSS900. PACE and the INSS900 are 16-bit microprocessors because they handle data in 16-bit units. In many ways. however. the internal architecture of PACE and the INSS900 have an S-bit orientation: this is something you should keep in mind while reading this chapter. because it does result in PACE and the INSS900 having program execution speeds that are comparable to. rather than being significantly faster than. the S-bit microprocessors we have described in earlier chapters. The only current manufacturer for PACE and the INSS900is: NATIONAL SEMICONDUCTOR. INC. 2900 Semiconductor Drive Santa Clara. CA 95050 There are agreemen.ts between Rockwell-International and National Semiconductor and between Signetics and National Semiconductor to exchange microcomputer technical information and to produce each other's products. At the present time. neither Signetics nor Rockwell International has elected to second source PACE or the INSS900. As shown in Figure 15-1. a typical PACE microcomputer will consist of a mixture of special-purpose PACE support devices and standard device~. The PACE microcomputer devices described in this chapter consist of: • The PACE CPU • The System Timing Element (STE), which generates clock signals for PACE and the system. • The Bidirectional Transceiver Element (BTE), which converts the MOS-Ievel PACE sign'als to TTL-level signals for other devices. The ,BTE is 8 bits wide. The Microprocessor I nterface Latch Element (M I LE), which provides an 8-bit" bidirectional latched interface between the PACE System Bus and external devices, is described in Volume 3. The INSS900 needs a clock generator: a 2 MHz crystal and a 74C04 inverter are recommended. Otherwise. there are no special'INSS900 support devices: in fact. you can easily use any NMOS support devices described in Volume 3 with the1NS8900. Specifically. the STE and BTE devices cannot be used with the INSS900. because they provide MOS-to-TTL signal level conversions for PACE. The MILE can be used with either PACE or the INSS900. PACE requires +5V. +SV and. -12V power supplies. The +SV is a substrate voltage requirement of the CPU and can be derived from the +5V power using a few discrete components. Therefore. a system can be implemented using only two primary power supplies: -+5V and -12V. The INSS900 also uses three power supplies: + 12V. +5V and -SV. ------PACE/INS8900 POWER SUPPLY EXECUTION SPEED The INSS900 uses a 500 nanosecond clock to provide typical instruction execution times in the range of S to 20 microseconds. PACE (lPC-16A/520D) uses a 750 nanosecond clock to provide typical instruction execution times in the range of 12 to 30 microseconds. 15-1 Before making direct comparisons of these instruction execution times with those of other devices. however. note carefully that because of the 16-bit architecture of PACE and the INS8900. it may take many instructions on another microcomputer to perform the same operations as a single INS8900/PACE instruction. MOS level signals are input and output by PACE. TTL leve'l signals are input and output by the INS8900. PACE/INS8900 LOGIC LEVEL P-channel silicon gate. MOS/lSI technology is used with PACE. N-channel MOS technology is used by the,INS8900. . . . PACE AND INS8900 MICROCOMPUTER SYSTEM OVERVIEWS Figure 15-1 concep~ually illustrates a PACE system. Figure 15~2 conceptually illustrates an INS8900 system. As with any mini~"or microcomputer system, the CPU outputs data. address. a'nd control signals. In the case of PACE and the INS8900. the data and address signals use the same bus lines; therefore. they are said to be multiplexed. Timing'signals needed by PACE ~re generated' by the System Timing Eleme~t (STE). PACE signals are all MOS level; the STE therefore generates two sets of timing signals; one s~t are IVIOS.level for PACE, the other set are TTL level. for external logic. SYSTEM TIMING ELEMENT (STE) BIDIRECTIONAL Since PACE signals are MOS level, Bidirectional Transceiver Elements (BTEs). must be TRANSCEIVER present to translate outgoing signals from MOS to TTL levels, and to translate incoming ELEMENT (BTE) signals from TTL to MOS levels. BTEs are quite indiscriminating in the signals they translate: in either directi·on. any signal arriving at an input pin is faithfully reproduced at the corresponding output pin. Control signal options allow a BTE to operate bidirectionally. to drive output signals only. or to place qoth the MOS and TTL outputs in·a high-impedance mode. Since the BTE is 8 bits wide. two BTEs operating bidirectionC!lIyprovide buffering for the 16-bit .AddresslData Bus. A third BTE. operating in the drive-only mode. provides bufferingfonhe PACE control signals,(NADS. ODS. IDS. and Flags). A complete' TTL level bus is created by combining BTE outputs with the TTL level timing signals output by the STE. Remember. though. that the 16 address/data lines are multiplexed. External logic that can demultiplex these lines and that can respond to the PACE timing and control signal logic can connect directly to the TTL level address/data lines. For.example. National Semiconductor provides ROM and RAM devices with on-chip address latches: these devices can interface directly to the TTL level bus. ADDRESS If memory devices or I/O ports are used that cannot demultiplex the address/data lines. you must provide separate logic to perform this function. No special PACE family devices are available for LATCHES this purpose: however. standard logic devices can be used. For example. two hex flip-flop devices AND . and a' q~ad flip-flop device would provide a latched 16-bit Address Bus. Tw08212 I/O ports could. DECODERS also be used to latch the 16 bits of address information. The PACE Address Data Strobe (NADS) - - - - - - signal can be used as the ClK input to the flip-flops or as the STB input to the 8212s. The ~ACE Address Data Strobe (NADS) signal can be used as the ClK input to the flip-flops. In many systems this is the most effective approach since a latched Address Bus allows you to use simpler address decoding techniques to generate memory chip enable, and I/O port select signals. . ' . Figure 15-2 illustrates an INS8900 mi~~o~&mputer system. logic is quite elementary - and equivalent to. that which you would expect with any other microcomputer. Control Bus. Data Bus. and Address Bus lines are buffered using INS8208 bidirectional buffers. These are National Semiconductor standard catalog devices. recommended by National Semiconductor and illustrated in their literature: however. any other buffer would do equally well. The Data/Address Bus is shown being demultiplexed by 8212s to create separate Data and Address Busses. This again is straightforward logic. 15-2 INTERRUPT ANDJUMP . CONDITIONS STE PACE c w ~ a: oa. 1~~~ a: ADDR/DATA o CJ ~ en w CONTROL ~'V" - BTE ~ BTE (2) g en en :~:~ oCt TIL LEVEL TIMING/CONTROL I. IllS w Z a: oIn en o RAM WITH ROM WITH :!E oCt c ADDRESS ADDRESS LATCHES LATCHES oCt @) D TIL LEVEL ADDRESS/DATA -------------...---~ l. ADDRESS LATCHES ,' n •••••• ,.) AND/OR DECODERS : •• ".- ; ~ I I I/O PORT MILE. 8212. 8255 ! ! 4 I I !i "'-_ _...&...."'1 MEMORY WITHOUT ADDRESS LATCHES TIL LEVEL TIL LEVEL ADDRESS ~ ~~v SENSE • CONTROL 7 ADDRESS DATA ~v DATA LINES LINES LINES LINES IN OUT OUT IN/OUT Figure 15-1. A National Semiconductor PACE Microcomputer System 15-3 SENSE LINES IN ( r---------------------------------------------------------------------------------~\. CONTROL BUS nnw, INS8900 TWO INS8208s 74C04 TWO INVERTER INS8212s ROM RAM PERIPHERAL Figure 15-2. A National Semiconductor INS8900 Microcomputer System INS8900 PROGRAMMABLE REGISTERS The INS8900 (and PACE) has four 16-bit Accumulators and a 16-bit Program Counter; these registers may be illustrated as follows: E3 , ACO ACl AC2 AC3 , PC Primary Accumulator Secondary Accumulator Secondary Accumulators and Index Registers Program Counter Accumulator ACO may be likened to a primary Accumulator as described for our hypothetical microcomputer in Volume 1. Accumulator AC1 is a secondary Accumulator. Accumulators AC2 and AC3 are equivalent to a combination of secondary Accumulators and Index registers. Recall from Volume 1. Chapter 6 that an Index register differs from a Data Counter in that the Index register contents are added to a displacement (which is provided by a memory reference instruction) in order to determine the effective memory address. The Program Counter serves the same function in an INS8900 system as it does in our hypothetical microcornputer described in Volume 1 . . Figure 1 5-3 illustrates that part of our general microcomputer system logic which has been implemented in the INS8900 microprocessor. 15-4 Clock Logic Q w ~ a: oQ. a: o o ~ u) w ~ g CI) CI) ct o!I w Direct Memory Access Control Z a: o CD CI) o ~ ct Q ct @ Interface Logic Interface Logic Programmable Timers Read Only Memory I/O Ports Interface Logic I/O Ports Figure 15-3. Logic of the INS8900 Microprocessor INS8900 STACK A Stack is provided on the INS8900 (and PACE) chip. The Stack is 16 bits wide and 10 words deep. The Stack is not a cascade stack. as described in Volume 1. Chapter 6; rather. chip logic maintains its own Stack Pointer to identify the next free Stack word. The Stack Pointer is automatically incremented and decremented in response to Push and Pull operations. Stack Push and Pull operations are initiated by CPU logic during execution of Jump-to-Subroutine (JSR) and Return-from-Subroutine (RTS) instructions. and during interrupt processing. to automatically save and . restore the Program Counter. In addition. the Stack can be used for temporary storage of data or status information. There are instructions which allow you to transfer words between the Stack and any Accumulator. or the Status and Control Flag register. This capability can significantly reduce the number of memory accesses required (thus increasing system speed) and can also reduce read/write memory requirements since intermediate values can be sto~ed on the Stack. Whenever the Stack becomes completely filled or emptied, an Interrupt Request is generated on the INS8900 chip. If you have enabled Stack Interrupts. program execution will be suspended. allowing you to deal with the situation. A Stack Full condition will indicate that it is time to dump data accumulated on the Stack out to read/write memory. 15-5 INS8900 AND PACE STACK INTERRUPTS INS8900 AND PACE ADDRESSING MODES Most INS8900 (and PACE) memory reference instructions use either ,direct or direct, indexed addressing. A few instructions also offer indirect addressing and pre-indexed, indirect addressing. Refer to Volume 1. Chapter 6 for a description of these addressing modes, All memory reference instructions have the following object code format: 15 1" 13 12 11 10 9 8 7 6 5 " 3 2 1 0 I " - -- ~ Bit No. IIII - l -' I I I I I IXIRI I I I I - .--'" ./ Address displacement / Addressing mode selection t . . . ------------- 11 APPROX . .4 CYCLES PROCESSOR STALL + Ie CYCLES t:~::==_D_R_IV_E_N_L_O_W_E_X_T_ER_N_A_L_LY_ _ _- J DURA TION I RESUME NORMAL OPN (;-2(t---"--1~"."".... ~ DRIVEN HIGH EXTERNA:V NHALT (OR USING INTL. PULLUP) o ~~ 3 ClK CYCLES ;::: 5 +te CYCLES .2 4 CYCLES CONT CONTINUE DRIVEN ~t--~""'_-CONTINUE EXTERNALLY DRIVEN BY PACE - - - - -......~__----~ (EXTERNAL CIRCUITS HIGH IMPEDANCE) CONTINUE DRIVEN EXTERNALLY ~: 1. EXTERNAllY GENERATED TTL INPUTS OVERRIDE PACE MOS OUTPUTS. 2, ~ CROSSHATCH INDICATES "DON'T ~ CARE" INPUT STATE. 3. te = DURATION OF EXTEND DURING PACE I/O CYCLES. TIMING ASSUMES NO OTHER EXTENDS AND NO SUSPENDS. Figure 15-10. Timing Diagram for Processor Stall Using NHAL T and CONTIN Signals But we must have a way of determining whether the CPU is going to be using the System Busses. There are several methods of making this determination: we will conceptually examine each of them within the context of three different DMA schemes: 1) DMA block data transfers initiated by the CPU 2) DMA block data transfers initiated by external logic 3) Cycle-stealing DMA transfers From a hardware point of view, the simplest method of implementi'ng DMA in a PACE or CPU INITIATED INS8900 system is to have the CPU initiate block transfers of data. Considerthe following DMA BLOCK approach. The CPU will treat an external DMA controller as a peripheral device and will estabDATA .TRANSFERS lish initial conditions such as starting address. word count. and direction (memory read or write). This information can be passed to the controller by treating its registers as memory locations and using Store instructions to write into the registers. When the required information has been passed. the CPU simply executes a Halt instruction. As we described earlier. when a Halt instruction is executed, the NHAL T control output line from the CPU is driven low (7/8 duty cycle). This signal could thus be used by the DMA controller as an indication that the CPU will not be using the System Bus and the DMA transfer can begin. When the transfer is completed, the DMA controller will use the CONTIN input to the CPU, as shown in Figure 15-9, to terminate the Halt instruction. Normal CPU operation will then resume. 15-16 cw ~ II: o Do II: o(J !: en w ~ g (I) (I) ct all w Z II: o al (I) o ~ ct C ct @ DMA BLOCK DATA TRANSFERS INITIATED BY EXTERNAL LOGIC IN PACE AND INS8900 SYSTEMS Most microprocessors have a Bus Request input signal that can be used by external logic to request access to the System Busses. In a PACE or INS8900 system, the NHAL T input signal can be used to force the CPU into a Processor Stall, as described earlier, and thus free the System Busses for DMA operations. The Acknowledge Interrupt (ACK INTI pulse on the CaNTIN output line shown in Figure 15-10 is then equivalent to a Bus Grant signal, and the DMA controller may begin the data transfer. When the transfer is complete, the CaNTIN line is used as a control input lirie to the CPU to terminate the Processor Stall. CYCLE-STEALING Cycle.-stealing DMA operations typically transfer a single word via the System Busses during a DMA IN PACE' brief interval when the CPU is not using the busses. With this method. CPU operations need AND INS8900 not be stopped: instead. they are only slowed down slightly. or in some cases not affected at SYSTEMS all. In order to implement cycle-stealing DMA, external logic must have a way of detecting those time intervals, when the CPU will not be using the System Busses. There are two ways that this can be accomplished with the INS8900 or PACE CPU. The first method involves the use of the EXTEND input signal to the CPU to suppress or suspend input/output operations: the second method uses a special technique to sense when the CPU is beginning an internal (non-I/O) machine cycle. Earlier we described how to use the EXTEND input signal to lengthen the CPU input/output cycles. The EXTEND signal can also be used to prevent the CPU from beginning an I/O cycle. and thus ensure that the System Busses will be available to external devices for DMA operations. EXTEND USED TO SUSPEND INS8900 AND PACE I/O DURING DMA OPERATIONS Figure 15-11 illustrates both uses of the EXTEND signal. The CPU looks at the EXTEND input signal at internal clock phases T1 and T6. Notice that during I/O cycles the IDS or ODS signal goes high at the beginning of T6 and low at the beginning of T1. If EXTEND is high during T6. then extra clock cycles are inserted after T8: this is the method that would be used to lengthen an I/O cycle. If EXTEND is high during Tl. then extra clock cycles are inserted between T3 and T4: this is the method we would use for DMA operations. The trailing edge of IDS/ODS indicates that the CPU has just completed an I/O cycle and is therefore not using the System Busses at this instant. By setting EXTEND high at this time. we suppress the beginning of another I/O cycle while we use the busses for a DMA transfer. Notice that we are merely lengthening the beginning of the machine cycle. and thus delaying that part of the machine cycle where the CPU might begin I/O activity. We do not know whether the current machine cycle will be an internal machine cycle or an I/O cycle. and we do not care. We have merely stolen the busses by slowing down the CPU. 750 nsec Internal Clock Phase IDS/ODS IT1 ~ I lT1 T2 T3 T4 T5 T6 T7 T8 EEl I I ~ 1.5 JJ.sec . I \.. ~I : T2 T3 E E T4 T5 T6 T7 T81T1 T2 T3 E E E E T4 T5 T61 I I I i-----' CPU I/O CYCLE EXTENDED ONE CLOCK PERIOD AVAILABB~~ CPU I/O CYCLE DELAYED ONE CLOCK PERIOD r.. CPU I/O CYCLE DELAYED TWO CLOCK PERIODS ~l~,---";'-f(.. ....- - - - - - - - 1... 1.5 JJ.sec .)~--. . 2.25 JJ.Sec Figure 15-11. Using PACE EXTEND Signal for Cycle-Stealing DMA 15-17 There are two drawbacks inherent in the EXTEND method of cycle-stealing DMA. Firstwhenever we use the System Busses for a DMA transfer. we slow down the operation of the CPU. Second. we must wait until the CPU has just completed an input/output cycle before we can perform the cycle steal. Since only about one-third of the CPU machine cycles are used for I/O. this means that bLis access for DMA will be quite limited. Both of these drawbacks can' be eliminated if we can find some technique for determining when the CPU is performing an internal (non-I/O) machine cycle. We could then use the System Busses any time that the CPU is not using them (which is more than 60%. of the time) and we could perform the DMA transfer without slowing down CPU operations. We shall now describe' just such a technique. . ' . . CYCLE-STEALING We stated earlier in this chapter that the i.nternal clock phases (T1 through T8) are not availaDMA DURING ble to external logic. However. National Semiconductor data sheets include a figure that shows INS8900 AND circuits for internal. drivers and receivers. A detailed examination of this figure reveals a very PACE INTERNAL interesting and useful fact: the JC 13 (Jump Condition 13) pin on the CPU is intended as an in~ MACHINE CYCLES put signal: but. because of the way in which the receiver for this signal is designed. it also produces an output pulse on the JC 13 pin during every machine cycle. The output pulse occurs during T4 of each machine cycle. and we can use this fact to design a very efficient cycle-stealing DMA arrangement. ~~------------------------------------------------- BUS REQUEST (From DMA Device) D NADS Q ~----------------------~~BUSGRANT (To DMADevice) ClR ClK -- DIVIDE-BY -FOUR ClR NINIT --------------1.......------------..... TClK----------------------------------~~ (From STE) Figure 15-12. Idealized Circuit for Cycle-Stealing DMA During INS8900 and PACE Internal Machine Cycles Figure 15-12 shows a circuit that uses the output pulse provided by JC13 to implement cycle-stealing DMA. Recall . that the CPU sends out a negative-going NADS pulse at T4 of every input/output cycle. This NADS Signal is ANDed in our circuit with an external device's DMA Bus Request and applied to the D input of a flip-flop. The JC 13 output pulse. which also occurs at T4. is inverted via a transistor and applied to the clock input of the flip-flop. Thus. if NADS is high at T4 !indicating that the current CPU machine cycle is not an I/O cycle) the flip-flop will be set if there is a Bus Request present. The output of this flip-flop is then used by external logic as a Bus Grant signal and the DMA transfer can be in- 15-18 itiated. Since we do not know whether or not the next cycle will be a CPU I/O cycle. we must terminate DMA activity on the bus prior to the next T4 time. In Figure 15-12. this is accomplished using a divide-by-four counter. Q w ~ II: oQ. II: o !: (J en w ~ g II) II) The ClK input to the counter is a combination of the Bus Grant signal and the TClK signal which is available from the PACE STE. This results in the timing shown in Figure 15-13. Notice that this scheme makes the bus available for about 7/8 of a machine cycle. or approximately 2.25 microseconds. If you refer back to Figure 14-10 you will noti~e that this is about the same length of time as was obtained by using the maximum duration of EXTEND. So. we have not increased the maximum time available for a DMA transfer. But. we have made two significant gains: DMA transfers can occur more frequently. and these tra'nsfers do not slow down CPU operations. We must add a final note of caution to the descriPtion of this otherwise straightforward DMA technique. There are several critical timing paths in the idealized circuit shown in Figure 15-12. Both the JC13 pulse and the NADS signal occur at T4. although the trailing edge of NADS does os:cur slightly after the trailing edge of JC 13. Therefore. the components used to provide ClK and D inputs to the flip-flop must be selected carefully to ensure that there is not a race condition. Additionally. we have shown the Bus Grant signal being reset at the end of T3. Since the leading edge of NADS occurs at T4. this timing relatio!1ship can be critical. However. if external devices such as address latches and decoders use the trailing edge of NADS. this timing should present no problems. ~ o!I T3 w Z T4 T5 T6 T7 TB T1 T2 T3 T4 T5 T6 T7 TB T1 T2 T3 T4 T5 NClK (TClK·) II: oen II) o ClK (TClK) ~ ~ Q ~ JC13 @ - f '_______...f\...___________ " T1 ' NADS BUS REQ BUS GRANT ~2.25 JLsec for DMA Transfer Figure 15-13, Timing for Cycle-Stealing DMA During INS8900 and PACE Internal Machine Cycle THE INS8900 AND PACE INTERRUPT SYSTEM' The INS8900 and PACE CPUs have complete on-chip interrupt systems. Six separate levels of interrupts are provided: one internal and five external interrupt request inputs, including a non-maskable input. Priority logic is provided on the CPU, and all interrupts are vectored, thus eliminating any polling rE:!quirements. Because of the various ways in which interrupts can be initiated, and also because of a few problems that exist in the PACE interrupt system, we will divide our description of the system into three parts: ' 1) 2) 3) Low priority external interrupts Internal (Stack) interrupts Non-maskable (Level 0) interrupts But first. let us take an overview of the INS8900 and PACE interrupt system. 15-19 IRQ INT ENABLE lEN INTERRUPT LEVEL Q INTERRUPT (TO CPU'S INTERNAL CONTROL CIRCUIT) (IRQ) STACK FULL OR EMPTY INT REO (INTERNAL TO PACE) ----------------~ S IRl R S IR2 PRIORITY ENCODER R INTERRUPT POINTER ADDRESS S IR3 R S IR4 R S IR5 R IE5 Figure 15-14. Internal View o-f INS8900 and PACE Interrupt System 15-20 Figure 15-14 depicts the interrupt logic that is contained on the CPU. The highest priority in-· terrupt request is the non-maskable Level 0 interrupt request, whjch is initiated using the NHALT control input to the CPU. The lowest priority interrupt request is NIR5. Q w ~ a: o0. The Stack Interrupt and each pf the four lower-priority external interrupt requests can be individually enabled or disabled by setting or clearing associated bits (lE1 - IE5) in the Status and Control Flag register. Notice in FiQure 15-14 that these bits are shown as provid- INS8900 AND PACE INTERRUPT PRIORITIES ENABLING AND DISABLING INS8900 AND ~ ing the 'R' input to a latch. The 'S' input to each of these latches is the actual interrupt request PACE INTERRUPTS line. The significance of this is rather subtle. It means that an interrupt request need not supply a continuous low level until it is acknowledged. Instead. any pulse exceeding one PACE clock period will set the associated interrupt· request latch: this ailows narrow timing or control pulses to be used as interrupt request inputs. Note. however. that the 'R' input to the latches overrides the 'S' input. Therefore. if the individual Interrupt Enable flag is reset. it not only prevents the latch from being set by interrupt requests. it will also clear a previously latched request that mayor may not have been serviced. If this logic is not clear to you. you should study the characteristics of the RS flip-flop. en en ct A master interrupt enable (lEN) flag is also provided in the Status and Control Flag register. lEN must be set true to allow any of the latched interrupt requests to be recognized by the CPU. a: o o ~ iii w g oIS w Z a: oen en o ~ ct Q ct The CPU checks for interrupts at the beginning of every instruction fetch. If an interrupt request is present (and enabled). the instruction fetch is aborted. the contents of the Program Counter are pushed onto the Stack. and the master interrupt enable (lEN) is set low. The CPU then loads the Program Counter with the address vector for your interrupt service routine and executes the instruction contained at that address. (We'll describe the address vectors in the next paragraph.) The interrupt request just described requires a total of 28 clock cycles from the time the interrupt is CPU until the time when the first instruction of your interrupt service routine begins execution. INS8900 AND PACE INTERRUPT RESPONSE recognized by the @ Memory locations 000216 through 000816 are used as pointer locations or address vectors. You load each of these locations with the starting address of the interrupt service routine for each interrupt as follows: . MEMORY LOCATION 2 3 4 5 6 7 8 INTERRUPT POINTER FOR INS8900 AND PACE INTERRUPT POINTERS i Stack Interrupt NIR2 NIR3 NIR4 NIR5 Level 0 Program Counter Pointer} Level 0 Interrupt Origin Special case The level 0 interrupt isa special case which we will describe on its own. But first let us look at interrupts in general. When the CPU responds to an interrupt. it loads the Program COUllter with the contents of memory locations 2 through 6. depending on the specific level of interrupt that is being acknowledged. Control is thus vectored to the proper service routine. Suppose. for example. memory locatio'n 4 contains the value 2A3016. If an interrupt request occurring at pin NIR3 is acknowledged. then during the acknowledge process the contents of the Program Counter are saved on the Stack. foliowing which the value 2A3016 is loaded into the Program Counter. Had the value 472816 been in memory locati,on 4. then 472816 would have been loaded into the Program Counter instead of 2A3016. Thus. whatever memo~ ry address is stored in the memory location associated with the interrupt being acknowledged. this address will be loaded into the Program Counter. becoming the starting address for the specific interrupt service routine to be executed. As part of the interrupt response we've just described. the CPU sends out a low-going pulse on INS8900 AND PACE the CQNTIN line. Refer back to Figure 15-10 and associated text for a description of the ACK INT pulse. The last instruction executed by your interrupt service routine must be a ReturnINTERRUPT ACKNOWLEDGE from-Interrupt (RTI) instruction. This instruction sets lEN high to re-enable interrupts. then AND RETURN pulls the top of the Stack into the Program Counter. This returns program control to the point FROM INTERRUPT where it was interrupted. The RTI instruction does not clear the internal Interrupt Request latch; therefore your interrupt service routine must reset the latch (using a Pulse Flag instruction). or the same interrupt request will still be present after the RTI instruction has been executed. Once the latch has been cleared. it can then be re-enabled for subsequent interrupt requests. 15-21 The interrupt sequence does not save the contents of any registers except the Program Counter. If the program that was interrupted requires that the contents of CPU registers be saved and then restored. your interrupt service routine must perform these operations. The CPU's response to a Stack interrupt is as described for external interrupts. However. the interrupt request is generated internally by the CPU chip; it can be caused either by a Stack Full or a Stack Empty condition. Remember that the 1O-word Stack is part of the CPU chip. It consists of an internal RAM and a pointer that can address Stack words 0 through 9. A Stack Empty interrupt request is generated whenever the pointer is at 0 and a Pull instruction is executed. A Stack Full interrupt request occurs when the pointer is at 7 (eight entries on the Stack) and a Push instruction is executed to fill the ninth word. The tenth word of the Stack will then be used as part of the interrupt response to store the Program Counter contents. Unless you intend to extend the Stack out into main memory. your application program will not require a Stack Empty or Full interrupt. These error conditions and can be avoided by careful programming. SAVING INS8900 AND PACE CPU REGISTERS DURING INTERRUPTS INS8900 AND PACE STACK INTERRUPTS interrupts become If your program is treating the Stack Empty and Stack Full interrupts as error conditions. then you can disable Stack interrupts. in which case the full ten words of the Stack are available for nested interrupts and subroutines. Of course. this means that a Stack Full or Empty condition. should it occur. will become an undetected error. with unpredictable consequences. PACE When using PACE. but not the INS8900. there is an additional reason for not using the Stack inSTACK terrupt capability unless you really need it. PACE has an internal circuit problem thatcan cause INTERRUPT improper interrupt response. If a Stack interrupt request occurs at the same time as an NIR3 PROBLEMS or NIR5 interrupt request, the Stack interrupt address vector will be incorrectly accessed from location 0 instead of location 2. The solution recommended in PACE literature is to load both of these locations with the Stack interrupt vector. This apparently straightforward solution is complicated by the fact that location 0 also happens to be the initialization address; whenever the CPU is initialized. the first instruction executed is the one that is contained in location O. Thus. the word in location 0 must serve a dual purpose: 1) It serves as an instruction whenever the CPU is initialized. 2) It serves as an address vector if a Stack interrupt occurs at the same time as NIR3 or NIR4. Here's an example. The object code for a Copy Flags to Register (CFR) instruction is 04001'6. So. if locations 0 and 2 both contain a value of 040016 the problem is solved. Your Stack interrupt service routine would have to begin at memory address 040016. but you would be correctly vectored to that address regardless of whether or not the interrupt error we've just described occurs. On initialization. the first instruction executed would be the CFR instruction: this is not a very useful initialization instruction. but at least no damage is done. For a fuller discussion of this interrupt problem and the solution. refer to PACE literature. Also keep in mind that the problem has been fixed in the INS8900. The non-maskable (Level 0) interrupt cannot be disabled and differs from the other interrupt levels both in the way it is initiated and in the way the CPU responds to it. INS8900 The Level 0 interrupt request is initiated using the NHAL T control input signal in comAND PACE bination with the CONTIN input line. Figure 15-15 shows the timing relationships betNON-MASKABLE ween NHAL T and CONTIN that are required to initiate the non-maskable interrupt. If you (LEVEL 0) compare this figure with Figure 15-10. you will notice that the Level 0 interrupt request and INTERRUPT the Processor Stall begin in exactly the same way; NHAL T is driven low by external logic and held low for some time after a low-going pulse (ACK INT) has been sent out on the CONTIN line. The only difference between the two operations is towards the end of the timing sequence. For a Processor Stall. NHAL T is allowed to return high while CONTIN is still high; for a Level 0 interrupt. the CONTIN line must be driven low by external logic before the NHAL T line is allowed to go high. This critical timing sequence is the only way that the CPU has to differentiate between a Processor Stall and a Level 0 interrupt. Notice that this Level 0 interrupt timing sequence never requires external logic to drive CONTIN high. Therefore. if you're using the CONTIN line for any of its other multiple functions (including the ACK INT output pulse) you can merely tie CONTIN to ground and use NHALT to initiate the Level 0 interrupt. . INS8900 The response ~f the CPU. to the Level 0 interrupt is subtly different from its response to AND PACE other interrupts. These subtle differences are related to the slightly different purpose of a nonLEVEL 0 maskable interrupt versus a normal program interrupt request. A non-maskable interrupt is INTERRUPT typically used only when there is a catastrophic error or failure (such as loss of power) or to impleRESPONSE ment a control panel for program development or debug purposes. Both of these uses require that an asynchronous. unplanned program termination have a minimum effect upon system status; that is. you want to leave behind a picture of the system as it looked immediately before the program termination occurred. 15-22 CD I-> 11 + '. ow u 5 CLOCK CYCLE MIN. $. 3 CLK CYCLES o ct oll w Z CONTINUE DRIVEN II) EXTERNALLY o ~ ,, -, \ ~ J-t- ~ CONTINUE DRIVEN EXTERNALLY CONT I I CONTINUE DRIVEN BY PACE EXECUTION , EXECUTION SUSPENDED 1* I ~ ct ct ~ 5 + te CYC~ES 15 + 2 te'CYCLESQ), ACK. APPROX.2 1/'+te0~ a: oen ~ ~ WD/4 CLOCK CYC LES 0 INTERRUPT RESP. TIME ~ II) II) NHALT (OR USING INTERNAL PULLUP) . I I a: ct (3 ~m til .. , DRIVEN HIGH EXTERNALLY o I- + '. ~DRIVEN LOW EXTERNALLY ~ a: o Il.. en w CD CYCL£Si "• CYCLES1 I INTERRUPT SERVICE STARTS C( o @ NOTES: 1. EXTERNALLY GENERATED TTL INPUTS OVERRIDE PACE MOS OUTPUTS 2. ~ CROSSHATCH INDICATES "DON'T ~ CARE" INPUT STATE. 3. te = DURATION OF EXTEND DURING PACE I/O CYCLES. TIMING ASSUMES NO OTHER EXTENDS AND NO SUSPENDS Figure 15-15. Initiating INS8900 and PACE Level 0 Interrupt Using NHALT and CaNTIN Signals Remember that other levels of interrupts store the contents of the Program Counter or the Stack and reset the lEN flag in the Status and Control Flag register. This sequence obviously alters the "picture" of the CPU. since both Stack contents and Status and Control Flag register contents are changed. To avoid this. the Level 0 interrupt response by the CPU uses an external memory location to store the contents of the Program Counter. Memory location 000716 holds the address of the memory word where the Program Counter will be stored. The contents of the Status and Control Flag register are unaltered. CPU internal circuitry resets an "IRa INT ENABLE flag to prevent another interrupt from being recognized (refer to Figure 15-16), but this is not discernible to you. After the Program Counter has been saved in the designated memory location. the instruction contained in memory location 000816 is executed: this is the first instruction of your Level 0 interrupt service routine. Suppose. for example. that memory location 000716 contains the value FF0016. Following a Level 0 interrupt request. the Program Counter contents will be stored in location FF0016. Following the Level 0 interrupt acknowledge, the actual instruction stored in memory location 000816 is executed. Note that the Level 0 interrupt acknowledge sequence has not altered anything within the CPU that is discernible to you or to a program: the Stack. Accumulators. and Status and Control Flag register are all unchanged. Additionally. avoiding use of the Stack ensures that there will not be a Stack overflow - and in consequence a Stack interrupt will not be generated by this interrupt response sequence. The normal Return-from-Interrupt (RT!) instruction that must be executed at the end of your interRETURN FROM rupt service routine causes the Program Counter to be restored from the Stack. Since the Level 0 PACE LEVEL 0 interrupt sequence does not utilize. the Stack to store the Program Counter, a different techINTERRUPT nique must be used to return control to the interrupted program. First you must execute a Set Flag (SFLG) or Pulse Flag (PFLG) instruction. referencing bit 15 in the Status and Control Flag register. This bit always appears to be set to a '1'. but must be referenced in this case to enable lower levels of interrupts. Next you must ex- 15-23 ecute a Jump Indirect (JMP@) through the location pointed to by the contents of memory location 000716 to restore the original Program Counter contents. PACE LEVEL 0 If a Level 0 interrupt occurs within the 12-clock-cycle period following the recognition of INTERRUPT any other interrupt, PACE will either perform a Processor Stall (which we described earlier) PROBLEMS or PACE will execute the Level 0 interrupt - but using the wrong pointer address. In short. you don't know what might happen under these circumstances. There is a solution for this problem. It requires that external logic allow NHALT to be applied to the PACE CP.U only while the NADS signal is present. provided no Acknowledge Interrupt (ACK INT) has occurred since the last NADS pulse. ACK INT is accompanied by a negative-going pulse on the CONTIN line. Sound complicated? It is. PACE. but not the INS8900. has some Level 0 interrupt circuitproblems. The circuit shown in Figure 15-16 is reprqduced from PACE literature and solves the problem we've just described. We won't attempt to describe here how this circuit solves the problem. Note that this circuit only takes care of Level 0 interrupt problems: if you also want to use NHAL T and CONTIN to cause a Processor Stall. you must design additional external logic. Once again, we must advise that these interrupt system problems exisJ in PACE CPU chips. The INS8900 has none of these problems. . TJiE INS8900 AND PACE INSTRUCTION SET Table 1~-1 summarizes· the INS8900 and ~ACE instruction set. The primary memory reference instructions have typical minicomputer addressing modes. These instructions will also be used as I/O instructions. since external devices are identified via selected memory addresses . ...._ _ _ _ _"" Ln Table 15-1. "direct addressing options" means the instruction can reference memory using any of the direct or direct indexed addressing options described earlier. "Indirect addressing options" Similarly specifies any of the indirect addressing options described earlier. . INS89PO AND PACE DIRECT' ADDRESSING OPTION·S Both Branch and Skip instructions are provided. and each differs significantly from the philosophieSdescribed ill Volyme 1. Chapter 6. There are 16 condition$ that can cause a Branch. as shown in Table 15-3. Notice that three of the conditions are deter~ mined by external inputs JC 13. 14. and 15. If a Branch-on-Condition is true. then the displacement which is added to the Program Coun!~r i~ an 8-bit signed binary number as described in Volume 1. Chapter 6. There are three varieties of Skip-on-Condition instructions. SKNE. SKG and SKAZ compare the contents of an Accumulator to a memory location which is addressed using direct or direct indexed addressing. Based on the resu Its of the comparison. the instruction following the Skip mayor may not be executed. These three instructions are therefore combined Skip ard Memory Reference instructions .. ' ISZ and DSZ· identify a memory location using direct or direct indexed addressing; the contents of the addressed memory location ;are incremented (iSZ) or decremented (for DSZ); if. after the increment or decrement operation the memory location contains a 0 value. then the Skip is performed. The AISZ instruction adds an 8-bitsigned binary number to the contents of an Accumulator; if the result is O. a Skip is performed. ' These Skip instructions will be very familiar to minicomputer programmers. and on most microcomputers are equivalent to a secondary Memory Reference or Immediate Operate instruction. followed by q Branch-on-Condition int struction. 15-24 v LEVEL 0 INTERRUPT REQUEST NOTE: If the Level 0 Interrupt request has not already been reset to a logic '1' level before lACK goes to a logic ',', then lACK should be used to reset the request signal. c w t- ct a: '/.7476 0 FF1 D. a: 0 IDS Q tJ ~ ~--------------~ en w t- ct C3 0 en en CLR ct o/l w Z 8094 INIP a: 0 > ....- - -... !Xl en ~ NHALT - 0 1K ct ct C @ CLR D '/.7476 7404 '/.74L74 FF3 FF2 NADS Q CP Q CP PACE K - SET CLR JVV'V-o 1K +5 CLR D '/.74L74 FF4 lACK (normally '0') . .--------------------------~ Q 74L08 - - -..........- . I ! I ODS· INIP Figure 15-16. Circuit to Prevent Conflicts Between PACE Level Interrupts and Lower Priority Interrupts 15-25 a CaNTIN The following symbols are used in Table 15-1: ACO Accumulator 0 C Carry status CC 4-bit Condition Code described in Table 15-3 D Any Destination register DATA8 8-bit binary data unit DISP(X) Direct or indexed addressing operands as explained in the text. @DISP(X) Indirect addressing operands as explained in the text. EA The effective address generated by the specified operands. 4-bit quantity selecting a bit in the Flag Word. FW Flag Word described in the text. lEN Interrupt Enable status A 1-bit unit determining whether LINK is included in the shift/rotate. L Link status n Seven bits determining how many single bit shift/rotates are performed. o Overflow status PC Program Counter S Any Source register ST Top word of on-chip Stack. Any register.of the Accumulator: ACO, AC1, AC2 or AC3 x Bits y through z of the quantity x. For example, r<7,O> is the low-order byte of the specified register. [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets, then the designated register's contentsare specified. If a memory address is enclosed within the brackets, . then the contents of the addressed memory loc·ation are specified. [[]] Implied memory addressing; the contents of the memory location designated by the contents of a register. A Logical AND v Logical OR Logical Exclusive-OR Data is transferred in the direction of the arrow. Data is exchanged between the two locations designated on either side of the arrow. Under the heading of STATUSES in Table 15-1, an X indicates statuses which are modified in the course of the instruction's execution. If there is no X, it means that the status maintains the value it had before the instruction was executed. 15-26 © ADAM OSBORNE 8r. ASSOCIATES. INCORPORATED . Table 15-1. INS8900 and .PACE Instruction Set Summary . STATUSES TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES C 0 L LD r.DISP(X) 2 [rl-[EA] LD O.@DISP(X) 2 Load any Accumulator. direct addressing options. [ACO]-[EA] « ~ g c: ST r.DISP(X) 2 Load Primary Accumulator. indirect addressing options. [EA]-[rl ~ ST O,(ii)OISP(X) 2 Store any Accumulator. direct addressing options. [EA]-[ACO] LSEX O,DISP(X) 2 Store Primary Accumulator. indirect addressing options. [ACOl-[ EA](sign extended) w U z w c: > c: ::E Q. c Z > c: « 0 ::E w ::E Load a signed byte into Primary Accumulator; extend sign bit into high order byte. Direct addressing options. ADD r,DISP(X) 2 X X w « > c: c: c: I- DECA O.DISP(X) 2 X X c w w u. Q. w 0 SUBB O.DISP(X) 2 X X AND O.DISP(X) 2 OR O.DISP(X) 2 LI r.DATA8 2 JMP DISP(X) 2 JMP @DISP(X) 2 III U Z « Z 0 U iii c: > > c: w c: 0 III o ::E ::E w W ::E ::E- W I- « C W ::E ~ [rl-[ r1+ [EA] Add to any Accumulator. direct addressing options. [ACOl-[ACO]+ 1 EA] ... [C] Add decimal with Carry to any Accumulator. direct addressing options. [ACO]-[ACO]- [EAl_+LC] Subtract from Primary Accumulator with borrow. direct addressing options. [ACOl-[ ACOlA [EA] AND with Primary Accumulator. direct addressing options. [ACO]-[ ACOl V [EAl OR with Primary Accumulator. direct addressing options. [r< 7.0>]- DATA8 (sign extended) Load immediate into any Accumulator. DATA8 is an 8-bit signed binary value. The sign'bit is propagated through 8 high order bits. [PCl-EA Jump by loading the effective direct address into the Program Counter. [PCl-EA Jump by loading the effective indirect address into the Program Counter. Table 15-1. INSS900 and PACE Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES C JSR DISP(X) 2 JSR @DISP(X) 2 ~c W ot -:I OZ ~~ ::EO -8 w f-w otf- 0 L [STJ-[ PCl [PCl-EA Jump to subroutine direct. As JMP direct. but push old Program Counter contents onto Stack. [STJ-[ PCl [PCl-EA Jump to subroutine indirect. As JMP indirect. but push old Program Counter contents onto Stack. CAl r.DATAB 2 [rJ-[ rl +DATAB (sign extended) Complement contents of any register. then add immediate data. BOC CC.DISP 2 If CC true: then [PCl- EA Branch on CC true. as defined in Table 14-3. SKNE r.DISP(X) 2 SKG O.DISP(X) 2 If [rJ ~ [EAl: then [PCl-[ PCl + 1 Skip if any Accumulator not equal. If [ACOl > [EAl: then [PCl-[ PC]+ 1 Skip if Primary Accumulator greater. SKAZ O.DISP(X) 2 o~ Ww ::Ell. ~O Z Z 00 5ZOE otZ a:0 alU w U Z w a:Q.~ ll!i2~ ~(/)f>Ow a: zw oot!!! ::E w ~ If ([ ACOl /I. (EAl) = 0: then [PCl-[ PCl + 1 Skip if AND with Primary Accumulator is zero. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 15-1. INS8900 and PACE Instruction Set Summary ;(Continued) STATUSES TYPE MNEMONIC OPERAND IS) OPERATION PERFORMED BYTES C ci:a: www ........ > cncno (5(5~ ISZ DISP(X) 2 DSZ DISP(X) 2 AISZ r.DATA8 2 RCPY S.D RXCH S.D 2 o L [EA]-[EA]+l If [EA] = 0; then [PC]-[ PC]+l Increment memory. skip if zero. [EA]-[EA] -1 If [EA] = 0; then [PC]-[ PClt: 1 Decrement memory. skip if zero. [r]-[r]+DATA8 If [r] =0; then [PC]-[PC]+l Add immediate to any Accumulator. Skip if zero. DATA8 is an 8-bit signed binary immediate data value. [D]-[S] Move contents of any Accumulator (S) to any Accumulator (0). [D]-[S] Exchange contents of any Accumulators. Ww a: a: RADD S.D 2 x x .a: a:w wo.. RADC S.D 2 x x Ow ~a: RAND S.D 2 (5 RXOR S.D 2 SHl r.n.l r.n.l r.n.l r.n.l 2 2 ....e:(w [0]-[5]+ [D) 8inary add any Accumulator to any Accumulator. [O]-[S1+ [D]+[C] 8inary add with Carry any Accumulator to any Accumulator . [D]-[S] 1\ [D) AND any Accumulator with any Accumulator. [0]-[ S]'" [D) Exclusive-OR any Accumulator with any Accumulator. .... 0 w .... a:cn w a: a:w w .... .... e:( SHR OW wo.. a:0 ROR ~a: ROl 2 2 x X X X Shift any Accumulator left n bits. Simple if 1 = 0; through Link if 1 = 1. Shift any Accumulator left n bits. 'Simple if 1 = O. through Link if 1 = 1. As SHl. but rotate. As SHR. but rotate. Table 15-1. INSg900 and PACE Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES C PUSH r PUSHF PULL r [ST]-[rl 2 Push any Accumulator contents onto Stack. [STl-[FW] 2 Push flags onto Stack. [rl-[ST] 2 PULLF r 2 RTS DISP 2 RTI DISP 2 XCHRS L 2 ~ (J ~ (I) 0 X X X Pull top of Stack into flags. [STl--[r] Exchange contents of any Accumulator with top of Stack. [PC]-[ ST] + DISP Return from subroutine. Move sum of DISP and top of Stack to PC. DISP .is an 8-bit signed binary number. Cf w o .1II. :=) Pull top of Stack into any Accumulator. [FW]-[ST] [PC]-[ ST]+ DISP [IEN]-1 a:: a::. w Return from interrupt Like RTS. but enable interrupts. I- ~ CFR r 2 CRF r 2 SFLG f 2 PFLG f 2 (I) :=) I- ct I- (I) HALT 2 X X X [rl-[FW] Copy flags to any Accumulator. [FW]-[r] Move any Accumulator contents to flags. [FW]-1 Set flag f to 1. (f= 0 to 151. [FW < f>]- 1 for four clock periods Pulse flag f (invert flag status for four clock periods). (1= 0 to 151. Halt The following symbols are used in Table 15-2: aa Two bits choosing the destination register. bb Two bits choosing the Index register cccc Four bits choosing the Condition Code. See Table 15-3. Q ee Two bits choosing the source register. ~ a: ffff w 0 Cl. a: Four bits selecting a bit in the Flag Word. One bit determining whether Link is included in a shift or rotate. 0 nnnnnnn Seven bits determining how many single bit shifts or rotates are performed. ~ PP 8-bit signed displacement en w 00 Eight bits of immediate data ~ x A "don't care" bit xx A "don't care" byte CJ ... gen en ~ oil w Table 15-2. INS8900 and PACE Instruction Set Object Codes z a: 0 MACHINE CYCLES CD INSTRUCTION en OBJECT CODE BYTES 0 ~ ~ Q ~ TOTAL INTERNAL INPUT ADD r.DISP(X) 1110aabb pp 2 4 2 2 AISZ r.DATAB 011110aa 2 5/6 4/5 1 AND O.DISP(X) 101010bb pp 2 4 2 2 BOC CC.DISP 0100cccc pp 2 5/6 4/5 1 CAl r,DATAB 011100aa 2 5 4 1 2 4 3 1 2 4 3 1 @ aa OUTPUT aa CFR f 00000laa XX CRF f 000010aa XX DECA O.DISP(X) l000IObb pp 2 7 5 2 DSZ DISP(X) 101011bb pp 2 7/B 4/5 2 OOOOOOxx 2 - 1 HALT 1 XX ISZ DISP(X) l00011bb pp 2 7/B 4/5 2 JMP DISP(X) 000110bb pp 2 4 3 1 JMP e/lOISP(X) l00110bb pp 2 4 2 2 JSR DISP(X) 000101bb pp 2 5 4 1 JSR ~/lOISP(X) l00101bb pp 2 5 3 2 LD r.DISP(X) llOOaabb pp 2 4 2 2 LD O.@DISP(X) 101000bb pp 2 5 2 3 LI r,DATAB 010100aa 2 4 3 1 aa LSEX O,DISP(X) 101111bb pp 2 4 2 2 OR O.DISP(X) 10100tbb pp 2 4 2 2 15-31 1 Table 15-2. INSS900 and PACE Instruction Set Object Codes (Continued) MACHINE CYCLES INSTRUCTION OBJECT CODE BYTES TOTAL INTERNAL INPUT 2 6 5 1 2 4 3 1 2 4 ,3 1 011000aa 2 4 3 1 XX 0000llxx 2 4 3 1 2 4 3 1 2 4 3 1 2 4 3 1 2 4 3 1 2 5+3n '4+3n 1 2 5 + 3n 4+3n 1 2 6 5 1 2 5 4 1 2 6 5 1 010110aa eexxxxxx 2 4 3 1 0011ffff 2 5 4 1 2 5 + 3n 4+ 3n 1 2 5 + 3n 4+3n 1 2 5/6 3/4 2 2 7/8 5/6 2 2 5/6 3/4 2 2 4 2 1 1 2 4 1 2 1 2 4 2 2 2 6 5 1 PFLG f 00llffff PULL r 01100laa OUTPUT Oxxxxxxx XX oool00xx PULLF XX PUSH r PUSHF XX RADC S.D 0011101aa eexxxxxx RADD S,D 011010aa eexxxxxx RAND S,D 010101aa eexxxxxx RCPY S,D 010111aa eexxxxxx ROL r,n,l 00 1oooaa nnnnnnni ROR r,n,l 00100laa nnnnnnni RTI 011111xx PP RTS l00000xx PP RXCH S,D 011011aa eexxxxxx RXOR S,D SFLG f lxxxxxxx SHL r,n,l 001010aa nnnnnnni SHR r,n,l 001011aa nnnnnnni SKAZ O,DISP(X) 101110bb pp SKG O,DISP(X) l00111bb PP SKNE r,DISP(X) l111aabb PP ST r,DISP(X) 1101aabb PP ST O,@lDISP (X) 101100bb PP SUBB O,DISP(X) 100 1OObb PP XCHRS r ooo111aa XX *AII instructions may take additional cycles if Extend Read and Extend Write are impleme!"ted. 15-32 Table 15-3. Branch Conditions for INS8900 and PACE BOC Instruction Condition Code (CC) Mnemonic 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 STH.: REOO PSIGN BITO BIT1 NREOO BIT2 CONTIN LINK' lEN CARRY NSIGN OVF JC13 JC14 JC15 c w ~ a: o D. a: o o ~ en w ~ g II) II) ct ol:I w z a: o Condition Stack Full (contains nine or more words). (ACO) equal to zero (see Note 1). (ACO) has positive sign (see ,Note 2). Bit 0 of ACO true. Bit 1 of ACO true. (ACO) is nonzero (see Note 1). Bit 2 of ACO is true. CONTIN (continue) input is true. LINK is true. IE~ is true.' CARRY IS true. (ACO) has negative sign (see Note 2). OVF is true. Jc 13 input is true (see Note 3). JC 14 input is true. JC 15 input is true. aJ II) o NOTES: ~ ct c ct 1. 2. If selected data length is 8 bits. only bits 0 thrQlJgh 7 of ACO are teste~r Bit 7 is sign bit (instead of bit 15) if selected data length is 8 bits. @ 3. JC13 is used by INS8900 and PACE Microprocessor Development System and is not accessible during prototyping. . THE BENCHMARK PROGRAM For PACE, our standard benchmark program adopts this modified form: LOOP LD LD RCPY LD ST AISZ AISZ DSZ JMP RCPY ST 2.IOBUF O.@TABLE O.~ 0.0(2) 0.0(3) 2.1 3.1 10CNT LOOP 3.0 O.@TABLE LOAD I/O BUFFER ADDRESS INTO AC2 LOAD ADDRESS OF FIRST FREE TABLE BYTE MOVE TO AC3 LOAD NEXT BYTE FROM I/O BUFFER STORE IN NEXT TABLE BYTE INCREMENT AC2 INCREMENT AC3 DECREMENT t/O BUFFER LENGTH. SKIP IF ZERO RETURN FOR MORE BYTES MOVE AC3 CONTENTS TO ACO RESTORE ADDRESS OF FIRST FREE TABLE BYTE In order to take advantage of INS8900 and PACE indirect addressing. three memory locations are reserved on page 0 as follows:' .', ; 10BUF holds the beginning address of the I/O buffer. TABLE 10CNT holds the address of the first free byte in the permanent data table. holds the number of data words in the I/O buffer. . III 15-33 Memory. as organized for the benchmark program will look like this: Memory Addresses IOBUF ----!.~ TABLE-~"'~ 0010 0011 ~ME:~~Y } YYYY .' IOCNT--....... 0012 0013 . 0014 • • .. · . ··: '''' Data on Base Page ' • ; • ~S"" of I/O .,If" I • S-S"" Dot. of i ; '. I yyyy ~ T.bl. ""t f,.. won! of 0." T• .,. Suppose the benchmark program rules arbitrarily require that a displacement be stored in the first word of the data table. and that this displacement be added to the address of the first word of the data table in order to compute the address of the first free data table word: ( ~ DISP)! F;,,, d ... "bl. worn j ~~ F;"t f, .. dot... ble worn Now the instructions: LD RCPY O.@TABLE 0.3 LOAD ADDRESS OF FIRST FREE TABLE BYTE MOVE TO AC3 must be replaced by these instructions: LD LD RADD 3.TABLE 0.0(3) 0.3 LOAD BEGINNING ADDRESS OF DATA TABLE LOAD DISPLACEMENT TO FIRST FREE TABLE WORD ADD DISPLACEMENT TO AC3 The new displacement must be restored to the first data table word, The instructions: RCPY ST 3.0 O.@TABLE MOVE AC3 CONTENTS TO ACO RESTORE ADDRESS OF FIRST FREE TABLE BYTE 15-34 must be replaced by these instructions: c w ~ oQ. a: a: o LD CAl RADD RCPY LD ST O,TABLE 0,1 0,3 3,0 3,TABLE 0,0(3) LOAD BEGINNING ADDRESS OF DATA TABLE IN ACO FORM TWOS COMPLEMENT SUBTRACT ACO FROM AC3 TO FORM DISPLACEMENT MOVE DISPLACEMENT TO ACO LOAD BEGINNING ADDRESS OF DATA TABLE IN AC3 SAVE DISPLACEMENT IN FIRST FREE TABLE WORD Forcing an INS8900/PACE programmer to conform to programming logic suited to some other microcomputer's instruction set only proves that the two microcomputers have different instruction sets. u ~ en w THE PACE DP8302 SYSTEM TIMING ELEMENT (STE) (/) The STE is a very elementary clock device used with PACE. but not with the INS8900; it accepts inputs from an external crystal and generates the MOS clock signals for PACE. plus a pair of TTL-level clock outputs that can be used for synchronizing system operations, Figure 15-17 illustrates the pin assignments of the STE, ~ U o (/) ct ell w Z a: oIn (/) o :E ct c ct Xl @ X2 . 1 16 2 3 15 14 4 STE 13 EXTC 5 DP8302 12 TCLK TCLK· 6 11 7 10 8 9 GND PIN NAME - --.. VCC CK CLK NCLK . VGG NCK imkRIPTION LCK LCK· TYPE Xl, X2 External crystal connections Input CLK, NCLK D~mped MOS clocks to PACE Undamped MOS clocks to PACE Output CK, NCK TCLK, TCLK· TTL clocks to microcomputer system Output Output EXTC External oscillator option Input LCK, LCK· Non-overlap capacitor connection VCC ' VGG Power and Ground Figure 15-17. DP8302 System Timing Element (STE) Pins and Signals The frequency of the MOS clocks output by the STE is one-half the input crystal frequency. The STE is designed to operate with a 2.6667 MHz crystal. The MOS clock frequency is thus 1.3333 MHz which results in a clock period (tp) of 750 nanoseconds (tp = lit); this is the optimal clock period for the PACE CPU. STE CLOCK FREQUENCY Two pairs of MOS clock outputs are generated by the STE; NCLK!NCLK* and NCK!NCK*, The first pair of outputs contain a 25 n series of damping resistor; typically, these outputs will be used in circuit board layouts where the STEto-PACE interconnect lines are less than two inches. The other MOS outputs, NCK and NCK*, are undamped, and you can select some other value of series damping resistors that might be better suited for your particular board layout. In addition to the +5V and -12V power supplies typically needed with MOS devices. the PACE CPU has a third power supply requirement: a substrate bias voltage (VB B) of +8V must be applied to the CPU chip, Since it is unlikely that any other devices in your microcomputer system would require this voltage level. the need for a third external system power source can be eliminated by providing a voltage converter circuit. Figure 15-18 shows a circuit that generates the required VBB voltage level; the circuit requires only a few components and uses one of the STE's TTL clock outputs as a 'charge pump' for the circuit. 15-35 GENERATING THE PACE SUBSTRATE BIAS VOLTAGE PACE 23 i+8V) STE VBB O.lpF TCLK* lN914 ~ lN914 1°' "' - LM103 3V - + 5V Figure" 1Q-18. Circuit to Generate Substrate Bias Voltage (VBB) for PACE CPU I . ~. ", c: ".. i ' . THE PACE BIDIRECTIONAL TRANSCEIVER ELEMENT (BTE) The DP8300 BTE is an 8-bit device th'at provides an interface between the PACE MOS-Ievel signals and the TTL-level signals required' by other devices in a microcomputer system (the BTE is not used in INS8900 systems). If you refer to Figure 15-1 at the beginning of this chapter. you will see that a typical PACE microcomputer system requires three BTEs: two are used to buffer the CPU's 16 address/data lines. and the third is used as a TTL driver for the CPU's control signal output,s (NADS. ODS. IDS. F11 - F14). Figura 15-19 shows the pin assignments fOr the BTE. MBI/O 02 MBI/O 03 MBI/O 04 - .:' i,- MBI/O 05 ; '. -; .. 2 3 22 21 4 5 . 6 7 20 19 BTE 8 17 MBI/O 07 9 10 16 WBO" GNO 11 14 PIN NAME 15 12 - -.. 18 MBI/O 06 MBI/O 00 - 07 .. 24 . 23 1 MBI/O 00 MBI/O 01 .' 13 -- VCC BOI/O 00 BOI/O 01 BOI/O 02 BOI/O 03 BOI/O 04 BOI/O 05 BOI/O 06 BOI/O 07 - CEl CE2" STR* OESCRIPTION MOS Bus Oata Lines BOI/O 00 - 07 TTL Bus Oata Lines CE1. CE2*. Mode Control Signals TYPE Input/Output . Input/Output Input STR*. WBO* VCC·GNO + 5V Power and Ground Figure 15-19. BTE Signals and Pin Assignments 15-36 Table 15-4 summarizes the operating modes of the BTE. o w ~ a: oa. BTE MODE CONTROL SIGNALS WBD" is the main mode control signal; when this signal is low, the other control signals are ignored and the BTE simply converts the MaS signals from the CPU into TTL-level output signals. The TTL outputs have a high fan-out capability and can service up to thirty 50 millial11pere loads. The BTE used to buffer the PACE control signals normally operates continuously in this 'drive-only' mode (Mode 11 and is kept in this mode by simply connecting the WBD" signal to ground. en w The BTEs used to buffer bidirectional (address/datal lines must be switched back and forth between Modes 1 and 2; Mode 1 is used for CPU data output and Mode 2 for CPU data input. The simplest way of accomplishing this is to continuously enable the CE1, CE2", and STW controls by connecting them to appropriate logic levels (+5V or ground) 'and then use the WBO" signal for directional control. For example, in a PACE system, the lOS signal from the CPU could be used as the input to WBO". Ouring a PACE data input cycle, lOS will go high at the appropriate portion of the cycle arid place the BTE in Mode 2: lOS is low at all other times and the BTE will operate in Mode 1. g Table 15-4. PACE BTE Truth Table a: o lJ ~ ~ en en ct CONTROL INPUTS MOOE ~ w Z MOOE OESCRIPTION # CE1 CE2* STW WBO" 1 X X X 0 Receive MaS signals and drive TTL signals 2 1. 0 O· 1 Receive TTL signals and drive MaS signals 0 0 0 1 0 1 0 1 1 1 0 1 1 1 a: oCD en o ~ ct o ct @ 3 4 X = X X Outputs in high-impedance state On positive-edge transition of STR*, latch into Mode 2 or 3 as determined by state of CEl and CE2* don't care +5V 15 CE11---'" BTE 10S-----'" WBO* BUS GRANT _ _ _. ._ _ _ _.....;.1.. -t CE2* 13 STR * 1------. -Figure 15-20. Signal Connections to Control BTE in a OMA System 15-37 In a DMA.or mUltiprocessor we wiil need to use BTE Mo~e 3 to place the BTE outputs in a high-impedance state and thus free the System Busses for use by other devices. In such a system an externally generated Bus Grant signal could be used to place the BTE in Mode 3. Figure 15-20 illustrates one method ot-doing this: whenever, the BUS GRANT signal is high. the BTE is in Mode 3. At other times the IDS signal operates as we've just described to sJ.,itch the BTE back and 'forth between Modes 1 and 2 . ' . . ' .I I • • • • • • 1 .~ • !. . The fourthBTE mode .uses a negative-to-positive transition on the. STR* input to latch the state of,CE1 and CE2*, and then places the BTE in either Mode 2 or Mode 3. This latch mode function might be useful when ~heBTE is used as a simple input buffer: For example. ina system with multiplexed address/data lines (such as PACE1'address outputs could be applied to CEl and CE2*.and an address strobe signal (such as NADS) connected t'o STW. then~ when the BTE is selected by the appropriate address bits. the trailing edge of the strobe signal will gate TTL'data through the BTE and·apply the data to the MOS lines of the CPU. When the BTE is not selected (addressed!. its outputs will be in the high ifTlpedance state (Mode 3). ' USING OTHER MICROCOMPUTER SUPPORT DEVICES WITH THE PACEAND.INS8900· The INS8900 CPU has numerous control signals which allow general purpose microcomputer support devices to be included in an INS8900 system. .. .. . Let us see how 8080A support devices might be used with the INS8900 CPU. First, we'll take an overview of the general CPU-to-device interface that all the 8080A family of devices expect. '. . All of the 8080A family devices require that address information (or enabling/select signals derived froin the address lines) be valid during the data transfer (read/write) portion of an input/output cycle. Recall that the INS8900 data lines are multiplexed: at the beginning of an input/output cycle. the data lines are used to output address information: the address information is then removed and the data lines are used for the actual input or output of data during . the latter portion of the I/O cycle. Thus, the first thing we must do to interface the INS8900 to an 8080A family device is to demultiplex the INS8900 address/data lines. (This must also be dOhe even with the MILE device. described in Volume 3. which was specifically designed to operate with the INS8900 CPU. There are several different approaches that we can use to accomplish the required demultiplexing. DEMUL TIPLEXING THEINS8900 ADDRESS/DATA LINES The most obvious way is to use D-type flip-flops or data registers with the INS8900 NADS signal as the clock pulse. Here are some of the standard 7400 family devices that might be used: ·7475 Double 2-Bit Gated Latches with Q and Q Outputs ·7477 Double 2-Bit Gated Latches with Q Output Only • 74100 Double 4-Bit Gated Latches ·74166 Dual 4-Bit Gated Latches with Clear • 74174 Hex D-Type Flip-Flops with Common Clock and Clear • 74175 Quad D-Type Flip-Flops with Common Clock and Clear Some of these devices require that the NADS signal be inverted to provide the necessary clocking signal. Remember. though. that PACE address information is valid during both the leading edge (high-to-Iow transition) and trailing edge' (Iow-to-high transition) of NADS: this generally Simplifies the demultiplexing operation. In many systems you will not need to latch all16 bits of address information since it would be an unusual application that required all of the 64K of address space that this provides. There will usually be some tradeoff between system address requirements (how many system devices require a latched Address Bus) and the type and amount of address' decoding required. When a fully latched Address Bus is provided. then simpler non latched address decoders can be: used. In fact. often address bits can then be used directly as device select signals. or simple AND/OR gate combina-, tions can perform the decoding. The alternative method of demultiplexing the address/data lines is to use address decoding devices that are' clocked by the NADS signal and provide latched outputs. These latched outputs can then' be used as the device/chip select signals during I/O cycles. Many systems will use some combination of· a fully latched Address Bus and simple or latched address decoders. In the discussions that follow, we will not generally describe in detail the method used to obtain the required addressing or select/enabling signals, since the method used is so dependent on the particular system that you are designing. . 15-38 Q w ~ a: oCI. a: o u Once the INS8900 address/data lines have been demultiplexed, the only major conINS8900 CONTROL siderations we are left with are to ensure that the input/output control signals are of SIGNAL POLARITY the proper polarity, and to verify that there are no timing problems. We will see that CONSIDERATIONS generally the INS8900 I/O control signals must be inverted to operate with the 8080A family of devices. although the 8212 offers us a choice of using the IDS and ODS signals. in either their original or inverted form. Now we will provide a few specific examples of how devices from the 8080A family can be used with the INS8900 CPU. In our firstexample the 8212 I/O Port is used as a simple input port by the INS8900 CPU. The interconnections required are shown in the following figure: ~ enw ~ 8 000 CI) CI) 010 Data to INS8900 CPU (System Bus) c( IB w Z a: THE 8212 USED AS A SIMPLE INPUT PORT IN AN INS8900 SYSTEM Data from external logic 007 017 o CI) o ID ~ c( c Derived from ----~0{]1 Address Lines Dsi 10S-~--~" OS2 8212 c( @ (from INS89(0) Tie MO to Ground. Now STB clocks latches and NAOS (from INS8900) STB DSi. OS2 enable buffers. MO . CLR -- NINIT -------~ Here, the INS8900 Address Strobe signal (NADS) is inverted and used as the STB input to the 8212. Since MD is tied to ground, the STB signal clocks the data into the 8212: this will occur every time the INS8900 performs an input/output cycle, but the latched data will only be placed on the System Bus when the 8212 is selected. We accomplish device selection by applying a negative-true decoded address signal to the DS1 input and the'n using the INS8900 IDS strobe signal as the DS2 input. Now, whenever the proper address is decoded, the IDS signal will cause the data that was previously latched by NADS to be placed on the System Bus for input to the INS8900. The timing would look like this: NAOS STB 010 - 017 OS2 (IDS) r---, DOO - 007 Latched data output onto System Bus 15-39 Notice that the data from external logic will be latched whenever NADS occurs. The actual selection of the 8212 and input of the latched data to the INS890Q might not occur for quite some time. Frequently. this arrangement will be completely acceptable. If not. then an input-with-handshaking arrangement. which we will describe next. might provide a better solution. Before we proceed to our next example, let us make one more general comment about interfacing devices to the INS8900 CPU. The INS8900 is a 16-bit microcomputer: it can transfer 16 bits of parallel data in a single input or output cycle. All of the other devices that we will be discussing are 8-bit devices. Frequently, you may not need the full width of the 16-bit Data Bus when transferring data between the CPU and external logic. In these cases, you can simply connect the data lines to/from the support device to the less significant data lines (DO - 07) of the INS8900 System Bus, as we have shown in our first example. Masking of the unused. more significant data bits would then be handled under program control. When you are going to utilize the full 16 bits of the Data Bus, you merely connect two 8-bit devices in parallel, as described in more detail for the CP1600 in Chapter 16. One device would be connected as we've already described; the data lines of the other device would then be connected to the more significant bits (08 - 015) of the System Bus. All other connections to the two devices (device select signals, strobe signals, etc.) would be identical. In this example, we will use the 8212 interrupt request signal INT to establish an input port with handshaking. The connection diagram is very similar to our first example: 000 Data to INS8900 CPU Derived from 010 007 017 .. · · (System Bus) Address Lines · -- - ,.. OS; 8212 STB - THE 8212 USED IN AN INS8900 SYSTEM FOR INPUT WITH HANDSHAKING 0 ata from external logiC External logic strobes d ata into latches IDS (from INS8900) DS2 to INS8900 Interrupt or INT Tie MD to Ground. Now STB clocks latches and DSi. DS2 enable buffers MD 1- - Jump Condition Input Pin Here, the device select signals are the same as in our first example. However, instead of using the INS8900 NADS signal to clock data into the latches, we will require external logic to input the STB signal when it has data ready. When the data has been latched, the 8212 will output the INT signal, which will be used as the input to one of the INS8900 CPU interrupt request lines (NIR2 - N1R5) or Jump Condition inputs (JC13 - JC15). The CPU will then execute a service routine program that will include an instruction to read the data from the input port. This instruction will send out the input port's address. thus generating the DS1 Signal. and then gate the latched 15-40 data onto the System Bus when the IDS signal is generated. When the latched data is read out of the 8212. the INT signal returns high to complete the transaction. This sequence is summarized by the following timing diagram: Data latched by external logic Q 010 - 017 w ~ a: oD.. STB ---~ a: o u ~ enw ~ g CI) CI) ~ all w Z a: o CD CI) 0s1 DS2 (IDS) DOO - 007 ....--.... ......--.... ...... ........ ........ ............. ----~ o ~ Interrupt request or Jump condition input ~ ~ Q ~ ~ ~ ~ onto System Bus to INS8900 CPU @ Using the 8212 as an output port in an INS8900 system requires a simple reversal of the connections we have described in the two preceding examples, and we will now use the ODS (Output Data Strobe) signal from the INS8900 instead of the IDS signal. 010 000 Data from INS8900 CPU (System Bus) Data to external logic 017 007 8212 Ds'i ODS (from INS8900) STB DS2 Select Signal MD iNT derived from Address Lines THE 8212 USED AS AN OUTPUT PORT IN AN INS8900 SYSTEM - Select signals generated by external logic To external logic I I I : ~ to INS8900 interrupt lines or JCinputs 15-41 ______ JI When the output port's address is sent out and decoded from the Address Bus. one input to the AND gate is enabled. The ODS signal then goes high to generate the STS signal and latch the contents of the system Data Bus into the 8212. This will cause the TN'f signal to go low and inform external logic that data has been loaded into the output port. The external logic will then generate the DS1 and DS2 signals to gate the data out of the latches. When the data has been gated out. the Tl\fF signal will return high. This low-to-high transition could be used as an interrupt request or jump condition input to an INS8900 to enable output of new data. Notice that if we continuously enable 'the 8212 outputs by tying DS1 to ground and DS2 to +5V, then whenever the INS8900 loads a new data word into the latch, it will be immediately output to external logic. This approach may be more advantageous in some applications. Although the 8255 Programmable Peripheral Interlace (PPl) is a .more complicated device than the 8212, interfacing the 8255 to an INS8900 CPU is no more complicated (from a hardware point of view) than the INS8900-to-8212 interfaces we've described. This is due to the programmability of the 8255; mode control is performed by you~ program instead of by hardwired signals. Let us look at an example to illustrate this point:' 8255 PPI DEVICES USED IN AN INS8900 SYSTEM ------" ....~---......~DO To/From INS8900 CPU (System Bus) ...........- - -......-.407 ------.0(,,1 CS Decoded Select signal derived .from Address Bus . From latched { Address Bus ,';~;; CPU 8255 ------4~ ------4... :X>--OI ( I \ IDS To/From Extemal Logic AO A1 R5' ~ ODS~..• ~ __ R __~~ RESET ____~ NINIT The CS signal selects the 8255 and this signal would typically be the output of an address decoder. The AO and A 1 inputs select one of the three I/O ports (A, B or C) or the 8255 Control registers. The RD and WR control signals are obtained by simply inverting the IDS and ODS signals from PACE. A generalized timing diagram for input/output operations would look like this: NADS OS-AO-A' ~ .. . _ _ _ _.... Select Device and Port Select ~ ? IDS (ODS) _ _ _ _ _ _ _ _ _ _ RoIWffi ~ Data transferred 15-42 If you refer back to the detailed description of the 8255 in Chapter 4, you will see that Port C can be used to provide handshaking signals for 1/0 control. Since these signals are fully described in Chapter4, we will not discuss the various possibilities here. Generally, these signals would be used with the INS8900 CPU in the same ways that we earlier de' scribed for the 8212·INT signal. c w ~ a: oDo a: o CJ !: enw l- e:( o oCI) CI) e:( all w Z a: o III CI) o ~ e:( c e:( @ If two 8255s are used i~ parallel to provide 16-bit I/O ports, there is one special consideration beyond the gene'ral rules that we discussed earlier. Recall that mode control of the 8255 is accomplished by writing data into one 8-bit Control register within the device. When wired in parallel, one 8255 would be connected to bits 0 - 7 of the system Data Bus, and the other 8255 would be connected to bits 8 - 15. Therefore, when we' send out a 16-bit control word from the INS8900 CPU to establish the desired mode of operation, the upper and lower bytes of the word must be identical. ~------------~ From a hardware point of view, interfacing either of these devices to an INS8900 CPU is no different than interfacing an 8255 PPI to the INS8900. All we need to do is invert the IDS and ODS signals from the CPU to obtain RD and WR (or lOR and lOW) signals, and provide chip select and latched address bits for input to the devices. All other interfacing and usage considerations are software functions and are described in Chapter 4. We will not describe them here since those portions of the device descriptions apply regardless of the CPU being used. - TWO 8255 DEVICES USED FOR 16-BIT I/O PORTS WITH INS8900 THE 8251 USART AND 8253 PROGRAMMABLE COUNTER/TIMER USED IN INS8900 SYSTEMS INS8900 AND We will conclude our discussion of the use of S080A devices in INS8900 systems by 8080A SYSTEM comparing INS8900 System Bus signals with those of 8080A systems. This comparison will be a useful guide for interfacing any 8080A device to an INS8900 system. Table BUSSES 15-5 is a summary of INS8900 System Bus signals and the corresponding signals availaCOMPARED ble in 8080A systems. Two separate columns are provided for 8080A signals: the first applies strictly to th-e 8080A' CPU; the right-hand column refers to the signals present in a typical three-chip 8080A system consisting of the CPU, an 8228 System Controller, and an 8224 Clock Generator and Driver. , " Since we have already discussed these signals in preceding paragraphs, we won't perform an item-by-item analysis of the table. Nonetheless, there are a few signals in this table that do need additional explanation. We have included the INS8900 BPS signal in the I/O Control Signal group although it is not the type of signal you would normally classify within this group. However, you will recall that when the BPS input is high, the INS8900 operates in a Base-Page-Split mode; base page then consists of the top 128 words of memory and the bottom 128 words of memory. In our earlier discussion of the BPS signal. we described how this mode can be used to simplify addressing of I/O devices. If you refer back to that discussion, you will see that by doing a little address decoding we can come up with a signal that will tell us when the INS8900 is addressing an I/O device (as opposed to memory). Let us call this decoded signal 1/0 Device' (/00). Now, we can combine this decoded signal with IDS and ODS as shown below to generate signals equivalent to the 8080A 1I0R and 1I0W signals. 1/00 ----------------8 ~---------------------I/OW ODS--------------------~~ ___- J And if we invert-the 1/00 signal we can generate the 8080A MEMR and MEMW signals. IDS ---------------1-""""'" rl-----------------------MEiMR I/OO-----f ODS~-------------~__~ 15-43 ~-----------------------MEMVV One other portion of Table 15-5 requires some explanation. Notice that we have not drawn a line to separate the I/O control signals from the DMA-Related Signals. We've done this intentionally because there is some overlapping of functions with some of these signal'3. For example. the INS8900 EXTEND signal can be used either to extend I/O cycles or to suspend I/O to allow DMA operations. We've also compared the INS8900 NHAL T output signal to the 8080A WAIT signal. This comparison is valid if limited to the CPU Halt state initiated in either system by a Halt instruction. However. in 8080A systems the WAIT signal is also an acknowledgement to 'the READY or RDYIN input signals. There is no comparable EXTEND acknowledgement signal in PACE systems. The 6800 family includes many devices that might be useful in INS8900 systems. Unfor6800 SUPPORT DEVICES NOT tunately. all of these devices have one common requirement which effectively makes them incompatible for use in an INS8900 system. That requirement is the enabling input signal E COMPATIBLE which. as we mentioned in Chapter 9. should more accurately be described as a synchronizing WITH INS8900 signal. In 6800 systems. E is usually generated by ANDing one of the primary system clock signals (4)2) with the Valid Memory Address signal (VMA) from the 6800 CPU. The clock period of the resulting E signal can be no less than one microsecond. The clock signals (CLK and NCLK) used in PACE systems. however. cannot have a clock period greater than 850 nanoseconds. and therefore cannot be used to simulate the 6800 4>2 signal. Therefore. we cannot recommend using 6800 family devices in an INS8900 system. Table 15-5. Comparing INS8900 System Busses to 8080A System Busses INS8900 SYSTEM SIGNALS SYSTEM BUS 8080A CPU SIGNALS 8080A SYSTEM (CPU. 8228. 8224) SIGNALS Bidirectional Data Bus 000 - 015 (16 Bits) 00- 07 (8 Bits) DBO - DB7 (8 Bits) Address Bus 000 - 015 Address information must be demultiplexed from Data Bus AO-A15 AO-A15 Control Bus I/O Control Signals NADS Strobe signal used. by external logic to demultiplex address from Data Bus , IDS ODS, WR - MEMW 'and I/OW - EXTEND READY RDYIN NHALT (output) WAIT WAIT NHALT and CaNTIN inputs CaNTIN (ACK INT output) HOLD HOLD HLDA HLDA NIR2 - NIR5 CaNTIN (ACK INT output) Interrupt Signals MEMR and I/OR DBIN BPS DMARelated . Signals - - - INT DO and SYNC· INTE Non-maskable Interrupt (CaNTIN and NHALT inputs) BUSEN INT iNTA INTE - - Initialize NINIT Jump Condition Inputs JC13 - JC15 - - Control Flag Outputs F11 - F14 - - RESET 15-44 RESIN DATA SHEETS The following section contains specific electrical and timing data for the following devices: c w ~ a: oa.. PACE CPU INS8900 PACE STE PACE BTE a: o u ~ en w ~ o !J) (; !J) oct all w Z a: o m !J) o ~ oct c oct @ 15-01 PACE CPU ~~ :::~~ ..... os ID' ODS 'II-fIt I f-lr~ I 'I. !lItl": .,." I·I .., ~ ~ (IInnl I : r::~r .," I ~ L _____ ~ ~C!!A~A~ , 0, "·'''''lCTlO.' ,-II .. _____ I ..J fi FIGURE 4. PACE Driver and Receiver Equivalent Circuits external clock timing PACE requires non-overlapping true and complemented clock inputs as shown in Figure 5. Refer to Electrical Characteristics for timing specifications. 'p - CLOCK PE RIOO 'NOVA - 'Nove' CLOCK NONOVERLAP 'WCLK • 'WNCLK'= CLOCK WIDTH FIGURE 5. External Clock Timing We reprint data sheets on pages 15-02 through 15-017 by permission of National Semiconductor Corporation. 15-02 PACE CPU c w ~ oa.. a: a: o u ~ For systems utilizing mel110ries with access times greater than 2 clock periods it may be desirable. to use the EXTEND input to lengthen the I/O cycle by mUltiples of the clock period. Timing for this is shown in Figure 9. In the case of either input or output operations, the extend· should be brought true prior to the end of internai phase 6. The timing shown in Figure 9 will provide the minimum extend of one clock period. Hold· ing EXTEND true for h additional clock periods longer will cause an extension of n + 1 clock periods. In DMA or multiprocessor systems it may be desirable to prevent I/O operations by PACE when the bus is in use by another device. Thi$ may be done by using the EXTEND signal immediately following an IDS or ODS as shown in Figure 10. Alternatively, the extend timing of Figure 9 may be used, as the extend function occurs independent of whether there is an I/O operation, that is, whenever the internal clock phase 6 occurs. u) w l- e:( (j oen en tlDCKr(RIODS e:( all w Z a: o en en o ~ e:( FIGURE 6. Initialization Timing c e:( @ "'00 ,usa DATA NO'I.SttNIs,,.,.t"'ftc::t4tIWlh41011cl_".ncl"',nputl Int...... ch.cII:' ......r.sh_n'or''' ...''c:tOllly.lh'y.'.not,.,.tllbl' .. IIIIIIUy ·V,IiII",ult •• ··V.-2.lSV.tlhlll"n.,'IDt1c"I .. ,"put ··V'JiII MUII'I .. hlll,wI II t., Vss - II It thllllml htul hm,nl.llows'ol pull up 1111111110r 11m. comtlnt) Figure 7. Address Output and Data Input Timing FIGURE 8. Data Output Timing 15-D3 '1 PACE CPU EXTRA CLOCK CYCLE(SlOUE INTERNAL . I , " TO EXTEND I ClDC'P:;lS:~r--L-~ Cl'_~~~~I'ADDDR:TS:~_ _...tt:'-'J:l' PACE DUTPU!S~ _ _ _---'''''''''''--_ _ _''''''' PACE 'ULLUP TRA.SISTDR-+_ _ _ _..;.;.;.._ _ _ _ _ _H"'" INPUT_L-_ __ DATA ~!.!.!E._ _ __.E~~~~~~~~~~~~~~~m- ounUT DA,. - +_ _ _ _ _ _ _ _---'-'"4 --1-' .. IZ1 _ DDSIIDS-+_ _ _ _---'_ _ _ _-'"4 1-'," EXTEND W"~ -I f--'ES FIGURE 9. Extend I/O Signal Timing absolute maximum ratings All Input or Output Voltages with Respect to Most Positive Supply Voltage (VBB) Operating Temperature Range electrical characteristics +0.3V to -21.5V b _65°C to +150 C 300°C Storage Temperature Range Lead Temperature (Soldering, 10 seconds) (TA = o°c to +70°C, vss = +5V ±5%, vGG = -12V ±5%, VBB = vss + 3V ±0.5V) PARAMETER CONDITIONS I MIN I MAX I UNITS OUTPUT SPECIFICATIONS;, ! 000-015, Fll::-F14, OOS, lOS, NAOS (These are open drain outputs wh ich may be used'to drive OS3608 sense amplifiers, or,may be used with pull· down resistors to provide a ~8ltage output.) . Logic "1" Output Current (Except Fll-F14) Logic "1" Output Cu~rent, Fll-F14 (Note 7) Logic "0" Output Current VOUT = 204V VOUT = 204V VGG ~ VOUT ~ VSS NHALT, CONTIN (Low Power TTL Output.) LogIc "1" Output Voltage Logic "0" Output Voltage lOUT = -650pA lOUT = 300pA .. -1.0 . -0.7 -5.0 -5.0 ±10 mA mA pA 004 V V 2.4 INPUT SPECIFICATIONS 000-015, NIR2-NIR5, EXTENO, JC13-JC15, CONTIN, NINIT, NHALT (These are TTL compatible inputs.) (Note 2) Logic "1" Input Voltage Logic "0" Input Voltage Pullup Transistor "ON" Resistance (000-015) (Note 3) Pullup Transistor "ON" Resistance (all others) Logic "0" Input Current (000-015) Logic "0" Input Current (NHALT, CONTIN) Logic "0" Input Current (all others) Capacitance, Input and Output (except clocks) BPS (This is a MOS Level Input.) (Note 4) . Logic "1" Input Voltage Logic "0" Input Voltage Logic "1" Input Current .' CLK, NCLK (These are MOS Clock Inputs) Clock "1" Voltage (Note 5) Clock "0" Voltage Input Capacitance (Note 6) Bias Supply Current VGG Supply Current VSS Supply Current VSS-l VSS-7 VIN = VSS-1V VIN = VSS-1V kf2 -1.8 -12 -3.6 20 mA mA mA pF VSS-l VGG VSS+0.3 VSS-7 100 V V pA VSS-l VGG 30 VSS+0.3 VGG+ 1 150 100 40 85 V V pF pA mA mA VIN = VSS-1V 15-04 V V kf2 5 VIN=Oo4 VIN = 004 VIN=O.4 VIN = VSS, fT = 500 kHz VBB = VSS +3.0V tp = .65J.is, T A = 25°C tp = .65ps, T A = 25°C VSS+0.3 VSS-4 7 PACE CPU EITUCLOCK tYCU(SIDUl TO UTI NO INTERNAL ClOCK'N"SE cw ~ a: oD. a: o o ~ u) eLK fIIADS IDS/ODS w ~ g CI) CI) FIGURE 10. Suspend I/O Signal Timing ~ CI/:I w Z a: oCD CI) o ~ ~ c ~ @ TIMING SPECIFICATIONS (See Figures 5 to 10 for additional timing information.) CLK, NCLK (See Figure 5) (Referenced to 10% and 90% Amplitude) Rise and Fall Time (t r , tf) Clock Width (tw CLK,tW NCLK) Clock Non·Overlap (tNOVA, tNOVB) Clock Period (tp) EXTENO Individual Extend Ouration Extend Setup Time (tES) (Note 10) Extend Hold Time (tEH) (Note 13) Propagation Oelay (tOO) NHALT, CONTIN (Note 9) NAOS, lOS, DOS, 000-015 (Note 8) 000-015 Input Setup Time (tOS) (Note 11) Hold Time (tOH) (Note 12) Turn-on or Turn·off Time of Pullup Transistor (to C) (Note 13) F11-F14 Pulse Flag (PFLG) Pulse Width NINIT Initialization Pulse Width NIR2-NIR5 Input Pulse Width to Set Latch 10 300 5 .65 50 375 .8 2 • p.s ns ns 200 100 ns ns 100 20 CL = 20 pF VOUT= 2.4V 200 0 150 4tp -300 8 1 ns ns ns p.s ns ns ns 4tp +300 ns clock periods clock periods Note 1: Maximum ratings indicate limits beyond which permanent damage may occur. Continuous operation at these limits is not intended and should be limited to those conditions specified under de electrical characteristics. . Note 2: Pullup transistor provided on chip (See Figure 4.1 • . Note 3: Pullup transistors on JC13, JC14, JC15 are turned on one out of 8 clock intervals. Pullup transistors on 000-015 are turned on during last clock period of Input Data Strobe (IDS). Other pullup transistors are on continuously when in data inp'ut mode. Note 4: Pulldown transistor provided on chip. Note 5: Clamp diodes "nd series damping resistors may be required to prevent clock overshoot. Note 6: Capacitance is not constant and varies with clock voltage and internal state of processor. Note 7: For VSS;' VOUT;' 2.0V output current is a linear function of VOUT. Note B: Delay measured from valid logic level on clock edge initiating change to valid current output level Note 9: Delay measured from valid logic level on clock edge initiating change to valid voltage output level. Note 10: With respect to rising edge of NClK. (See Figure 9 and 10.1 Note 11: With respect to falling edge of ClK. (See Figure 7.1 Note 12: With respect to the valid "0" level on the falling edge of Input Data Strobe (IDS), (See Figure 7.1 Note 13: With respect to valid logic level of appropriate clock. . 15-05, INS8900 Absolute Maximll11 Ratings Voltage at Any Pin with Resepct to Most Negative Supply (VBB) . . . . . . . . . . . . . . . . -0.3 V to +20 V Operating Temperature Range . . . . . . . . . . . . . . . . O°C to +70°C Storage Temperature Range . . . . . . . . . . . . . . . . _65°C to +150°C Lead Temperature (soldering, 10 seconds) . . . . . . . . . . . . +300°C Electrical Characteristics (TA = o°c to +70°C, VSS= ov, VOO = +12V ± 5%, Vct = +5V ± 5%, VBB = -BV ± 5%) .. Parameter Symbol Coriditions Min Max Units OUTPUT SPECIFICATIONS VOH VOL 000-015, Fll-F14, OOS, lOS, NAOS (These are low·power Schottky-compatible push-pull outputs.) Logic "1" Output Voltage Logic "0" Output Voltage lOUT = -500JlA lOUT = 900iIA 2.4 VOH VOL NHALT, CaNTIN (low-power Schottky outputs) Logic "1" Output Voltage Logic "0" Output Voltage lOUT = -250JlA . lOUT = 600JlA 2.4 0.4 V V 0.4 V V INPUT SPECIFICATIONS VIH VIL IL IlL IlL 000-015, NIR2-NIR5, EXTENO, JC13-JC15, NINIT, CaNTIN, NHALT (low-power Schottky inputs) Logic "1" Input Voltage Logic "0" Input Voltage Input Leakage Current (except NHAL T, CaNTIN, JC13-JC15) Logic "0" Input Current, NHALT, CaNTIN (Note 2) Logic "0" Input Current, JC13-JC15 (Note 2) VIH VIL IIH BPS (This is an MaS level input.) Logic "1" Input Voltage Logic "0" Input Voltage Logic "1" Input Current (Note 3) VCIL VCIH CIN CLKX (This is an MaS level input.) Clock "0'; Voltage Clock "1" Voltage Input Capacitance 100 Average Supply Current (VOO) (Note 4) tp = 500ns, TA 100 icc Average Supply Current (VCC) (Note 4) tp 10 mA IBB Average Supply Current (VB B) VBB=.-BV -200 JlA 2.4 -1.0 V ss . :;; V IN":;; V CC + 1 VIN = 0.4 V VIN = 0.4 V VIN = 13.6V 15-06 = 25°C = 500ris, TA = 25°C VCC+ 1 +O.B 40 -7.0 -3.0 V V. JlA mA mA V V VOO -1 VOO+ 1 -1.0 +O.B 750 JlA -1.0 +O.B VOO-1 VOo+ 1 20 V V pF mA INS8900 Tming Specifications Symbol Min Conditions Parameter Max Units C w ~ a: t r , tf D. tp 0 tCLK, tNCLK CLKX Rise and Fall Times (Note 5) (Referenced to 10% and 90% amplitude) Clock Period Pulse Width (Referenced to 50% amplitude) tES tEH EXTEND Individual Extend Duration Extend Setup Time (Note 6) Extend Hold Time (Note 6) t001 Propagation Delay NHALT, CONTIN (Note 7) 0 a: CJ ~ en w l- e:( g en en e:( all w Z 0 III en 0 tos tOH 30 ns 500 tp/2 - 5% 650 tp/2 + 5% ns ns 2 70 120 J.lS ns ns 200 ns 200 ns CL = 40pF, 1 low·power Schottky load CL = 40pF, 1 INS820810ad NAOS, IDS, ODS, 000-015 (Note 7) t002 a: 5 000-015 Input Setup Time (Note 6) Hold Time (Note 8) 50 0 ns ns ~ tFW F11-F14 Pulse Flag (PFLG) Pulse Width 4tp - 300 C e:( tNW NINIT Initialization Pulse Width 8 tp @ tlRW NIR2-NIR5 Input Pulse Width to Set Latch 1 tp e:( 4tp + 300 Note 1: Maximum ratings indicate limits beyond which permanent damage may occur. Continuous operation at these limits is not intended and should be limited to those conditions specified under DC electrical characteristics. Note 2: NHALT, CONTIN, and JC13-JC15 logic "0" input currents specified when the internal chip loads are putting out a logic "1." Note 3: Pull·down transistor provided on chip. Note 4: Supply currents measured with 40 pF and INS820810ads. Note 5: Clamp diode and series damping resistor may be required to prevent clock overshoot. Note 6: Measured with respect to appropriate valid logic level of CLKX. Note 7: Delay measured from valid logic level on CLKX edge initiating change to valid output voltage level. Note 8: With respect to the valid "0" level on the falling edge of Input Data Strobe (IDS). Note 9: Typical load circuit: INS8900 R L = 3.6k (3.3k for testing) --CL = 40pF VREF = 1.72V -..., '~T RL III " u .. ~J±" Note 10: Typical output delay versus load capacitance CL for load circuit in Note 9: Note 11: Typical VOO supply current versus temperature. 125.0 • 250 100.0 • zoofo ~ C 150 .! fo 100 50 - I I I 120 140 - - - Q Q iZ5'C I 75.0 • -~ 50.0 • I I Z5.0 I ~ I I 160 110 too (n.) ZOO 0 ZZO 15-07 Z5 75 50 TEMPI'C) 100 ns INS8900 Tming Wavefonns Figure 1. External Clock Timing (CLKX) POWER AIIO CLOCKS ...- - PO'iVER AND CLOCKS STABLE J..-. NIlIIT CLOCK PEifos MINIMUM-.I . I· 2( 16-24 CLOCK PERIOOS L IIAOS_ Figure 2. Initialization Timing INTERNAL CLOCK PHASE CLKX ADDRESS DATA lADS PACE OUTPUT j 1-100 I 1-4I0RESS OATA VALID 100 I1-100 I ~ I \ \ -4J ~ OUTPUTS ACTIVE' ~ - 1-100 --0 OUTPUTS HIGH IMPEDANCE • II I 1 = _ I I I P U T BUFFER DISABLED IDS ----------------------------~ 'VIII MUST IE AT THE CORRECT LOGIC LEVEL AT THIS TIME. 1I0TE: SIGIIALS ARE REFERENCEO TO VAllO LOGIC LEVELS ON CLOCK INPUT. INTERNAL CLOCK PHASES ARE SHOWN FDA REFERENCE DNL Y: THEY ARE NOT AVAILAILE EXTERNALLY. Figure 3. Addrea Output and Dlta Input Timing 15-08 1--100 'L.I.- INS8900 Tining Wavefonns cw ~ a: oQ. a: u o ~ en w ~ g en en (continued) INTERNAL CLOCK PHASE 'DD;;~~__ \'-----'_I- - O "'~tC ..,. Ilil Ilil =:!I II f-'DD OUTPUT DATA LAST DATA VALID ---+l I-IDD ODS _ _ _ _ _ _ _ _ _ _ _ _ _.I:oI§J~ oCt \~1 \'--~ I OATA VALID II -t1 I-IDD Io;:®~ __________ Figure 4. Oau Output Timing ~ w Z a: oal en o ~ oCt C oCt @ EXTRA CLOCK, CYCLES DUE TO EXTEND INTERNAL CLDCK PHASE E E CLKX ADDRESS DATA-+_ _ _~ ' NADS PACE HIGH IMPEDANCE DUTPUTS~------A;.;;C~T;.;IV.:.E-----~ DATA DISABLED ~:~I~ INPUT_~--~--1~~L-----~~~~~~~~~~~~~~~~~~~~~~-OUTPUT DATA "-1'-------------.. . . DATA VALID '-1 DDS/IDS __I--_ _ _ _ _ _ _ _ _ _ _......'" IES Figure 5. Extend I/O Signal Timing EXTRA CLOCK1 CYCLES DUE TO EXTEND E E INTERNAL CLOCK PHASE CLKX DATA f!a LAST 110 DATA ' NEXT ADDRESS DATA ~ NADS IDSIODS ~ .. t-IEH ---1 t--IES EXTEND ...j f-IES Figure 6. Suspend I/O Signal Timing 15-09 ~ INS8900 Tming Wavefonns (continued) r- > 11 + Ie CYCLES ~'""I•. . . - - - - > . + Ie CYCLESCD.:::J:------t I_----DRIVEN LDW EXTERNALLY-----....- NHALT CONTIN NDTES: 1. EXTERNALLY GENERATED TTL INPUTS OVERRIDE PACE DUTPUTS. 2. ma CROSSHATCH INDICATES "DON'T CARE"INPUT STATE. 11 + Ie CYCLES~ ~ I-- APPROX 4 CYCLES - - - _ . I...--DRIVEN HIGH EXTERNALLY (OR USING INTL PULLUP) NHALT /--> 5 + Ie CYCLES@.j..->4 CYCLES-! CDNTIN CD I I ---l !-APPROX 2% + Ie CLOCK CYCLES I_CONTINUE DRIVEN_I I- com~~~frl~EN ..f-o·o-----(E-XT-E~~:rl~I~~~~:~~~yl~~~~A-N-C-E)----.-j· EXTERNALL y NOTES: 1. EXTERNALLY GENERATED TTL INPUTS OVERRIDE PACE OUTPUTS. 2. ~ CROSSHATCH INDICATES "DON'T CARE"INPUT STATE. ~ ~ z tJ ;( .! IZ 0.4 1--f---+--1f---+l'--4---I 1 a: a: a: ' - r-TA ~ 2S·C TA- 70·C ex: ::> u 02 I- ::> lA-O.lC il Z I en w I I O'----'---=:=...J'---"--........--' ~ 0.5 g 1.0 1.5 2.0 2.5 o 3.0 0.5 1.0 INPUT VOLTAGE (V) MOS BUS U) U) 1.5 2.0 2.5 3.0 1.2 INPUT VOLTAGE (V)' MOS BUS c/I MOS Bus Current Threshold sr-----r--r---~~ II: 3.5 o ~ ~ to < Q < I- ~ @ I- 2.5 e I 0.5 o O'---'---'---'--~l..-~ 160 180 200 1.1 220 12 INPUT CURRENT (~A) MOS BUS u .. ::> ::> e 1.3 1.4 VCC' SV STANDARD OUTPUT LOADING 1.5 1.6 0'--_J.L.c.c..,--_l..---.-.Jl..-~ o 1.7 INPUT VOLTAGE (V) TTL BUS High-Level Output Voltage Output Current TTL Bus Vcc -SV TA -25°C 02 0.3 0.4 0.5 Low-Level Output Voltage Output Current MOS Bus VI ;( . .. .! z a: a: ..... u '\ :::> r\. :::> e ; \ = '" :;: 0.1 LOW·LEVEL OUTPUT VOLTAGE (V) TTL BUS Output Current vs Output Voltage High Impedance State TTL Bus VI " ex: ex: ::> I- I 1.0 :::> 140 IZ TA =2S·C :::> 120 ;( I 2.0 :- 1.1 .! TA' O·C 1.5 1.7 VI I TA' 70·C 3.0 U) 1.6 Low-Level Output Voltage Output Current TTL Bus 50 ....--r--r--r---'I7T--' TTL Bus Threshold Characteristic oIII 1.5 INPUT VOLTAGE (V) MOS BUS < w Z 1.4 1.3 '\ o ~ o -10 -20 -lO 0'-----'.......- - ' ' - - - - ' - - - ' - - - ' -40 -1 HIGH LEVEL OUTPUT CURRENT (mA) TTL BUS 4.0 l.5 l- 3.0 .'" e > 2.5 I- ::> Output Current VI Output Voltage High Impedance State MOS Bus I- VCC ~ SV TA-2S·C- '" .! I- 1.5 > 1.0 = :;: '" Z '\. ::> e 10 ;( 2.0 .... ex: ex: ::> r\. u I- '\. ::> I- 0.5 e -10 '\. o -4 -B -12 -5 ::> r\. o 0.1 -16 -20 -2 HIGH LEVEL OUTPUT CURRENT (mA) MOS BUS OUTPUT VOLTAGE (V) MOS BUS 15-017 01 D.l 0.4 LOW LEVEL OUTPUT VOLTAGE (V) MOS BUS OUTPUT VOLTAGE (V) TTL BUS High-Level Output Voltage VI Output Current MOS Bus ~ o 10 0 0.5 Chapter 16 c w ~ oQ. a: THE GENERAL INSTRUMENT CP1600 a: o CJ ~ iii w ~ g II) II) « olI w Z a: o m II) o :!: « c « @ The CP1600 and the TMS 9900 were the first two NMOS 16-bit microprocessors commericially available. Even a superficial inspection of the CP1600 shows it to be more powerful than the National Semiconductor Pace (or 8900). yet the CP1600 is not widely used. This is because General Instrument does not support the CP1600 to the extent that National Semiconductor supports Pace. or most manufacturers support their 8-bit microprocessors. General Instrument's marketing philosophy has been to seek out very high-volume customers; General Instrument supports low-volume customers only to the extent that this support would not require substantial investment on the part of General Instrument. From the viewpoint of the low-volume microprocessor user. Generallnstrumenfs marketing philosophy is unfortunate. The CP1600 is an ideal microprocessor for the more sophisticated video games that are appearing. and its rich instruction set and capable architecture make it an ideal choice for data processing terminals and home computer systems. However. due to its limited support. potential low-volume CP1600 customers are likely to choose another equally capable product. Three CP1600 parts are available, differentiated only by the clock speeds for which they have been designed. The CP1600 requires a 3.3 MHz. two-phase clock and generates a 600 nanosecond machine cycle time. The CP1600 requires a 4 MHz. two-phase clock and generates a 500 nanosecond machine cycle time. The CP1610 requires a 2 MHz. two-phase clock and generates a 1 microsecond cycle time. In addition to the CP1600 microprocessors themselves, the CP1680 Input/Output Buffer (lOB) is described in this chapter. Additional support devices for the CP1600 may be found in Volume 3. The sole source for the CP1600 is: GENERAL INSTRUMENT Microelectronics Division 600 West John Street Hicksville. New York 11802 There is no second source for the CP1600. General Instrument has a policy of discouraging second sources for its product line. The CP1600 is fabricated using NMOS ion implant LSI technology; the device is packaged as a 40-pin DIP. Three power supplies are required: +12V. +5V and -3V. THE CP1600 MICROCOMPUTER SYSTEM OVERVIEW Logic of our general microcomputer system which has been implemented by the CP1600 CPU is illustrated in Figure 16-1. Observe that the CP1600 requires external logic to create its various timing and clock signals. Some bus interface logic is shown as absent because a number of devices must surround the CP1600; these include: 1) 2) 3) 4) An address buffer. since data and addresses are multiplexed on a single 16-bit bus. Buffer amplifiers to provide the power required by the type of memory and liD devices that will normally be connected to a CP1600 CPU. A one-of-eight decoder chip to create eight individual control signals out of three controls output by the CP1600. A one-of-sixteen multiplex chip to funnel sixteen external status signals into the CP1600 if using external branches. 16-1 Were you to compare Figure 16~ 1 with an equivalent figure for a low-end microprocessor such as the SC/MP (which is described in Chapter 3). the CP 1600 might appear to offer fewer logic functions: but within the functions it does provide. the CP1600 provides considerably more logic and program execution capabilities. Where low-end microprocessors choose to condense. onto a single chip. simple implementations of different logic functions. high-end products such as the CP1600 choose to provide more devices - with greater capabilities on each device. Clock Logic ", ::P~~g;a;r,~~b(~ . ··.T.i~e~s· ..' ,.·• ·•. •· • .• .·•. ·. • . • · • . • ·• • ·1 CP1600 CPU 1;/>.1 CP1680 I/O Buffer Read Only Memory Figure 16-1. Logic of the CP1600 CPU and CP1680 I/O Buffer 16-2 CP1600 PROGRAMMABLE REGISTERS The CP1600 has eight 16-bit programmable registers, which may be illustrated as follows: cw ~ a:: o D. a:: o u ~ RO Rl R2 } Data Counters R3 R4 } Data Counters with auto-increment R5 Stack Pointer R6 Program Counter R7 General Purpose registers en w ~ g (I) (I) < ell w 2 a:: The way in- which the registers illustrated above are used is unusual when compared to ,other microcomputers described in this book. All eight 16-bit registers can be addressed as though they were general purpose registers: however. only Register RO has no other assigned function, We may therefore look upon Register RO as the Primary Accumulator for this CPU. ' , om Registers Rl. R2. and'R3 serve as general purpose registers. but may also be used as Data Counters. o In addition to serving as general purpose registers. R4 and R5 may be used as auto-incrementing Data Counters. Memory reference instructions that identify Register R4 or R5 as holding the implied memory address will cause the contents of Register R4 or R5 to be incremented - after the memory reference instructions have completed execution. (I) ::?! < c < @ Registers R6 and R7. in addition to being accessible as general purpose registers. also serve as a Stack Pointer and a Program Cou nter. respectively. Having the Stack Pointer accessible as a general purpose register makes it quite simple to maintain more than one Stack in external memory: also. you can easily address the Stack as data memory using the Stack Pointer as a Data Counter. Having the Program Counter accessible as a general purpose register can be useful when executing various types of conditional branch logic. While having the Stack Pointer and the Program Counter accessible as though they were general purpose registers may appear strange. this is a feature of the PDP-ll minicomputer - and is a very powerful programming tool. CP1600 MEMORY ADDRESSING MODE The CP1600 addresses memory and I/O devices within a single address space. When referencing external memory, you can use direct addressing, implied addressing, or implied addressing with auto-Increment. Direct addressing instructions are all two or more words long, where the secpnd or last word of the instruction object code provides a 16-bit direct address. CP1600 DIRECT ADDRESSING CP1600 direct addressing instructions are complicated by the fact that CP1600 program memory is frequently only 10 bits wide. That is to say. even though the CP1600 is a 16-bit microprocessor. its instruction object codes are only 10 bits wide. If program memory is only 10 bits wide. then direct addresses will only be 10 bits wide. A 1O-bit direct address will access the first 1024 words of memory only. 16-3 Were you to implement a 16-bit wide program memory. then you could directly address up to 65.536 words of memory; however. six bits of the first object program word for every instruction in program memory would be wasted. This may be illustrated as follows: . Program Memory 15 o .- 10-9 '.i'·./·> . : : ...:· ... :·.i:·:·.·. ".::.:."0 .':'" ( ~i.1 ----~·~~§LQi§L~2£QiZE1- , Six unused bits in each of these __________~o~b~je:ct~co~d~e~_______J } _ Direct Address I - - ; : t i }/:,! ~ object code \ -111---------.. . Three memory reference instructions that specify direct addressing f> ... Direct Address tl~-==~~liliii:'''~'~~~~~~~t~~31 ~_ memory locations Bit Number object code object code , object code Two single word instructions } \> ......i--________~ Direct Address ~ ~----------------------------------------~--~I - Instructions that reference memory using implied addressing identify general purpose Register R1, R2, or R3 as containing the implied address. A memory reference instruction which identifies Register R4 or R5 as providing the external memory address will always cause Register R4 or R5 contents to be incremented following the memory access; thus you have implied memory addressing with auto-increment. CP1600 IMPLIED ADDRESSING Memory reference instructions that specify implied memory addressing via Register 1, 2, 3, 4, or 5 can access a-bit memory. An SDBD instruction executed directly before a valid memory reference instruction forces the memory reference instruction to access memory one byte at a time. If implied memory addressing via Register 1. 2. or 3 is specified. then the same byte of memory will be accessed twice. For an instruction that loads the contents of data memory into Register RO. this may be illustrated as follows: Memory l SDBD Program memory MVI R1.RO RO yy R1 PP PPQQ 16-4 XXYY } Data memory If Register R4 or R5 provides the implied memory address for the instruction which follows an SOSO instruction. then the implied memory address is incremented twice. and two sequential low-order bytes of data are accessed. For an instruction which loads data into Register RO. this may be illustrated as follows: Memory Q w !ta: SDBD o0.. a: o o MVI R5.RO RO ..... _ ____ BB YY_OJ R5 I t-----I t-----t Program memory !: en w !t g CI) CI) ~ all w Z a: o ra PP Data memory " CI) o ~ ~ Q ~ © The SOSO instruction may also precede an immediate instruction. Now the immediate data will be fetched from the low-order byte of the next two sequential program memory locations. This may be illustrated as follows: Memory MVII XXYY.RO .....-~"'""-t Without the preceding SOSO instruction. an' immediate instruction will access the, next single program memory word to find the required immecjiate data. Ten or more bits of immediate d~ta will be accessed. depending on the width of program memory words .. a The CP1600 has no Stack reference instructions such a~ a Push or Pull; rather, variety of CP16QO memory reference in'structions can identify Register R6 as providing the implied address. STACK When Register R6 provides the implied address. it is treated as an upward migrating Stack ADDRESSING Pointer. When a memory write operation specifies Register R6 as providing the implied memory address. Register R6 contents will be incremented following the memory write. A memory read instruction that specifies Register R6 as providing the implied memory address will cause the contents of Register R6 to be decremented before the read operation occurs. An unusual feature of the CP1600 is the fact that a variety of secondary memory reference instructions can also reference memory via the Stack Pointer. When these instructions are executed. Register R6 contents are decremented before the memory access occurs - as though a Pull operation frqm the Stack were being executed. Logically. Register R6. the Stack Pointer. is being handled as though it were a Oata Counter with post-increment and pre-decrement. ' 16-5· Jump instructions use direct memory addressing. Jump instructions are all three words long. The direct address is computed from the second and third memory words as follows: 98765432 0 0 0 0 0 0 0 0 1 0 0 x X A A A A A A Y Y B B B B B B B B B B --- JR or JSR Word 2 Word 3 AAAAAABBBBBBBBBB Jump address (binary) yy. are enable/disable bits for interrupts xx identify the register where the return address will be stored for JSR xx and yy are described in detail in Table 16-4. You can enable or disable interrupts whenever you execute.a Jump or Jump-to-Subroutine instruction. The only difference between a Jump instruction and a Jump-to-Subroutine instruction is that the Jump-to-Subroutine instruction saves the Program Counter contents in Register 4. 5, or 6. The two high-order bits (xx) or the second Jumpto-Subroutine object code word specifies which of the three registers will be used to hold 'the return address. Jump-to-Subroutine instructions. like the Jump instruction, allow direct memory addressing only. CP1600 STATUS AND CONTROL FLAGS The CP1600 CPU has four of the standard status flags; in addition, it has some unusual control signals. These are the four standard status flags: Sign (S). This status is set equal to the high-order bit of any arithmetic operation result. Zero (Z). This status is'set t01 whenany instruction's execution result. create~ a zero result. The statu~ is set to 0 f~r a nonzero . The Carry (C) and Overflow (0) statuses are standard carry and overflow, as described in Volume 1. Four control signals (EBCAO - EVCA3) are output during a Branch-on-External (BEXT) instruction. These four signals are output to reflect the low-order four bits of the BEXT instruction's object code. External logic receives these four signals and (depending on their statel. mayor may not return a high input via EBCl.lf EBCI is returned high, then the BEXT instruction will perform a branch: if EBCI is returned low, then the BEXT instruction will cause the next sequential instruction to be executed. The four control signals EBCAO - EBCA3 therefore provide the CP1600 with a means of test.. . . ing 16 external conditions. CP1600 CPU PINS AND SIGNALS. CP1600 CPU pins and signals are illustrated in Figure 16-2. DO - 015 is a multiplexed Address arid Data Bus. Given a total of 40 pins in a package, CP1600 designers have been forced to share 16 pins between addresses and data. Three control signals, BDIR, BC1, and BC2, identify the traffic on the Address/Data Bus. External logic (one MSI chip) 'must decode these three signals to create eight control signals, as summarized in Table 16.;'1. .. Remaining signals may be divided into four groups: timing, status/control, interrupt, and DMA. Two timing clock signals are required: «1>1 and «1>2. These are complementary ciocksignals w.hich may be illustrated as follows: <111 ---1 <112 ---'~_-.JI \ I \ \ I 16-6 I L r \ ...._ - - J EBeI 40 MSYNC PCiT 39 38 GNO Bel 37 Be2 BOIR cw ~ a: oa.. 015 014 36 35 34 013 012 33 32 a: 011 10 CPl600 31 ~ 010 09 08 11 12 13 14 CPU 30 29 28 o u enw DO 01 ~ g 07 CI) CI) D6 ct 05: olI D4 w Z 03 15 27 26 16 17 25 24 18 19 20 23 22 21 <1>1 <1>2 Veo VBB VCC BOROY STPST BuSRo. HALT. BUSAK iNTR 'iNTRM . TCI EBCAO EOCAl EBCA2 EBeA3 02 a: o III CI) o :!: ct c ct @ Pin Name Oescription DO- 015 Oata and Address Bus Bus control signals BOIR. Bel. Be2 ~ Type Tristate. Bidirectional Output Input Input Clock signals Master Synchronization MSYNC External branch condition address lines Output POT External branch condition input Program Counter inhibit/software Input Input BOROY WArT Input HALT CPU stop or stan on high-to-Iow transition Halt state signal Interrupt request lines Input Output Input Terminate current interrupt Bus request Output Input External bus control acknowledge Output EBCAO - EBCA3 EBCI interrupt signal s;;;sr MR. iNTiiM TCI BUSRa BUsAK VBB.VCC.VOO.GNO Power and Ground Figure 16-2. CP1600 CPU Signals and Pin Assignments MSVNC is a somewhat unusual signal, as compared to other microcomputer clock signals in this book. Following powerup. MSYNC must be held low fo(at'least 10 milliseconds. On the subsequent rising edge of MSYNC. logic internal to the CP1600 CPU will sync~rpnize the <1>1 and <1>2 clock signals to start a new machine cycle. Most of the CPU devices we have described in this book us~ a reset signal. or have internal powerup logic which performs this clock synchronization. . Now consider the status and control signals. . First of all. there are the four cont~ol ~utPuts which we have already described: 'EBCAO - EBCA3. There is one conditional Branch instruction (BEXT) which will'only branch if a high signal is input via EBCI. When the BEXT instruction is executed. the low-order four BEXT instruction object code bits are output via EBCAO - EBCA3. External logic is supposed to decode these four signals by whatever means are appropriate - and thence determine whether EBCI should be input high or low. A high input. as we have just stated. will result in a branch: a low input will cause the ' next sequential instruction to be executed. In reality. there is no connection within CP16QP CPU logic between the EBCI input and the four EBCAO - EBCA3 outputs, So far as external logic is conc'erned. thee:xecution of a BEXT instruction is identified by signal levels output and maintained on the EBCAO - EBCA3 outputs. while the EBCI input determines whether a branch will or will not occur. How external logic chooses to determine whether EBCI will be set high or low is entirely up to external logic. The only vital function served by EBCAO - EBCA3 is to identify the instanlat which a BEXT instruction is executed. Another unusual control signal provided by the CP1600 is PCIT; this is a bidirectional signal. When input low. this signal prevents the Program Counter from being in'cremented following an instruction fetch. This signal is also output as a low pulse following execution of a software interrupt instruction. Instruction timing separates the active input and 16-7 active output of this signal: providing external logic adheres to timing requirements. a conflict between input and output logic will never arise. . Eii5'RDY is equivalent to the WAIT signal we have described for a number of other microcomputers. "B"5Rt5V is input low by any external logic which requires more time in order to respond to anllO access. Recall that the CP1600 uses a single address space to reference memory or I/O devices. The BD1"IT5V signal causes the CPU to enter a Wait state for as long as B'i5R5Y is being input low: however. during the Wait state CPU logic is not refreshed. Thus a Wait state cannot last for more than 40 microseconds. or the contents of internal CPU locations will be lost. 'S'fiiST. a Halt/Reset input, is an edge-triggered signal. When external logic inputs a high-to-Iow transition via STPST. the CPU will complete execution of any interrupt instruction. then.will enter a Halt state and output HALT high. If a non-interruptable instruction is being executed. then the Halt state will not being until completion of next interruptable instruction's execution. The Halt state will last until external logic inputs another high-to-Iow STPST transition. at which time the Halt output will be returned low and normal programming execution will continue. Execution of the HL T instruction also causes the CP1600 to enter a Halt state. as described above. Let us now look at interrupt signals. The CP1600 has two interrupt request inputs -INTR and INTRM. INTR has higher priority than INTRM. INTR cannot be di~abled: Typically. 'iNTIr will be used to trigger an interrupt upon power failure or other catastrophes. The interrupt acknowledge signal is created by external logic which must decode the BC1, BC2, and BOlA sign~ls, as shown in Table 16-1. Observe that' there are. in fact. two interrupt acknowledge signals: the first (lNTAK) acknowledges the interrupt itself. while the second (DAB) is used as a strobe for external logic to return an interrupt address vector. The interrupt sequence is described later in this chapter. The CP1600 has two additional interrupt-related signals which are unusual when compared to other microcomputers described in this book. TCI is output high when an End-of-Interrupt instruction is executed. This signal makes it easy for external logic to generate interrupt priorities which extend across the execution of an interrupt service routine. Wehave discussed this subject in some detail ,:",hile desc'riping the 8259 Priority Interrupt Control Unit in Chapter 4. Table 16-1. CP 1600 Bus Control Signals .' BCl BC2 BDIR 0 0 0 NACT The CPU is inactive and the Data/Address Bus is in a high impedance ~tate. 0 0 1 BAR A memory address must be input to the CPU via the Data/Address Bus. 0 1 0 lAB Acknowledged external interrupt requesting logic must place the starting address for the interrupt service routine on the Address Bus. SIGNAL FUNCTION 0 1 1 DWS Data write strobe for external memory. 1 0 0 ADAR This signal identifies a time interval during which the Data/Address Bus is floated. while data input on the Data Bus is being interpreted as the effective memory address during a direct memory addressing 1 0 1 DW T[1e CPU is writing data into external memory. DW will precede DWS by one machine cycle. 1 1 ,0 DTB This is a read strobe which external memory or I/O logic can use in order to place data on the Data/Address Bus. 1 1 1 INTAK This is an interrupt acknowledge signal. It is followed by lAD which is a strobe telling t[1e external logic which is being acknowledged to identify itself by placing an address vector on the Data/Address Bus. oper~tion. 16-8 MC Tl T2 MC T4 T3 Tl T2 T3 T4 cw ~ II: oQ. II: o <.J ~ enw BC1.BC2.BDIR ~ g en en DO-D15 ct olI w Z Undefined state preceding data output II: o In en o Data Output Data Input ~ ct C ct Figure 16-3. CP1600 Machine Cycles and Bus Timing @ BAR NACT MC2 MCl T1 T2 I I I T3 T4 Tl T2 T3 DTB MC3 T4 Tl T2 T3 T4 <1>2 BCl BC2 ~ __ ~~ __+-__________-+____________- - J BDIR DO-D15---~ Instruction address out Instruction object code in Figure 16-4. CP1600 Instruction Fetch Timi~g 16-9 INSTRUCTION FETCH , BAR MCl I I NACT MC2 I I' I T4 ,T3, n:T2:T3fT4 n,I T2 , I I I Instruction address out , " MEMORY READ DTB MC3 BAR MCl NACT NACT MC2 DTB MC3 I I : : ' I 'I Tl," Tl,'T2IT3IT4 T2, I T31T4 Tl, T21 T3l T4 TlI T2: T3:T4 T'/T21 T3 :T4 "I , , I I "I I, I I I I I I I I Instruction object code in I I I I I Data address out Data in Figure 16-5. CP1600 Timing for Memory Read Instruction with Implied Memory Addressing CP1600 INSTRUCTION TIMING AND EXECUTION CP1600 instructions are executed as a sequence of machine cycles. Each machine cycle has four clock periods, as illustrated in Figure 16-3. Machin"e cycles are identified by their cycle number and by the levels of.the BCt BC2. "and BDIR signals. Each of the eight level combinations is given a name. taken from Table 16-1. This name becomes the name of the machine cycle. Thus in Figure 16-4. and in subsequent instruction timing illustrations. each machine cycle is identified by a signal name from Table 1 ~-1 '.: Figure 16-3 shows general case timing for data output or input on"the Data/Address Bus. In between data input or output operations the bus is floated. CP1600 MEMORY ACCESS TIMING Figure 16-4 illustrates instruction fetch timing for a CP1600 instruction's execution. Three machine cycles are required. During the first machine cycle an address is output. Nothing happens during the second machine cycle; it is a "time spacing" machine cycle that routinely separates two CP 1600 Bus access machine cycles. The object code for the accessed instruction is returned during the third niachine cycle. Figure 16-5 illustrates timing for the simplest memory read instruction's execution. In this case the data memory address is taken from one of the CPU registers. There is no difference between timing for the three machine cycles of an instruction fetch or a data memory read. As illustrated in Figure 16-5. a simple memory read instruction's execution consists of two three-machine cycle memory read operations. separated by a spacing no operation machine cycle. 16-10 MEMORY WRITE, INSTRUCTION FETCH Q w ~ a: oQ. DTB MC3 BAR MCl NACT MC2' I 'J T'l :T2:T3: T,4 T1: ,T2 IT3 h·4 I I I I I I I I I I I Tll T21T3I,T4 I I I I 1 I I Tl I:T2 l T3;T4 I I NACT MC2 BAR MCl NACT I I Tl : T2 I'T3 1T4 I I I • T11 T2: T3 IT4 I I DWS 'MC4 OW MC3 ' I I I Td T2 1T3 I I :T.~ I • I I Tl 1,T2: T3:T4' I I I a: oto) ~ en w ~ gen en ct all w Z a: o m en o ~ ct Q ct @ Data out Data address out Instruction object code in Instruction address out Figure 16-6. CP1600 Timing for Memory Write Instruction with Implied Memory Addressing Figure 16-6 illustrates timing for a simple CP1600 memory write instruction execution. Data is output for two machine cycles. giving external logic ample time to respond to the data output. External logic uses the DWS machine cycle as' a write strobe. Any memory reference instruction that specifies direct memory addressing will require one three-clock-period machine cycle to fetch each word of the instruction object code: an NACT clock period will seperate each machine cycle, Aft~r the first instruction fetch machine cycle. an ADAR-NACT clock period combination will be inserted in the second (and third. if present) instruction fetch machine cycle, During an ADAR clock period. BC1 is high. while BC2 and BDIR are low. No other control signals are active, Thus. for a two-word m'emory read or memory write instruction that specifies direct addressing, the following clock periods and machine cycles will be required for instruction execution: Direct Addressing Memory Read Machine Cycles Direct Addressing Memory Write Machine Cycle BAR } Fetch first instruction NACT ....... ..------object code word DTB ------a.. ~ { BAR NACT DTB , NACT ...4-------Spacing machine cycle------II ..~NACT ~~~~} NACT DTB ~{ ~~~~ ...... e_----Fetch second instruction-----a .. object code word NACT ........-----Spacing machine BAR } Memory read NACT "'4_--machine cycle DTB cycle------Il~~ NACT DTB NACT Memory write { BAR machine cycle----IlI ... ~ NACT OW DWS 16-11 BAR NACT NACT <1>1 <1>2 BCl -----------------+------------ BC2 BDIR BDRDY Figure 16-7. CP1600 Wait State Timing THE CP1600 WAIT STATE , The CP1600 has a Wait state equivalent to those described for other microcomputers in this book. External logic that requires more time to respond to an access must input BDRDY low before the end of the BAR machine cycle. during which an address is output and the device is selected. Timing is illustrated in Figure 16-7. Jf you examine Figures 16-4, 16-5 and 16-6, you will see that an address is output during a BAR machine cycle to initiate any external device access. The BAR machine cycle is always followed by an NACT machine cycle; in the middle of T1 during this NACT machine cycle, the CP1600 samples BDRDY. If'B"D"RlJ? is low, then a sequence of NACT machine cycles occurs. In the middle of T4 for every NACT machine cycle, the CP1600 samples BDRDY again. Upon detecting BDRDY high, the CP1600 resumes instruction execution with a DTB machine cycle. A Wait state must last for less than 40 microseconds, since the CP1600 is a dynamic device. THE CP1600 HALT STATE The CP1600 has a Halt state which may follow execution of the Halt instruction, or may be initiated by external .. . logic. When the Halt instruction is executed, then, following the instruction fetch machine cycle, the HALT signal is output high and a sequence of NACT machine cycles is executed. External logic initiates a Halt state by making the STPST input undergo a high-to-Iow transition. Following execution of the next interruptable instruction, a Halt state begins. The HALT signal is output high and a sequence of NACT machine cycles is executed. A Halt state, whether it is initiated by execution of a Halt instruction or by a high-to-Iow transition of STPST, must be terminated by a high-to-Iow transition of STPST. This will cause the Halt state to end at the conclusion of the next NACT machine cycle. Timing for a Halt state which is initiated and terminated by ST~ST may be illustrated as follows: ::J;:=~~~~----'-I------.~~-Next inte~uptable instruction's execution ends here 4\ J y HALT STATE 16-12 ) • \. Next NACT machine cycle ends here The PciTsignal as an input inhibits CP1600 Program Counter increment logic. Thus. external logic can input PCIT low - in which case the same instruction will be continuously re-executed until PCTf goes high again. However. 1ZT'f should only change levels while the CPU has been halted. Thus. PCIT and STPST should be used together as follows: CP1600 PCIT SIGNAL c w !ia: PCIT REQUEST o STPST o0.. a: o ~ en w !i PCIT g CI) CI) ct o!J w Z a: o a:I CI) o CP1600 INITIALIZATION SEQUENCE The CP1600 is initialized by inputting the MSYNC signal low for a minimum of 10 milliseconds after power is first applied to the CPU. MSYNC must make a low-to-high transition. marking the end of the initialization. on a rising edge of the <1>1 clock signal. On the next rising edge of <1>1. instruction execution will begin. This may be illustrated as follows: ~ II T1 ct C ct I I I I I I I I T2 I T3 I T4 I @ <1>1 MSYNC~ When instruction execution begins. interrupts are disabled. The following sequence of machine cycles is executed: NACT lAB ~ Read Data/Address Bus and load into Program Counter NACT NACT NACT B A R . - Output Program Counter contents to fetch first instruction NACT DTB etc During the lAB machine cycle. external logic must supply a 16-bit address at DO - 015. Your external logic must provide this address. which in the simplest case may be 0000 by grounding the bus. or FFFF16 by tying it to +5V following a startup. . The address which is input at lAB is output at BAR. initiating program execution. CP1600 DMA LOGIC CP1600 DMA logic is quite standard. When external logic wishes to transfer data under DMA control, it inputs BUSRQ low. At the conclusion of the next interruptable instruction's execution, the CPU floats the Data/Address Bus and enters a Wait state, during which a sequence of NACT machine cycles is executed. BUSAK is output low at the beginning of the first NACT machine cycle. The NACT machine cycles that occur during a DMA operation refresh the CPU. NACT machine cycles that occur during a Wait state do not refresh the CPU. This means that any number of NACT machine cycles can occur during a DMA break. while a Wait state must be shorter than 40 microseconds. The DMA break ends when external logic inputs BUSRO high again. BUSRO is sampled during T1 of every DMA NACT machine cycle. When BUSRO is sampled high. two additional NACT machine cycles are executed. then BUSAK is output high and normal program execution resumes. DMA timing is illustrated in Figure 16-8. 16-13 Last machine cycle of an interruptable instruction's execution I NACT I '.1 I Tl I T21 T3 ,T4 I I I ,T4 1 nl 1 NACT I I NACT NACT 1 I I 1 1 1 BAR I I T3 ,T4 n I T2 , T3 1 T4 n I T2 , T3 I T4 'I 1 I I 1 Tl, 1 'I <1>1 BC1,BC2,BOIR BUSRQ BUSAK Figure 16-8. CP1600 DMA Timing INTAK ow NACT I :: NACT OWS I ::: lAB NACT X 4 :: I : BAR i:: , I I ::. 1 ::: TdT2:T3h4 Tl1T21T31T4 T11T21T3,T4 TlIT21T31T4 nlT2IT3IT4 Tl1T21T31T4 Tl'T2 'T4 n'T2IT31T4 I ,I 1 I I I' I I I I I I I I I I I I I I 1 <1>1 uv-v- <1>2 rvLfL BC1J \ BC2l \ BOIR} \ 00--0 015 t Output Stack Pointer \ I I \ I \ 0 t Current Program Counter contents written to memory stack External logic inputs starting address for interrupt service routine Figure 16-9. CP1600 Interrupt Service Routine Initialization 16-14 Start executing interrupt service routine INSTRUCTION FETCH BAR MC1 Q w ~ a: oQ. INSTRUCTION EXECUTE/FETCH OTB MC3 NACT MC2 BAR MC1 NACT NACT MC2 OTB MC3 I I I I I I I 1 I I I I I I I I I I I T1:T2lT3:T4 n:T2IT3:T4 T1: T21 T3 \T4 T1\T2:T3;T4 'T1 1T2 1 T3lT4 T1!T2: T3:T4 T1: T21 T3:T4 l : I I I I I I I I I I I I I I I I I I I a: o CJ ~ u) w ~ g U) U) ct II!I w Z a: o III U) o ~ ct Q ct @ Instruction address out TCI instruction object code in Next instruction address out Next instruction object code in Figure 16-10. CP1600 Timing for TCI Instruction's Execution THE CP1600 INTERRUPT LOGIC The CP1600 uses a vectored interrupt processing system. External logic requests an interrupt by inputting a low signal at either the INTR or INTRM pins. Following the execution of the next interruptable instruction. the CP1600 acknowledges the interrupt by pushing Register R7 contents (the Program Counterl onto the Stack; then the CP 1600 outputs 111. followed by 010 at BC 1. BC2. and BOlA. External logic must respond by placing 16 bits of data on the Data/Address Bus. These 16 bits of data will be loaded into Register R7. the Program Counter. thus causing program execution to branch to an interrupt service routine dedicated to the interrupt. Timing is illustrated in Figure 16-9. The PC IT signal is output low following execution of a software interrupt instruction (SIN). This is the only microcomputer described in this book which allows external logic to respond to a software interrupt in this fashion. Allowing external logic to respond to a software interrupt only makes sense when you anticipate your product being used in a minicomputer-like environment. Typically. the software interrupt will interface to logic of a front panel or console. When an SIN instruction is executed. a one-machine cycle low PCIT pulse is output. You may. if you wish. end an interrupt service routine by executing a Terminate Current Interrupt (TCI) instruction. in which case the TCI signal will be output high. Timing for TCI is given in Figure 16-10. Following an interrupt acknowledge. the interrupt service routine must execute instructions in order to disable interrupts and save the contents of registers on the Stack. The exception is Register R7. the Program Counter. which is automatically pushed onto the Stack following an interrupt acknowledge. External logic is entirely responsible for any type of interrupt priority arbitration which may occur. and for the generation of the interrupt vector address which must be input following an interrupt acknowledge. 16-15 It is quite easy to generate signals equivalent to other microcomputer system busses from the CP1600 System Bus. Therefore. you can use parts described in Volume 3 to handle CP1600 interrupt requirements. THE CP1600 INSTRUCTION SET The CP1600 instruction set is relatively straightforward. Addressing modes. which we have already described. are simple. and instructions are typical of those we have seen and described for other microcomputers. Unusual features relating to addressing modes available with individual instructions are summarized in Table 16-2, VVhich describes the CP1600 instruction set. If you have never programmed a PDP-11 minicomputer, then you should pay particular attention to programming techniques that result from the Stack Pointer and Program Counter being accessed as general purpose registers. . A wide variety of Register Operate instructions allow you to compute data and load the resu It directly into Register R7. the Program Counter. In effect. these become computed Jump instructions. The ability to manipulate Register R6. the Stack Pointer. as though it were a general purpose register means that it is easy to maintain a number of different Stacks in external read/write memory. The Jump-to-Subroutine instruction has a minicomputer flavor to it. Rather than saving the return address on the Stack. Register R7 contents are moved to General Purpose Register R4 or R5. A number of minicomputers will save a subroutine return address in a general purpose register in this fashion. The problem with this logic is that you must execute an additional instruction within the subroutine to save the return address on the Stack if you are going to use nesting subroutines. If you are passing subroutine parameters. however. this is an excellent arrangement. for the Jumpto-Subroutine instruction places the address of the parameter list directly in a Data Counter with auto-increment. We have described the concept of parameter passing in Volume 1. Chapter 7. Note that the CP 1600 instruction set lacks a logical OR. In Tables 16-2 and 16-4. instruction length is given in terms of "words" rather than "bytes". as we have done in previous chapters. Since only the lower 10 bits of the CP1600 object code are presently used. system configurations need not have the fu II 16-bit word size. Hence a "word" may be 10 to 16 bits wide. depending on the implementation. The following notation is used in Table 16-2: ADDR cond DATA DISP E EBCAO-3 EBCI LABEL PCIT RB RD RM RR RS One word of direct address Condition on which a branch may be taken. Table 16-3 lists all 14 branch conditions. One word of immediate data. One word displacement. See Table 16-4 for location of sign bit. External branch condition. The external branch condition address lines: EBCAO. EBCA 1, EBCA2. and EBCA3. The external branch condition input line. A 16-bit direct address. target of a Jump instruction. See Table 16-4 for ~he bit format. The software interrupt output line. General Purpose Register R4. R5. or R6. One of the general purpose registers. used as a destination for operation results. One of the general purpose registers used as a Data Counter. R4 or R5. if specified. is auto-incremented after the memory access. R6 is incremented after a write. and decremented before a read. General Purpose Register RO. R1. R2. or R3. One of the general purpose registers. used as the source of an operand. Statuses: S the Sign status C the Carry status Z the Zero status o the Overflow status The following symbols are used in the STATUSES column: X the status flag is affected by the operation a blank means the status flag is not affected o the operation clears the status flag 1 the operation sets the flag 2 . the Overflow flag is affected only on 2-bit shifts or rotates 16-16 SW The Status Word. whose bits correspond to the condition of the status flags in the following way: 3 2 1 0 ~ BII No. IsIzlole I cw Status Word When the status word is copied into a register. it goes to the upper half of each byte: ~ oa.. a: a: o o ~ enw [SW] ~ g 0' When the status word is loaded from a register. it comes from the upper half of the lower byte: en en ct ~ll.-5---------------8~1~7----::::tL~-4~3-------'01 ~ aIS w Z a: oCD [RS] en o ~ ct x o ct @ (.2) [ ] [[ ]] A ¥ ± 01 [SW] Bits y through z of the Register x. For example. R7 < 15.8 > represents the upper byte of the Program I Counter Indicates that the operand ".2" is optional A low pulse Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. Implied memory addressing: the contents of the memory location designated by the contents of a register. ~ogical AND Logici31 Exclusive-OR Additic'l~ or subtraction of a displi3cement. depending on the sign bit in the object code. Data is. transferred in the direction of the arrow. 16-17 Table 16-2. CP1600 Instruction Set Summary STAtUSES TYPE g~w -OCJ >:E Z a:w w < :E ffi ~ol:i a:Za: 1:1..< w CJ Z w a: w II. w a: > a: 0 ~ w WORDS MVI ADDR,RD 2 MVI@ RM,RD 1 load register from memory, using direct addressing. [RD]-[[RMll MVO RS,ADDR 2 load register from memory, using implied addressing, [ADDR]-[RS] MVO@ RS,RM 1 SZ C 0 . [RD]-[ADDR] Store register to memory, using direct addressing. . [[RMll-[RS] Store register to memoiy, using implied addressing. If RS=R4, R5, R6 or R7, then RS=RM is not supported. ADD ADDR,RD 2 X X X X ADO@ RM,RD 1 X X X X SUB ADDR,RD 2 X X X X [RD]-[RD] + [ADDR] Add memory contents to register, using direct addressing. [RD]-[RD]+ [[RMll Add memory contents to register, using implied addressing. [RD]-[RD] - [ADDR] SUB@ RM,RD 1 X X X X Subtract memory tontents from register, using direct addressing. [RD]-[RD] - [[RM]] CMP ADDR,RS 2 X X X X CMP@ RM,RS 1 X X X X AND ADDR,RD 2 X X AND@ RM,RD 1 X X XOR ADDR,RD 2 X X AND memory tRD]-[RD] A AND memory [RD]-[RD]¥ XOR@ RM,RD 1 X X Exclusive-OR memory contents with those of register, using direct addressing. [RD]-[ RD]¥- [[ RMll :E 0 Z < g > a: c< Z 0 CJ w (/l OPERATION PEitFORMED OPERAND(SI MNEMONIC Subtract memory contents from register, using implied addressing. ; [RS]- [ADDR] Compare memory contents with registers, uSing direct addressing. Only the status flags are affected. [RS] - [t RMll Compare memory contents with register's, using implied addressing. Only the status flags are affected. [RD]-[RD] A [ADDR] contents with those of register, using direct addressing. [[RMll contents with those of register, using implied addressing. [ADDR] Exclusive-OR memory contents witli those of register, using implied addressing. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 16-2. CP1600 Instruction Set Summary (Continued) STATUSES S Z MNEMONIC OPERAND(S) WORDS w I- MVII DATA,RD 2 is w MVOI RS,DATA 2 ADDI DATA,RD 2 X X X X « :!! ~ w I- « a: C [RD)-DATA Load immediate to specified register. HR7) + l)-[RS) Store contents of specified register in immediate field of MVOI instruction, This is only possible if program memory is read/write memory (rather than ROM). SUBI DATA,RD 2 X X X X 0 w I- CMPI DATA,RS 2 X X X X is w ANDI DATA,RD 2 X X :!! ~ XORI DATA,RD 2 X X J LABEL 3 JR RS 1 JSR RB,LABEL 3 B DISP 2 w Q. « Q. :!! :l ""') OPERATION PERFORMED 0 TYPE [RD)-[RD) + DATA Add immediate to specified register. [RD)-[RD) - DATA Subtract immediate data from specified register. [RD)-DATA Compare immediate data with conterits of specifl8d register, Only the status flags are affected. [RD)-[RD) A DATA AND immediate data with contents of specified register. [RD)-[RD)-VDATA Exclusive-OR immediate data witl} contents of specified register. [R7)-LABEL X X Jump to given address. [R7)-[RS) Jump to address contained in specifl8d register. [RB)-[R7]; [:fI7)-LABEL . - Jump to given address, saving Program Counter in R4, RS. or R6. [R7)-[R7) + 2±DISP Branch relative to Program Counter contents. Z 0 :z:: Z 0 j:::: u is Z z « a: 0 III U Bcond DISP 2 BEXT DISP,E 2 If cond is true, [R71-[ R7) + 2±DISP Branch relative on given condition; otherwise, execute next sequential instruction. EBCAO-3 -E; If EBCI=l, [R7)-[R7)+2±DISP Branch relative if extemal condition is true. Table 16-2. CP1600 Instruction Set· Summary (Continued) STATUSES . TYPE MNEMONIC ffi~ a:~ WORDS S Z OPERATION PERFORMED C 0 Move contents of source register to destination register. [RD]-[RS]+ [RD] x RS.RD 1 ADDR RS.RD 1 X 'X X X SUBR RS.RD 1 X X X X Add contents of specified registers. [RD]-[RD] - [RS] CMPR RS.RD 1 X X X X Subtract contents of source register from those of destination register. [RD] - [RS] ANDR RS.RD 1 X X Compare registers' contents. Only the status flags are affected. [RD]-[RD] A [RS] XORR RS,RD 1 X X AND contents of specified registers. [RD]-[ RD]-Y- [RS] MOVR a: w I!!!( U)a: -w 011. we ~e a:Z I!! < U)w OPERAND(S) X [RD]-[RS] 'Exclu~ive-OR ~ N o ...1-[SWl; [RD<7,4>I-[SWl Place Status Word in upper half of each byte of the-specified register. RD may beRO, Rl, R2 or, R3. [SWl-[RS<7.4>1 Load Status Word from bits 7 through 4 of the specified register. [CI-O Clear Carry. [Cl-l Set Carry. No Operation. Halt after executing next instruction. Set double byte data mode' for next instruction, which must be of one of the following types: Primary or secondary I/O or memory reference·" Immediate or immediate operate If implied addressing through RI, R2, or R3 is used, the same byte will be accessed twice; addressing through R4, RS, or R7 will give bytes from the addressed location and that addressed after auto-increment. Direct addressing and Stack addressing are not allowed in double byte mode. -- .- Table 16-3. CP1600 Branch Conditions and Corresponding Codes MNEMONIC C LGT Q w ~ a: o Il. NC LLT a: o u OV ~ BRANCH CONDITION OBJECT CODE DESIGNATION C= 1 0001 Carry (logical greater than) C =0 1001 No Carry (logical leas than) 0=1 0010 Overflow en w NOV g PI.. ~ CI) CI) MI c( o!I w Z ZE EO oCD NZE NEG LT a: CI) o ~ c( Q c( GE @ LE GT USC ESC 0=0 No overflow S=O Plus S= 1 Minus Z= 1 Zero (equal) Z =0 Nonzero (not equal) SlJO = 1 Less than S .... O =0 Greater than or equal ZV(S .... O) = 1 Less than or equal ZV(SVO)=O Greater than CVS=1 Unequal sign and carry C¥S=O Equal sign ~nd carry 1010 0011 1011 0100 1100 0101 1101 0110 1110 0111 1111 The following notation is used in Table 16-4: Where ten digits are shown. they are the ten low-order bits of a 10 to 16-bit word. (Word .size depends on the system implementation.) Where four digits are shown. they represent the hexadecimal notation for an entire word (10 to 16 bits). bb cccc ddd eeee 1111 mmm . m p P rr sss z Two bits indicating one of the first three general purpose registers Four bits giving the branch condition. as shown in Table 16-3 Three bits indicating a destination register. RD Four bits giving the external branch condition. E One word of 'immediate data Three bits indicating a ,Data Counter ~~gister RM One bit indicating the number of rotates or shifts: o one bit position 1 two bit positions. One bit of immediate address One hexadecimal digit (4 bits) of immediate address Two bits indicating one of the first four general purpose registers Three bits indicating a source register. RS Sign of the displacement: o add the displacement to PC contents 1 subtract the displacement from PC contents In the "Machine Cycles" column. when two numbers are given with one slash between them (e.g .. 7/9l. execution time depends on whether o~ not a branch is taken. When two numbers are given. separated by two slashes (such as 8//11l. execution time depends on which register contains the implied address. 16-23 Table 16-4, CP1600 Instruction Set Object Codes MACHINE :' INSTRUCTION OBJ~CtCODE WORDS ADCR RD ADD ADDR,RD OOOOHilddd 1 1011000ddd 2 PPPP 1011mmmddd 1 ADDI DATA,RD 1011111ddd 2 ADDR RS,RD AND ADDR,RD 001 iS55ddd 1110600ddd PPPP , 1 2 AND@,RM,RD ANDI DATA,RD 1110mmmddd 1 2 ADD@ RM,lm MACHINE CYCLES 6 10 ANOR RS,RD B DISP OBJECT CODE WORDS CYCLES MVII DATA,RD 1010111ddd 2 8 2 11 MVO RS,ADDR 8/ /11 8 MVO@ RS,RM MVOI RS,DATA 1111 11101)lddd 1111, INSTRUCTION 6 NEGR RD NOP (2) 10 NOPP 8/ /11 8 1111 1001000555 PPPP lOOlmmm555 1 9 1001111555 1111 0000l00ddd 2 9 1 000011010m loooz01ooo 1 6 6 7 looll1055S 1 9 1010110ddd q001010mrr oooll10mrr 0000111555 1 1 11 6/8 1 6/8 6 0110S5Sddd 1 2 6 , 7/9 PULR RD RLC RR!.2) RRC RR!.2) Bcond DISP loooz00000 PPPP loooz0cccc 2 7/9 RSWD RS SAR RR!.2) BEXT DISP,E PPPP looozleeee 2 7/9 SARC RR!.2) ooollllmrr SDBD SETC SIN (2) 0001 0007 000011011m PPPP CLRC CLRR'RD CMP ADDR,RS CMP@ RM,RS CMPI DATA,RS CMPR AS,RD COMR RD DECR RD DIS EIS GSWD RR HLT INCR,RD J LABEL JD LABEL 0006 Qllldddddd 1 1101ooo~5S 1 2 PPPP 1101mmm555 1 1101111555 2 1111 0101sS5ddd 00000llddd 00000lOddd 1 4 6 SLL RR!.2) SLLC RR!.2) 10 8/ /11 8 SLR RR!.2) SUB ADDR,RD 6 6 SUB@ RM,RD SUBT DATA,RD 1 1 § 0003 1 4 SUBR RS,RD 0002 0000l100rr 1 4 SWAP RR!.2) 0000 1 1 6 4 TCI TSTR RS 000000lddd 1 3 6 12 XOR ADDR,RD 0064 llppppppoo pppp 0004 llpppppp.l0 3 XOR@ RM,RD XORI DATA,RD 12 XORR RSiRD PPPP JE LABEL 0004 3 12 llppppppOl PPPP JR RS' JSR RB,LABEL 0010555111 1 0004 7 3 lZ 3 12 3 12 1 bbppppppoo PPPP JSRD RB,LABEL JSRE RB,LABEL 0004 bbppppppl0 PPf>P 0004 bbppppppOl MOVR RS,RD MVI ADDR,RD PPPP 00105s5ddd 1010000ddd 2 6/ /7 10 MVI', RM,RD PPPP 1010mmmddd 1 8/ /11 2 PPPP PSHR RS 16-24 oool101mrr 1 1 6/8. 1 1 6/8 4 1 1 4 6 oooloolmrr 1 6/8 ooo1011mrr ooolloomrr 1 1 ll00000ddd PPPP 2 6/8 6/8 10 1 8/ (11 2 8 lloommmddd llOOlllddd 1111 01oo555ddd 000 1ooonrr 0005 0010555555 llll000ddd PPPP llllmmmddd lllll11ddd 1111 011155sddd 1 6 1 1 6/8 4 1 6//7 10 2 2 1 8/ /11 8 1 6 THE BENCHMARK PROGRAM For the CP1600 our. benchmark program may be illustrated as follows: c w ~ a: oD. a: o CJ ~ ui w ~ g LOOP MVII MVII MVI@ MVII MVI@ MVO@ DECR BNZE MVO@ IOBUF.R4 TABLE.Rl Rl.R5 CNT.R2 R4.RO RO.R5 R2 LOOP R5.Rl LOAD THE 1/0 BUFFER STARTING ADDRESS INTO R4 LOAD THE TABLE STARTING ADDRESS INTO Rl LOAD ADDRESS OF FIRST FREE TABLE WORD INTO R5 LOAD WORD COUNT INTO R2 LOAD NEXT DATA WORD FROM 10BUF STORE IN NEXT TABLE WORD DECREMENT WORD COUNT RETURN IF NOT END RETURN ADDRESS OF NEXT FREE TABLE BYTE This benchmark program makes very few assumptions. The input table 10BUF and the data table TABLE can have any length. and can reside anywhere in memory. The address of the first free word in TABLE is stored in the first word of the TABLE. U) U) ~ all w Z a: oCD U) o ~ ~ c ~ @ 16-25 BOBOA System Bus Signals CP1600 System Bus Signals DO 015 -. - ··· ····· .. - - Latched Address Buffer a :- - .- + MUX -- --' - -BAR Latched Data Buffer • -::-= .• ~ - .-.. BC1 - BC2 ...... - BDIR ""'" ...... "" lAB 1 of B Decoder INTAK ...... ...., ADAR NACT iNTRM BDSiffi' -- ~ - - ---{>o STSTP 'I High-order <4!1 TCI EBCAO EBCA3 4 Figure 16-11. CP 1600 to 8080A Bus Conversion 16-26 byte DO Low-order 07 ,byte --INT INT BOSEN HOLD RDYIN WAIT -------------------------------------------~------...~ RES~ HALT EBCI - Lt>:; --L?), --f ..... A MSYNC : =. DO 07 -- ON iN'i'R - .. : A15 ~ DTB DWS : AO SUPPORT DEVICES THAT MAY BE USED WITH THE CP1600 c w ~ IX: oQ. IX: o U ~ enw ~ g en en c( all w Z IX: oCD en o :!! c( c c( @ A CP1600 microcomputer system with any significant capabilities will use support devices of some other microprocessor. Parallel I/O capability is available with the CP1680. (described next}"but priority interrupt logic. DMA logic. and serial 110 logic. to mention just a few common options. may need additional support devices. Fortunately. it is quite easy to generate an 8080A-compatible system bus from the CP1600 system bus. Logic is illustrated in Figure 16-11. The CP1600A is the fastest version of the CP1600 CPU; it runs with a 500 nanosecond machine cycle. The CP1600 machine cycle is equivalent to an 8080A clock period. Since the standard 8080A clock period is also 500 nanoseconds. no speed conflicts will arise. The bus-to-bus interface logic illustrated in Figure 16-11 is self-evident. with the exception of bus demultiplexing logic. The CP1600 Data/Address Bus is shown buffered by a demultiplexing buffer that is connected to two latched buffers. One of the latched buffers accepts the demultiplexer outputs only when a valid address is being output. as identified by BAR high. The second latched buffer may be a bidirectional latched buffer. or it may be two unidirectional latched buffers. Three latching strobes are required: DTB. lAB. and DWS. DTB and lAB are data input strobes. DTB strobes data input that is to be interpreted as data. while lAB stroves data input that is to be interpreted as an address. So far as external logic is concerned. both of these signals are simple data input strobes. We could thereforj3 generate a single data input strobe as the OR of DTB and lAB. When this data input strobe is high. information on the 8080A System Bus side of the latched data buffer must be input to the buffer; this data must simultaneously be transmitted to the multiplexer. DWS is the data output strobe. When high. this signal must strobe data from the multiplexer to the latched data buffer; this latched data must immediately appear at the 8080A System Bus side of the latched data buffer. Since the CP1600 uses a 16-bit Data Bus. you will probably have to generate two external device data busses; a highorder byte bus and a low-order byte bus. All external devices that transmit or receive'parallel data must be present in duplicate. For example. were 8255 parallel interface devices to be present. the following connections would be required: - -.. - ... ... ;.. -. · ·.----·.. I~ :: - -:= -.:- j j ~ -. , - DO PA high PB high ---- --......... - ...-.. -- ..-.. ~ PC high ,.. t Device Select Logic 07 DO 1- • WR 8255 PPI - .- RD AO A1 CE ---... --.. -- - --16-27 .. WR 1m AO A1 TI- 8255 PPI II RO DO 07 08 015 AO A1 A2 A15 07 -- -.. -- --.. --- -.. -- -.. --.. - - PAlow PBlow PC low The CP1600 and MC6800 system busses are singularly incompatible. You should not attempt to use MC6800 support devices with the CP1600. ro IMSKO DO 01 02 03 04 05 06 07 CRT PCLR POO POl P02 P03 P04 P05 P06 P07 4 5 6 7 8 9 10 11 12 13 14 15 CP1680 lOB 16 17 18 19 20 40 INTRQ 39 38 37 36 35 34 IMSKI BCl BC2 BOIR CE ERROR 33 32 31 30 29 28 27 VCC GNO 26 25 24 VOO PE AR P015 P014 P013 P012 POll 23 22 21 POlO P09 P08 Pin Name Description Type DO - 07 POO - P015 BOlA. BC 1, BC2 CKl CPU Data/Address Bus Peripheral I/O Port Bus Control signals Clock signal Chip Enable I/O handshake control I/O handshake control Interrupt request Terminate current interrupt Daisy chain priority Daisy chain priority Error interrupt request Reset Power, Ground Bidirectional, tristate Bidirectional Input Input Input Output Input Output Input Input Output Input Input IT PE AR INTRQ TCI IMSKI IMSKO ERROR PCLR VCC' Voo,GNO Figure 16-12. CP1680 108 Signals and Pin Assignments 16-28 © ADAM OSBORNE & ASSOCIATES. INCORPORATED MEMORY lAB 10 B 1 of 8 DECODER -./ I r 8 .J~ 00 J~tt~2, t4>2 120 Skew (4)1, 4>2 delay) t12, t21 0 Clock Period tcy 0.3 Rise & Fall Times tr, If - - Mllster SYNC: Delay from 4> tms - Conditions (J ~ DC CHARACTERISTICS en w Clock Inputs High Low Logic Inpull Low High (All Lines except BOROY) High (Bus Data Ready Line See Note) ~ g en en ~ all w Z a: o m en o ~ ~ c ~ @ Logic Outputs High Low (Data Bus Lines 00-015) Low (Bus Control Lines, BC1,BC2,BOIR) Low (All Others) - - 0.5 V V 10H = 100,...4 10L = 1.6mA - - 0.45 0.45 V V 10L= 2.0mA 10L = 1.6mA - - ns 2.0 p's 15 ns - 30 ns 120 ns - ns ns ns 120 ns AC CHARACTERISTICS Clock Pulse Inpull, 4>1 or 4>2 00-015 Bus Signals Output delay from 4>1 (float to output) Output delay from 4>2 (output to float) Input setup time before 4>1 Input hold time after 4>1 tBO - - t BF tB1 tB2 - 50 0 10 - Bus Control Signals BC1,BC2,BOIR Output delay from 4>1 t - BUSAK Output delay from 4>1 TCI Output delay from 4>1 TCI Pulse Width EBCA output delay from BEXT input EBCA wait time for EBCI input DC - t BU t ro trw - - t DE tAl - - 150 200 300 - -- ns - - ns ns ns 150 400 ns ns CAPACITANCE 4>1,4>2 Clock Input capacitance Input Capacitance 00-015 All Other Output Capacitance 00-015 in high impedance state C4>1,C4>2 - - TA = +25°C; Voo = +12V; Vee = +5V; V BB = -3V; t'4>1 t 4>2 = 120ns 20 30 pF - - 6 5 12 10 pF pF Co - 8 15 pF CIN 1 TTL Load & 25 pF ··Typical values are at +25°C and nommal voltages. NOTE: The Bus Data ReaOY(BOROY) line is sampled during time period TSI after a BAR or AOAR bus control signal. BOROY must go low requesting a wait state 50 ns before the end of T5'1 and remain low for 50 ns minimum. BOROY may go high asynchronously. In response to BOROY, the CPU will extend bus cycles by adding additional microcycles up to a maximum of 40 p'sec duration. 16-03 CP1600A ELECTRICAL CHARACTERISTICS (CP1600A) Maximum Ratlngs* *Exceeding these ratings could cause permanent damage to these devices. Functional operation at these conditions is not implied-operating conditions are specified below. Vo D • Vee. GND and all other inpuVoutput voltages with respect to Vaa . . . . . . .' . . . . . -0.3V to +18.0V Storage Temperature . . . . . . . . . . . . -55° C to +150° C Operating Temperature . . . . . . . . . . . . . O°C to +70°C Standard Conditions: (unless otherwise noted) Voo=+12V±5%. 70mA(typ) • 140mA(max.) Vee=+5V±5%.12mA(tYP).25mA(max.) Characteristic OC CHARACTERISTICS Clock Inputs High Low Logic Inputs Low High (All Lines except BDRDY) High (Bus Data Ready Line See Note) Logic Outputs High Low (Data Bus Lines 00-015) Low (Bus Control Lines. BC1.BC2.BOIR) Low (All Others) Vaa= -3V±10%. 0.2mA(typ) • 2mA(max.) Operating Temperature (TA)=O°Cto +70°C Sym, Min, VIHe VILe 10.4 0 VIL VIH Typ" Max Units - Conditions Voo 0.6 V V 0 2.4 - 0.65 Vee V V VIHa 3.0 - Vee V VOH VOL 2.4 - Vee - 0.5 V V IOH= 100~A IOL= 1,6mA VOL VOL - - - - 0.45 0.45 V V IOL= 2.0mA IOL= 1.6mA Pulse Width t4>2. t4>2 95 Skew (4)1. 4>2 delay) t12. t21 0 Clock Period tcy Rise & Fall Times Master SYNC: Oelay from 4> 00-015 Bus Signals Output delay from 4>1 (float to output) Output delay from 4>2 (output to float) Input setup time before 4>1 Input hold time after 4>1 BUI Control Signals BC1,BC2,BOIR Output delay from 4>1 tr.tf AC CHARACTERISTICS Clock Pulse Inputs, 4>1 or 4>2 BUSAK Output delay from 4>1 TCI Output delay from 4>1 TCI Pulse Width EBCA output delay from BEXT input EBCA wait time for EBCI input - ns - - ns 0.25 - 2.0 ~s - - 15 ns tms - - 30 ns tBO - - 95 ns t BF t B1 tB2 - 50 - - t DC t BU tro trw 0 10 - - - ns ns ns - 200 ns - - ns ns ns - 150 200 300 t DE tAl - - 150 400 ns ns C4>1.C4>~ - 20 30 pF 6 5 12 10 pF pF 8 15 pF - CAPACITANCE 4>1.4>2 Clock Input capacitance Input capacitance 00-015 All Other Output Capacitance 00-015 in high impedanc~ state CIN - Co - 1 TTL Load & 25 pF TA=+25°C; Voo=+12V; Vee = +5V; Va a =-3V; t4>1 t 4>2 = 120ns '*Typical values are at +25°C and nom mal voltages. NOTE: The Bus Data ReaOY(BOROY) line is sampled during time period TSI after a BAR or AOAR bus control signal. BOROY must go low requesting a wait state 50 ns before the end of TS1 and remain low for 50 ns minimum. BDROY may go high asynchronously. In response to BOROY, the CPU will extend bus cycles by adding additional microcycles up to a maxi'mum , of 40 ~sec duration. 16-04 CP1610 ELECTRICAL CHARACTERISTICS (CP1610) Maximum Ratings- ·Exceeding these ratings could cause permanent damage to these devices. Functional operation at these conditions is not implied-ope(ating conditions are specified below. Voo, Vee, GND and all other inpuVoutput voltages with respect to VBB . . . . . . . . . . . . -0.3V to +1B.OV Storage Temperature . . . . . . . . . . . . -55°C to +150°C Operating Temperature . . . . . . . . . . . . . O°C to +70°C cw Standard Conditions: (unless otherwise noted) 0:: Voo=+11V±5%, 70mA(typ) ,110mA(max.) Vee=+5V±5%, 12mA(typ) ,25mA(max.) ~ o no:: o u ~ en w ~ g CI) CI) ct all w Z 0:: o Characteristic Clock Inputl High Low Input current Logic Inputl Low High (All Lines except BDRDY) High (Bus Data Ready Line See Note) c ct @ AC CHARACTERISTICS CI) o :!: ct Sym Min Typ·· Max Units VlHe VILe 10.0 0 - - - - Voo 0.6 15 V V rnA VIL VIH 0 2.4 - 0.65 Vee V V VIHB 3.0 - Vee V VOH VOL 2.4 - Vee - - 0.5 V V 10H = 100llA 10L= 1.6mA - 0.45 0.45 V V 10L= 2.0mA 10L= 1.6mA - ns Conditions OC CHARACTERISTICS Logic OutPUtl High Low (Data Bus Lines DO-D15) Low (Bus Control Lines, BC1,BC2,BDIR) Low (All Others) In V BB = -3V±10"Io, 0.2mA(typ) , 2mA(max.) Op~rating Temperature (TA)=O°C to +70°C VOL VOL - - VIHC = Voo'-1 Clock Pulse Inputl, 4>1 or 4>2 Pulse Width Skew (4)1, 4>2 delay) t4>2,14>2 250 - - ns t12, t21 0 Clock Period tcy 0.5 - 2.0 /loS Rise & Fall Times tr,tt - - 15 ns Master SYNC: Delay from 4> tms - - 30 ns 00-015 BUI Signall Output delay from 4>1 (float to output) Output delay from .p2 (output to float) Input setup time before .p1 Input hold time after 4>1 tBO - - 200 ns t BF t B1 tB2 0 10 50 - - ns ns ns BUI Control Signall BC1,BC2,BOIR Output delay from 4>1 t DC - 200 ns t BU t ro trw - - - ns ns ns BUSAK Output delay from 4>1 TCI Output delay from .p1 TCI Pulse Width EBCA output delay from BEXT input EBCA wait time for EBCI input - - 150 200 300 tOE tAl - - 150 400 ns ns Cqi1,C4>:1 - 20 30 pF CIN - - 6 5 12 10 pF pF Co - 8 15 pF CAPACITANCE .p1, 4>2 Clock Input capacitance Input Capacitance DO-D15 All Other Output Capacitance DO-D15 in high impedance state 1 TTL Load & 25 pF TA = +25°C: Voo = +12V: Vee = +5V: V BB =-3V: 14>1 t .p2 = 120ns ··Typical values are at +25°C and nominal voltages .. NOTE: The Bus Data ReaDY(BDRDY) line is sampled during time period TSI after a BAR or ADAR bus control signal. BDRDY must go low requesting a wait state 50 ns before the end of TS1 and remain low for 50 ns minimum. BDRDY may go high asynchronously. In response to BDRDY, the CPU will extend bus cycles by adding additional microcycles up to a maximum of 40 ",sec duration. 16-05 1081680 ELECTRICAL CHARACTERISTICS Maximum Ratings· Voo and Vee and all other input/output voltages with respectto GNO ...............•...........••.............. -0.3V to +18V Storage Temperature . '.' .•.......•............•......•.... -55° C to +1,50° C Operating Temperature ........•......•....................... 0°Cto+70°C -Exceeding these ratings could cause permanent damage. Functional operation of this device at these conditions is not implied-operating ranges are specified below. Standard Conditions (unless otherwise noted) All voltages referenced to GNO Voo = +12V :!:5% Vee = +5V :!:5% Operating Temperature (T A) = 0° C to +70° C Symbol Min Typ·· Max Unit High Vihc 2.4 - Voo V Low Vilc 0 .5 V High Vi~ 2.4 - Low Vii 0 - Vee .65 V High Voh Vol 2.4 Vee - V 10h = 100pA - - .5 V 101 = 1.6mA Clock period t}Jc 0.4 f.1s tcl 70 - 4.0 Clock width - ns 10 ns Characteristic Condition DC CHARACTERISTICS Clock Input: Logic Inputs: Logic Outp.yts: Low V AC CHARACTERISTICS Clock Inputs CK1, Rise & Fall times tcr,tcf - C in - 6 12 pF Yin = OV 5 10 pF Yin = OV - 8 15 pF CAPACITANCE (T A =25°C, Voo = +12V, Vee = +5V) Input Capacitance: 00-07 All others Output Capacitance: Cout --Typical values are at +25° C and nominal voltages. TIMING DIAGRAM ~~ ~ ~ ~ ~ I- W' -U tel tpe -----I ~ f4- ter I tel "I u U -'] BDIR BC2,BCl , I 1 ----.j ,. ._______ t De Note: CK1- not drawn to scale. I+- CiRCUIT DESCRIPTION This circuit is designed to provide all the data buffering and control functions required when interfacing the Series 1600 Microprocessor System to a simple peripheral device. Data is transferred to and from the peripheral on 16 bidirectional lines, each of which can be considered to be an input or output. The transfer of. information with the CPl600 is accomplished via an 8bit highway, the 16-bits being transferred as two 8-bit bytes. the register addresses are assigned CP1600 memory locations, as follows (N is an arbitrary starting address): Register Address N N+1 N +2 N+3 N+4 N +5 N+6 N+7 16-06 Description Control Register Data Register Low Order 8-bits Data Register High Order 8-bits Timer tow Order a-bits Timer High Order 8-bits Peripheral Interrupt Address Vector Timer Interrupt Address Vector Error Interrupt Address Vector c Chapter 17 w ~ oQ. a: THE GENERAL INSTRUMENT 1650 SERIES MICROCOMPUTERS a: o(J ~ enw ~ U o en en c:( all w Z a: o The 1650 series of one-chip microcomputers have been manufactured by General Instrument to compete in the highvolume. price sensitive. digital logic replacement market. If we compare the 1650 series of one-chip microcomputers to other one-chip microcomputers. they are most similar to the 3870; in reality. they are copies of no other product. They are unique devices in their own right. Describing the 1650 family of microcomputers at this point in the book is. perhaps. not strictly accurate. since they are not 16-bit microcomputers. nor do they have any re!ationship to the CP 1600 described in the previous chapter. CD en o ~ c:( c c:( @ The 1650 series have separate on-chip program and data. memories. Program memory is 12 bits wide. while data memory is 8 bits wide. Table 17-1 summarizes the 1650 options. None of these microcomputers are expandable. If your application outgrows the 1670. th!3n you must look elsewhere for a replacement. The prime source for the 1650 series of microcomputers is: GENERAL INSTRUMENT CORP. Microelectronics Division 600 West John Street Hicksville. New York 11802 In Europe a second source for the .1650 is: INTERMETALL 19 Hans-Bun Strasse 7800 Freiburg West Germany The 1650 series microcomputers use a single +5V power supply. With an oscillator frequency of 1 MHz. instructions execute in four or eight microseconds. 1650 series devices are packaged as 18-pin. 28-pin. or 40-pin DIPs. They are manufactured using NMOS ion implantation technology and have TTL-compatible signals. Figure 17-1 illustrates that part of our general microcomputer system logic which is implemented on the 1650 series one-chip microcomputers. Once again. we must warn against making direct comparisons using these figures; logic shown as present says nothing about the extent to which the logic has been implemented. Re~d/write memory is shown only half present because between 11 and 39 bytes of on-chip read/write memory are provided by the various 1650 options. 64 words is the smaliest amount of read/write memory provided by any other one-chip microcomputer. A 1650 FUNCTIONAL OVERVIEW Logic of the 1650 series microcomputer~ is illustrated functionally in Figure 17-2. The Arithmetic and Logic Unit and the Control Unit are inaccessible to you as a user. therefore we will ignore this portion of the microcomputer. Table 17-1. 1650 Series One-Chip Microcomputer Options Part Number Program Memory 12-Bit Words Data Memory Bytes I/O lines 1650 1655 1670 1645 512 512 1024 256 23 23 39 16 8x4 8x 1 8x4 4 xl Input Only lines Output Only Lines - - 4 x 1 8 x 1 Stack Levels - - 2 2 4 4 x 1 4 x 1 3 17-1 Interrupts Power Supply Package Pins No No Yes Yes +5V +5V +5V + 5V 40 28 40 18 Direct Memory Access Control Logic Interrupt Priority Arbitration ... I/O Comniuni\iation Serial tP". Par~"'el Interface Logil= .':' Figure 17~ 1. Logic of the 1650 Series Microcomputers 17-2 RTCe R1 R2 =PC c w ~ II: R3 =PSW 0 a.. R4 = FSR II: 0 U ~ R5 en w ... R6 c( (3 0 R7 en en c( CI/I w Z Control Unit R8 R9 II: 0 a:I en 0 Scratchpad Memory ~ c( C c( @ Program Memory R31 MClR OSC ClK OUT Figure 17-2. 1650 Functional Logic Program memory is 12 bits wide. The 1650 has 512 words of program memory. As iIIustrated in Table 17-1, other variations may have 256 or 1024 words of program memory. All 1650 PROGRAM MEMORY program memory is read-only memory. There are currently no EPROM or EAROM program memory versions of the 1650. For development purposes. there is the 1664. which has no on-chip program memory; rather. it generates a memory Address Bus and a program memory Data Bus via a 64-pin DIP. so that external program memory can be accessed. Note that General Instrument has strong EAR OM (Electrically Alterable Read-Only Memory) technology. but no significant EPROM (Erasable Programmable Read-Only Memory) technology. EPROMs and EAROMs are described in Volume 3. I/O ports of 1650 series microcomputers are connected directly to a-bit registers which can also be accessed as general purpose registers. In Figure 17-2. Registers R5. R6. R7. and R8 are shown connected to four 8-bit bidirectional 1/0 ports. I/O variations for other 1650 options are summarized in Table 17-1. Register connections for these other options are defined in Table 17-2. ' 1650 I/O PORT REGISTERS 1650 I/O PIN LOGIC Those 1650 series microcomputer I/O pins which are defined as bidirectional are, in reality, pseudo-bidirectional. Pin logic is illustrated in Figure 17-3. The logic illustrated in this figure has become standard pseudo-bidirectional pin logic for one-chip microcomputers. The 3870 and 8048 have similar logic. When outputting data to a 1650110 port pin. the data is applied to theD input of a D-type flip-flop. which is clocked by an internal WRITE control signal. The reason for having two sets of gates on the flip-flop output is to provide a high voltage from VXX when switching a pin low. Vee sources 100 microamps. Thus. external logic connected to a. highlevel pin need only sink 100 microamps in order to pull a high pin low. External logic that attempts to write a '1 to a pin that is outputting 0 must pull-up Q2. which will be on and connected to ground; this is not feasible. Therefore. as was 17-3 the case for other one-chip microcomputers. the CPU can output a 0 or a 1 to any pin. but a pin that is going to receive input must first have a 1 written to it. External logic can now leave 1 at the pin. or can pull the 1 to a O. External logic cannot write a 1 to a pin that is outputting O. For a complete discussion of this pseudo-bidirectional logic, refer to the 8048 functional overview presented in Chapter 6. . 1650 SERIES MICROCOMPUTER PROGRAMMABLE REGISTERS All of the 1650 series microcomputers have a single 8-bit Accumulator plus a register file, as illustrated in Figure 17-2. All registers in the register file are eight bits wide. with the exception of the Program Counter and the Status register. The Accumulator, which is referred to in General Instrument's literature as the W regis~er, is a primary Accumulator, as described for other microcomputers in this book. It is the source of one operand for two-operand instructi~:ms. and an optional destination for any instruction that moves or operates on data. 1650 ACCUMULATOR vee ~;:1 III I I Vxx (lOV) On (INTERNAL DATA BUS) .....- - - - - - 1 0 Q WRITE (INTERNAL SIGNAL) e S ':' READ (INTERNAL SIGNAL) Figure 17-3. 1650 Series Microcomputer Bidirectional I/O Port Pin Logic Register 0 does not exist. When identified by any instruction, implied register addressing via Register 4 is assumed. That is to say. when Register 0 is specified as a source or destination. the register identified by R4 will be selected instead. For example. suppose R4 contains OF16. An instruction which selects RO will then. in fact. access R15. Register R1 C~ln be used as a general purpose register unless you are making use of 1650 real-time clock/counter logic. Every high-to-Iow transition of the RTCC input increments the contents of R1. Register R2 is the Program Counter. The bit width of Register R2 depends on program memory 1650 size. For 1650 series microcomputers that have 512 words of program memory. R2 will be nine PROGRAM bits wide. The 1670 one-chip microcomputer will have a 10-bit R2 register. while the 1645 will COUNTER have an 8-bit R2 register. R2 is a write-only location; however. it is otherwise treated as a general purpose register. Thus. any instruction that specifies a general purpose register as a destination. without 17-4 specifying the same general purpose register as a source. can select Register R2. But note that all data manipulations operate on eight bits of data only. Thus. to a limited extent. 1650 series microcomputer program memory is divided into 256-word pages. Register R3 is the Status register. This register is only three bits wide and contains the following status flags: cw ~ a: o0.. 0 ",--Bit No. 2 a: o o 1650 STATUS REGISTER Register R3. the Status register ~ en w ~ '-----Carry (C) g en en - - - - - - D i g i t Carry (DC) c( ' - - - - - - - - - Z e r o (Z) c!I w Z a: o !XI c( The Carry status is absolutely standard. It reflects a carry out of the high-order bit following an arithmetic operation. When a subtract instruction is executed. the Carry status is set if twos complement addition causes a carry out of the high-order result bit. c( The Digit Carry status is an Auxiliary Carry: it identifies any carry from bit 3 to bit 4: en o ~ c @ 6 4 3 2 o "'--BitNo. Carry here sets DC The Zero status is set to 1 when an arithmetic operation produces a 0 resu It: it is reset to 0 when an arithmetic operation generates a non-zero result. Register R3 is a read/write location. Instructions can identify R3 as a source or destination for data. When reading the contents of R3. bits 3 through 7 will be read as 1 bits. When writing to R3. bits 3 through 7 will be lost. Register R4 is a register pointer similar to the ISAR register described for the 3870. Register R4 is an 8-bit register: however. the low-order five bits are interpreted as a register select whenever an instruction identifies RO (which does not exist). Table 17-2. 1650 Series Microcomputer Register DeSignations FUNCTION 1650 REGISTER 1655 1670 RO Rl R2 R3 R4 R5 Not implemented. Specifies implied register addressing via R4 Real-time clock/counter register Program Counter Status register File Select register. holds implied register address I/O Port A I/O PortA I/O Port A R6 I/O Port B R7 I/O Port C Output Port B I/O Port B R8 R9-R19 Input Port C (bits 0-3 only) I/O Port 0 Scratchpad register Scratchpad registers present in all versions R20-R23 R24-R31 R32-R47 Scratchpad registers Scratchpad registers Not present I/O Port C I/O Port 0 1645 I/O Port A (bits 0-3 only) Output Port B (bits 0-3 only) Input Port C (bits 0-3 only) Scratchpad register } Not present Scratch pad registers 17-5 Registers R5 through RS are connected to I/O ports in various ways for different members of. the 1650 family, as defined in Table 17-2. When you write to anyone of these four registers. associated I/O port pins. if they contain output logic. will generate a high output level for a 1 and a low output level for a O. When you read the contents of Register R5. R6. R7. or R8. then each register bit that is connected to an I/O port input pin will reflect the level of the most re~ cently input data. For 'an I/O pin. if no data has been input. then the most recently output data will be read back. Any register bit that is not connected to an I/O port pin becomes a standard Scratchpad register. bit. Whatever was most recently written to this bit will be read back. Beginning with Register R9, remaining registers are general Scratchpad registers. Different 1650 versions provide different numbers of Scratchpad registers. 1650 SERIES MICROCOMPUTER MEMORY ADDRESSING MODES Since the 1650 series microcomputers have a very small number of data registers; they have very simple data memory addressing options. Scratch'pad registers up to R31 may be identified directly by any instruction that operates on data. If Register RO is identified. however. then the register selected by the low-order five bits of Register R4 will in fact be selected. This may be illustrated as follows: Select R O - . . ---- Rll-_ _--f R2 R3 R4 1-----1 1-----1 9A 1-----1 9A= l00l...JJ;>.!9 R51--_ _-I R6 1A16 = 26 10 -,-. 1-----1 R7 R21 R22 R23 R24 1-----1 1-----1 1-----1 1-----1 R25 Select Register R26 1-----1 R26 1------1 For the 1670 only. six bits of Register R4 are active address bits. This is necessary since.the 1670 has general purpose registers numbered up to 4710. Note that for the 1670, general-purpose registers R32 through R47 can be accessed only via Register R4, using indirect addressing. Program memory is addressed by Jump instructions and Jump-to-Subroutine instructions, using direct addressing only. Jump instructions can identify any 9-bit address - covering the 512 words of program memory. The Jump-to-Subroutine instruction can directly address only the first 256 'words of program memory; all subroutines must therefore be origined in the first 256 words of program memory. although a subroutine can be called from any memory word. The 1670 one-chip microcomputer has a four-level Stack; other 1650 series one-chip microcomputers have a two-level or three-level Stack. Thus. with the exception of the 1670 and the 1645. only a single level of subroutine nesting is allowed. The 1670 allows three levels of subroutine nesting. the 1645. two. For a program that can only be 512 words long. two levels of subroutine nesting are probably quite sufficient. 1650 SERIES MICROCOMPUTER PINS AND SIGNALS Figure 17-4 illustrates pins and signals for the 1650 microcomputer. 1645 pin assignments are not available at the present time. 17-6 The 1650 series microcomputers communicate y.Jith external logic via their I/O ports. In Figure 17-4, three types of I/O pins are identified: pseudo-bidirectional, input-only, and output-only pins. We have already described the logic of pseudo-bidirectional pins. Input-only and output-only pins, as their names imply, are limited to receiving data from external logic only or transmitting data to external logic only. The 1650 series microcomputers have just two control signals: MCLR and RTCC. ffi ~ ~ Q. MCLR is a master reset control input. This signal should be held low for at least 1 millisecond after the power supply is valid. It forces all output pins to a high level and it sets all Program Counter bits to 1. Therefore, the first instruction executed following a reset will be located at the highest program memory location. II: o o ~ u) w ~ g (I) (I) < (Ground) VSS AO Al A2 TEST 2 3 4 6. 7 8 9 10 11 12 13 14 IIi:I A3 w A4 II: A5 Z oa:I A6 A7 BO Bl B2 B3 B4 B5 (I) o :!: < c < @ B6 B7 CO Cl Pin Name AO - A7 BO - B7 CO -'C7 DO - 07 MClR RTCC TEST OSC ClK OUT Vxx, VCC, Vss 1650 MICROCOMPUTER 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 .Description . I/O Port A I/O Port B I/O Port C I/O Port 0 System Reset Clock/Event Counter Debug and chip test control Clock Clock Power, .Ground VXX (+ 10V or + 5V) VCC (+5V) RTCC MClR OSC ClK OUT 07 06 05 04 03 02 01 DO C7 C6 C5 C4 C3 C2 Type Pseudobidirectional Pseudobidirectional Pseudo bidirectional Pseudo bidirectional Input Input Input Input Output Figure 17-4. 1650 Microcomputer Signals and Pin Assignments On high-to-Iow transitions of RTCC, the contents of Register R1 are incremented. RTCC will not respond to a frequency that is greater than 250 KHz. That is all there is to 1650 counterltimer logic. No interrupts are generated on a time-out. nor is there any special logic associated with reading the contents of Register R1 or writing to this register. A program will access Register R1 as it wou Id any other register, and RTCC will increment register contents without regard to events internal to the microcomputer. 1650 COUNTER/ TIMER LOGIC If you are not using counterltimer logic, it is a good idea to ground the RTCC pin. TEST is a-control input used to read the contents of program memory as data. General Instrument purposely provides no information on the TEST pin or how it is used, since they do not want customers using this pin. 17-7 Two pins are associated with clock logic: the OSC input and the CLK OUT output. For very precise execution frequency. an external oscillator signal can be input via OSC. For less precise input. an RC network may generate the input as follows: Vee ",J}--osc . c." 1" Rext and Cext options are described in the data sheets at the end of this chapter. The clock signal which drives the microcomputer is output via ClK OUT. The very simple timing associated with 1650 series one-chip microcomputers is given in the data sheets at the end of this chapter. Although you can run any 1650 series one-chip microcomputer with a single +5V power supply. it is sometimes desirable to have an additional +10V power supply connected to the VXX input. As illustrated in Figure 17-3. this power supply allows the bidirectional I/O port pins to sink more current, typically to drive higher current loads such as LED displays. 1650 TIMING 1650 VXX POWER SUPPLY None of the 1650 series microcomputers have any DMA or interrupt logic. The absence of DMA logic makes a lot of sense; the whole concept of Direct Memory Access is ridiculous when your data memory consists of 39 bytes or less. The absence of interrupt logic is simply a designer's choice. There are plenty of arguments for including interrupt 'Iogic in a one-chip microcomputer. since this allows external devices to influence event sequences asynchronously within the one-chip microcomputer. In the absence of interrupt logic. a program executed by a 1650 series microcomputer must test an input pin looking for a high or low level to trigger specific events. 1650 SERIES MICROCOMPUTER INSTRUCTION SET The 1650 series microcomputer instruction set is summarized in Table 17-3. We have arbitrarily chosen to classify instructions which access registers as memory reference instructions. These are also I/O instructions if Register R5. R6. R7. or R8 is identified. If Register R3 is identified. they become status instructions. Furthermore. any of these instructions could also be classified as register-register instructions. I nstructions that test. set. and clear bits become I/O instructions if a bit of Register R5. R6. R7. or R8 is specified; they are Status registers if Register R3 is specified. The more you look at the 1650 instruction set. the more mu Itifaceted many of the instructions become. Generallnstrument recognized this fact by creating assembly language instruction mnemonics to identify special cases of instructions. These are summarized in Table 17-4. There are two anomalies in ~he 1650 instruction set which you must guard against. There is no Add-with-Carry instruction. This makes it difficult to handle multi-byte arithmetic. Consider 16-bit binary addition. You can start off simply enough by adding the two low-order bytes: this will generate a carry for the two high-order bytes: " 1 ... 31 24 C EA 68 55 On first inspection. adding the two high-order bytes looks like .no problem. You can add the carry to the augend: 0 ... 32 24 C EA 68 55 17-8 Then you add the high-order addend byte to the sum of the high-order augend byte plus the carry: o cw ~ a: oQ. EA 6B 56 55 A problem arises if the high-order augend byte happens to be FF. Now when you add a carry to FF. you get 00 and the carry is reset: 1..- a: o (J FF 24 ~ enw ~ g o o ~ «c « @ ~ 00 24 24 ell a: en en 00 24 55 « o C--'l EA 6B EA 6B 55 Upon adding the high-order adden9 byte. the Carry status will be cleared erroneously: en en w Z C :41 32 24 C (should be 1) EA 6B 55 This becomes a significant problem when dealing with numbers that are three or more bytes long. since you can no longer guarantee that the correct carry"will be generated for the second and higher-order bytes. There are ways around this problem. but they lead to more complex programs. Fortunately the problem is not particularly severe. since in an application that is limited to a data memory as small as that of the 1650 you are most unlikely to have much multi-byte arithme·tic anyway. .. Note that any time you return from a subroutine you will modify the contents of the Accumulator. Table 17-5 summarizes 1650 instruction object codes and execution times. THE 1650 BENCHMARK PROGRAM Our standard benchmark program is of little use with the 1650 microcomputers. Given the very small amount of data memory available. moving blocks of data around makes no sense. We therefore illustrate a modified benchmark program in which a number of data bytes are input via I/O Port A and then output via I/O Port B. The first data byte input identifies the length of the data block which follows. We are going to use bit 0 of I/O Port C to provide handshaking controls between the 1650 and external logic. Whenever external logic transmits new data to I/O Port A. it resets bit 0 of I/O Port C low. The 1650 program tests this bit before attempting to read data from I/O Port A. As soon as the program outputs data to I/O Port B. it sets I/O Port C bit 0 high again. Thus. external logic can wait until it detects I/O Port C bit 0 high before attempting to input new data - which will be followed by I/O Port C bit 0 being pulled low by external logic. Here is the necessary instruction sequence: L1 LOOP L2 MOVLW MOVWF BSF BTFSC GOTO MOVF MOVWF BSF BTFSC GOTO MOVF MOVWF MOVLW MOVWF DECFSZ GOTO FF R5 R7.0 R7.0 L1 R5 R9 R7.0 R7.0 L2 R5.0 R6 FF R5 R9 LOOP INITIALIZE PORT A FOR INPUT BY OUTPUTTING ALL HIGH BITS SET PORT C BIT 0 HIGH IF PORT C BIT 0 IS O. READ FIRST DATA BYTE INPUT FIRST BYTE STORE AS A COUNTER IN R9 SET PORT C BIT 0 HIGH IF PORT C BIT 0 IS O. READ NEXT DATA BYTE INPUT NEXT DATA BYTE FROM PORT A OUTPUT VIA PORT B PREPARE PORT A FOR NEW INPUT DECREMENT R9 IF NOT ZERO. RETURN FOR NEXT BYTE 17-9 These abbreviations are used in Tables 17-3 and 17-4: R Any register W Accumulator. or W register d Destination identifier digit: must be 0 or 1. (Ff] Ones complement of Register R contents DATA Immediate 8-bit data value LABEL9 Program memory address (9 bits) [ STACK]- Push onto Stack - [ STACK] Pop off Stack n A bit identification number. in the range 0 through 7. (0 low-order. 7 high-order! 17-10 © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 17-3. A Summary of the 1650 Series Microcomputer Instruction Set TYPE MNEMONIC OPERAND(SI MOVF R,O MOVWF R STATUSES BYTES ~--~--~----__--~--~--~ C DC OPERATION PERFORMED z x [W]-[R] Move register (or I/O portl contents to Accumulator. [R]-[W] Move Accumulator contents to register or I/O port. x x x [W]-[W]+ [R] if d=O. [R]-[W]+ [R] if d=l. x Add Accumulator and register contents. Store sum in the Accumulator or source register. [W]-[W] AND [R] if d=O. [R]-[W] AND [R] if d=l ADDWF R,d ANDWF R,d ClRF R COMF R,d x DECF R,d x INCF R,d x IORWF R,d x RlF R,d x AND Accumulator and register contents. Store result in the Accumulator or source register. [R]-.O Zero Register R contents. [W]-nn if d=O. [R]-nn if d=l Store the ones complement of register contents in the Accumulator, or back in the register. [W]-[R] - 1 if d=O. [R]-[R] - 1 if d=l Store decremented register contents in the Accumulator, or back in the register. [W]-[R] + 1 if d=O. [R]-[R] + 1 if d=l Store incremented register contents in the Accumulator, or back in the register. [W]-[R] OR [.w] if d=O. [R]-[R] OR [W] if d=1. OR Accumulator and register contents. Store result in the Accumulator or Source register. left rotate register contents. Store result in Accumulator if d=O or in register if d=l. C n. L RRF R,d x ··1.....1 . . . . . .1--'--1~I. . . 1--'-1 . ......1.....1 , Register contents Right rotate registBL"'Contents. Store result in Accumulator if d=O or in register if d=l. c ltJ ~"'_....I.I_. .I.........I__IL. ....I_. . I_*""' . ' I~I Register contents Table 17-3. A Summary of the 1650 Series Microcomputer Instruction Set (Continued) STATUSES TYPE a:: ~ MNEMONIC OPERAND(S) SUBWF R.d SWAPF R.d BYTES ~--~----r---'----r--~--~ C DC x 'X x r/) (; w a:: ~~ OPERATION PERFORMED z [W]-[R]- [W] if d=O.[R]-[R]- [W] if d=1 Subtract Accomulatorc.contents from register contents. Store result in Accumulator or source register. Swap register nibbles. Store result in Accumulator if·d=O.or in. register if d=l. > a:: a:: w + I I I I I I I I I 00.. ~9 ~~ o·W a:: ::::w >~ + < o Z o XORWF w Register contents ~~ a:: a:: (J r ~'---,/--~'--' WW R.d x I :Exclusive-OR Accumulator and register contents. Store result in Accumulator if d =0 or in register if d=l. r/) [W]-DATA load immedrate data into Accumulator. MOVlW DATA GOTO LABEl9 [ R2]-LABEl9 Jump to instruction LABEl9. anywhere in 512 word program memory. a:: W::::l ZI-w I-a:: CAll LABEl8 [STACK]-[R2]+ 1. [R2]-LABEl8 Jump to subroutine origined at LABEl8. anywhere in first 256 words of program memory. Push ::::10 RET Z ~Z return address onto Stack.. [R2]-[STACKl. [W]-O Return from subroutine and clear Accumulator. [R2]-[STACKl. [W]-DATA Return from subroutine and load immediate data into Accumulator. 11:1< ::::I..J r/)..J < (J RETlW DATA ANDlW DATA x IORlW DATA x XORLW DATA x w I- ~ W 0.. o 'w I- < C w ~ ~ [W]-[W] AND DATA AND Accumulator contents with immediate data. Store result in Accumulator. [W]-[W] OR DATA OR Accumulator contents with immediate data •. Store result in Accumulator. [W]-[W] XOR DATA Exclusive-OR Accumulator contents with immediate data. Store result in Accumulator. © ADAM OSBORNE & ASSOCIATES,INCORPORATED Table 17-3. A Summary of the 1650 Series Microcomputer Instruction Set (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED C Z BTFSC BTFSS DECFSZ INCFSZ 0 i= is Z 0 U R.n R.n R.d R.d DC Z Test bit n of Register R. If it is O. skip the next instruction. Test bit n of Register R. If it is 1. skip the next instruction. Decrement Register R contents. If the result is zero. skip the next instruction. Increment Register R contents. If the result is zero. skip the next instruction. 1 1 1 1 Z 0 Il. i;;: en a:w CLRW WI- 1 [W]-O Clear Accumulator. 1-« ~a: OW wil. a:0 en enl- Z ::liij2 I-c~ ~za: BCF BSF R.n R.n Reset bit n of Register R to 0 Set bit n of Register R to 1 en«~ .0 NOP No operation. Table 17-4. Mnemonics Recognized by the 1650 Assembler for Special Cases of General Instructions Special Mnemonic CLRC SETC CLRDC SETDC CLRZ SETZ SKPC SKPNC SKPDC SKPNDC SKPZ SKPNZ TSTF R MOVFW R NEGF R,d ADDCF R,d S~BCF R,d ADDDCF R,d SUBDCF R,d B LABEL9 I3c LABEL9 ;. ~ ~NC LABEL9 ,~ Bq~ LABEL9 ,- ~NDC LABEL9 BZ LABEL9 BNZ LABEL9 Equivalent Mnemonic{s) Status Affected - BCF 3,0 BSF 3,0 BCF 3,1 BSF 3,1 BCF 3,2 8?F 3,2 BTFSS 3,0 BTFSC 3,0 BTFSS 3,1 BTFSC 3,1 BTFSS 3,2 BTFSC 3,2 MOVF R,1 MOVF R,O COMF R,1 INCF R,d BTFSC 3,0 INCF R,d BTFSC 3,0 DECF R,d BTFSC 3,1 INCF R,d BTFSC 3,1 DECF R,d GO TO LABEL9 BTFSC 3,0 GO TO LABEL9 BTFSS 3,0 GO TO LABEL9 BTFSC 3,1 GO TO LABEL9 BTFSS 3,1 GO TO LABEL9 BTFSC 3,2 GO TO LABEL9 BTFSS 3,2 GO TO LABEL9 - Z Z Function Clear Carry Set Carry Clear Digit Carry Set Digit Carry Clear Zero Set Zero Skip on Carry Skip on No Carry Skip on Digit Carry Skip on No Digit Carry Skip 0'1 Zero Skip on No Zero Test File Move File to W Negate File Z Add Carry to Fil~ Z Subtract Carry from File Z Add Digit Carry to File Z Subtract Digit Carry from File Z - Branch Branch on Carry Branch on No Carry Branch on Digit Carry Branch on No Digit Carry Branch on Zero Branch on No Zero - The following abbreviations are used in the "Object Code" column of Table 17-5: C - a "don't care" binary digit n - binary digits that identify a bit number r - binary digits that represent a register number x - any hexadecimal digit a - binary digits of a nine-bit address Abbreviations defined for Tab!e 17-3 are preserved in the "Instruction" column of Table 17-5. 17-14 Table 17-5. 1650 Instruction Set Object Codes Object Code Instruction c w ~ 0: oDo: o CJ ~ enw ~ U o (I) (I) c:( ell w Z 0: o m (I) o ~ c:( c c:( @ ADDWF ANDLW ANDWF BCF BSF BTFSC BTFSS CALL CLRF CLRW COMF DECF DECFSZ GOTO INCF INCFSZ IORLW IORWF MOVF MOVLW MOVWF NOP RET RETLW RLF RRF SUBWF SWAPF XORLW ooo111drrrrr Exx ooo101drrrrr 0100nnnrrrrr 0101nnnrrrrr 0110nnnrrrrr 0111nnnrrrrr 9xx 00000 1 1rrrrr 0000010ccccc 001001drrrrr 0000 1 1drrrrr 001011drrrrr 101aaaaaaaaa 00 10 1Odrrrrr 001111drrrrr Dxx 000 1OOdrrrrr 001000drrrrr Cxx 000000 1rrrrr 000 800 8xx 001101drrrrr 001100drrrrr 00001 Odrrrrr 001110drrrrr Fxx R,d DATA R,d R,n R,n R,n R,n LABEL R R,d R,d R,d LABEL9 R,d R,d DATA R,d R,d DATA R DATA R,d R,d R,d R,d DATA All object codes occupy one 12-bit word. All instructions execute in one machine cycle, with the exception of conditional Skip instructions, which execute in one machine cycle for no skip or two machine cycles to skip. 17-15 DATA SHEETS The following section contains electrical data for the 1650. c w ~ a: oa.. a: o u !: u) w ~ g C/) C/) c:( o1J w Z a: o !XI C/) o ~ c:( c c:( @ 17-01 1650 ELECTRICAL CHARACTERISTICS MAXIMUM RATINGS· "Exceeding these ratings could cause permanent damage. Functional operation of this device at these conditions is not implied-operating ranges are specified below. Storage Temperature ....................................... -55·C to +150·C Operating Temperature ......................................... O·C to +70·C Vee. Vxx • and all other input/output voltages with respect to Vss ................................. -0.3V to +12.0V STANDARD CONDITIONS (unless otherwise noted) Vee: +5V ± 5% Vxx: +4.75V to 10.0V Characteristics Sym Min Typ** Max Units Conditions DC CHARACTERISTICS Power Supply Currents Logic Inputs Low High Logic Outputs Low (Note 1) High - Ice Ixx - 35 1 50 5 mA mA VIL VIH 0 2.4 - .65 Vee V V VOL VOH 2.4 - 0.45 Vee V V MHz KHz Vxx=5V @ IOL=1.6mA IOH=100pA min. AC CHARACTERISTICS OSC Frequency RTCC Frequency CLKOUT Frequency ClK OUT Rise Time Fall Time I/O Registers A. B, C, D Output Mode: Delay From CLKOUT Input Mode Set-Up hold - .2 DC .25 fin - 1 200 - - - tr tf - - - 200 200 ns ns 1 TTL load and 100 pF too - - 500 ns 1 TTL load and 100 pF tIS tlH 0 100 - - ns ns fIN - 1650 LED Direct Drive Vxx drives the gate of the output buffer. allowing adjustment of lED drive capability: VOUT 0.4V 0.7V 0.4V 0.7V 1.0V Vxx 5V 5V 10V 10V 10V ISINK (typ.) 2.5mA 4.2mA 5.BmA 1O.0mA 14.1mA 1650 OSCILLATOR INPUT The oscillator input (OSC) can be driven directly by a crystal with compatible output or by an external RC network. Vee R... CRYSTAL ~ osc C. XI 1 ~osc I CLOCK OUT (pSI 1650 TYPICAL OSCILLATOR RC CHART @ 25°C We reprint data sheets on pages 17-D2 through 17-D3 by permission of General Instrument Corporation. 17-02 1660 I/O TIMING INTERNAL WAVEFORMS c w !( a: o a. 01 1 elK OUT a: o o ~ u) w !( OUTPUT g en en < 011 w Z INPUT a: o CD en o :E c< < @ 17-03 w Chapter 18 a: THE TEXAS INSTRUMENTS TMS 9900, TMS 9980, AND TMS 9940 PRODUCTS , Q ~ a: o0.. o o ~ " . ' , enw ~ g CI) CI) c( o!J w Z a: oen CI) o ~ c( Q c( @ The TMS 9900 was the first 16-bit microprocessor that could compete effectively in the minicomputer market. In fact. the TMS 99QP is a one-chip implementation of the TM 990 series ~inicomputer Central Processing Units. The TMS 9900 is packaged as a 64-pin DIP; it generates signals for a 15-bit Addres~ Bus and a separate 16-bit Data Bus. whereas other 16-bit microprocessors multiplex their Data and Address Busses. The TMS 9980 series microprocessors are 40-pin DIP versions of the TMS 9900; in order to reduce pin counts. the TMS 9980 series microprocessors access external memory via an 8-bit Data Bus and 14-bit Address Bus. The TMS 9940 is a one-chip microcomputer containing a subset of the TMS 9900 Central Processing Unit. together with on-chip memory and realtime clock logic. The TMS 9900 product line has for some time been one of the enigmas of the microprocessor industry. Even a casual examination of the TMS 9900 instruction set shows that from the programmer's viewpoint. this microprocessor was at least two years ahead of its time. While it may have ,had problems competing in high-volume. simple applications. it was certainly the microprocessor of choice for data processing-type. program'-intensive applications. yet it was not widely used in these markets. The reason for this lack of acceptance has been poor support from Texas Instruments. Texas Instruments initially offered little support for the TMS 9900 because this microprocessor was designed as a lowend product of the TM 990 minicomputer series. That is to say. customers were expected to develpp products around the TM 990 minicomputers; then. if they chose to. they could build production models around 'the TMS 9900 microprocessor. This development path did not call for extensive TMS 9900 support. In:all probability. Texas Instruments was caught by surprise by the buoyancy of the microprocessor market - as a mark~tinits own right. Certainly. if Texas Instruments had given the TMS 9900 the same level of support that Intel gave the 8080A. we would see entirely different microprocessor product distributions today. But the TMS 9900 and its derivativeproduc;ts are powerful enough that the belated support they are now receiving from Texas Instruments will give the product line a reasonable share of future markets. . Texas Instruments now provides full support for the TMS 9900 microprocessor line. TIV!S 9900 support de'vices are designed specifically for the TMS 9900; therefore, they are described in this chapter rather than in Volume 3. Support devices can be used with the TMS 9900, TMS 9980, or TMS 9940 products. The following devices are described: ! . • • The TIM 9904 Clock Generator The TMS 9901 Programmable System Interface Texas Instruments is the primary manufacturer for all of the TMS 9900 series products. TMS 9900 series products are handled out of the following Texas1nstruments office: TEXAS INSTRUMENTS. INC. P.O. Box 1443 Houston. Texas 77001 Second sources for the TMS 9900 family are: AMERICAN MICROSYSTEMS. INC. 3800 Homestead Road Santa Clara. California 95051 SMC MICROSYSTEMS CORP. (TMS 9980 series only) 35 Marcus Blvd. Hauppage. N.Y. 11787 18-1 THE TMS 9900 MICROPROCESSOR The TMS 9900 is manufactured using N-channel silicon gate MOS technology. It is packaged as a 64-pin DIP. Three power supplies are required: -5V. +5V. and +12V. Using a 3 MHz clock. instruction execution times range between 3 and 10 microseconds. A TMS 9900 FUNCTIONAL OVERVIEW Figure 18-1 illustrates that part of our general microcomputer system logic which iS,implemented by the TMS 9900 CPU. The most important features of Figure 18-1 are: • The absence of programmable registers • The presence of significant interrupt handling logic • The presence of serial-to-parallel data conversion logic • The absence of .1/0 port interface logic Clock Logic Accumulator Register(s) Data 'Counter(s) . · .· .· .· . ·. . ".'i t . Stack Pointer . Direct Memory Access Control . Logic ...... /} Xi"/ i' ~ !III .•• i\ i '« . . ••• •..•••..••• qdcoMM6~lc;. . a . t. j. :;.on. .•. •[, . .•.•. •.•. . ,)? ~.i.a lt~..·/.p. a;;.r...•a....~.I.:I. . ...... ) / / / . . . . .s.,.. e. .•. . . . 1 iii i. .... ry9~~cJ~f~ssll1g,··. •·. .1 t· .· .· e~.· rf,· .a~ e~ . . . . . . . . . . . .. It.·. •.· ·I.•n. •• .•. . .c_.n. . ·.L.· O· · · g:I·.•c·. ·.i.<.•··. •· . • I i···.··.... .......... ....... . . . . . ............ I/O Ports Interface Logic '.'" Programmable Timers Read Only Memory I/O Ports 1 Figure 18-1. Logic of the TMS 9900 CPU . 18-2 , Read/Write Memory ~ ••••••••••.••••••••••• Let us first consider the manner in which the TMS 9900 handles programmable registers. TMS 9900 PROGRAMMABLE REGISTERS Within the logic of the TMS 9900 itself. there are just three 16-bit programmable registers: a Program Counter. a Workspace register. and a Status register. ~ ~ ~ ~ 8 ~ enw ~ g The Program Counter and Status registor are straightforward. The Program Counter contains the address of the next instruction to be executed. The Status register maintains various statuses. which we describe later in this chapter. The Workspace register is a unique and powerful programming feature of the TMS 9900. This register idontifies the first of sixteen 16-bit memory locations which act as 16 Genoral Purposo registers. This may be illustrated as follows: 16-BIT MEMORY Any memory HIGHORDER BYTE addresses CI) CI) - < CI/J w z a:: o m Special Functions LOCATION xxxx WP ~ xxxx ~~--------,~--------~, LOWORDER BYTE ........ ,... ~ ! I I ~ II' RO Rl xxx x + 2 CI) xxxx + 4 R2 ~ xxxx + 6 xxxx + 8 I R3 R4 xxxx + A xxxx + C I R6 xxxx + E : R7 xxxx + 10 xxxx + 12 I RB i o < o < @ RO cannot be an Index register. Shift instruction will seek shift count in low-order four RO bits if instruction object code specifies o shifts. R5 xxxx + 14 I R9 • Rl0 xxxx + 16 xxxx + 18 xxxx + lA i Rll ! R12 R13 Subroutine return address or XOP eftective addre ss CRU Bit address Save old WP xxxx + lC i I R14 Save old PC R15 Save old ST xxxx + lE I Some of the 16 registers serve special functions, as defined by the text on the right-hand side of the illustration above. For the moment. do not attempt to understand these special functions. They are described later in the chapter. In TMS 9900 microcomputer systems, oxternal momory consists of 16-bit momory words. Each 16-bit memory word has its own momory addr~ss. Within tho TMS 9900 CPU, however, memory is addressod as a sequence of a-bit locations. For this to occur. the CPU 18-3 TMS 9900 MEMORY ADDRESSES generates an internal 16-bit merT)ory address; the high-order 15 bits of the internal.memory address create the external memory addresses. This may be illustrated as follows: This 16-bit address is created by program logic to address 65536 bytes 'I (#~--------------~~~--------------~ These 15 address bits are output to access 32768 external, 16-bit memory words ~51" ~SB 1 y Byte Discrimination Bit 0 = Even Byte A ......- - - - - - - - " l L ! s ! j . 13 12 " 10 9 8 7 6 5 4 3 2 1 I0 1 = Odd Byte Bit No. I 1'1 I I I II I I I I I I I 1 J "'!emory Address Inside the CPU ~ II j ~ j j j j~ j j jll IE AO (LSB) A1 A2 A3 A4 A5 A6 A7 External Address Bus ~8 A9 A10 A11 A12 A13 A 14 (MSB) When designing hardware around the TMS 9900. you will implement external memory as 16-bit words. which are addressed by a 15-line Address Bus. That is to say. 32.768 16-bit words may be addressed. But when you are programming the TMS 9900 you will visualize memory as 65.536 bytes. addressed by a 16-bit address. An even byte address will access the low-order byte of an external 16-bit memory word, while an odd memory address will access the high-order byte of an e~ternal 16-bit memory word. Any 16 contiguous words of read/write memory may serve as the current 16 general purpose registers for the TMS 9900. . . You may ~ave as many setl? of 16-bit registers as you wish, limite~ only by the size of implemented memory. If you are using more than one set of 16-bit registers, then at any tim~ just one set of 16-bit registers can be selected. The WP register identifies the first ofthe 16 con1iguous memory locations serving as the current 16 general purpos~ registers. . . ' . Each of the 16 general purpose registers may be used to stors data or addresses. Thus. each general purpose register may serve as an Accumulator or as a Data Counter. Regist~rs R11 through R15 are used a~ special Pointer storage buffers; we will be describing the way in which these registers ~re used as the chapter proceeds. Having 16 general purpose registers in read/write memory, rather than in ttJe CPU, is the single most important feature of TMS 9900 architecture. The advantage of having 16 general purpose registers located anywhere in read/write rTH,3mory is that you can have many sets of 16 general purpose registers. For example. following an interrupt acknowleqge: you no longer need to save the contents of general purpose registers - all you need to do is save the conten1s' of the Program Counter. the Workspace register and the Status register. and that is done automatically by TMS 9909 interrupt handling logic. By loading new values into the Program Counter and the Workspace register. you 18-4 can begin executing a new program. accessing 16 new memory words general purpose registers. c w ~ a: o0. a: o o ~ rnw ~ g CI) CI) c( alJ w Z a: o CD CI) o ~ c( c which will be treated as a new set of 16 The disadvantage of having 16 general purpose registers in read/write memory is that no TMS 9900 microcomputer system can be configured without read/write memory; and if you are going to use many different sets of 16bit registers. then you are going to require a significant amount of read/write memory.'Furthermore. you lose the speed associated with executing register-to-register operations; there are no source and destination locations left in the CPU. Every register access becomes a memory access. TMS 9900 literature refers to the process of switching from one set of general purpose registers to another as a context switch. This terminology reflects the complete change of program environment that results from the switch. TMS 9900 CONTEXT SWITCH Special instructions allow you to perform a forward context switch or a backward.context switch. During a forward context switch. you load new values into the Workspace register and Program Counter. while simultaneously saving the old Workspace register. Program Counter. and Status register contents in the new General Purpose Registers R13. R14. and R15. A backward. or reverse context switch loads the current contents of General Purpose Registers R13 .. R14. and R15 into the Workspace register. Program Counter. and Status register. respectively. thus returning you to your previous set of general purpose registers. You can perform context switches as often as you like and whenever you like. For example. a very effective way of using context switching is to group data into contiguous memory words which you can identify as a register set. Upon entering a subroutine. you can perform a context switch which automatically creates all necessary initial data and address values in appropriate general purpose registers. This may be illustrated as follows: c( MEMORY WORDS @ Arbitrary Memory RO Rl R2 Rl ~h 0218 Rll R14 R15 Data and parameters used by subroutine are stored here by the calling ~ program before calling the subroutine RO Rl R2 Rl R4 0280 0282 0284 0286 0288 RIO 0294 0296 0200 18-5 TMS 9900 FORWARD CONTEXT SWITCH As illustrated above. when you perform a forward context switch, the current Program Counter contents. Status register contents. and WP register contents are saved in what will become the new Registers R13. R14 and R15. respectively. Here. is the exact sequence in which events occur: 1) The new WP register contents are loaded into the CPU and held in temporary storage. 2) The current Status register contents are written out to the memory location which will become the new Register R15. 3) The current Program Counter contents are written out to the memory location which will become the new Register R14. . 4) 5) The current WP register contents are written out to the memory location which will become the new Register R13. The new WP register contents. which were held in temporary storage. are moved into the WP register. 6) The new value is loaded into the Program Counter Thus. when a forward context switch is performed. an audit trail ensures that program logic knows the exact machine state at the instant of the forward context switch. When a backward context switch occurs, the contents of the current General Purpose registers R13, R14, and R15 are loaded into the WP register, the Program Counter, and the Status register, respectively. Thus. program logic returns to the location of the forward context switch. TMS 9900 BACKWARD CONTEXT SWITCH TMS 9900 MEMORY ADDRESSING MODES The TMS 9900 provides these four methods of addressing memory: 1) 2) 3) 4) Direct memory addressing Direct, indexed memory addressing Implied memory addressing Implied memory addressing with auto-increment The way in which the TMS 9900 implements these four memory addreSSing modes is exactly as described in Volume 1. Chapter 6. The important point to note is that the TMS 9900 looks upon its address space as consisting of 32.768 16bit memory words which are addressed using 15. rather than 16. Address Bus lines; yet programs compute all addresses as 16-bit words. This logic was described earlier. Direct memory addressing instructions provide the memory address in the second word of an instruction's object code: MSB 15 LSB 14 13 12 11 10 9 8 65432 o < ) - - - - Bit No. I I I I II I I I I I II I I I I \ TMS 9900 DIRECT ADDRESSING L f Instruction Object Code Byto Ido"",,, ""ag",ed by CPU lag I, ' - - - - - - - - - - - - - - - - - Direct address output via Address Bus Direct, indexed memory addressing instructions provide a base address in the second object code word, but they also identify a general purpose register whose contents are to be added, as a signed binary number, to the base address. Again. the low-order bit of the computed address is not output via the Address Bus. but' (s interpreted by CPU logic as a byte identifier. TMS 9900 INDEXED ADDRESSING General Purpose Register RO cannot be specified as an index register. Direct. indexed addressing is very useful in a TMS 9900 microcomputer system. It allows you to address the previous set of general purpose registers. following a context switch. without knowing where the previous registers were. Suppose you want to access the contents of the memory word which was being used as General Purpose Register R5 18-6 before you switched to your current set of general purpose registers. Recall that the previous Workspace register contents are stored in your current General Purpose Register R13. You could thus address the previous General Purpose Register R5. without knowing where this general purpose register may have been. by using direct. indexed addressing as follows: cw Instruction Base Address ~ 0: o D- o Read/Write Memory ~ ~ ui HighOrder Byte o: o w ~ g lowOrder Byte CI) CI) oct RO 01:1 Rl w Z 0: oIn CI) o ~ oct c oct @ I R2 R3 R4 I R6 R7 R8 R9 I ( 'xxxx xxxx + 2 xxxx + 4 xxxx + 6 xxxx + 8 xxxx+ A I R5 ARBITRARY MEMORY ADDRESSES xxxx + C xxxx + E xxxx + 10 : ! xxxx + 12 xxxx + 14 I ! xxxx + xxxx + xxxx+ xxxx + xX')(x + I Previous General Purpose registers 16 18 lA lC lE I : : RO Rl I R2 R3 R4 R5 R6 R7 R8 R9 : yyyy+ 6 yyyy+ 8 yyyy+ A I I yyyy+ C yyyy+ E yyyy+ 10 i ! I I i Rl0 Rll I R12 R13 I' R14 R15 yyyy yyyy+ 2 yyyy+ 4 X); I I I xx yyyy + yyyy+ yyyy+ yyyy + yvyy+ yyyy + yyyy+ 12 14 16 18 lA lC lE Current General Purpose registers I An implied memory addressing instruction will specify one of the 16 current general pur' pose registers as providing the effective memory address. TMS 9900 IMPLIED If you specify implied memory addressing with auto-increment, then the contents of the ADDRESSING identified general purpose register will be incremented after the memory access has been performed. If the instruction specifies a byte operation. the register contents will be incremented by one; the register contents will be incremented by two after a full-word operation, 18-7 Six object code bits identify the data memory addressing option selected by any TMS 9900 instruction that accesses data memory. The six object code bits are interpreted as follows: ,T R ~~. I '-v-'~ L { 0000 through 1111 se;ect the general purpose register to be accessed during the memory address computation r~fe. . {OO - Not a me. mory rence instruction. The selected register is accessed directly. 01 - Implied memory addressing '"--------10 - Direct addressing if register RO is selected. Direct, indexed addressing otherwise. 11 - Implied memory addressing with auto-increment Two-address instructions will include 12 memory addressing option bits: Two-address instruction object code --..-- ~--..-- ~ TO RD TS RS ~~ Destination address Source address Some instructions allow a source to be anywhere in memory. but the destination must be a general purpose register. These object codes include TS. RS. ~lnd RD. but not TO. TMS 9900 Jump instructions use program relative, direct addressing. These are one-word instructions. where the low-order byte of the instruction object code provides an 8-bit. signed binary value. which is added to the incremented contents of the Program Counter. This is straightforward program relative. direct addressing. TMS 9900 PROGRAM MEMORY ADDRESSING TMS 9900 I/O ADDRESSING As compared to other microcomputers described in this book. the TMS 9900 has uhusuall/O logic. In addition to addressing I/O devices as memory locations, you can address a separate I/O field ofup to 4096 bits. Texas Instruments' literature refers to this field as the "Communications Register Unit" (CRU). If you are programming a TMS 9900 microcomputer system that has already been configured by Texas Instruments. then it is justifiable to look upon the Communications Register Unit as a form of I/O port. If you are building your own interface to a TMS 9900 CPU. then instructions that are supposed to access the Communications Register Unit in reality simply make alternative use of part of the Address Bus in conjunction with three control signals: CRUCLK. CRUIN. and CRUOUT. Ttu!re are two classes of TMS 9900 CRU instructions. The first class accesses individual bits (or signals), while the second class accesses bit fields that may be between 1 and 16 bits wide. There are three single-bit CRU instructions; they set. reset. or test the identified CRU bit. This is equivalent to setting. resetting. or testing an external signal or single I/O port bit. When a bit is to be set or reset. the new level is output via CRUOUT. and a CRUCLK pulse indicates that valid data is on the CRUOUT line. When the condition of a bit is to be input or tested. then external logic is required to return the level of the tested bit via CRUIN. 18-8 A CRU bit instruction outputs a 12-bit address which is computed as follows: Instruction Object Code r-----------------~~--------------,\ c MSB 15 14 13 12 11 10 9 B ~ ex: oQ. I..... I I I I I I w 7 6 5 4 3 2 0 LSB I IX I y I y I y Iy I y I y I y I General Purpose Register R12 ~~~~~~~~~~~~--------~---------r ~ ex: o u ~ MSB 15 14 13 12 11 10 9 B en w 7 6 5 4 3 2 o LSB I I I Izlzlzlzlzlzlzlzlzlzlzlzi ~ g en en c( raZl w ex: Z om en o ~ c( cc( x X X X X Y Y Y Y Y Y Y + @ Z Z Z Z Z Z Z Z Z Z Z Z X, Y and Z represent any binary digits The 12-bit address is output on the 12 lower-order address lines; the three higher-order address lines are all 0 to designate a CRU address. . Now during the execution of a CRU bit instruction. the address which is output is supposed to be a bit address - that is. an address identifying one bit in a possible 4096-bit field. So far as external interface logic is concerned. the address can be interpreted in any way. However. data output will occur via CRUOUT only; data is input via CRUIN. and stored in the Equal bit of the Status register. There are two multi-bit CRU instructions: one. LDCR. transfers data from an addressed memory location to any addressed CRU bit field. The other. STCA. transfers data from an addressed CRU bit field to any addressed memory location. Anywhere from 1 to 16 bits of data may be transferred by the LDCR and STCR instructions. Instruction object codes are interpreted as follows: MSB LSB R T .-A-.~ 15 14 13 12 11 10 9 8 7 6 5 4 II I IIIIII ...... .. ~ • ~ 1 0 II I I I I I ..-. ...... ~ 3 2 Bit No. Multi-bit CRU Instruction .-~ I ~ L{These four bits identify the general purpose register which is to be used in the memory address computation 0000 = RO to 1111 = R15. /00 - Register is the memory location 01 - Implied memory addressing via address in the register 10 - If Register RO is selected, then direct memory addressing is specified; the direct address is in the next program memory word. If any register other than RO is selected, then direct, indexed addressing is specified. The contents of the selected register are added to the contents of the next program memory word. 11 - Implied memory addressing with auto-increment ~ L - . - - - - - - - - - C R U bit field length (0 is interpreted as 16) _________________________ j001100=LDCR 1001101 = STCR 18-9 The source/destination memory location is identified as it would be for any memory reference instruction. The address of the first CRU bit is specified by Register R12. For a multi-bit CRU instruction. the CRU bit address is incremented for each succeeding bit access. but the incremented address is held in a temporary storage location. The contents of Register R12 are not incremented. Thus. multi-bit CRU instructions may transfer anywhere from 1 to 16 bits between any memory location and any CRU bit field. Note that memory must be divided into 16-bit words, each of which has identified bit boundaries, but there are no equivalent bit boundaries in the CRU bit field. That is to say. any CRU bit may be identified via Register R12 as the first bit in a multi-bit field. while the length of the multi-bit field is identified by the instruction object code. This may be illustrated as follows: CRU MSB 15 14 13 LSB 12 11 10 9 8 7 6 5 4 3 2 0 I . .~ / Ixlxlxlxlxlxlxlxlxlxlxlxl R12 " MSB 15 14 1 ~ 12 11 Start of CRU Bit Field LSB 10 9 8 7 6 5 4· 3 2 l,v1v 0 < I I I I CRU Instruction Object Code " If YYYY is 0000. the CRU bit field is assumed to be 16 bits in length. 18-10 End of CRU Bit Field When bits are transferred from a memory location to a CRU bit field, the contents of the memory location are not actually modified. but the transfer occurs as though bits had been right shifted out of the memory location. Bits arriving within the addressed CRU bit field are stored in sequential CRU bit locations with ascending addresses. This may be illustrated as follows: CRU C ILl ~ IX: oQ. Data Memory IX: o U ~ en ILl ~ g (I) (I) < L 10-""'"" ~ xlXlxlxlxl1 1 1 1 0 1 0111011111011Jo \ ail ILl Z \ IX: o In (I) o ~ ~ < c < @ ~ -- 0 1 0 1 1 0 1 0 0 1 1 Lowest CRU Bit Address I···· Highest CRU Bit Address Eleven bits have been transferred in the illustration above. If eight or fewer bits are transferred from a general purpose register. only the more significant byte is accessed: MSB 15 14 13 12 11 10 LSB 9 8 7 6 5 4 3 2 0 General Purpose Register CRU 1 Lowest CRU Bit Address 1 o o Highest CRU Bit Address Our illustration shows a transfer of five bits. 18-11 If eight or fewer bits are transferred from? memory location. then the memory address will be considered a byte address rather than a word address; that is. the transfer will be from the low-order bits of the addressed byte. which may be either the upper or lower byte of a 16-bit memory word. Thus you can access the lower byte of.a general purpose register by addressing it as a memory location. A data transfer from the CRU to data memory occurs as the exact logical reverse of the illustration above. except that high-order bits of the destination data memory word are zeroed if unfilled. This may be illustrated as follows: CRU Data Memory Lowest CRU Bit Address o o o Unused, Therefore Reset Highest CRU Bit Address As with data transfers from memory to the CRU. if eight or fewer bits are transferred. only a byte will be affected. This will be either the addressed memory byte: CRU Data Memory Lowest CRU Bit Address Highest CRU Bit Address These Bits Reset to 0 18-12 or the high-order byte of a general purpose register: MSB LSB 151413,121110,98765432 cw ~ a: oIl.. a: o(.) I 0 \ 0 \ 0 \i \1 \ 0 \1 \ 0 \ '-v-' J x \ x \ x \x \x \ x \x \x "- j 0 These Bits Reset to 0 - I General Purpose Register ./ -yo This Byte Unaffected CRU ~ enw l- 0 e( (3 Lowest CRU Bit Address 1 oCI) 0 CI) e( all 1 w Z 1 Highest CRU Bit Address a: o ID CI) o :!! e( c e( © TMS 9900 STATUS FLAGS The TMS 9900 CPU has o a 16-bit Status register which may be illustrated as follows: 4, 5, 6 15 14 13 12 1.1 19 9 2 3, 8 8 9 1011 12 13 14 15 ...-TMS 9900 Bit Number ·7 6 5' 4 3 o . . - Our Bit Number Status register ' - - - - - - - - - - - - - XOP instruction executed ' - - - - - - - - - - - - - - Parity status .....- - - - - - - - - - - - - - - Overflow status ' - - - - - - - - - - - - - - - - Carry status ' - - - - - - - - - - - - - - - - - - Equal condition ' - - - - - - - - - - - - - - - - - - - Arithmetic Greater Than condition - - - - - - - - - - - - - - - - - - - Logical Greater Than condition The low-order four bits of the Status register represent an interrrupt mask which identifies the level of interrupt which is currently enabled. As the 4-bit interrupt mask would imply. 16 levels of interrupt are allowed, We will describe interrupt processing later in this chapter. The X status is set to 1 while an XOP instruction is being executed. This instruction allows you to perform a software interrupt - as described later in this c~apter. The P, 0, and C are standard Parity, Overflow and Carry statuses. The Equal status (=) identifies a condition that currently exists, as the result of the execution of a previous in,struction, that will cause a Branch-if-Equal instruction to branch. A CRU bit to be tested also gets stored in the Equal status. The Logical Greater Than arid Arithmetic Greater Than statuses are set or reset following arithmetic. logical. or data move operations. A Logical Greater Than treats the source data as simple, unsigned binary numbers. An Arithmetic Greater Than interprets the operand as signed binary numbers. TMS 9900 CPU PINS AND SIGNALS Figure 18-2 illustrates the pins and signals of the TMS 9900 CPU. Being a 64-pin DIP. the TMS 9900 can afford to have separate Address and Data Busses. 18-13 VBB HOLD VCC WAIT MEMEN loAi5 .WE READY CRUCLK HOLOA R'Esff VCC lAO <1>1 (LSB) '.,' (MSB) <1>2 D15 A14 A13 D14 013 A12 All D12 Dll Al0· Dl0 A9 D9 AS A7 A6 D7 (LSB) OS D6 05 A5 A4 A3 A2 D4 D3 Al 01 02 AO DO <1>4 VSS (MSB) Vss VOO <1>3 OBIN ICO CRUOUT ICl CRUIN IC2 iNTREo IC3 Pin Name Description Type AD - A14 Address Bus Data Bus Clock Signals Memory Enable Instruction Fetch· Data Bus In Write Enable Memory Ready Wait State Indicator I/O Clock Serial I/O Out Serial I/O In Interrupt Request Interrupt Code DMA Request Hold Acknowledge Load Interrupt Reset Power and Ground reference Tristate. Tristate. Input Tristate. Output Tristate. Tristate. Input Output Output Output Input Input Input Input Output Input Input 00 - 015 <1>1. <1>2. <1>3. <1>4 MEMEN lAO· DBIN WE . READY WAIT CRUCLK . CRUOUT CRUIN iNTRffi ICO - IC3 " HOiJ). HOLDA LOAD RESET VBB. VCC. VDD. Vss . (MSB) (LSB) output bidirectional output output output Figure 18-2. TMS 9900 Signals and Pin Assignments 18-14 Pins Ao - A 14 provide the 15-bit Address Bus. Note that Texas Instruments' literature numbers bits and pins from left to right; therefore, address iine AO represents the most significant address bit, where as address line A 14 represents the least significant address bit. c w ~ a: oD.. a: o (J ~ ui DO - 015 provide a 16-bit bidirectional Data Bus. Once again, DO represents the most significant data bit in Texas Instruments' literature. Remaining signals may be divided into bus control, interrupt control, and timing. External logic must provi~e four clock later in this chapter. sig~als, 11>1, 11>2, 11>3, and 11>4. These are provided by the TIM 9904, described Any memory access operation begins with an address being output via the Address Bus. The TMS 9900 CPU identifies a stable addr~~s on the Address Bus by outputting MEMEN low. w If the memory access operation is an instruction fetch, the lAO is output high. g If the memory access is a read, then the TMS 9900 outputs a high level via DBIN. Memory interface logic must interpret the high DBIN level as a signal to place data on the Data Bus. ~ (I) (I) oct all w Z a: oal (I) o ~ oct oct C @ If the memory access is a memory write, then the TMS 9900 CPU outputs a low pulse via WE. Memory interface logic must use the low WE pulse to signal that valid data is on the Data Bus, and to store it in the addressed memory . location. WE low does not last as long as DBIN high. When external logic cannot respond to a memory access in the available time, it requests a Wait state by inputting READY low. The CPU ackno~ledges by outputting WAIT high. CRUCLK, CRUIN, and CRUOUT are three signals used to implement single:bit or serial data transfers via the CRU interface. CRUOUT is used to output bits of data to the liD devices, and CRUIN is used to retrieve input data from the liD devices. CRUCLK is active during output operations only, and defines when data bits on CRUOUT are valid. Let us now look at interrupt control signals. There is a single interrupt request input, INTREO, which must be held low by any external device requesting an interrupt. External devices identify themselves via control signals ICO - IC3. Thus, an interrupt request must be accompanied by the appropriate input at ICO - IC3. Observe that there is no interrupt acknowledge signal. For DMA operations, external logic requests access to the System Bus by inputting HOLD low. The CPU acknowledges the Hold request by outputting HOLDA high. LOAD is a nonmaskable interrupt. RESET is a typical system Reset signal. However, TMS 9900 Reset logic uses the device's interrupt capabilities; therefore, we will describe the Reset operation in detail.when discussing TMS 9900 interrupt capabilities in general. TMS 9900 TIMING AND INSTRUCTION EXECUTION TMS instructions execute as a sequence of machine cycles, each of which contains two clock periods. Clock periods are timed by four clock signals, 11>1,11>2, 11>3, and 11>4, as illustrated in Figure 18-3. Note that 11>2 is the first phase of each clock period, and that 11>1 is the last phase. The simplest instruction execution machine cycle is an internal operations cycle. No external bus signals are active during this machine cycle, and no memory or I/O access occurs. Timing for an internal operations machine cycle will consist of two clock periods, as illustrated in Figure 18-3. TMS 9900 INTERNAL OPERATIONS MACHINE CYCLE MEMORY ACCESS OPERATIONS TMS 9900 memory access operations may consist of a memory read or a memory write. An instruction fetch is a minor variation of a memory read. Figure 18-4 illustrates memory read machine cycle timing. MEMEN goes low at the beginning of any memory access machine cycle and stays low for the entire machine cycle. 18-15 ....I----CLOCK PERIOD 1 - - -.......I-----CLOCK PERIOD 2--~~ OSC ¢3 __________________J ¢4 Figure 18-3. TMS 9900 Clock Periods and Timing Signals as Generated by the TIM 9904 ONE MACHINE CLOCK PERIOD 1 I CYCLE~ CLOCK PERIOD 2 I ¢1 cf>3 ------t+--' ¢4 ----+-H------oJ DBIN AO-A14 00-015 ADDRESS OUT INPUT MODE INPUT MODE CPU READS DATA Figure 18-4. A TMS 9900 Memory Read Machine Cycle 18-16 DBIN goes high at the beginning of the memory read machine cycle and stays high for the entire machine cycle. External logic can therefore use MEMEN low as a memory address indicator while DBIN high identifies the read operation. A memory address is output stable on the Address Bus for the entire machine cycle. c w ~ a: oa. a: o u a; en w ~ o(/) (j The Data Bus operations during a memory read machine. cycle represent the only unusual characteristics of the machine cycle. Input data needs to be stable during the <1>1 high pulse of the second clock period. However. the Data Bus is connected to input logic for the entire memory read machine cycle and for a portion of the next machine cycle. Thus. during a memory read machine cycle. external logic cannot access the Data Bus to perform direct memory access. or any other operations. on the assumption that the Data Bus is free until Data In becomes stable. Moreover. since the Data Bus is held by data input logic of the CPU during the next machine cycle. a memory read machine cycle cannot be followed by a memory write machine cycle. A memory read machine cycle must be followed by an internal operations machine cycle, or by another memory read machine cycle. The only difference between an instruction fetch machine cycle and a memory read machine cycle is the fact that during an instruction fetch machine cycle, IAQ is output high, along with DBIN. for the duration of the machine cycle. (/) « all w Z .....I - - - - - - - - - O N E MACHINE CYCLE -------~~ a: o CD (/) o CLOCK PERIOD 1 ~ CLOCK PERIOD 2 « c « @ ¢2 ¢3 ¢4 ______ ~--------J MEMEN WE . AO-A14 00-015 ADDRESS OUT DATA OUT Figure 18-5. A TMS 9900 Memory Write Machine Cycle Memory write machine cycle timing is illustrated in Figure 18-5. In this illustration. we see that data is output stable on the Data Bus for the entire duration of the memory write machine cycle. The Data Bus is not held by output logic beyond this single machine cycle. Thus. no restrictions are placed on the type of machine cycle which can follow a memory write machine cycle. Even though data output is stable for the entire memory write machine cycle. the write 18-17 enable strobe wrdoes not go low untii close to the end of the first clock period. In many cases it is easier to use NOT DBIN as a write control signal. Here is the necessary logic: Icg MEMEN DBIN WRITE READ TMS 9900 instruction execution machine cycle sequences are not always self-evident; therefore, letus look at some memory reference examples. Memory address computations make machine cycle seqL.ie~ces quite complex. particularly for two-operand instructions. Fortunately. the exact machine cycle sequences are rarely of any consequence to you as a programmer or logic designer. The eventual number of machine cycles required to execute an instruction (and therefore its execution time) is important. . Generally stated. instruction execution proceeds as follows: 1) 2) 3) The instruction object code is fetched. The first operand address is computed. The second operand address (if there is one) is computed. 4) Any operation that may be required is performed. 5) If a result is generated. it is returned to the second operaild address. TMS 9900 INSTRUCTION EXECUTION SEQUENCES Let us look at operand address computations using the ADD instruction (A) as a general example. First consider the in~ struction in its simplest form - where the contents of one register are added to the contents of another register: A Cycle 1 2 3 4 5 6 7 Type MEMORY ALU MEMORY ALU MEMORY ALU MEMORY Figure 18-4 READ 18-3 READ 18-4 18-3 18-4 READ 18-3 WRITE 18-5 R1.R2 Function Fetch instruction object code Decode instruction Fetch R1 contents Fetch R2 contents Add R1 and R2 contents Store sum in R2 Now consider the same instruction's execution. but using implied memory addressing for the first operand: A Cycle 1 2 3 4 5 6 7 8 9 Type MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY Figure READ 18-4 18-3 READ' 18-4 18-3 18-4 READ 18-3 READ 18-4 18-3 WRITE 18-5 *R1.R2 Function Fetch instruction object code Decode instruction Fetch R1 contents Use R1 contents as a memory address (implied addressing) Fetch contents of implied address location Fetch R2 contents Add data fetched in cycles 5 and 7 Store sum in R2 18-18 If the second (destination) operand uses direct addressing. here is the machine cycle sequence: A c w ~ a: o0. a: o u ~ u) w ~ g en en Cycle 1 2 3 4 5 6.7.8 9 10 11 12 13 Type MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY Figure 18-4 READ 18-3 18-4 READ 18-3 18-4 READ 18-3 18-4 READ 18-3 18-4 READ 18-3 WRITE 18-5 w a: o In en o :!: ~ c ~ @ Function Fetch instruction object code Decode instruction Fetch R1 contents Use R1 contents as a memory address Fetch contents of implied address location Fetch the second instruction object code word: it holds the direct addres? Fetch contents of directly addressed memory word Add words fetched in cycles 5 and 11 Store sum in directly addressed memory word Indexed. direct addressing results in the following sequence: ~ A olJ z *R1.@LABEL Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 Type MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY READ READ READ READ READ READ WRITE Figure 18-4 18-3 18-4 18-3 18-4 18-3 18-4 18-3 18-4 18-3 18-4 18-3 18-5 *R1.@LABEL(5) Function Fetch instruction object code Decode instruction Fetch R1 contents Use R1 contents as a memory address Fetch contents of implied address location Fetch the second instruction object code word: it holds the direct address Fetch R5. the Index register contents Add direct address and index Fetch contents of memory word addressed by cycle 10 addition Add memory words fetched in cycles 5 and 11 Store sum in memory word addressed by cycle 10 addition If the first operand-implied address specified an auto-increment. w~ must add one more machine cycle: A Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Type MEMORY ALU MEMORY ALU MEMORY MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY Figure 18-4 READ 18-3 18-4 READ 18-3 WRITE 18-5 18-4 READ 18-3 18-4 READ 18-3 READ 18-4 18-3 18-4 READ 18-3 WRITE 18-5 *R1 +.@LABEL(5) Function Fetch instruction object code Decode instruction Fetch R1 contents Increment fetched R1 contents Write incremented R1 contents back to R1 Fetch contents of implied address location Fetch the second instruction object code word: it holds the direct address Fetch R5. the Index register contents Add direct address and index Fetch contents of IT)emory word addressed by cycle 11 addition Add memory words fetched in cycles 5 and 12 Store sum in memory word addressed by cycle 11 addition MEMORY SELECT LOGIC MEMEN discriminates between memory and I/O accesses. It is therefore very important that MEMEN low be a necessary component for any memory select. You can map I/O into the memory space of the TMS 9900. This is tr.ue of any microprocessor. Memory addresses that select I/O devices will. of course. also require 1\i1EMEN low as a contributor to I/O device select logic. 18-19 MEMEN as a contributor to select logic may be illustrated as follows: 1 '- CRl) SELECT LOGIC r4- ···- ~ ~ j - ..- •• !: ,. 0 .. ~ SELECT TRUE ONLY IF MEMEN IS HIGH AND A12-A14 ARE 000 - --.. MEMEN AO (LSB) A11 A12 A14 (MSB) r ·· ·· ··- MEMORY AND MEMORY MAPPED I/O SELECT LOGIC SELECT TRUE ONLY IF MEMEN IS LOW --.. The three high-order address lines. A 12. A 13. and A 14. are not used to address CRU bits. When addressing a CRU bit. these lines are all low. They are not low during execution of externally defined I/O instructions: therefore. A 12. A 13. and A 14 low must be a prerequisite for any CRU bit select. TMS 9900 I/O INSTRUCTION TIMING All TMS ~900 I/O instructions transfer serial data via the Communication Register Unit (CRU). (This excludes I/O which is addressed as TMS 9900 memory space.) There are four types of TMS 9900.1/0 instructions. They are: 1) Data input. Anywhere f~om 1 to 16 bits of data may be transferred from the CRU bit field to memory. 2) Data output. This is the simple reverse of data input. Anywhere from 1 to 16 bits of data m'ay be output from memory to the CRU bit field. 3) Bit test. Any bit in the CRU bit field may be tested, The tested bit is input and stored in the Equal bit of the Status register. Thence. condition branch instructions can be used to test the bit ·Ievel. 4) Externally defined I/O instructions. These instructions generate I/O control signals. but they transfer no data. Timing for CRU output and input machine cycles is illustrated in Figures 18-6 and 18-7, respectively. Each of these figures shows two bits of data being transferred. (You should not attach any special significance to this fact: deper:1ding on the instruction being executed. anywhere from 1 to 16 bits may be transferred.) CRU machine cycles are executed contiguously. one per bit. 18-20 Every CRU I/O instruction will require a memory reference machine cycle. together with one or more CRU machine cycles. For example. when an STCR instruction is executed to input data from the CRU to the CPU, the following machine cycle sequence will occur: Cycle Type cw Figure Function MEMORY READ 18-4 Fetch Instruction Code ALU 18·3 Decode Instruction ~ IX: o11. 2 o a Cycles, where 0 <; a <; 4 ~ 3+a MEMORY READ 18-4 iii w 4+a ALU 18·3 g 5+a MEMORY READ 18-4 Fetch R12 6+a 7+a ALU ALU 18·3 Compute CRU Starting Address and Prepare Control Signals i Cycles CRU IN 18·7 8+a+i 9+a + i ALU ALU 18-3 IX: } U ~ (I) (I) c:( olJ w Z IX: o m (I) o ~ c:( c c:( r Cycles @ Obtain Destination Address Fetch Destination Memory Word Contents } } Input i CRU Bits Load CRU Bits in Temporary Register Fill Upper Bits of Byte or Word With Zeroes If i >8, r = 15 - i; if i <; 8, r = 7 - i 10 + a + i + r to 12+a+i+r ALU 18-3 Prepare to Store Memory Word 13+a+i+t" MEMORY WRITE 18-5 Output Assembled Word to Memory Location Whose Contents Were Fetched in Machine Cycle 3 + a r M A C H I N E CYCLE' I CLOCK PERIOD C/>1 'I CLOCK PERIOD MACHINE CYCLE 2 - 1 2 CLOCK PERIOD' I CLOCK·PERIOD 21 --------' C/>2 CP.3 ---tt-....., C/>4 _ _1+-_ _.... AO-A14 CRUOUT --~----------~------~--~~---------+------~--~~ CRUCLK Figure 18-6. Two TMS 9900 Output-to-CRU Machine Cycles 18-21 r M A C H I N E CYCLE 1 1CLOCK PE R laD 1 I CLOCK PE R laD MACHINE CYCLE 2 - - 1 2 I CLOCK PE R I 00 1 CLOCK PE R laD 21 cp1 cp2 cp3 ---..- cp4 AO-A14 CRUIN CRU READS BIT CRU READS BIT Figure 18-7. Two TMS 9900 Input-from-CRU Machine Cycles An LDCR instruction outputs a sequence of 1 to 16 data bits to a CRU bit field. Here is the LDCR instruction machine cycle sequence: Cycle 1 2 Type MEMORY READ ALU Figure 18-4 18-3 } a Cycles where 0=:;a:::;4 Function Fetch instruction object code Decode instruction Obtain source address MEMORY READ 18-4 Fetch source memory word contents ALU 18-3 Prepare for data transmission MEMORY READ ALU 18-4 18-3 Fetch R12 Compute CRU starting address i Cycles CRU OUT ALU 18-6 } 18-3 Output i bits to CRU 10+a+i 3+a 4+a to 7+a 8+a 9+a Machine cycle to conclude instruction The SBO and SBZ instructions set or reset an addressed CRU bit; in essence, these instructions output one data bit. Here is the machine cycle sequence via which the bit output occurs: Cycle 1 2 3 4 5 6 Type MEMORY READ ALU ALU MEMORY READ ALU CRU OUT Figure 18-4 18-3 18-3 18-4 18-3 18-6 Function Fetch instruction object code Decode instruction Decode instruction Fetch R12 Compute CRU address Output to addressed CRU bit The TB instruction inputs one CRU bit; its timing is identical to the SBO and SBZ instructions, except that machine cycle 6 is a CRU IN machine cycle. 18-22 Q w ~ a: oQ. The Address Bus is used in an unusual way during a CRU machine cycle. As we have already stated. the CRU bit field is 4096 bits wide - addressed by 12 of the 15 Address Bus lines. The three high-order Address Bus lines are used to identify I/O control instructions, as defined in Table 18-1. We can conclude from Table 18-1 that when MEMEN is high and the three high-order Address Bus lines are all low. an I/O transfer is occurring. Otherwise. one of five externally defined I/O control instructions is being executed. There are dedicated functions for these five I/O controls in TM 990 minicomputer systems: these are shown in Table 18-1. But to anyone who is simply building a microcomputer system around a TMS 9900. these five I/O states are undefined. Thus, Figure 18-8 illustrates TMS 9900 systems' bus utilization during both CRU operations and externally defined I/O operations. If CRU SEL and MEMEN are high, CRU Select logic will be active. a: o o Table 18-1. High-Order Address Bus Line Used by TMS 9900 I/O Instructions ~ enw ~ oen (3 INSTRUCTION MNEMONIC INSTRUCTION TYPE en (MSB) AI4 AI3 FUNCTION AI2 ~ 0/1 w Z a: oen en o ~ ~ Q ~ @ LDCR SBO SBZ STCR TB IDLE RSET CKOF CKON LREX Output Output Output Input Test (Input) Control Control Control Control Control 0 0 0 0 0 0 0 I I 1 0 0 0 0 0 I I 0 I I 0 0 0 0 0 0 I I 0 I Output data to,CRU Set CRU bit to I Reset CRU bit to 0 Input data from CRU Input CRU bit to Equal status bit Enter HALT condition :f Reset the Interrupt mask Real tIme clock on R I t' I k ff ea tme c oc a Execute bootstrap These are TM 990 uses. Instructions are undefined in a TMS 9900 system. Externally defined instructions output 0 on the 12 low-order Address Bus lines, AO - A 11; in addition, CRUCLK pulses are output as part of the instruction executions. CRUCLK is an active CRU output strobe only. This signal pulses high whenever a valid level is present on the CRUOUT signal line. There is no pulse for CRUIN. External logic must generate its own strobe if it is needed. by combining MEMEN high with a valid bit pattern on the Address Bus. CRU instructions that test the level of a bit are. to external logic. no different from CRU input instructions. External logic is required to return. via CRUIN the level of the selected bit. The fact that the CPU interprets this input as status. rather than data. is immaterial to external logic. THE WAIT STATE Additional Wait State clock periods may be inserted between clock periods 1 and 2 of any memory access machine cycle. Timing is illustrated in Figure 18-9. At the rising edge of <1>1 of clock period 1. the CPU samples the READY input signal. If this signal is low. then the next clock period is a Wait clock period. During a Wait cycle. the WAIT output signal is high: all other output signals hold the levels they had during clock period 1. A Wait State can last for any number of clock periods. During the <1>1 high pulse of every Wait clock period. the CPU samples the level of the READY input. As soon as READY is sampled high. the Wait State ends. The next clock period becomes clock period 2 of the machine cycle. and the memory operation is completed. 18-23 ;, .. A14 : A13 :: A12 A11 ....- .. .;. ..- - ..;,· 7 6 5 .4 3 2 ~ ~ · ~ ..- 1 O~ AO CFfuCLK c-Ru60-T· CFfulN MEMEN LREX CKON CKOF UNUSED RSET HALT UNUSED CRU SEL t ... ••• • CRU SELECT LOGIC CRU SELECT SIGNALS ... · If CRU SEl and iiii'EMEN are high. CRU Select logic will be active. Figure 18-8. TMS 9900 System Bus Utilization During 1/0 Operations ~f----------- ONE MACHI NE CYCLE ....;..---------~~ CLOCK PERIOD1 ., . WAIT CLOCK PERIOD I· WAIT· CLOCK PERIOD cp1 cp2 cp3 _ _.....I cp4 -------1 READY WAIT Figure 18-9. The TMS 9900 Wait State 18-24 CLOCK PERIOD 2 THE HOLD STATE· The TMS 9900 has a typical microcomputer Hold State, used to enable direct memory access operations. External logic initiates a Hold State by inputting HOLD low. At the beginning of the next nonmemory reference machine cycle. the CPU floats its Address and Data Busses. together with the· DBIN. MEMEN and Wt control signals. HOLDA is output high as a Hold Acknowledge. Timing is illustrated in Figure 18-10. ow ~ a: oQ. (NON-MEMORY ICLO~~~~~IOD 11 a: o o ~ iii w ~ c( HOLD I CLOCK PERIOD i I n'--_~j...., 1>1 \ g (I) (I) HOLD 1>2 a!I w Z a: o 1>3 co (I) --+--' o ~ c( 1>4 o _-+-_-+.J c( @ HOLDA 00-015 AO-A14, WE, }' M"'E'M"E'N, DB I N _-'-_.J ---~~---~-------------t~-------.-.- Figure 18-10. TMS 9900 Hold .State Timing The Hold State lasts until external logic raises HOLD high again. It is up to external logic to perform all operations associated with a DMA transfer. The CPU simply floats the System Bus in response to a Hold request. As soon as the TMS 9911 device is available, this will be the part of choice to use in all TMS 9900 microcomputer systems that use direct memory access logic. Any of the other DMA devices described in Volume 3 may also be used. . . The only nonobvious aspect of Figure 18-10 is the fact that Data Bus timing, during normal instruction execution. differs from other System Bus signal timing. Figure 18-10 highlights this fact by showing the Data Bus floating at the beginning of the first HOLD clock period. while other signals float earlier in the preceding clock period. This is not a particularly significant event. The entire System Bus is floating once the HOLD clock· period has begun. However. the actual tristate condition for any signal begins at that point in the preceding clock period when the signal is no longer being driven by current operations. THE HALT STATE The TMS 9900 IDLE I/O instruction generates a Halt State. Whel") this instruction is executed. the CPU suspends all program ~ion and internal operations. You must terminate the Idle condition with an interrupt request or a low LOAD or RESET input. (LOAD and RESET are treated as interrupts as we will describe soon.) The TMS 9900 CPU does not relinquish the System Bus while halted. That is to say. after an IDLE instruction has been executed. no System Bus lines are floated. 18-25 The IDLE instruction is usually executed when program logic requires that the CPU wait for an interrupt. or when external logic is computing a real-time interval - which will be terminated with an interrupt request. You can, if you wish, initiate a DMA transfer by executing an IDLE instruction. In order to do this, you must create a HOLD request from the Address Bus output characteristic of the IDLE instruction's execution. This may be illustrated as follows: A14 A13 A12 ' CRUCLK .... -- A14 (MSB) A13 A12 CRUCLK ) + 5V .=:~ ' --- , '------~~----fA2 ~ ~ t----o()(-)( Ica 7 1C)oI1III_1---- INT8 ~ ~----<~K IC2 GS A1 c;. .,,_---JP-------f I-----<:-K 18-31 AO 74148 (TIM 9907) .. - • • • • INT 15 (LOWEST PRIORITY) External logic must maintain its interrupt request until it receives its own specific interrupt acknowledge. This need is obvious. since an interrupt request may be denied for a long time while higher priority interrupts are being serviced. The problem is that the TMS 9900.has no interrupt a~knowledge signals. Interrupt ac~nowledge signals can be generated in one of two ways: 1) . By using CRU bit instructions to set and reset'external flip-flops that create interrup't acknowledge signals. 2) By decoding appropriate addresses on the Address Bus. Figure 18-12 illustrates two possible configurations that will allow CRU bit set and reset instructions to generate interrupt acknowledge signals; The logic in Figure 18-12A generates a short interrupt acknowledge pulse. CRUOUT becomes the input to a flip-flop which is decoded to generate CRU select signals. The CRU bit select and MEMEN are gated to the flip~flop's Clear input. Therefore. when CRU bit "n" is selected. CLR is removed and CRUOUT can be clQckE]d through. A set bit (SBO) instruction switches the flip-flop on. As soon as the flip-flop address is removed at the end of the CRU 1/0 machine cycle. the flip-flop is cleared. thus terminating the interrupt acknowledge pulse. The logic illustrated in Figure 18-12A requires that you execute an SBOinstruction at the beginning of every interrupt service routine in order to generate an interrupt acknowledge. You could require every interrupt service routine to control the length of the interrupt acknowledge pulse by executing an SBZ instruction to terminate the pulse. Figure 18-12B shows logic to implement this scheme. When the flip-flop is selected by the appropriate CRU address. CRUCLK will clock CRUOUT to INT ACK n. At other times. CRUCLK will merely clock the flip-flop's output through. thus making no change. In this way. only SBO and SBZ instructions which address INT ACK n can set or reset the flip-flop. Figure 18-13 illustrates generation of an interrupt acknowledge signal by identifying specific addresses on the Address Bus. Following any interrupt acknowledge. specific memory locations will be accessed. as identified in Figure 18-11. in order to fetch the new values for the Program Counter and WP register. Figure 18-13 shows a very simple scheme whereby Address Bus lines are combined with MEMEN low to generate high pulses for the duration of a valid address. That isto say. the interrupt acknowledge signal will last for one machine cycle - the time that the valid address exists on the Address Bus. External logic which requested an interrupt removes its interrupt request and priority signals Upol'! receiving an interrupt acknowledge. 18-32 A14 A13 A12 :- All AO Q w MEMEN ~ a: oa.. a: o u .... CRU ADDR ~ ~ ...... ..;., ..... , T CRU'BIT ADDRESS DECODE ( n SELECT g CRUCLK ~ ~ ~ 1~ .. CK 7474 CI) CI) -- Q D INT ACK n Q Ct:R c( 6J o!l w 2 a: en o CI) o M'EME'N + 5V PRE CRUOUT A~1 AO (LSB) ~ ~ en w A14 (MSB) A13 A12 A) Logic to create a short INT ACK n pulse ~ c( Q c( @ P'R'E n SE LECT ---4IIt--Q D + 5V. CRUOUT Cr<. 7474 Q t -.....- _.. INT ACK n Q C'C'R CRUCLK - - - - - - - - - - - - - - - B) Logic to have a programmed INT ACK n pulse length Figure 18-12. A TMS 9900 Interrupt Acknowledge Pulse Generated Using an SSO Instruction A14 A5 A4 A1 MEME~ .-•... ·· ··· ·· ' . ·.-·... .:. .... r r .............. Y A5 A4 A1 MEMEN 0(,)00(')(')(')(') INTERRUPT n SELECT LOGIC I A14 INTERRUPT ADDRESS n SELECT !.....I -.. INT ACK n Figure 18-13. TMS 9900 Interrupt Acknowledge Generated by Decoding Valid Addresses 18-33 THE TMS 9900 RESET You reset the 9900 microcomputer system by inputting a low RESET signal. This signal must remain low for at least 3 clock periods. When the low RESET signal is removed, the following machine cycle sequence is executed: . . Cycle 1 2 3 4 5 6 7 8 9 10 11 12 13 Type ALU ALU ALU MEMORY READ Figure 18-3 18-3 18-3 18-4 ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU 18-3 18-5 18-3 18-5 18-3 18-5 18-3 18-4 18-3 WRITE WRITE WRITE READ Function Prepare for Level 0 interrupt Fetch new WP register contents from memory word 000016 to temporary storage Store Status register contents in new R15 Store Program Counter contents in new R14 Store old WP register contents in new R13 Fetch new Program Counter contents from memory word 000116 Load WP register from temporary storage Thus. program execution begins with a program whose starting address is stored in memory word 1. The starting address for the 16 general purpose registers is stored in memory word O. The TMS 9900 has a Reset instruction (RSETl. In reality. this instruction resets only the interrupt mask in the Status register; it also outputs a code on the Address Bus. as identified in Table 18-1 and illustrated in Figure 18-8. TM 990 minicomputer systems use this signal to generate a program-initiated Reset. If you are designing your own TMS 9900based microcomputer system. you are free to use the RSET instruction in any way. THE TMS 9900 LOAD OPERATION The LOAD input to the TMS 9900 is a non-maskable, highest priority interrupt. Load must be input low for at least one instruction's duration. Since the length of an instruction can vary, you must use the IAQ signal to control the LOAD input pulse width. Texas Instruments' literature recommends the following circuit: +5V ~) '. ~ 0 lAO . PRE PRE 0 CK 7474 Q TMS a::R 9900 0 --- D - I Q CLR ~ i:OAD 18-34 - ~ ~CK 7474 EXTERNAL LOAD The CPU checks LOAD at the end of each instruction's execution. After a valid LOAD input has been acknowledged, the following machine cycle sequence is executed: Q Cycle 1 2 Type ALU MEMORY READ Figure 18-3 18-4 ALU MEMORY ALU MEMORY ALU MEMORY ALU MEMORY ALU 18-3 18-5 18-3 18-5 18-3 18-5 18-3 18-4 18-3 w ~ a: o n. a: o(J ~ en w ~ g en en oCt all w Z a: oCD en o ~ oCt Q 3 4 5 6 7 8 9 10 11 WRITE WRITE WRITE READ Function Input new WP register contents from memory word 7FFE16 to temporary storage Store in new R15 Store incremented Program Counter contents in new R14 Store old WP register contents in new R13 Input new Program Counter contents from word 7FFF16 Load WP register from temporary storage There are two differences between Reset and Load. First, the RESET input provides a true hardware reset, synchronizing internal operations, as well as a level 0 interrupt; LOAD provides only a non-maskable interrupt. Second, the Reset vector in bytes 0 through 3, while the Load vector is in bytes FFFC16 through FFFF16' In TM 990 minicomputer systems, the LREX instruction is frequently used as a software load. Output due to LREX is identified in Table 18-1 and Figure 18-8. In a TMS 9900 microcomputer system, you can use the LREX signal in any way. oCt THE TMS 9900 INSTRUCTION SET @ The TMS 9900 instruction set is extremely powerful when compared to any 16-bit microprocessor described in this book. When you consider that the TMS 9900 was first manufactured in 1976, the power of this instruction set becomes. more impressive. With regard to instructions described in Table 18-2, some explanations are required. The ABS instruction converts the contents of a memory location to their absolute value. That is to say, this instruction assumes that the memory location contains a signed binary number. If the number is positive, nothing happens. If the number is negative, the twos complement of the number is taken. A number of instructions act on specific bits within source and destination memory words. These include the SOC, SOCB, SZC, SZCB, COC, and CZC instructions. In the OPERATION PERFORMED column of Table 18-2, the word "corresponding" means that the source word bits are affected only if selected by the destination word bit pattern. For example. the SOC instruction will be interpreted as follows: Source: Destination: Here are the new destination contents. After SOC: This is equivalent to an OR operation. The SOCS instruction is identical to the SOC instruction. except that only one byte is affected. This may be any memory byte or the high-order byte of a general purpose register. The SZC instruction may be illustrated as follows: Source: Destination: After SZC: 18-35 This is equivalent to complementing the source operand and then ANDing the two operands. The SZCB instruction is identical to the SZC instruction. except that only one byte is affected. The CDC instructio'n compares Source Register 1 bits with general purpose register bits that happen to be in the same bit positions. If all corresponding general purpose register bits are also 1. then the Equal status is set. Matches are not significant in bit positions if the source register bit is O. The CZC instruction operates in the same fashion as the CDC instruction. except that those source memory word bits that are 0 become significant. That is to say. if every source memory word 0 bit has a corresponding Workspace register 0 bit. then the Equal status is set. Matches are not significant ~n bit positions iUhe source register bit is 1. The BLWP instruction is a subroutine call accompanied by a context switch. The operand memory address identifies the first of two memory words within which the new WP register and Program Counter contents will be stored. The BLWP instruction is remarkably powerful. The subroutine call and passing parameters to the subroutine become a single operation. The memory words that are to serve as subroutine general purpose registers can be used as general data memory locations prior to the subroutine call. Thus. the subroutine finds its registers pre-loaded with data when it starts executing. The RTWP instruction should be used to return from a subroutine that is called by the BLWP instruction. One-bit position arithmetic shifts may be illustrated as follows: Right Shift Left Shift 101 101 011 01 001 1 0 1011010110100110 ~""""""'" """""""" 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 Lost Lost 0 1 1 0 1 0 1 1 0 1 0 0 11 .0 O~ Inserted A one-bit-position logical right shift may be illustrated as follows: 1011010110100110 """""""" o10 Inserted -I 1 1 0 1 0 1 1 0 1 0 0 1 1 Lost A one-bit right rotate (Shift Right Circularl may be illustrated as follows: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 You can specify any number of bits. from 1 to 15. as the number of bit positions for any TMS 9900 shift or rotate instruction. If you specify 0 for the bit count. then the actual bit count is taken from the four low-order bits of general purpose Register RO. If these fourlow-order bits are 0000. then the bit count is assumed to be 16. 18-36 The following symbols are used in Table 18-2: ow ~ a: oC1. AG C CNT CRUA d Arithmetic Greater Than status Carry status 4-bit count field CRU base address from R12 Destination memory word. There are five possible options for the destination memory word. They are represented by these combinations of addressing modes: Workspace Register D Implied through Workspace Register D Direct address Direct. indexed address Implied through Workspace Register D. auto-increment Workspace Register D DATA4 DATA16 DISP EQ 4-bit data unit 16-bit data unit 8-bit signed displacement Equal status bit of Status register Both the AG and LG statuses Logical Greater Than status Odd Parity status Overflow status Program Counter Any of the 16 Workspace registers Workspace register. For example. R15 is Workspace Register 15 Sour~e memory location. Addressing options identical to destination memory location Status register Workspace Pointer register Bits y through z of the quantity x. For example. ([ S1 * [R1) <31.16 > represents the high-order word of the product of the contents of the Source Register S and the Workspace Register R. a: o (J ~ en w ~ g (/) (/) ct ciS w Z a: o CO (/) o ~ ct ct o @ G LG OP OV PC· R Rxx S ST WP x [ 1 / A V 4/- Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memoiy address is enclosed within the brackets. then the contents of the addressed memory location are specified. Mu Itiplication Division Logical AND Logical OR Logical Exclusive-OR Data is transferred in the direction of the arrow Under the heading of STATUSES in Table 18-2. an X indicates statuses which are modified in the course of the instruc~ tion' s execution. If there is no X. it means that the status maintains the value .it had before the instruction was executed .• Byte-operand 'instructions will affect half of a 16-bit memory word. If the word is accessed as a general purpose register, then only the high-order byte will be affected. If the word is accessed as non-register memory, then the byte affected is determined by the least significant bit of the ·16·bit address: 0 selects the high-order byte; 1 selects the low-order byte. 18-37 Table 18-2. TMS 9900 Instruction Set Summary STATUSES TYPE g MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES G EQ C OV OP LOCR S.CNT 2 X X X" STCR O.CNT 2 X X X" SBO OISP 2 SBZ OISP" 2 TB OISP 2 MOV S.D 2 X X MOVB S.D 2 X X X [CRUA]-[S] Transfer the specified number of bits from source memory word to the CRU. [0 ] - [ CRUA] Transfer the specified number of bits from the CRU to destination memory word. [CRUA + OISP]-l Set "bit in CRU to 1. [CRUA+ OISP]-O Set bit in CRU to O. If [CRUA + OISP] = O. then [EQ] = 1; or else [EQ)'= 0 Test bit in CRU. w » u II:II:Z ] [R+ 11-[([S]"[R])<15.0>] Multiply the contents of source memory word by contents of Workspace Register R. Store most significant word of result in R. Store least significant word of result in Workspace Register R + 1. [R]-([R.R+ 111 [S]Xquotient) [R + 11-([ R.R + 111 [S]Xremainder) Divide the 32-bit quantity represented by R (high-order word) concatenated with R + 1 (low order) by the contents of the source memory word.· Store the quotient in R. the remainder in R + 1 and set overflow if quotient will exceed 16 bits. [0]-[0]+1 INCT 0 2 X X X X Increment contents of memory word by 1. [0]-[0]+2 DEC 0 2 X X X X Increment contents of memory word by 2. [0]-[0] -1 W l- II: X ~ Z II: II: > II: 0 ~ w X ~ > II: a: SZCB S.D 2 X X 0 Z 0 0 COC S,R CZC S,R is X OP [D]-[D]-2 Decrement contents of memory word by 2. X [D]-000016. . Oear the destination memory word. ILl J Z ~ Z 0 iii [D]-FFF~16 Set all.blts of memory word. [D]-(O] Ones complement the destination memory word. [D]-['DJ+1 Twos complement the destination memory word. [D]-I [D]I Take the absolute (unsigned) value of the'destination memory word's contents. a: ILl A. 0 > a: 0 ~ [D<15.8>]-[D<7.0>] Exchange the high and low bytes of the memory word. If [S]=l. then [D]-l Set the bits in the destination memory word that correspond to 1s in the source-memory word ILl ! ILl 0 Z ILl a: ... . ILl X ILl a: > a: 0 ~ for 8 bits. If [S]=l, then [D]-P Oear the bits in·theLlestination memory word that correspond to·ls in the source memory word ILl ~ .q: ILl en X X 2 for all 16 bits. If [S]=;. then [D]-l Set the bits in the destination memory word that correspond to 1s in the'source memory word X for all 16 bits. If [S]=l, then [D]-O Clear the bits in the-destination memory word that correspond to 1s in the source memory word for 8 bits. If for an:[.5]=l, [R]=l. then [EQ]-l If the bits in the Workspace Register R·that correspond to the set bits in the source memory word are all1s, set the EQUAL status. If for all [S]=l, [R]=O, then [EQ]=l If the bits in the:Workspace Register R that correspond to set bits in the source memory word lire aliOs, set the EQUAL status. ... ILl q: LI R,DATA16 4 C ILl ~ ~ . LWPI DATA 16 -4 X X [R]-DATA16 Load immediate to Workspace Register R. [WR]-DATA16 Load immediate to Workspace Pointer Register. WR. Table 18-2. TMS 9900 Instruction Set Summary (Continued) STATUSES TYPE w l- MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES G EQ C OV OP Set the status flags based un 16-bit comparison between contents of Workspace Register Rand CI R,DATA16 4 X X AI R,DATA16 4 X X ANDI R,DATA16 4 X X ORI R.DATA16 4 X X B S 2 [PC]-[S] JMP DISP 2 Branch unconditional to address in Source memory word. [PC]-[PC]+DISP. Branch unconditional. BL S 2 BLWP S 2 e:( immediate data. [R]-[R] + DATA 16 Add immediate to Workspace Register R contents. [R]-[ R] A DATA 16 AND immediate with Workspace Register R contents. [R]-[R] V DATA16 OR immediate with Workspace. Register R contents. a: w II- X X 0 w I- e:( ew :E ~ II- :E ~ -, Z a: [R11l-[PC]+ 1 [PC]-[S] w~ ZI-w I-a: ~C gz me:( ~..J 1/)...1 e:( 0 2 RTWP X X X X X Branch to subroutine at address in source memory word. [R13]-[WP] [R14]-[PC] [R15]-[ST] [WP]-[S] [PC]-[S+2] Branch to subroutine whose address -is stored in source memory word + 1. Perform context switch to RO address contained in source memory word. [WP]-[R13] [PC]-[R14] [ST]-[R15] Perform a backward context switch. JGT DISP 2 If [EQ]=l; then [PC]-[PC] + DISP Branch if equal. If [EQ] =0; then [PC] - [PC] + DISP Branch if not equal. If [AG]=l; then [PC]-[PC] + DISP eZ JLT DISP 2 Branch on arithmetic greater than. If [AG]=O and [EQ]=O; then [PC]-[PC] +DISP Z JHE DISP 2 JH DISP 2 Branch on arithmetic less than. If [LG]=l or [EQ]=l; then [PC]-[PC] +DISP Branch on logical greater than or equal. If [LG]=l and [EQ]=O;then [PC]-[PC]+DISP JL DISP 2 Branch on logical greater than. If [LG]=O and [EQ]=O; then [PC]-[PC] +DISP JLE DISP 2 Branch on logical less than. If [EQ]=l or [LG]=O; then [PC]-[PC]+DISP Z 0 ~ JEQ DISP 2 JNE DISP 2 0 0 0 l: 0 Z a: e:( m Branch on less than or equal. © ADAM OSBORNE & ASSOCIATES,INCORPORATED Table 18-2. TMS 9900 Instruction Set Summary (Continued) STATUSES TYPE ,MNEMONIC OPERAND IS) BYTES OPERATION PERFORMED G JNC DISP 2 ZZC OOw JNO DISP 2 ZOi= «ZZ a:00 JOC DISP 2 JOP DISP 2 ~Ei IIIU~ EO C OV OP If [C) =0: then [PC] - [PC] + DISP Branch on carry reset. If [OV]=O: then [PC]-[PC] +DISP Branch on overflow reset. If [C]=l: then [pC]-[PC]+DISP Branch on carry set. If [OP]=l; then [PC]-[PC]+ DISP Branch on odd parity set. a: W W lIC/l «a: W C5 W Da: 0 01- ZD«:l C/la: :la: I-w «II- Z C/l- W I:l SLA SRA SRL R,CNT R,CNT R,CNT 2 2 X X X X X X 2 SRC R,CNT 2 X X X X X X STST R 2 STWP R 2 lIMI DATA4 4 XOP S,R 2 X S IDLE « W Z ~ a: LL WW ~O W X [SR<3,O>] -DATA4 Load immediate data into the interrupt mask bits of the Status register. [R13]-[WP] Execute the instruction represented by the data in the source location. If that instruction has immediate operand words, those words must be located directly after the X instruction. The instruction [S] will affect the status flags but its fetch will not cause lAO to go high. 2 CPU enters Halt state. CPU clears interrupt mask and outputs 001 on three high-order Address Bus lines. >< W 0 [R]-[ST] Store the Status register into Workspace Register R. [R]-[WP] Store the Workspace Pointer into Workspace Register R. 2 W -I Logical shift the Workspace Register R right the specified number of bits. Rotate the Workspace Register R right the 'Specified number of bits. [R14]-[PC] [R15]-[ST] [Rl11-[S] [WP]-[40,. +(4* [R])] [PC]-[41,. +(4* [R])] Perform a context switch. This is the software interrupt. U > -I Arithmetic shift'the Workspace Register R left the specified number of bits. Arithmetic shift the Workspace Register R right the specified number of bits. X RSET CKOF CKON LREX 011 on three high-order Address Bus lines. 110 out on three high-order Address Bus lines. 101.out on three high-order Address Bus lines: 111 out on three high-order· Address Bus lines. THE BENCHMARK PROGRAM For the TMS 9900, our benchmark program may be illustrated as follows: ~OOP BLWP MOVE CONTEXT SWITCH TO APPROPRIATE REGISTERS MOV DEC JNE RTWP @IOBUF(R1):R2+ R1 LOOP LOAD NEXT INPUT WORD IN NEXT TABLE WORD DECREMENT COUNT RETURN FOR 'MORE RETURN FROM SUBROUTINE Let us look at how our benchmark program can collapse to just five instructions. We assume that there is some set of 16 General Purpose registers within which we store the word count and the address of the first free word in TABLE. We illustrated this ideawhen describing context switching earlier in the chapter. Observe that Register R1 contains the word count. and is therefore used as an Index register. while Register R2 addresses the first free word in TABLE. Note that the contents of Register R2 are incremented automatically when the next byte is loaded into the table. The BLWP instruction will branch to the program which performs the required data move. but simultaneously it loads the Workspace register with the appropriate initial address. We do not need to load any initial addresses or word counts into registers. since we have adopted the memory space where this data 'is stored to serve as our General Purpose registers. After the move has been completed. we do not have to update any counters or pointers. because they were updated "in situ". All we have to do upon completing the move is store the contents of the current General Purpose Registers 13 and 14 to the Workspace register and Program Counter. The following notation is used in Table 18-3: aa bb cccccccc Two bits determining the addressing mode for the destination memory word . Two bits determining the addressing mode for the source memory word 8-bit signed address displacement dddd eeee Four bits Hsed with aa to determine the destination memory word 4-bit count field rrrr ssss xx Four pits choosing the Workspace register Four bits used with bb to determine the source memory word 16 bits of immediate data If either aa or bb is 1°2. and the corresponding register specified is 02. then an additional 16-bit direct memory address word. used in computing the effective memory address of the operand. will follow the instruction. It'aa and bb are 1°2. and both corresponding register specifications are 0. then two additional 16-bit direct memory addressing words will follow the instruction: the first will be used in computing the source address; the second will be used in computing .the destination address. 18-42 Table 18-3. TMS 9900 Instruction Set Object Codes INSTRUCTION OBJECT CODE BYTES CLOCK INSTRUCTION PERIODS· OBJECT CODE BYTES CLOCK PERIODS· Q A S,D 1010aaddddbbssss 2 14-30 (1) JOP DISP 000 111 OOcccccccc 2 8/10(15) ~ a: o AB ASS S,D 1011aaddddbbssss 2 14-30 (1) LDCR S,CNT 00ll00eeeebbssss 2 22-52 (11) 0 0000011101aadddd 2 12-20 (6) LI R,DATA16 00000o 1OOOOOrrrr 4 12 (19) AI R,DATA16 00000o 10001 Orrrr 4 14 (17) 4 16 (21) ANDI R,DATA16 00000o 100 100rrrr 4 14 (17) enw B S XX 00000 1000 1bbssss 2 8-16 (7) 2 4 10(20) BL S 0000011010bbssss 2 12-20 (9) g BLWP S 00000 1OOOObbssss 2 26-34 (10) C S,D l000aaddddbbssss 2 CB S,D 100 1aaddddbbssss CI S,D 00000o 10 l000rrrr w D. a: o u ~ (I) (I) ct w Z CKOF o CLR 0 (I) COC S,R ::!: CZC S,R DEC 0 DECT 0 DIV S,R CD o ct Q ct @ CKON IDLE 00000o 11111 00000 00000o 10 11100000 MOV S,D l100aaddddbbssss 2 14-30(1) 14-30 (1) MOVB S,D 1101aaddddbbssss 2 14-30(1) 2 14-30(1) MPY S,R 001110rrrrbbssss 2 52-60 (2) 4 14 (18) NEG 0 000001 0 l00aadddd 2 12-20 (5) ORI R,DATA16 XX 6 (14) RSET 2 10-18 (5) RTWP 00l000rrrrbbssss 2 10-18 (1) S 001 00 1rrrrbbssss 2 14-22 (1) 0000011000aadddd 2 14-22 (5) 0000011001aadddd 00 1111 rrrrbbssss 2 2 10-18 (5) 10-18 (3) 00000o 1101 00000o 2 JEQ JGT JH JHE 2 00000o 100 11 Orrrr 14 (17) XX 6 (14) 2 INV INCT 6 (14) DATA16 LREX 00000100llaadddd 0000010110aadddd 00000o 1100000000 XX 00000o 1111000000 00000o 111 0 100000 0 0 0 INC DATA4 LWPI XX ail a: LlMI XX ~ XX 6 (14) 00000o 110 11 00000 00000o 111 00000oo 2 2 14 (8) S,D 0110aaddddbbssss 2 14-30(1) SB S,D 0111 aaddddbbssss 2 14-30 (1) SBO DISP 00011101cccccccc 2 12 (13) SBZ DISP 2 12 (13) SETO 0 000 1111 Occcccccc 0000011100aadddd 2 10-18 (5) 6 (14) SLA R,CNT 0000 10 lOeeeerrrr 2 14-52 (16) 16-124 (5) SOC S,D 1110aaddddbbssss 2 14-30(1) 1111 aaddddbbssss 2 14-30 (1) ooool000eeeerrrr 2 14-52 (16) 0000010111aadddd 2 10-18 (5) SOCB S,D 000001010laadddd 2 10-18 (5) SRA R,CNT DISP 00010011cccccccc 2 10-18 (15) SRC R,CNT oooo1011eeeerrrr 2 14-52 (16) DISP 00010101cccccccc 2 8/10 (15) 2 0001101lcccccccc 2 8/10 (15) R,CNT D,CNT 0000 100 1eeeerrrr DISP SRL STCR 001101eeeeaadddd 2 14-52 (16) 42-60 (12) DISP 00010100cccccccc 2 8/10 (15) STST R JL DISP 00011010cccccccc 2 8/10 (15) STWP R 00000o 10 ll00rrrr 00000o 10 10 1Orrrr 2 8 (23) 8 (22)' JLE JLT DISP 000100IOcccccccc 2 8/10 (15) SWPB 0 0000011011aadddd 2 10-18 (23) DISP 00010001cccccccc 2 8/10 (15) SZC S,D 0100aaddddbbssss 2 14-30 (1) JMP DISP 000 1OOOOcccccccc 2 10 (15) SZCB S,D 0101 aaddddbbssss 2 14-30 (1) JNC DISP 00010111cccccccc 8/10 (15) TB DISP 00011111cccccccc 2 12 (8) JNE DISP 00010110cccccccc 2 2 8/10 (15) X S 0000010010bbssss 2 8-16 (7) JNO DISP 00011001cccccccc 2 8/10 (15) XOP S,R 001011rrrrbbssss 2 44-52 (4) JOC DISP 000ll000cccccccc 2 8/10 (15) XOR S,R 001010rrrrbbssss 2 14-22 (1) • The number in brackets identifies the instruction's machine cycle sequence, as defined in the preceding text. 18-43 2 The minimum and maximum number of clock periods for the execution of each instruction are shown in the CLOCK PERIODS column of Table 18-3. Remember that a machine cycle consists of two clock periods. The bracketed number after the number of clock periods identifies the machine cycle sequence. Machine cycle sequences associated with each bracketed number are liste~ below. In the machine cycle list below, the following abbreviations are used: R represents a memory read machine cycle as identified in Fig~re 18-4. A represents an ALU machine cycle as illustrated in Figure 18-3. W represents a memory write machine cycle as illustrated in Figure 18-5. C represents a CRU machine cycle as illustrated in Figures 18-6 and 18,-7. A subscript associated with any machine cycle notation identifies that machine cycle repeated a number of times. Thus A3 is equivalent to -A-A-A-. " M represents memory address computation machine cycles. Memory address computations were described earlier in this chapter. In summary. here are the various possibilities for M: Register addressing: R Implied memory addressing: R-A-R Implied memory addressing with auto-increment (for byte operand): R-A-W-R Implied memory addressing with auto-increment (for word operand): R-A-A-W-R Direct addressing: A-A-R-A-R Direct. indexed addressing: R-A-R-A-R '(1) (2) . (3) (4) (5) (6) (7) . (8) (9), (10)· (11) (12) (13) (14)' (15) (16) (17) (18) (19) (20) (21) (221 (23) ,R-A-M-A-M-A-W" , R-A-M-A-R-A18-W-A-W R-A-M-A-R-A-A-R-Ax-W-A-W (51 ~ x :::; 35) R-A-M-A3-R-A-W-A-W-A-W-A-W-A-R-A R-A-M-A-W R-A-M-A3-W-A R-A-M-A R-A-A-R-R-R-A ' R-A-M-A-A-W . R-A-M-A-A-W-A-W-A-W-A-R-A R-A-M-A4-R-A-C x -A (16 ~ x 1) , R-A-M-A-R~A-A-Cx-Ay-W (16 ~ x ~ 1. 11 y ~ 5) R-A-A-R-A-C . R-A-A-C-A-A R-Ax (x=3 or 4) ,', R-A-R-A-A-H-Ax-W-A (18 x 3) R-A-A-R-R-A-W R-A-R-A-R-A-A R-A-A-R-A-W R-A-A-R-A R-A-A-R-A3 R-A-A-W R-A-M-A-R-A4-W < < < < THE TMS 9980A AND THE TMS 9981 MICROPROCESSORS The TMS 9980A and the TMS 9981 are low-cost variations of the TMS 9900. The principal differences between the TMS 9900 series and TMS 9980 series microprocessors are summarized in Table 18-4. Differences between the TMS 9980A and the TMS 9981 are summarized in Table 18-5. This discussion of the TMS 9980 series microprocessors covers only differences as compared to the TMS 9900. The TMS 9980 series microprocessors are manufactured using N-channel silicon gate MOS technology. They are packaged as 40-pin DIPs. The TMS 9980A uses three power supplies: -5V. +5V. and +12V. The TMS 9981 uses two power supplies: +5V and +12V. Typically. a clock cycle timE/of 400 nanoseconds will be used with TMS 9980 series microprocessors. This generates instruction execution times ranging between 4 and 14 microseconds. 18-44 Figure 18-14 illustrates that part of general microcomputer system logic which is implemented by the TMS 9980 series microprocessors. This figure is identical to Figure 18-1. with the exception of clock logic. which is now shown present. ~ ~ a: ~ Programmable registers are implemented and used in exactly the same way the TMS 9900 and TMS 9980 series microprocessors. Note. however. that the TMS 9980 series microprocessors address a 2048-bit CRU; therefore. bits 1 through 11 of Register R12 identify the origin of any CRU bit field. The TMS 9900 uses bits 1 through 12 of Register R12 to identify the .CRU origin within a 4096-bit CRU. Table 18-4. A Summary of Differences Between the TMS 9900 and TMS 9980 Series Microprocessors a: o CJ !: en w le( g en en e( CI/l w z a: o FUNCTION Addressable external memory DIP pins Data Bus Address Bus External interrupt priorities CRU field width Clock logic TMS 9900 TMS 9980A/TMS 9981 32.768 x 16-bit words 64 16.384 x 8-bit words 40 16 bits 15 bits 15 4096 bits Four external inputs 8 bits 13 bits 4 2048 bits One external input or internal (TMS 9981 only) m en o :!: e( c e( @ Table 18-5. A Summary of Differences Between the TMS 9980A and TMS 9981 Microprocessors FUNCTION Power supplies Clock logic Pin incompatibility ties . TMS 9980A TMS 9981 -5V. +5V. +12V One external input +5V. +12V One external input or crystal only DO - D7. INTO - INT2. <1>3 The TMS 9980 series microprocessors have a 14-line Address Bus, used to address up to 16,384 bytes of memory. In contrast. the TMS 9900 addresses up to 32.768 16-bit words of external memory. Thus. TMS 9980 programs address memory as bytes. while externally generated addresses also select bytes. The TMS 9900. by way of contrast. addresses memory as bytes within the CPu. but as 16-bit words externally. The TMS 9980 series microprocessors use exactly the same memory and CRU addressing techniques as the TMS 9900. General-purpose registers are used in the same way. and instruction object codes are identical. The Status register and Status flags used by the TMS 9980 series microprocessors are identical to those which we have already described for the TMS 9900. TMS 9980 SERIES MICROPROCESSOR PINS AND SIGNALS Figure 18-15 illustrates pins and signals for the TMS 9980A. Figure 18-16 provides the same information for the TMS 9981. In both of these illustrations. signal names conform to Texas Instruments nomenclature. For the Data and Address Busses. our notation is given in brackets. Differences result from the fact that we number bits from right to left (0 being the low-order bitl. while Texas Instruments numbers bits from left to right (0 becomes the high-order bit). TMS 9980A/TMS 9981 pin-out differences are shaded in Figures 18-15 and 18-16 so that you can identify them quickly. For descriptions of the individual signals, refer to the earlier TMS 9900 discussion. 18-45 .·,".Y·:.Y,.'" , :..:·.:,,:Y,':Y\':'/::./··)' , \ : , . " " " : ' " Y":·:·'·i.i Y.::· .,:'.:.'.·,.•: :• . •:. •.:.'i:':.,. ,•.,}(,' i.'YY·:<. ".':\:"':;"":"':',':':",,:." ".". :": .:,' :' .:""',:' ,:'.",. :'" :'":,:•.",•. :",,.,:" •..,.',/':.:'.: Data Counterisl Stack Pointer Direct Memory Access Control Logic I/O Ports Interface Logic , t Programmable Timers Read-Only Memory I/O Ports Read/Write Memory Figure 18-14. Logic of the TMS 9980A and TMS9981 Microprocessors 18-46 ~ HOLD HLDA Q w ~ ex: oQ. ex: o CJ :!!: en w ~ g CI) CI) < oil w Z ex: oCD CI) o lAO (LSB) (AO) CRUOUT/A13 (Al) A12 (A2) All (A3) Al0 (A4) A9 (A5)A8 (A6)A7 (A7)A6 (A8)A5 (A9)A4 (Al0) A3 (All) A2 (A12)Al (MSB) (A 13) AD DBIN CRUIN (+5V) VCC 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 TMS 9980A 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 WE CRUCLK V DD (+.12V) vss (GND) CKIN (LSB) (MSB) ::!! < Q < @ Pin Name Type Description AO·A13 Address Bus Tristate, output 00·07 Data Bus Tristate, bidirectional CKIN Clock signal in Input 1;3 Synchronizing clock Output Memory Enable Tristate, qutput lAO I nstruction Fetch Output DBIN Data Bus in Tristate, output WE Write Enable Tristate, output READY Memory Ready Input WAIT Wait State indicator Output CRUCLK I/O clock Output CRUOUT Serial I/O out Output CRUIN Serial I/O in Input INTO, INn, INT2 Interrupt request and priority Input HoLi5 DMA request Input HOLDA Hold acknowledge Output V BB ' V CC' V DD ' VSS Power and Ground reference Figure 18-15. TMS 9980A Signals and Pin Assignments 18-47 Hc5ID-~.. 1 2 IAO ......~--I 3 (lSB) (AO) CRUOUT/A13 .....1----1 4 (A1) A12 .....1...-.--1 5 (A2) A 11 ....~--4 6 (A3) A10 ....1----I -7 (A4) A9 ......---4 8 (A5)A8 9 (A6) A7 ....---4 10 (A7) A6 ....1----1 11 (A8) A5 ......~--t 12 (A9) A4 13 . (A10) A3 14 (A11) A2 15 (A12) .0.1 16 (MSB) (A 13) AO 17 OBI N .....1----1 18 CRUIN 19 (+5V) VCC HlDA-4---I TMS 9981 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 (lSB) (MSB) Type Description Pin Name AO-A13 Address Bus Tristate, output 00-07 Data Bus Tristate, bidirectional CKIN Clock or crystal connection Inptlt OSCOUT Crystal connection Output Synchronizing clock Output MEMEN Memory Enable Tristate, output lAO I nstruction Fetch Output DBIN Data Bus in Tristate, output WE Write Enable Tristate, output READY Memory Ready Input WAIT Wait State indicator Output CRUClK I/O clock Output CRUOUT Serial I/O out Output CRUIN Serial I/O in Input INTO, INT1, INT2 I nterrupt request and priority Input HOLD DMA request Input HOLDA Hold acknowledge Output VCC' V DD , VSS Power and Ground reference Figure 18-16. TMS 9981 Signals and Pin Assignments 18-48 TMS 9980 SERIES MICROPROCESSOR TIMING AND II\ISTRUCTION EXECUTION The TMS 9980A and TMS 9981 microprocessors have the same signal relationships and instruction execution sequences as the TMS 9900. The few minor waveform differences are identified in the data sheets at the end of this chapter. ow ~ a: o a.. a: o o ~ en The only significant difference between the TMS 9900 and TMS 9980 series Is in clock logic. The TMS 9900 requires four clock inputs. as identified in Figure 18-3. The TMS 9980A requires a single clock signal. input via CKIN. The frequency of this clock input must be four times the desired clock frequency. That is to say. CKIN will be divided by four in order to create one clock period. The TMS 9981 can operate with the same CKIN input as the TM~ 9980A; however. you can also connect a crystal across CKIN and OSCOUT. This may be illustrated as follows: ' TMS 9980 SERIES CLOCK LOGIC w ~ g CKIN ~------.-----------__- -__ CI) CI) ct o olI w Z a: oa:I CI) o OSCOUT t-----.------, :E ct o ct @ C 1 and C2 must have values between ,10pf and 25pf. typically 15pf. The crystal must be of the fundamental frequency type. The frequency will be divided by four in order to create the internal clock frequency. 80th the TMS 9980A and the TMS 9981 output3. a synchronizing clock signal. <1>3 is the inverse of the <1>3 clock signal shown in Figure 18-3 and in subsequent timing diagrams for the TMS 9900. Thus you can create the timing diagram for any TMS 9980 operation by looking at the equivalent timing diagram for the TMS 9900 and replacing the four TMS 9900 clock signals by a single timing pulse which will be the complement of <1>3. The following operations are identical within TMS 9900 and TMS 9980 systems: • Memory references. However. note that memory reference will consist of two memory access cycles. as a 16-bit word is handled as two bytes. ·CRU I/O operations (remember that the TMS 9980 series CRU is only 2048 bits wide). ·CRU control operations •The Wait state •The Hold state and direct memory access operations •The Halt state • The interaction of Hold and Halt states Refer to the TMS 9900 discussion for any of the above topics. TMS 9980 SERIES INTERRUPT LOGIC The TMS 9980A and TMS 9981 microprocessors support four levels of external interrupt. together with a Reset and a Load. Reset and Load are non-maskable interrupts. In contrast. the TMS 9900 supports 15 levels of external interrupt. along with Reset. The TMS 9980 series microprocessors identify external interrupts via the INTO. INT1, and INT2 inputs as shown in Table 18·6. Figure 18·17 shows the interrupt vector map. ', 18-49 Table 18-6. TMS 9980 Interrupts I nterrupt Decoded INTO INT1 INT2 0 0 0 Reset 0 0 1 Reset 0 1 0 Load 0 1 1 Level 1 (H ighest Priority) 1 0 0 Level 2 1 0 1 Level 3 1 1 0 Level 4 (Lowest Priority) 1 1 1 No Interrupts , Observe that the TMS 9980A and the TMS 9981 have no i'i\ffREQ input. Also. the Reset and Load non-maskable interrupts are decoded from the INTO - INT2 inputs. Figure 18-18 shows some pin connections for various levels of interrupt complexity in a TMS 9980 series microcomputer system. The three illustrations shown are self-evident they simply implement the INTO - INT2 codes defined' above. The TMS 9980 series microprocessors provide all 16 XOP software interrupts available with a TMS 9900. Observe that Figure 18-17 shows memory as 8-bit units in contrast to Figure 18-11. which shows memory as 16-bit units. This reflects the fact that external memory is addressed as bytes by the TMS 9980A and the TMS 9981. 18-50 Memory Address c w ! Reset ~ a: oQ. / a: o t u ~ enw Memory Byte Content "I 0000 WP HI 0001 WP LO 0002 PC HI 0003 PC LO 0004 WP HI 0005 WP LO 0006 PC HI 0007 PC LO Reset Vector > PC < ) WP I , I ( ~C LeveJ 1 Vector ) > WP } ) PC Level 2 Vector ~ I WP } Level 3 Vector > PC ~ WP } Leve' 4 VeeW } PC I L- 0040 WP HI 0041 WP LO 0042 PC HI L.. PC 0043 XOP Vectors, Use Same Memory Space as the TMS 9900 WP HI WP LO 007E PC Hi L...- PC } PC \wp } a Vector } XOP 15 Veeto, PC - LO I. Unassigned Memory WP I OP7D 007F } XOP L() I 007C Load { I } WP I 3FFC WP HI 3FFD WP. LO 3FFF PC HI 3FFF PC LO : VP PC } - Figure 18-17. TMS 9980 Memory Map 18.:.51 Load Veew INTO r INTO TMS 9980A/ TMS 9981 1 RESET - - - - 4.--1 INT1 LEVEL4 - - - - - I I N T 2 TMS 9980A/ TMS 9981 A) Using Reset and One External Interrupt RESET --H~-----1INT1 iJ5Ai5 INT2 B) Using Reset, Load and One External Interrupt Vee . ) b 4~ RESET 6 L:O'A5 5 LEVEL 1 LEVEL 2 ,. -:!:-- E1 A2 4 A1 3 AD L.EVEL. :3 2 LEVEL 4 1 '-c . e) 7 INTO ... - INT1 INT2 TMS 9980A/ TMS 9981 SN74148 (TIM 9907) Using Reset, Load and Four External Interrupts Figure 18-18. Some TMS 9980A/TMS 9981 Interrupt Interfaces The interrupt acknowledge process and interrupt priority arbitration logic are identical in TMS 9900 and TMS 9980 series microprocessors. For a discussion of t~ese subjects. refer to the earlier TMS 9900 description. THE TMS 9980 SERIES INSTRUCTION SET The TMS 9900 and TMS 9980 series microprocessors have identical instruction sets. Instructions execute in almost the same sequences of machine cycles - the only difference is that each memory reference will have twice as many memory access cycles. Refer to Tables 18-2 and 18-3. together with their accompanYing text. for details. Remember to substitute two memory cycles for each TMS 9900 memory cycle. THE TMS 9940 SINGLE-CHIP MICROCOMPUTERS The TM~ 9940 is a single-chip microcomputer based on the TMS 9900 microprocessor. Figure 18-19 illustrates that. part of our ~eneral microcomputer system logic provided by the TMS 9940 series microcomputer. Specifically, this is the logic provided by the TMS 9940 series microcomputers: ·A Central Processing Unit. essentially equivalent to the TMS 9900 Central Processing Unit ·2048 bytes of read-only memory. Erasable Programmabl~ Read-Only Memory (EPROM) is provided by the TMS 99400E. Normal mask programmable Read-Only Memory (ROM) is available with the TMS 9940M. ·128 bytes of read/write memory. This read-write memory is frequently organized as four sets of sixteen 16-bit registers. 18-52 • Two levels of external interrupt • An on-chip timer/event counter with its own interrupt logic c ·32 I/O pins accessed as 32 CRU bits ·A single +5V power supply • On-chip clock logic w ti a: oD. a: o (J Clock Logic ~ en w l- e:( U o(I) (I) e:( olI w Z a: o a:a (I) o ~ e:( C e:( @ Figure 18-19. Logic of the TMS 9940 Single-Chip Microcomputers The TMS 9940 microcomputer has very iittle expansion logic; 256 external CRU bits can be addressed, but . there is no provision for executing programs directly from external memory. But the TMS 9940 is easily included in multiprocessor configurations. For multiprocessor configurations. the TMS 9940 has internal Hold request/acknowledge logic. together with a serial I/O path via which data can be transferred between processors. The TMS 9940 has two +5V power supplies: a standard operating power supply and a standby power supply. Under program control. it is possible to shut down the TMS 9940. in which case only the standby power supply is active. An external interrupt can subsequently restart the TMS 9940. The TMS 9940 is manufactured using N-channel silicon gate MOS technology. It is packaged as a 40-pin DIP .. Using a 3 MHz clock. instruction execution times range between 3 and 10 microseconds. 18-53 This description of the T!VIS 9940 microcomputer relies on the preceding detailed description of the TMS 9900. This description of the TMS 9940 does not stand alone, and you should not read it until you understand the TMS 9900 in detail. TMS 9940 REGISTERS AND READ/WRITE MEMORY There are some important conceptual differences between the read/write memory/registers of the TMS 9940 and those of the TMS 9900. The TMS 9940 has only 128 bytes of read/write memory. with all the read/write on the chip itself. and you cannot create an external Data/Address Bus. Therefore. it makes no difference whether memory is addressed as bytes or words. The only remaining restriction is that 16-bit words must be origined on even byte address boundaries. 0000 WP HI WP LO > 0002 PC HI PC LO > PC 0004 WP HI WPLO 0006 PC HI PC LO WP} R,eset Vector < WP } Level 1 Interrupt Vector > PC :~~~E=l:~ 1~ WP HI WP LO 0008 > ,pc HI OOOA > PC PC LO WP HI WP LO oboc WP} Decrementer Vector I' } WP } Level 2 Interrupt Vector. PC HI PC LO OOOE > PC ::~~ ~ : s ·· 8320 8322 :~: Register Set 1 R1 R2 I- 0010 1 Register Set 2 0012 I ROM ) I I I ! Unused and Available for Programs I 004E' 0050 WP HI WPLO 0052 PC HI PC L.O, 0054 WP HI WPLO 0056 PC HI PC LO RAM i 0080 , WP} XOP 4 Vector > PC 835E > 1< ~ ~P~C~H~ I:} Register Set 4 837C t-----1R14 837E c = J R 1 5 WP HI WP LO l R15 :~:~ : ::~ 1 WP } XOP 5 Vector > PC } XOP 6 - XOP 14 Vectors ... PC LO R2 I I) 007E R15 R1 ' 8342 > I~ 007C 833E 8340 : : } XOP 15 Vector ' ( unus,ed and Ava,ilable for programs, 07FF ....._ _.... ) Figure 18-20, TMS 9940 Memory Map 18-54 The TMS 9940 does introduce one additional read/write memory restriction: the 128 bytes of read/write memory are divided into four non-overlapping sets of sixteen 16-bit registers, as illustrated in Figure 18-20. Note that the 128 bytes of read/write memory have specifically defined addresses. Both the TMS 9900 and the TMS 9980 series microprocessors allow any sixteen 16-bit words of memory to serve as a set of general purpose registers. whether or not they overlap with another set. Q w ~ oa. II: II: o o ~ u) w !i g en en c( ail w Z II: o CD en o :;! ~ c( @ :rhe TMS 9940 has the same three CPU registers as the TMS 9900: the Program Counter. the Workspace register. and the. Status register, The TMS 9940 sets aside general-purpose registers to serve specific functions. as does the TMS 9900. Given the configuration of the TMS 9940. many register designations can be justified only as a means of preserving TMS9900 series compatibility. For example. a 16-bit TMS 9940 Workspace register makes no sense when there are only 64 I'ocations that the Workspace register can possibly address. Moreover. the whole idea of context switching and tying up three 16-bit registers in order to execute a context switch - is ridiculous. given the few places to which you can context switch. But there is long-range sense in the TMS 9940 design. Over the next few years. enhancements of the TMS 9940 will appear with substantially more memory - both read-only memory and read/write memory. Since it is absolutely imperative that TMS 9940 programs be compatible with new. enhanced one-chip microcomputers that are likely to appear. it is necessary that addressing modes and architectural features that influence the instruction set be included in the TMS 9940 if they. will be useful in later enhancements. Despite' the fact that the TMS 9940 has only 128 bytes of read/write memory and 2048 bytes of read-only memory. the TMS 9940 has all of the TMS 9900 memory addressing modes. Note carefully that so far as memory addressing is concerned. there .is no difference between rea'd"only memory and read/write memory. Many one-chip microcomputers have a scratqhpad re'ad/write memory which can only be accessed as data memory. while a separate program memory can only store instruction sequences. the TMS 9940 makes no such distinction between its read-only memory and read/write mernory. Data and instructions can be stored in read-only memory or in read/write memory. The TMS 9940 and TMS 9900 CRU addressing techniques are identical; however. the TMS 9940 has just 32,external CRU bits. each with its own dedicated pin. By configuring 11 of these pins aS,address lines and CRU controls .. you can expand external CRU to 256 bits. There'are some small differences between the TMS 9930 Status re'gister as compared to the TMS 9900 Status register. The TMS 9940 Status register may be illustrated as follows: a l' 2 3 4 5 15'14'1~ 12 11, 10 6 7 8 9 9 8 7 6 I ~ I ~ I = I C I 0 I P 1. 0 .~ j ~ • .. .~ IAcl a I a I 10 11 5 4 12 13 14 154-TMS99aa 8itNumber 3 01 I I I a 111' I 0 ... Our Bit Number 2 J Status Register -~L a a I Inter.rupt Mask Unused Half Carry Status Parity Status Overflow Status Carry Status Equal Condit(on Arithmetic Greater Than Condition Logical Greater Than Condition TMS 99,40 L... N. =. C. O. and P statu,ses.'are the same a~ those of the TMS 9900.' The TMS 9940 has no XOP instruction executed status. which the TMS 9900 holds in Status register bit 9. 18-55 The TMS 9940 has anAC status in bit 8. This is a half-carry status. For byte-oriented instructions. AC represents the carry from the low four bits to the higher four: .. 7 6 5 4 3 04-Blt No. 2 I pip I pip I I I I I Q Q Q Q Memory Byte U AC = 1, for Carry AC = 0 for NoCarry I ~ I I(51 sis Is ININI NI INININ I I 15 14 IA "- 13 12 '1110 9 8 7 6',5 A .. 4 3 2 ',. N V O_BitNo. N Gono,al-Pu,po," Aeg'''e, . . ,,/ Byte Instructions operate on the high-order byte of a register. For 16·bit instructions. the AC status represents a carry from bit 11 to bit 12: 10 15 14 13 12 I pip I P 11 1 0 jaI 9 Q 8 7 6 5 4 3 2·· 1 0 . - Bit No. I I I I I I"I sis Is I Q A A A A Mmory Word orGeneral-Purpose Register AC = 1 for Carry AC = 0 for No Carry Since there are just four levels of external interrupt. the TMS 9940 uses Status .register bits 0 and 1 for its interrupt mask. In contrast. the TMS 9900 uses Status register bits 0.-1. 2.and 3.for itsin,terrupt mask. TMS 1940 CPU PINS AND SIGNAL ASSIGNMENTS Fiture 18-21 illustrates the pins and signals of the TMS 9940 microcomputer. po. P31 and 321/0 pins addressed as 32 CRU bits. Some of these pins serve additional functions which can be selected under program control. 18-56 The TMS 9940 can, in fact. use standard TMS 9900 CRU instructions to address up to 612 CRU bits. But 512 is the maximum number of CRU bits that the TMS 9940 can address. Therefore. the TMS 9940 uses just 9 bits of General Purpose Register R12 to create CRU bit addresses._For a single-bit CRU instruction. this may be illustrated as follows: cw ~ a: oQ. a: oCo) Instruction Object Code ~~-----------------~~----------------~, LSB MSB 15 14 13 12 11 10 9 ~ 8 7 6 5 4 3 2 0 I' Ixlvlvlvlvlvlvlvl en w ~ g en en c( o2J w a: Z o 15 III 14 13 12 11 en o ~ g c( @ x + X V V V V V V V Z Z Z Z Z Z Z Z Z Sum Becomes Effective CRU Address 18-57 10 9 8 7 6 5 4 3 2 -.. .... P23 P22 P21 P20 P19 P18 EC/P17 I DLE/P16 HL5'A/P15 H'[i5/P14 ..... TD/P12 (+5V) V CC1 (+5V) V CC2 TC7P11 (jJ/P13 CRUCLK/P10 CRUOUT/P9 CRUIN/P8 ~ INT1/TST '"R'S'TjPE ~ - -- ..-.. ---- ....- - .. ---- ..- -- . - ~ -.. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 TMS 9940 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 --.. ·.... --- - -- .. ----- ....- · _ -- ..·.. ~ -- ·.-. -- · -- .. ~ --- ·~ VSS (GND) P31 P30 INT2/PROG P29 P28 P27 P26 P25 P24 P7/A8 (LSB) P6/A7 P5/A6 P4/A5 P3/A4 P2/A3 P1/A2 PO/A1 (MSB) XTAL2 XTAL1 Pin Name Description Type PO - P31 INT1/TST INT2/PROG RST/PE AO - A7 CRUCLK CRUOUT CRUIN TC CRU I/O pins External interrupt and Test select External interrupt and EPROM programmer System reset and EPROM programmer enable External CRU bit address External CRU clock External serial I/O output External serial I/O input Multiprocessor data I/O clock Multiprocessor data I/O Event counter input Idle state indicator Hold request Hold acknowledge Synchronizing clock External crystal connections Standby + 5V power Normal + 5V power Ground reference Bidirectional Input Input Input Output Output Output Input Bidirectional Bidirectional Input Output Input Output Output TO EC IDLE HLD HLDA XTAL2, XTAL1 VCC1 VCC2 VSS (In this figure, Pn and An numbering conforms to Texas Instruments' policy of beginning with N=O for the high-order bit. We use N=O for the low-order bit.) Figure 18-21. TMS 9940 Microcomputer Signals and Pin Assignments 18-58 Table 18-7 shows how the TMS 9940 interprets its 512 available bit addresses. Table 18-7. TMS 9940 CRU Bit Address Assi~nments cw ~ a: 0 CRU Address Read Function Write Function 000 to OFF External CR U bits; the address is output via A 1-A8. } and CRUCLK 100 to 17F } Unused Data is transferred via CR U IN, CR UOUT Do a: 0 0 ~ en Unused 180 INT1 state Unused 181 Oecrementer interrupt level Clear decrementer interrupt 182 INT2 state Unused 183 Unused Configuration bit 184· Unused Configuration bit 1 (CB 1) 185 Unused Configuration bit 2 (CB2) c 186 Unused Configuration bit 3 (CB3) @ 190 to .190 ...w c:( g CI) CI) c:( ail w 2 a: 0 a (CBO) ID CI) 0 ~ c:( c:( } Oecrementer register. 190 is the least sign ificant bit and 190 is the most sign ificant bit 19E Unused Timer (high) or Counter (low) select 19F Unused Unused 1AO to lAF System I nterface buffer register } 1Multiprocessor AO is the least significant bit and 1AF is the most significant bit lBO to lBF } General purpose flag bits lCO to 10F } Unused 1 EO to 1FF } Local CRU pins (PO = Identify direction for PO (via 1CO) through P31 (via 10F). 1 specifies output. 0 specifies input 1EO, P31 = 1FF I The place to begin looking at Table 18-7 is at CRU bits 183, 184, 185, and 186. These four CRU bits represent write-only locations which determine how the 32 CRU pins illustrated in Figure 18-21 will be used. TMS 9940 CRU BIT UTILIZATION If you look again at Figure 18-21. you will see that PO through P17 have shared functions. P18 through P31 are simple I/O pins without other programmable options. CRU addresses 183, 184, 185 and 186 control the functions of PO through P16, as illustrated in Table 18-8. P17 options depend on real-time clock logic. which we will describe later. Let us look at the programmable options available with CRU pins PO through P31. It does not matter what options you have selected; you will actually access the 32 CRU pins PO - P31 via CRU addresses 1 E016 through 1 FF16. In the simplest case, all 32 pins, PO - P31, will be used for input or output. We call this SimTMS 9940 ple I/O mode. In order to use all 32 pins for data input or output. {that is. in Simple I/O model. all SIMPLE four of the configuration bits. CBO. CB1. CB2. and CB3. must be O. At any time. a CRU bit can CRU I/O either input data or output data. but it cannot be used for bidirectional data transfer. You must MODE identify the direction for each pin by outputting appropriate data to CRU addresses 1CO 16 through 1 DF16' As shown in Table 18-7. each pin has a dedicated CRU address. beginning with pin PO controlled by 18-59 1C016 and ending with pin P31 controlled by CRU address 1DF16. A 1 written to any Direction CRU bit causes the associated pin to output data only. A 0 written to any CRU Direction bit causes the associated pin to input data only. Of course. you can at any time change a pin from input to output or from output to input. under program control. by rewriting control information to Direction CRU bits 1C016 through 1DF16 Table 18-8. TMS 9940.CRU Bits Whose Functions are Determined Under Program. Control CRU Function as Configured =0 Bit Address Pin 0-7 1EO-1E7 23-30 PO-P7 8 1E8 18 9 1E9 10 1EA CBO CBO =1 CB1, CB2, CB3 A1-A8 No Effect P8 CRUIN No Effect 17 P9 CRUOUT No Effect 16 P10 CRUCLK No Effect CB1 =0 CB1 =1 CBO, CB2, CB3 11 1EB 14 P11 TC No Effect 12 1EC 11 P12 TO No Effect CB2 13 1ED 15 =0 P13 CB3 =0 CB2 =1 1> CB3 =1 14 1EE 10 P14 15 1EF 9 P15 -HLDA 16 1FO 8 P16 IDLE HLD CBO, CB1, CB3 No Effect CBO, CB 1, CB2 No Effect No Effect No Effect You will always have to define the direction of data transfer for pins P18 through P31 - assuming that you are using these pins. When pins PO through P17 are being used in any of the special ways which we are about to describe. then the data direction associated with the special operation will apply. and it makes no difference what you output to the associated Direction CRU bit. If you wish to use 256 external CRU bits, then you must set CRU bit 183 (CBO) to 1. This is TMS 9940 called I/O expansion mode. I/O expansion mode modifies the functions of pins PO through P10. CRU I/O When you use CRU addresses 00 through FF16 in I/O expansion mode. the address is output via EXPANSION pins PO - P7. which now function as CRU address lines A 1 - A8. P8. P9. and P1 0 serve as the stanMODE dard CRU data transfer lines: CRUIN. CRUOUT. and CRUCLK. Timing for data input and output via these three lines has been described for the TMS 9900. Refer to the TMS 9900 description for details. In order to illustrate the use of external CRU, consider execution of the instructions: LI LI LDCR R3.>00 R12.>140 R3.4 LOAD 1010 BINARY INTO UPPER BYTE OF R3 LOAD A BASE ADDRESS OF 82 HEX INTO R12 OUTPUT FOUR LOWcORDER BITS OF R3 TO CRU Note that R12 contains 014016 to represent the address 08216. since R12 bit 0 is unused: therefore the internal address is. in effect. doubled. This instruction outputs 1010 to CRU bit 08216 (0). 08316 (1). 08416 (0). and 08516(1). Since fewer than eight bits will be transferred. they will come from the upper byte of the general purpose register. This is theevent sequence which occurs: 1) The address 8216 is output via Al - A8. Remember. Texas Instruments' literature uses 0 to represent the highorder bit: therefore A 1 represents the high-order address bit. and A8 represents the low-order address bit.CRUIN is inactive. but CRUOUT is low to represent 0 while CRUCLK is pulsed high to time the 0 bit on CRUOUT. 18-60 2) The address output on A 1 ~ A8 increments to 8316. and CRUOUT goes high. then CRUCLK pulses high. 3) The address on A 1 - A8 increments to 8416. CRUOUT goes low again. and CRUCLK pulses high. 4) The address on A 1 - A8 increments to 8516. and CRUOUT goes high. and CRUCLK pulses high. 1010 has now been transmitted to four external CRU bits. cw ~ a: oQ. a: o (J ~ enw ~ g Note that it is up to external logic to decode the CRU address output: however. the Parallel System interface (which we will describe in later editions) will connect directly to the TMS 9940 Address and CRU outputs that we have just described. When you write 1 to CRU bit 18416 (CB1), pins P11 and P12 function as serial data transfer pins. The purpose of this logic is to allow the TMS 9940 to operate in multi-CPU configurations. This logic is very simple. You output data by writing the data to CRU bits 1A016 through 1AF16. This data is immediately transmitted via TD (P12) as a serial data stream which is clocked by TC (P11). In keeping with normal bit sequence protocol. data is transmitted low-order bit first. Thus. 16 bits of data being output may be illustrated as follows: C/) C/) II: ~ w "" II: w Z a: II: o w o o -~ o .J o II: ± oCD CJ o I C/) ~tO ~ to .... .... « ~ o c ~ @ TMS 9940 MULTIPROCESSOR SYSTEM INTERFACE 11. « 11 10 11 11 11 10 11 10 11 11 11 10 11 10 1 1 I-U :>a... CJ 1- 0 :>.J O.J 1-« (/)2 II: II: -w wX 11.1- IW 1->~m (/)z -w Iw I-.(/) TC TO When a TMS 9940 has a 1 written to CB1. it can also receive data via TD. Data input is again clocked by TC.lnput logic is the reverse of the output logic illustrated above; that is say. as a data stream is input. the first input bit is loaded into CRU bit 1AF16. and the sixteenth input bit is loaded into CRU bit 1A016. TMS 9940 multiprocessor system interface logic is used to transfer data from a memory location in one TMS 9940 to a memory location in another TMS 9940. You will not normally use this logic to transfer data between a TMS 9940 and external logic; the CRU serves that purpose better. There are three reasons why you may want to use the TMS 9940 multiprocessor system interface; they are: 1) To transmit status information. For example. one TMS 9940 could tell another how far it has progressed through various phases of a task by transmitting a status word whose bits have some predefined interpretation.' 2) To transmit data. One TMS 9940 may generate data which another TMS 9940' needs in order to execute its programs. 3) To transmit instruction sequences. Instructions could be transmitted from the read-only memory (or the read/write memory) of one TMS '9940 to the read/write memo'ry of another TMS 9940. The. receiving TMS 9940 cou Id then execute the instruction sequence out of its read/write memory. - 18-61 -- -... -- - -- :. · · · :. .. - -..- - - ..: , 10 ,. 11 .~ •• m m;: Ul- :2 I- 13 00 ~ 01! 02 , 15 14 ~ .. I .. - ..- -- ----::.. - .. - -- ..-.;., -- -.. -.. · --= INn P27 P31 P30 P29 P28 TO TC ~ TO P28 P29 P30 P31 TC TO P28 P29 P30 P31 iC TO P28 P29 P30 P31 TC TO P28 P29 P30 P31 . P26~ P25 ~--.. 0 INT1 P27 UlP26 :2 P25 .~ ... P30 P29 -- - ..... P28 TO =rc + 12 ~~ - P31 P30 P29 P28 TO TC 0 ~ P31 74148 17 16 P31 P30 P29 P28 TO TC ~N - 11- ~,.. I- 0 ~ m .... m M Ul- ~ I- 0 ~ m .... m "" Ul- ~ I- - INTi P27 P26 P25, ~~ - INT1, P27 1 P26 P25 ..,~ 1- I I- 03 02 01 00 4~ 12 -:... 0 ""mm .... lO Ul~ I- 0 ""m m~ U) Ul- ~ I- 0 ""m m~ I' Ul~ I- 0 ""m m~ OJ Ul~ I- P25, P26, ~P27 11 10 74138 04 05 06 07 I TN'fl P25 ~I. P26 P27 INT1' ,.. P25, P26 ~II" P27 INT1 - P25 P26 P27 INT1 I .. ~ Figure 18-22. Handshaking Logic in a TMS 9940 Multi-Microcomputer Network Communicating via the TD Data Line 18-62 cw ~ a: oQ.. a: o CJ ~ en w l- e:( (; oCI) You could use the CRU to perform any of the three data transfers described above. but the multiprocessor system interface is somewhat easier to use. We say that data transfer via the multiprocessor system interface is "somewhat" easier to use because many problems still remain when you use the multiprocessor system interface. These problems arise from the fact that there is absolutely no handshaking protocol associated with the multiprocessor system interface. For example. there is absolutely no protection against two TMS 9940s simultaneously trying to output data via TD and TC. There is no predefined protocol whereby a transmitting TMS 9940 identifies the receiving TMS 9940 or the instant data has been transmitted and should be read. Any protocol is your responsibility - to be provided by logic external to the TMS 9940s. Fortunately. this protocol is easy to implement. Figure 18-22 shows how eight TMS 9940s can communicate with each other, such that each TMS 9940 may transmit data to, or receive data from, any other TMS 9940. The logic illustrated in Figure 18-22 is more complex than the logic you would need for a small system - for example. a two-microcomputer system. or a system where there are dedicated transmitters and receivers. While Figure 18-22 shows TMS 9940s communicating with each other. you will in ·fact use TMS 9940s just as frequently with other microprocessors - such as a TMS 9900. Nevertheless. the concepts embodied in Figure 18-22 would apply. from the viewpoint of the TMS 9940. in any other configuration. Let us look at how the logic in Figure 18-22 works. CI) e:( ell w Z a: o aI CI) o ~ e:( c e:( The first problem we must resolve is the problem of transmission contentions. How will we make sure that one TMS 9940 does not try to transmit data while another TMS 9940 is already transmitting data? A simple scheme would be to set aside a particular CRU pin to serve as a "Busy" line. For example. every TMS 9940 could use P31 as a "Busy" output pin and P30 as a "Sense" input pin. We could wire-OR together all P31 Busy outputs and input this wire-OR to all P30 Sense inputs. Now any TMS 9940 that wishes to transmit data will read its P30 CRU bit. If this bit is O. then it will output 1 to P31. Outputting 1 to P31 causes all otherTMS 9940s to receive 1 at their P30 inputs. Thus. no other TMS 9940 will begin transmitting data if another TMS 9940 was in the process of transmitting data. This logic may be illustrated as follows: @ P31 P30 All TMS 9940s now receive a high P30 output 1 to P31 Another TMS 9940 senses P30 high - so does not try to output The problem with the logic illustrated above is that two TMS 9940s could simultaneously read P30. find it was O. output 1 to P31. then output competing data on TD. While the chances of two microcomputers executing identical instructions at exactly the same time are very small. a well-designed microcomputer system must account for every potential error. In Figure 18-22 we resolve our problem by using a 74148 8-to-3 decoder. The P31 output from every TMS 9940 is connected to a different 74148 input. The 74148 outputs. via 00. 01. and 02. the line number for the highest priority active input. This three-line output is connected to the P28. P29. and P30 pins of every TMS 9940; we assume that these three pins are inputs at every TMS 9940. Nowevery TMS 9940 that wishes to transmit data via TD must output a 1 to P31. It must then input the contents of P30. P29. and P28. Upon detecting its own ID on these three inputs. it begins data transmission. If a TMS 9940 outputs 1 via P31 and then reads in some other ID via P30. P29. and P28. then it must wait. Here is an appropriate instruction sequence: LOOP LI R12. >3F8 SBO STCR CI JNE 3 LI LDCR R2.3 R2.ID LOOP R12. >340 R3.16 LOAD P28 ADDRESS. X2. INTO R12 SET P31 ON . INPUT P28. P29. AND P30 COMPARE INPUT WITH DEVICE ID RETURN AND RE-ENTER CODE IF NOT CORRECT ID LOAD MPSI OUTPUT DATA BASE ADDRESS X2 OUTPUT CONTENTS OF R3 VIA TD 18-63 Assuming that a TMS 9940 has output 1 to P31 and has received back its own ID via P28. P29. and P30. the TMS 9940 is ready to transmit data. However. in addition to simply transmitting the data .. the TMS 9940 must tell the intended recipient that the data has been transmitted. In Figure 18-22 we use a 74138 3-to-8 demu Itiplexer for- this purpose. Pins P25. P26. and P27 of every TMS 9940 are outputs that connect to the 10.11. and 12 inputs of the 74138. The transmitting TMS 9940 outputs data which will be received by every other TMS 9940; however. the transmitting TMS 9940 follows up by outputting a 3-bit code via P25. P26. andP27; this 3-bit code identifies the intended recipient. The 3-bit code is input to the 74138. which generates one of eight possible outputs. These eight outputs become external interrupt request inputs to the eight TMS 9940s. Only the single TMS 9940 will receive the data which was transmitted by the eighth TMS 9940. only one TMS 9940 will receive an interrupt request signal: this is the TMS 9940 for which the transmitted data was intended. The TMS 9940 which receives data simply executes an STRCR instruction to move the data from CRU bits 1A016 through 1AF16 to the appropriate general purpose register. CRU bit 18516, the CB2 bit, serves the very limited purpose of outputting a synchronizing signal. When you output 1 to CB2, P13 ceases to be an I/O pin and instead outputs the internal TMS 9940 clock signal. TMS 9940 SYNC MODE CRU bit 18616 (CB3) controls idle and hold logic for the TMS 9940. When you write a 1 to CRU bit 18616. pins P14 and P15 act as hold request input (HLD) and hold acknowledge output (HLDA) signals. respectively. P16 generates an IDLE output. The Hold request/acknowledge logic of the TMS 9940 is quite standard. The purpose of this TMS 9940. logic is to remove the TMS 9940 from any shared busses when some other microprocessor or HOLD LOGIC microcomputer is bus master. If CB3 is 1. then a low signal arriving at the TMS 9940 HLD input will cause the TMS 9940 to enter a Hold state at the conclusion of the current instruction's execution. A low HiJ5A output marks the beginning of the Hold state. The IDLE signal is output low when an IDLE instruction is executed and CB3 is 1. The only way in which you can terminate an Idle state is by requesting an interrupt via INTl or TNT2. The TMS 9940 three-state signals are not floated in the Idle state. You must additionally enter the Hold state for this. The purpose of the IDLE instruction and signal is to enable standby power logic. This may be illustrated as follows: +5V IOLE LOW OPENS SWITCH Under normal circumstances. the power supply will input power to VCCl and VCC2. When IDLE goes low. the power input to VCC2 is switched off. While VCC 1 only is receiving power. the TMS 9940 read/write memory and interrupt logic is active. but all other logic is inactive. since the interrupt logic is active. any arriving interrupt request will be acknowledged. The process of acknowledging an interrupt request sets IDLE high again. This closes the switch and restores power to VCC2. which allows the TMS 9940 to resume normal execution. In the illustration above. note that IDLE is connected to HLD. 18-64 TMS 9940 GENERAL.PURPOSE FLAGS o If you look again at Table 18~7, you will see that C~U addresses 18016 through 1BF16 address 16 general purpose flags. These general purpose flags have no special hardware functions. They are programming aids and that is all. You can write data out to these flags. and you can read back the data. How you use this data is entirely up to program logic. w T~~ a: The TMS 9940 has a timer.which can a'.so be used as an event counter. CRU bit 19E 16 determines whether this logic will function as a timer or as an everit counter~ If CRU bit 19E16 is high, then this logic serves as a Timer. If CRU bit 19E16 is low, then this logic s~ives as an event counter. ~ a: oQ. o !: u u) w ~ g en en oct all w Z a: en en o o ~ oct o oct @ 994.0 ~iM..ER/EVENT ~OUNTE~LO.GIC . . . . . '. . Timer and Event Counter logic both use CRU bjts 19016 'through 19D16 as a 14-bit register whose contents are decremented by Timer or Event Counter logic. This 14-bit register is buffered. That is to say. the initial value which you output to CRU bits 19016 through 19D16 is stored in a buffer. in addition to being loaded into CRU bits 19016 through 19D16. Subsequently. CRU bits 1~016 through 19D16 are decremented. but the buffer contents remain unaltered. When CRU bits 19016 through 19D16 decrement to O. they are reloaded from the buffer. Thus Timer/Event Counter logic runs continuously. An interrupt request is generated interrially when CRU bits 19016 through 19D16 decrement . to O. Remember. C~G:blt 19016 is the low-order bit. and CRU 19D16 is th~ high-order bit. This is' the reverse of hormal Texas Instruments bit numbering. where the high-order bit has the lowest bit number. However. this is consistent with the fact that Texas Instruments outputs data to the CRU low-order bit first. and addresses CRU bits in numerically ascending address sequence. When you write Oto CRL! bits J90, 6 through 19DH3. you disable Timer/Event Counter logic. When the Tim~r/Ev~rit CouHt~r is op~rating as a timer, the 14-bit register represented by CRll bits 19016 through 19016 are decrement~d once every 30 inierli~1 clock oscillations. The crystal conne'cted across XTAL 1 and XT AL2determines clock oscillation frequency, When CRU bits 19016 through 19D16 time out to zero. an interrupt request is generated. When Timer/Even~ Counter logic is operating ~s a~ event counter, pin P17 seryes as ari inpul, receiving the event sequence to be counted. Every low-to-high transition of the signal input at P17 decrements the counter. Once again. when the counter counts out to O. an interrupt request occurs and the counter is reloaded from its buffer register. TMS 9940 INTERRUPT LOGIC The TMS 994:0 has four ext~rnal iriterrupt~ and twelve internal software interrupts. These are the four external inter~uPts: 1) Reset. Thi~ has ~ighest prio~ity. 2) A level 1 interrupt occurring at the INT1 pin. This has second highest priority. 3) A Decremehter/Event Counter interrupt. This has third highest priority. 4) A level 2 interrupt occurring at the INT2 pin. Thi~ has lowest priority. . • • 01. . , As described for {he TMS 9900. you execute XOP instructions to generate software interrupts. XOP4 through XOP15 are active. XOPO through XOP3 do not exist on the TMS 9940. TMS 9940 interrupt vectors. togethe~ with a co~plete TMS 9940 memory map. are illustrated in Figure 18-20. The actual interrupt acknowledge sequence for a TMS 9940 is identical to that which we have described for the TMS .. 9900. TMS 9940 RESET a , You Reset the TMS 9940 by i~putting I~w ~ignal at RSTIPE (pin 20). This low signal' must last for at least five clock cycles. A Reset resets to 0 the contents of all pointer regiSters and all CRU configuration bits. Following a Reset. level 0 interrupt response begins - which means that read-only memory bytes 0 through 3 provi~e the initial Program Counter and Word Pointer register contents. and therefore the address of the program which will be executed following the Reset. 18-65 Note that the TMS 9940. being a smaller and simpler system than the Tt'v1S9900. car use elementary logic to generate an interrupt acknowledge. For the TMS 9900 we suggested an Address Bus decodihg technique in order to create an interrupt acknowledge signal. For the .TMS 9940 a CRU bit will do just fine. The foiiowirig circuit. is recommended by Texas I nstru ments: a D INT REa ClK 7474 0. I NT1 or i'i\iT'2 Ci::R INT ACK A simple D-type flip-flop has its D input connected to +5V.Every time an interrupt request'pulse is input to the clock pin. the Q output will go low - generating a valid interrupt request at the TMS 9940. In order to acknowledge the interrupt and remove the interrupt request signal. you can output a low pulse via any of the P pins. This low pulse clears the D-typ~ flip-flop and forces Q high again. PROGRAMMING A TMS 9940E ERASABLE, PROGRAMMABLE READ-ONLY MEMORY The TMS .9940E has a transparent q~arti lid over the device in its dual in-line package. In order to erase the TMS 9940E EPROM, you should expose it to a high-intensity ultravioletlight with a wavelength of 2537 angstroms. An intensity of 10 watt-seconds per square centimeter is recommendea. After the TMS 9940E EPROM has been erased. all EPROM memory bits will be O. These are the steps required in order to program a TMS 9940E EPROM: 1) Reset the device. 2) Apply the first data byte - to be stored in memory location 0000 to pins P24 through P31. Remember. P24 represents the most significant bit of the byte. and P31 represents the least significant bit of the byte. 3) Apply a 26-volt level to pin 20. the RST/PE pin. This being the first programming pulse. it resets the internal program memory address point at 0000 and writes the data byte at P24 through P31 into memory location O. 4) After at least 80 clock cycles. apply 26 volts to pin 37. INT2/PROG. for 50 milliseconds while changing the data byte (step 5). 5) Apply the next data byte to P24 through P31. At the high-to-Iow transition the next location. 6) Remove the 26 volts from pin 37 for a minimum of 50 clock cycles. Then apply 26\1to pin 37 for 50 milliseconds. 7) Return to Step 5 until all of program memory has been programmed. at PROG. the data will be written into LOADING A PROGRAM INTO TMS 9940 READIWRITE MEMORY You can load a program directly into TMS 9940 read/write memory via pins P24 (MSB) through P31 (LSB) for either the TMS 9940E or the TMS 9940M. Typically. this is done in order to load a small test program. The procedure for loading data into the TMS 9940 read/write memory is exactly as described in the previous section for loading data into EPROM;' except: the 26-volt level is applied to pin 19. the TST pin. after the device has been reset by inputting a low signal to pin 20. the RST /PE pin: and the high pulses at PROG are logic '1' level rather than 26 volts. When you input data to a TMS 9940 read/write memory using the TEST pin and P24 through P31. the address pointer is initialized to address 830016. The address keeps incrementing the high-to-Iow transition of each 50 millisecond programming pulse applied at pin 37. When you finally stop applying programming pulses. the last 16 bits of data input are interpreted as thebeginning address for the program to be executed. This address may point to a read/write'memory location. or to read/write memory location. That is to say. the test program may be in read/write memory. in readonly memory. or in both areas. . a THE TMS 9940 INSTRUCTION SET The TMS 9940 instruction set is identical to the TMS 9900 instruction set, with these exceptions: 1) The RSET, CKOF, CKON and LREX instructions have been deleted. That is. all the external instructions except IDLE. 18-66 Q w 2) The XOP instructions will not work with operands 0, 1, 2, or 3. 3) There are new DCA and DCS Instructions that enable 8-bit binary-coded decimal arithmetic. Assuming that you start with two valid 8-bit binary-coded decimal operands. you can add these two 8-bit operands using normal binary addition. The result will be a meaningless 8-bit number: however. if you immediately execute the DCA instruction. this meaningless 8-bit number will be converted to a meaningful 8-bit. 2-BCD-digit number. o DCS. likewise. allows you to perform 8-bit binary-coded decimal subtraction. Assuming that the subtrahend and minuend are both valid 8-bit binary-coded decimal numbers. you perform a subtraction using binary arithmetic and you generate a meaningless 8-bit result. By executing the DCS instruction. you convert this meaningless 8-bit result into a valid 8-bit. 2-BCD-digit binary-coded decimal difference. ~ The DCA and DCS instructions both generate in the low-order eight bits of the 16-bit word. en w For a discussion of decimal adjust logic in BCD,addition or subtraction. see Volume 1. Chapter 3. ~ oQ. 0: 0: CJ ~ g en en The LlIM instruction loads a 2-bit interrupt mask into the two low-order bits of the Status register. Here are the instruction object codes used by the DCA. DCS. and LlIM instructions: < 011 w 2 Instruction 0: DCA r DCS r LlIM n o a:J en o ~ < Q < @ Object Code Bytes Clock Periods 0010110000bbssss 0010110001 bbssss 001011001 xxxxxnn 2 2 2 7 7 10 The object code notation above conforms to that which we have described for Table 18-3, For the LlIM instruction. x represents "don't care'" bits and n represents the two binary digits that get loaded into the two low-order Status register bits. ' THE TIM 9904 FOUR-PHASE CLOCK GENERATOR/DRIVER This part is also given the generic TTL name: the SN74LS362. The TIM 9904 provides TMS 9900 microprocessors with the four clock signals: <1>1, <1>2, <1>3, and ct>4. These are +12V MOS driver signals. In addition, four complementary +5V clock signals, ct>1, ct>2, ct>3, and ct>4, are generated for use elsewhere in a TMS 9900 microcomputer system. The TIM 9904 device may be driven by an external crystal, an external LC circuit, or a single external clock sig" ' nal. The TIM 9904 is manufactured using low-power Schottky technology: hence the 74LS part number. It is packaged as a 20-pin DIP. All signals. other than the four MaS level clocks. are TTL-compatible. The TIM 9904 allows one asynchronous input signal to be synchronized. via a D flip-flop. with the ct>3 signal. The synchronized signal is output. frequently to be used as a RESET input to the TMS9900. Figure 18-23 illustrates TIM 9904 pins and signal assignments. The four clock signals, ct>1,ct>2, ct>3, and ct>4, conform to Figure ct>1, ct>2, ct>3, and ct>4. 18-3~ ct>1, ct>2, ct>3, and ct>4 are complements of ' A logic level input at D will be output at Q on the high-to-Iow transition of ct>3: cp3 _ _ _--I o Q 18-67 TANK1 TANK2 GND1 Q D <1>4 <1>3 <1>3 <1>4 GND - -. ------ 1 2 3 4 5 6 7 8 9 10 TIM 9904 20 19 18 17 16 15 14 13 12 -- ... ,;. ... --.. 11 Pin Name Description VCC1 (+ 5V) XTAL2 XTAL1 OSCIN OSCOUT <1>2 iiii VCC2 (+ 12V) <1>1 <1>2 Type + 12V clocks to drive a TMS 9900 Output + 5V clock complements Output <1>1. <1>2. <1>3. <1>4 <1>1. <1>2. <1>3. <1>4 D Q TANK1. TANK2 XTAll. XTAL2 OSCIN OSCOUT VCC1. VCC2. GND1. GND2 Asynchronous control Synchronized control Crystal overtone controls External crystal connections External clock Clock with frequency 4<1> Power. Ground . Input Output Input Output Figure 18-23. TIM 9904 Signals and Pin Assignments OSCOUT provides a clock frequency four times that of the clocks. Its phase relationship to the clocks may be illustrated as follows: OSCOUT 4>2 4>3 , '~----------------~I I ,-----------------~,I ,------------------1 4>4~_______________________ 18-68 ,---------- When an external quartz crystal Is used to drive the TIM 9904, the following connections are required: TANK 1 Q w ~ a: o Q. a: o 0.47 J.LH ~_-I2 19 i o - . -..... XTAL 1 TANK2 o TIM 9904 U ~ enw 20 ohm to 75 ohm crystal, 2 mw power dissipation. (May substitute a 0.1 J.LF capaclton) ~ g CI) CI) < ail w 17 Z OSCIN a: oCD o CI) OSCIN must be tied to a high logic level for the internal clock logic to work properly. :E Required capacitor and inductance values are shown in the illustration above for a TMS 9900 microprocessor operating with its standard 3 MHz frequency. The crystal must have a resonant frequency of 48 MHz. For 48 MHz operation. a third overtone crystal is used. < c < @ For less precise timing. the quartz crystal may be replaced with a 0.1 J.Lf capacitor. The LC-tuned circuit now establishes the clock frequency according to the following equation: fosc = 1/(27T.jCC) where L is the inductance. with units of Henries. and C is the capacitance with units of Farads. This includes the capacitance of the circuit into which the components are mounted. If an external clock signal is Input, It must occur at OSCIN. The crystal connections XTAL 1 and XTAL2 should be connected to VCC as follows: + 5V ( r---4 NOT {TANK 1 CONNECTED TANK 2 - V 20 1 19 2 TIM 9904 18 17 18-69 Cc 1 .~ :~ XTAL2 XTAL1 OSCIN } TIED TO LOGIC '" CLOCK INPUT The clock input OSCIN must have a frequency which is four'times the clock period frequency and has a 25% duty cycle. Thus. for a 3 MHz frequency. a 12 MHz signal must be input via OSCIN: 1...... ----OSCIN ·1 83.3ns . ---- ~-------~r' ~20.8nsr- In TMS 9900 microcomputer systems, the D input is used for an asynchronous reset; Q is output as a synchronousreset. This may be illustrated as follows: Vee c . 10Kn : 1000 .AAA ! - y TIM TMS 9904 9900 a 0 y RESET 1 F-- - The illustration above shows recommended resistor and capacito'r values. TIUI~ TUI: ....... 111'1~ DDnt:!DAIUIIUIADI C _ ~V~TCI\JI ""'1 ••.•• •• _ •••••• __ ...... . _ ....... ftftn" ",~ II\ITCDCAI'C II • • _ . . . . , , _ _ ID~I\ ,I _ I I The TMS 9901 Programmable System Interface (PSI) is a special support part designed for the TMS 9900 series of microprocessors. This relatively primitive device uses 32 bits of the TMS 9900 CRU bit field to support parallel I/O and interrupt request logic. Programmable timer logic is also available. Figure 18-24 illustrates that part of general microcomputer system logic which has been implemented on the TMS 9901 PSI. The TMS 9901 PSI is packaged as a 40-pin DIP. It uses a single +5V power supply. All inputsand outputs are TTL-compatible. The device is, implemented using N-channel silicon gate MOS technology. . 18-70 Clock Logic Q w Arithmetic and Logic Unit ~ a: oQ. Accumulator Registerlsl ,." a: o u Instruction Register .' ... Control Unit ~ enw ~ .. Data Counterlsl .. Stack Pointer ~ g CI) CI) 0:( o1J w Z Bus Interface Logic a: oa:I ~ Program Counter Direct Memory Access Control Logic CI) t t o ~ 0:( Q System Bus 0:( @ ROM Addressing and Interface Logic I/O Communication . . Serial to Parallel Interface Logic .)Inl~;~. .,."" laic ,,,,." :<. . :. (i ". ". 'i ....".'" !i Read Only Memory i. t'c :- Read/Write Memory i'" j)! t Figure 18-24. Logic of the TMS 9901 Programmable System Interface 18-71 ~ t "" } ,"" 3 RAM Addressing and Interface Logic '" :""',,-,, ~ ~ .. -.- RSTi CRUOUT CRUCLK CRUIN - -... iNT6 - --...... iN'f5 iNT4 iN'f3 Ci> INTREQ (LSB) IC3 IC2 IC1 (MSB) ICO VSS TFm iNi'2 P6 P5 ---- --- -.. -- ----- Pin Name CRUIN CRUOUT CRUCLK PO - P15 iN'ff - INTl5 iNi'REQ ICO - IC3 CE SO - S4 Rffi VCC,VSS 1 2 3 4 5 6 7 ·8 9 10 11 12 13 14 15 16 17 TMS 9901 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 18 19 -%0 23 22 21 -- .. -- ..- --- .-. ----- --.-. - - - . ::- ...- --- -.... ---- .. --.. --.. - - Description CRU data output CRU data input CRU data input strobe I/O data External interrupt requests Interrupt request to CPU Interrupt priority designation Chip Enable CRU bit select Chip reset Synchronizing clock signal Power, Ground reference VCC (+5V) SO (MSB) PO P1 S1 S2 INT7/P15 INT8/P14 INT9/P13 INTlO/P12 INTll/Pll INT12/Pl0 INTl3/P9 INT14/P8 P2 S3 S4 (LSB) INTl5/P7 P3 P4 Type Output Input Input Input or Output Input Output Output Input Input Input Input Figure 18-25. TMS 9901 Programmable System Interface Signals and Pin Assignments In the illustration above, Address lines have been numbered using our standard notation, whereby A 14 is the highestorder address line and AO is the lowest-order address line. This is the opposite of Texas Instruments' notation. The CRU select lines are numbered according to Texas Instruments' notation and Figure 18-25. Therefore, S4 is connected to AO, and SO is connected to A4. 18-72 TMS 9901 PSI PINS AND SIGNALS The TMS 9901 pins and signals are illustrated in Figure 18-25. The signals which connect the TMS 9901 to a TMS 9900 series microprocessor are quite straightforward: they consist of the CRU and interrupt signals. The CRU signals include CRUIN. CRUOUT. and CRUCLK. cw ~ II: oa.. II: o U ~ en w I- ct The interrupt signals consist of INTREQ. ICO .. IC1. IC2. and IC3. For a description of CRU and interrupt signals . refer back to our Tiv1s 9900 discussion. Device select logic includes a chip enable input, CE, together with five CRU bit select pins, SO - S4. CE and SO . S4 will connect to the Address Bus as follows: ..•.. .-.. ·· :. -.. U o II) II) ct ell w Z II: o a:I II) ..... I DEVICE SELECT I A14 A5 A4 A3 A2 A1 .:: AO - S4 .. S3 .. o S2 __ ~ ct C ct S1 .. @ TMS 9901 - SO .. CE_ In the illustration above. Address lines have been numbered using our standard notation. whereby A 14 is the highestorder address line and AO is the lowest-order address line. This is the opposite of Texas Instruments' notation. The CRU select lines are n.umbered according to Texas Instruments'notation and Figure 18-25. Therefore. S4 is connected to AO. and SO is connected to A4. 18-73 Device select logic determines the CRU address space that will be reserved for the TMS 9901 PSI. This may be illustrated as follows: .. .: :. : : ......-.. ·· . ..... ~ CRU ACCESS A5 A4 A3 A2 . A1 .t;.0 DEVICE SELECT CE l' o A14 A13 A12 A11 ,......, " 'l) • M"E'ME"N r 0 0 ~ SO S1 S2 S3 S4 n n n n n n n r • r r ~ x x x x ,x """"--....__......v-",.-__-'¢I' .............- -.....v~-"-'../ These three bits zero and M"E'ME"N inactive (high) indicate a CRU address These seven bits identify the TMS 9901 address space .. These five bits select a CRU bit in the TMS 9901 PSI The high-order three address lines. which we call A 14. A 13. and A 12. are all zero during a CRU access. at which time inactive (high). Thus we decode address lines A 11 through A5 to select a particular TMS 9901 device: "iViE'f\ii'EN is Since the TMS 9980 uses the Address Bus differently during a CRU operation. TMS 9901 device select logic would connect to the Address Bus in a different way. The CRU bit select lines SO - S4 would be tied to lines A5 - A 1: device select logic wou Id decode lines A 11 - A6: and lines A 13 and A 12. -along with MEMEN. wou Id indicate a CRU access. We illustrate this as' follows: MSB A 13 o LSB A 12 O. A 11 n A 10 n A9 n A8 n A7 n A6 n A5 x ......--,~~----------~~ , ~ ~~-- A4 x A3 x A2 x AO . - Address Bus x ~~--------~~ These five bits select a CRU bit These six bits identify the TMS 9901 address space A1 CRUOUT These two bits zero, along with M"E'ME"N inactive, indicate a CRU address CiJis a synchroniz!!:ill. clock signal used to time data output and to sample interrupts ..<1> is the 'complement of <1>3. For the TMS 9900, <1>3 is generated by the TMS 9904. The TMS 9980 outputs <1>3 directly. The best way of understanding the interface between a TMS 9901 and external logic is to look at functions performed, as illustrated in Figure 18-26. ' 18-74 If\lTERRUPT MASK BITS o SELECT BIT ICo . .-~r--...., INTERRUPT PRIORITY ENCODER Q IC1-.---t !ia: IC2 -40---1 a: IC3 ~----1l....._........J w oDo o CJ ~ u) w INTREQ <:I---{ CLOCK LOAD BUFFER !i g (I) (I) ct all w Z a: o CD (I) o ~ ct Q ct @ CRUOUT - -......... CRU CRUClK ---I:.IINTE R FACE ~_ _ _ _ _ _ _---' CRUIN .....- - - 1 SO ---II~ S1---"~1 S2----I~ \S3----I~ PO-P6 CRU BIT SELECT LOGIC S4--_'- CE .... Figure 18-26. TMS 9901 PSI General Data Flows and CRU Bit Assignments 18-75 \ j' • From the programmer's viewpoint. a TMS 9901 looks like 32 contiguous CRU bits. Thus, you will access any part of a TMS 9901 device's logic using CRU input apdoutput instructions. • • ' '. r " { As you read through the TMS9901 description thatfolloV,Vs, you should bear in mind the power of multi-bit CRU load and store ilistrl:lctions as they' apply to TMS 9901 architecture. A single instruction transferring an appropriate bit pattern can ,frequently perform multiple control and data transfer operations. The manner in which CRU b.~tS are used by the TMS 9901 is not straightforward. This is because CRU bits share functions and pins. ~unctions and Ilins are shared in different ~ays. Let us first look at pin connections. CRU bits 1-6 connect to pins INT1 - INT6; thus, in interrupt mode each of these CRU bits has its own dedicated input pin. CRU bits 7-15 share nine input or output pins with CRU bits 23-31. CRU bits share piris as follows: 7 8 31 30 29 .9, 28 27 26 25 24 10 11 12 13 14 23 15 ... " ... ... .~ .~ 31 ~ ~O ~ 29 28 27 ~ ......... r 34 33 32 ~ ... - . ... , ~ ~ ~ 23 t t Device Pii1S I These CRU bits support interrupt logic These CRU bits are dedicated to data I/O Each of the CRU bits shown above shares a pin with another CRU bit. That is to say, within the illustrated CRU address ~ange, there are two CRU bits which will a~cess the same pin, although each CRU bit performs a different operation. Thus you use the same pin in one of two different ways, using a bit address to select one operation. This may be illustrated as follows: If you select CRU bit 27, Pin 30 supports data I/O 30 . I. If you select CRU bit.11, and interrupt mode, Pin 30 serves as an interrupt request input CRU bits 16-22 connect to parallel I/O pins. These bit addresses are not shared with any other TMS 9901 functions. CRU bit 0 is a s~lect bit that is not connected to any pin. A 1 written into this bit causes bits 1-15 to support realtime clock logic. A written into CRUbit selects ihterrupt logic. When CAU clock logic is selected, bits 1-14 function as two 14-bit real-time Clock Buffer registers - one read-only register, the other write-only. Real-time clock logic is separate from, and operates simultaneously with, and/or parallel I/O logic. That is to say, the process of selecting realtime clock logic does not disable a.ny other logic. The select bit merely chooses which registers CRU addresses will access. rather than enabling or disabling any operations. a a a TMS 9901 PSI INTERRUPT LOGIC The easiest place to start understanding the TMS 9901 is at its interrupt logic. External logic can input data to CRU bits 1-15 via their connected pins. These input data signals will be interpreted as interrupt requests if interrupts are enabled. If interrupts are disabled, then these CRU bits act simply as data input. 18-76 You access interrupt logic through the CRU when the select bit, CRU bit 0, contains a O. CRU bit addresses 1-15 each access separate read-only and write-only locations. The read-only location stores the signal level input at the attached pin. The write-only location accesses an interrupt mask bit. This may pe illustrated as follows: ReadOnly Data Bit WriteOnly Mask Bit' c w ~ oQ" IX - IX o u !: N N1' 1 en w e:( l- I U I oCI) CI) e:( CRU Bit N { CRU Bit N + 1 { o/l w Z IX oa:I CI) o N ~ N r--- +1 I I I I I - } From Pins I - Signals arriving at pins connected to CRU bits 1-15 are immediately reflected by CRU bit contents: ~ ReadOnly pata Bit e:( c e:( @ 0 I I I: Low High A low level (that is. a a bit) is. interpreted as i3n interrupt request. The interrupt request is passed on to the mask bit. If the mask bit contains 1. the interrupt is enabled and the interrupt request is passed on: Interrupt Request .. WriteOnly Mask Bit 1 ReadOnly Data Bit , I I· 0 I I I: Low High If the mask bit is O. the interrupt request is disabled and therefore denied: WriteOnly Mask I Bit I 0 ReadOnly Data Bil I· 0 '0' 1 18-77 I I I: Low High Quite apart from interrupt logic. the CPU can at any time read the contents of one or more CRU bits in the address range 1-15. Here are some instructions that may access CRU bits 1-15 in various ways: LI LI LDCR R12.PSI+1 R1.MASK R1.15 LOAD CRU BASE ADDRESS INTO R12 LOAD INTERRUPT MASK BITS INTO R1 OUTPUT TO WRITE-ONLY MASK LOCATIONS STCR R2.15 INPUT CRU BITS 1 THROUGH 15 AS DATA TO R2 For some randomly selected data levels. CRU bits 1-15 may be illustrated as follows: Interrupt Mask Bits 1 Bits Pass on Interrupt Reque sts -- t 1 1 2 1 3 0 4 1 5 1 6 0 7 0 8 0 9 1 10 0 ,,-=CRU Oat a to CPU - 11 1 12 1 13 0 14 1 CRU Bits o Bits Generate Interrupt Requests -.. 1 2 .. ... -- pulse which causes the Clock Counter to decrement. • An exit from clock mode. c w ~ IX: oQ. Thus, the Clock Read Buffer register is updated whenever the TMS 9901 leaves clock mode, and every time the Clock Counter decrements outside of clock mode. ~ Beware - even if CRU bit 0 contains a 1. the TMS 9901 will exit clock mode for as long as it sees a 1 on select line SO; this will happen whether or not CE is active. Thus the Clock Read Buffer will not hold the same value indefinitely just because the TMS 9901 select bit is set. The PSI will leave clock mode whenever the CPU reads to or writes from CRU bits 16-31. or if any device accesses a memory address with a 1 on the address line connected to SO (A4 in a TMS 9900 system). en w The logic controlling clock mode and the Clock Read Buffer may be illustrated as follows: IX: o CJ ~ g 7;-----1 +64 U) U) < DECREMENT CLOCK COUNTER all w Z IX: o SELECT BIT (CRU BIT 0) III U) o L--~-""" :!l UPDATE CLOCK READ BUFFER < c < @ so This logic summarizes our discussion above. There are two important things to note about clock mode and Clock Read Buffer update. First. you cannot inadvertently exit clock mode while you are reading the Clock Read Buffer. since you access it as CRU bits 1-14. Second. you cannot enter clock mode solely by accessing CRU bits 0-15; SO changes clock mode only ilvhen the select bit is 1 (clock mode selected). In order to read the most recent Clock Counter value, you must do two things: • Exit clock mode so the Clock Read Buffer will receive the current Clock Counter contents. • Enter clock mode so the Clock Read Buffer will be stable during the read itself. Here is the appropriate instruction sequence: LI SBZ SBO \ STCR R12.PSI+1 -1 -1 R1.14 LOAD PSI CRU BASE. ADDRESS -EXIT CLOCK MODE TO UPDATE READ BUFFER ENTER CLOCK MODE TO STABILIZE READ BUFFER READ 14-BIT CLOCK READ BUFFER TMS 9901 RESET LOGIC You can reset a TMS 9901 in one of two ways: 1) 2) By inputting a low signal at'iiSf1. By using a programmed reset via RST2, a CRU bit. In order to use RST1. a low level must be input at this pin for at least two clock periods. You can reset the TMS 9901 under program control only whim clock mode is selected (CRU bit 0 is 0). At this time. writing a 0 to CRU bit 15 (RST2) causes the device to be reset. Thus. the following instruction sequence causes a TMS 9901 device reset: LI SBO SBZ R12.PSI o 15 LOAD PSI CRU BASE ADDRESS ENTER CLOCK MODE RESET PSI When the TMS 9901 is reset. the INTREQ signal is output high. ICO through IC3 are output low. all interrupt requests are disabled. and all I/O CRU bits are placed in input mode. 18-81 DATA SHEETS The following electrical specifications for the TMS 9900 and the TMS 9980A are out of date: we provide them here only to give a rough idea of timing and electrical requirements. Texas Instruments is revising its documentation on the TMS 9900 series parts. Revised data sheets will appear in updates to this volume and in the next edition. C iLl ~ o D. II: II: o U ~ u) iLl ~ g en en c( aIS iLl Z II: o m en o ~ c( C c( @ 18-D1 TMS 9900 TMS 9900 ELECTRICAL AND MECHANICAL SPECIFICATIONS ABSOLUTE MAXIMUM RATINGS OVER OPERATING FREE·AIR TEMPERATURE RANGE (UNLESS OTHERWISE NOTEO)* Supply voltage, VCC (see Note 1) Supply voltage, VOO (see Note 1) Supply voltage, VSS (see Note 1) All input voltages (see Notp 1) Output voltage (with respect to VSS) Continuous power dissipation Operating free·air temperature range Storage temperature range. -0.3 to 20 V -0.3 to 20 V -0.3 to 20 V -0.3 to 20 V -2 V to 7 V 1.2W O°C to 70°C . _'5°C to 150°C ·Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or any other conditions beyond tl10se indicated In the "Recommended Operating Conditions" section of this specification Is not implied. Exposure to absolute-maxlmum·rated conditions for extended periods may affect device reliability. NOTE 1: Under absolute ma)(lmum ratings voltage values are with respect to the most negative supply, Vee (substrate), unless otherwise noted. Throughout the remainder of this section, voltage valuei are with respect to VSS. Data sheets on pages 18·02 through 18·08 are reproduced by permission of Texas Instruments, Incorporated. 18-02 TMS 9900 RECOMMENDED OPERATING CONDITIONS MIN NOM MAX UNIT Supply voltage, VSS -5.25 -5 -4.75 V Supply voltage, Vee 4.75 5 5.25 V c Supply voltage, VOO 11.4 12 12.6 V ~ Supply voltage, VSS 2.2 2.4 Vee+ 1 V V -1 0.4 VOO 0.8 -0.3 0.3 0.6 V 70 °e w II: oa. II: High-level clock input voltage, VIH(¢) o Low-level input voltage, VIL (all inputs except clocks) ~ Low-level clock input voltage, VI U¢) CJ en ~ V 0 High-level anput voltage, VIH (all inputs except clocks) VOO-2 Operating ftee-air temperature, T A 0 V w g (/) (/) ELECTRICAL CHARACTERISTICS OVER FULL RANGE OF RECOMMENDED OPERATING CONDITIONS (UNLESS OTHERWISE NOTED) ~ ell PARAMETER w Z II: o o II Input current ~ 41 Clock-4 input capacitance CDS Data bus capacitance Co 10. = 3.2 mA VCC 0.65 10 = 2 mA 0.50 VSS = -5, f= 1MHz, unmeasured pins at VSS Clock-3 input capacitance 2.4 VSS = -5, f = 1MHz, unmeasured pins at VSS VSS = -5, f = 1MHz, unmeasured pins at VSS VSS = -5, f = 1MHz; unmeasured pins at VSS O':!tput capacitance (any output except VSS = -5, data bus) unmeasured pins at VSS = 25° C and nominal voltages . • D.C. Com'ponent C!f Operating Clock t All typical values are at T A 18-03 f = 1MHz, V V TMS 9900 TIMING REQUIREMENTS OVER FULL RANGE OF RECOMMENDED OPERATING CONDITIONS (SEE FIGURES 12 AN'D 13) MIN NOM MAX UNIT tcltP) . Clock cycle time 0.3 0.333 0.5 /..IS tdtP)· Clock rise time ·5 12 1S' ns tf(tP) Clock fall time 10 12 :I.&" ns tw(tP) Pulse width, any clock high 40 45 tl/>1L,1/>2H Delay time, clock 1 low to clock 2 high (time between clock pulses) 0 5 t1/>2L, 3L,I/> 4H Delay time, clock 3 low to clock 4 high (time between clock pulses) ·0 5 ns PARAMETER tl/>4L,I/> 1H Delay time, clock 4 low to clock 1 high (time between clock pulses) tl/> 1H,I/>2H Delay time, clock 1 high to clock 2 high !time between leading. edges) tr/>2HAlaH tr/>3H,r/>4H Delay time, clock 2 high to clock 3 high (time between leading edges) tl/>4H,I/> 1H tsu Delay time, clock 4 high to clock 1 high (time between leading edges) Delay time, clock 3 high to clock 4 high (time between leading edges) ' Data or control setup time before clock 1 0 5 ns 73 73 73 73 80 ns 80 ns 80 ns 80 ns ns ns SWITCHING CHARACTERISTICS OVER FULL RANGE OF RECOMMENDED OPERATING CONDITIONS (SEE FIGURE 13) TEST CONDITIONS PARAMETER MIN CL = 200 pF tpLH or tpHL Propagation delay time, clocks to outputs TYP MAX 20 40 ~I 1 .........- - - - - - - - - - - - - tel,,,, CLOCK ~'12 CLOCK (,13 I I I tr/>_3L_.rf>4_H CLOCK_<;,4_ _ _ _ _ _ _ _ _ _ _I_.. NOTE: All timing and voltage levels shown on 4>1 applies to 4>2, 4>3, and 4>4 in the same manner. FIGURE 12 - CLOCK TIMING 18-04 -r II j4- tr/>4H, r/> 1H ~~f t ns ns 30 10 Data hold time after clock 1 th 100 .\: \Ch4L.¢lH TMS 9900 ID¢::: :~*{fW~ --.J J.' INPUT ltu Q w ~ oQ. CLOCK 411 IX: ~:___9~.4Vr-\~____________~~r-\~____ CLOCK4l2 ___ CLOCK4l3 _ _ enw ~ g ~-..J 4Vn I ct I •. all CLOCK 414 4V n -J (/) o ~ CRUCLK OUTPUT i--tPLH : _----:...._~:t'AV ~ r @ We OUTPUT O.4V i I lo.4v : --.I i4-tPLH I I , I r ~ _______~I-----..Jt~2-.4V----------------~~ !PHL-.J WAIT OUTPUT tPLH I tpHL I_ _----Jt·4V -+-_ _ i-I r_ \ ---t ~ n 4v I ----~----------~--~I IX: o cg ct Q ct •. •• (/) (/) w Z _______________ I IX: !: ~ th ~~o~.~~v____________________9_'4~V~~ o lJ j4- I LI r .-, tPHL f4- tPLH OR tpHL I tTha number of cycles over which input/output data must/will remain valid can be determined fro·m Section 3.9. Note that in all cases data should not change during C·70oC 10 TYP 15 MAX UNIT 10 MHZ 25 I'>f External Clock The external clock On the TMS 9980A and optional on the TMS 9981, u~es the CKI N pin. In this mode the OSCOUT pin of the TMS 99!H must be left floating. The external clock source must conform to the following specifications .. PARAMETER f ext External source frequency· VH V· ,L External sOurce high level External source low level Tr/Tf External source rise/fall time MIN TYP 6 MAX UNIT 10 MHz 2.2 V 0.8 10 V ns TWH External source high level pulse width 40 ns TWL External source low level pulse width 40 ns "This allows a system speed of 1.5 MHz to 2 MHz. 18-07 TMS 9980A SWITCHI~G CHARACTERISTICS OVER FUll RANGE OF ~ECOMMENDED OPERATING CONDITIONS The timing of all the inputs and outputs are controlled by the intern()1 4 phase ciock: thus all timings are based on the width of one phase of the internal clock. This is l/f(CKIN) (whether driven or from crystal). This is also %fsystem. In the following table this phase tilTle is denoted two ' a All external signals are ~ith reference to 1/>3 (see Figure 14). PARAMETER TEST CONDITIONS Rise time of rp3 tf(rp3) Fall time -of rp3 t w (rp3) Pulse width of rp3 tsu Data or control setup time· th Data hold time· tPHL (WE) tPLH(WE) tP.HL(CRUCLK) Propag'ation delay time WE high to low Propagation delay time WE low to high Propagation delay time. CRUCLK high' to low tPLH(CRUCLK) tov Propagation delay time. CRUCLK lowto high Delay time from output valid to rp3 low tox Delay time from output invalid to rp3 low • Al! MIN TYP MAX 3 5 10 ns 5 7.5 15 ns t~-15 t w -10 tw+ 1O ns " t r (rp3) tw=1/f(CKIN) =%fsystem ns t w -30 2tw+1O CL = 200pf inputs except ICO-I C2 must be synchronized to 'meet these re9uirements. ICO-IC2 may tw- 1O tw -20 2tw-1O t....,-50 UNIT I1S tw+2O tw+ 3O +10 ns ns ns 2tw t w -30 2tw+2O ns ns t w -20 tw lis tw. tw+ 1O -10 chan~e asynchronously. See section ;2.10,4: !NPUTS I I I I I _--!....-----!.-.I~-_tP.LH_ _.}Ir--~:---'--'-~[~HL I CRUCLK--------; _I OTHER ~tOV.3L I ~,......:.I--_--_-_??,3,L"j=. OUTPIJTS ~\.._ _ _ _ _ _ _ V_A_L_I_D_ _ _ _ _ _ _ _--, FIGURE 14 - EXTERNAL SIGNAL TIMING DIAGRAM 18-08 - , w Chapter 19 a: SINGLE CHIP' NOVA MINICOMPUTER CENTRAL PROCESSING UNITS Q ~ a: oD. o lJ ~ en w ~ g C/) C/) ct ~ w z a: o III C/) o In this chapter we are going to look at two microprocessors which are the world's first single chip reproductions of established 16-bit minicomputers. We are going to describe two products which reproduce, on a single chip, the logic of a Nova Central ProcessinQ Unit. No'va minicomputers are built by Data General Corporation. Data General Corporation offer a set of LSI chips centered on the MicroNova microprocessor. These chips are described quite superficially in this chapter since Data General is not actively marketing them as LSI devices. Rather, Data General favor the sale of MicroNova microcomputer systems. ::!! Fairchild manufacture the 9440 microprocessor, which is sold primarily as an LSI device. The 9440 is therefore described in some detail, together with standard Nova I/O bus and typical memory bus interface bus logic. @ The Nova minicomputer was designed as a next generation enhancement of the PDP-8. The IM61 00. which we have described in Chapter 13. is a single chip implementation of the PDP-8 Central Processing Unit. ct Q ct If you compare the Nova3rchitectures. which we describe in this chapter. with the IM61 00 described in Chapter 13. the two products will indeed look very different. But conceptually they are similar. Both the Nova and the PDP-8 Central Processing Units have few addressable registers; for computing power they rely upon instructions which may perform complex sequences of operations. Similarities between the Nova and the PDP-8 will become more apparent if you compare these two devices with the CP1600 and the TMS9900 - which we have described in Chapters 16 and 18. respectively. . What is interesting about the Nova minicomputer is that it is one of the most popular in the world; and Data General Corporation is the second largest minicomputer manufacturer in the world. despite the fact that many aspects of the Nova Central Processing Unit may. 'on first inspection. appear to be very restricting. The MicroNova is manufactured by: DATA GENERAL CORPORATION Mail Stop 6-58 Southborough. MA 01772 The 9440 is manufactured by: FAIRCHILD SEMICONDUCTOR 464 Ellis Street Mountain View. CA 94040 The MicroNova and th'e 9440 are not the same; differences, however, are small. The MicroNova is eq~ivalent to the Nova 3 minicomputer. The Nova 3 is a low-end minicomputer recently introduced by Data General. Although it is a low-end product. it includes a number of features not found in the basic Nova architecture. The 9440 reproduces basic Nova architecture - that is. the lowest common denominator of architectural features found in any Nova Central Processing Unit. As such. the 9440 lacks a number of logic features provided by the MicroNova. The 9440. however. has higher instruction execution speeds. Because the MicroNova and the 9440 are very similar. we are going to describe them together in this chapter. The MicroNova is manufactured using NMOS LSI technology. The 9440 is manufactured using Isoplanar integrated injection logic (l3U technology. Both products are packaged as 40-pin DIPs. The MicroNova requires four power supplies: -4.25V. +5V. +10V and +14V. The 9440 requires two power supplies: +5V and +350 mAo 19-1 Using a 240 nanosecond clock. the MicroNova executes instructions in 2.4 to 10 microseconds. Using a 100 nanosecond clock. 9440 instructions will execute in 1 to ~.5 microseconds. A P~ODUCT OVERVIEW Figure 19-1 illustrates that part of our general microcomputer system logic which has been implemented by the . . MicroNova and the 9440. Note that only the MicroNova has a Stack Pointer, and I?I\I!A logic. Most Nova minicomputers do not have a Stack; the 9440 is the 9440 lacks a Stack. a reproduction of the basic Nova architecture. which is why ,. The MicroNova and Nova 3 db contain Stacks. because the addition of the Stack is technologically straightforward. while the lack of a Stack had been one of the most distressing ~ea~ures of earlier Nova minicomputers. Both the 9440 and the MicroNova have DMA request and DMA acknowledge signals; however. in response to a DMA request. the 9440 does nothing except float the System Bus. it is up' to you to provide any and all external logic needed to actually perform a data transfer via direct memory access. The MicroNova. on the other hand. executes the required sequence of I/O operations to actually perform the Dt0A transfer. Thill is why in Figure 19-1 DMA logic is shown as being present on the MicroNova but not the 9440. . What about I/O ports? I/O ports interlace logic is shown as abse~t in Figure 19-1. The I/O port is a microcomputer concept. In any microcomputer configuration. you will look upon I/O ports as th~ ultimate interface between the microcomputer system and external logic. You need a conduit via which data bits or signals can be transferred to. or received from logic beyond the microcomputer system. Each conduit becomes an I/O port and an I/O port becomes a set of pins. which can be addressed as a unit on a ~upport device. Minicomputer~l~ke a conceptually different approach to I/O operations. To begin with. data is generally transferred to or fromthetC:PU - not signals. The data finishes up on a System Bus. Therefore a minicomputer's interface with the outside worts:! cqnsists of an I/O System Bus and a memory System Bus. In some cases the two busses are one; in other cases. such;a's"the Nova minicomputers. these two are separate and distinct busses. Canceptually. what is impartant is the facdh~t t~e minicamputer anticipates transferring data via its I/O System Bus to line printers. disk units. or other substantial devices each of which is capable of having a significant amount of local logic. Thus the System Bus is as far as the minicomputer attempts to. go when defining its interface to the outside world, Figure 19-1, including bus interface logic within the logic of the Central Processing U nit, needs some clarification. As we have just stated. the Nova minicomputer creates two separ?lte System Busses: one for memory. the other for 1/0 devices. All the signals af these two busses originate at card edge pins. There is nothing very expensive about adding more pins to the edge of a card. as there is to adding more p'ins toa DIP. Therefore the Nova System Bus has 47 signals. Since neither the MicroNova nor the 9440 can have 47 signals. neither of these two devices creates standard Nova System Busses; but each device creates its own System Bu's which could be used to drive external logic. That is why interface logic is shown as being present in ~igure i 9-1. . . . 19-2 © ADAM OSBORNE & ASSOCIATES. INCORPORATED Clock Logic '--_ _ _..II MicroNova and~ Iltttll~\1 MicroNova on~ Logic to Handle Interrupt Requests from External Devices Figure 19-1. Logic of the Data General MicroNova and the Fairchild 9440 There is one further major difference between the MicroNova and the 9440 which is not evident from Figure 19-1. The M icroNova provides transparent dynamic memory refresh logic. The 9440 has no dynamic memory refresh logic. The MicroNova, but not the 9440, contains an elementary interval timer capability. Providing interrupttimer logic is enabled. the MicroNova will generate an interrupt request every 20.000 instruction cycles. Using a standard 8.333 MHz clock. this translates to an interrupt request occurring every 2.4 msec. Note that the MicroNova and the Nova 3 interval timer logic differ. The Nova 3 provides four programmable interval timer options; the MicroNova provides just one. NOVA PROGRAMMABLE REGISTERS These are the programmable registers of the MicroNova and the, 9440: o 15 ACO } ACI Primary Accumulator AC2 Accumulator and Index register I Stack Pointer } I Frame Pointer 14 AC3 Accumulator. Index register and Subroutine Return Address register MicroNova Only o Data General literature numbers registers and memory words from left to right. rather than as illustrated above. from right to left. Also Data General is one of the few minicomputer manufacturers that uses octal numbering. In order to remain consistent with the rest of this book. we will use hexadecimal numbers. and we will number registers from right to left: where confusions may arise. we will show both our standard numbers and Data General equivalents. ACO and AC1 are typical primary Accumulators. AC2 andAC3 may be used as Accumulators or as Index registers. The Jump-to-Subroutine instruction automatically stores the return address in AC3. If one subroutine is going to call another (j.e .. you are nesting subroutines!' then the calling subroutine must save the contents of AC3 before itself calling another subroutine. Only the MicroNova has a Stack Pointer. The only instructions that access' the Stack Pointer are "Push" and "Pop" i nstru ctions. The MicroNova, but not the 9440, also contains a Frame Pointer register. The Frame Pointer register is an address buffer used to access the Stack. This may be illustrated as follows: MEMORY Stack Pointer identifies current top of Stack Use Fram e Pointer to hold im portant Stack ad dresses The Frame Pointer is a buffer register; it is not a Data Counter. There are no instructions that access the memory loca. tion addressed by the Frame Pointer. Observe that we show no programmable registers identified as Data Counters. even though in Figure 19-1 we show Data Counter logic as being present. This is because the Data Counter is another microcomputer concept - in effect. a subset of the Index register. If a memory reference instruction specifies direct. indexed addressing with a zer'o displacement. then Index Registers AC2 and AC3 are equivalent to Data Counters. 19-4 . NOVA MEMORY ADDRESSING MODES Both the MicroNova and the 9440 offer the following standard Nova memory addressing modes: c w ~ a:: o0. a:: o u ~ en w ~ g CI) CI) c( alJ w Z a:: o III CI) o 1) 2) 3) 4) 5) 6) 7) Base page, direct addressing Program relative, paged, direct addressing Indirect addressing Indirect addressing with auto-increment Indirect addressing with auto-decrement Direct, indexed addressing Pre-indexed, indirect addressing These addressing modes have been described in Volume 1, Chapter 6. Nova memory addressing' modes are heavily influenced by the fact that every Nova instruction generates a single 16bit object code - just as the predecessor PDP-8 instructions each generated a single 12-bit object code. Even memory reference instructions are confined to 16 bits of object code: therefore the memory reference instruction can only provide a short address displacement. Whereas PDP-8 memory reference instructions provide a 7-bit address displacement. the Nova provides an 8-bit address displacement. which is handled in a much more intelligent fashion. Nova instructions that use simple, direct addressing treat the 8-bit displacements as a direct, page zero address, or as a signed binary, program relative displacement. Thus you can directly address the first 256 words of memory, or you can address any location within + 127 to -128 words of the memory reference instruction itself: ~ c( MEMORY § cc( @ yy can directly address base page i 0001 0002 0003 ~ iOOFE i I Memory reference instruction 0000 OOFF 0100 ·(xxxx) + FF80 (FF80 = -80) (xxxx) + FF81 (FF81 = -7F) (xxxx) + FF82 (FF82 = -7E) Address displacement equals yy ...:" !\. , ,.L"'-- yy can be added, as a signed binary number, ~ to xxxx, to address program relative page IVY xxx-1 xxxx xxxx + 1 (xxxx) + 70 (xxxx) + 7E (xxxx) + 7F \ Remember. in microcomputer applications, program relative direct addressing is fine for Jump instructions, but is of limited value when accessing data memory. When a microcomputer program is stored in read-only memory, program relative. direct addressing can be used to read constant data only. Nova instructions that specify direct, indexed addressing, compute the effective memory address as the contents of either AC2 or AC3, plus the 8-bit displacement provided by the instruction object code. The 8-bit dis- 19-5 placement is treated as a signed binary number. Since the Index registers are 16 bits ·wide. direct indexed addressing allows you to address any memory word. This may be illustrated as follows: Accumulator AC2 or AC3 1514 1312 11 10 9 8 7 6 5 4 3 2 1 0 ~Bit No. Ixlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxl Instruction Code e x x x x x x x x x x x x x x x x Z L--_ _ _ _ _ _.... Z Z Z Z Z Z Z Y Y y y y y y y Sum is the effective memory. address 0 selects AC2 1 selects AC3 Indirect addressing may be superimposed on any of the memory addressing options described thus far. Indirect addressing is identified by a "1" in bit 10 of the Memory Reference instruction's object code. When indirect addressing is specified. the effective memory address is the contents of the directly addressed memory word. NOVA DIRECT MEMORY ADDRESSING Let us examine the various indirect addressing options. First there is page zero indirect addressing: NOVA INDIRECT PAGE ZERO ADDRESSING 3 2 8 o ____ Bit No. ~~~~~~~~-r~~~~~ '-------+-------- Page Zero ' - - - - - - - - 1 - - - - - - - - Indirect addressing Arbitrary Memory 1M~O~ 1:0001 0002 0003 ! i 0024 1------1 0025 1236 0026 .......-------~ 0027 1-------1 0030 1235 1-------1 1236 1237 1------1 1240 In the illustration above. arbitrary. real memory addresses have been selected to make the illustration easier to understand. 19-6 NO~A Program relative. indirect addressing may be illustrated as follows: INDIRECT PRO~RAM RELATIV~ ADDRESSING cw 2 ~ a: oa.. a: o o ~ 1216 u) w l- e( g ~----------~~____ ~55 126B This instruction fetched from this en en ~---------------Iooirect e( all w Z _ _....... ' -_ _ _ _ _ _ _ _ _ _ _ _ _ Program r81ative MEMORY Arbitrary Memory Address· a: o !Xl 1215 1216 1217 1220 1221 1222 en o ~ e( c e( @ 736~ 126A 126B 126C 1260 126E 12GF 1270 7362 7363 7364 7365 7366 7367 7370 7371 7372 19-7 NOVA INDIRECT INDEXED ADDRESSING Indirect. indexed addressing may be illustrated as follows: I Accumulator AC2 15 14 13121110 9 8 7 6· 5 4 3 2 1 O~BitNo. lololololololqol1lolololqQQQ Instruction Code 02BF ' - - - - - - -....-0020 02BC ' - - - - - - - - - - - - - - I n d e x via AC2 '----------------Indirect " Arbitrary Memory Address MEMORY 02B~ 02BB 02BC 0280 02BE 02BF 7364 .1 7362 7363 7364 7365 7366 7370 The illustration above arbitrarily uses indexed addressing via Accumulator AC2. Also the comput~d effective memory address is identical to that which was obtained in the indireCt. program relative addressing illustration. Observe that Nova indirect addressing logic results in pre-indexed indirect addressing. As described in Volume 1. Chapter 6. this is less desirable than post-indexed indirect addressing . . ·19~8 If. and only if indirect addressing has been specified by a "1" in bit 10 of a Memory Reference instruction's object code. then the contents of the data fetched from memory are treated as a direct address. providing the high-order bit of the direct address is O. If the high-order bit of the address is 1. then the address is treated as another indirect address pointer. This may be illustrated as follows: NOVA MULTIPLE INDIRECT ADDRESSING c w !ia: o 11. a: u o EffectiVe. indirect ,nemory addresS ~ rn !i w g CI) CI) ct Interpret as. m~IOm:IOI=V:addresa==-======~:==O----=~-1l:==::::1 Interpret as. memory addraa .- ~ w Z a: oaJ CI) o ~ ct C ct @ ~lo...I_...I...,.t...,.,,.1.''..0 .·. .· .1..·.1.....·1........1.·..I·_· ..I.......-!'I-------------.....--~ ~ ......... ~~~ ~~ Il11erpret as last memory address Note carefully that multilevel indirect addressing will occur only when indirect addressing is specified in the first place. If you execute a direct memory reference instruction. data will never be interpreted as an address. The Nova indirect addressing logic means that. given a 16-bit indirect address. only 15 bits actually address memory: therefore you are limited to a 32.768 word memory address space: 1.5 1'- 13 12 11 10 9 8 7 6 .5 ~ 3 2 1 0 ~BitNo. I I I I I I I I I I I I >t--~MemoryAdcha y. O-dirlc:t . . . . . 1 - incInIct ..... The Nova minicomputers and microcomputers also provide indirect addressing with auto-increment and autodecrement addressing. If you indirectly address one of the eight memory locations. 001 016 throug~ 001716. then the contents of the addressed memory location are incremented at the beginning of the memory access~ Thus you have indirect addressing with auto-increment. If you indirectly address anyone of the locations. 001816 through 001 F16 then the contents of the addressed memory location will be decremented at the beginning of the memory access. Thus you have indirect addressing with autodecrement. Neither the MicroNova nor the 9440 provide memory mapping logic. Memory mapping is a technique whereby more than 32.768 words of addressable memory may be accessed. The Nova 3 minicomputer is capable of supporting memory mapping as an option. Nova minicomputers have separate memory and I/O device spaces. I/O instructions include six bits which identify one of 64 I/O devices. Because Nova minicomputers and microcomputers treat I/O devices in a manner that differs significantly from the typical microcomputer. we will defer our discussion of I/O addressing until we have looked at pins. signals and System Busses. 19-9 NOVA I/O DEVICE ADDRESSING NOVA STATUS FLAGS Nova minicomputers contain just one status flag, as we would define it, and that is the Carry status. Instn.ictions are able to test for a zero or nonzero condition occurring at the conclusion of an instruction's execution, but no permanent zero status flag exists. MicroNova also has these interrupt related status flags: • • • • Interrupt Enable Real Time Clock Enable Real Time Clock Request Stack Overflow Request } MicroNova Only The interrupt related status flags do not occur as addressable locations in any Status register; rather they represent flipflops which are set or reset during the course of interrupt handling.' The interrupt enable bit is a master enable which is set to 1 in order to enable all interrupts. Specific instructions allow all interrupts to be enabled or disabled. The MicroNova has a Real Time Clock interrupt enable bit and a Real Time Clock request bit. The Real Time Clock enable bit must be set to 1 in order to enable Real Time Clock interrupts; as soon as a Real Time Clock interrupt occurs. the Real Time Clock enable bit and the Real Time Clock request bit are reset to O. The Stack Overflow request bit is only present in the Microf'Jova. since only the MicroNova has a Stack. A Stack overflow condition occurs if. following a push operation. the incremented contents of the Stack register have zeros in the eight low-order bits. What this implies is that the Stack must reside within a 256-word memory page: Arbitrary Memory IM~ORY I Mdffi'_ 0800 : 0801 0802 0803 . . SE;L.", '. t:::j.:::~ • .',' i : ~ ::~ Pushes that increment Stack Pointer from XXFF to XYOO will cause a Stack . ,?v~/ow interrupt 09FF~~ OAOO~ OAOl OA02 When a Stack overflow occurs. the Stack Overflow request bit is set to 1 and an' interrupt is requested. MICRONOVA AND 9440 CPU PINS AND SIGNALS As we stated earlier in this chapter, minicomputer Central Processing Units are implemented on cards, not DIPs; therefore they usually have System Busses containi'lg more than 40 signals. The standard Nova System I/O Bus contains 47 signals; furthermore, the Nova System Bus is, in effect, two busses: one communicating with memory, while a separate and distinct bus comm~nicates with I/O devices: . MEMOFW NOVA sus I/O'S US cpu It I/O DEVICES AND MEMORY EXTERNAL LOGIC 19-10 Table 19-1 briefly defines the functions of bus signals. The 1/0 Bus is standard for all Nova line computers, while the Memory Bus is different for each model. We give the Memory Bus signals of the Nova 2 in Table 19-1, Table 19-1, Nova System Bus Signals STANDARD NOVA SYSTEM IjO BUS c w ~ IX: oa.. SIGNAL DIRECTION DsO-Ds5 To Device Bidirectional DATAO - DArAi5 IX: DATOA U DATI A DATOB DATIB To De~ice To Device To Device To Device DATOC DATIC STRT To Device To Device To Device CL,R 10PLS To Device To Device To Proi:e~sor To Processor To Device To Processor To DeVice To Device To Device To Processor To Device To Device To Processor o ~ enw l- e( (3 oen en e( oil w Z IX: o III en o ::!: e( c e( @ SeLB SIT5 i«iENB iNTR iNi'P INTA MSK5 DcHR 5CHP DcHA DCHMO,DCHM 1 FUNCTION OR INDICATION Device selection pata Data Data Data Data and address lines out to device's A buffer in from device's A buffer out to device's B buffer in from device's B buffer Data out to device's C buffer Data in from device's t: buffer Start device-clear Done flag, set Busy flag and clear device's INT REO flip-flop aear device's Busy and Done flags and INT REO flip-flop I/O Pulse - user-defined function Selec~ed device's Busy flag is set Selected device's Done flag is set Enable i~terrupt or DMA requests !nte~pt request Interrup~ pri,ority Interrupt acknowledge Interrupt mask out Data channel request (DMA request) Data channel priority Data channel acknowledge Data channel mode: DCHMO 1 1 0 0 To To To To D<;HI DCHO OVFlO 10RST Device Device Device Device DcHMi 1 0 1 0 Data out Increment memory Data in Add to memory Data channel in Data channel out ' oVerflow: result of memory increment or add exceeds FFFF '. aear all i/o devices THE NOVA 2 MEMORY BUS SIGNAL' DIRECTION AO-A14 DATAO - DATA15 INHIBIT SELECT BMEMEN WRITE BRMW WE SYNC ENABLE RELOAD DISABLE WAIT MEM CLOCK EXTERNAL SELECT EXTERNAL MBLD To ~emory Bidirectional To Memory To Memory To Memory To MemorY To Memory To Processor To Memory To CPU To Memory To Memory To Memory RJNCTION OR INDICATION Memory address lines Memory data)!nes Inhibits selection of memory modiJle Starts memory cycle Memory write Causes pause between read and write Enable write after pause in read-pause-write cycle CPU hold control Inhibits loading of memory buffer Disables other memory modules during write portion of memory cycle Memory Clock Allows module to be selected despite contents of address lines Allows data to be stored in memory buffer without starting a memory cycle If you are using the MicroNova or 9440 in a new product. then there is no reason why you should create the standard Nova System Busses, Providing the signals generated by the MicroNova or the 9440 are adequate for your needs, you can interface external logic directly to these two devices, Let us first look at the MicroNova pins and signals, which are illustrated in Figure 19-2. Two clock signals, <1>1 and <1>2, must be input to synchronize all MicroNova logic. 19-11 The Memory Bus consists of a 16-bit Address/Data Bus, plus three control signals: SAE, P and WE. MICRONOVA MEMORY BUS The Address/Data Bus connects to pins MBa ~ MB15. P is a synchronization signal. SAE is a read enable and WE is a write enable. The I/O Bus consists of just four signals: MICRONOVA I/O BUS 110 CLOCK synchronizes I/O transfers. 110 DATAl and 110 DATA2 are bidirectional data and control signals. -:-:-::~~~ 110 INPUT identifies ,1e direction of data transfers occurring via 110 DATAl and 110 DATA2. As compared to other microcomputers described in this book. the MicroNova 110 interface is very unusual. Only the TMS 9900 I/O logic is at all similar. A l6-bit 110 data transfer occurs as two 8-bit serial units. This may be illustrated as follows: . I/O CLOCK ~~~__~I_B_IT_O~I~BI_T_1~I_B_IT_2~I_B_IT_3~1_BI_T_4~I_B_IT__5~I_B_IT_6~I_B_IT_7JI \ BIT 0 I BIT 1 I BIT 2 I BIT 3 I BIT4 I BIT 5 I BIT 6 I BIT 7 I Eight serial bits are input in less than one microsecond: therefore this method of handling 110 is as fast as the parallel data input operations described for other microcomputers. Each data transfer is preceded by one of four codes generated by levels output via 110 DATA 1 and 110 DATA2. These are the four codes: 110 DATAl 1 o a I/ODATA2 INTERPRETATION 1 Accompanying I/O low pulse may be used to synchronize interrupt requests and DMA requests. 0 1 DMA request acknowledge. 110 data transfer. The transfer direction is specified by 110 INPUT. 110 command out. a Thus every 110 operation will begin with I/O DATA 1 and 110 DATA2 being output during a low I/O CLOCK pulse. 110 INPUT will be low at this time since data is being output via 110 DATAl and 110 DATA2. Providing 110 DATAl andl70 DATA2 specify a data transfer to follow. the actual.data transfer will occur via 110 DATA 1 and 110 DATA2 with 110 IN-' PUT identifying the data transfer direction. 19-12' V BB 40 P WE 39 38 SAE DCHINT 37 36 C EXTiNr ~ a:: VGG Vss (GROUND) D. MBO w 0 a:: 0 U ~ enw Me4 13 14 ~B7 U) U) vcc c( II/J w z a:: a:a U) 10 MB6 g 8 Ms1 Ms2 Mii3 MaS ~ 7 11 12 MICRONOVA MB8 Ms9 17 18 19 MBTci 20 VDD HALT. 35 34 CLAMP 33 . 32 PAUSE <111 31 <112 30 29 i7Oi>ATA'i 28 27 26 15 16 Vss (GROUND) 25 24 23 22 21 I/O DATA2 'I/O INPUT I/O CLOCK Vss (GROUND) MiIT5 ,.. MBi4 MBi3 ' Ms12 MBi'i" 0 0 :E c( C c( @ PIN NAME DESCRIPTION TYPE <111. <112 Clock Signals MOO-Mei5' Address/Data Bus Memory Synchronization Memory 'Read Enable Input' Bidirectional Output P SAE WE I/O CLOCK I/O DATAl. I/O DATA2 I/O INPUT CLAMP HALT DcHiNr' 00iNT PAUsE VBB VDD' VGG. Vss Memory Write Enable . I/O Synchronization Data and Comrol Transfer Direction Power-Or) Reset CPU Halti!d DMA Request Extemal, Interrupt Request Memory Bus Grant Output Output Bidirectional Bidirectional Output Input Output Input Input Output Pow~~ and Ground Figure 1~-2. MicroNova CPU Signals and Pin Assignments There are two CPU control signals which are not part of either the Memory Bus or the 1/0 Bus. Following power-up, the MicroNova CPU will not perform any operation until a high' input occurs at CLAMP. When CLAMP goes high. interrupts are enabled. Real Time Clock and Stack Overflow interrupt requests are cleared. and the CPU is halted. Once CLAMPhas been input high. it is ignored until the MicroNova is powered down and then powered up again. The HALT signal is output by.. the MicroNova as a high pulse whili3'the MicroNova CPU has been, halted response to execution. of a H~ltinstruction. or following CLAMP going high. either in There are two MicroNova signals associated with interrupt logic. DMA requests are made via DCH INT while any external interrupt is requested via EXT INT. Both the DMA request and the interrupt request must be synchr~nized with instruct.ion execution timing, This synchronization is provided by I/O DATA 1 and I/O DATA2. as we have already described. :fhe. DMA acknowledge occurs via I/O DATA 1 and I/O DATA2. There is no external interrupt acknowledge signal: however. such a signal can 'be derived from the Memory Bus. as we will describe later in this chapter. iiAliSEis output low by the CPU when devices other than the CPU are permitted to access memory. Now look at 9440 pins and 'signals, which are iHustrated in Figure '19-3. These pins and signals create a single System Bus. No attempt is made to create separate Memory and 1/0 Busses. ' You may connect a crystal a,cross CP and XTL in order to create a master clock signal, or you may input a clock signal via CPO 19-13' . C3 40 MO C2 39 38 M2 Cl co DCH REO 00 'iNfREQ 01 ClK OUT CP 35 34 XTL 32 INTON GND 10 RU.N H 31 9440 30 29 28 12 13 14 IINJ ..• 37 36 33 8 Mi MR SYN MBUsY VCC GND iBf5 (low-order bit) i64 18 iB5..-t~~ 19 23 22 iBi4 iEii3 iim iB1i iBiO iB9 iB8 iB6 20 21 IB7 CA~ (high-order bit) 180 lSi 27 26 15 16 iB2 25 24 la3 .....~-. 1~ TYPE PIN NAME DescRIPTION XTl, CP Oock Signals Input SYN.. ' Syitchronization Signal ClK OUT SystelTl, COck Data/ Address Bus Memory Controls Me~orY Busy . I/O ·~ntrol . Output Output iOO -iBiS Mo-M2 MsUsY 00,01 iNT'REQ INTON "DcH REa RUN CARRY Bidirectional Output Input Output . Input Interrupt Req"uest Interrupt Enable DMA Request CPU Running . Output Input Output carry Status CO -C3 Fro~t MR Master Rase,t IINJ' VCC; GND Power and Ground Panel/Console Control Signals Output Input Input Figure 19~3. 9440 CPU Signals and Pin Assignments 9~40 generates~ s~rigie ~y~~hrOniii~9 output (SyNi. The CPU clock is output to the The system·via CLK OUT. . iBO - IB15 provides the 9440 with a~ulti~lexed 16-bit Data and Address Bus: This bus carries addresses to memory prid 1/0 de~ices, and it carries bidirectional data between the CPU and memory or 1/0 devices. iBO - iBT5 are. low true: a low Signal level represents a 1 bit. 9440 .~ SYSTEM BUS the high-order bus Ii~e while IB15 is the 10w-orderJjus line. This agrees with Nova conventions. This chapter, and t,his whole book describe the. low-order bit as bit O-exactly the reverse of IBO -IB15. TBO is There are three control signals on the 9440 CPU-memory interface. MO is output low to identify a memory read. output low to iqentify a memory write. M2 is output low to identify a memory· address being output. MT is Extern~1 memory interface logic inputs MBUSY low while it is responding to any memory access. MBUSY is similar to the WAIT signals that we have described for other microcomputers: it can be used to make the CPU wait for slow memory to respond to a CPU access request. The 9440 has two I/O control Signals 00 and 01. These two control signals define 1/0 and memory accesses as follOws: 01 01 01 01 0 0 1 1 00 00 00 00 0 Instruction Fetch 1 . Data Channel Access 0 Execute 1/0 Operation 1 No I/O 19-14 There are two signals associated with 9440 interrupt logic. An external interrupt is requested by inputting INT REO low. INT ON indicates whether or not interrupts are enabled. This signal is high when interrupts are enabled: if this signal is low. interrupts are disabled. cw A DMA request is made by inputting DCH REQ low. The DMA request is acknowledged by 01 and 00 being output low and high. respectively. . ex: o o Two of the front panel or console signals are outputs; these are the RUN and CARRY signals. ~ ex: oQ. There are seven signals provided by the 9440 specifically to support a front panel or console. iii w RUN is output high while the CPU is executing programs: it is output low while the CPU is halted. RUN is used to generate an appropriate front-panel display light: it is also equivalent to a Halt acknowledge. as described in this book for many other microcomputers. g CARRY represents the condition of the Carry status. This signal is output specifically to drive a front-panel light. ~ ~ U) U) oct CI/I w Z ex: o ED U) o ~ oct C oct @ Five input control signals are provided for switches on a front-panel. Four of these signals are CO, C1, C2 and C3; they perform the following operations: C3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C2 0 0 C1 0 0 1 1 CO 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 FUNCTION Display ACO contents at console Display AC 1 contents at console Display AC2 contents at console Display AC3 contents at console Increment Program Counter and then display contents of addressed memory word Display contents of addressed memory word Load memory from console switches Halt Deposit switches into ACO Deposit switches into AC 1 Deposit switches into AC2 Deposit switches into AC3 . Load Program Counter from console switches Continue/Run Increment Program Counter and then load memory from console switches No Operation The first 9440 devices decoded the C lines in a slightly different manner. The following combinations were different operations: C3 C2 C1 CO FUNCTION 0 0 0 1 1 0 1 Load memory from console switches 1 0 Continue/Run 1 0 Load Program Counter from console switches 0 Not used MR is the Reset input to the 9440. When this line is pulled low: the 9440 halts immediately and clears the Interrupt Enable flip-flop. Once MR goes high. the CPU will remain in the Halt state until it receives the "Run" command from lines C3- CO. 19-15 Data Output To De~tination Inhibit da, ta output t Second source T ' oPtio~' fr1 __~an:d~d:es:tin:a:tio:n__~~r-~~~---,~~Da~ta~o~u~tP~ut~.~r--~~----1-~~D~at~a~ou~tP~u~lt~,r----~~--~ ( t-",~_r~ ACO Arithmetic ' Shifter Test .. Data and ... and ACI " r First source for Byte Swap Boolean ... AC2 ~ ~ AC3 ,--------~ Logic Logic Skip r Program Counter 'I t Test Carry Carry Status Logic for Skip T 1 r----f.:-:.::=;:::::=~=::._::.:.._=:::=::::_.::_.:::_ :~.::::.:_===:_:::.:_-=~_L_________J .-J-.-J-...-,-~-1- ! ...-l-, 151 .. 1312 1110 8 7 6 5 .. 3 2 1 0 _ B i t No. 11\ I I I I I I I I I I I I I I I l't_________________________________ Arithmetic And logic Instruction Code Figure 19-4. The Nova Arithmetic and Logic Unit 1514 13 12 11 10 9 8 7 6 5 " 3 2 1 0 ~Bit No. Ills SiD DITITITIH Hie elLIKIKIK Arithmetic/Logic instruction L·OOON',"' 001 Always skip 010 Skip if Carry is Zero 011 Skip if Carry is One 100 Skip on Zero result 101 Skip on nonzero result 110 Skip on either Carry or result zero 111 Skip on Carry and result both nonzero o Store result in destination Accumulator 1 Discard result L-________~~ 00 Preserve current Carry status 01 Zero Carry 10 Set Carry to 1 11 Complement current Carry These operations are performed on Carry before entering the ALU ' - - - - - - - - - - - - - 00 No operation 01 Left rotate one bit position 10 Right rotate one bit position 11 Swap bytes These operations are performed on the ALU output L.._ _ _ _ _- -_ _ _ _ _ _ _ _ _ 000 Complement 001 Twos Complement (Negate) 010 Move 011 Increment 100 Add Complement 101 Subtract 110Add 111 AND OOACO Destination Accumulator} 01 ACl ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Source Accumulator 10 AC2 llAC3 Figure 19-5. Arithmetic/Logic Instruction Object Code Interpretation 19-16 l Carry -@lstatus CPU LOGIC AND INSTRUCTION EXECUTION cw The manner in which the Nova CPU executes instructions· differs markedly from microcomputers described earlier in this book. We will therefore begin our discussion of CPU operations by Ipoking at overall CPU architecture. ~ IX: o 11. Our discussion of Nova CPU logic is tied to instruction object code bit patterns; this happens to be the simplest way of describing the Nova CPU. We will look at instructions from a programmer's perspective when we examine the Nova instruction set. o Nova instructions may be divided into these three groups: IX: CJ ~ ~ 1) 2) 3) en Let us examine each group of instructions and associated CPU logic. en w g ~ o!S w Z IX: o III en o :!! r this purp~se. I/O.devic~ 3FH~ selects a number of interrupt related instructions whose object codes are defined .in Figure 19-10. I/O device numbers 0 and 1 implement instructions illustrated in Figure , . 19-11. , You will have to add considerable logic beyond the 9440, or the MicroNova, if.Youare going to execute all I/O instructions described in Figures 19-8, 19-9, 19-10' and 19-11. The only logic provided by the CPU chips themselves support that part of the I/O operation which is exclusively internal to the cpLJ - and that is not much. The CPU will route data to or from the selected Accumulator,.if needed, and it will increment the Program Counter in response to a Skip true condition. Everything else is the responsi~ility of logic beyond the CPU chip. . o 1 2 3 4 5 6 7 8 9 10 11 12 13'14 15 ~ Information Bus line "151413121110987 . . 6 5 4 3 2 ' 1 0 " - - BitNo. I0 11 11 I xIxIx IxIxIxIxI0 I 0 I0 I0 I0 11 ~ CPU I/O instruction '--L 1011001 Divide 101101 Multipiy 0010110 Return i 0010100 Save. VYOOOOO Move to Frame Pointer yYOOOiO Move from Fra";e Pointer MicroNova only' VY01000 Move to Stack Pointer VY010l0 Move from St.ack Pointer VYOlloo'Push Accumuiaior to"1O Pop ,"'"m""'m Acc:umuhitor specification ooACO 01 ACI 10AC2 llAC3 Figure 19-11. CPU Device 1 Input/Output Instruction Object Code Interpretation A NOVA CPU SUMMARY a If you compare Nova CPU logic with microprocessors described earlier'in this book, m.im6~n of mi~icomputer characteristics become self-evident: These characteristics have important implications when we look at bus signals, interfaces and timing; therefore they must be clearly defined. Minicomputer Central Processing Units are more complex than their microprocessor counterparts. Look at the number of operations which may be performed during execption of a single Nova instruction; only the 8X300 makes any attempt ~o provide such serial logic. The microprocessor CPU architect has been severely restricted by the fact that only a limited amount of logic can be put on a chip without drastically affecting chip yield - and therefore the price of the microprocessor. When minicomputers were designed, making CPU logic more complex increased the size of the CPU card. or cards, which had some effect on eventual product price. but nothing like the microprocessor pric!:! escalations that resu It from low chip yields. . Thus unconstrained by log'ic limitations. minicompllter CPU architects also designed complexsystem busses. requiring equi~alently complex logic within I/O devices attached to the system busses. For example. consider the fact that Figure 19-5 defines 32,768 different Register-Register Operate instructions, while the instruction format in Figure 19-8 assumes an I/O System Bus that can simultaneously manipulate I/O device status while transferring data. 19-22 These are formidable burdens placed on the designer of a chip which is supposed to reproduce the Nova CPU - with the result that chip designers have elected to tackle only part of the task. Both the MicroNova and the 9440 terminate at 40-pin DIPs: their busses are. in consequence. less than the standard Nova System Busses. c 9440 TIMING AND INSTRUCTION EXECUTION w ~ a: o0. a: o (J ~ en w ~ oo (/) (/) ct ~ w Z a: o Ie (/) o We will now examine 9440 instruction timing in detail. 9440 instructions and internal logic are,timed by a master 10 MHz clock signal. Instructions are executed in machine cycles. This is the number of ~Iock periods per machine cycle: Memory read/instruction fetch 15 clock Memory write - 15 clock I/O data in - 10 clock i/o data out - 10 clock ,I;: ' periods }Depends on actual periods memory timing periods periods ) Let us begin by looking at timing for clr,!; instruction fetch or a memory read; these two machine cycles have th'e timing illustrated in FigLire 19-12. m At the end of clock period 2. the three memory control signals MO. and M2 are output with levels that identify the memory access which will be performed during the current machine cycle. For a memory read or instruction fetch. MO and M2 are output low while 1VIT remains high. ~ 9440 INSTRUCTION FETCH 9440 MEMORY READ ct ct C @ 00-01 00 for instruction fetch. 1:1 for. memory read Figure 19-12. 9440 Memory Read/Instruction Fetch Timing. An insthJction fetch and a memory read are differentiated by signals 00 .and 01: these signals are both low for an instru'ction fetch and both high for a memory read. The address of the memory location to be accessed is output on the Information Bus (lBO - iBl5) beginning at the end of clock period 8. At the end of clock period 9 SYN is output low: externallogic must use the high-to-Iow transition of SYN as a strobe to latch an address off the Information Bus. External logic must also use the high-to-Iow transition of SYN as a trigger to input MBUSY low to the 9440. MBUSY must be input low until addressed data has been read from memory and is stable on the Information Bus. At that time MBUSY goes high again. When MBUSY goes high. the 9440 will read data off the Infotmation Bus. If the Memory Read machine cycle is to execute in the minimum 15 clock periods. then MBUSY must 6e low for one clock period only. MBUSY is a signal used by external memory interface logic to synchronize itself with the CPU. If MBUSY is low while SYN is high. early in any memory access machine cycle. then the high-to-Iow transition of SYN will be delayed until 19-23 MBUSY goes high. For a Memory Read or Instruction Fetch machine cycle. the trailing edge of the low Kii'BO'S'Y pulse also acts as an end-of-machine-cycle trigger. Three clock periods after ~ low-to-high transition. the machine cycle ends and 'S'YN goes high again. Here is an example ofMBUSY and"SYfiJ interaction during termination of a Memory Read or Instruction Fetch machine cycle: 10 11 N N+1 N+2 IN+31 MBUSY and SYN interaction at the high-to-Iow SYN transition may be illustrated as follows: CP Figure 19-13, 9440 Memory Write Timing Every instruction's execution will begin with :an instruction fetch mathine cycle. This machine cycle will be followed by internal operations, another memory read, a memory write, an I/O read, or an I/O write. If the instruction to be executed requires internal operations only, that Is. it isan arithmeticilogic instruction. then internal operations are executed during clock periods 1 through 8 of the next machine cycle - which must be another i nstructi,on fetch machine cycle. 19-24 If a memory read operation is to be performed, then another machine cycle is executed, exactly equivalent to Figure 19-12. c w ~ a: oc.. a: o(.) ~ enw I- ct g CI) .~ olJ w Z a: o a::J CI) o ~ ct ct C @ If a memory write is to be performed, then two machine cycles must follow the instruction fetch. During the first machine cycle the external memory address is output. During the second machine cycle data to be written to memory is output. Timing is illustrated in Figure 19-13. This figure is self-evident. During the first machine cycle only M2is low since a memory address is being output without a read or a write operation occurring during the same machine cycle. During the second machine cycle only MT is output low since a memory write operation alone will occur. During both machine cycles of a Memory Write operation. M'i3LmV acts as a synchronizing Signal. however only the high-to-Iow transition of MBUSY can modify instruction execution time. IflViB'ImV is low prior to SYN" making its highto-low transition. then the SYN high-to-Iow transition will be delayed until"'fiii'Im'SY goes high. Once SYN goes low. the processor waits for MBUSY to go low: three clock periods after the MBUSY high-to"low transition. the memory write machine cycle will end. The subsequent low-to-high transition of MBUSY has no effect on the SYN signal. or on internal CPU operations. The only memory addressing modes that change instruction execution time are indirect addressing and indirect addressing with auto-increment or auto-decrement. Each level of indirect addressing is equivalent to an additional memory read and an additional memory write. In order to compute instruction execution times for memory references with indirect addressing. therefore. add one memory read machine cycle and one memory write machine cycle for each level of indirection. Recall that memory locations 1016 through 1F16 are used to store addresses which. when accessed indirectly. will be incremented or decremented. When you use indirect addressing and specify a memory location from 1016 through 1716. the address fetched from the specified location will be incremented. An indirect address fetched from locations 1816 through 1F16 will be decremented. The increment or decrement operation requires the memory address to be loaded into the CPU. incremented or decremented. then written back out. Loading the address into the CPU is a routine part of any indirect addressing sequence: however. writing the address back out represents an additional step requiring an additional memory write machine cycle. This may be illustrated as follows: Machine Cycle l' Instruction fetch Machine Cycle 2 Fetch address from location 1016 - 1F16 Machine Cycle 3 Machine Cycle 4 Increment or . Perform memory decrement access address and (read or write) write add ress back ~ Memory Write The increment or decrement and Skip-if-Zero instructions require an instruction fetch, a memory read and a memory write machine cycle. Timing may be illustrated for direct memory addressing as follows: Machine Cycle 1 Instruction fetch Machine Cycle 2 Fetch data from memory Machine Cycle 3 Machine Cycle 4Increment or Increment decrement data Program Counter and write if needed data back ~ Memory Write Let us now look at I/O instruction execution. There are no special I/O device select or control signals output by the 9440, rather external I/O devices must have select logic which is created by decoding instruction object codes on the Information Bus. This is done by decoding the three high-order Information Bus lines during an instruction fetch. as characterized by 00 and 01 both low. The three high-order Information Bus lines will at this time be 011 if the instruction to be executed is an 1/0 instruction. If these conditions are met. then the six low-order Information Bus lines must be decoded by device select logic. If the device code is 3F16. then all 1/0 devices must be selected simultaneously: for this to occur a special overriding device select signal must be created in response to device code 3F. If device code 0016 occurs. then no device shou Id be selected: this requires no special select logic. rather it means that no external device should have the address 0016. If any device code other than 0016. or 3F16 appears on the six low-order Information Bus lines. then one external device's select logic should go true. If device code 3F16 has been output. then one of the operations defined by Figure 19-10 is ~bout to occur. A significant amount of external logic associated with execution of these instructions may be required. A specific implementation 19-25 consistent with standard Nova 1200 I/O interface logic is given later in this chapter. Alternatively. you may create a variety of individual control signals unrelated to the standard Nova I/O bus by suitably decoding I/O instruction object code bits 10 through 6. An I/O instruction whkh identifies a specific device further identifies the I/O operations which are to occur. via bits 10 through 6 of the instruction object code (Information Bus lines TB5 through 'iErn). Figures 19-8 and 19-9 show the I/O operations which may be specified. If data is to be input or output, then timing will conform to Figures 19-14 and 19-15. But a significant amount of parallel control logic will accompany any I/O da'ta transfer. An I/O Skip on Busy or Done instruction. as illustrated in Figure 19-9. requires the addressed I/O device to return Busy and Done statuses to the CPU. The addressed I/O device returns these statuses on the two high-order Information Bus lines i"BO and iBT. respectively. with timing conforming to Figure 19-14. I I I I I I •I I I 2 3 4 I 5 I 7 I I 8 I I 9 110 11 III 2 3 I I I 01 180-1815 I/O Data In .1 MO-M:!\ .1 CPU reads data Figure 19-14. 9440 I/O Data Input Timing 01 180 -1815 I I ' I. I I Figure 19-15. 9440 I/O Data Output Timing 19-26 ·1 MICRONOVA AND 9440 INTERRUPT PROCESSING At the most elementary level, the MicroNova and the 9440 respond to interrupts in a very simple way. External logic requests an interrupt by inputting a low signal via ~. ffi ~ ~ ~ o Providing interrupts are enabled, the CPU acknowledges the interrupt upon completing execution of the current instruction; the CPU disables its own interrupt logic, saves the Program Counter contents in memory location 0000, then jumps indirect via location 0001. Thus memory location 0001 must contain the address of the first interrupt service routine instruction. o ~ ui w Return address following interrupt service ~ Starting address for interrupt service routine xxx x + 1 0000 YYYY 0001 0002 g ~----I ~ I---~ o1J I---~ en en w en Interrupt acknowledged here ~ This instruction will be executed following interrupt service , o ~ c ~ @ , Interrupt service routine starts here 0005 r ~ ·· .. • Z a: o III 0004 =XXXX-l xxx x xxxx + 1 xxxx + 2 xxxx + 3 , ~,.·YYYY-l YYYY yyyy+l YYYY + 2 A single interrupt service routine will be executed in response to any external interrupt. In order to discriminate between interrupts. the interr-upt service routine must identify the source of the interrupt. then jump to an appropriate individual program. This may be illustrated as follows: yyyy Initial In}errupt Service Routine I I t 1 Device 1 Interrupt Service Routine Device 3 Interrupt Service Routine Device 2 Interrupt Service Routine Device 4 Interrupt Service Routine I " t· t Return ,19-27 Device 5 Interrupt Service Routine etc ... There will be a separate device interrupt service routine for every I/O device capable of representing an interrupt. There are many ways in which the initial interrupt service routine may identify the interrupting I/O device in a multiple interrupt configuration. The most primitive method used to identify an interrupting I/O device is to·test the device's Done status. Standard Nova protocol requires an I/O device to request an interrupt when it sets its Done status. This may be illustrated as follows: . Interrupt Reque?t False False True Busy Done 0 0 Device idle 1 0 Start I/O operation 0 1 End I/O operation Primitive I/O device interface logic will request an interrupt by applying a low signal at INT REO when it sets its Done status high. Now the initial interrupt service routine will execute a sequence of "Skip on Done False" instructions in order to identify the highest priority interrupting device. This may be illustrated as follows: Done =0 SKPDZ DEVI JMP IDEVI SKPDZ DEV2 JMP IDEV2 SKPDZ DEV3 Jump to Device 1 Interrupt routine Done =0 Jump to Device 2 Interrupt routine Done =0 etc etc. The order in which the initial interrupt service routine program logic tests device Done statuses becomes interrupt priority. You can modify this priority sequence at any time simply by changing the program. A faster method of identifying an interrupting device is to daisy chain the interrupting devices. Daisy chain logic has been described in Volume 1. and again in Chapter 6 of this book (in conjunction with the 8048). Daisy chains are resolved by an interrupt acknowledge signal: but there is no interrupt acknowledge signal output by the MicroNova or 19-28 the 9440; rather an interrupt acknowledge instruction is executed. This is an I/O instruction addressing device 3F16; bits 10 through 6 (lB5 through IB9) of the instruction object code must be decoded in order to create an interrupt acknowledge signal. Here is appropriate logic: c 00 !ia:: 01 w iiiiO lim iim 0 Q. a:: 0 u iim iBi4 ~ enw iiIT5 I- Q 0 c( g iB5 iB6 iB7 (I) (I) c( INTA CK o!I w Z ClR a:: 0 co (I) 0 SYN ~ MBUsY c( c c( @ Recall that the Information Bus is low true; that is. a low logic level represents a bit value of 1: To ensure that INTA is generated only when a valid instruction code is on the Information Bus. it should be qualified by SYN low and MBUSY low-to-high transition. This is illustrated in Figu re 19-16. The highest priority interrupting device identifies itself by placing its device code on the Information Bus lines. The CPU stores the device number in one of the four Accumulators. Thus the interrupt acknowledge instruction is an I/O Data In instruction. Interrupt acknowledge timing is illustrated in Figure 19-16. Interrupt enable and disable logic exists separately at the CPU and at external I/O devices. At the CPU all interrupts are disabled as soon as an interrupt is detected. You can disable interrupts at any other time by executing a disable interrupt instruction (NIOC CPU). In order to enable interrupts you must execute an interrupt enable instruction (NIOS CPU); when an NIOS CPU instruction is executed, interrupts are enabled following execution of the next instruction. This next instruction will usually be a Return instruction: NIOS JMP CPU @O ;Enable interrupts ;Return from interrupt service routine ;Interrupts are now enabled When nested interrupts are not allowed, all interrupts are disabled following the interrupt detection; interrupts remain disabled until the end of the interrupt service routine. You terminate the interrupt service routine with the two instructions illustrated above; one re-enables interrupts, the other returns from the interrupt service routine. Interrupts are not actually re-enabled until after the Return instruction has been executed; this prevents pending interrupts from being acknowledged before you have finally exited the current interrupt service routine. 19-29 Machine Cycle 1 Interrupt Acknowledge' Instruction Fetch Machine Cycle.2 Oilta In MO Mf\. M2 cp w 01 0 00 180 - 'iBiS SYN MsUsY INTA , Figure 19~ 16, 9440 Interrupt Acknowledge Instruction Execution Timing If you want to nest interrupts then you must execute an interrupt enable instruction within the interruptable interrupt service routine. But make sure that you do not re-enable interrupts until the initial interrupt service routine has executed; remember. the. initial interrupt service routine is determining the source of the interrupt - and it makes no sense to allow another interrupt to occur until this determination has been completed. . c w ~ a: o Il.. a: o (.) ~ en w ~ U o (I) (I) ~ You can disable interrupts selectively at external devices that have local interrupt disable logic. This is done using the Mask Out instruction (MSKO); MSKO is another I/O instruction addressing device 3F16. The MSKO instruction outputs data from one of the CPU Accumulators onto the Information Bus. Every I/O device capable of having its interrupt logic disabled must be connected to one of the Information Bus lines. When the MSKO instruction is executed. the I/O device must first decode the~SKO instruction in order to activate its interrupt disable logic;. subsequently. if the Information Bus line to which device interrupt disable logic is connected is low. then interrupt request logic must be disabled locally. Timing is illustrated in Figure 19-17. In order to re-enable interrupts at any external device you output a new mask with a high level on the Information Bus line to which the device's interrupt disable logic is connected. Interrupt logic again demonstrates the minicomputer emphasis of the Nova. We have assumed that an external device capable of requesting interrupts can decode I/O instruction object codes on the Information Bus and have a considerable amount of logic associated with Busy. Done and Interrupt request flags. ~ w Z a: o Machine Cycle 1 Mask Out Instruction Fetch Machine Cycle 2 O.t. Out III (I) o ~ ~ c ~ @ 01 00 MSKO I_....,.._.....--t_-I-_-+---+_......_ ...--+_-;-_ _--..J I I I I o sable interrupt il iii line is low (1) Enable interrupt if iii line is high (0) Figure 19-17. 9440 Mask Out Instruction Execution Timing MICRONOVA AND 9440 DIRECT . 'MEMORY ACCESS LOGIC MicroNova and 9440 direct memory access logic differ markedly. In both cases external logic represents a DMA access by inputting a low signal via DCH REO. The MicroNova responds by acknowledging the DMA request. This is done by outputting a high-:-I/7::0::-:=:'D"':'"A~T"':'"A"::"1 with a low I/O DATA2 signal. External logic then identifies the direction of the data transfer via the I/O INPUT control signal. Subsequently. MicroNova logic performs the entire DMA transfer by creating appropriate I/O Bus and Memory Bus signal sequences - but only data may be transferred in only one direction. 19-31 The '9440 has a more primitive DMA capability. It responds to DCH INT by outputting lines 01 and 00 low and high. respectively. and floating the Data Bus. External logic must implement the actual DMA transfer. Standard Nova protocol allows four DMA operations to be defined by external logic via the DCHMO and DCHM 1 1/0 bus signals. These are the four DMA operations that may be defined: DCHMO DCHM1 o o 0 1 1 0 1 1 Add to memory Data in Increment memory Data out The MicroNova. as we have already stated. handles data in and data out only; increment memory and add to memory are not available.. The 9440 on the other hand. does nothing in response to a DMA request other than float the Information Bus. All external logic associated ~ith DMA operations must exist outside the 9440 chip. THE MICRONOVA AND 9440 INSTRUCTION SETS Table 19-2 summarizes the instruction sets for the MicroNova and the 9440. Observe that there are some instructions available with MicroNova that the 9440 lacks. The power of the Nova instruction set is derived from the fact that many instructions perform multiple operations. Register Operate instructions. for example. allow you to set. or reset or complement a Carry status before the specified operation is performed. Primary Memory Reference and Register Operate instructions allow you to also perform data shifts. or to swap the high and low-order bytes of the data word being moved or generated. Primary Memory Reference and Register Operate instructions also allow you to perform a conditional skip based on the resu Its of the operation. . It is the ability of the Nova instruction set to perform a combination of operations. during a single instruction's execution. that makes the instruction set so effective. THE BENCHMARK PROGRAM Our benchmark program may be illustrated as follows for the MicroNova and the 9440: LOOP LDA LDA STA LDA STA LDA STA INC JMP LDA STA 2.CNT O.IOBUF 0.10 O.@TABLE 0.11 0.@10 0.@11 2.2.SZR LOOP 0.21 O.@TABLE LOAD WORD COUNT COMPLEMENT INTO AC2 LOAD 10BUF BASE ADDRESS INTO AUTOINCREMENT LOCATION LOAD ADDRESS OF FIRST FREE TABLE WORD INTO AUTO-INCREMENT LOCATION LOAD NEXT BYTE FROM 10BUF STORE IN NEXT TABLE WORD INCREMENT WORD COUNT SKIP IF ZERO RETURN FOR MORE RETURN NEW ADDRESS OF FIRST FREE TABLE WORD This benchmark program uses indirect addressing with auto-incrementing in order to sequentially access 10BUF and TABLE. We begin the program by loading the word count (CNT) into Accumulator 2. and table base addresses into memory words 1016 and 1116. We assume. that the address of the first free word in TABLE is stored in the first word of TABLE; thus we can fetCh the address of the first free TABLE word by executing a load to Register 0 with indirect addressing. Data is moved by a four-instruction loop. Two instructions load data from 10BUF and store data in TABLE using indirect addressing with auto-increment. Next we increment the counter stored in Register 2 and skip the following instruction upon detecting a zero count. The following instruction is a jump back to the beginning of the loop. The final two instructions simply restore the new address for the first free TABLE word into the first word of the TABLE. The benchmark program makes no assumptions. The source and destination tables may be any size and any number of data words may be transferred. limited only by the available memory space. 19-32 The following notation is used in Table 19-2. An "X" in the column labeled "9440" indicates that the instruction is available on the 9440 CPU. c w ~ a:: 0 0. a:: 0 CJ ~ enw I- ct g en en ct CIlI w za:: 0 III en AC ACX C D DEV DEVX DEVBD EA FP ION PC PM S SP (CS#) 0 ::!: ct ct c @ (f) Any of the four Accumulators. A specific Accumulator. For example. AC1 is Accumulator 1. Carry status An Accumulator which serves as the destination for the results of an operation. A 6-bit device code. A specific device register. For example. DEVA is Device Register A. Device Busy-Done flags. Effective address determined by @DISP CiX ). Frame Pointer (not present in 9440). Interrupt ON flag Program Counter Priority Mask An Accumulator which serves as the source of an operand. Stack Pointer (not present in 9440). Represents three options which are used by the Register-Register operations. C is a 2-bit field which determines the carry state prior to the ALU operation. Coded Character Result Bits Operation option omitted 00 No operation Z 01 Set carry to 0 o 10 Set carry to 1 C 11 Complement carry For example. ADDO 2.2 would set carry to 1 before adding AC2 to AC2. S is a 2-bit field which determines how the result of the ALU will be shifted. Coded Character Result Bits Operation 00 No shift option omitted 01 Shift result and carry left L cine bit R 10 Shift resu It and carry right one bit S 11 Swap result bytes For example. MOVS 1.2 would swap the bytes of AC1 and store into AC2. # is a 1-bit field which determines whether the result is stored in ACD. Coded Character Result Bits Operation 0 Load result into ACD option omitted # 1 Do not load result into ACD For example. NEGOL#.1.2 would set carry to 1 then negate AC1. shift the result and carry left one bit. but would not store into AC2. A 2-bit I/O command whose meaning depends on whether the CPU or another device is being referenced. CPU f~ No operation 00 No operation Set Interrupt 01 Start device by setting Busy to 1 On to 1 and Done to 0 Set Interrupt 10 Id Ie device by setting Busy to 0 On to 0 and Done to 0 No operation 11 Pulse a special device dependent line 19-33 tSKCND) A 3-bit skip-on-condition field which is used by the Register-Register Operate instructioris. Coded Character option omitted SKP SZC SNZ SZR SNR SEZ SBN Result Bits 000 001 010 011 100 101 110 111 Operation No operation Always skip Skip if Carry = 0 Skip if Carry = 1 Skip if resu It = 0 Skip if result =t= 0 Skip if either carry or result = 0 Skip if both carry and result =t= 0 (@ ) DISP (.IX) Generates the address EA @ is the indirect bit. If @=1 then indirection is specified. DISP is an 8-bit address value. (IX) is a 2-bit field which indicates the addressing Mode: Bits are Mode 00 Zero page addressing. DISP is an unsigned address betwe~n 0 and 256. EA = DISP 01 PC relative addressing. DISP is a signed two's compiement address displacement. EA = DISP+[ PC] 10 Indexed addressing via AC2. DISP is a signed two's complement address displacement. EA = DISP+ [ AC2] 11 Indexed addressing via AC3. DISP is a signed two's complement address displacement. EA = DISP+ [AC3] (t) A 2-bit I/O test field whose meaning depends on whether the CPU or another device is referenced. CPU 1. b~Vice Test for lmerrupt On=1 60 ~r Busy=1 Test for Interrupt On=O 01 Test for Busy=O 10 Test for Done=l Never skip Always skip 11 Test for Done=O x [ ] [[ ]] A Bits y through z of the quantity x. [AC] <5.0> is the low six bits of the specified Accumulator. Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. Implied memory addressing; the contents of the memory location designated by the contents of a register. Logical AND Data is transferred in the direction of the arrow. Under the heading of STATUS in Table 19-2. anX indicates statuses which are modified in the course of the instruction's execution. If there is no X. it means that the status maintains the value it had before the instruction was executed. 19-34 © ADAM OSBORNE & ASSOCIATES,INCORPORATED Table 19-2. MicroNova and 9440 Instruction Set Summary STATUS TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED 9440 C NIO!fl DEV 2 X [DEVBD]-f DIA(f) AC.DEV 2 X Set the device's Busy and Done flags according to, I/O command. [AC]- [DEVA] [DE\(BD]-'f DIB(fl AC.DEV 2 X Read device's A buffer into Accumulator. Set the device Busy and Done flags. [AC]- [DEVB] . [DEVBD]-f DIC!f) AC.DEV 2 X Read device's B buffer into Accumulator. Set the device.Busy arid Done flags. [AC]- [DEVC] [DEVim]-f DOAlf) AC.DEV 2 X Read device's C buffer into Accumulator. Set the device Busy and Done flags . IDEVA] - [AC] [DEVBD]-f DOB(t) AC.DEV 2 X to .~ 01 g " DOC!f) AC.DEV 2 X SKPlt) DEV 2 X 10RST X Write Accumulator int,o device's A'buffer. Set the device Busy and Done flags. [DEVB]- [AC] [DEVBD]-f Write Accumulator into device's B buffer. Set·the·-device Busy and Done flags. [DEVC]- [AC] [DEVBD]-f Write the Accumulator into device's C·buffer. Set the Busy and Done flags. If T is true for DEV. [PC] - [PC] + 1 Skip if I/O test true. [PM]-O [ION1-l0. The Busy and Done flags in all I/O devices are set to O. The Priority Mask is set to 0 and interrupts are turned on. Table 19-2. MicroNova and 9440 Instruction Set Summary (Continued) STATUS 'tYPE MNEMONIC OPERAND IS) 9440' , BYTES OPERATION PERFORMED' C w »u a:a:z LOA AC,I 0) DISP (.IX) 2 X STA AC,I 0) DISP (.IX) 2 X e(Ow ~~a: ~~~a: Store contents of Accumulator into memory. ADDICS#) S,DISKCND) 2 X X [0)- [D)dS) SUBICS#) S,DI.SKCND) 2 X X Add contents of Source register to contents of Destination register. Perform the specified options. [D) - (0)- [S) X Subtract contents of Source register from contents of Destination register. Perform the specified options. [D) - [5) + 1 (twos complement) X Place twos complement of the Source register contents in the Destination register. Perform the specified options. [D)- [D)+ [5) w le( a: w a.. NEG (CS#) S,DI.SKCND) 2 X 0 a: ... III aw [AC)-:- [EA) Load contents of memory to Accumulator. [EA)- [AC) w ADC(CStl) S,DI.SKCND) 2 X w MOV(CS/I) S,DI.SKCND) 2 X X Add the ones complement of the Source register contents to contents of Destination register. Perform the specified option. [D)-[S) aw INC(CSt:) S,DI.SKCND) 2 X X Move contents of Source register to Destination register. PerforJT1 the specified options. [D)- [S)+1 COM (CS tI) S,DtSKCND) 2 X X Place incremented Source register contents into Destination register. Perform specified options. [D)-lS) X Complement the Source register contents, then move to Destination register. Perform specified options. [0)- (0) t\ [S) a: ci: IIII a: AND (CS 11) S,DI.SKCND) :2 X AND the Source register contents with the Destination register contents. Perform specified options. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 19-2. MicroNova and 9440 Instruction Set Summary (Continued) STATI,IS TYPE MNEMONIC QPERANDIS) BYTES 9440 OPERATION PERFORMED C MUl x DIV PSHA AC POPA AC SAY MTSP AC MTFP AC 2 [ACO] -(( [ACI]" [AC2))+ [ACO]) <31,16> [ACI] -II [ACl1" [AC2))+ [ACO)) <15,0> Multiply contents of ACI by contents of AC2 and add contents of ACO to result. [ACl1':"'l [ACOJ.[ACI))/[AC2] (quotient) [ACO] -I [ACOJ.[AC1])/[AC2] Iremainder) Divide the 32-bit quantity contained in ACO (high order) and AClllow order) by the contents of AC2. [SP] - [SP] + 1; [[SP)) - [AC] Push the Accumulator onto the Stack. [AC] - [[SP]; [SP] - [SP] - I Pop the top of the Stack to the Accumulator. [[SP]+ 11- [ACO] [[SP] + 2] - [AC1] [[SP] + 3] - [AC2] [[SP] + 4] - [AC3] [[SPl+5] <14,0> - [PC] [[SP] +5] <15> - [C) [SP] - [Spj + 5 [FP] - [SP] Save a return block in the Stack. [SP] - [AC] <14,0> Move the low 15 bits of the Accumulator to the Stack Pointer. [FP] - [AC) <14,0> Move the low 15 bits of the Accumulator to the Frame Pointer. Table 19-2. MicroNova and 9440 Instruction Set Summary (Continued) STATUS TYPE MNEMONIC OPERAND(S) 9440 BYTES OPERATION PERFORMED C 0w 'MFSP AC 2 MFFP AC 2 JMP (II)DISPI,IX) 2 X JSR (")DISPI.IX) 2 X [AC] <14,0> - [SP] [AC] <15>-0 Move the Stack Pointer to low 15 bits of Accumulator. [AC] <14,0> - [FP] [AC] <15>-0 Move the Frame Pointer to the Accumulator. ~;:) Oz ~~ C/)Z 0 g cp w (Xl X [PC]-[EA] Branch unconditional. [AC3] - [PC] 1 [PC]-[EA] Branch to subroutine. [SP] - [FP] [C) - ([SP)) <15> [PC] - ([SP)) <14,0> [AC3] - ([SP] - 11 [AC2] - ([sp] - 2] [ACl] - ([SP] - 3] [AC2] - [(SP] - 4] [SP] - [SP] - 5 Retum from subroutine and pop a retum block off the Stack. + RET 2 :E~ ~g RTCEN(f) 2 X (JON]-f ~o a: RTCDS(f) 2 X Enable Real Time Clock then set ION via I/O command • [ION] - f Q. :E ., ;:) w ........ Disable Real Time Clock then set ION via I/O command. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 19-2. MicroNova and 9440 Instruction Set Summary (Continued) STATUS MNEMONIC TYPE OPERAND(S) BYTES 9440 OPERATION PERFORMED C 0 ~~2~ ISZ (u)DISPI.IX) x 2. owOI- ~!;t~~ :!:ffi~o DSZ (u)DISPI.IX) 2 X u ~ 0 [EA] - [EA] + 1 If [EA] =0 then [pc] - [pc]+ 1 Increment memory contents and skip if zero. [EA] - [EA] - 1 If [EA] =0 then [pc] - [PC] + 1 Decrement memory contents and skip if zero. INTEN 2 X [ION]-l INTDS 2 X Enable interrupts. Same as NIOS CPU. [ION]-O 2 X INTA(f) AC I~ ::;) a: a: w l- ~ MSKOlf) AC HALTlf) X 2 TRAP SKPIt) .- CPU 2 X 2 X Disable interrupts. Same as NIOC CPU. [AC] <5,0> -DEV [ION] - f . The 6-bit device code of the device closest to the CPU that is requesting an interrupt is loaded into the low si~ bits of the Accumulator. Set ION via I/O command. [PM] - [AC] [ION] - f Move contents of Accumulator to Priority Mask. Set ION via I/O command. [26 ..1- [PC] [pc] - [27 .. ] Performs a software interrupt. If t is true, [PC] - (PCI + 1 If interrupt or power fail condition satisfied, skip next instruction. [IONI-f Set ION via I/O command, then halt. Table 19-3. MicroNova and 9440 Instruction Set Object Codes OBJECT CODE INSTRUCTION BYTES CLOCK PERIODS 9440 X ADC(CS#) S,DI.SKCND) 5/7 S,DI.SKCND) 1ssdd l00rrccnwww 1ssdd 11 Orrccnwww 2 ADD(CS#) 2 5/7 X AND(CS#) S,DI.SKCND) lssddlllrrccnwww 2 5/7 X COMICS#) S,DI.SKCND) 2 5/7 15 X AC,DEV 1ssddooorrccnwww 011aaOOlffpppppp 2 OlAf DIBf AC,DEV 011aaOl1ffpppppp 2 15 X DICf X X AC,DEV 011aal0lffpppppp 2 15 DIV DOAf 2 2 123 AC,DEV 7641 011aaOl0ffpppppp 10 X DOBt AC,DEV 011aa l00ffpppppp 2 10 X DOCf AC,DEV (fI)DISP(.IX) 011aall0ffpppppp 2 10 X 000 11 ixxbbbbbbbb 2 8/10· X 011aall0ffllllll 2 10 X X X DSZ HALTf INC(CSIt) S,DI.SKCND) lssddOllrrccnwww 2 INTAf INTDS AC 011aaOl1ffllllll 5/7 15 10 X 60BF 2 2 INTEN 607F 2 10 X IORST 011aa01Offllllll 2 10 X ISZ (fI;)DISP(.IX) ooo10ixxbbbbbbbb . 2 8/10· X JMP ('fI.)DISP(.IX) OOOOOixxbbbbbbbb 2 6/8· X JSR (rt) Disp I.IX) AC (.rl),DISP !.IX) 0000 1ixxbbbbbbbb 2 7/9· X 011aaixxbbbbbbbb 2 6/8· X AC 011 aaooo 100000o 1 2 8 LOA MFFP MFSP AC 011aaOl0l000000l 2 7 MOV(CSttl S,DI.SKCND) lssddO 10rrccnwww 2 MSKOf AC 011aal00ffllllll 2 5/7 10 MTFP AC 011aaOOOOOOOOOOl 2 6 6 86 X X MTSP AC 011 aaO 1 oooooooo 1 2 MUL NEG(CSt!) S,DI.SKCND) 76Cl 1ssddOO 1rrccnwww 2 2 NIOf DEV 01100000ffpppppp 2 5/7 10 POPA AC 011aaOlll000000l 2 7 PSHA RET AC 011aaOll0000000l 6581 2 2 7 15 RTCDSf 01101010ffllllll 2 10 X RTCENf 0111oo10ffllllll 6501 2 10 X 2 16 SAY X X 01100lllttpppppp 2 15/17 X SKPT DEV 01100111ttllllll 2 15/17 X STA 010aaixxbbbbbbbb 2 6/8· X SUB(CS til CPU AC,( ,,) DISP (.IX) 1ssdd 101 rrccnwww 2 5/7 X TRAP S,DI.SKCND) 1ssddqqqqqqq 1000 2 9 SKPt ·Direct addressing. For indirect addressing, add two clock periods for each level of indirection. For autoincrement or auto- decrement locations, add three clock periods, plus two for each level of indirection. The following symbols are used in Table 19-3: aa Two bits selecting an Accumulator bbbbbbbb a-bit signed two's complement address displacement cc dd ff Two bits selecting the carry option Two bits' selecting the destination Accumulator n pppppp Two bits selecting the I/O command One bit selecting indirect addressing One bit choosing the no load option Six-bit device number rr Two bits determining the shift option ss Two bits choosing the source Accumulator 19-40 tt www xx cw Two bits choosing the I/O test Three bits selecting the skip-an-condition option Two bits. selecting the index option Execution times shown are for MicroNova. Where two execution times are shown (for example, 5/7!. the second is the instruction time if the skip or branch is taken. ~ a: o0. a: o u ~ u) w ~ g CI) CI) oct ail w Z a: o CD CI) o ::!: oct oct c @ 19-41 DATA SHEETS This section contains specific electrical and timing data for the following devices: • MicroNova cw ·9440 ~ a: o n. a: o(J ~ en w ~ U oen en c( o1J w Z a: o m en o ~ c( cc( @ 19-01 MICRONOVA ABSOLUTE MAXIMUM RATINGS* Supply Voltage Range VBB to -7 Volts Supply Voltage Range VCC -0.3 to +7 Volts Supply Voltage Range VDD ...::Qd. to ~Volts -2 Supply Voltage Range VGG -0.3 to +17 Volts Input. Voltage Range VI -0.3 to + 7 Volts Input Current Range II o Operating Temperature Range T A o to +70 °c Storage Temperature Range T stg -55 to + 125°C Average Power Dissipation to _6_mAmps 1 Watt NOTES All voltages in th{s document are referenced to Vss (ground). *Subjecting a circuit to conditions either outside these limits or at these limits for an extended period of time may cause irreparable damage ·to the circuit. As such, these ratings are not intended tope used during the operation of the circuit. Operating specifications are given in the DC (STATIC) CHAR,ACTERISTICS ,TABLE. Data sheets on pages 19-02 through 19-03 reprinted by permission of Data General Corporation. 19-D2 MICRONOVA D. C. w Z a: INPUT CURRENT FOR LOW STATE IlL mAnlps o CD CI) o ~ INPUT HIGH VOLTAGE VIH Volts e( Q e( @ INPUT CURRENT FOR HIGH STATE OUTPUT LOW VOLTAGE IIH mAmps fX'fINT. I5C'Il'1NT I 0 CLOCK. I 0 DATA I. I o DATA Z a 1.3 and 02.4 Ma 0·15 I 0 CLOCK. I 0 DATA I. I 0 DATA 2 MIN. MAX. -2.0 .O.S -1.0 +1.0 -1.0 .0.S -2.0 -2.0 -4.0 +.01 -2.0 -4.0 .13.0 +15.0 +4.25 .5.8 +2.5 +5,8 -.01 ·.06 -1.0 -.02 t. XTINC • U<.H IN. VOL Volts cntrr> +.001 HALT MB 0·15 I 0 INPUT: PAtiSE. SAEG. WEG. PG .3,0 liD CLOCK OUTPUT CURRENT FOR LOW STATE 10L mAmpoi OUTPUT HIGH VOLTAGE VOH \'fllIs OUTPUT CURRENT FOR HIGH STATE LIMITS PINS UNITS 10H mAnl~ .0.4 .0.5 110 DATA I, I/O DATA 2 PG. I 0 INPUT +'.0 M8 O·U • \ o CLOCK I o DATA I •• o DATA 2 /'Am. SAEG. PG. HALT +2.0 MB 0·15 I o CLOCK. I o DATA 1.1 ODATA2· I 0 INPUT. PAUSE. SAEG. WEG. PG +4.25 HALT HALT. M8 0.15 10 INPUT. PG I 0 CLOCK. I 0 DATA I. I 0 DATA 2, PAUSE SAEG. WEG C -0. al t 3and.2,t INPUT CAPACIT ANCE CI pF ~ MB 0·15 , I o CLOCK I 0 DATA 1. I 0 DATA Z EifiTII'I'.15C'Il'1NT NOTE Logic "1" is defined as the more positive voltage as are the maximum figures given under voltage limits. Logic "0" is defined as the more negative voltage as are the minimum ligures given under voltage limits. Positive current, In the conventional sense, is denned as /lo'wing into t.he pin. On power-up. Vee must be within Its speci/led operating range (with respect to VSS) belore any 01 the other power supply voltages are appiled to the circuit. 19-03 '-.01 -.06 -.01 100 10 9440 ABSOLUTE MAXIMUM RATINGS (beyond which the useful life of the device may be impaired) Storage Temperature Ambient Temperature Under Bias Vee Pin Pot~fltial to Ground Pin Input Voltage (de) Input Current (de) Output Voltage (Output HIGH) Output Current (de) (Output LOW) Injector Current (lINJ) Injector Voltage (V INJ ) -65° to 150"C -55 to +125°C -0.5 to +6.0 V -0.5 to +5.5 V - 20 to +5 rnA -0.5 to +5.5 V +20 rnA +500 rnA -0.5 to + 1.5 V DC CHARACTERISTICS OVER OPERATING TEMPERATURE RANGE (0 to 75°C) liNJ(min) = 300 rnA. liNJ(max) = 400 rnA. Vee(min) = 4.75 V. Vee(max) = 5.25 V LIMITS' ,'; 1 CHARACTERISTIC SYMBOL MIN V,H Input HIGH Vo~~ge V,L Input LOW Voltage Veo 1.!1Put ~Iarnp Diode Voltage VOH Output HIGH Voltage RUN. CARRY. INT ON. SYN. ClK OUT. 00. 01 2.4 Q.utput-ttIGH Voltage IBo - IB 15 2.4 TYP MAx UNITS CONDI~IONS Guaranteed Input HIGH Voltage 0.8 V Guaranteed Input lOW Voltage -1.5 V Vee = 4.75 V. liN =-18 rnA IINJ = 300 rnA 3.4 V Vee = 4.75 V. 10H = -400 p.A IINJ = 300 rnA 3.4 V Vee = 4.75 V. 10H = -1.0 rnA IINJ = 300 rnA 1.0 rnA Vee = 4.75 V. VO H = 5.25 V IINJ = 300 rnA 0.25 0.5 V Vee = 4.75 V. 10L = 8.0 rnA IINJ = 300 rnA 1.0 20 p.A Vee = 5.25 V. VIN = 2.7 V IINJ = 300 rnA Input HIGH Current CP 2.0 40 p.A Vee = 5.25 V. VIN = 2.7 V IINJ = 300 rnA !!!put H..!..GH Current IBo - IB15 (3-State) 5.0 100 p.A Vee = 4.75 v. VIN= 2.7 V IINJ = 300 rnA 1.0 rnA Vee = 4.75 V. VIN = 5.5 V IINJ = 300 rnA ICEX Output leakage Mo. M1• M2 VOL 9utput lOW Voltage IIH Input HIG~ -0.9 _______ Co - C3. DCH REO. INT REO. MBSY. MR Input HIGH Current All Inputs IlL TEST V 2.0 Input lOW Current All inputs except CP -0.21 -0.36 rnA Vee = 5.25V. VIN = 0.4 V IINJ = 300 rnA Input lOW Current Cpo -0.42 -0.72 rnA Vee = 5.25 \/.. Y,N = 0.4 V IINJ = 300 rnA 100 p.A Vee = 5.25 V; Your = 2.4 V liNJ = 300 rnA -0.36 rnA Vee = 5.25 V. Your = 0.4 V IiNJ = 300 rnA -100 rnA Vee = 5.25 V~ Your = 0.0 V IINJ = 300 rnA 200 rnA Vee = 5.25 V V IINJ = 300 rnA 10ZH OFF State (Hig!!.lrnp~ance) Output Current IBo - IB 15 IOZL OFF state (Hig!l.lrnp~ance) Output Current IBo - IB 15 los Output Short Circui!....Cu~nt_ All putputs Except Mo. M1. M2 Ice Supply Current VINJ Injector Voltiige -0.21 -15 ., 150 1.0 Data sheets on pa~es 19-.04 through 19-010 reprinted by permission of Fairchild Camera and Instr~ment Corporation. 19-04 9440 AC CHARACTERISTICS: T A = 0 to 75° C - Figures 8 & 9 LlMITS-ns NOTE SYMBOL CHARACTER ISTIC tCPSYL Propa9ation Delay, CLOCK to SYN going LOW 150 ~ a: oa.. tCPSYH Propagation Delay, CLOCK to SYN going HIGH 160 b.1BSYL propagation Delay, MBSY gOing HIGH to SYN going LOW a: o o tMBW MBSY Min ~ tMBS ~et-up enw tMBHO Hold Time, MBSY HIGH after CLPCK tCPMH Propagation qelay, CLqCK to M2, Ml, Mo going HIGH 160 tCPML Propagation Del~y, CLOCK to ~2, Ml, Mo going LOW 170 tCPOH Propagation Delay, CLOCK tei ()1, 00 going HIGH 160 Fig. 9 Only tCPOL Propagation Delay, CLOCK to 91, 00 going LOW 170 Fig. 8 Only tCPAH Propagation Delay, CLOCK to ADDRESS IBo-15 going HIGH 170 ow ~ (3 o en en oCt "" w Z a: o en Pul~e Time, MIN Width ~BSY (HI~H) TYP 70 30 HIGH to CLOCK -40 60 tCPAL Propagation Delay, CLO~K to ADDRESS IBo-15 going LOW 180 o tMBAF Propagation Delay, CLOCK toADDRESS IBo-15 going 3-state 110 ~ tos Set-up Time, DATA IBo-15 to CLOQK : oc( tOHO Hold Time, DATA IBo-15 after CLOCK 130 tcs ~et-up Time, C3, C2, Cl, Co to C'LOCK -110 tCHO Hold Time, C3, C2, Cl, Co after CLOCK 130 tCPRH Propagation Delay, CLOCK to RUN HIGH 160 tCPRL Propagation Delay, CLOCK to RUN LOW tocs Set-up Time, DCH REO to CLOCK en oCt @ -110 170 -110 tOCHO Hold Time, DCH REO after CLgCK tiS Set-up Time, INT REO to CLOCK -100 tlHO Hold Time, INT REO after CLOCK 120 tCPCYH Propagation Delay, tCPCYL Propagation Delay, CLOCK to CARRY LOW 150 tCPIOH PropaQation Delay, CLOqK to INT ON HIGH 200 tCPIOL Propagation Del~y, CLOC~ MAX 130 to CARRY HIGH 160 CLOCK to INT ON LOW 190 NOTES:, , 1. The Information Bus is driven as a result of the ~revious cycle. 2. The Fetch and Read cycles will be stretched out for slower memories. 3. Applies to console operation using t~is cycle type. ' 19-05 Fig. 8 Only 9440 I" "I FETCH CYCLE o 1 1 1 1 2 1 3 1. SYNC u~ I C l K O U T . --~~. ~ --I MBSY \~ ,:<" ' ~~~"J~~-~H-+~~.I".~S~_ _ _ _-+______~ V SYN PLA I".SYL ~ "1·1 !4--ICPSYH-+l ~~\\\\~~+--ir_ll) +1-l~~~~~~~~~~~ 14- I".w-.J .1,. '''.HOI- .... -. M·--------+~-~IC-P"-H-~~~ M2------~___ --IIC-PM-L-~-~~-----------+---~-----~-~,,~-i----~----------------- ~---------1---------~,----------------~~-+----~--~--~I~.~------~-------------------OO _ _ _ _ _ O· _ _ _ _ _ _ _ ~-----~~----------_+---~-----H_~I~+_----~---------------_ICPOL-+j ~----~~----------_+--~---~--H_~I~~~~~~~-~~--------- ~~~~~~~~~~~-·~l~~---------_1~~~IC+,P ••~F!j~~E'O[S~~~~.-~'O~H!O~:J~--__- - - - - :: .1...~H-~~~I~~~~'M~ AOORESS OUT' VI/, DATA II~ OATA IN ~ iiio-" : _IC!'L~ CO-, __________ .lk.lF RUN ., __ -.',CS +_-----~------------~-------+_----~-~"~_i----~x~-----~x------~--_ICPRL--+! ';:"~ICH~ ~ICPRH~ " -- - - - - - - -- -- - - .1'. -:-7 - - . -'-!f.-:-- - - - ;107-0-=.:{ - - - - - - - - OCH REQ +-____ CARRY _____________________________________ ~~·A-~~~r_l-----~~---~--~~--- ._ICPCYL-.J ~I'HO- ." __ INTON ______________________________________________~-~"~~------~~-------~~:.~~--____~ MEMORY BUSY "tIME Fig. 8 ClK OUT I ~tcPIOH~ Fetch Cycle o - - - - - - - - - - - - - - - - - - R E A O CYCLE \ - o. \ . _ICPIOL--.j (i) ------------------.-1 I ~ PlA LILIlJlJL...rL ~ ~ I '-IMBSl ~ IMBSYL 1.- ~\\~ MBSY IMBWc+j 14- JL .1L I 1- I-- l I IMBHO I l-ICPSYH_I I- -F _ICPMH-.t "k~lePML---l Mo ~ " " .:I- 00 _lepoH_1 / O. ~tCPAH-------t -..r los ~ IMBAF:i AOORESS OUT ) %:::OATA~ iiO-15 4--tCPAL.~ -"Ies :o- -'1 9440 AC CHARACTERISTICS: TA =0 to 75°C- Figures 12, 13, 14, 15 L1MITS-ns cw SYMBOL CHARACTERISTIC tCPSVL Propagation Delay, CLOCK to SYN going LOW MIN TYP MAX 150 ~ a: oQ.. tCPSYH Propagation Delay, CLOCK to SYN going HIGH 160 tCPMH Propagation Delay, CLOCK to M2, M" Mo going HIGH 160 o tCPML Propagation Delay, CLOCK to M2, M" Mo going LOW 170 ~ tCPOH Propagation Delay, CLOCK to 0" 00 going HIGH ffiO w tCPOL Propagation Delay; CLOCK to 0" 00 gOing LOW 170 < o oC/) tCPOH Propagation Delay, CLOCK to DATA IBo-15 going HIGH 170 tCPOL Propagation Delay, CLOCK to DATA IBo-15 going LOW 180 tCPOF Propagation Delay, CLOCK to DATA IBo-15 going 3-state 110 a: u ui I- C/) < all w Z tos Set-up Time, DATA IBo-15 to CLOCK -110 o tOHO Hold Time, DATA IBo-15 after CLOCK 130 a: NOTE Fig. 12 Only Fig. 13 Only In C/) o tcs Set-up Time, C3, e2, C" Co to CLOCK ::?! tCHO Hold Time, C3, C2, C" Co after CLOCK < c < @ -110 .' Fig. 14 Only 130 NOTES: 6. During the 94~ is not driving the lines. An external device can conlrol the memory when a LOW is applied to the appropriate 7. The 9440 floats the IBo-15. The Information Bus is available to the I/O devices and the memory as needed. DCH, M 1 . . - - - - - - - - - - - I/OIN -----------~ CLKOUT SYN _ _ _ _ _~ +-___ MI ______ ~ M, ______+-___-' MO ______+-___-' OO------~___ --IC-P-Ml-~-~-------------~-------- O'-------~~---I-CP-M-H~~I ~ tos -4-tDHOj iSO'S ( DATA IN >---- Co·, RUN _________________________________________________________ i5CHREa iNTiiEa CARRY ____________________________________________________________ INTON _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ___ Flg.13 I/O In Cycle 19-D9 Mline. 9440 I __----------WAIT----------~ .. PLA ClK OUT SiN ii, ii, ----------f ---------+-------'. ________-+______ -J ~----------~-------' +-______ OO __________ ~ 0, ________________- J RUN ______________________________________________________________ DCH RE,O iii"f'iiEQ CARRy ______________________________________________________________ INTON ______________________________________________________________ Fig. 14 Wall Cycle ~-----------DCH------------------tl PLA ClK OUT SiN __________., ii, __________~~----~ ~ +-______-' iio __________+-______-' ii, __________ +-______ Oo __________ ~ +-__~----~---------------------------------------- O, __________ (l) iBo-15 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ CO_3 ______________________________________________________________ RUN ______________________________________________________________ ii'C'ii"iiEO INT REO CARRy ______________________________________________________________ INTON ______________________________________________________________ Fig. 15 Oala Channel Requell Cycle 19-010 ~ Chapter 20 ~ THE INTEL 8086 a: o CJ :!: en !iw g (/) ~ a/I ltil ~ ~ o :! ~ ~ @ The 8086 is Intel's first 16-bit microprocessor. It is significantly more powerful than any prior microprocessor. The 8086 assembly language instruction set is upward compatible with 8080A - but at the source program level only. That is to say. every 8080A assembly language instruction can be converted into one or more 8086 assembly language instructions. There is no reason why anyone would try to convert 8086 assembly language instructions. one at a time. into one or more 8080A assembly language instructions. but if you did. you would soon become hopelessly tangled in conflicting memory allocations and special translation rules. That is why we say that the 8086 and 8080A assembly language instruction sets are "upward" compatible. The 8086 and 8080A assembly language instruction sets are not compatible at the object code level. which means that 8080A programs stored in read-only memory are useless in an 8086 system. The 8085 and 8080A assembly language instruction sets are identical. with the exception of the 8085 RIM and SIM instructions. The 8085 RIM and SIM instructions cannot be translated into 8086 instructions. This is because the RIM and SIM instructions use the serial I/O logic of the 8085. which has no 8086 counterpart. Without the RIM and SIM instructions. the 8085 and 8080A assembly language instruction sets are identical; therefore the 8086 assembly language instruction set must also be upward compatible with the 8085 assembly language instruction set - apart from the RIM and SIM instructions. The 8085 and 8080A assembly language instruction sets are object code compatible -with the exception of the 8085 RIM and SIM instructions. That is to say. a program existing in read-only memory could be used with one microprocessor or the other. The 8080A assembly language instruction set is a subset of the Z80 assembly language instruction set. That is to say. the Z80 will execute an 8080A object program - but the reverse is not true. The 8080A cannot execute Z80 programs when the full Z80 instruction set is used. The 8086 assembly language instruction set is not upward compatible with the Z80 assembly language instruction set. As a historical note. it is worth mentioning that the 8008 microprocessor. which preceded the 8080A. was also compatible only at the source program level. That is to say. there is an 8080A assembly language instruction for every 8008 assembly language instruction. but the two microprocessor object code sets are not the same. The various instruction set compatibilities that we have described may be illustrated as follows: 8086 . / / / ) excluding RIM ( and SI~instructions / 8085 / +I I I I I I Z80 ~i~-8080A +I Source program of lower microprocessor can be assembled to generate upper microprocessor object program. Lower microprocessor instruction set is a subset of upper microprocessor instruction set at the object program level. I 8008 20-1 These are the most interesting innovations to be found in 8086 hardware design: 1) 8086 Central Processing Unit logic has been divided into an Execution Unit (EU) and a Bus Interface Unit (BIU). These two halves operate asynchronously. The Bus Interface Unit handles all interfaces with the external bus: it generates external memory and I/O addresses and has a 6-byte instruction object code queue. Whenever the EU needs to access memory or an I/O device, it makes a bus access request to the Bus Interface Unit. Providing the Bus Interface Unit is not currently busy, it acknowledges the bus access request from the EU. When the Bus Interface Unit has no active pending bus access requests from the EU, it performs instruction fetch machine cycles to fill the 6-byte instruction object code queue. The CPU takes its instruction object codes from the front of the queue. Thus instruction fetch time is largely eliminated. 2) The 8086 has been designed to work in a wide range of microcomputer system configurations, ranging from a simple one-CPU system to a multiple-CPU network. To support this wide flexibility, a number of 8086 pins output alternate signals. This may be illustrated as follows: Minimum Configurations Maximum Configurations These signals do not change These signals do not change 8086 8086 11· K • ~m:~~~'~ MN!MX Simple control ~~IIII~~ output for use in one-CPU system Complex control useful signals in multi CPU networks +5V The same pins output these two sets of signals, based on a level of MN/MX. This wholesale re-allocation of signals is a highly imaginative and innovative first for the microprocessor industry. 3) The 8086 has built-in logic to handle bus access priorities in multi-CPU configurations. (This is not anew concept: National Semiconductor's SC/MP has had it for years.) . 4) In multi-CPU configurations, each 8086 CPU can have its own local memory, while simultaneously sharing com. mon memory. The common memory may be shared by all CPUs, or by selected CPUs. 5) The 8086 has been designed to compete effectively in program intensive applications that have been the domain of the minicomputer. Up to a million bytes of external memory can be addressed directly. All memory addressing is base relative: this memory addressing technique naturally generates relocatable object programs. (Relocatable object programs can be moved from one memory address space to another and re-executed without modification.) Also, since the 8086 utilizes stack-relative addressing, re-entrant programs are easily written. (Re-entrant programs can be interrupted in mid-execution and re~executed. For example, a subroutine which calls itself is re-entrant: a program which can be interrupted in mid-execution by an external interrupt. and then re-executed within the interrupt service routine, is also re-entrant.) 6) The 8086 uses prefix instructions that modify the interpretation of the next instruction's object code. The 8086. like its predecessor. the 8080A. is really one component of a mUltiple-chip microprocessor configuration. In addition to the 8086 microprocessor itself. you must have an 8284 Clock Generator/Driver. You cou Id create the required clock signal using alternative logic, but it would be neither practical nor economical to do so. The third device necessary in some 8086 microprocessor configurations is the 8288 Bus Controller. You will usually have an 8288 Bus Controller between an 8086 and its System Bus (or busses). just as you will usually have an 8228 System Bus controller. between an 8080A and its System Bus. In the case of the 8086, however, you can dispense with the 8288 Bus Controller in single-bus configurations - and pay no penalty for it. 20-2 The 8086 has a large family af suppart devices. Mast af these suppart devices are nat yet available. In this chapter we describe the fallawing suppart devices: • The 8282/8283 8-bit input/autput parts • The 8284 Clack Generatar/Driver Q w ~ a: o D. a: • The 8286/8287 8-bit parallel bidirectianal bus drivers • The 8288 Bus Cantraller The anly manufacturer af t~e 8086 is: o INTEL CORPORATION 3065 Bawers Avenue Santa Clara. CA 95051 CJ ~ enw ~ g CI) CI) ~ cIS w Z a: o 10 CI) o :!E ~ It is prabable that Advanced Micra Devices will became a secand saurce far this part within the U.S.A.. while Siemens AG becames the secand saurce in Eurape. The 8086 is manufactured using N-channel depletian laad. silican gate technalagy. It is packaged in a 40-pin DIP. A single +5V pawer supply is required. All signals. with the exceptian af the clack input. are TTL-campatible. The clack input must be an MOS level signal: it is generated by the 8284 Clack Generatar/Driver device. which is described later in this chapter. Instructian executian times will vary depending an haw effectively instructian queuing is used. Typically. between 2 and 30 clack cycles are required to. execute an instructian. Multiplicatian and divisian instructians require mare executian time. Clack cycles may be as shart as 125 na·nasecands. Future versians of the 8086 will likely allaw faster clacks. c ~ @ THE 8086 CPU ~unctions implemented on the 8086 microproce~sor chip are illustrated in Figure 20-1. Interrupt priarity arbitratian lagic is shawn as anly half present: external lagic. such as an 8259A. must pravide a device cade identifying an interrupt. but all arbitratian and vectaring lagic is subsequently handled by lagic within the CPU. . It is ~arth nating that bus interface logic. which is shawn as present in Figure 20-1. is much mare extensive than ather microprocessars provide. One cauld rightfully demand that bus interface lagic therefare be shawn as absent in equivalent figures far athermicrapracessars. . 8086 PROGRAMMABLE REGISTERS AND ADDRESSING MODES We describe 8086 programmable registers in conju'nction with 8086 addressing modes, since many 8086 programmable registers are there only to support memory addressing logic;. 8086 programmable registers are illustrated in Figure 20-2. . , • Shaded ~egisters are 8086 equivalents far 8080A regist~rs. 8080A register names are shawn in the left margin. L,et us first examine the general purpose registers, AX, BX, ex and OX. These lacatians are treated as four 16-bit registers ar eight 8-bit registers; they also. reproduce the 8080A generai pur: pase registers as fallaws: AH has no. 8080A equivalent. Do not canfuse it with the 8080A PSW. 8086 AND 8080A REGISTERS' COM JlATIBILITY AL is equivalent to. the 8080A A register BH is equivalent to. the 8080A H register BL is equivalent to. the 8080A L register CH is equivalent to. the 8080A B register CL is equivalent to. the 8080A C register DH is equivalent to the 8080A D register DL is equivalent to. the 8080A E register Cansistent with 8080A register utilizatian. register AX serves as a primary Accumulator. Input and autput instructians pass data thraugh AX (ar AU in preference to. at~er general purpase registers: also.. selected instructian access AX (ar AU cantents only. In addition to serving as a general purpose Accumulator, register register when computing data memory addresses. 20-3 ex can serve as a base 8086 AX REGISTER 8086 ex REGI~TER Clock Logic / Logic.toliandle> _ . ~ Ir'l.·. t..·.e.·.rr. . u. pfrom . . t. Re.q..•.. . u.e.s. t.s.·· .. ... • • •. • • • .• • 0Esx~teirn0aJIo(e~VTIicTIesTIitl? .../ >< iii) ...\. ................. ..····ii ./.\ . i l~strJctjoriR~~,st~r" ......... ..i............. Co~i~olurii~/ i ..... :: ..... 'i> .... Ii. ........... . ... \.iL} .. . . ~t,'1< i i ",' c'·•·•· ..... ·.· .•.... c\ .. ·:.·•• • .(,../ it . < i < \ i : : '...: V:.~'. ))) ...< II . •.A.•. .•.rith . . '"!le. . . t. iC.a.~. .?>. \ . . •. \·r.· . . ·. A.. d.c.c.y.m.U....I.aw... )L.••.••.•.•••.• 7\< Logic U n i t » . R e g i s t e H s ) . ..... • •.•.• ·1·. • i) ..... ··/i.· ' .. r < Direct Memory Access Control Logic j ....... i .. .... • .>... < ..... .... t· ·.c··' ..... > / ....... I/O Communication . . . Serial to Parallel Interface Logic •••.•. . 1/ ... -~ 'r. ~AM···A9~re~sing Hi!3M·i}r~ ~ ..I~tf!~a9f:\'~~*i , •.. . .... Programmable Timers Read Only Memory I/O Ports ~ Figure 20-1. Logic of the Intel 8086 CPU 20-4 Read/Write Memory ° +- One 16-bit register .---_ _ _-.-_ _ _--,0 +- Two 8-bit registers AL (or Al AX (= AH. AL) Primary Accumulator(s) ~~--~----~ BX (= BH. BLl Accum~lator(s). and Base register BL ". cw ~ oQ. a: ~----~----~ 1,-_ _ _-t-_C~L----1 CX (= CH. ~LI Accumulator!s) and Counter register DL OX (= DH. DL) AccumulatQns) and I/O Data Counter ~;;::::::;:::;-=;ft;.:::;;;;:::::;:::;f-=;;L- These names apPI~t~' 16-bit registers a: o u '. These na0es apply to 8-bit registers L..-_ _ _- ' -_ _ _ _ _ ~ en w °1 :,::' ;:;:.t::r(SP) .. Base Pointer (BPI ~ g num~er . CI) CI) :================:0 +- Bit c( 1 - - - - - - - - - - 1 1 Source Index (SI) L--_ _ _ _ _ _ _---J DestlOatlon Index (01) CI/S w Z a: o CI) o a:I ~ c( c c( @ } . Index registers o +- Bit number r7'"77~~~~~~~1 Program Counter (PC) 0 +- Bit number 15 8 .' COdeSeQ"'1ent (CS)} Data Segment (OS) . Stack Segment (SS) '.' Segment registers Extra Segment (ES) . 1;":15~_ _ _ _ _ _ _0~ +- Bit number 1 1 - ._ _ _ _ _ _ _ _..... , Status Shaded registers are 8086 equivalents for 8080A registers. 8080A register names are shown in the left margin. Figure 20-2. 8086 Programmable ReQisters Register ex serves as an Accumulator; it is also used as a counter by multi-iteration instructions; these instructions terminate execution when register. ex contents increment or decrement to O. . '. 8086 ex REGISTER 80a6 Some I/O instructions move data between an identified I/O port and the memory location addressed'by register OX. Register DX may also serve as an Accumulator. When looking at general purpose registers AX. BX. confused by terminology. OX REGISTER ex and pX. there is plenty of opportunity to be '. Intel literature identifies the four 16-bit registers via the laQels AX. BX. divided by Intel literature into two 8-bit registers. as follows: 20-5 ex and DX.' Each of these 16-bit registers is sub- 15 -----I ----- 7 07 I AH 15 7 I 07 B~ 7 07 I CH CL CX 15 7 I B; BX 15 I AL AX 07 OH . l' o ~ AX bit numbers o ~ AH. AL bit numbers I o ~ BX bit numbers o ~ BH. BL bit numbers I o ~ CX bit numbers o ~ CH, CL bit numbers I o ~ OX bit numbers o ~ OH, OL bit numbers I OL ox The 8080A Accumulator must be reproduced by AL. since selected 8080A and 8086 instructions access this register , and none o t h e r . ' BH and BL must reproduce the 8080A Hand L registers. since only BX can contribute to an 8086 data memory address, On the surface this would appear to present a problem. since the 8080A has a limited number of instructions which use the Be and DE registers to provide 16-bit memory addresses. When 8080A source programs are reassembled to execute on an 8086 microprocessor. 8080A instructions that seek memory addresses out of the Be or DE registers ' become 8086 instructions that use Index registers.' All 8086 memory addresses are computed by summing the contents of a Segment register and an effective memory address. The effective memory address is computed via a variety of addressing modes. as it would be for any other microprocessor. The selected Segment register contents are left-shifted four bits. then added to the effective memory address to generate the actual address output as follows: Segment Register contents: Effective memory address: Actual address output: xxx~xxxxxxxxxxxxoooo + OOOOyyyyyyyyyyyyyyyy ZZZZZZZZZZZZZZZZyyyy x, Y and Z represent any binary digits. 20-6 8086 SEG'MENT R~GISTERS Thus a 20-bit memory dressed directly. , , . ~ddress is computed - which allows 1,048,576 bytes of external memory to be ad- ' I. The Segment registers of the 8086 are unlike any other microprocessor registers described in this book. They act as base registers which can point to any memory location that lies on an address boundary that is an even multiple of 16 bytes. Using arbitrary memory addresses. this may be illustrated as follows: Q ~ a: 334DF I6 oQ. a: o u } ~ enw ~ g CS Segment register _ contains 234E I6 CS",m,", I - - - - - - - - - ' - - - i 234EO l6 CI) CI) lA31F I6 ct CI/l w Z a: ES segment oc:a 121EF I6 CI) o ~ ct Q ct @ ES Segment register _ t--~--;c~~~~--;c-i contains OA3216 DS Segment register _ contains021F I6 1--_ _ _ _ _---'----'--1 OA320 16 021FO l6 As illust~ated above. each Segment register identifies the beginning of a 65.536-byte memory segment. Since the 8086 has four Segment registers. there will.at any time be four selected 65.536-byte memory segments. The actual address output will always select a memory location within one of these four segments. For example. if an actual address output is the sum of the OS Segment register and an effective memory address. then the actual address output must select a memory location within the OS segment: that is to say. within the address range 021 FOt6 through 121 EFts in the illustration above. Likewise. an actual address output which is the sum of the CS Segment register and an effective memory address must select a memory location within the CS segment. which in the illustration above will lie in the address range 234EOt6 through 3340Ft6. No restrictions are placed on the contents of Segment registers. Therefore 8086 memory is not divided into 65.536byte pages. nor do the four Segment registers have to specify non-overlapping memory spaces. Each Segment register identifies the origin of a 65.536-byte memory segment which may lie anywhere within addressable memory. and may or may not overlap with one or more other segments. Even though Segment registers can create overlapping or non-overlapping segments. they do have dedica~ed addressing functions. That is to say. different types of memory accesses compute memory address within specific segments. During an instruction fetch, the Program Counter contents are added to the Code Segment register (CS) contents in order to compute the memory address for the instruction to be fetched. This may be illustrated as follows: 20-7 8086 CODE SEGI\ijENT REGISTER AND. PROGRAM COUNTER 15 0 7 07 0 AX.=AH+ALm· BX = BH+BL CX = CH+CL OX = OH+OL : o 15 SP BP 10-, 51 01 M PC M M M 15 .~ . ~~~~~ 0 :~ ES~ 0 M M M M Actual program memory address output. M. Nand P represen! any hexadecimal digits. Any Stack instruction such as a push. pop. call or return adds the Stack Pointer contents to the Stack Segment register (SS) contents in order to Compute the address of the Stack location to be accessed. This may be illustrated as follows: 15 7 07 0 0 :::::::~m cx = CH+CL o~ ~ OH+OL· 15 8086 STACK SEGMENT AND STACK POINTER REGISTERS .. . o Actual Stack operation . address output. Once again. M. Nand P represent any hexadecimal digits. Instructions that process data strings use the SI and 01 Index registers, together with thE! Data Segment register (OS) and the Extra Segment register (ES), in order to identify string source and destination addresses. This may be illustrated as follows: ·20-8 8086 EXTRA SEGMENT, SOURCE INDEX AND DESTINATION INDEX REGISTERS 15 0 7 07 0 :::::::~~ .. cx = CH+CL cw OX = OH+OL ~ a: o 15 C Q, IX C SP ~ BP c.: ui w SI J J J J l- 01 K K K K U PC e{ oen en e{ , III o 15 CS~ u.. Z a: DS en SS oCD o M. M ES ::!E ~ MM· 0 K K K K 0 J J J J N N N N 0 MMMMO R R R R K If Actual data string address output. S S S S J Source string address. NNNN e{ c e{ @ J. K. M. Rand 5 all represent any hexadecimal digits. As the above illustration would imply. instructions that process strings require that the source and destination strings reside within a single 65.536-byte address range. but not necessarily the same 65.536-byte range. Instructions that access data memory add an effective memory address to the Data Segment register (OS) or the Stack Segment register (SS). This may be illustrated as follows: 15 7 07 CX DATA SEGMENT AND STACK SEGMENT REGISTERS Program Memory. as addressed " ' - - - - - - -.... by PC and CS 0 0 :::::::~~. § = CH+CL OX = OH+OL 8086 . 15 SP BP SI ~--------------~ r---------------~ 01 r---------------~I _ _----"'"'JIP" 0 X X X X PC r---------------~ y y Y Y 0 ~:~~/zzzzx Effective address segment base. Actual data address output. ESE===:3 X. Y and Z represent any hexadecimal digits. When a data memory address is created. as illustrated above. the BX. BP. 51 and DI registers' contents. plus a displacement coming from the instruction object code, may contribute to the effective memory address. There are, however, very specific register and displacement combinations that can create an effective memory address, as summarized in Table 20-1. Each case specifies either the D5 or 55 register as the default source for the segment base address. 20-9 Table 20-1. A' Summary of Intel 8086 Memory Addressing Options POSSIBLE DISPLACEMENTS MEMORY REFERENCE SEGMENT REGISTER OS BASE REGISTER CS, SS or ES) OS 8-BIT HIGH ORDER BIT EXTENDED NONE SI X X X X X X SI X X X 01 X X X None X X X None None X SI X X X BP 01 X X X None X X BX SS . (Alternate*: 16-BIT UNSIGNED 01 None (Alternate* : NORMAL DATA MEMORY REFERENCE INDEX REGISTER CS, OS or ES) STACK SS SP STRING DATA ES None INSTRUCTION FETCH CS PC None BRANCH CS PC None I/O DATA OS OX None None SI 01 X * The segment override allows OS or SS to be replaced by one of the other segment registers X These are displacements that can be used to compute memory addresses. When creating any d,3ta' memory address. you can execute an extra instruction to select a Segment register' other than the default Segmetit register. You can only select a Segment register other than the default Segment register when addressing data memory. You must live with the default Segment register when creating program memory addresses, Stack addresses, or string instruction addresses. It is very important to nate that the 8086 has a whale set of data memory addressing options aimed at accessing the Stack as though it were a data area. That is to say, in addition to the normal "Push" and "Pop" type Stack instructions, the 8086 allpws normal data memory acceses instructions to address the Stack. Many assembly language programmers use the Stack to store addresses, and as a general depository for data which must be transmitted between program modules. Anyone favoring this assembly- language programming philosophy will be delighted with 8086 data memory addressing options. 20-10 Let us now examine the various data memory addressing options in detail. Refer to Table 20-1. ,..--------, In the simplest case. we have straightforward direct memory addressing. A 16-bit displacement provided by tvvo instruction object code bytes' is added to the Data Segment register in order to create the actual memory address. This may be illustrated as follows: 8086 DIRECT MEMORY ADDRESSING cw ~ a:: oD.. a:: o o ~ enw ~ 15 Program Memory 0 7 07 0 :~:::::~m ~~L ::::~+1 CX = CH+CL o OX = OH+OL g H H L L ~"""-_-----{J o C/) C/) 5 5 5 5 L < ci:I w Z a:: BP CD 01 o C/) o ~ H PPPPM+2 ~ Actual data memory address output for direct memory addressing. 51 PC < c < @ H R R R R0 M 15 M M M O~OMMMM C5~N. N N R R R R 05 • NNNNO P P PPM 55 ES H. L. M. N. P. Rand S all represent any hexadecimal digits. Note that a 16-bit address displacement. when stored in program memory. has the low-order byte preceding the highorder byte. This is consistent with the way the 8080A stores addresses in program memory. DS must provide the Segment base address when addressing data memory directly. as illustrated above. 20-11 Direct. indexed addressing is also provided. The 51 or 01 register maybe selected as the Index register. You have the option of adding a displacement to the contents of the selected Index register in order to generate the effective address. If you do not add a displacement. then you have. in effect. implied memory addressing via the SI or 01 register. This may be illustrated as follows: 15 7 8086 IMPLIED MEMORY ADDRESSING 0 0 07 :::;:::~~ cx = CH+CL DX = DH+DL o 15 SP BP SI DI PC r---------------~ r---------------~ r---------------~ ~--------------~ ~--------------~ 15 0 CS~ DS R R R R oxxxx ------.,.,. R R R R 0 SS ES S S S S X ......f - - - - Actual data memory address output for implied memory addressing. (You may substitute CS, SS or ES for DS by executing an additional 1-byte instruction.) X. Rand 5 represent any hexadecimal digits. If a displacement is added to the contents of the selected Index register. then you may 8086 DIRECT. specify an 8-bit displacement or a 16-bit displacement. A 16-bit displacement is stored in two INDEXED object code bytes; the low-order byte of the displacement precedes the high-order byte of the disADDRESSING placement. as illustrated for direct memory addressing. If an 8-bit displacement is specified, then the high-order bit of the low-order byte is propagated into the high-order byte to create a 16-bit displacement. This may be illustrated as follows: Displacements: Sign extended: 1 LJ2~~[lill~w]illJ~u 0 1 1 0 1 0 1 0 1 1 0 1 0 1 20-12 o 1 ""'19"' . --O-i-O->-O-\-O-.·.·. ·.,....j)""'y.,..,.O-\\-o"....,...,q11 1 0 1 0 1 1 0 1 0 1 1 We may now illustrate direct, indexed addressing as follows: 15 7 c w ~ a:: oa.. Program Memory 0 0 07 :::::::~m CX = CH+CL o y y y.y ox o x x x X = OH+OL a:: § --{. R R R R 0 o CJ o ~ enw BP ~ U o (I) SI 01 (I) ct ell ~ ~--------------4 PPPPM+1 PPPPM+2 PPPPM+3 Actual data memory address output for direct. indexed memory addressing. r---------------~ PC ~--------------4 M M M M CS ~N N N --------I..~ w Z zzz zz PPPPM ~1-5--------------~0~ a:: OMMMM oen (I) o OS ~ ct C ct R R R R N N N N 0 P P PPM SS ES @ (You may substitute CS. SS or ES for OS by executing an additional 1-byte instruction.) M. N. P. R. X. Y and Z all represent any hexadecimal digits. YYYY is the 16-bit or 8-bit displacement taken from program memory. XXXX is the index taken from either the 01 or the SI register. The effective memory address can be computed using base relative addressing. You have two sets of base relative addressing options: 1) Data memory base relative addressing. which is within the OS segment (data memory). 2) Stack base relative addressing. which is in the SS segment (Stack memory). Data memory base relative addressing uses the BS register contents to provide the base for the effective address. All of the data memory addressing options thus far described are available with base relative data memory addressing. In effect, base relative data memory addressing merely adds the contents of the BX register to the effective memory address which would otherwise have been generated. Here. for example. is an illustration of base relative direct addressing: • 20-13 8086 BASE RELATIVE, INDEXED ADDRESSING 8086 DATA MEMORY BASE RELATIVE ADDRESSING 15 0 7 07 ::: ::::~ rnK . K K: ____ ~OKKKK CX=CH+CL Dx = OH+OL § Program Memory 0 .J: -""''--------"lj 0 H H L L .... . PPPPM PPPPM~l PPPPM+2 R R R R 0 o S S S S S ~ Actual data memory address output for base relative. direct. indexed memory add ressi ng. BP SI 01 PC M M M M 15 OMMMM CS~N N N ----------~.~ R OS R R R N N N N 0 P P PPM SS ES (You may substitute CS. ES or SS for OS by executing an additional '·byte instruction.! Simple. direct addressing. which we described earlier. always generated a 16-bit displacement. Base relative. direct addressing allows the displacement. illustrated above as HHLL. to be a 16-bit displacement. an 8-bit displacement with sign extended. or no displacement at all. Base relative implied data memory addressing simply adds the contents of the BX register to the selected Index register in order to compute the effective memory address. This may be illustrated as follows: 0 15 :::::::~rn7 K.07 0________________ K K K CX = CH+CL OX = OH+OL . o 15 SP BP SI 01 PC r---------------~ r---------------~ r--------------~ r--------------~ 15 0 ~~ OS SS R R R R 0 K 0 • xxx X R R R R 0 S S S S S ES ...-- Actual data memory address output for base relative. implied memory addressing. (You may substitute CS. SS or ES for OS by executing an additional 1-byte instruction.) 20-14 Base relative. direct. indexed data memory addressing may appear to be complicated. but in fact it is not. We simply add the contents of the BX register to the effective memory address. as computed for normal direct. indexed addressing. Thus. base relative. direct. indexed data memory addressing may be illustrated as follows: 15 7 Program Memory 0 0 07 ~ :::::::~mK KK • o KK K...., K ~ CX = CH+CL o y y y y ~ OX = OH+OL 0 X X X X -{ §PPPPM PPPPM" PPPPM+2 (J PPPPM+3 R R R R 0 ~ en w zz zz o I- z~ ~ U Actual data memory address output for base relative. direct. indexed memory addressing. BP oCI) SI CI) ~ col! 01 w Z PC M M M M a: 0---------- oell 15 CI) o :!: CS OS ~ o ~ ~N N N -------1~~ .R R R R OMMMM N N N N 0 P P PPM SS @ ES (You may substitute CS. s or ES for OS by executing an additional 1-byte instruction.) The 8086 also has Stack memory addresing variations of the base relative. data memory addressing options just described. Here. for example. is base relative. direcfStack memory addressing: 15 7 Program Memory 0 0 07 :::::::~m· 0 OX = OH+OL 0 H H L L CX = CH+CL KKKK... §PPPPM --{. PPPPM., PPPPM+2 R R R R 0 o BP SI 01 PC KKK K ~ Actual Stack memory address out~ut for base relative. direct memory addressing. ~-------------~ ~--------------~ ~--------------~ MM M M 0 - - - - - - - - . . 0 M M IV! M ,15 CS~N N N OS SS S S S S S R R R • NNNNO P P PPM R ES (You may substitute CS. ES or SS for OS by executing an additional 1-byte instruction.) In the illustration above. the displacement HHLL must be ,present. either as a 16-bit displacement. or as an 8-bit displacement with sign extended. Remember. base relative. direct data memory addressing also allows no displacement. However. base relative. direct Stack memory addressing requires a displacement. These options are summarized in Table20-1. 20-15 Here is an illustration of base relative implied Stack memory addressing: AX.AH>ALm 15 7 0 0 07 = BH+BL = CH+CL OX = OH+OL BX CX 15 0 5P BP K K K K 51 01 PC 0 K K 15 ;~I 0 xxx X R R R R 0 R R R 5 5 S S S ~ Actual Stack memory address output for base relative, implied memory addressing. R (You may substitute CS, OS or ES for SS by executing an additional 1·byte instruction.) X, Rand S represent any hexadecimal digits. Here is an illustration of base relative. direct. indexed Stack memory addressing: 15 7 Program Memory 0 0 07 :::::::~m cx = CH+CL o o OX = OH+OL 0 X X X X K K K K Y Y Y Y ..... ~ §PPPPM PPPPM" o BP SI 01 PC KKK Z Z Z Z Z K ~---------------4 ~---------------4 M M M 15 0 0 M M M M C5~N N N ------------~.~ N N N N0 OS P P PPM 55 ~ Actual Stack memory address output for base relative, direct, indexed memory addressing. ~---------------4 M R R R PPPPM+2 PPPPM+3 R R R R 0 R ES (You may substitute CS, OS or ES for SS by executing an additional 1-byte instruction.) 20-16 cw ~ a: o Q. a: o (J, ~ ui w· l- e:( U oC/) C/) e:( oil w Z a: o In C/) o ~ e:( c e:( @ There is one anomalous 8086 addressirig mode which can cause confusion. One variation of I/O 8086 I/O . PORT instructions addresses an lio port via the DX register. The OX register contents are output Oh the Address Bus. to be interpreted as an I/O port address .. This means you can have up to 65.536 ADDRESSING I/O port addresses. Since the OX register contents are being output as an I/O port address. it is not added to any Segment register contents. Thus, the OX register outputs an address in the range 000016 through FFFFI6. This is the only case in which a register's contents ilre output directly as an address on the Address Bus. without first passing through segmentation logic. All 8086 Branch-on-Condition instructions use program relative addressing. This feature allows dynamically relocatable code. The Branch-on-Condition instruction provides an 8-bit. signed binary displacement which is added to the contents of the Program Counter. Thus, Branchon-Condition instructions have an addressing range of + 128 through -127 bytes from the location of the Branch-on-Condition. The queuing of instruction object codes has no impact on Branchon-Condition logic, or the branch addressing range. 8086 PROGRAM RELATIVE , ADDRESSING 8086 Jump and Subroutine Call instructions offer these addressing options: 1) Program relative addressing. An 8-bit or 16-bit displacement is added to the contents of the Program Counter. 2) Direct addressing. New 16-bit addresses provided by the instruction are loaded into the Program Counter and the CS Segment register. 3) Indirect addressing. Any of the data memory addressing options may be used to read data from data memory. However, the data input is interpreted as a memory address. You have two indirect addressing options. A single 16-bit data word may'be read, in which case it is loaded into the Program Counter and the Jump or Call references a memory location within the current CS segment. You can also read two 16-bit data words; the first is loaded into the Program Counter and the second is loaded into the CS Segment register. Thus you can Jump or Call indirectly any addressable memory location. 8086 STATUS The 8086 has a 16-bit Status register with the following status bit assignments: 1514 13 12 11 10 9 1-1-1-1-1 0 I I I I 8 7 6 5 4 3 2 1 0 ~ I-I pi-I I I I It I D II IT I S I Z I-I A Bit No. C Status register L Carry Reserved bits, normally 0 Parity Auxiliary Carry Zero Sign Trap Interrupt enable/disable Direction Overflow 20-17 8086 INDIRECT ADDRESSING a The Carry, Auxiliary Carry, Overflow and Sign statuses are quite standard; see Volume 1 for description of these statuses: The Auxiliary Carry status is identical to theB080A status with the same name. It represents carries out of bit 3 in an 8-bit data unit as described in·Volum.e I. Chapter 2. Subt~act instruc~ions use twos ci~mpl~ment arithmetic in order to subtract the minuend from the subtrahend. However, the Carry status is inverted. That is to say, following a subtract operation, the Carry status is set to 1 if there was no carry out of the high-order bit, and the Carry status is reset to 0 if there was a carry out of the high-order .bit. The Carry Status therefore indicates a borrow. The Parity status is sette 1 when there is an even number of 1 bits in the result of a data operation; an odd number of 1 bits causes the Parity status to be reset to O. The Zero status Is completely standard. It is set to 1 when the resu It of a data operation is zero; it is set to 0 when the resu It of a data operation Is not zero. The Direction ~tatus determi~es whether stringoperati~ns will auto-increment or auto-decrement the contents of Index .registers. If the Direction status is 1. then the 51 and DI Index registers' contents will be decremented; that is to say. strings will be accessed from the highest memory address down to the lowest memory address. If the Direction status is O. then the 51 and Dllridex register contents will be incremented; that is to say. strings will be accessed beginning wit~ the lowest memory address. The Interrupt status is a master irite;rupt enable/disable. This status must be 1 in order to enable interrupts within the 8086. If this status is O. then all interrupts will be disabled. The Trap status is-a special debugging aid which puts the 8086 into a "single step" mode. The single step mode is described in detail together with 8086 interrupt logic. since it depends on this interrupt logic for its existence. The Carry, Auxiliary Carry, Parity, Sign and Zero statuses are also found in the 8080A. The Overflow, Direction, Interrupt and Trap statuses are new in the 8086. 20-18 8086 CPU PINS AND SIGNALS 8086 CPU pins and signals are illustrated in Figure 20-3. C w 40 GND l- < a: AD14 • a: AD12 .. • AD13 0 n. 0 CJ ADll ~ en w AD10 < AD8 AD9 l- (j 0 AD7 en en • • .. • 2 39 3 38 4 37 5 36 6 35 7 34 8 33 .. 10 AD5 OIl 11 30 w Z AD4 .. i:z 29 AD3 OIl 13 28 III 0 AD2 en • 0 ADl ~ ADO ~ a: • OIl • • • • • • 8086 • • 31 14 27 15 26 16 25 AD15 A16/S3 A17/S4 A18/S5 A19/S6 BHE/S7 MN/MX 32 9 AD6 < Vee RD RO/GTO, HOLD • RO/GT1. HLDA • S2, MliO • LOCK, WR • Sl,DTlR • OSO, ALE • SO, DEN < C < NMI 17 24 INTR 18 23 TEST @ eLK 19 22 READY 20 21 RESET GND Minimum System Signals OSl,lNTA Type Description Pin Name Maximum System Signals • ADO-AD15 Data/Address Bus Bidirectional, tristate A16/S3, A17/S4 Address/Segment identifier Output, tristate A18/S5 Address/I nterrupt enable status Output, tristate A19/S6 Add ress/status Output, tristate BHE/S7 High-order byte/status Output, tristate RD Read control READY Wait state request Output, tristate Input TEST Wait for test control Input INTR I nterrupt request Input NMI Non-maskable interrupt request Input RESET System Reset Input CLK System Clock Input MN/MX = GND SO,Sl,S2 Machine cycle status Output, tristate RO/GTO, RO/GTl Local bus priority control Bidirectional OSO,OSl Instruction queue status Output LOCK Bus hold control Output, tristate MN/MX = Vcc for a minimum system { for a maximum system M/IO Memory or I/O access WR Write ALE Address Latch enable DT/R Data transmit/receive Output, tristate DEN Data enable Output, tristate contro~ Output, tristate Output, tristate Output INTA Interrupt acknowledge Output HOLD Hold request Input HLDA Hold acknowledge Output Vee,GND Power, ground Figure 20-3. 8086 Pins and Signal Assignments 20-19 The 8086 outputs a 20-bit memory address. Data is accessed as 16-bit words. sUbdivided into a low-order byte and a high-order byte. Therefore the 8086 needs a 20-line Address Bus and a 16-line bata Bus. In order to have a 40-pin package. the low-order 16 Address Bus lines are multiplexed viiitH the Data Bus. " .' BHE may be looked upon as an additional Address Bus line, since it is used to identify the high-order byte of a memory word. while ADO identifies the low-order byte of the memory word. The four high-order Address Bus lines. together with BHE. are multiplexed with five status lines. thus. we can illustrate Address Bus line multiplexing as follows: D<1ta/Status Status 16-bit data word { Status Address S7 6R'l: High-order byte of selected word DO AO Low-order byte of selected word 01 -'015 S3 - S6 A1-A15 } A16 - A19 Address of a 16-bit word It rs easy to become confused when looking at how the Address Bus, together with BHE, is used to access memory. As seen by external memory. Address Bus lines are interpreted as follows: Low-order byte memory bank Memory select logic Select AO ---- A18 DO ---- 07 .. ADO 8086 EXTERNAL MEMORY ADDRESSING - AD1 ADO AD1 AD7 AD7 AD8 AD8 AD15 AD15 A19 A19 SHE SHE DO ---- D7 AO ---- A18 Select High-order byte memory bank Memory select logic 20-20 In the illustration above you will see that memory is indeed organized as bytes. The data pins of the low-order byte memory bank connect to ADO-AD7. The high-order byte memory bank data pins connect to AD8-AD15. Q w ~ a: o Do a: o o ~ enw ~ oo en en oCt ~ w Z a: The low-order and high-order byte memory banks each have memory select logic which decodes AD 1-A 19. These 19 address lines become inputs AO-A 18 at the illustrated memory select logic. Since each memory bank receives 19 address lines. select logic can address up to 524.288 (512K) bytes of memory. These two memory banks. taken together. constitute the advertised one million bytes of directly addressable memory. Now. you may well ask why one should bother dividing memory into separate low-order byte and high-order byte banks. If a sixteen-bit word lies on an even-byte address boundary. then we could ignore the memory select logic connections to ADO and BRE. The address on AD1-A 19 becomes an address identifying a 16-bit word which just happens to be implemented as two separate 8-bit memory banks. If an 8086 16-bit memory word does lie on an even-byte address boundary. then the low-order byte address is. in fact. the only address output. BHE is pulsed low while the low-order byte address is being output. and both memory banks consider themselves selected even though (in theory) the high-order memory bank's address has not been output. To illustrate what happens. consider the memory addresses 02A4016 and 02A4116. One would normally expect the two addresses to be output sequentially in order to access the low-order byte and then the high-order byte of the 16-bit word. This may be illustrated as follows: o CD en o ::!: ADO-AD7 oCt Q oCt @ AD8-AD15 ADl6-AD19 Input data from byte 02A4016 Output address 02A4016 Output address 02A4116 Input data from byte 02A4116 But we could just as easily output the low-order byte address only. using BHE as an extra address line to substitute for the odd-byte address - which is never output. This may be illustrated as follows: ADO-AD7 AD8-AD15 ADl6-AD19 Output address 02A4016 Assume address 02A4116 has been output 20-21 If a word lies on an odd-byte address boundary, then two byte addresses must be output to access the two halves of the 16-bit word. This may be illustrated as follows: First memory access is to a byte in the highorder byte memory bank, i.e. an odd byte address, with ADO high Return loworder byte of 16-bit word via AD8-AD15 Second memory access is to a byte in the low-order byte memory bank, i.e. an even byte address, with ADO low Return highorder byte of 16-bit word via ADO-AD7 When a 16-bit word lies on an odd-byte address boundary. as illustrated above. the low-order byte is input first via AD8-AD15. then the high-order byte is input via ADO-AD7. Logic internal to the 8086 switches the data bytes into their correct locations. Intel could have elected to implement external memory as 16-bit words, which would eliminate BHE along with the Address Bus complexities we have just described. But this would have forced all instruction object codes, and data, to be accessed as 16-bit units. Why not do it? One of the most interesting hindsight discoveries that 8080A users have made is the fact that the 8080A is extremely efficient in its use of memory. By having a large number of 8-bit object codes. the 8080A generates object programs as compact as the most powerful minicomputers on the market. But if the 8086 is to keep 8-bit object codes. and therefore the efficient memory utilization of the 8080A. then it can no longer guarantee that data will lie on even-byte address boundaries. The first 8-bit object code will force the next instruction or data entity to begin on an odd-byte boundary. By including BHE and the extra logic needed to access 16-bit data units origined at odd-byte boundaries. the 8086 has allowed instructions to generate 1-byte. 3-byte or other odd-byte object codes. rather than 2-byte. 4-byte and evenbyte object codes only.' Simply stated, this is the trade-off: simplify memory addressing so that external memory is accessed only as 16-bit data units and you will use memory less efficiently. Intel elected to make memory addressing logic more complex and memory utilization more efficient. Moving on from the Data/Address Bus, 8086 signals may be grouped into those that do not change with system complexity, and those that do. let us first look at the unchanging signals. elK is the single clock signal output by the 8284 clock generator to synchronize all 8086 logic. READY is the Wait state request which slow external logic inputs if it requires more time to respond to an access. A high READY input occurring at the proper time early in a machine cycle causes the 8086 to extend the machine cycle by inserting Wait state clock periods. 20-22 RD is a single bus control signal which does not change with system configuration. This signal is output low when the CPU is inputting data from any external source. Even though RD is output by the same physical pin under all circumstances. this signal is functionally part of the group which change their nature depending on signal complexity. We will therefore refer again to RD when describing the signals which are a function of system complexity. Q w ~ II: o D. II: o U ~ en w I- ct g CI) CI) ·ct oil w Z II: oIII CI) o ~ ct Q ct @ There are four interrupt and interrupt-related signals. INTR is a normal interrupt request input. NMI is a non-maskable interrupt request input. 8086 RESET RESET is a system reset signal; it must be input high to the 8284 clock generator for at least four ClK clock periods. The 8284 transmits a synchronized RESET signal to tho CPU. When the 8086 is reset, the following events occur: 1) I The Status register is cleared. This disables external interrupts. 2) The Program Counter and the three Segment registers. OS. SS. and ES. are cleared. 3) The CS Segment register is set to FFFF16. Following a Reset. program execution therefore restarts with the instruction located at memory byte FFFF016. These reset operations take approximately 10 clock periods to occur should occur. during which time no other operations TEST is not really an interrupt input. but it is used by program logic that otherwise would rely upon an interrupt. The 8086 has a special "Wait-for-Test" instruction that puts the CPU in~o a Idle state; this Idle state ends when the TEST input goes low. An 8080A (and other microprocessors) will duplicate the logic of the 8086 "Wait-for-Test" instruction by executing a "no operation" loop which is terminated by an interrupt request: ENI NOP JMP LOOP Enable interrupts Stay indefinitely in this loop Only an interrupt will terminate loop execution • - 1 There are eight pins which can output one of two signals, depending on whether MN/MX is tied to power or ground. By having two sets of signals. the 8086 can be used in simple configurations. best served by elementary control signals. or in complex configurations. where control signals must provide sufficient information to resolve the contentions and access conflicts that complex microcomputer systems may encouter. The two sets of signals may be illustrated as follows: Minimum Maximum Systems Systems MN/MX = Vee MN/MX = GND M/io - - - DT/R - - - DEN S2 51 SO 1" 00 0 0 , . . . . .'. 0})1 .•.'•. 1./ •. ., .• . . •. . . • 0 10 N o o ALE OSO M 0 0 A FEE 0 N E L E T TRW 0 0 1 0 1 N 0 B 0 0 E 1 0 B P S LOCK HOLD RO/GO RQ/G1 20-23 M M A 0 HLDA ·.··.•·0 H TRW 0 WR 1 I H OSl • I C INTA .,. •,. ,.• .:. . 01<./ .. <...•. . • .• . . .•.1'.'. . . •. . M N r_-----_ 8086 DUAL BUS COMPLEXITY Let us first look at the simple set of control signals which are output when MNli\iiX is connected to +5V. These are completely standard microprocessor control signals. 8086 SIMPLE CONTROL Since data and addresses are multiplexed on a single bus. AlE is output high to identify a valid memory address. SIGNALS When data are being transmitted or received via the Data/Address Bus. WR is pulsed low to identify data output, while RD is pulsed low as a request for external logic to place data on the Data/Address Bus. We have already described RD. It is not one of the changing signals; nevertheless. it is used by both simple and complex system busses. For a read or a write operation. M/IO indicates whether memory (M/IO high) or an I/O port (M/ffi low) is being accessed ' DT/R and DEN are two new control signals not found in earlier Intel microp~ocessors. These two control signals have been designed specifically to control 8286/8287-type bidirectional latched buffers. DTlR identifies the data direction. while DEN is the latching signal. The 8286 and 8287 latched buffers are described later in this chapter. . HOLD and HLDA are standard hold request/acknowledge signals. When external logic inputs HOLD high. the 8086 CPU enters a Hold state upon completing the current instruction's execution; the 8086 acknowledges the Hold State by outputting HLDA high. We will describe the Hold state in more detail later in the chapter. 8086 COMPLEX Let us now look at the complex System Bus which is generated when MN/MX is tied to ground. Control signals are output as a three-signal combination. decoded by a 3-to-8 decoder. CONTROL SIGNALS and a two-signal combination. decoded by a 2-to-4 decoder. Complex System Bus signals have been designed to act as inputs to an 8288 Bus Controller. _ _ _ _ _ _ _..1 S2. S1 and SO are decoded to provide eight separate control signals. However. the simple system signals M/IO. DTiR and DEN represent a subset of the eight S2. S1 and SO combinations. In our earlier illustration. we identify this simple . system subset by shading the applicable complex system S2. S1 and SO levels. The eight combinations of S2, S1 and SO generate the following control signals: S2 51 SO o o o o o o o 1 1 1 1 1 1 o o 1 1 1 o 1 o 1 o 1 INTA lOR lOW HALT IFETCH MEMR MEMW NONE Interrupt acknowledge I/O device read I/O device write CPU has executed a HALt instruction and is in the Halt state The CPU is fetching an instruction object code byte . Memory read Memory write The System Bus is inactive The control signal descriptions above use the words "read" and "write" as seen 'by the CPU. That is to say. a "read" operation moves data from a memory device or I/O port to the CPU. while a "write" operation moves data from the CPU to a memory location or I/O port. . OSO and OS 1 combine to identify conditions within the 8086 instruction object code queue soon. The aso and aS1 combinations are interpreted as follows: OSO OS1 o o o 1 1 1 o 1 NOOP OB1 OE OBS which we will describe No operation. This is the default case. The first instruction object code in the queue is being executed. The queue is empty. An instruction object code other than the first one in the queue is being executed. Observe that the simple bus signals INT A and ALE do not correspond to any combination of OSO and OS 1. This is in contrast to M/IO. DT /R and DEN. which constitute a subset of S2. S1 and SO. LOCK. RO/GT 0 and RO/GT 1 are not related to their simple system equivalent signals: WR. HOLD and HLDA. LOCK, Ra/GT 0 and Ra/GT 1 provide the 8086 with its System Bus priority and control logic in complex configurations. LOCK is output high to prevent the 8086 from losing bus control while executing a sequence of machine cycles that must not be interrupted. Typically these will be a memory access combination of read-modify-write machine cycles. where an error could result if the CPU lost bus control after the read and before the write. RO/GTo and RO/GT 1 are two-bus priority. bidirectional type signals. They are used to determine which CPU in a multiCPU configuration will at any time have control of a shared bus. We will discuss these signals in more detail later in the chapter when looking at the capabilities of the 8086 in multi-CPU shared bus configurations. 20-24 8086 TIMING AND INSTRUCTION EXECUTION cw ~ o D.. a: a: o u ~ The most important concept to understand when looking at 8086 instruction execution timing is the fact that 8086 bus control logic has been separated from the 8086 instruction execution logic. That is to say, the 8086 has an Execution Unit (EU), and a Bus Interface Unit (BIU). 8086 EXECUTION UNIT (EU) The Execution Unit (EU) contains Data and Address registers, the Arithmetic and Logic Unit, 8086 BUS plus the Control Unit. The Bus Interface Unit (BIU) contains bus interface logic, Segment INTERFACE registers, memory addressing logic, and a six-byte instruction object code queue. This may UNIT (BIU) be illustrated as follows: '--------' u) w t- g< CI) CI) AH AL I w BH BL CS 0000 a: CH CL OS 0000 OH OL SS 0000 < a!I Z oa:I CI) o SP ~ c< BP < SI © 01 .... ~ Bus Control Logic A ~. 8086 V ~ V Bus I I 1 I 2 I Control Unit (CU) 3 I 4 I I( ~ Instruction object code queue 5 I I A Instruction Reg. ;-. I I Status L-=t ..: I I Arithmetic and Logic Unit (ALU) iY 0000 ES 11 II ~ PC 6 I I I Execution Unit (EU) I Bus Interface Unit (BIU) I I The Execution Unit (EU) and the Bus Interface Unit (BIU) operate asynchronously. Whenever 8086 the Execution Unit is ready to execute a new instruction. it fetches the instruction object code INSTRUCTION from the front of the Bus Interface Unit instruction queue. then it executes the instruction in some QUEUE number of clock periods that have nothing to do with machine cycles. If the instruction object code queue is empty. then the Bus Interface Unit (BIU) executes an instruction fetch machine cycle - and the CPU waits for the instruction object code to be fetched. But the queue will rarely be empty. for reasons that will soon become apparent: therefore. the EU will usually not have to wait while an instruction fetch is executed. 20-25 If memory or an 1/0 device must be accessed in the course of executing an instruction. then the EU informs the BIU of its needs. The BIU executes an appropriate external access machine cycle in response to the EU demand. r-------.., The Bus Interface Unit (BIU). for its part. is independent of the Execution Unit(EU). and attempts to 8086 keep the six-byte queue filled with instruction object codes. If two or more of these six bytes are INSTRUCTION empty. then .the Bus Interface Unit (BIU) executes instruction fetch machine cycles - providing QUEUE the EU does not have an active request for bus access pending. If the EU issues a request for bus access while the BIU is in the middle of an instruction fetch machine cycle. then the BIU will complete the instruction fetch machine cycle before honoring the EU bus access request. 8086 BUS CYCLES If we look at the way clock logic is used by the 8086, the term "machine cycle" no longer applies. The EU does not use machine cycles; it executes instructions in some number of clock periods that are not subject to any type of machine cycle grouping. The only time clock periods are grouped is when the bus control logic wishes to access memory or I/O devices. Each external access requires four clock periods. This is the minimum amount of time required to handle the normal bus protocol which accompanies any transfer of information between a microprocessor and logic beyond the microprocessor. Since this is the only time the 8086 groups clock periods, it is more accurate to talk about 8086 bus cycles, rather than machine cycles. Figure 20-4 illustrates two 8086 bus cycles executed back-to-back. In common with machine cycles. 8086 bus cycles. as illustrated in Figure 20-4 assign individual clock periods to time specific events. Memory and 1/0 device addresses are output on the Datal Address Bus during T 1Data is transferred between the 8086 and memory or 1/0 devices during T 3 and T 4. If these two clock periods provide external logic with insufficient time to respond to an access. then Wait state clock periods (T w) may be inserted between T3 and T4. T 2 is a buffer clock period during which the Datal Address Bus stops outputting an address and starts outputting or inputting data. During T4 the CPU identifies the status of the next bus cycle or clock period. In simple configurations when MN/MX is tied to $5V. DTlRis the only external signal that changes state during T4. When MN/MX is tied to ground. 50.51. and 52 change state during T4. Thus. by examining these three status outputs. external logic knows whether to expect another bus cycle. and. if so. what type of bus cycle. Now if you look at Figure 20-4, there is very little about it that differentiates an 8086 bus cycle from any other microprocessor's machine cycle. The characteristic of the bus cycle which differentiates it from standard machine cycles is the fact that bus cycles occur only on demand. :,...4__- - - - BUS CYCLE : Tl T2 ------II.~lfooIl4__- - - - BUS CYCl.E - - - - - - I I...;: T3 T4: Tl T2 T3 I T4 I I ClK Plll7ll/1 V77J77J/t VI///IItt. V///////1 ~ . Output address du ring T 1 rI/////I.J rIL. / ...... / / ...... / / ...... / /1""""7"7"7"7"7"7"7"7"7"7"7"7"'7"'7"1 ~ V7J7lllllllJll/ t'l7J/:/llllll/ vmt//II/://IIA ~ Tu rn Bus arou nd duringT2 Perform memory accesses during T3 +'------------------t.~----periods ' W a i t state clock . In complex systems. status output in T4 identifies subsequent operations. Figure 20-4. Two 8086 Bus Cycles 20-26 8086 INSTRUCTION QUEUE Consider what happens when an instruction is executed. Beginning with the simplest case, the instruction object code queue within the Bus Interface Unit will be empty. When the EU requests an object code byte there is none, so the BIU executes a bus cycle which fetches the first byte of the instruction object code: c w ~ a: oD.. T1 a: o i I I T2 T3 T4 ClK u I I ~ I I en w ~ ~ oCI) Bus cycle fetches fi rst object code byte (j CI) ct oil w Z Let us assume that this particular instruction requires two bytes of object code: keeping things simple. we will illustrate another instruction cycle executed immediately to fetch the next instruction byte: a: o m CI) o I T4 T1 : T2 I T3 ~ I ct I T1: T2 : T3 : T4 I I I C ct ClK @ I I I I I 1 I I ~~ Bus cycle fetches first object code byte Bus cycle fetches second object code byte Let us suppose that this instruction reads a word of data from memory. then performs an arithmetic operation using this data. The instruction is going to require some number of clock periods to compute the effective address for the data memory location to be accessed (we will assume seven clock periods are needed!. Some additional number of clock periods will also be needed to perform the arithmetic operation (we will assume nine clock periods). In a normal microprocessor. this instruction might be executed as the following sequence of machine cycles: Machine Cycle 1 T1 : T2 I i T3 Machine Cycle 2 T1 : T2 I T3 I I I Machine Cycle 3 I Machine Cycle 5 Machine Cycle 4 T1 1 T2 : T3 : T4 T1: T2 I T4 T1: T2 : T3 I 1 1 ClK Fetch first object code byte Fetch second object code byte Machine Cycle 6 T1 : T2 I : T4 Compute data memory address Compute data memory address long Machine Cycle 7 Machine Cycle 8 i T41 T5 T1 I I I Fetch data from memory T1 I ClK Execute arithmetic operation in a standard machine cycle and a long machine cycle 20-27 I Start executing next instruction by fetching object code byte I But the 8086, having asynchronous CPU and Bus Control Unit logic, will use clock periods to execute the instruction illustrated above as follows: Bus Cycle 2 Bus Cycle 1 T1 I T2 : T3 i I T1 I i T2 : T3 I I Bus Cycle 4 Bus Cycle 4 Bus Cycle 3 I T3 I T4 T 1 : T2 : T3 I I l T4 T1 I CLK Ti EU EU asks for an object code byte. There is none, so the BCU fetches one. The E U needs a second object code byte. BCI BCI fetches a byte of object code in one bus cycle. BCI fetches a second byte of object code in one bus cycle. I Ti Ti Ti The EU computes a data memory address in 7 clock periods. At the end of the 7th clock period the CPU requests bus access. The EU waits for the requested data to be fetched by the BCU. Since the EU is not demanding bus access, the BCI fetches the next two object code bytes and stores them ir, the queue. At the end of bus cycle 4 the EU is requesting bus access, so the BCU services the CPU. BCI fetches data from memory location addressed by the CPU. I Bus Cycle 5. T1 Ti Ti Bus Cycle 6 T1 I T2 IT3 i T4 Bus Cycle 7 T1: T2 : T3 : T4 I I CLK I , I Ti Ti Ti EU The EU uses nine clock periods to . execute the required arithmetic operation. BIU Ithe instruction object code queue. Ti Ti : Ti The BI U contin, ues executive bus cycles to fill 20-28 I I I etc. , Ti I : The EU takes the etc. I next object code I byte from the : BI U queue and I starts executing the ! next instruction. etc. Now. the illustration above is not accurate because. you will recall. the 8086 fetches data in 16-bit increments. providing the data address lies on an even-byte boundary. Also. the BIU fetches instruction bytes and loads them into the queue only when there are at least two free bytes in the queue. Let us assume that all data does lie on even-byte boundaries. This is how our timing will now look: cw Bus Cycle 1 ~ oQ. a:: a:: o T1 I T2 : T3 I I Bus Cycle 2 i T4 T1 : T2 : T3 I I I I T4 Bus Cycle 3 T1: T2 : T3 I Bus Cycle 4 i T4 T1: T2 I I I I T3 I Bus Cycle 4 II T4 T1: T2 : T3 : T4 I Ti Ti : Ti I ClK U ~ enw EU ~ g CI) CI) ct o!I BIU w Z a:: o III CI) o ~ EU asks for an object code byte. There are none. so the BI U executes a bus cycle. BIU fetches two bytes of object code in one bus cycle. The CPU takes both of them. so the queue is immediately emptied. The EU computes a data memory address in 7 clock periods. At the end of the 7th clock period the EU requests bus access. The EU uses 9 clock periods to execute the arithmetic operation. The EU waits for the requested data to be fetched by the BCU. BIU fetches four bytes of object code in two bus cycles and stores them in the queue. which has two empty bytes left. I B I U fetches data from memory location addressed by the EU. The BIU fetches two more bytes of object code and stores them in the queue which is now full. I I The BIU is idl.e. ct ct C @ Ti I I I Ti ClK etc. I I EU BIU. Ti t The EU ends instruction execution and fetches one byte of object code from queue to execute next instruction. The BIU remains idle since only one byte of queue is empty. There are some important points to note regarding 8086 bus cycle timing. Bus cycles are a Bus Interface Unit (BIU) phenomenon. So far as the EU logic is concerned. bus cycles do not exist. The EU experiences periods of activity while executing instructions. and periods of inactivity while waiting for instruction object codes or data that the BIU must process via bus cycles. Periods of EU activity are timed by a sequence of clock periods. The EU makes no attempt to group clock periods into machine cycles. nor do EU clock periods have to occur in any special numeric combinations. So far as the BIU is concerned. clock periods are grouped into bus cycles only when data must be transferred to or from the 8086. First priority is given to a bus access request coming from the EU. If the EU is not requesting bus access. then the BIU executes instruction fetch bus cycles until the queue is full. These are the prerequisites for the BIU to execute an instruction fetch bus cycle: 1) The clock period which initiates the bus cycle would otherwise be an idle clock period. 2) The EU does not have an active bus access request pending. 3) There are at least two bytes empty in the queue. If the queue is full. then the BIU ceases to execute bus cycles: as illustrated above. a sequence of idle clock periods occurs. 20-29 Note that the CPU may have to wait for bus access. In the illustrations above, the CPU requires seven clock periods in order to compute a data memory address. At the end of the seventh clock period, the EU issues a bus access request to the BIU. But at this time the BIU is part way through executing an instruction fetch bus cycle. The BIU completes the instruction fetch bus cycle, then honors the EU bus access request. In the final illustration above, no bus cycle accompanies the beginning of a new instruction's execution. We are assuming that the next instruction executed has one byte of object code. This object code byte is fetched from the front of the queue - which then has just one empty byte. No bus cycle is executed to fetch the instruction object code, sihce it is taken out of the queue. Subsequently, the BIU does not execute an instruction fetch bus cycle since there is only one empty byte: there must be at least two empty bytes in the queue before the BIU will execute an instruction fetch bus cycle. Based on the foregoing discussion of BOB6 instruction fetch queuing, we can see that the BOB6 has essentially eliminated instruction fetch time. The only time the EU will have to wait while the BIU fetches instruction object codes is when a Branch-on-Condition instruction causes execution to branch out of the queue sequence, or when (for any reason) the memory accesses accompanying an instruction's e.xecution are so dense that the BIU has insufficient idle clock periods within which to insert instruction fetch bus cycles. 8086 MEMORY AND I/O DEVICE READ BUS CYCLE FOR SIMPLE CONFIGURATIONS Figure 20-5 shows timing for an BOB6 memory read bus cycle when MN/MX equals +5V; that is to say, for the minimum mode bus configuration. 1...........- - - - - - - - - - - One Bus Cycle - - - - - - - - - - - -....~: I I I I T1 T2 T3 T4 ClK ADO-AD15 -+----1----( A 16-A 19 - 1 - - - # - - - - ( BHE ALE M/iO --+----' DT/R" DEN Trailing edge of ALE latches address Figure 20-5. 8086 Memory Read Bus Cycle for a Minimum Mode System (MN/MX 20-30 = +5V) I The memory or 1/0 device address is output via the Address Bus BHE during clock period T 1. ADO-AD 15 starts floating in T2 while turning around internal pin logic so that data can be input during T3 and T4· Address lines A 16 through A 19 are all Iqw when an 1/0 device a*hess is being output. These address lines output status during T2. T3 and T4· Close to the end of T4. A16 through A19 start to float. Q w ~ a: oQ. a: o CJ ~ en w le( oo CI) CI) e( ell w Z a: o aI CI) o ~ e( Q e( @ BHE timing follows Address lines A 16-A 19: that is to say. BHE is output low for the time that A 16 through A 19 is out. ,I putting an address. The trailing edge of the high ALE pulse should be used as the "valid address" strobe. If your 8086 configuration demultiplexes the Data and Address Busses. then the Address Bus demultiplexing buffers should use the high-to-Iow transition of ALE as their latching strobe. Remaining control signals consist of MilO and RD. which are directed at external memory or 1/0 devices. plus DTiR and DEN. which are directed at b4S buffers. MilO differentiates between a memory access and an 1/0 device access. MilO will be high for a memory access bus cycle: it will be low for an 1/0 device access bus cycle. MilO will contribute to memory and 1/0 device select logic when memory and 1/0 devices have similar addresses. RD is pulsed low as a memory or 1/0 device read strobe. The addressed memory device must use this low signal to place data on 'ADO-AD15. DTiR and DEN are control signals designed to control bidirectional latched buffers on the Data Bus. DTiR is output low for the entire memory or 1/0 device read bus cycle: it should be used to turn the latched buffers around so that they will transmit data to the CPU. DEN subsequently acts as a latching strobe. These two signals have been designed specifically to work with the 828§ a'ld 8287 Data Bus transceivers: however. their logic is quite general. There is no difference between external timing for an instruction fetch or memory read bus cycle. Given the pipelining instruction fetch logic of the 8086. this makes sense. The only timing difference between a memory read bus cycle and an I/O device input bus cycle occurs at the M/IO signal. This signal will be low for the duration of an 1/0 input bus cycle, whereas in Figure 20-5 it is shown high for the duration of a memory' ~ead bus cycle. Except for this difference, Figure 20-5 also illustrates I/O input bus cycle timing for a simple 8086 configuration. During any simple configuration memory access operation, the following status is output on address lines A 16 through A 19: A 19/56 - Always 0 A 18/S5 - Interrupt enable status A17/S4 A 16/S3 - 0 0 0 1 t 1 1 0 t 1 L- Data segment access _ Code segment access or no access Stack segment access L...-_ _ _ _ _ _ _ Extra segment access L...-_ _ _ _ _ The interrupt enable status appearing on A 18 may be used to illuminate an indicator on a control panel. should there be one. This indicator will show whether interrupts ar!3 enabled or disabled at any time. This status has no other value. 53 and 54 together identify the memory segme~t wttich is being accessed. This is not very useful information. Even a code segment access cannot be interpreted as an instruction fetch', since data can be addressed out of the pro' gram segment. 8086 MEMORY OR I/O DEVICE WRITE BUS CYCLE FQR MINIMUM MODE Figure 20-6 illustrates timing for an 8086 memory or 1/0 device ~rite bus cycle when the 8086·is operating in a . minimum mode with MN/MX tied to +5V. Address output logic is identical in read and write bus cycles. As was the case for a read bus cycle, the address is output on tre Address Bus, together with BHE. during T 1. External logic should use the high-to-Iow transition of the ALE pulse in order to latch a valid address. During T2, ADO-AD15 switches to outputting data, while A 16-A 19 outputs status. The same status is output in read and write bus cycles. MilO is output high for the duration of a memory write bus cycle: it is output low for the duration of an I/O device write bus' cycle. 20-31 WR is output low beginning early in T 2 and ending shortly after T 3. Note that RD does not go low for a read bus cycle until halfway through T 2. For an 8286 or 8287 Bus Transceiver. or any similar device. DT iR is output high for the entire duration of the write bus cycle. This conditions the device to transmit data from the CPU to external logic. DEN is the chip enable signal provided for the bus transceiver. DEN is output high from the end of T 1 until the end of T4. Note that this high pulse is longer than the DE~' pulse accompanying a read bus cycle. 1 1 " ". "1 . .. _ - - - - - - - - - - - I I I T1 One Bus Cycle - - - - - - - - - - - - - - t..~11 T2 T3 T4 I I I I I ADO- AD 15 Data Out Status Out A16-A19 BHE ALE M/iD DT/R DEN Trailing edge of ALE latches address Figure 20-6. 8086 Memory Write Bus Cycle for a Minimu~ Mode System (MN/MX = +5V) An I/O w~ite bus cycle has timing identical to Figure 20-6. except that the M/IO signal will be low for the duration of the bus cycle. rather than high as shown in Figure 20-6. Wherever a memory word and an I/O port may have the same address. MilO must contribute to device select logic in order to discriminate between memory and I/O devices. The status output on A 16-A 19 is no more useful in a write bus cycle than it is in a read bus cycle. 8086 READ AND WRITE BUS CYCLES FOR MAXIMUM MODE It is not very rewarding looking at maximum mode memory or I/O access bus cycle timing. if we look at timing for an 8086 device on its own. This is bec~use in maximum mode. with MN/MX tied to ground. the 8086 has been designed to operate with the 8288 Bus Controller. Figures 20-7 and 20-8 provide maximum mode timing for the 8086 on its own when executing read or write bus cycles. Only the status signal levels differentiate memory or I/O access bus cycles. Tjming for the Address/Data Bus is id~!ltical in minimum and maximum modes. The read strobe RD does not change; however. remaining control signals become control inputs to the 8288 Bus Controller. 20-32 Observe that OSO and OS1 change levels on a clock period by clock period basis in order to identify events for individual clock periods. SO, S1 and S2 hold their levels from shortly before T 1 until shortly after the end of T 2. I cw I- oCt 0 a: D- I ""1.. - - - - - - - - - - - - - One Bus Cycle - - - - - - - - - - - -..... ~~I I I I T1 T2 T3 T4 I I I I I ClK a: 0 (J ~ en w ADG-AD15 Address Out A16-A19 Address Out I- oCt C3 0 en en oCt oll w Z BHE a: 0 a:I en aso, aS1 ~ oCt C oCt SO,Sl,S2 0 © RD Figure 20-7. 8086 Memory or I/O Read Bus Cycle for a Maximum Mode System (MN/MX = OV) i. I I I ~I One Bus Cycle I T1 T2 I I I I T4 T3 I I I ClK --+---i Address Out Data Out A 16-A 19 - - t - - - - ( Address Out Status Out ADG-AD15 aso, aS1 SO, Sl, S2 _ _ _ _-I Figure 20-8. 8086 Memory or I/O Write Bus Cycle for a Maximum Mode System (MN/MX = OV) 20-33 I I I The 8288 Bus Controller. described later in this chapter. decodes 50. 51 and 52 in order to generate control signals which are comparable to those illustrated in Figures 20-5 and 20-6. For a complete discussion of bus cycle timing in complex 8086 microcomputer configurations. see the discussion of 8288 Bus Controller. THE 8086 WAIT STATE 8086 Wait state logic is independent of the MN/MX pin connection and the external access bus cycle being ex. ecuted. In any bus cycle it is possible to insert one or more Wait clock periods (T W) between T 3 and T 4. In order to extend a bus cycle with Wait clock periods. external logic must input a low READY signal during T 2 of the bus cycle which is to be extended. The READY input to the 8086 must be synchronized with the falling edge of ClK at the end of T 2; this synchronized READY input is created by the 8284 clock generator. External logic will normally input an asynchronous READY to the 8284 clock device. which outputs a synchronous READY for the 8086. Wait clock periods will continue to be inserted to the bus cycle until READY goes high again. Timing is illustrated in Figure 20-9. All output signal levels are maintained for the duration of the Wait state. THE 8086 HOLD STATE The 80'86 can be forced into a Hold state, at which time all three-state signals are floated. The 8086 Hold state is used to enable direct memory access logic, and in addition to disable inactive 80986 devices when more than one CPU accesses' the same System Bus in a multi-CPU configuration. Tl T2 T3 TW T4 ClK ROY READY ROY is input by external logic to the 8284 clock READY is output by the 8284 clock, to be input to the 8086 Figure 20-9. The 8086 READY Input and Wait States In a minimum mode configuration,when MN/MX is tied to +5V, the 8086 has a traditional Hold request input (HOLD) and a Hold Acknowledge output (HLDA). Upon receiving a high HOLD input. the 8086 will complete execution"6f its current instruction bus cycle before entering the Hold state and outputting HlDA high. Timing may be !lIustrated as follows: T40rTi ClK HOLD HlDA 20-34 8086 HOLD IN MINIMUM MOD~ SYSTEM The 8086 samples the HOLD input on the low-to-high transition of ClK. Therefore, HOLD must make its transitions away from this sampling point: that is to say, HOLD must be stable when ClK is making its low-to-high transition. The 8086 will acknowledge the Hold request by outputting HlDA high during any idle clock period, or at the end of a bus cycle. If a bus cycle is being executed when a Hold request occurs, the Hold request will not be acknowledged until the end of T 4 for the currently executing bus cycle. cw ~ a: o0. a: o u ~ enw ~ (3 o en en < IllS w Z The Hold state will last until the HOLD input goes low again. The 8086 continues to sample the HOLD input on all lowto-high transitions of ClK: therefore, HOLD must make its high-to-Iow transition away from the rising edge of ClK. When HOLD goes low, the Hold state will immediately end and HlDA will be output low again. In 8086 maximum mode configurations where MN/MX is tied to ground, the HOLD and HlDA pins convert to bidirectional type control signals. There are two bidirectional signals: RO/GTO and RO/GT1. RO/GTO has higher priority than RIT/Gf1. 8086 HOLD IN MAXIMUM MODE SYSTEM Any~ern~o9l£...that wishes to put an 8086 CPU into the Hold state transmits a low pulse to RO/GTO or RO/GT1. The 8086 CPU will acknowledge this Hold request immediately, if a bus cycle is not being executed, or at the conclusion of a currently executing bus cycle. The 8086 acknowledges the Hold request by outputting a low pulse via the same RO/GT line: simultaneously the 8086 floats its three-state bus lines. External logic must allow at least one clock period to elapse following the Hold Acknowledge pulse, before attempting to input via the same pin. External logic terminates the Hold state by inputting another low pulse. Timing may be illustrated as follows: a: oen en I ' I Hold State-.,l I T4 or Ti 1....-I I o :'i: I < < @ c I I elK R O / G T _ - - _ ® ® © ® In the illustratio~bove, identifies the instant ~which external logic requests a Hold state by inputting a low pulse vi.a either RO/GT line. The 8086 samples RO/GT on the rising edge of ClK; therefore, all signal transitions on RO/GT'must occur away from the ClK low-to-high transitions. ' The 8086 will now acknowledge a Hold request during a bus cycle. If a bus cycle is in progress, then the Hold acknowledge will occur at the end of the bus cycle - that is to say, at the end of T 4. If a bus cycle is not in progress, then the Hold request will be acknowledged immediately. In the illustration above, identifies the low pulse which the 8086 will output as its Hold acknowledge. The Hold state will last until external logic again inputs a low pulse via RO/GT. This is identified above as Once again the 8086 samples RO/GT on the rising edge of ClK; therefore, RO/GT should be stable at this time. ® © . When the 8086 enters the Hold state, it continues executing instructions which it takes out of the pipeline, until a bus access is required. When the EU requires a bus access, it stops operating until the end of the Hold stateat which time its bus access request will be honored by the Bus Interface Unit. In the event that Hold requests occur simultaneously on RQ/GTO and RQ/GT1, the acknowledge pulse will be output on RQ/GTO. RO/GT1 will not be acknowledged until the Hold state initiated via RO/GTO has ended. When .one Hold state ends, another Hold state can begin immediately for either of these reasons: 1) RO/GT1 was active when RO/GTO was acknowledged: the RO/GT1 Hold request. being of lower priority, was denied and is pending. 2) While the 8086 was in a Hold state, a new hold request occurs on the other RO/GT line. If a new hold request occurs while the 8086 is in Hold state, priorities no longer apply. For example, if the CPU has ack!22...w~ed a Hold request occurring at RO/GT1 and is in a Hold state, then it will deny a new Hoid request arriving via RO/GTO until the current Hold state has ended. 20-35 If there is an active Hold request when the CPU ends a Hold state .. then the CPU will immediately acknowledge the pending Hold request. This may be illustrated as follows: Hold for RO/GTl in progress Hold for RO/GTO in progress r _L Low pulse input at RO/GTO End RO/GTl Hold and immediately stand RO/GTO Hold When a Hold state ends. if the CPU has a bus access request pending. the.nthe CPU bus access request will be denied until all active Hold requests have been acknowledged. Note that there are no 8086 instructions that specifically affect the .Ievel of RO/GTO or RO/GT1. That is to say. external logic is entirely responsible for the interfaces to .these two signals. We will discuss RO/GTO and RO/GTl in more detail later in this chapter when we look at some multiple CPU 8086 configurations, THE 8086 HALT STATE The 8086 enters a Halt state after a HALT instruction is executed. In the Halt state no signals are floated, and undefined data is output on the Data/Address Bus. No bus cycles can be executed while the 8086 is in the Halt state. When a Halt instruction is executed, a bus cycle initiates the Halt state. This Halt state initializing bus cycle has nothing to do with instruction fetch logic.' If the Halt instruction object code is fetched by the CPU from the queue. then there will be no preceding instruction fetch bus cycle. If the Halt instruction must be fetched from memory because the queue is empty. or is at the conditional end of a Branch-on-Condition. then the Halt initializing bus cycle will be preceded by an instruction fetch bus cycle. For a simple system, the HALT initialization bus cycle is given by Figure 20-5, except that RD, M/IO, DT/R and DEN are not active. ALE is active, although the address output has no meaning. For a complex system, the HALT initializing bus cycle is illustrated in Figure 20-10. The Halt state combination occurring at SO. S1 and S2 causes the 8288 Bus Controller to issue an ALE pulse before entering the Halt state; however. the occurrence of ALE could not be deduced simply by looking at 8086 timing. 1 ; . . . 1 1 I ! ! 1 ! t - - - - - - - - - - - - One Bus Cycle --------------lr;r;;.;: I Tl T2 T3 T4 I I ClK . ADO-AD15 --+-----( A16-A 19 ---+----( OSO.OSl SO,S1 .-1 ~"- _________ S2---i~________________~/r--------------Figure 20-10. 8086 HALT Instruction and Bus Cycle Timing for a Complex Bus Configuration 20-36 The Halt state is terminated by an interrupt request or a Reset. You can freely enter and leave a Hold state within an 8086 Halt state via any of the means that we have just described. The fact that the 8086 is in a Halt state in no way modifies Hold logic. THE 8086 LOCK cw ~ a: oa. a: o u ~ ui w ~ A potential for serious error exists in the Hold request/acknowledge logic of the 8086. The 8086 will acknowledge a Hold request occurring on the RO/GTO or RO/GT1 lines at the end of the current bus cycle. if one is being executed. or at the next idle clock period. if a bus cycle is not being executed. The 8086 does not wait until the conclusion of the current instruction's execution before acknowledging the Hold request. Therefore. if an instruction reads the contents of a memory location (or 1/0 port). modifies these contents. then writes it back. a Hold state may separate the read bus cycle from the write bus cycle: Read from memory location X Modify data g en en c( all w Z a: oa:l en o ~ c( cc( @ Write back to location X HOLD STATE This can cause unexpected errors. If the 8086 enters a Hold state after reading memory location X contents and before writing these contents back. then it is possible for external logic - either direct memory access logic or another Central Processing Unit - to modify the contents of memory location X while the 8086 is in the Hold state. Now when the 8086 writes back the modified word. it may destroy data which shou Id have been preserved. If a 16-bit data word lies on an odd-byte boundary. it will require two bus cycles to access the data word. Under normal circumstances. a Hold request could be acknowledged between the first and second memory access bus cycles. But what if the word being accessed gets modified during the Hold state? If the Hold state splits two memory read bus cycles. this is what the CPU is going to read: 7 07 I I --_./ '-....---""'~, 0 ~ High-order byte was read after Hold and is modified I Low-order byte was read before Hold and is not modified If a Hold state splits two memory write bus cycles. this is what ultimately gets written: 7 07 I'-...._ _ _ ~~ 0 I I _ _ _./ ""-...._ _ _'-/"""'7? - . ./ High-order byte is written after Hold and is not modified Low-order byte was written before Hold and gets modified You use the 8086 LOCK instruction in order to prevent the types of errors described above. When a LOCK instruction is executed, the LOCK signal is. output high for the duration of the next sequential instruction's execution. Also, while the next sequential instruction is being executed, a Hold request will not be acknowledged. You cannot extend protection against a Hold acknowledge beyond a single instruction's execution. For example. suppose you have two instructions. each of which is preceded by a Lock: LOCK AND LOCK OR MEMX. AX MEMX. BX In the instruction sequence above. MEMX is a label which represents the address of a memory location. The contents of this memory location are ANDed with a mask stored in· AX. then ORed with a mask stored in BX. The contents of MEMX are read. modified. and written back at each step. Now. you may wish to inhibit Hold logic for both the AND and the OR operation. You cannot do so using the LOCK instruction. The first LOCK instruction will protect the following AND instruction from being interrupted by a Hold state; however. any pending Hold state will be acknowledged before the second LOCK instruction is executed. Each Lock instruction extends protection against a Hold Acknowledge for the duration of the next sequential instruction only. The fact that the following insturction is also a Lock is irrelevant. The second Lock instruction will be the first instruction executed following the Hold state. and it will guarantee that no new Hold state begins until it. and the OR instruction. have both been executed. 20-37 8086 SINGLE You can use the LOCK instruction and signal to identify individual instruction execution INSTRUCTION times. If for any reason external logic needs to know the execution time for certain instructions. TIME then by preceding these instructions with a LOCK instruction you will generate a high pulse on IDENTIFIED the LOCK output. The width of this high pulse exactly equals the execution time of the instruction which follows the LOCK. ......_ _ _ _ _--1 THE 8086 PROCESSOR WAIT FOR TEST STATE The 8086 has a program-initiated Wait state which external logic must terminate via the TEST input signal. The WAIT instruction initiates this Wait state. After the WAIT instruction is ·executed. the 8086 generates an endless sequence of idle clock periods. This sequence lasts until external logic inputs a low signal at the TEST input. While the endless sequence of idle clock pulses is being executed. the System Bus is not floated and the Bus Interface Unit may execute memory read bus cycles in order to fill up the instruction object code queue. The processor Wait state can be used to synchronize an 8086 with any external time sequence. For example. you could start two programs. executing in two separate 8086 systems. at exactly the same time. by preceding each program with a Wait instruction. If both 8086's receive low TEST inputs simultaneously. then both microprocessors will start executing their programs at the same instant. THE 8086 PROCESSOR ESCAPE The 8086 has a special escape instruction (ESC) intended for use in multi-CPU configurations. When the ESC instruction is executed, the contents of an addressed memory location are input to the CPU, but the input data is not stored anywhere. The purpose of the ESC instruction is to place the'addressed data on the Data/Address Bus so that any other microprocessor (or external logic) connected to the Data/Address Bus can receive the data. We will examine the value of the ESC instruction later in the chapter when looking at the 8086 in multiple CPU configurations. THE 8086 RESET OPERATION The 8086 has an asynchronous Reset input. This signal can be input high at any time in order to reset the 8086. The high RESET must be at least four clocl< cycles long. The 8086 terminates all current operations as soon as the RESET input makes a low-to-high transition. Nothing more happens until the RESET signal subsequently makes a high-to-Iow transition. It then takes approximately ten clock periods in order to execute the following operations: 1) The Status register is cleared. Among other things. this resets the interrupt enable flag to O. thus disabling interrupts. 2) The CS Segment register is set to FFFF16. 3) The OS. SS and ES Segment registers and the Program Counter are all reset to O. 4) Program execution begins. Since the CS Segment register contains FFFF16 and the Program Counter contains. O. the first instruction executed is taken from memory location FFFF016. 8086 INTERRUPT PROCESSING The 8086 allows interrupts to originate in one of three ways: 1) From software or within program logic. 2) From external logic as a non-maskable interrupt. 3) From external logic as a maskable interrupt. There is. in addition. a special "single step" condition that makes use of interrupt logic. We will describe single stepping after our discussion of interrupt logic. In the event that two or more of the three interrupt types occur simultaneously. software generated interrupts have the highest priority and maskable interrupts have the lowest priority. These are the ways in which a software interrupt request may occur: 1) Following an attempt to divide by O. A special divide by 0 interrupt request will occur any time the divide instruction is executed with a 0 dividend. 2) Following execution of an Interrupt instruction (lNT). 3) Following execution of an Interrupt-on-Overflow instruction (INTO) set. 20-38 if theOve:rflow status is 8086 SOFTWARE INTERRUPTS Q w !ia: oa.. a: o (J ~ enw !i C3 o C/) C/) A non-maskable interrupt request is initiated when external logic inputs a low-to-high transition at the NMI pin. This is an edge-triggered signal. A non-maskable interrupt has lower priority than a software interrupt. but higher priority than a maskable interrupt. 8086 NONMASKABLE INTERRUPT A maskable interrupt request will be generated when external logic inputs a high level at the INTR pin. This input is level sensitive; it is the high level at INTR that causes the interrupt requests to occur. 8086 MASKABLE INTERRUPT Central to all 8086 interrupt processing is a Vector table that can be up to 1024 bytes in length. occupying absolute memory addresses 00000 through 003FF16. This Vector table consists of up to 256 four-byte entries. Each entry contains two 16-bit addresses which get loaded into the CS Segment reg~ster and th~ Program Counter. . 8086 INTERRUPT VECTOR TABLE Figure 20-11 illustrates tlle 8086 Interrupt Vector table. Interr'upt Ve~tor Memory Addresses Table c:( 00000 CSO w Z 00002 o 00004 pcb r---- all a: In C/) o ~ c:( Q c:( @ } Vector 0 - Divide by 0 } Vector 1 - Single-step mode } Vector 2 - Non-maskable interrupt } Vector 3 - I NT software interrupt (default option) } Vector 4 - INTO software interrupt } Vector 5 CSl 00006 PCl 00008 CS2 OOOOA PC2 OOOOC CS3 OOOOE PC3 00010 CS4 00012 PC4 00014 CS5 00016 PC5 I I I I 00078 CS30 0007A PC30 0007C CS31 0007E PC31 00080 CS32 00082 PC32 00084 CS33 00086 PC33 Reserved by Intel } Vector 3010 } Vector 3110 } Vector 3210 } Vector 3310 I User vectors I I 003F8 CS254 003FA PC254 oo3FC CS255 003FE PC255 I Interrupt } } Vector 25410 Vector 25510 I (2)-0-0-0 aCk~Owledge sequence 01 events is I I I I CSN PCN ~ 4 CS Register Program Counter To stack To stack Figure 20-11_ 8086 I nterrupt Vector 20-39 A number of the Vector table entries serve specific interrupts. Other entries are reserved by Intel and should be avoided if compatibility with Intel software is desired. These entries are identified in Figure 20-11. As illustrated in Figure 20-11,32 of the 256 interrupt vectors are not available to external logic; that leaves 224 vectors available to maskable external interrupts - which is plenty. Taking each of the three interrupt types in turn, let us examine the interrupt acknowledge process. When any of the software interrupts are acknowledged, the following steps occur: r-------, 8086 SOFTWARE INTERRUPT 1) The Status register contents are pushed onto the Stack; Stack Pointer contents. in consequence. are decremented by two. 2) The Interrupt and Test status flags are cleared; this enables maskable interrupts and single step logic (which we describe after our discussion of interrupt logic).' 3) The CS Segment register contents are pushed onto the stack; Stack Pointer contents. in consequence. are decremented by two. 4) The new CS Segment register contents are taken from the appropriate interrupt vector location. With the exception of the INT instruction. software-generated interrupts have dedicated vector locations as illustrated in Figure 20-11. The INT instruction allows anyone of the 256 vector locations to be selected; a default option selects Vector 3. 5) The Program Counter contents are pushed onto the Stack; Stack Pointer contents are decremented by two. 6) The new Program Counter contents are taken from the interrupt vector. When a non-maskable interrupt is acknowledged, the following events occur: 1) The Status register contents are pushed onto the Stack. The Stack Pointer contents are decremented by two. 2) The Interrupt and Test statuses are reset to 0; this disables non-maskable interrupts and single stepping mode. 3) The CS Segment register and Program Counter are reloaded from Interrupt Vector 2. See Figure 20-11. When a maskable interrupt is acknowledged, the following steps occur: 8086 NONMASKABLE INTERRUPT 8086 1) Two interrupt acknowledge bus cycles are executed by the Bus Interface Unit of the 8086. An MASKABLE interrupt acknowledge bus cycle is identical to the memory read bus cycles. as illustrated in _I_N_T_E_R_R_U_P_T_-, Figures 20-5 and 20-7. with the exception that an interrupt acknowledge low pulse replaces the memory read low pulse. For a minimum mode system. INTA will provide the low RD pulse shown in Figure 20-5. Figure 20-7 accurately illustrates timing for an interrupt acknowledge bus cycle in a maximum mode system; however. SO. S1 and S2 will all be output low. identifying an interrupt acknowledge. whereas a read I/O port or read memory status combination would be output otherwise. 2) The acknowledged external device must send back a byte of data on lines ADO-AD7 in response to the second interrupt acknowledge bus cycle. This data byte is interpreted as a pointer into the interrupt vector. Multiplying this 8-bit value by 4 creates the correct beginning address for the interrupt vector. 3) The Status register contents are pushed onto the Stack. 4) The Interrupt and Test flags in the Status register are cleared. This disables further maskable interrupts and single step logic. 5) The CS Segment register contents are pushed onto the Stack. 6) The next CS Segment register contents are taken from the interrupt vector location identified in Step 2. 7) The Program Counter contents are pushed onto the Stack. 8) The new Program Counter contents are taken from the interrupt vector location identified in Step 2. 9) The first instruction of the interrupt routine is fetched using the new PC and CS. It takes 60 clock periods to complete the nine interrupt acknowledge steps listed above. 20-40 You should use the IRET instruction to exit any interrupt service routine. This instruction restores Program Counter, CS Segment register, and Status register contents from the Stack. . 8086 INTERRUPT RETURN SINGLE STEPPING MODE c w !ia:: oQ. a:: o CJ ~ enw !i oo fI) fI) c( all w Z a:: o CD fI) o ~ c( Q c( @ When the T status bit is set to 1, the 8086 operates in single stepping mode. In the single stepping mode the 8086 executes a software interrupt after each instruction's execution. The software interrupt vectors through Location 1 of the interrupt vector table. as illustrated in Figure 20-11. Since the process of acknowledging an interrupt resets the TF flag. the single stepping mode will cease to exist once the interrupt service routine identified by Vector 1 is executed. But since the Status register contents prior to the interrupt acknowledge are saved on the Stack and are restored when a return from interrupt instruction is executed. single stepping mode will be restored as soon as the interrupt service routine corresponding to Interrupt Vector 1 concludes execution. Interrupt Vector lshould therefore vector to a debug routine. Any user program executed in the single step mode will now execute instructions one at a time. branching to the debug program following execution of each instruction. . A particularly pleasing aspect of the 8086 single step mode is the fact that it can cope with interrupt logic. Frequently. microprocessor programs cannot be debl!gged once interrupt logic is introduced. In the case of the 8086. the interrupt acknowledge process automatically takes the 8086 oUl of the single step mode. You can insert instructions into any interrupt service routine in order to restore single stepping mode for that particular interrupt service routine. Thus. you have the option of executing any program or interrupt service routine in single step mode. without impacting any other program or interrupt service routine. THE 8086 INSTRUCTION SET The 8086 instruction set is summarized in Table 20-4. When compared to other microprocessor instruction sets. the 8086 instruction set might appear quite large. If you look at Table 20-4. you will see that a single instruction mnemonic may appear many times. In reality. these are variations of the same instruction. We show the variations of a single instruction as though they were separate instructions in order to make this description of the 8086 instruction set consistent with similar tables for other microprocessors. The two I/O instructions, IN and OUT, becom~ eight instruct~ons because each has two sets of options. Each I/O instruction can access 16-bit words or 8-bit bytes. In each case. the instruction may have a short addressing range or a long addressing range. The short addressing range instruction requires two bytes of object code and can access one of the first 256 I/O port addresses. The I/O address is specified in the seconq object code byte. The long-range I/O instructions occupy only one byte of object code; however. register OX provides ~re I/O port aqpress - which can . therefore range between 0 and 65.53610. Primary memory reference instructions, and memory reference instructions in general, all have byte and word versions. In Table 20-4, the data memory location accessed is identified by' the operand label DAD DR. Because data memory reference instructions mayor may not include a displaceme~l. the object code may be two. three. or four bytes long. as defined in Table 20-5. By preceding any data memorY reference instruction with the SEG instruction. you can force the data memory reference to access a segment other than the data se'gment. Here. for example. are the two instructions that load a byte of data from the extra segment to Register AL. using direct. indexed addressing: ES SEG MOV AL. (Oil AOOR Select extra' segment Load data word from extra segment The LEA and LES instructions are unusual in that they load a memory address. rather than the contents of a memory location. into an identified 16-bit register. For the LEA instruction. this may be illustrated as follows: LEA AX. (01) AOOR Data Memory AX BX ex OX P p p p r-------------~ r-------------~ QQQQO RRRRP OS ~ . ~------------~ 20-41 RR R R P In the illustration above. RRRRP represents a five hexadecimal digit data memory address - the actual location which will be accessed. This address is the sum of 00000. the DS Segment register contents. and PPPP. the operand address. The LEA instruction loads the operand address PPPP into the identified 16-bit register. The LES instruction serves primarily to initialize the address register for string operations. As discussed earlier in this chapter. string ins~ructions access the extra segment via the DI and SI Index registers. The XLAT instruction is designed for table look-ups. An obvious application for an XLAT instruction would be to convert between ASCII and EBCDIC character codes. EBCDIC character codes being input could be translated into ASCII character codes. prior to being stored in memory. via the following instruction sequence: LABEL IN XLAT STOB LOOP PORTS Input an EBCDIC code Convert to ASCII Store in memory Return for next byte if there is one AL LABEL The instruction sequence above inputs character codes from 1/0 Port 5. These are assumed to be EBCDIC codes which arrive at the AL register. The XLAT instruction uses each EBCDIC code as an index into a conversion table whose base address is assumed held in the BX register. Part of this conversion table may be illustrated as follows: Memory [BX) + [ O S ) - PPPPP PPPPP + 81 6 1 PPPPP+ 82 6 2 PPPPP+ 83 6 3 PPPPP+ 84 6 4 ppppp + 85 6 5 PPPPP+ 86 6 6 PPPPP + 87 6 7 PPPPP+ 88 6 8 89 6 9 PPPPP + PPPPP+ 8A PPPPP+ 8B PPPPP+ 8C These bytes not used by the table. can be used in other ways PPPPP+ 80 PPPPP+ 8E PPPPP t 8F pppp~ 90 + PPPPP + 9'1 EBCOICcharacter c~es J 6 A iI :I ~ Equivalent ASCII character codes After the XLAT instruction has executed. the ASCII version of the input EBCDIC code will be in the AL register. The STOB instruction stores this ASCII code in the Extra Segment memory location addressed by the DI register: the DI register contents are then incremented so that on the next pass of the iterative loop it addresses the next free memory byte in the Extra Segment table. The LOOP instruction decrements the CX register and branches back to the IN instruction if the CX register contents are not zero. 20-42 Secondary memory reference instructions occur in four versions. Each instruction may access a memory byte or a memory word; in either case. the resHlt of the operation may be returned to a register. or to the memory word from which one operand was fetched. Note carefully that the Subtract c inst~uction inverts the Carry status. The following numeric options are available with Add, Subtract, Multiply and Divide instructions: w ~ IX: oD.. Operation o ~ IX: U en w ~ g (/) (/) ~ all w Z IX: o III (/) o ~ ~ c ~ @ Unsigned Binary Signed Binary Packed Decimal Unpacked Decimal 8-bit 16-bit 8-bit 16-bit 2 digit Add X X X X X Subtract Multiply X X X X X X X X X X Divide X X X X X 4 digit 1 digit 2 digit X X Let us first look at addition and subtraction. Little needs to be said about signed and unsigned binary addition or subtraction; these are standard operations described in Volume 1. The only point to note is that the 8086 Subtract instructions invert the Carry status. Packed binary coded decimal (BCD) addition and subtraction are also quite standard in that tl1ey closely follow the logic describe~ in Volume 1. However, like the 8080A, the 8086 uses Decimal Adjust instructions to handle packed binary coded decimal data. r---------, 8086 BCD ADDITION When you add two packed binary coded decimal numbers. it is assumed that the two numbers are indeed valid packed binary coded decimal data. The sum. which will not initially be a valid packed binary coded decimal number. is converted into one by the DAA instruction. This may be illustrated as follows: ADD DAA AL. BL Add BCD data in BL to AL Decimal adjust result Note that you can only add bytes. and AL must be the destination when adding packed BCD data. Using abbreviations of Table 20-4. DAA instruction logic ll1ay be summar!zed as follows: If (AU AND OF16 is greater than 0916. or if (AF) = 1. then: (AU ~ (AU +06 16 (AF)~1 If (All is greater than 9F16 or if (CF) (AU ~ = 1. then: (AL) + 6016 (CF)~1 If one of the numbers being added is not a valid packed binary coded decimal number. then no error indication is given. but the answer will be wrong. For example. there is nothing to stop you from adding 1F16 to A316 and then executing the DAA instruction to modify the sum; however. the result will be meaningless. When you subtract packed binary coded decimal numbers, once again it is assumed that the subtrahend and minuend are both valid packed binjlry coded ~ecimal numbers. The difference will initially be meaningless; however. executing the DAS instrlJciion generates a valid packed '1 binary coded decimal result. This may be illustrated~as fQllovys: ' . ; SBB DAS AL. BL 20-43 8086 BCD SiJBTRACT Once again you must subtract bytes. and the difference must be returned to the AL register. Using abbreviations of Table 20-4. DAS instruction logic may be ~ummarized as follows: If (All AND OF16 is greater than 0916. or (AF) = 1. then: (All +- (All -0616 (A F) +-1 If (All is greater than 9F16. or (CF) (All +-, (All - 6016 ' = 1. then: (CF) +-1 When you subtract packed binary coded decimal numbers and generate a negative result. the Carry status will be 0 (as is the case for binary subtraction) but the numeric negative difference will be a tens complement number rather than a twos complement number. Refer to Volume 1 for details. Ypu can also add and subtract unpacked binary coded decimal numbers. These numbers may occupy the low-order four bits of-a byte. leaving the high-order four bits empty: ' 101010101 1 1 1 1 o 000 .~ through 1 0 0 1. Or you may add and subtract ASCII c~aracters, An ASCII character contains the binary coded decimal digit in the loworder four bits and 0011 in the high-order four bits,.' ,If" • Wh'en you add unpacked binary coded decimal (BCD) digits, it is assumed that the two numbers being added are indeed valid ASCII characters or unpacked BCD digits. The sum is initially meaningless; however, after executing the AAA instruction it is converted into one or two valid unpacked binary coded decimal digits. Note carefully that the AAA instruction does not generate ASCII characters; it generates'one binary coded decimal digit per byte which the four high-order. bits Zero. AAA instruction operations may be illustrated as follows: If (AU AND OF 16 is greater than 0916 or (AF) (All +- (AU + 0616 = 1. then: (AH) +- (AH) + 1 (A F) +-1 Unconditionally: (AU +- (All AND OF 16 (CF) +- (A F) Note trat AH is incremented if the sum in AX is more than 0916. since 0916 is the highest one-byte unpacked BCD value that!s legal. ' When you subtracJ unpacked binary coded decimal numbers, you can subtract ASCII characters or.bytes which have the four hiQh-order bits blank. It makes no difference which option you choose; if you subtract two ASCII chara~ters you wilr~ancel out the four high-order bits - which are identical anyway. Assu~ing that th~:s4btrahend and minuend are initially valid un~acked binary coded decimal numbers. the difference. which initially is meaningless. will be converted into one or two valid unpacked binary coded decimal digits by executing th~ AAS instruction. This may be illustrated as follows: SUB AAS AL. BL 20-44 AAS instruction operations may be. summarized as follows: If (AL) AND OF16 is greater than 0916 or (AF) '" 1 then: (AL) +- (All - 6 (AH) +- (AH) - 1 c w ~ IX: oa.. (AF) +-1 Unconditionally: IX: (CFf+- (AF) U (AL) +- (ALl AND OF 16 o ~ ui w ~ g U) U) < o1J w If you generate a negative result when subtracting unpacked binary coded decimal numbers. the Carry status will be zero and the answer will bein its tens complement form. You can multiply unpacked binary coded decimal numbers, but not packed binary coded decimal numbers. The multiplier and multiplicand must each be one byte long. with a single binary coded decimal digit in the low-order four bits and 0000 in the high-order four bits. Consider the multiplication 7 x 8 = 5610. The instruction sequence: Z AL. BL MUL AAM IX: o IX! 8086 BCD MULTIPLICATION U) o ~ c< < @ results in these register contents' changes: Before o I _~ L.. After ----II __ : :~ AX ....;0~....;5_+1--=-~_:~-f1 :~ 1-1 Assuming that the multiplier and multiplicand are valid. as i'lIustrated above. the product will initially b~ meaningless. However. after executing the AAM instruction. a valid two-digit product will be generated. with the high-order digit in the AH register and the low-order digit in the AL register. AAM instruction logic is, in fact, quite simple. It may be illustrated as follows: (AH) +- (All /OA16 (/ means "divided by") . (All +- (AL) modulo OA16 Consider again 7 x 8 = 5610. This is initially computed as 7 x 8 = 381S: therefore. AH contains 00 and AL contains 38 before the AAM instruction is executed. (AL)/OA16'" 5 Therefore. 05 is loaded into AH. "Modulo" is the remainder after division: therefore (AU modulo OA1S is the remainder following (AU/OAls: it is 6. which is loaded into AL. Binary coded decimal multiplication does not take sign into account. It is up to your program logic to keep track of the sign. Binary coded decimal division, like multiplication, works only with unpacked binary coded decimal data. However. you must execute the AAD instruction before the DIV instruction in order to generate a valid unpacked binary coded decimal answer. This may be illustrated as follows: AAD DIV 8086 BCD DIVISION AX. BL The AAD instruction takes the dividend. which we assume to be a valid unpacked binary coded decimal number in the AX register. and packs it into the AL register as follows: (AL) +- (AH) * OA16+ (AL) (AH) +-0 Consider the reverse of our multiplication examples: 56/8 = 7 20-45 Initially. AH contains 05 and AL contains 06. After the AAD instruction is executed. AL contains: 0516 * OA16 + 0616 which is 3816. Thus the DIV instruction can perform a pure binary division. The 8086 allows you to shift and rotate the contents of memory bytes or words. This is very useful since it allows counters and masks to be held in memory. rather than in CPU registers as is the usual case. Immediate instructions allow immediate data to be loaded into registers or memory locations. When loading immediate data into memory locations. you can generate 3.4. 5 or 6 byte instruction object codes. depending on the length of the immediate data and the addressing options. See Table 20-5 for details. The Loop instructions are. in fact. variations of the multi-byte. string-handling 8086 capability. These instructions allow you to set up a counter in the CX register. which is decremented in order to identify the number of iterations for any instruction loop. This may be illustrated as follows for the 8080A and the 8086: 8086 8080A MVI MOV C. COUNT NEXT +- Initialize counter CX. DATA NEXT } OCR C JNZ NEXT R,.,.,,,d ;o","otlo", +- Gount and loop logic LOOP NEXT Jump-on-Condition instructions are limited in that they all provide an 8-bit signed binary displacement. Thus. you are limited to jumping within a 256-byte program relative memory page. Jump-on-Condition instructions are confusing at the best of times. pecause status combinations determine whether a jump will or will not occur. This is not very interesting information to you as a programmer. It is much easier to jump based on signed and unsigned binary numbers being less than. greater than. or equal to each other. Table 20-2 therefore summarizes the way in which you should use 8086 Jump-on-Condition instructions. This table is similar to the table on page 7-29 of Volume 1; however. the Carry statu's is inverted. since the 8086 Subtract instruction inverts the Carry status. The way the 8086 creates Block Transfer and Search instructions is interesting. You begin with a set of instructions; e~ch of which p~rforms a single operation. Each of these instructions can be made to repeat some number of times by preceding the instruction with a repeat (REP). For example. the MOVW instruction. executed on its own. will move one 16-bit word of data from a source memory location to a destination memory location. using Data Segment and Extra Segment addressing as follows: ~: I L L L L M M M M 51 P P P P 01 Q Q Q Q I .- B I L L L 0 L Memory I~MMMMO B I Origin of extra segment I I I I I I I I I I '\ I I I MMMMO+QQQQ 20-46 I I I .~ Table 20-2. 8086 Branch-an-Condition I nstructians Q w ~ a: ona: o o a; en w ~ g STATUS CONDITIONS . C = 1 or Z = 1 C=1 Z=1 Z=O C = 0 or Z = 0 C=O Z = 1 or S XOR 0 = 1 S XOR 0 = 1 Z=1 Z=O Z = 0 or S XOR 0 = 0 S XOR 0 = 0 JBE, JNA JB, JNAE JE, JZ JNE, JNZ JA, JNBE JAE, JNB JLE, JNG JL, JNGE JE, JZ JNE, JNZ JG, JNLE JGE, JNL 0=0 0=1 P= 1 P=O S=O S= 1 JCXZ JNO JO JP, JPE JNP, JPO JNS JS Branch Branch Branch Branch Branch Branch Branch CI) CI) oct ail w Z a: o CD CI) 8086 INSTRUCTION BRANCH CONDITION Unsigned branch on less than or equal Unsigned branch on less Unsigned branch on equal Unsigned branch on not equal Unsigned branch on greater Unsigned branch on greater than or equal Signed branch on less than or equal Signed branch on less Signed branch on equal Signed branch on not equal Signed branch on greater Signed branch on greater than or equal on on on on on on on counter decrement to zero no overflow overflow even parity odd parity positive negative i ~ :J il 15 ~ ....o u ... ~ 0 0'" ';: ~ u ... :J .... ... .0 .... :J .S ~ S! 0) .... f- <0 ~ .r=*- - .r= ~ g C V) <0 C .g ~Eg ~.o 5l OJ .r= II) II) a.~ <0 f-t; o :!: oct Q oct But. precede this instruction with a repeat and you move an entire block of data. This may be illustrated as follows: @ I L L L L M M M M SI P P P P DI Q Q Q Q N N N N :: I • LLLLO Memory § I CX I I I B I I I I I I I MMMMO LLLLO+PPPP +NNNN § § I I I I I I I I I I QQQQ§ I MMMMO+ I Origin of extra segment I I I I I I I I MMMMO+QQQQ§ +NNNN I 20-47 I When a Block Transfer or Search instruction is executed, the Program Counter contains the address of the prior instruction until it and the Block Transfer or Search instruction has completed executing. For example. when the REP and MOVW instruCtion pair executes. the Program Counter keeps pointing to the REP instruction as follows: REP - PC points here until end of block move MOVW Only after the MOVW instruction has executed the number of times specified by the repeat will the Program Counter advance to the instruction following MOVW. This little piece of logic is designed to protect repeat instructions during interrupts. Interrupts are not locked out for the duration of a repeat instruction's execution; that would create intolerable delays between an interrupt request and acknowledge. Providing interrupts are enabled. an interrupt request can be acknowledged at any time during a repeat loop. Within the interrupt service routine. it is only necessary that you save the contents of the 51. 01. and CX registers in order to preserve the repeat loop logic. When you return from the interrupt. the Program Counter is pointing the ,REP instruction which picks up where it left off. using the restored contents of the 51. 01. and CX registers. A problem arises if you precede a Block Transfer or Search instruction with more than one single prefix. Suppose, for example, y.ou have a LOCK and a REP instruction preceding an MOVW: REP LOCK. MOVW The LOCK must directly precede MOVW; otherwise. it wou Id protect REP against a Hold. The Program Counter points to the LOCK instruction. not the REP instruction. while the MOVW repeatedly executes the specified number of times. If at some point an interrupt request is acknowledged, then after the interrupt service routine completes execution you will retu'rn to the LOCK instruction. not the REP. This will cause the MOVW instruction to be executed once more, rather than the number of times remaining in the repeat loop, as specified by the CX register contents and the REP instruction. Thus. if both prefixes must be used. then interrupts should be disabled. 8086 - 8080A INSTRUCTION COMPATIBILITY As we have already stated, the 8086 instruction set is upward compatible with the 8080A at the source program level. That is, every 8080A instruction can be converted to one or more 8086 instructions. Table 20-6 identifies the source program conversions recommended by Intel. These are by no means the only conversions which are possible, but they are the ones you should use, since they are the ones that Intel plans to support. THE BENCHMARK PROGRAM The 8086 makes short work of our Benchmark program, which is well suited to the 8086 block transfer instruction. We assume that the 1/0 buffer and the table being filled both lie within single 65.536-byte program segments. The displacement to the beginning of the 1/0 buffer is loaded into the 51 Index register. while the displacement to the first free byte of the data table is loaded into the 01 Index register. Our Benchmark program now consists of these few instructions: MOV LE5 MOV REP MOVW MOV 51. 10BUF 01. AOOR' Load 1/0 Buffer base address displacement in 51 CX.COUNT' Load word count into CX AODR.OI Move the data block Return new address of first free table byte Load Data table starting address in E5 and displacement to first free byte in 01 20-48 The following abbreviations are used in Table 20-4: Q w ~ a: oD.. a: o o ~ u) w ~ g (I) (I) ~ CI/I w Z a: oco (I) o :E ~ Q ~ @ AH AL AL7 AX AX 15 BH BL BRANCH BX C CH CL CS CX DADDR . DATA8 DATA16 DH DI DISP DISP8 DL DS DX EA ES I I/D LABEL N o OEA PC PDX PORT RB RBD RBS RW RWD RWS SEGM SFR SI SP SR SS U V X ]] [[ [ ] Accumulator. high-order byte Accumulator. low-order byte The value of register AL high-order bit (0 or 1) extended to a byte (0016 or FF1S) Accumulator. both bytes The value of register AH high-order bit (0 or 1) extended to a 16-bit word (OOOOIS or FFFF1S) B register. high-order byte B register. low-order byte Program memory direct address. used in Branch addressing option shown in Tables 20-1 and 20-2 B register. both bytes Carry status C register. high-order byte C register. low-order byte Code Segment register C register. both bytes Data memory address operands identified in Table 20-2 Eight bits of immediate data 16 bits of immediate data D register. high-order byte Destination Index register An 8-bit or 16-bit signed displacement An 8-bit signed displacement D register. low-order byte Data Segment register D register. both bytes Effective data memory address using any of the memory addressing options identified in Table 20-2 Extra Segment register . Status flag set to 1 Increment/decrement selector for string operations: increment if D is O. decrement if D is 1 Direct data memory address. as identified in Table 20-2 A binary digit (0 or 1) Status flag reset to 0 Offset data memory address used to compute EA: EA = OEA + [DS] • 16 Program Counter I/O port addressed by DX register contents: port number can range from 0 through 65.536 A label identifying an I/O port number in the range 0 through 25510 Anyone of the eight byte registers: AH. AL. BH. BL. CH. CL. DH or DL Any RB register as a destination Any RB register as a source Anyone of the eight 16-bit registers: AX. BX. CX. DX. SP. BP. SI or DI Any RW register as a destination Any RW register as a source Label identifying a 16-bit value loaded into the CS Segment register to execute a segment jump Status Flags register Source Index register Stack Pointer Anyone of the Segment registers CS. DS. ES or SS Stack Segment register Status flag modified. but undefined Any number in the range 0 through 25510 Status flag modified to reflect result Contents of the memory location addressed by the contents of the location enclosed in the double brackets The contents of the location enclosed in the brackets Data on the right-hand side of the arrow is moved to the location on the left-hand side of the arrow Contents of locations on each side of - - are exchanged The twos complement of the value under the Not equal to 20-49 Table 20-3. A Summary of I ntel8086 Memory Addressing Options Identified by the EA Abbreviations in Table 20-3 , - - - - - - - - - - - - - - These columns contribute to EA. - - - - - - - - - - - - - - - - - . , These columns contribute to OEA.----------"""') ( POSSIBLE DISPLACEMENTS MEMORY REFERENCE SEGMENT REGISTER BASE REGISTER INDEX REGISTER 16-BIT, UNSIGNED a·BIT, HIGH ORDER BIT EXTENDED NORMAL DATA MEMORY REFERENCE STACK STRING DATA INSTRUCTION FETCH BRANCH I/O DATA None ES None SI 01 CS PC None CS PC DS DX None None X * The segment override allows DS or SS to be replaced by one of the other segment registers X These are displacements that can be used to compute memory addresses. / / This column to be provided 1 ! Shaded rows apply to EA and DADDR . ..., . Shaded row applies to EA and LABEL. 20-50 NONE ASSEMBLY LANGUAGE OPERAND MNEMONIC © ADAM OSBORNE & ASSOCIATES, INCORPORATED Table 20-4. The 8086 Instruction Set Summary STATUSES TYPE MN.EMONIC OPERAN.D(S) ., g BYTES 0 IN PORT 2 IN [OX) 1 INW PORT 2 INW [OX) 1 OUT PORT 2 OUT [OX) 1 OUTW PORT 2 OUTW [OX) 1 LOS RW,OAOOR 2,3 or 4 LEA RW,OAOOR 2,3 or 4 LES RW,OAOOR 2,3 or 4 MOV RB,DAOOR 2,3 or 4 MOV RW,OADOR 2,3 or 4 MOV DADDR,RB 2,3 or 4 MOV OAOOR,RW 2,3 or 4 MOV AL.LABEL 3 MOV AX,LABEL 3 w U Z w a: w II.. w a: > a: 0 :2: w :2: > a: II: 0 ~ w ~ > II: II: ADD DADDR,RW 2,3 or 4 X X X X X X AND RB,DADDR 2,3 or 4 0 X X U X 0 1 c. 0 > 0 E ~ w u zw II: w II.. w II: > II: 0 ~ ~ a: 0 :E ·W :E > a: ct D 2 0 u W en OPERATION PERFORMED [RW) +- [EA) AND [RW) . AND the 16-bit contents of register RW with the data memory word addressed by DADDR. Store the result in RW [EA) +- [EA) AND [RB) AND the 8-bit contents of register RB with the data memory byte addressed by DADDR. Store the result in the addressed data memory byte [EA) +- [EA) AND [RW) AND the 16-bit contents of register RW.with the data memory word addressed by DADDR. Store the result in the addressed data memory word [RB) - [EA) Subtract the contents of the data memory byte addressed by DADDR from the contents of register RB. Discard the result, but adjust status flags [RW) - [EA) Subtract the 16-bit contents of the data memory word addressed by DADDR from the contents of register RW.Discard the result, but adjust status flags [EA) - [RB) Subtract the 8-bit contents of register RB from the data memory byte addressed by DADDR . Discard the result, but adjust status flags [EA) - [RW) Subtract the 16-bit contents of register RW from the data memory word addressed by DADDR. Discard the result; but adjust status flags [EA) +- [EA) - 1 Decrement the contents of the memory location addressed by DADDR. Depending on the prior definition of DADDR, an 8-bit or a 16-bit memory location may be decremented [AX) +- [AX) /lEA) Divide the 16-bit contents of register AX by the 8-bit contents of the memory byte addressed by DADDR. Store the integer quotient in AL and the remainder in AH. If the quotient is greater than FFJ6> execute a "divide by .0" interrupt [OX) [AX) +- [OX) [AX) /lEA) Divide the 32-bit contents of registers OX (high order) and AX (low order) by the 16-bit contents of the memory word addressed by DADDR. Store the integer quotient in AX and the remainder in OX. If the quotient is greater than FFFFJ6 , execute a "divide by 0" interrupt [AX) +- [AX) /lEA) Divide the 16-bit contents of register AX by the 8-bit contents of the memory byte addressed by DADDR, treating both contents as signed binary numbers. Store the quotient, as a signed binary number, in AL. Store the:remainder, as an unsigned binary number, in AH. If the quotient is greater than 7F16' or less than -80J6 ;execute a "divide by 0" interrupt [OX) [AX) +- [OX) [AX)/[EA) Divide the 32-bit contents of register OX (high order) and AX (low order) by the 16-bit contents of the memory word addressed by DADDR. Treat both contents as signed binary numbers. Store the quotient, CIS a signed binary nymber ,in AX. Store the remainder, as an unsigned binary number, in AH. If the quotient is greater than 7FFFJ6 , or less than -800016> execute a "divide by 0" interrupt - Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE. MNEMONIC OPERAND(S) BYTES o D I. r OPERATION PERFORMED S ZAP C IMUL AL,DADDR 2,3 or 4 X U U U U IMUL AX,DADDR 2,3 or 4 X U U U U X INC DADDR 2,3 or 4 X X X X MUL AL,DADDR 2,3 or 4 X U U U U MUL AX,DADDR 2,3 or 4 X U U U U X NEG DADDR 2,30r4 X XX NOT DADDR 2,3 or 4 OR RB,DADDR 2,3 or 4 X OR RW,OADOR 2,3 or 4 OR DADDR,RB OR RCL X X [AX) +- [ALI * [EA) Multiply the 8-bit contents of register AL by the contents of the memory byte addressed by DADDR. Treat both numbers as. signed binary numbers. Store the 16-bit product in AX [OX) [AX) +- [AX) * [EA) Multiply the 16-bit contents of register AX by the 16-bit contents of the memory word addressed by DADDR. Treat both numbers as signed binary numbers. Store the 32-bit product in DX (high order word) and AX (low order word) [EA) +- [EA) + 1 Increment the contents of the memory location addressed by DADDR. Depending on the prior definition of DADDR, an 8-bit or a 16-bit memory location may be incremented [AX) +- [ALI * [EA) Multiply the 8-bit contents of register AL by the contents cif the memory byte addressed by DADDR. Treat both numbers as unsigned binary numbers. Store the 16-bit product in AX [OX) [AX) +- [AX) * [EAi Multiply the 16-bit contents of register AX by the 16-bit contents of the memory word addressed by DADDR. Treat both numbers as unsigned binary numbers. Store the 32-bit product in DX (high order word) and AX (low order word) [EA) +- [EA) Twos complement the contents of the addressed memory location. Depending on the prior definition of DADDR, an 8-bit or 16-bit memory location may be twos complemented [EA) -NOT [EA) Ones complement the contents of the addressed memory location. Depending on the prior definition of DADDR, an 8-bit or 16-bit memory location may be ones complemented [RB) +- [EA) OR [RB) OR the 8-bit contents of register RB with the data memory byte addressed by DADDR. Store the result in RB [RW)""': [EA) OR [RW) OR the 16-bit contents of register RW with the data memory word addressed by DADDR. Store the result in RW [EA) +- [EA) OR [RB) OR the 8-bit contents of register RB with the data memory byte addressed by DADDR. Store the result in the data memory byte [EA) +- [EA) OR [RW) ·OR the 16-bit contents of register RW with the data memory word addressed by DADDR. Store the result in the data memory word Rotate the contents of the data memory location addressed by DADDR left through the Carry status. If N = 1, then rotate one bit position. If N = CL, then register CL contents . provides the number of bit positions. Depending on prior definition, DADDR may address a byte: C [EA) 0 1 X c. 0 ~ 0 E N 9 Ul ~ ~ X X X ox. X U X X X X X U X X 2,3 or 4 X X X U X X DADDR,RW 2,3 or 4 X X X U DADORN 2,3 or 4 X w 0 zw a: _oW u.. ,W a: > a: 0 ::iE w ° ::iE > a: « 0 z 0 0 w en X X X C:t-tdididid t ' or OADDR may address a word: C [EA) [EA + 1) 4tjd4+f4d4dtLd4;+444;+t l ©ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC RCR ROL OPERAND(S) DADDR.N DADDR,N BYTES 2,3 or 4 2,3 or 4 o X X D OPERATION PERFORMED I T S ZAP C X X As RCL, but rotate right Rotate the contents of the data memory location addressed by DADDR left. Move the left most bit into the Carry status. If N = 1, then rotate one bit position. If N = CL, then register CL contents provides the number of bit positions. Depending on prior definition, DADDR may address a byte: C [EA] ~ Ji Ji Ji J] or DADDR may address a word: C [EA] ~ CD ~ Co ROR SAL DADDR,N DADDR,N 2, 30r 4 2,30r4 X X X X X UX X o ~ o E !w II: II: SAR DADDR,N 2,30r4 X X X U X X As SAL, but shift right and propagate.sign.: [EA] C 4Jtfththt+-----f] o ::a: w ::a: [EA] [EA+1] C [f1 t h t h F h t i-h t h t h t h t +-tJ > II: II: C Z +0 or DADDR may address award: _ C [EA] zW W U. W As ROL, but rotate right Shift the contents of the data memory location addressed bV DADDR left. Move the left most bit into the Carry status. If N = 1, then shift one bit position. If N = CL, then register CL contents provides the number of bit positions. Depending on prior definition, DADDR may address a byte: C [EA] [3-f J i J i J j J u [EA+1] 4 1 4 i 4 14 j--f4 i J i J i J ] SBB RB,DADDR 2,3 or 4 X X X X X X SBB RW,DADDR 2,3 or 4 X X X X X X SBB DADDR,RB 2,3 or 4 X X X X X X SBB DADDR,RW 2,3 or 4 X X X X X X o U w CIl or [RB] +- [RB] - [EA] - [C] Subtract the contents of the data byte addressed by DADDR from the contents of 8-bit register RB, using twos complement arithmetic. Decrement the result in RB if the Carry status was initially set [RW] +- IRW] - lEAl - IC] Subtract the contents of the 16-bit data word addressed by DADDR from the contents of the 16-bit register RW, using twos complement arithmetic. Decrement the result in RW if the Carry status was initially set [EA] +- [EA] - [RB] - [C] Subtract'the contents of 8-bit register RB from the data byte addressed by DADDR, using twos complement arithmetic. Decrement the result in data memory if the Carry status was initially set [EA] +- [EA] - [RW] - [C] Subtract the contents of 16-bit register RW from the 16-bit data word addressed by DADDR, using twos complement arithmetic. Decrement the result in dat~. memory if the Carry status was initially set Table 20-4~ The 8086 Instr~ction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES 0 SHL SHR DADDR,N DADDR,N 2,30r4 2,3 or 4 X X D I T OPERATION PERFORMED S Z A P C X X U X X X U X X X This'is an altern'ate mnemonic for SAL As SAL, but shift right: [EA] C °t ~ r ~ r ~ r ~t-EJ ~ r tt tt tH-} r t-r t t t t-EJ [EA] [EA+1] C orot Gi SUB RB,DADDR '2,3 or 4 X X X X X X a. 0 SUB RW,DADDR ,2,3 or 4 X XX X X X SUB DADDR,RB' 2,3 or 4 X X XX X X SUB DADDR,RW 2,3 or 4 X X X X TEST DADDR,RB 2,3 or 4 0 X X U XO TEST DADDR,RW 2,30r4 0 X X U X 0 XOR RB,DADDR 2,30r 4 0 X X U X 0 XOR RW,DADDR 2,3 or 4 0 X X 0 XOR DADDR,RB 2,3 or 4 0 X X U X 0 XOR DADDR.RW 2,3 or 4 0 X X U X 0 I- MOV DADDR,DATA8 3,4or 5 C MOV DADDR, DATA 16 4,50r6 S ~ 0 E ~ w 0 Z N o m 0) w ex: w u. w 'ex: >ex: X X 0 ~ w ~ >ex: < C Z 0 0 w en w X U < w ~ ;§ ," .[RB] :.- [RB] - [EA] Subtract the contents of the data memory byte addressed by DADDRfrom the contents of 8-bit register RB, using twos complement arithmetic [RW] -- [RW] - [EA] Subtract the contents of. the 16-bit data memory word addressed by DADDR from the contents of 16-bit register RW, using twos complement arithmetic [EA] -- [EA] - [RB] Subtract the contents of 8-bit register R B from the data memory byte addressed by DADDR, using twos complement arithmetic [EA] -- [EA) - [RW] Subtract the contents of-16-bit register RW from the 16-bit data memory word addressed by DADDR, using twos complement arithmetic [EA] AND [RB] AND the 8-bit contents of the data memory location addressed by DADDR with the contents of 8-bitregister RB. Discard the result, but adjust status flags appropriately [EA] AND [RW) AND the 16-bit contents of the data memory word addressed by DADDR with the contents of 16-bit regi,ster RW. Discard the result, but adjust status flags appropriately [RB] -- [RB] XOR [EA] Exclusive OR the 8-bit contents of register RB with the data memory byte addressed by DADDR. St~re the result in RB [RW] -- [RW] XOR [EA] Exclusive OR the 16-bit contents of register RW with the 16-tiit data memory word addressed by DADDR. Store the result in RW [EA] -- [RB] XOR [EA] Exclusive OR the 8-bit contents of register RB with the data memory byte addressed by DADDR. Store the result in the addressed data memory byte [EA] -- [RW) XOR [EA) Exclusive OR the 16-bit contents of register RW with the data memory word addressed by DADDR. Store the result in the addressed data memory word [EA) -- DATA8 Load the immediate data byte DATA8 into the data memory byte addressed by DADDR [EA) -- DATA16 Load the immediate 16-bit data word DATA 1'6 into the data memory word addressed by DADDR © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES 0 w tct MOV RB,DATA8 3 MOV j'W.DATA16 4 JMP BRANCH JMP BRANCH.sEGM 5 JMP DADDR 2 Ci w :E ~ 2or3 Q.. :E .,:::> JMP .DADDR,CS 2 CALL BRANCH 3 CALL BRANCH.sEGM 5 CALL DADDR 2 CALL DADDR,CS 2 z a: :::> tw a: Q Z ct -I -I ct U w Z ~ :::> 0 1 a: m RET en RET CS 1 RET DATA16 3 RET CS,DATA16 3 :::> D I T S Z A P C OPERATION PERFORMED [RB] +- DATA8 Load the immediate data byte DATA8 into 8-bit register RB [RW] +- DATA16 Load the immediate 16-bit data word DATA16 into 16-bit register RW [PC] +- [PC] + DISP Jump direct to program memory location identified by label BRANCH. The displacement DISP which must be added to the Program Counter will be computed as an 8-bit or 16-bit signed binary number, as needed, by the assembler [PC] +- DATA16, [CS] +- DATA16 Jump direct into a new segment. BRANCH is a label which becomes a 16-bit unsigned data value which is loaded into PC. SEGM is a label which becomes another 16-bit unsigned data value that is loaded into the CS segment register [PC] +- [EA] Jump indirect in current segment. The 16-bit contents of the data memory word addressed by DADDR is loaded into PC [PC] +- [EA] , [CS] +- [EA+2] Jump indirect into a new segment. The 16-bit contents of the data memory word addressed by DADDR is loaded into PC. The next sequential 16-bit data memory word's contents is loaded into the CS segment register [[SP]) +- [PC) , [SP] +- [SP] -2, [PC] +- [PC) + DISP Call a subroutine in the current program segment using direct addressing [[SP]] +- [CS] , [SP] +- [SP] -2, [[SP]] +- [PC] , [SP] +- [SP] -2, [PC] +- DATA 16, [CS] +- DATA16 Call a subroutine in another program segment using direct addressing. BRANCH and SEGM are labels that become different 16-bit data words; they are loaded into PC and CS, respectively [[SP]] +- [PC] , [SP] +- [SP] -2, [PC] +- [EA] Call a subroutine in the current program segment using indirect addressing. The address of the subroutine called is stored in the 16-bit data memory word addressed by DADDR [[SP]] +- [CS] , [SP] +- [S2] -2, [[SP]] +- [PC] , [SP] +- [SP] -2, [PC] +- [EA] , [CS] +- [EA+2] Call a subroutine in a different program segment using indirect addressing. The address of the subroutine called is stored in the 16-bit data memory word addressed by DADDR. The new CS register contents is stored in the next sequential program memory word [PC] +- [[SP]] , [SP] +- [SP] +2 Return from a subroutine in the current segment [PC] +- [[SP]] , [SP] +- [SP] +2, [CS] +- [[SP]] , [SP] +- [SP] +2 Return from a subroutine in another segment [PC] +- [[SP]] , [SP] +- [SP] +2 +DATA 16 Return from a subroutine in the current segment and add an immediate displacement to SP [PC] +- [[SP]] , [SP] +- [SP] +2, [CS] +- [[SP]] , [SP] +- [SP] +2 +DATA 16 Return from a subroutine in another segment and add an immediate displacement to SP Table 20-4. The 8086 Instruction S€t SummarY'(Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES 0 D I T S Z A P C ADD AL,DATAB 2 X X X X X :X ADD AX,DATA16 3 X X X X X ADD RB,DATAB' 3 X X X X X X ADD RW,DATA16 4 X X X ADD DADDR,DATAB 3,4 or 5 X X ADD DADDR,DATA16 4,5 or 6 X X X ADe AL,DATAB 2 X X ADe AX,DATA16 3 X X ADe RB,DATAB 3 X X X ADe RW,DATA16 4 X ADe DADDR,DATAB 3,4 or 5 ADe DADDR,DATA 16 AND X j' N 9tn 00 w Ioct a: w a.. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X 4,5 or 6 X X X X X AL,DATAB 2 0 X X U X 0 AND AX,DATA16 3 0 X X 0 AND RB,DATAB 3 0 X X U X 0 AND RW,DATA16 4 0 X X U X 0 AND DADDR,DATAB 3,4 or 5 0 X X U X 0 AND DADDR,DATA 16. 4,5 or 6 0 X eMP AL,DATAB 2 X X X X X X eMP AX,DATA16 3 X X X X X X eMP RB,DATAB 3 X X X X X X eMP RW,DATA16 4 X X X X X X 0 w oct I- i5 w :E ~ X U X X U X 0 OPERATION PERFORMED. [All +- [All + DATA8 Add B-bit immediate data to the.AL register [AX) +- [AX)'+ DATAlO Add 16-bit immediate data to the AX register [RB) +- [RB) + DATA8 ,. Add B-bit immediate data to the.AB register [RW) +- [RW] + DATA16 Add 16-bit immediate data to the RW register [EA] +- [EA] + DATA8 Add B-bit immediate data to the data memory byte addressed by DADDR [EA] +- [EA] + DATA16 Add 16-bit immediate data to the data memory word addressed by DADDR [All +- [All + DAT A8 + [e] Add 8-bit immediate data, plus carry, to the AL register [AX] +- [AX] + DATA16 + [e] Add 16-bit immediate data, plus carry, to the AX register [RB] +- [RB] + DATA8+ [e] Add B-bit immediate data, plus carry, to the R B register [RW] +- [RW] + DATA16+ [e] Add 16-bit immediate data, plus carry, to the RW register [EA] +- [EA] + DATA8 + [e] Add 8-bit immediate data, plus carry, to the data memory byte addressed by DADDR [EA] +- [EA] + DATA16+ [e] Add 16-bit immediate data, plus carry, to the data memory word addressed by DADDR [All +- [AL] AND DATAB AND 8-bit immediate data with AL register contents [AX] +- [AX] AND DATA16 AN D 16-bit immediate data with AX register contents [RB] +- [RB] AND DATA8 AND B-bit immediate data with RB register contents [RW] +- [RW] AND DATA16 AN D 16-bit immediate data with RW register contents [EA] +- [EA] AND DATAB AND B-bit im·nediate data with contents of data memory byte addressed by DADDR [EA] +- [EA] Ai'lD DATA16 AND 16-bit immediate data with contents of 16-bit data memory word addressed by DADDR [All - DATAB Subtract B-bit immediate data from AL register contents. Discard result, but adjust status flags [AX] - DATA16 Subtract 16-bit immediate data from AX register contents. Discard result, but adjust status flags [RB] - DATAB Subtract B-bit immediate data from RB register contents. Discard result, but adjust status flags [RW] - DATA16 Subtract 16-bit immediate data from RW register contents. Discard result, but adjust status flags © ADAM OSBORNE & ASSOCIATES, INCORPORATED Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES 0 D I T S Z A P C X X CMP DADDA.DATAS 3.4 or 5 X X CMP DADDR.DATA 16 4.5 or 6 X 'X X X OR AL.DATAS 2 0 X X U X 0 OR AX.DATA16 3 0 X X U X 0 OR RB.DATAS 3 0 X X U X 0 OR RW.DATA16 4 0 X OR DADDR.DATAS 3.4 or 5 0 X X U X 0 OR DAD 0 R.DATA 16 4.5 or 6 0 X X U X 0 SBB AL.DATAS 2 X X X X X X SBB AX.DATA16 3 X X X X X X SBB RB.DATAS 3 X X X X X X SBB RW.DATA16 4 X X SBB DADDR.DATAS 3.4 or 5 X X X X SBB DADDR.DATA 16 4.5 or 6 X X X SUB AL.DATAS 2 X X X X X X SUB AX.DATA16 3 X X X X X X X X X X X U X 0 w I- < a: w D.. 0 w I- < 0 w :E ~ X X X X X X X X X OPERATION PERFORMED [EA] - DATAS Subtract S-bit immediate data from contents of data memory byte addressed by DADDR. Discard result. but adjust status flags [EA] - DATA16 Subtract 16-bit immediate data from contents of 16-bit data memory word addressed by DADDR. Discard result, but adjust status flags [All +- [All OR DATAS OR S-bit immediate data with AL register contents [AX] +- [AX] OR DATA16 OR 16-bit immediate data with AX register contents [RB] +- [RB] OR DATAS OR S-bit immediate data with RB register contents [AW] +- [RW] OR DATA16 OR 16-bit immediate data with RW register contents [EA] +- [EA] OR DATAS OR S-bit immediate data with contents of data memory byte addressed by DADDR [EA] +- [EA] OR DATA16 OR 16-bit immediate data with contents of 16-bit data memory word addressed by DADDR [All +- [All - DATAS - [C] Subtract S-bit immediate signed binary data from AL register contents using twos complement arithmetic. If the Carry status was originally 1 decrement the result [AX] +- [AX] - DATA16 - [C] Subtract 16-bit immediate signed binary data from AX register contents using twos complement arithmetic. If the Carry status was originally 1 decrement the result [RB) +- [RB] - DATAS - [C] Subtract S-bit immediate signed binary data from RB register contents using twos complement arithmetic. If the Carry status was originally 1 decrement the result [RW] +- [RW] - DATA16 - [C] Subtract 16-bit immediate signed binary data from RW register contents using twos complement arithmetic. If the Carry status was originally 1 decrement the result [EA) +- [EA] - DATAS - [C] Subtract S-bit immediate signed binary data from contents of data memory byte addressed by DADDR using twos complement arithmetic. If the Carry status was originally 1 decrement the result [EA) +- [EA] - DATA 16 - [C] Subtract 16-bit immediate signed binary data from contents of 16-bit data memory word addressed by DADDR using twos complement arithmetic. If the Carry status was originally 1 decrement the result [All +- [All - DATAS Subtract the S-bit immediate signed binary data from AL register contents using twos complement arithmetic [AX] +- [AX] - DATA16 Subtract the 16-bit immediate signed binary data from AX register contents using twos complement arithmetic Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES 0 N 90) o w I- « D I T S Z A P C SUB RB,DATA8 3 X X ~,UB RW,DATA16 4 X X X X X X SUB DADDR,DATA8 3,4 or 5 X X X X X X SUB DADDR,DATA 16 4,5 or 6 X X X X X TEST AL,DATA8 2 0 X X U TEST AX,DATA16 3 0 X X U X 0 TEST RB,DATA8 3 0 X X U TEST RW,DATA16 4 0 X X U X 0 TEST DADDR,DATA8 3,4 or 5 0 X X U X 0 TEST DADDR,DATA 16 4, 50r 6 0 X X U X 0 XOR AL,DATA8 2 0 X X U XOR AX,DATA16 3 0 X X U X 0 XOR RB,DATA8 3 0 X X U X 0 XOR RW,DATA16 4 0 X X U X 0 XOR DADDR,DATA8 3,4 or 5 0 X X U X 0 XOR DADDR,DATA 16 4,5 or 6 0 X X U X 0 X X X X X X 0 X 0 a: w Q. 0 w I- « a w :E ~ X 0 OPERATION PERFORMED [RB] .... [RB] - DATA8 Subtract the 8-bit immediate signed binary data from RB register contents using twos complement arithmetic [RW] .... [RW] - DATA16 Subtract the 16-bit immediate signed binary data from RW register contents using twos complement arithmetic [EA) .... [EA] - DATA8 Subtract the 8-bit immediate signed binary data from the contents of the data memory byte addressed by DADDR using twos complement arithmetic [EA) .... [EA) - DATA16 Subtract the 16-bit immediate signed binary data from the contents of the 16-bit data memory word addressed by DADDR using twos complement arithmetic [AL! AND DATA8 AND the 8-bit immediate data and AL register contents. Discard the result but adjust status flags [AX] AND DATA16 AND the 16-bit immediate data and AX register contents. Discard the result but adjust status flags [RB] AND DATA8 AND the 8-bit immediate data and RB register contents. Discard the result but adjust status flags [RW] AND DATA16 AND the 16-bit immediate data and RW register contents. Discard the result but adjust status flags [EA) AND DATA8 AND the 8-bit immediate data and the contents of the data memory location addressed by DADDR. Discard the result but adjust status flags [EA] AND DATA16 AN D the 16-bit immediate data and the contents of the 16-bit data memory word addressed by DADDR. Discard the result but adjust status flags [AL! .... [AL] XOR DATA8 Exclusive OR 8-bit immediate data with AL register contents [AX) .... [AX) XOR DATA16 Exclusive OR 16-bit immediate data with AX register contents [RB] .... [RB) XOR DATA8 Exclusive OR 8-bit immediate data with RB register contents [RW) .... [RW] XOR DATA16 Exclusive OR 16-bit immediate data with RW register contents [EA) .... [EA] XOR DATA8 Exclusive OR 8-bit immediate data with contents of the data memory byte addressed by DADDR [EA] .... [EA] X,-'R DATA16 Exclusive OR 16-bit immediate data with contents of the 16-bit data memory word addressed by DADDR .' © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES LOOP DISP8 2 LOOPE DISP8 2 LOOPNE DISP8 2 LOOPNZ LOOPZ JA DISP8 DISP8 DISP8 2 2 2 JAE DISP8 2 JB DISP8 2 JBE DISP8 2 JCXZ DISP8 2 JE DISP8 2 JG DISP8 2 JGE DIS.P8 2 0 JL DISP8 2 is JLE DISP8 2 JNA JNAE JNB JNBE JNE DISP8 DISP8 DISP8 DISP8 DISP8 2 2 2 2 2 JNG JNGE JNL JNLE JNO DISP8 DISP8 DISP8 DISP8 DISP8 2 2 2 2 2 JNP DISP8 z 0 j::: is z 0 U Z 0 Q. :E ~ Z j::: Z 0 U Z 0 :t u Z < a: CD JNS DISP8 2 .. 2 o D I OPERATION PERFORMED T S Z A P C "* "* "* [CX) +- [CX) -1 If [CX) a then [PC) +- [PC) + DISP8 Decrement CX register and branch if CX contents is not a [CX) +- [CX) -1 If [CX) a and [Z) = 1 then [PC) +- [PC) + DISP8 Decrement CX register and branch if CX contents is not a and Z status is 1 [CX) +- [CX) -1 If [CX) a and [Z) = a then [PC) +- [PC) :" DISP8 Decrement CX register and branch if CX contents is not a and Z status is a See LOOPNE See LOOPE [PC) +- [PC) + DISP8 Branch if C or Z is a [PC) +- [PC) + DISP8 Branch if C is a [PC) +- [PC) + DISP8 Branch if C is 1 [PC) +- [PC) + DISP8 Branch if C or Z is 1 [PC) +- [PC) + DISP8 Branch if the CX register contents is a [PC) +- [PC) + DISP8 Branch if Z is 1 [PC) +- [PC) + DISP8 Branch if Z is a or the Sand 0 statuses are the same [PC) +- [PC)·+ DISP8 Branch if the Sand 0 statuses are the same [PC) +- [PC) + DISP8 Branch if the Sand 0 statuses differ [PC) +- [PC) + DISP8 Branch if Z is 1 or the Sand 0 statuses differ See JBE See JB See JAE See JA [PC) +- [PC) + DISP8 Branch if Z is a See JLE See JL See JGE See JG [PC) +- [PC) + DISP8 Branch if 0 is a [PC) +- [PC) + DISP8 Branch if P is a [PC) +- [PC) + DISP8 Branch if S is a Table 20-4. The 8086 Instruction Set Summary (Continued) STATUSES TYPE MNEMONIC OPERAND(S) BYTES 0 z ~ JNZ JO DISP8 DISP8 2 2 z JP DISP8 2 JPE JPO JS DISP8 DISP8 DISP8 2 2 2 JZ DISP8 2 MOV RBD,RBS 2 MOV RWD,RWS 2 ...enw MOV SR,RW 2 w MOV RW,SR 2 XCHG AX,RW 1 XCHG RB,RB 2 XCHG RW,RW 2 0 D I See JNE [PC] +- [PC] Branch if [PC] +- [PC] Branch if SeeJP See JNP [PC] +- [PC] Branch if See JE Q 0 CJ z 0 :x: CJ Z q: IE: III w > 0 :E N 9 0'> N IE: I IE: ...enw C; w IE: CMPB 1 X lID X X X X X CMPW 1 X lID X X X X X LODB 1 liD w en LODW 1 I/D ...IE: MOVB 1 lID MOVW 1 lID :x: CJ IE: q: w en C Z q: IE: u. Z O'l X W w t'TA16 DADDR,DATAS ADC DADDR.DATA16 ADC 'DADDR,RB ADC DADDR,RW ADC RB,DADDR ADC ADC ADC RB,DATAS RBD,RBS RW,DADDR ADC RW,DATA16 ADC ADD ADD ADD RWD.RWS AL,DATAS AX,DATA16 DADDR,DATAS ADD DADDR,DATA16 ADD DADDR.RB ADD DADDR,RW ADD RB,DADDR ADD ADD ADD RB,DATAS RBD,RBS RW,DADDR ADD RW,DATA16 ADD AND AND AND RWD,RWS AL,DATAS AX,DATA16 DADDR,DATAS AND DADDR,DATA16 AND DADDR,RB AND DADDR,RW AND RB,DADDR AND AND AND RB,DATAS RBD,RBS RW,DADDR AND AND CALL CALL CALL RW,DATA16 RWD,RWS BRANCH BRANCH,SEGM DADDR OBJECT CODE 37 D50A D40A 3F 14 yy 15 yyyy SO aa010bbb [DISP] [DISP] YY 100000a1 aa010bbb [DISP] [DISP] YY[YY] 10 aadddbbb [DISP] [DISP] 11 aadddbbb [DISP] [DISP] 12 aasssbbb [DISPj [DISP] SO 11010ddd YY 12 11dddsss 13 aasssbbb [DISP] [DISP] 100000a111010ddd YY[YY] 1311dddsss 04YY 05 YYYY SO aaOOObbb [DISP] [DISP] YY 100000a1 aaOOObbb [DISP] [DISP] YY[YY] 00 aadddbbb [DISP] [DISP] 01 aadddbbb [DISP] [DISP] 02 aasssbbb [DISP] [DISP] SO 11 OOOddd YY 0211dddsss 03 aasssbbb [DISP] [DISP] 1OOOOOa 1 11000ddd YY[YY] 0311dddsss 24 YY 25 YYYY SO aa100bbb ' [DISP] [D1spj YY Sl aa100bbb [DISP] [DISP] YYYY 20 aasssbbb [DISP] [DISP] 21 aasssbbb [DISP] [DISP] 22 aadddbbb [DISP] [DISP] SO 111 OOsss YY 2211dddsss 2.3 aadddbbb [DISP] [DISP] S1111:JOsssYYYY 2311dddsss ES DISP DISP 9A ppqqppqq FF aa010bbb [DISP] [DISP] 20-68 BYTES CLOCK PERIODS 1 2 2 1 2 3 3,4 or 5 4* 60 S3 4* 4* 4* 17+EA 3,4,5 or 6 17+EA 2,3 or 4 16+EA 2,3 or 4 16+EA 2,30r4 9+EA 3 2 2, 30r 4 4* 3* 9+EA 30r4 4* 2 2 3 3,4 or 5 3* 4* 4* 17+EA 3,4,5 or 6 17+EA 2,3 or 4 16+EA 2,3 or 4 16+EA 2,3 or 4 9+EA 3 2 2,3 or 4 4* 3* 9+EA 30r4 4* 2 2 3 3,4 or 5 3* 4* 4* 17+EA 4,5 or 6 17+EA 2,3 or 4 16+EA 2,3 or 4 16+EA 2,30r4 9+EA 3 2 2,30r4 4* 3* 9+EA 4 2 3 5 2,30r4 4* 3* 19** 2S** 21+EA** Table 20-5. A Summary of 8086 I nstruction Object Codes and Execution Cycles (Continued) OBJECT CODE BYTES CLOCK PERIODS FF aa011bbb [DISPI [DISPI FF 11010reg 98 F8 FC FA F5 3C YY 3D YYYY 80 aa111bbb [DISPI [DISPI YY 100000a1 aa111bbb [DISPI [DISPI YY[YYI 38 aadddbbb [DISpl [DISPI 39 aadddbbb [DISPI [DISpl 3A aasssbbb [DISPI [DISPI 80 11111 ddd YY 3A 11dddsss 3B aasssbbb [DISPI [DISPI 100000a111111ddd YY[YYI 3B 11dddsss A6 A7 2,3 or 4 37+EA** 2 1 1 1 1 1 2 3 3,4 or 5 21+EA** 5 2* 2* 2* 2* 4* 4* 17+EA 3,4,50r6 17+EA 2,3 or 4 16+EA 2,3 or 4 16+EA 2,30r4 9+EA 3 2 2,30r4 4* 3* 9+EA 30r4 4* 2 1 1 1 1 1 2,3 or 4 3* 22 22 5 4* 4* 15+EA INSTRUCTION CALL DADDR,CS CALL CBW CLC CLD CLI CMC CMP CMP CMP RW AL,DATA8 AX,DATA16 DADDR ,OAT A8 CMP DADDR,DATA16 CMP DADDR,RB CMP DADDR,RW en CMP RB,DADDR ~ CMP CMP CMP RB,DATA8 RBD,RBS RW,OAOOR CMP RW,DATA16 CMP CMPB CMPW CWO DAA DAS DEC RWD,RWS DADDR DEC DEC DIV RB RW AX,DADDR DIV DX,DADDR ESC DADDR c w ~ oDo a: a: o CJ ~ en w I~ U oen en ~ o1J w Z a: o ID o ~ C ~ @ 99 FALC HLT IDIV AX,DADDR IDIV DX,DADDR IMUL AL,DADDR IMUL AX,DADDR IN IN INC PORT DADDR INC INC INT INT INTO INW INW IRET RB RW 3 V PORT 27 2F 1111. 111 a aa001 bbb [DISPI [DISPI FE 11001ddd 01001ddd F6 aa11 Obbb [DISPI [DISPI F7 aa110bbb [DISPI [DISPI 11011 xxx aaxxxbbb [DISPI [DISPI 06 F4 F6 aa111bbb [DISPI [DISPI F7 aa111bbb [DISPI [DISPI F6 aa101bbb [DISPI [DISPI F7 aa101bbb [DISPI [DISPI EC E4 YY 1111111 a aaOOObbb [DISpl [DISPI FE 11000ddd 01000ddd CC CD YY CE ' ED E5 YY CF 20-69 "- 2 1 2,3 or 4 2* 2* 90+EA 2,3 or 4 155+EA 2,30r4 7+EA 1 1 2,3 or 4 4* 2* 112+EA 2,3 or 4 177+EA 2,3 or 4 90+EA 2,3 or 4 144+EA 1 2 2,3 or 4 8 10 15+EA 2 1 1 2 1 1 2 1 2* 2* 60 60 60 8 10 32** Table 20-5. A Summary of 8086 I nstruction Object Codes and Execution Cycles (Continued) INSTRUCTION JA/JNBE JAE/JNB JB/JNAE JBE/JNA JCXZ JE/JZ JG/JNLE JGE/JNL JL/JNGE JLE/JNG JMP JMP JMP DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 BRANCH BRANCH,SEGM DADDR JMP DADDR,CS JMP JNE/JNZ JNO JNP/JPO JNS JO JP/JPE JS LAHF LDS RW DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 RW,DADDR LEA RW,DADDR LES RW,DADDR LOCK LOD8 LODW LOOP LOOPE/LOOPZ LOOPN E/LOOPN Z MOV MOV MOV DISP8 DISP8 DISP8 AL,LABEL AX,LABEL DADDR,DATA8 MOV DADDR,DATA16 MOV DADDR,RB MOV DADDR,RW MOV DADDR,SR MOV MOV MOV LABEL,AL LABEL,AX RB,DADDR MOV MOV MOV RB,DATA8 RBD,RBS RW,DADDR MOV MOV MOV MOV RW,DATA16 RW,SR RWD,RWS SR,DADDR MOV MOVB SR,RW OBJECT CODE 77 DISP 73 DISP 72 DISP 76 DISP 63 DISP 74 DISP 7F DISP 7D DISP 7C DISP 7E DISP 111010Xl DISP [DISP) EA ppqq ppqq . FF aal OObbb [DISP) [DISP) FF aal0lbbb [DISP) [DISP) FF 11100reg 75 DISP 71 DISP . 68 DISP 79 DISP 70 DISP 7A DISP 78 DISP ·9F C5 aasssbbb [DISP) [DISP) 8D aasssbbb [DISP) [DISP) C4 aasssbbb [DISP) [DISP) FO AC AD E2 DISP El DISP EO DISP AO ppqq .Al ppqq C6 aaOOObbb [DISP) [DISP) YY C7 aaOOObbb [DISP) [DISP) YYYY 88 aasssbbb [DISP) [DISP) 89 aasssbbb [DISP) [DISP) 8C aaOrrbbb [DISP) [DISP) A2 ppqq A3 ppqq 8A aadddbbb [DISP) [DISP) 10110ddd YY 8A lldddsss 8B aadddbbb [DISP) [DISP) 10111ddd YYYY 8C 11 Orrsss 8B 11dddsss 8E aaOrrbbb [DiSP) [DISP) 8E 110rrsss A4 20-70 BYTES CLOCK PERIODS .. 2 2 2 2 2 2 2 2 2 2 2or3 5 2,3 or 4 4 or 16** 2,3 or 4 24+EA** 2 2 2 2 2 2 2 2 1 2,3 or 4 9+EA** 4or16** 2,3 or 4 2+EA 2,3 or 4 16+EA 1 1 1 2 2 2 3 3 3,4 or 5 2* 12 12 5 or 17** 5 or 19** 5 or 19** 8+EA 8+EA 10+EA 4,5 or 6 10+EA 2,3 or 4 9+EA 2,30r4 9+EA 2,3 or 4 9+EA 3 3 2,3 or 4 9+EA 9+EA 8+EA 2 2 2,3 or 4 4" 2" 8+EA 3 2 2 2,30r4 4" 2* 2* 8+EA 2 1 2* 17 . . . . .. .. . . 15** . 15** 15+EA** . . .. ." . 4* 16+EA Table 20-5. A Summary of 8086 I nstruction Object Codes and Execution Cycles (Continued) INSTRUCTION c MOVW MUL AL,DADDR MUL AX,DADDR NEG DADDR NEG NEG NOT RB RW DADDR NOT NOT OR OR OR RB RW AL,DATAS AX,DATA16 DADDR,DATAS OR DADDR,DATA16 OR DADDR,RB OR DADDR,RW OR RB,DADDR OR OR OR RB,DATAS RBD,RBS RW,DADDR OR OR OUT OUT OUTW OUTW POP RW,DATA16 RWD,RWS w ~ a: oa.. a: o u ~ en w ~ U oCI) CI) < o/J w Z a: o III CI) o :E c< < @ PORT PORT DADDR POP POP POPF PUSH RW SR PUSH PUSH· PUSHF RCL RW SR RCL RB,N RCL RCR RW,N DADDR,N RCR RB,N RCR REP/REPNE/REPNZ REPE/REPZ RET RET RET RET ROL DADDR DADDR,N . RW,N N N CS CS,DATA16 DATA16 DADDR,N OBJECT CODE A5 F6 aa100bbb [DISP] [DISP] F7 aa100bbb [DISP] [DISP] 1111011a aa011bbb [DISP] [DISP] F611011ddd F711011ddd 1111011a aa010bbb [DISP] [DISP] F611010sss F711010sss OCYY OD YYYY SO aa001bbb [DISP] [DISP] YY Sl aa001bbb [DISP) [DISP] YYYY OS aasssbbb [DISP] [DISP) 09 aasssbbb [DISP) [DISP) OA aadddbbb [DISP) [DISP) 80 11001ss YY OA 11dddsss OB aadddbbb (DISP) (DISP) 8111001sssYYYY OB 11dddsss EE E6 YY EF E7 YY 8F aaOOObbb [DISP] [DISP) 01011ddd 000rr111 9D FF aa110bbb [DISP] [DISP) 01010sss 000rr110 9C 110100va aa01 Obbb [DISP] [DISP] 11010OVO 11010sss BYTES CLOCK PERIODS 1 2,30r4 17 71+EA 2,3 or 4 124+EA 2,3 or 4 16+EA 2 2 2,3 or 4 3* 3* 16+EA 2 2 2 3 3,4 or 5 3* 3* 4* 4* 17+EA 4, 5·or 6 17+EA 2,3 or 4 16+EA 2,3 or 4 16+EA 2,3 or 4 9+EA 3 2 2,3 or 4 4* 3* 9+EA 4 2 1 2 1 2 2,3 or 4 4* 3* 8 10 8 10 17+EA 1 1 1 2,3 or 4 8 8 8 16+EA 1 1 1 2,3 or 4 10 10 10 15+EA (single) or 4/bit+20+EA 2* (single) or 4/bit+8· 2 11010Ov111010sss 110100va aa011 bbb [DISP] [DISP) 110100vO 11011sss 2 2,3 or 4 11010Ov111011sss F3 F2 C3 CB CA YYYY C2 YYYY 110100va aaOOObbb [DISP] [DISP] 2 1 1 1 1 3 3 2,3 or 4 20-71 2 .. 15+EA (single) or 4/bit+20+EA 2* (single) or 4/bit+8 . +6 per loop +6 per loop 16** 26** 25** 20** 15+EA (single) or 4/bit+20+EA Table 20-5. A Summary of 8086 I ns'truction Object Codes and Execution Cycles (Continued) INSTRUCTION OBJECT CODE BYTES CLOCK PERIODS ROL RB,N 11010OVO 11 OOOsss 2 ROL ROR RW,N DADDR,N 2 2,30r4 ROR RB,N 11010Ov1 11000sss 110100va aa001 bbb [OISP) [DISP) 11010OVO 11001sss ROR SAHF SAL/SHL RW,N DAODR,N 2 1 2,3 or 4 SAL/SHL RB,N 110100v1 11oo1sss 9E 110100va aa100bbb [DISP) [DISP) 11010OVO 111 OOsss SAL/SHL SAR RW,N OAODR,N 2 2,30r4 SAR RB,~ 11010Ov1 11100sss 110100va aa111bbb [DISP) [DISP) 11010OVO 11111sss SAR SBB SBB SBB RW,N AL,OATAS AX,OATA16 OAODR,DATAS 2 2 3 3,4 or 5 4* 4* 17+EA SBB OAODR,DATA16 3,4,5 or 6 17+EA SBB DADOR,RB 2,30r4 16+EA SBB DADDR,RW 2,3 or 4 16+EA SBB RB,DAODR 2,3 or 4 9+EA SBB SBB SBB RB,DATAS RBO,RBS RW,OADDR 3 2 2,3 or 4 4* 3* 9+EA SBB RW,DATA16 110100v1 11111sss 1C YY 10 YYYY SO aa011bbb [DISP) [DISP) YY 100000a1 aa011 bbb [DISP) [DISP) YYlYY) lS aadddbbb [DISP) [DISP) 19 aadddbbb [DISP) [OISP) 1A aasssbbb [DISP) [DISP) SO 11011ddd YY 1A 11dddsss 1B aasssbbb [OISP) [DISP) 100000a111011ddd 3 or 4 4* 1B 11dddsss AE AF 001rr101 110100va aa101bbb [DISP) [OISP) 110100vO 11101 sss 2 1 1 1 2,30r4 3* 15 15 +2 15+EA (single) or 4/bit+20+EA 2* (single) or 4/bit+S 11010Ov1 11101s55 F9 FO FB AA AB 2C YY 20 YYYY SO aa101bbb [DISP) [DISP) YY 100000a1 aa101bbb [DISP) [OISP) YY[YY) 28 aadddbbb [DISP) [DISP) 29 aadddbbb [OISP) [OISP) 2A aasssbbb [OISP) [DISP) 2 1 1 1 1 1 2 3 3,4 or 5 2* 2* 2* 10 10 4* 4* 17+EA 3,4,5 or 6 17+EA 2,30r4 16+EA 2,30r4 16+EA 2,3 or 4 9+EA 2 2 2 2* (single) or 4/bit+S . 15+EA (single) or 4/bit+20+EA 2* (single) or 4/bit+S . 4* 15+EA (single) or 4/bit+20+EA 2* (single) or 4/bit+S . 15+EA (single) or 4/bit+20+EA 2* (single) or 4/bit+S . YY[YY) SBB SCAB SCAW SEG Prefix SHR RWO,RWS SR OAOOR,N SHR RB,N SHR STC STO STI STOB STOW SUB SUB SUB RW,N AL,DATAS AX,OATA16 OAOOR,DATAB SUB OAOOR,DATA16 SUB DADDR,RB SUB OAOOR,RW SUB RB,DADDR 20-72 2 .. Table 20-5. A Summary of 8086 I nstruction Object Codes and Execution Cycles (Continued) INSTRUCTION SUB SUB SUB RB,DATA8 RBD,RBS RW,DADDR SUB RW,DATA16 SUB TEST TEST TEST RWD,RWS AL,DATA8 AX,DATA16 DADDR,DATA8 TEST DADDR,DATA16 TEST DADDR,RB o1J w Z TEST DADDR,RW om TEST TEST TEST TEST WAIT XCHG XCHG RB,DATA8 RBD,RBS RW,DATA16 RWD,RWS AX,RW RB,DADDR XCHG XCHG RB,RB RW,DADDR XCHG XLAT XOR XOR XOR RW,RW AL,DATA8 AX,DATA16 DADDR,DATA8 XOR DADDR,DATA16 XOR DADDR,RB XOR DADDR,RW XOR RB,DADDR XOR XOR XOR RB,DATA8 RBD,RBS RW,DADDR XOR XOR RW,DATA16 RWD,RWS Q w ~ a: ona: o(J ~ en w ~ g CI) CI) « a: CI) o ::! « Q « @ BYTES CLOCK PERIODS 80 11101ddd YY 2A 11dddsss 2B aasssbbb [DISP) [DISP) 100000a1 11101ddd yy[yy) 3 2 2,30r4 4* 3· 9+EA 3 or 4 4* 2B 11dddsss A8 YY A9 YYYY F6 aaOOObbb [DISP) [DISP) YY F7 aaOOObbb [DISP) [DISP) YYYY 84 aaregbbb [DISP) [DISP) 85 aaregbbb [DISP) [DISP) F6 11000reg YY 8411regreg F7 11 OOOreg YYYY 8511regreg 9B 10010reg 86 aaregbbb [DISP) [DISP) 8611regreg 87 aaregbbb [DISP) [DISP) 87 11 regreg D7 34 YY 35 YYYY 80 aa010bbb [DISP) [DISP) YY 81 aa010bbb [DISP) [DISP) YYYY 30 aasssbbb [DISP) [DISP) 31 aasssbbb [DISP) [DISP) 32 aadddbbb [DISP) [DISP) 80 11110sss YY 3211dddsss 33 aadddbbb [DISP) [DISP) 81 11110sss YYYY 3311dddsss 2 2 3 3,4 or 5 3· 4* 4* 10+EA 4,5 or 6 10+EA 2,30r4 9+EA 2,30r4 9+EA 3 2 4 2 1 1 2,30r4 4* 3* 4* 3* 3 3* 17+EA 2 2,3 or 4 4* 17+EA 2 1 2 3 3,4 or 5 4* 11 4* 4* 17+EA 4,5or6 17+EA 2,30r4 16+EA 2,30r4 16+EA 2,30r4 9+EA 3 2 2,30r4 4* 3* 9+EA 4 2 4* 3* OBJECT CODE 20-73 Table 20-6. 'SOSOA to SOS6 Instruction Mapping 8080A , INSTRUCTION EQUIVALENT 8086 INSTRUCTION(S) IN OUT DEV DEV IN OUT PORT PORT LDAX B * SI,CX LDAX 0 STAX B STAX "0 MOV MOV LOA STA LHLD SHLD ' REG,M M,REG ADDR ADDR ADDR ADDR MOV LODB MOV LODB MOV STOB 'MOV STOB MOV MOV MOV MOV MOV MOV 8080A INSTRUCTION EQU IVALENT 8086 'INSTRUCTION(S) RM JNS RET , JS RET ,JPO RET JPE RET RP RPE , SI,DX RPO DI,CX DI,DX i RB,DADDR DADDR,RB AL,LABEL LABEL,AL BX,DADDR DADDR,BX ADD ADC SUB SBB ANA XRA ORA CMP INR OCR M M M M M M M M M M LXI RP,DATA16 MOV RW,DATA16 M,DATA REG,DATA ADDR MOV MOV JMP JMP DADDR,DATA8 RB,DATA8 BRANCH ** , BX CALL CC ADDR ADDR CNC ADDR CALL BRANCH JNB next-inst CALL BRANCH JB next-inst CALL BRANCH JNZ next-inst CALL BRANCH JZ next-inst CALL BRANCH JS next-inst CALL BRANCH JNS next-inst CALL' , 'BRANCH JPO next-inst CALL BRANCH JPE next-inst CALL BRANCH RET MVI MVI JMP PCHL " CZ ADDR CNZ' ADDR CP AD DR CM ADDR CPE ADDR CPO ADDR RET RC RNC RZ RNZ ADD ADC SUB SBB AND XOR OR CMP 'INC DEC JNB RET JB RET JNZ RET JZ RET next-inst next-inst next-inst ADD ADC SUB SBB AND XOR OR CMP AL,DATA8 AL,DATA8 AL,DATA8 AL,DATA8 AL,DATA8 AL,DATA8 AL,DATA8 AL,DATA8 ADDR ADDR ADDR ADDR ADDR ADDR ADDR ADDR JB JNB JZ JNZ JNS JS JPE JPO DISP8 *** DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 DISP8 d,s MOV XCHG MOV RBD,RBS DX,BX SP,BX ADI ACI SUI SBI ANI XRI ORI ' CPI DATA DATA DATA DATA DATA DATA DATA DATA JC JNC JZ JNZ JP JM JPE JPO MOV XCHG SPHL AL,DADDR AL,DADDR AL,DADDR AL,DADDR AL,DADDR AL,DADDR AL,DADDR AL,DADDR DADDR DADDR next-inst " ADD ADC SUB SBB ANA XRA ,ORA CMP DAD REG REG REG REG REG REG REG REG RP AL,RBS ADD AOC AL,RBS SUB AL,RBS SBB AL,RBS AND AL,RBS XOR AL,RBS OR AL,RBS CMP AL,RBS LAHF ADD BX,RW RCR AL 'SAHF AL RCL or ADD BX,RW (unlike DADwill affect AF, PF, SF, and ZF) INR OCR CMA DAA RLC RRC RAL RAR INX REG REG DCX RP INC RB DEC RB NOT AL DAA ROL AL ROR AL RCL AL RCR AL LAHF INC RW SAHF or INC RW (unlike INX - will affect AF, PF, SF, and ZF) LAHF DEC RW next-inst RP next-inst next-inst next-inst 20-74 Table 20-6. 8080A to 8086 I nstruction Mapping (Continued) EQUIVALENT B086 INSTRUCTION(S) B080A INSTRUCTION SAHF or DEC RW (unlike DCX - will affect AF, PF, SF, and ZF) cw ~ oD. a: PUSH PUSH RP PSW POP POP RP PSW PUSH LAHF PUSH POP POP SAHF POP XCHG PUSH a: o u ~ en w XTHL ~ g (I) (I) oct ail w Z a: o m (I) o ~ oct C oct @ EQUIVALENT 8086 INSTRUCTION(S) BOBOA INSTRUCTION EI DI RST RW AX RW AX STI CLI CALL N STC CMC STC CMC NOP HLT XCHG HLT S*N AX,AX SI BX,SI SI *SOSOA registers map into SOS6 registers as follows: BOBOA A B C D E H B086 B080A 8086 AL CH CL DH DL BH L BC DE HL SP PC BL CX DX BX SP IP .. Addresses on SOS6 jumps and calls are adjusted to be self-relative. **·Conditional jumps to a location out of the short self-relative range must be implemented by using a reversed-sense conditional jump around a normal jump to the location, e.g.: JC ADDR becomes JNB JMP Refer to Table 4-4 for a complete description of SOSOA mnemonics shown above. Refer to Table 20-4 for a complete description of SOS6 mnemonics shown above. 20-75 next-inst BRANCH £T..>----lD XTAl OSCll: LATOR ~'------4 ~,o---~---- TANK FIC RESET CK X1 X2 Q OSC t - - - -.. ClK -rt>0 +3 SYNC EFI peLK CSYNC RDY1 AEN1 ~ -----[>o----L...I READY SYNC lOGIC l>o--=-=-n -------L-I AEN2 RDY2 READY Figure 20-12. Logic of the 8284 Clock Generator and Driver CSYNC-1 Pin Name RESET RES RDY1. RDY2 AEN1. AEN2 READY X1. X2 TANK EF1 FIC ClK PClK OSC CSYNC Vee· GND 18 Vee (+5V) PClK 2 17 X1 AEN1 3 16 X2 15 TNK 14 EFI ROY1 4 READY 5 RDY2 6 13 F/C AEN2 7 12 OSC ClK 8 RES GND 9 RESET 8284 Description Control signal output to 8086 Reset logic input Wait state ready inputs Address enable qualifiers for RDY1 and RDY2 Control signal output to 8086 External crystal connections . Overtone crystal tank circuit connection Alternate clock input Clock source select MOS level clock signal to 8086 TTL clock for peripherals Crystal oscillator output Clock synchronizer Power. ground Figure 20-13. 8284 Clock Generator and Driver Pins and Signal Assignments 20·76 Type Output Input Input Input Output Input Input Input Input Output Output Output 'Input THE INTEL 8284 CLOCK GENERATOR/DRIVER Q w ~ oD. II: II: o The 8284 Clock Generator/Driver Is a standard component that will be present in every 8086 microcomputer system. In a multlmlcroprocessor system, each 8086 microprocessor will have its own 8284 Clock Genera,tor/Driver. While one could conceivably have a single 8284 servicing more than one 8086 microprocessor. it will rarely make any economic sense to design a system in this fashion. Logic implemented on the 8284 Clock Generator/Driver corresponds generally to the block labeled clock logic in Figure 20-1. To be completely accurate. however. a small portion of the bus interface logic should also be illustrated as provided by the 8284 device. CJ Figure 20-12 illustrates 8284 device internal logic. en w The 8284 is manufactured using bipolar technology. It is packaged as a 18-pin DIP. All signals are TTL compatible. g ~ 8284 CLOCK GENERATOR/DRIVER PINS AND SIGNALS (I) (I) 8284 device pins and signals are illustrated In Figure 20-13. Figure 20-19 illustrates the 8284 device in a single 8086 microprocessor configuration. ~ < oll w Z II: o III (I) o ~ < Q < @ Signals may be divided between timing and control logic. Clock frequency is controlled by a crystal connected across tho X1 and X2 pins. Clock frequency must be exactly three times the required clock period. Since the standard 8086 clock period is 200 nanoseconds. a 15MHz crystal frequency is required. If an overtone mode crystal is employed, then it must be supported by an external LC network connected to TANK to insure oscillation of the overtone frequency. This is standard clock logic practice; for the 8284 it is illustrated along with other normal connections in Figure 20-14. You have the option of connecting a crystal across X 1 and X2 in order to generate a fundamental frequency. or you can input the fundamental frequency via EFI. The level of F/C determines whether an external crystai or a signal input will provide the fundamental frequency. If F/C is high. then the fundamental frequency is taken from the EFI input. If F/C is low. then the crystal connected across X1 and X2 provides the fundamental frequency. Three clock outputs are generated: 1) ClK is an MOS level signal designed to meet the requirements of the 8086. 2) PClK is a TTL level clock signal. output for support circuits. PClK runs at half the frequency of ClK. 3) OSC is an oscillator output running at the crystal or EFI input frequency. These timing signals may be iIIustratod as follows: 2 3 4 5 6 EFI or Crystal OSC CLK) ___--II PCLK 20-77 7 8 9 10 .etc. XTAl Cx Xl X2 RDYl OSC r----------~ OSC AENl RDY2 ClK r----------~ClK AEN2 PClK r----------~ PClK vcc-o-----, 8284 READY r----------~ READY RESET r----------_ RESET RES Fie EFI CSYNC TANK 1----- -----, I I I I I I I Tank circuit used with overtone crystals only. I I CT IT I I I I I I I I I I L ___________ --1 NOTES: 1. C x should be 3 to 10 pF 2. Cc (when used) should be 1 to 10 nF 3. CR and RR determine Reset time constant 4. CT and IT determine tank frequency: fo = 1 ~ 2 Try lTCT Figure 20-14. Normal 8284 Clock Generator Circuit 2078 cw ~ oIl. a: a: o SYNCHRONIn multi-CPU configurations you will probably need to synchronize all 8086 clock signals. IZING You use the CSYNC signal for this purpose. When CSYNC is input high. logic internal to the MULTI-8086 8284 Clock Generator/Driver is stopped. When CSYNC subsequently goes low. clock outputs CLOCK restart. If the same CSYNC signal is input to a number of 8284 devices that receive the same EFI SIGNALS input. then all microprocessors in a multi-CPU configuration will be exactly synchronized. Appropriate logic is illustrated in Figure 20-15. "-_ _ _ _ _---1 Note that you cannot use individual crystals for 8284 Clock Generator/Drivers that are supposed to be synchronized with each; minor variations in crystal frequency. which must occur. will quickly distort clock signal synchronization. You can use a crystal to generate the fundamental frequency for one 8284 Clock Generator/Driver. then use the OSC output of this Clock Generator/Driver as the EFI input to other 8284 Clock Generator/Drivers. CJ ~ enw I- < (3 o en en < The 8086 requires its RESET input to be synchronized with clock logic. The 8284 will receive an asynchronous Reset input at RES and will generate synchronized RESET output which the 8086 requires. Appropriate logic is illustrated in Figure 20-14. Timing is illustrated in the data sheets at the end of the chapter. 8086 RESET The 8284 RES input need not make a sharp transition. The 8284 inputs RES to a Schmit trigger that generates the RESET output. RES can make a slow low-to-high transition. olS rlD~ w Z a: oal en T o ~ X2 X1 < C < @ Master Synchronizer Q D D ClK 8284 7474 7474 ,.- CSYNC Q ------ ClK <}~ OSC CSYNC Input to other 8284 devices EFI input to other 8284 devices Figure 20-15. Clock Synchronization Logic in a Multi-CPU 8086 Configuration We have described earlier in this chapter how external logic can extend a bus cycle by inserting 8284 Wait clock periods between T3 and T4. Figure 20-9 illustrates the READY input which controls WAIT STATE Wait states within the 8086 bus controller. As illustrated in Figure 20-9. the 8086 READY input LOGIC must be synchronized with the clock signal. The 8284 Clock Generator/Driver outputs an ap- ....._ _ _ _ _~ propriately synchronized READY signal to the 8086. The 8284 creates its READY output from one of two inputs: RDY1 or RDY2. The 8284 has two READY inputs to support MUL TIBUS configurations. as illustrated in Figure 20-22. A single 8086 may connect to two separate System Busses. Memory or I/O devices attached to either bus may wish to create a Wait state within a bus cycle. Each System Bus may therefore have its own READY line. In order to arbitrate bus priorities. RDY 1 and RDY2 have companion enable signals AEN 1 and AEN2. respectively. The 8284 will respond to RDY1 only when AEN1 is low. Similarly. the 8284 will respond to RDY2 only when AEN2 is low. AEN1 and AEN2 are general bus priority signals which you must generate through your own bus priority arbitration logic. We will describe these two signals. and methods of generating them. later in this chapter. 20-79 THE INTEL 8288 BUS CONTROLLER In maximum 8086 configurations, wherethe 8086 MN/MX signal is low, you must use an 8288 Bus Controller in order to decode the SO, S1 and S2 status lines, and thus create System Bus control signals. You can also use the 8288 Bus Controller in order to connect more than one 8086 to a single System Bus, or in order to create more than one System Bus for a single 8086. Although the primary purpose of the 8288 Bus Controller is to decode the three 8086 status signals SO, S 1 and S2, a simple 1-of-8 decoder could accomplish this limited task. The 8288 has these additional capabilities: . 1) The 8288 can generate control signals for a System Bus or an I/O device only bus. 2) You can float a System Bus's control signals to enable direct memory access. or to arbitrate bus priorities. 3) The two Write control lines have alternate advanced outputs designed for slow memories or I/O devices. 4) You can supress control signals as a means of implementing memory protect logic in multi-bus or multimicroprocess or configurations. 5) The 8288 generates control signals needed by line drivers. 6) The 8288 generates control signals needed by simple or complex interrupt logic. The 8288 Bus Controller is manufactured using bipolar technology. It is packaged as a 20-pin DIP. All signals are TTL compatible. 8288 BUS CONTROLLER SIGNALS AND PIN ASSIGNMENTS Figure 20-16 illustrates 8288 Bus Controller signals and pin assignments. Figure 20-20 illustrates an 8288 within an 8086 microcomputer system. 20 lOB ClK 2 19 VCC(+5V) SO S1 3 18 S2 DT/R 4 17 MCE/PDEN ALE 5 16 DEN AEN 6 15 CEN INTA 8288 MRDC 7 14 AMWC 8 13 10RC MWTC 9 12 AIOWC 10 11 10WC GND Signal Function Direction SO, S1, S2 ClK AEN CEN lOB MRDC MWTC AMWC 10RC 10WC AIOWC INTA MCE/PDEN ALE Bus cycle state signals TTL clock signal Bus priority control/enable Command enable Mode control Memory read strobe Memory write strobe Early memory write strobe I/O read strobe I/O write strobe Early I/O write strobe Interrupt acknowledge Cascade/peripheral data enable Address latch enable Data direction control Data buffer enable Power, ground Input Input Input Input Input Output, tristate Output, tristate Output, tristate Output, tristate Output, tristate Output, tristate . Output, tristate Output Output Output Output DT/R DEN VCc,GND Figure 20-16. 8288 Bus Controller Pins and Signal Assignments 2080 Control signals are generated from SO, S1 and S2 as follows: SO c w ~ a: oQ. a: o o ~ en w S1 S2 0 0 0 0 0 0 0 0 0 0 0 8086 State 8288 Control Out~ut I nterrupt acknowledge INTA and MCE I/O read 10RC I/O write 10WC,AIOWC Halt None Code access MRDC Memory read MRDC Memory write MWTC,AMWC No operation None I- g< en en 0 1 < II!! w Z a: o In en o ~ < c < @ 8288 and 8086 control signal timing is essentially the same. For details. see the data sheets given at the end of this . ' chapter. If you look again at the Read and Write bus cycle timing descriptions given earlier in this chapter for the 8086 you will see that Read control signals pulse low approximately one clock period earlier than Write control signals. The 8288 creates two alternate Write control signals whose timing is the same as the Read control signals. These alternative Write control signals are referred to as advanced Write control signals. because they go low one clock pulse in advance of the standard Write control signals. 8288 ADVANCED WRITE CONTROL SIGNALS We can thus summarize 8288 System Bus control signals as follows: MRDC is the memory read control. MWTC is the memory write control. AMWC is a memory write control whose timing conforms to MRDC. INTA is a memory read control signal which is output during the two interrupt acknowledge bus cycles. 10RC is an I/O device read control signal. 10WC is an I/O device write control signal. AIOWC is an alternative I/O device write control signal with timing that conforms to 10RC. Devices connected to a bus are likely to use both 10WC and MWTC orAIOWC and AMWC. but not all four signals. That is. you will use either the normal write control Signals or you will use the advanced write control signals. All 8288 control signals are tri-state. They can be disabled and thus disconnected from the System Bus. You have two control options which modify the control signal logic of the 8288 Bus Controller. Using the lOB pin, you can operate the 8288 device in I/O bus mode or in System Bus mode. Using the CEN pin, you can suppress control signals. Let us examine each of these capabilities in turn. When the lOB pin is connected to +5V. the 8288 Bus Controller generates an I/O bus. lOB high 8288 I/O floats MRDC. MWTC and AMWC all of the time. but continuously outputs INTA. 10RC. 10WC and BUS MODE AIOWC. In I/O bus mode. these four I/O control signals cannot be floated. Since the four I/O controllines will always be active. itis assumed that the I/O bus generated by an 8288 is a local bus. You cannot share this local I/O bus with another microprocessor. nor can it be used by direct memory access logic. The 8288 I/O bus has two control signals. PDEN and DT /R. which drive I/O ports and line drivers. DTiff. which we have described for the 8086. is used to control a bidirectional bus driver. When high. DT/A' puts the bus driver in output mode. while when low. DT /A' puts the bus driver in input mode. PDEN pulses low as a data enable signal. PDEN is equivalent to DEN. the standard bus data enable signal output by the 8086. When lOB is low. a normal System Bus is generated. All seven control signals are active: however. AEN is a bus enable control (much as the BUSEN input is used by the 8228 Bus Controller in an 808A system). 20-81 AEN is inactive when lOB is high and an 110 bus is being generated. AEN is active only when lOB is low and a System Bus is generated. When lOB is low and AEN is high. all control signals are floated. When lOB is low and AEN is low. control signals are connected to the System Bus. You will use AEN to implement bus priority arbitration logic. or direct memory access logic. as described later in this chapter. CEN is used to disable, but not float, control signals. CEN can be used when an 8288 is generating a System Bus or an I/O bus. CEN will normally be high. When CEN is low, control signals are inactive. CEN does not float signals; it just disables the logic which might otherwise have made a control signal pulse low.;, " 8288 BUS CONTROLLER MEMORY PROTECT Table 20-7 summarizes the effect of lOB and CEN on control signals generated by the 8288 Bus Controller. Table 20-7. Effect of lOB, CEN and AEN on Control Signals Output by the 8288 Bus Controller EFFECT ON CONTROL OUTPUT CONTROL INPUT lOB CEN AEN 0 0 0 MRDC, MWTC, AMWC INTA, IORC, IOWC, AIOWC Mode Floated? Active? Mode Floated? 0 System Floated Active System Floated Active? Active 0 1 System ' Floated Inactive System Floated Inactive 0 1 0 System Connected "A'ctive System Connected Active 0 , 1 1 1 System Connected Inactive System Conrected inactive 0 0 I/O Floated Active Not Used Floated Inactive 1 0 1 I/O Floated Active Not Used Floated Inactive 1 1 0 I/O Connected Active Not Used Floated Inactive 1 1 1 I/O Connected Active Not Used Floated Inactive The CEN control enables memory mapping. Here are some possibilities: 1) In multi-bus configurations. one block of memory addresses may access memory on two or more busses. In order to avoid contentions. you can use the CEN signal to selectively disable busses so that only one bus will actually respond when the 8086 accesses duplicated memory addresses .. 2) Privileged memory is frequently present in large microcomputer systems. Privileged memory is likely to become more common in microcomputer systems 'as they grow larger. Privileged memory is memory which can be accessed only under special circumstances. Frequently. system programs are run out of privileged memory. while application programs are run out of non-privileged memory. This prevents errors in application programs from destroying system programs; it also prevents unauthorized access of reserved memory spaces. DT/R and DEN, the two standard buffer control signals, are generated by the 8288 when it is creating a normal System Bus. These two control signals: wh~ generated by the 8288 Bus Controller. are identical in form and purpose to the signals which the 8086 creates. DT IR determines the data direction for bidirectional buffers. while DEN is latching strobe. 'a The 8288 generates two interrupt control signals: INTA and MCE. INTAis active on a System Bus or an I/O Bus. MCE shares a pin with PDEN and is active only. on a System Bus. 8288 BUS CONTROLLER INTERRUPT SIGNALS As we discussed earlier in this chapter. the 8086 executes two bus cycles when acknowledging an interrupt. During each bus cycle. INTA is 'output as a low read pulse. On the second low INTA pulse. the acknowledged device must return an 8-bit 'code which the 8086 uses as an interrupt vector. The INT A control Signal which is generated by the 8288 Bus Controller is identical to the 8086 INTA control signal and serves the same purpose. on a System Bus or an 110 Bus. The MCE control signal has been added for use in large 8086 microcomputer systems that use a variation of theB259A Priority Interrupt Control Unit. (The 8259A Priority Interrupt Control Unit is described in Chapter 4.) When you have a master 8259A Priority Interrupt Control Unit and slave 8259A Priority Interrupt Control Units. you will use MCE as a control to the master. while INTA becomes a control to the slaves. The 8086 version 'of the 8259A Priority Interrupt Control Unit is not described .in this chapter. We will therefore defer further discussion of the MCE signal until a subsequent revision of this c~apter. ' 20-82 THE 8282/8283 8-BIT INPUT/OUTPUT PORT These are simple unldirectlonal8-bit latch buffers. The 8283 inverts does not. That is the only difference between these two devices. inp~ts in order to create outputs; the 8282, c Both devices have three-state outputs. When a device Is not selected, its outputs are floated. ~ a:: oa. These devices are manufactured using bipolar technology. All signals are TTL compatible, Outputs have a high drive' capability. as defined in the data sheets at the end of this chapter. The devices are packaged as 20-pin DIPs. o THE 8282/8283 INPUT/OUTPUT PORT PINS AND SIGNAL ASSIGNMENTS ~ Figure 20-17 illustrates the pins and signal assignments for the 8282 and 8283 8-bit input/output ports. w a:: o en w Data must be input at 010-017. g When STS is high. the internal latches appear transparent and data on the output pins track data on the input pins. The transition from high to low of STS latches the data. The outputs remain stable while STS is low. ~ VJ VJ < IllS w Z a:: o IXl VJ o ~ < Q < @ Data which is latched internally is output when CS is low. The 8282 outputs data unaltered. while the 8283 inverts the data. ' Were you to simply ground DE and tie STS to +5V. the 8282 or 8283 I/O ports will function as simple bus drivers. The outputs will continuously track the inputs. but will support heavier signal loads. If you tie STS high. but use the low DE pulse. then input data is constantly available but outputs only become valid while DE is low. Timing may be illustrated as follows: ' ' DiO-DI7 A Latches A 1 ~ ~l DOo-D07 ~ A B X c X C 1 t B i 5 B } , 20-83 C{ D C ~ I? D ~ 010 011 012 013 014 2 3 4 5 6 7 015 016 017 OE 8282 or 8283 000 001 002 003 004 005 006 007 STB 13 12 11 8 9 10 GNO Vee (+5V) 20 19 18 17 16 15 14 Type Description Pin Name Data input Input Data output Output. tristate Output Enable . I nput data strobe Input Input 010-017 000-007 OE STB Vee. GNO Power. ground Figure 20-17. 8282 and 8283 I nput/Output Port Pins and Signal Assignments When the Strobe and Output Enable signal are both active. I/O port logic may be illustrated as follows: 010-017 A X STB Latches OE 000-007 A 3 A X e B ~ T rr B t ~ B 20-84 0 X e ~ c w ~ o D. a: AO A1 1 20 Vee 2 19 BO A2 A3 3 4 18 B1 B2 A4 A5 6 7 a: o(J z enw 5 8286 or 8287 17 16 B3 B4 15 14 B5 B6 13 8 12 GND B7 T 11 10 I- « U oC/) Pin Name C/) AO-A7 BO-B7 OE T GND « ~ w z a: o en C/) o Vee. Description Local Bus System Bus Output Enable Direction select Power. ground Type Bidirectional. tristate Bidirectional. tristate Input Input ~ « c « Figure 20-18. 8286 and 8287 Bidirectional Bus Transceiver Pins and Signal Assignments @ THE 8286/8287 8-BIT BIDIRECTIONAL BUS TRANSCEIVERS These two devices are used to buffer bidirectional lines on a System Bus. The 8286 transmits data unaltered, while the 8287 inverts the data. The two devices are otherwise the same. The 8286 and 8287 bidirectional bus drivers are manufactured using bipolar technology. All pins are TTL-compatible. The devices are packaged as 20-pin DIPs. 8286 AND 8287 BIDIRECTIONAL BUS TRANSCEIVER PINS AND SIGNAL ASSIGNMENTS Figure 20-18 illustrates pins and signal assignments for the 8286 and 8287 bidirectional bus drivers. AO-A7 constitute eight parallel data lines that connect with the microprocessor Data/Address Bus. BO-B7 constitute eight equivalent lines that connect with the System Bus. System Bus outputs have a higher line drive capability (as defined in the data sheets at the end of this chapter); otherwise. there is no difference between the two busses. When the T input is low, data arriving at the B pins is output via the A pins. When T is high, data arriving at the A pins is output via the B pins. The actual data transfer occurs only while OE is low. When used as an 8086 Data Bus tranceiver. T should be connected to DTfR and OE connected to DEN. 20-85 SOME'SOS6 MICROPROCESSOR BUS CONFIGURATIONS We are now going to look at some 8086 microprocessor bus configurations. The flexibility of the 8086 gives rise to such a bewildering array of system configuration possibilities that a whole book could be written on the subject. We are going to fulfill the more limited objective of identifying possibilities. Figure 20-19 illustrates the simplest case. Here we are using the 8086 to generate a simple microcomputer system. Addresses taken off the bidirectional 8086 Data/Address 8us are unidirectional. We therefore use 8282 I/O ports to latch addresses of the 8086 Data/Address Bus. In Figure 20-19, we show just two 82821/0 ports generating a 16-line Address Bus. Address'lines A16 through A19 are wasted. By adding one more.8282 I/O port to the logic in Figure 20-19, you could include the four missing Address Bus lines. . M!I5 INTA GND ADO .. RD tOE WR ~ AO = r AD7 ALE A7 OE 8282 A8 STEi 8282 .~ A15 SHE \ J V ~DO 8086 Vee ~ ~T/R MN/HX DEN / cs AAD8 V 1\ AD15 ~ ..J U .. Vee 0 8286 OE - -.l.... - 08 OE ~ 015 8286 \ J ~ LU - DO KAD7 ROYl READY PCLK 8284 r t _RES I~~? AENl ~ Xl X2 ~D1 I ~/C I ¥' Figure 20-19. Generating a System Bus for a Simple 8086 Configuration 20-86 In Figure 20-19. we ground the Output Enable inputs of the 82821/0 ports; the Address Bus will therefore never be floated. We use the 8086 ALE pulse to strobe addresses into the 8282 I/O ports. Since the Data Bus is bidirectional. we use 8286 bidirectional Bus Transceivers in order to create a separate Data Bus from the 8086 Address/Data Bus. Two 8286 bidirectional Bus Transceivers are required to create the 16-line Data Bus. We can use the DT/R and DEN outputs of the 8086 as the 8286 T and CS inputs. c w We can now illustrate timing for creation of the Address Bus and 'Data Bus during a read bus cycle. as follows: ~ a: oQ. a: o I u ~ enw Tl T2 T4 T3 ~ g I I I I elK fI) fI) ct ail w ADG-AD15 1-11-_1--_ _ _-+0(=8282 01 -+-----+---f '--_ _......,...._ _~ Z and 8286A) a: o CD fI) o BHE :!: ct c ct ALE (=8282 STB) @ M/io DT/R (=8286 T) DEN . .828201 ------I Address Out Data In )--------(=ADO-AD15) ---r--~~--- 8282 DO 8286 B Address Out _____________ AO-A15 Data In DG-D15 ~-J~------~-~~--/L------- 8286A ---------------~ Data In }-----------(=ADO-AD15) The simple system illustrated in Figure 20-19 will not make use of the dual READY clock logic. A single READY input is connected to RDY1. and both of the READY enables are grounded. Thus. the 8086 READY input will be created directly from the 8284 RDY1 input.' 20-87 Figure 20-20 illustrates a slightly more complex 8086 microcomputer configuration. Figure 20-20 uses an 8288 Bus Controller to generate System Bus control signals. The DEN. DT IR. and ALE control outputs. which in Figure 20-19 were generated by the 8086 microprocessor. are now generated by the 8288 Bus Controller.. As a stand-alone microcomputer configuration. Figure 20-20 offers little or 1)0 advantage over Figure 20-19. In a single bus. single 8086 microcomputer configuration. there is no compelling reason to use the 8288 Bus Controller. All it does is add an extra (;omponent to the system without offering any significant logic enhancement. SO S1 S2 GND ~ lOB DEN DT/R 8288 elK ~ ADO AD7 ~ AD A7 8282 O_E A8 ~ STB AD8 A15 8282 BHE AD15 SHE 8086 ADO ADO AD7 AD7 T GND MN/HX DE ~-¥ AD8 l.I: ....J >Cl «llJ r RES ~ .,- Figure + 20~20. ~ 08 015 8286 IAD15 I- 0: 0: RDY1 ~t 1 ~ llJ CIl llJ - Vee 07 8286 AD8 AD15 u DO - READY PClK 8284 I--+-=-=FL'=O':":AT:+--< POINTER ~- ICTCHCTV "" ~---T-C-VC-T-V_--+-~-CV-_:_-TV--~~~t=L~~~/~~~~~~T-T-:-V-:_C-:_X-:_'-~-~~~~~~r-=::~:~-+---...JIJ -+__________-+______ DEN ______ -X I-TCVCTX2. . "., , J X SOFTWARE HALT - (DEN. VOL;RO.W'R.iNTA DTJR = VOH: TI', follow T1. then NMI or INTR - TCLAV Figure 8. 8086 Bus Timing - TCVCTX2 .J DT/A f-'--~ DATA OUT TCVCTV_ { AD15-ADo or: I~--~----~----- r- A15- AO AD15-ADo FlOAT SEE N?lE 3_ j-l TRHAV~1 7- r.L TCLRH ",cr,,_ .f"J WRITE - (RD,INTA DT/A. VOH) DEN - I RD c c:( I \)+-o-::.-=l::--( DATA IN #A'------If---{ ~ - ~ BegIn • new T1 '~'~'''''''~ Minimum Mode System 20-05 8086 ~ VCH LJ '" TCltCHt -TCLAVr- QSe.OS, 'I ~;tlH1CH' _TCl2Cll r\ :-TCLCL_ . -~IJ( -~~ ~ T. Tw r'\ ~ '\ '--- ,~TClSX _ ---- ~---+~--~--+---~---+~r-~--~--~~\ 1'---+--+-.--±=--t--J1 . R: -{' L...TCLAV I-!--TClDV rl--+T~Cl=.X-+-~rl--+__ =====:~ TSVlY TCllV_ .. 'A.. II2IIOUTPUTl -f---- SfENOTE' \ .. --+____~__-+-__ X'--+--+----l---t--~~(SEENOTE31 IHEA, .."" - S7'S) r-- I ~---+---~---+---r----+---~----TRlYCl --l TCll. =~m~=1~~~~~~~~~~~ ~~I_TClRIX ITRVYCH_ ~~ I ~ YOH) ADuAOo I I r- _ I TCLAY --,---,-"",\ ., - TOVCL- HLo.t-\ D.TAIN TAlRlI~ TClRH TClDZ-1 I~~ -r- TRH.V~ .~ ;~ {--+"'''' DnA I UI '2" OUTPUTS ~_TCIAZ - ...... 1".".. - . _[\~S\\\~\\\~'® t-TCHRYX-l --;--r- SEE NOTES r.LOAr TCHll ROY 1121-4 INPUT) READ - ,iNTA.MWTC,AMWTC,IOWC.AIOWC ---- \.. TCHDZL... --t--i.I~ TCVCTY- {. MADC OR ~ 0'" l- TCvCTX,- Ir- TCYCTY- I- ~ I-- TCVCTX1- lCVCTX1- 9' TCYCTX2- ---=cx-I-_T-tCl_.V_-+T_Cl""\DV;I---t_---'-_ _ _ _+-T_CH_DZ_-+--i.r-~~~T WRIT( - (RD.MADC.iOiiC.fIifi.,DTIA ·'11'0"'_ AOl$'''Oo _ _ X,--+-_:--_D._TA_O_U_T-+__+--' .15-"0 -+_-+-__f-TC_VE_V_-+-, I- __ I TCVEX- _ TCYCTX2- "-t--'--+--'---'-+--.-+ -..:..{TCVCTV 'E~ ~?TES 5.1 .1 .MWTC OR Alowe NOTE ') { ; -+---+---+--+---t---,.-{ TCvCTV - .;IrI-_'TC_VCt-TX_'--t_ _ ,iiWfCOAI15W"e INT.- lim,IIIIl!C.IO"C,IIWTe..(JlWTl:,IOWC.~. Vo.·II![. VoJ ' 1. FLOA" J "£SEAVED FOR / .(EE N:j' ;rCT:~,::DE·T ... 0,· ... 00 ~TCHMV "CE . IOfTW'JltE HAlT - IDEN.VoL:RD ... / ,J"n / DTiA I "'~''']~: ~TDVCl- r-TClD:lOAT fr-~P;OIN;TE;Rt-\-~~~~ FlD.T TC~CTX,;Df~rE" ~ TCVCTV-j . .1I80UlPVT5 \ - -MWTC.IOWC.AIOWC.iru.DTIR.V oH FOLLOW',. MOTU , ALlllDNALllWITCM IIT'WUN VOH AND VOL UNUII O'"EIIWI.E ,'fClfIED J fIIOT 'S ...... "LtO N(A" '"liND 0' 'it '3 .NO ' . TO Dl"TUIIIIN( •• '.IIIACH'lfl tuTU ...". TO I ( 1"'11""0 '. :~~OT~~"IO '''":~:ACLT~~: !..;~o~~~~:! ;~!I:!N;:~,l~:~ ~~:~::!~ ~ ~:=~~ Uc'It=~::~I:::~O ItUN AMOTHER • nwO'H'ACYCUI IIIUN lAC. '0 IACII. 'H'_lOCALADOWOAT".UltlflOAT'NOOUIII,NCI'MIIlCONOIIiIITACYCLI . • HlldUANel 0' 'MI . . . COMMAND .... 0 CONTIIOL StQN ..UI..IIIDC ... WTC ..... 'C.tO"C.tOWC.AIOWC .... 'A..... O DIN! LAOS 'HI ACtlVIHIOM,HlCINI ... NI Figure 9. 8086 Bus Timing - I r-- I \TCVCT'2-' 1- \ I-TCYEY --------~----~ "DC.iOiiC.MWTC .... :TI'$ .0"· ... 00 J flOAT "---.y+------_-.-'!::!vCTXl THEN NMI OR INTA-BEGIN NEw Td • \ Maximum Mode System (Using 8288) 20-06 \,~------- 8086 ClK iii.... iNrR o w ~ IX: o11. IX: o(.) ~ irn l"~ NOTE: 1. SETUP REQUIREMENTS FOR ASYNCHRONOUS SIGNALS ONLY TO GUARANTEE RECOGNITION AT NEXT ClK Figure 10. Asynchronous Signal Recognition enw _Any eLK ~ g c,e'.-I ClK C/) C/) ct CI/S LOCK w 2 IX: o en C/) o Figure 11. Bus Lock Signal Timing (Maximum Mode Only) ~ ct o ct @ '''~''~0-Lj{ (s •• noll 3) ~ .. Previous o"nl NOTES: 1. THE 80806 FLOATS S2. 51. SO FROM 1.1.1 STATE ON THIS EDGE 2. THE 8086 FLOATS AxDx BUS. BHE. AND lOCK ON THIS EDGE 3. THE OTHER MASTER FLOATS MASTEAGT Mille, granl i, 'Impled by lOIS Mille' requI.1 II .ampled by 80M 52. 51. SO FROM 1.1.1 STATE ON THIS EDGE 4. THE OTHER MASTER FLOATS AxDx BUS. BHE. AND lOCK ON THIS EDGE Figure 12. RequesllGrant Sequence Timing (Maximum Mode Only) Flguro 13. Hold/Hold Acknowledge liming (Minimum Modo Only) 20-07 (s •• nol. C) 8282/8283 D.C. CHARACTERISTICS FOR 828218283 Conditions: Vee = 5V ± 10%, TA = O·C to 70·C Symbol Parameter Min Max Units -1 V Input Clamp Voltage Ve Test Conditions Ie = -5 mA lee Power Supply Current 160 mA IF Forward Input Current -0.2 IJlA VF = 0.45V IA Reverse Input Current 50 IJft. VA = 5.25V VOL Output Low Voltage 0.50 V 10L = 32 mA VOH Output High Voltage 10FF Output Off Current VIL Input Low Voltage VIH Input High Voltage C IN Input Capacitance 2.4 50 0.8 V 10H = -5 mA IJft. VOFF = 0.45 to 5.25V V 2.0 V 12 F= 1 MHz V BIAS = 2.5V, Vee= 5V T A=25·C pF A.C. CHARACTERISTICS FOR 8282/8283 Conditions: Vee = 5V ± 10%, TA = O·C to 70·C Loading: Outputs - 10L = 32 mA, 10H = - 5 mA, C L = 300 pF Symbol TIVOV TSHOV Not••: Max Units Input to Output Delay Inverting Non·lnverting Parameter Min 25 35 ns ns STB to Output Delay Inverting Non·lnverting 45 55 ns ns 25 ns 50 ns TEHOZ Output Disable Time TELOV Output Enable Time TIVSL Input to STB Setup Time 0 ns TSLIX Input to STB Hold Time 25 nt 10 1. See waveforms and test load circuit on following page. 20-08 ._--- 8282/8283 828218283 TIMING INPUTS Q .W ~ c: oQ. STB c: o o ~ enw ~ g en en c:( OUTPUTS cIS w 2 c: oCO en o ~ NOTE: 1.8283 ONLY - OUTPUT MAY BE MOMENTARILY INVALID FOLLOWING THE HIGH GOING STB TRANSITION. c:( Q c:( @ OUTPUT TEST LOAD CIRCUITS 1.SV 1.5V t, 2.14V ,",~'M' '~~ '"'~~" r~PF r~PF :J.STATE TO VOL 3·STATE TO VOH r~PF SWITCHING D.C. CHARACTERISTICS FOR 8284 Conditions: T A =0·Cto70·C;V ee =5 ±10% Symbol IF Parameter Min Forward Input Current Test Conditions Max Units -0.5 mA V F =0.45V· IR Reverse Input Current 50 I-4A VR= 5.25V Ve Input Forward Clamp Voltage -1.0 V le= -5 mA lee Power Supply Current 140 mA 0.8 VIL Input lOW Voltage V Vee= 5.0V V IH Input HIGH Voltage 2.0 V V ee =5.0V VIHR Reset Input HIGH Voltage 2.6 V Vee= 5.0V VOL Output lOW Voltage V 5mA VOH Output HIGH Voltage ClK Other Outputs Vee- 0 .5 2.4 V V -1 mA -lmA VIHR-VILR RES Input 0.25 V Vee= 5.0V Hysteresis 0.45 20-09 8284 A.C. CHARACTERISTICS FOR 8284 Conditions: TA=o·c to 70·C; Vcc=5 ± 10% TIMING REQUIREMENTS Symbol ,r' ,',9 :' Parameter Min Max Units TEH2EL2 External Frequency High Time 20 ns TEL1EH1 External Frequency low Time 20 ns TElEl EFI Period TEH2EH2 + TEll EH 1 + d XTAl Frequency 12 ns 25 Test Conditions ' ~" (Note 1) MHz TR1VCl RDY1, RDY2 Set-Up to ClK 45 ns TClR1X RDY1, RDY2 Hold to ClK 0 ns TNVR1V Aml, A£N2 Set-Up to RDY1, RDY2 15 ns TClNX AEN1, 0 ns TYHEH CSYNC Set-Up to EFI 20 ns TEHYL CSYNC Hold to EFI 20 ns TYlEH CSYNC Width 2,tc ns TCU1H RES Set-Up to ClK 50 ns (Note 2) Tl1HCl RES Hold to ClK 20 ns (Note 2) AEN2 Hold to ClK TIMING RESPONSES Symbol Parameter TCLCl ClK Cycle Period TCH2CL2 TCL1CH1 TCH1CH2 TCl2Cl1 ClK Rise and Fall Time Max Min Units 125 ns ClK High Time (TClCU3)-11.7 ns ClK low Time (TClCU3) - 23,3 ns 10 ns TPH2PL2 PClK High Time TClCl- 20 ns TPL1PH1 PClK low Time TCLCl- 20 ns 0 ns TRYHCl Ready Set-Up to ClK TClRYl Ready Hold to ClK TElRYl EFI to Ready Inactive Delay TCUl ClK to Reset Delay TClCl+ 30 ns 60 40 ns Note: 1. d = EFI rise + EFI fall_ ?-. Violating these parameters will not create metastable conditions, n NAME 110 EFI 1-1 ClK 0 PClK 0 n LJ \.. RDY1.2 I -~---, AEN1.2 1--+---- READY 0 -+---TEHYL CSYNC RYD1-----TClRYl---+-- I -TYlEH- RESET 0 --=--------', ALL MEASUREMENTS ARE MADE AT 1,5 VOLTS. EXCEPT Tl. T2. TR. TF WHICH ARE MADE AT 0,8 AND 3,5 VOLTS, Figure 3 20-010 ns Test Conditions 8286/8287 D.C. CHARACTERISTICS FOR 828~~8287 Conditions: Vee = 5V ± 10%, TA = O·C to 70·C Symbol cw Parameter Min Max Unlls Ve Input Clamp Voltage -1. V lee Power Supply Current 8287 8286 130 160 mA mA Test Conditions Ie = -5 rnA ~ o D- IF Forward Input Current -0.2 mA VF = O.45V o IR Reverse Input Current 50 ~ 'fR = 5.25V ~ VOL Output Low Voltage B Outputs A Outputs 0.50 0.60 V V 10L = 32 mA 10L = 16 mA V V IOH = -:5 mA IOH = -1mA' 0:: o:: o enw ~ g Output High Voltage B Outputs A Outputs VOH en en ~ cI:I w Z 0:: oIII en o 2.4 2.4 IOFF Output Off Current IF ~ MIL Input Low Voltage 0.8 V VIH Input High Voltage 2.0 VOFF = 0.45to 5.25V " V ~~;.~.; :!: Input Capacitance CIN ~ 12 F= 1 MHz VBIAS=2.5V, Vee::=5V TA =25°C " pF c ~ @ A.C. CHARACTERISTICS FOR 8286/8287 Conditions: Vee = 5V ± 10%, TA = O·C to 70·C Loading: B Outputs - IOL = 32 mA, 'IOH = - 5 mA, CL = 300 pF A Outputs - 0 S'ymbol TIVOV ", IOL = 16 mA, 10H = ..,. 1 inA, CL = 100 pF' , ' Parameter TEHTV Transmit/Receive Hold Time nVEL Transmlt/~ecelve Setup TEHOZ Output Disable Time TELOV Output Enable Time Nole: 1. ~ea Min Input to Output Delay Inverting Non·lnvertlng ~aveforms Max Units 25 35 ns ns TEHOZ ns 30 . ns 10 and tast load circuit on following page, 20-D11 25 n!!l 50 os Test Conditions (S~e Note 1)- 8286/8287 8286/8287 TIMI NG \V INPUTS 11\ II -"'"' CS ) !-TIVOV- ~~:!~':O~t L--- \V Jf\.'------------4--....., OUTPUTS VOL+O.1V ~ .-T_E_H_TV_~.)\(~ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ ~ ___ TT_V_EL_ _ _ ____ TEST LOAD CIRCUITS 1.5V O"'~'" I~PF 2.14V 1.5V o",~H' r 100PF J.uo O"'.i r~PF 3·STATE TO VOL 3-STATE TO VOL B OUTPUT A OUTPUT B OUTPUT 1.SV 1.5V 2.28V L~ OO.~ r~PF O"'~-r 100pF 3·STATE TO VOH 3·STATE TO VOH B OUTPUT A OUTPUT 20-D12 SWITCHING o",~,,·o r 100PF SWITCHING A OUTPUT 8288 '. = 5V ± 10%, Conditions: Vcc ow Symbol TA = O·C to 70·C Parameter , " D.C. CHARACTERISTICS FOR THE 8288 : Min Max Units ' Test ~ondUions = -5 rnA ~ oQ. Vc Input Clamp Voltage -1 V Icc Power Supply Current 170 mA o a: o IF Forward Input Current -0.2 IA Reverse Input Current 50 ~ enw VOL Output low Voltage Command Outputs COfltrol Outputs 0.45 0.45 V V 10L 10L = 32 mA = 16 mA V V 10H 10H = -5 mA = -1 mA a: ~ ~ oo CI) CI) Output High Voltage Command Outputs Control Outputs VOH c( c!I w 2 a: o en CI) o V1L Input low Voltage V1H Input, High Voltage 10FF Output Off Current 2.4 2.4 ~ A.C. CHARACTERISTICS FOR THE 8288 Conditions: Vcc @ = 5V ± 10%, TA 0.8 V 100 ~ ,...;-. ,~ ," ....,. ,4 ~:~y = 0.45V VA = 5.25V VF V 2.0 c( rnA Ic VOFF = 0.4 to 5.25V = O·C to 70·C TIMING REQUIREMENTS Symbol Parameter Min Max Unit TClCl ClK Cycle Period 125 ns TCL1CH1 ClK Low Time 65 ns TCH2CL2 ClK High Time 35 ns TSVCH Status Active Setup 65 tCy-10 ns TSHCl Status Inactive Setup 55 tCy-10 ns Loading TIMING RESPONSES Symbol P~ramoter Min Max Unit 5 45 ns 10 45 ns ALE Active Delay (from ClK) 15 ns ALE Active Delay (from Status) 15 ns ALE Inactive Delay 15 ns TClNH TCHNH Control.Active Delay TCLNL TCHNl Cpntrol Inactive Delay TCllH TSVlH TCHll TCLRL Command Active Delay 10 35 ns TClRH Command Inactive Delay 10 40 ns TCHDTL Direction Control Active Delay 50 ns TCLDTH Direction Control Inactive Delay 30 ns TAElCV Command Enable Time ' TAEHCZ Command Disable Time , 30 ns 30 ns TAEVCV Enable Delay Time 190 ns TAEVNV AEN to DEN 20 ns TCEVNV, CEN to DEN 20 ns TCEVNV CEN to PDEN 20 ns 85 20-013 Loading MADe} i5RC MWTC IOWC INTA AMWTC AIOWC Other 10L 10H CL = 32 mA = -2mA = 300 pF {'O10HL == 10-1rnAmA CL = 80 pF 8288 8288 TIMING DIAGRAM _--T4~ STATE ---T1-- /n ~ ClK -:- TCLLH- ALE /n TSHCL ~ / I ~- 1 - \ \ ADDRESS/DATA n- /n - TSVCH T4- T3 T2 AD DR VALID WRITE DATA VALID / CD _1~TSVlHr- TCHLL l cr \ \ - - -TCLRL I.-TCLRL - \ - _TCLRH J \ TCLNL- \ I I -TCHNH / I TCLNH- f--TCLRH l- J'- l- \ I DEN (WRITE) -. \ PDEN (WRITE) ------- -------Vr-- DT/Ji (READ) TCLDTH- - TCLLH, r- t-TSVLH - TCHNL / ~ \ ;1 / ® MCE 4- / TCLDTH- ;- TCHDTL \ -TCHLL ... OORE5S1DAT ... aUStSS .... OWNQNLYFORR(F(R(NCEPURPQSES 2 LEAOINGEOGEO"Al£ ...... OMC(ISOET(RI...... E08yT .... E" ... ll'NG£OG£OFCLKORSTATUSC.OtNG ... CTIVE WH,CHEVEROCCURSLAST l ALL ', .. ,NG"E"'SUR(M(NTS ... R(M"'OT ATO.YOlTS ...... 020vOlTSUNlESSS PEeiFleOOTHERWISE 20-D14 --- 8288 DEN, PDEN QUALIFICATION TIMING Q CEN w ~ a: oD.. a: o o ~ TAEVNV- en w ... oct oo DEN C/) C/) oct c1J w Z a: o m C/) o ~ oct Q oct @ 8288 ADDRESS ENABLE (AEN) TIMING (3·STATE ENABLE/DISABLE) OUTPUT COMMAND TEST LOAD CIRCUITS l.SV o",~ l.SV 1300 o",~"N o",~uo ..oo pF 3·STATE TO HIGH 1300 2.2SV 2.14V I 300 pF pF COMMAND OUTPUT TEST LOAD 3·STATE TO LOW 3·STATE COMMAND OUTPUT TEST LOAD 20-015 J"" O"'~ I SOPF CONTROL OUTPUT TEST LOAD ~ Chapter 21 ~ THE ZILOG Z8000 II: o U ~ en This chapter will be provided at a later date as an update. w le:( (3 o en en CP CP . DO ~ i2 " .... V ~v bW CP ,5 (' 51 rc5 I· 1 TWO BIT CP UP DOWN COUNTER 01 <5:0 aD QI I 01 02 CP 03 03 - ...~ J J ~~ ...~~ d~-C-~Q,yy,-- lY~I-IL:-_. ___ ...;~____ "- __eJ' 'tJ .\:).:J ___ f-- 6"1: r" . ",I f---- 1> ~IO MICROPROGRAM ~~UNTER REGISTER D3 [ ~ W7 C 02 01 _ _ _ _ _ _ _. _ _ _ ~ Y3 Cn +4 F3 L:7 f--f-- Y7 F2 Y1 f1 YO - FO " 11 INCREMENTER C Figure 22-3. 2909 Microprogram Sequencer Block Diagram 00 CP J .~ 1: 0 : W1 1 W2 I W3 -,---t--l-~ATRIX D' f-- I/O 01 f-- OF MEMORY CellS I I I/O I 13 so r-- f-- REAO/wRITE lOGIC Y2 0--{> I ENABLE UP STAC:::TER 00 0 51 ~ n-{>o- I ".... [~ ~!Q~~ LTIPLEXER o--r-t> FllE_ ENABLE l-ENABlE ~ o PUSH/POP oaf-- I 4. 4 I -+--!--f--- 1/0 IE-::~lEE w~ I Table 22-3. ALU Destination Control RAM FUNCTION MICRO CODE 18 17 16 OCTAL CODE L L L 0 L L H 1 SHIFT a·REG. FUNCTION LOAD SHIFT LO~D NONE ALU (Fi) V OUTPUT RAM. SHIFTER, RAM3 RAMO LOIRI LliRO a SHIFTER a3 ao LOIRI LIIRO Q w ~ oa.. F x X x X F X X X x 29010NLV 1 ALU (Fi) B x X x X 6701 ONLY 2• NONE ALU (Fi) A x X x X F X X X x O·REG (Oi+ 1) F FO IN3 00 IN3 - F FO IN3 00 X a·REG (ai-I) F INO F3 INO 03 F INO F3 x 03 a: a: o o z L iii w L ~ (3 oCI) L H H L L H H 3 NONE ALU (Fi) H L L 4 LEFT (DOWN) ALU (FI + 1) ALU (FI+ 1) ALU (Fi-l) ALU (Fi-l) CI) ct all w Z a: H L H 5 LEFT (DOWN) H H L 6 RIGHT (UP) 7 RIGHT (UP) o In CI) o ~ ct Q ct @ H x' " H H LEFT (DOWN) RIGHT (UP) Don't care. Electrically, the shift pin is a TTL input internally connected to a three·state output which is in the high-impedance state. Monolithic Memories provides the 67110 Control Unit which performs the same functions as the 2909, but in a substantially different way. The 67110 is not described in this chapter. The most important thing to note about microprogram sequencer logic is that it bears a striking resemblance to the program memory addressing logic which will be provided on any microprocessor CPU. The principal difference is that microprogram sequencer logic is more elementary and therefore can execute faster - a necessary prerequisite if microprogram instruction executions are to concatenate in order to generate macroprogram instruction executions. The next important point to note is that the 2909 microprogram sequencer logic, like the 2901 ALU, is a chip slice product. Each 2909 is a4-bit chip slice. One 2909 device is capable of generating four address lines - addressing just sixteen microinstructions stored in ROM. By having two 2909 devices in parallel. you can create an 8-bit address which will access 256 microinstructions stored in program ROM. Each additional 2909 will increase the size of the address by four bits; and the number of microinstructions that can be accessed will increase accordingly. Let us take a look at Figure 22-3. You should begin by looking at the multiplexer. This logic selects and outputs one of four possible address inputs. The two control signals, SO and S1, determine which of the four addresses will be output. The four lines of the address which is selected for output are ORed individually with external inputs ORO - OR3, then the result of the OR is ANDed with a possible zero input. The reason for having the individual ORO - OR3 inputs is to allow branch logic to unilaterally modify an address which is being created. This is the point at which you would implement logic associated with a conditional branch. The AND with zero allows you to unilaterally zero the output address RESTART or other initialization. which you might want to do in response to a These are the four possible address inputs: 1) A direct address input via the pins DO - D3. This is an input which you would use initially to start the execution of a microinstruction sequence, after decoding macroinstruction object code. You could also use these inputs subsequently to force a unilateral branch. 2) The incremented contents of the Microprogram Counter register. The Microprogram Counter register serves exactly the same function as the Program Counter register in a microcomputer. You would initially load a starting address into the Microprogram Counter register. Subsequently the Microprogram Counter register is going to be the normal location from which the mu Itiplexer chooses its output address. After each address from the Microprogram Counter register is selected, the address will be incremented and returned, just as it would be in any microprocessor Program Counter. But there is a difference; since we are dealing with a chip slice product. the total Microprogram Counter register will consist of a number of 4-bit sections. There will accordingly be a carry-in pin and a carry-out pin. so that incrementing can ripple down from one 4-bit section to the next. a 22-7 There is an additional feature of Microprogram Counter register logic. As described in Volume I. Chapter 4. it is frequently necessary to re-execute the same microinstruction many times. For example. you may execute a no operation code a number of times in order to maintain synchronization between microinstructions and the macroinstruction system clock. You may also re-execute a Shift or Rotate microinstruction many times to perform multiple shifts or rotates. In order to save on microprogram ROM. you can inhibit the Microprogram Counter register increment logic by inputting a high value at the CI input to the low order four bits of the Microprogram Counter register. Clearly. this carry input must be zero in the normal course of events. since there is no lower shift that could possibly generate a legitimate carry input. 3) Just as assembly language programs can contain subroutines. so a microinstruction program can also contain subroutines. From our discussion of microprogramming in Chapter 4 of Volume I. you will recall that having subroutines in a microprogram is a very desirable feature. For example. large portions of an instruction fetch. a memory read and a memory write will be implemented via exactly the same microinstruction sequences. By including these microinstruction sequences in a microprogram subroutine. you can save significant amounts of microprogram memory. Microprogram subroutines are just as useful and memory-saving devices as assembly language subroutines. However. since microprograms are likely to be shorter than assembly language programs. the 2909 provides a four-level subroutine Stack. This means that you can nest microprogram subroutines to a depth of four. By inputting FILE ENABLE low. you can pop the top of the four-deep Stack into the multiplexer. or you can push the Microprogram Counter contents into the top of the Stack. Signal PUP. when high. forces the push: when low. PUP forces a pop. 4) The fourth possible input for the multiplexer address is the contents of the Address register. You can at any time input an address to the Address register via the RO - R4 pins. The OE control input allows you to disconnect the microprogram sequencer from the Address Bus. Thus, address outputs may be floated. Observe that although the 2909 microprogram sequencer provides a good deal of the logic needed in order to create address sequences, a great deal of additional logic must still be provided in order to access microprogram . sequencer logic appropriately. The 2910 microprogram sequencer is essentially equivalent to three 2909 slices. That is to say. it provides a 4096 instruction addressing range. The 2910 microprogram sequencer is not described in this chapter. The 2930 and 2931 address generation devices are also new additions to the 2900 series chip slice products. The 2930 and 2931 devices cOrT1pute effective memory addresses needed by assembly language memory reference instructions. Thus. the 2930 and 2931 devices are used to compute external memory addresses which may be required by assembly language level macroinstructions. while the 2909 and the 2910 compute internal memory addresses that may be needed within the microprogram itself. THE 2902 CARRY LOOK AHEAD This device serves Just one function: when performing binary addition, it creates parallel carry inputs for those 4-bit slices that are going to need a carry. Carry look ahead logic has been described in detail, in Volume 1, Chapter 4. We will therefore provide a simple summary of this device in this chapter. Suppose two 16-bit binary numbers are to be added. If each 16-bit number is implemented in four 4-bit slices. then how are you going to generate the carry for the second. third and fourth 4-bit slice? You could perform the binary addition in four steps - in which case at the conclusion of each step you would generate the necessary carry for the next step. This is an unsatisfactory method of performing binary addition when using chip slice logic because it is slow. The whole purpose of chip slice logic is to obtain maximum execution speed. The alternative is to create a device which will anticipate the carry that would be generated and provide it so that all four segments of the 16-bit binary addition can be performed simultaneously. That is exactly what the 2902 device does. Figure 22-4 illustrates the way in which a 2902 Carry Look Ahead device will connect to 2901 ALU slices. As illustrated in this figure. the 2902 device can compute carry look ahead for up to three 4-bit slices - which means that it will support a 16-bit word: remember. the low order slice does not need any carry look ahead. You can generate c~my look ahead for larger words by using a number of 2902s together. In order to generate carry look ahead. the 2902 receives. as inputs. the Carry Generate and Carry Propagate signals from the 2901/6701 ALU slices. For a discussion of this carry look ahead logic see Volume 1. Chapter 4. 22-8 © 00 I/O CARRY-IN N 00 RAMO 00, RAMO Cn Cn YO-3 08-11 04-7 00-3 ADAM OSBORNE & ASSOCIATES. INCORPORATED 03 RAM3 012-15 0151/0 00 RAMO RAM15 I/O Cn Cn Cn+4 OVR F3 FO Y12-15 Y4-7 t;" C V N Z Rl 4700 K _IN_P_U_T_ _ a) Establish setup time with long thold' b) Keeping the leading edge of the input constant (tsetup) vary the trailing edge of the input to determine thold' 50% NOTE: tsetup and thold as defined are positive. Internal delays in the data path may result in a shift of the data waveform to the left, with respect to the clock, resulting in negative hold times. Clk SWITCHING TIME TEST CIRCUIT = VCC = +2.0 Vdc VCCO 50 ohm termination to ground located in each scope channel input. V out Vin 251lF All input and output cables to the scope are equal lengths of 50 ohm coaxial cable. Wire length should be I/O Communication . . Serial to Parallel Interface Logic I Programmable Timers ROM Addressing and Interface Logi~ 1.-.. I t t ~ ~ RAM Addressing and ~ Interface Logic I Read Only . Memory I/O Port, t I t Read/Write Memory ~ Figure 24-1. Logic of the Hewlett Packard MC2 Microprocessor MC2 PROGRAMMABLE REGISTERS AND STATUS The MC2 has eight 16-bitprogrammable,registers and an a-bit Stack Pointer. In addition there is an a-bit I/O Device Identification register. Registers may be illustrated as follows: o 15 RD A1 R2 R3 R4 Also Status register Any ,register may serve as a Data Counter AS R6 I I R7 Stack Pointer (SP) Device Identification register (01) Anyone of the eight 16-bit registers may be used as a Data Counter. 24-2. Register RO serves as the Status register. Its contents are interpreted as follows: 15 14 13 12 11 10 9 8 7 6 5 .. 3 2 o -:I-- Bit No. Status register (RO) cw L ~ a: oQ. a: o o L-_ _ _ _- ~ l- g CI) CI) Low order byte Zero .....- - - - - - Low order byte Negative L-_ _ _ _ _ _ _ _ _ _ Interrupt enable enw e:( F;"t b;t of low onl" by to Priority code .....- - - - - - - - - - - - - - - - Word Zero ' - - - - - - - - - - - - - - - - - - - Word Negative e:( ' - - - - - - - - - - - - - - - - - - - - W o r d Carry all " - - - - - - - - - - - - - - - - - - - - - W o r d Overflow w Z a: oen CI) o ~ e:( c The Zero. Negative. Carry and Overflow statuses in bits 11. 12. 13 and 14. respectively. apply to the 16-bit result of the most recent data operation performed. Zero. Carry and Overflow are standard statuses. as described in Volume I. Chapter 6. The Negative status reflects the sign of the 16-bit result that is to say. it is set to the value of the result's high-order bit. e:( @ The Interrupt Enable flag in Status register bit 7 is set to 1 in order to enable interrupts. It is reset toD in order to disable interrupts. The low-order byte Zero and Negative statuses are identical to standard Zero and Negative statuses. except that they reflect the low-order 8 bits of the most recent operation's result. This may be illustrated as follows: 15 14 13 12 11 10 9 8 7 6 5 .. 3 2 1 0 -=t-- I I II(IIIIIIIII III Bit No. Most recent operation result ~~::=:' I 'L______ ZL status = 1 if all 0; = 0 otherwise ' - - - - - - - - - - - - N L status acquires value of this bit The low-order three Status register bits are referred to as a Priority Code. This Priority Code identifies the highest order 1 bit in the low-order byte of the most recent operation's result. The Priority Code has the value of the bit position being identified. Here are some examples of Priority Codes: Result 15 14 13 12 11 10 9 8 7 6 5 .. 3 2 1 0 Ixlxlxlxlxlxlxlxlol111 10101 15 14 13 12 11 10 9 8 7 6 5 .. 3 2 - = ! - - Bit No. ,0101 O~BitNo. Priority Code .. The Stack Pointer enables a 256-word Stack. The Stack occupies the first 256 words of read/write memory, with memory word 0 being the top of the Stack. 24-3 , CPU registers SO RO S1 S2 R1 R2 S3 R3 S4 R4 S5 R5 S6 S7 R6 R7 ~ : S8 S9 RO 1 - - - - - - - - - 1 R11-_ _ _ _ _ _ _-I 510 511 R2 R3 t - - - S12 S13 R4 R5 J) S14 515 _ _ _ _ _ 16 register bank accessed b Y . - / -----....... 1---------1 R6 R7 ;'. ---------f~ "7) I/O devl"". Esen k>oks ... general purpose registers instructions selected I/O device registers source and destination operands source operands (destinations for MOVE only) Figure 24-2. CPU and ,I/O Device Registers' Organization for the MC2 The I/O Device Identification register, also referred to as a Base register, identifies one of 256 possible external I/O devices. The identified external I/O device will be interpreted as consisting of eight 16-bit registers. When executRAni ...... r_RAni ..... r ... in .... r",. .. inn.. ..hArA m::.I'IA hAhAlAAn rAnic:tArc: ::.nl'l ..inn _;, ."-:;,----.. -::1----_------_ .. -..... _-_.-i.. 1i-t .. __...-IA l'IiffArAn _.... _._ ........ i::.__.. inn ._ ...... --- --_ ... __ .. .._...hA- Ainh -.. .. ..- r.PII -- - --..,-----_... - . _-~ th~ eight regisiets oi ihe ideiiiiiied external device. The two sets of eight registers constitute a 16-register bank out of which two operands are selected. The two operands mayor may not come from the same register. The destination. which is the first identified operand register. is usually one of the CPU registers (RO - R7); only the Register-Register Move instruction permits an external register (RS - R15) to be the destination. This scheme is illustrated in Figure 24-2. MC2 MEMORY ADDRESSING MODES The MC2 is quite limited in its memory reference capabilities. Instructions allow you to load data from memory into a CPU register. or to store data from CPU registers to memory. Data access instructions use direct memory addressing or implied memory addressing. Direct memory addressing instructions are two words long; the second instruction object code word provides the 16bit direct memory address. Instructions that use implied memory addressing allow anyone of the eight CPU registers to specify the 16-bit memory address. Conditional Branch instructions and Subroutine Call instructions allow direct and indirect addressing; however direct addressing is program relative and the displacement is an S-bit signed binary number. HARDWARE ASPECTS OF THE MC2 We are not going to describe pins and signals of the MC2 because Hewlett Packard has not made sufficient information available at the present time. Also. such information will be irrelevant until you can buy the MC2 as a chip. Instead we will provide a brief summary of principal MC2 hardware characteristics. The MC2 is packaged as a 4S-pin package. This allows separate 16-bit Data and Address Buses. together with an adequate set of control signals. Control logic on the System Bus is asynchronous. having a request/acknowledge control 24-4 philosophy. This simplifies multiple CPU configurations. Execution of a "No Operation" instruction puts any CPU into a slave state on the System Bus. at which time its internal registers may be accessed by some other "master" CPU. A slave CPU may be converted into the master via an interrupt request. cw ~ a: oc.. a: o CJ ~ iii w ~ U oen en ct MC2 interrupt logic is primitive but effective. There is one interrupt request line: when an interrupt is acknowledged. a subroutine call to memory location FFFE16 is executed. Memory location FFFE16 must contain the beginning address for the interrupt service routine. THE MC2 INSTRUCTION SET The MC2 instruction set is characterized by a lack of distinction between CPU registers and I/O devices. Most instructions that operate on data or move data are Register-Register instructions: as illustrated in Figure 24-2. each register may be an internal CPU register or a register out of an I/O device. Thus there is no difference between Move instructions that access two CPU registers. one CPU register and an I/O device. or two registers from the same I/O device. This similarity between Register-Register and I/O instructions is manifest by the way in which the MC2 instruction set has been defined in Table 24-1. For a better understanding of MC2 instructions. you must understand the way in which Register-Register instruction object codes are defined. This may be illustrated as follows: oi:I w a: 15 14 13 12 11 10 9 8 Z o a:I en o ~ ct C ct @ t 7 6 5 " 3 0 ~ Bit No. 2 IIII IIIIIIIIIII ~ L IlnstructiL,n object code .~'-C So"". R.g;"., 'l I Source Register 1 Xy y y t4 r~ -- Optional field descriptor: SWB Swap bytes LJL Left justify lower byte LJU Left justify upper byte RJU Right justify upper byte RJL Right justify lower byte RJO Right justify high-order nibble RJ 1 Right justify next-to-high-order nibble RJ2 Right justify next-to-Iow-order nibble RJ3 Right justify low-order nibble REG (FD) The resu It of the operation of the field descriptor on the specified register. SRC (K) Operand field specification of one bit of the register. Register may be any of the 16 registers; K may be any number from 0 to 15. SRC Bit K of Register SRC. <.1> Optional indirection specification. When I is present. the address used is the contents of the memory location addressed. 24-6 <.IF CC> cw ~ a: o0. a: o o ~ u) LABEL. ~ REG w g U) U) c:( all w Z a: o al U) o :!E c:( c c:( @ Optional Condition Code representing a linear combination of the Zero and Negative status flags and "Greater Than": N Z NVZ 000 Not true o 0 1 G - greater than 0 o 1 0 E - equal to 0 o 1 1 GE - greater than or equal to 0 1 0 0 L - less than 0 1 0 1 LG - not equal to 0 0 1 1 LE - less than or equal to 0 1 1 1 Unconditional branch A 16-bit address; it may be the second word in the instruction. or its lower byte may be the lower byte of a one-word instruction. Any of the CPU or external registers. < (REG <.FD » > Optional indexing specification. For example. the instruction: IBR TABLE(9.RJU will calculate an address by clearing the upper byte of the contents of Register 9 and adding the result to the 16-bit word TABLE. Then the contents of the location thus addressed will be the address at which instruction execution continues. RO Register O. the Status register. as described earlier in this chapter. PC . The Program Counter. SP The Stack Pointer. SRC Any of the 16 registers. used as the source of an operand. STATUSES The following status flags are affected by the instructions: o The Overflow status C The Carry status N The Negative or Sign status Z The Zero status L The lower byte statuses NL and ZL The following symbols are used in the STATUSES columns: A blank means the status flag is not affected by the operation. X The operation affects the status flag in a meaningful manner. ? The operation affects the status flag. but it is meaningless. WORD 16 bits of immediate data. Bits y through z of the Register x. For example. PC < 15.8> represents the upper byte of the Prox gram Counter. [ ] Contents of location enclosed within brackets. If a register designation is enclosed within the brackets. then the designated register's contents are specified. If a memory address is enclosed within the brackets. then the contents of the addressed memory location are specified. [[]] Implied memory addressing: the contents of the memory location designated by the· contents of a register. A Logical AND V ¥ Logical OR Logical Exclusive-OR Data is transferred in the direction of the arrow. Exponentiation. 2**K represents a 16-bit word with a 1 in bit K. and 0 in all the other bits. 24-7 Table 24-1. /-\ Summary of the MC2 Instruction Set p---~~------~------------~----~----------STATlIS :s TYPE MNEMONIC LOAD > a: o OPERAND(S) LOAD COST = (CSRC) ctL&. STOR a:0.. LABEL «COST <,FO»> =CSRC STOR (COST) = CSRC ;:E~ OPERATION PERFORMED ;~ L [COSTJ- [LABEL + [CSRC(FO))) Load CPU register from memory using direct addressing or indexed addressing via COST = LABEL «CSRC<,FO»> ;:Ew w U ;:EZ w > a: a: w BYTES I---.----r----rN o c a CPU register. [COST]-[[CSRC]) Load CPU register from memory using implied addressing via a CPU' register. [LABEL + [COST(FOIll-[ CSRC] Store CPU register to memory using direct addressing or indexed addressing via a CPU register. [[ COST])-[ CSRC] Store CPU register to memory using implied addressing via a CPU register. w I-W ~~ Ww ;:Eo.. ~o LOWI COST = WORD LOBI REG = BYTE AOOI COST,BYTE x x X X SUBI COST,BYTE x x X X CMPRI CREG,BYTE x x X X BR 2 o i= C 2 o IBR LA'3EL «REG < ,FD » > CALL LABEL <,I> 2 o ::I: X [COST]-[COST] + BYTE Add immediate 8 bits to lower half of CPU register. [COST]-[COST] - BYTE Subtract immediate 8 bits from lower half of CPU register. [CREG] - BYTE Compare immediate 8 bits with lower half of CPU register. Only the statuses are affected. [ PC] - [REG(FD)l Branch to memory location addressed by register contents or by some operation on the register's contents. [PC1-[ LABEL + [REG(FOIll Branch using direct addressing or indexed addressing via any CPU or extemal register. " 7 If CC is true then [[SPll-[RO] [SP1-[SP] + 1 [RO]-[PC] [PC]-[PC] <15.8>LABEL<7,O> or [PC]-[[PC] <'5,8>LABEL<7.0>] if I is specified Subroutine call- may be conditional or unconditional. If condition is not satisfied, Program Counter is incremented and next instruction is executed. If condition is satisfied. statuses are U Z ct a: III c 2 saved on the stack, the incremented Program Counter is saved in Register O. and the lower 8 bits of,the Program Counter are replaced by the second byte of the instruction. Subroutine starting ct :;) g : REG <,FO> U a: :E ., X [COST]-WORO Load immediate 16 bits to CPU register. [REG <7,O>]-BYTE Load immediate 8 bits to CPU or extemal register. RTN CREG location must be within 256 words of CALL instruction location. [PC]-[CREG] [CREG1-[[SP] - 1] [SP]-[SP] - 1 Subroutine retum - get return address from specified CPU register and pop the stack into that register. © ADAM OSBORNE & ASSOCIATES. INCORPORATED Table 24-1. A Summary of the MC2 Instruction Set (Continued) STATUSES TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES 0 Z 0 cE ZC CBR LABEL <,I > C N Z L If CC is true then [PC]....,.[PC] <15,8>LABEL<7,0> or 2 Q el:Z w . 0 ;:) Q.U Z :!E Z j: ~o Z • :I: 0 OU Y ::::Z el: [pc]-[[ PC) < 15,8 >LABEL <7,0 » if I is specified Conditional branch - if condition is satisfied, then replace lower 8 bits of Program Counter with lower 8 bits of instruction, Branch destination must be within 256 'words of CBR instruction, a: CD a: w MOVE OST -SRC<,FO> Caw Zw> el:a:O STRB COST LORB CSRC<.FO> 2 7 7 X X I- gffi~ I- X [ OST)-[SRClFOIl Move data from register to register. optionally operating on source word. [COsT]-[OI] Move contents of Device Identification register into specifted CPU register. [Ol)-[CSRC(FDII 2 Load Device Identification register with contents of a CPU register. or with lome function of those contents, (/) (; w a: ADD COST,SRC <,FO > 2 X X X X X [COST)-[SRClFOIl+ [COST) (; SUBR COST,SRC < ,FO > 2 X X X X X Add contents of CPU register and any register; deposit result in CPU register. [COST)-[SRClFO)) - [COST] • ffi!i ~ffi CJQ. AND COST,SRC <.FO > 2 7 7 X X X OR COST,SRC<,FO> 2 7 7 X X X XOR COST.SRC<,FO> 2 7 7 X X X CMPR COST.SRC <.FO > 2 X X X X X Exclusive-OR CPU register contents with any register's contents; deposit result in CPU register, [SRClFO)) - [COST] Compare contents of CPU register with those of any register. Only the statuses are aHected, AODC CREG 2 X X X X X [CREG]-[CREG)+ [C) NEG CREG 2 X X X X X Add Carry bit to contents of CPU register. [CREG]-O- [CREG] CMPL CREG 2 7 7 X X X Negate contents of CPU register !twos complement). [CREG]-[CReGl a: w l- (/) w a: 'w ~o C Z el: g w I- el: a: w Q. 0 a: w I(/). (; w a: Subtract contents of CPU register from any register's .contents; delXlsit result in CPU register. [COST]-[SRClFO)) A [COST) AND CPU register contents with any register's contents; deposit result in CPU register. [COST]-[SRClFO)) V [COST] OR CPU register contents with any register's contents; deposit result in CPU register. [COST]-[SRClFO))...,. [COST] Complement contents of CPU register (ones complement!. SHFTL RRL.CREG<,C> 2 X X X X X [(0)..-+5 ... oJ;J [CREG] Rotate CPU register contents left one bit position, through Carry if specified. Table 24-1. A Summ3ry of the MC2 Instruction Set (Continued) '3TATU SES TYPE MNEMONIC SHFTL OPERAND(S) LSL,CREG,F OPERATION PERFORMED BYTES 2 0 C N Z L X X X x x [CREG] Shift CPU register contents left one bit position, filling bit 0 according to F. w ~ 0 a: w w ;:) Q. z 0 a: i= Z SHFTR RRR,CREG<,C> 2 ? X X x x w I- 0 m g aw Rotate CPU register contents right one bit position, through Carry if specified. a: SHFTR LSR,CREG,F 2 ? X X x x [F) ~15 - - -......~ 0 I [CREG] Shift CPU register contents right one bit position, filling bit 15 according to F. z 0 SBIT CDST,SRC(K) 2 ? ? X x x RBIT CDST,SRC{K) 2 ? ? X x x CBIT CDST,SRC(K) 2 ? ? X x x TBIT CDST,SRC{K) 2 ? ? X x x PUSH CREG 2 pop CREG 2 i= ]-1 [CDST]-[SRC] Set the specified bit of the specified register to 1, then deposit result in a CPU register. [SRC]-O [CDST]-[SRC] Reset the specified bit of the specified register to 0, then deposit result in a CPU register. [SRC]-[SRC] [CDST]-[SRC] Complement the specified bit of the specified register, then deposit 'result in a CPU register. [CDST]-[SRC] A 2··K Set all bits of the specified register, except the specified bit, to 0; deposit result in a CPU register. [[SP]]-[CREG] [SP]-[SP] + 1 Store CPU register's contents on top of stack. [CREG]-[[SP] -11; [SP]-[SP] - 1 Load CPU register from top of stack. CPU enters idle state. c w Chapter 25 oa.. SELECTING A MICROCOMPUTER !ia: a: o u ~ enw l- So you have a product and you may want to build it using microcomputer devices. You have two decisions to make: e( U oen en e( 1) 2) Should you use a microcomputer at all7 And if so, which 7 oil Of course, both decisions must be based on minimizing costs. w Z The eventual unit price for any product, whether or not it includes a microcomputer, is given by the equation: a: o F m en P =- o e( ce( @ + V N :!! In the above equation. P represents unit price, F represents fixed costs, V represents variable costs and N represents the number of units you plan to build. Fixed costs are the front-end expense which is essentially insensitive to the number of units you plan to build. Fixed cos~s include the following items: 1) Product evaluation expense. including preliminary market research. 2) Product advertising and promotion expense. 3) The cost of doing a competitive analysis to select a microcomputer. 4) The cost of going from specification to product. Variable costs are the costs that must be incurred for every unit built. These are the contributors to variable costs: 1) The cost of logic components and particularly. whether you have access to second sources for all logic components. A product without a second source may be a product . that becomes significantly more expensive as time goes by. 2) Assembly line expenses. 3) Product testing expenses. FIXED COST CONTRIBUTING FACTORS VARIABLE COST CONTRIBUTING FACTORS While you are still deciding whether to use microcomputer logic or discrete logic, two further considerations must be taken into account: 1) 2) Subsequent product modification After sales servicing Remember, if your product is built around a microcomputer you can make very drastic changes to the product simply by rewriting the microcomputer program. That will result in a single ROM or PROM device having to be replaced. Were the product completely implemented using discrete logic. a similar product change may require one or more boards of logic to be completely replaced. CONTINUING ENGINEERING COSTS The cost of servicing a product built around a microcomputer is significantly less than the cost of servicing a product that uses discrete logic. There are two reasons why this is so. AFTER SALES SERVICE First, a product that is built around a microcomputer is likely to have far fewer components . than the same product implemented entirely out of discrete logic. This means that not on Iy are there fewer parts to malfunction. but when a part does malfunction. it is easier to locate. The second reason that servicing a microcomputor-basod product is cheaper than servicing the same product implemented in discrete logic is that you can write a diagnostic program to test every logic device on a card. Suppose there are 200 logic devices on a large card that includes a microcomputer system. Give each device a number. 25-1 and place eight light-emitting diodes at the card edge. Then write a program which systematically tests every single device on the card to ensure that it is functioning correctly. Any malfunctioning device may be identified using the eight light-emitting diodes to display a binary device number. There are, of course, numerous applications where this simplistic approach to diagnostics will not work, but in many applications the concept has potential. In order to determine whether you should use a microcomputer at all, you must estimate costs, based on fixed and variable expenses, for a product built around a microcomputer, and for a product built entirely out of discrete logic. You must then consider continuing engineering and after sales service economies that may accrue when you build your product around a microcomputer. Assuming that you are going to use a microcomputer, which should you use? Let us examine the impact that microcomputer selection has on fixed and variable costs. First consider variable costs. It may not be immediately apparent, but a microcomputer's instruction set and execution speed will usually have very little impact on variable costs, being overwhelmed by simple pricing considerations. For example, the F8 has an instruction set that will invariably generate longer object programs than an equivalent 8080A system. On the other hand, by combining the 3850 CPU with a 3851 PSU, you have a two-device system which includes a CPU, 1024 bytes of ROM, 64 bytes of RAM, four I/O ports (each of which are 8 bits wide). a programmable timer and a single external interrupt line. Providing your application is simple enough to fit into this small configuration, the fact that the 8080A instruction set is superior, or that 8080A programs execute faster, becomes irrelevant. If your F8 program fits in the minimum 1K bytes of memory, memory savings become irrelevant and it would take seven 8080A devices to give you the same functional capacity as the two F8 devices. Clearly, the seven 8080A devices will cost considerably more. If the FS-based product provides lower parts costs (Variable Costs), but the SOSOA-based product costs less to develop (Fixed Costs), at what point will fixed costs become more important than variable rc_os_t_s_?_ _ ___ Let us answer·the question by looking more clo~elY at factors that contribute to fixed costs. I FIXED COSTS I Of the four cost factors that contribute to fixed costs, only the fourth, the cost of going from specification to pro~uct, can be critically evaluated. We will begin by summarizing, without comment, the steps that lead from a specification to an end product. Using this sequence of events as a framework, we will describe the decisions you must make, and the basis on which you should m~ke these decisions. DESIGNING LOGIC WITH MICROCOMPUTERS-A SEQUENCE OF EVENTS 1) Specify the product. The need for clear and accurate specifications is more critical when a product is to be built around a microcomputer than it would be if the product were to be built around discrete logic. Remember that designing with discrete logic involves a single set of choices - the selection of discrete logic components. When you use a microcomputer, there are two sets of choices: having decided on the CPU and the devices that will surround the CPU, you still have to create a program. which means that enormous flexibilities and variables remain unresol~·ed even after the hardware has been selected. In other words, you are going to be faced with constant hardware/software tradeoffs. Unless an excellent specification defines the product which is to be built the process of compromising between hardware and software will be difficult at best and will result in unforeseen errors at worst. 2) Prepare a preliminary hardware design. Even before you have selected a microcomputer, you will layout a preliminary product design, leaving as "black boxes" those parts of the product which will eventually become the microcomputer system. 3) Specify the microcomputer requirements. The "black boxes" from step 2 can now be expanded into a set of performance criteria uponwhich the selection of a microcomputer will be based. Some iteration between steps 2 and 3 may be required. If the first time you perform step 3, you discover that no microcomputer on the market can meet your performance criteria, redo step 2; relax the demands placed on the microcomputer by identifying the critical steps that the microcomputers cannot handle, then implement these critical steps using discrete logic. In other words, shrink the "black box". If you find that virtually every microcomputer provides overkill for your job as specified, it is worth going back to step 2 to see if some additional logic functions can be performed by the microcomputer. In other words, expand the "black box". 25-2 A frequently made error. when specifying the logic that must be implemented by a microcomputer. is to needlessly include steps that demand extremely fast logic. Remember. none of the microcomputers described in this book are capable of performing real-time events in much less than ten microseconds. Q w !ia: Erring in the other direction. another common mistake is to underestimate what a microcomputer can do. A microcomputer can handle large volumes of data. and can perform complex data manipulations. providing program execution speed is unimportant. 4) Depending on your history as a microcomputer user, it mayor may not be worthwhile doing a competitive analysis of microcomputer products. If it is worthwhile, you will, at this point, narrow the field to two or three products. 5) Write source programs. You must now make a major decision: do you write source programs in assembly language or in a higher level language 7 oD.. a: o o ~ en w Most microcomputer manufacturers now allow you to write source programs in FORTRAN Inters new programming language. PL/M. is also being adopted by a number of microcomputer manufacturers. In all probability. a growing number of nigher level languages will be made available to microcomputer users. As we will discuss later in this chapter. however. using assembly language is frequently less expensive. !i g (I) (I) « 011 w Z 6) a: o Convert the source program to an object program. This step may be handled in one of two ways: you may use a time-sharing computer service or you may use a microcomputer development system. A microcomputer development system looks like a minicomputer system. but is built around the microcomputer of your choice. m (I) o ~ Until you have made a final microcomputer selection. you will likely use a time-sharing service to convert your source programs to object program format. Eventually you are going to need access to a microcomputer development system (for step 7); therefore. it makes sense to get off the time-sharing service and to start using a microcomputer development system as soon as you have made your final microcomputer selection. «Q « @ 7) Convert the object program into Programmable Read Only Memory devices (PROMs). You will do this using the microcomputer development system that supports the microcomputer of your final choice. 8) Build a prototype of your product. Now is the time to ensure that all conceivable errors have been detected and corrected. both in the programs driving the microcomputer and in the logic supporting it. Correcting programming errors and logic design errors will require constant iteration between development steps. perhaps as far back as step 2. 9) Create a ROM mask. Unless your product is a low volume item. or is still being developed. economics dictate that you stop using PROMs and start using ROMs. When you are certain that all your programs are correct. you will define ROM masks for your read only memory devices. ROMs will likely be created for you by the microcomputer manufacturer. Programs that drive your microcomputer now become nothing more than logic devices. and will be handled routinely on the production line. like any other logic device. Within the framework of these nine steps, we are now in a position to explain how you go about estimating product development costs. The most important factor determining microcomputer-based product development costs is the type of assistance you receive, either from the microcomputer manufacturer, or from an alternative source. Product development assistance can be divided into development hardware and system software. Development hardware consists of a minicomputer-like device which you will use to implement some or all of steps 6 through 9. System software consists of program~ that make the hardware usable. We will describe microcomputer development hardware first, and system software next. MICROCOMPUTER DEVELOPMENT HARDWARE At the center of any hardware development system, there will be a box that looks like a minicomputer. In its simplest form, this box closely parallels a minicomputer. Its Central Processing Unit is a microcomputer. which is surrounded by read/write memory. I/O interface. and logic to support the various options available with the microcomputer. All this is packaged in a minicomputer-like box. with a power supply and a front console. This "microminicomputer" will have minicomputer-style peripherals. including an input device. an output device and bulk storage devices. 25-3 A very simple micro-minicomputer system' will consist of the microcomputer box and a teletype. The teletype keyboard is the input device. the teletype printer is the output device. and the teletype paper tape reader/punch is the bulk storage device. Source programs and any other human readable documentation will be printed by the teletype printer. SIMPLE MICROCOMPUTER DEVELOPMENT SYSTEMS The source program you enter and the object program which the computer creates will both be output by the teletype paper tape punch. Subsequently, these paper tapes may be input via the teletype paper tape reader. The first enhancement of this very simple hardware development system will be to stop using the teletype paper tape reader/punch as the bulk storage device, replacing it with a tape cartridge or floppy disk system, which is much faster and easier to handle. . The next enhancements will be to replace the teletype keyboard with a CRT terminal, and the teletype printer with a line printer. . . ' , At this point your microcomputer development system looks remarkably like a small minicomputer system, and you will use it. just as you would use a minicomputer system. to create source programs. and to convert source programs into object programs. . However, your microcomputer development system will have one feature which no minicomputer ever had: on the console of the microcomputer box there will be a plug, into which you can insert unused Programmable Read Only Memory devices. The development system will give you the ability to write any part of your object program into a PROM. via the console plug. You may take the PROM. plug it into a prototype board. and test the prototype product in the traditional way. Every microcomputer manufacturer provides a straightforward microcomputer development system, as described above. The oldest and most popular microcomputers; such as the Intel 8080, now have more sophisti-' cated development systems available. These more sophisticated development systems are produced not only by the microcomputer manufacturer. but by a number of independent companies who are rapidly entering the microcomputer development products business. The first enhancement of the straightforward microcomputer development product, as described above, is a product that allows you to include a hardware simulation of the logic you are developing, within the microcomputer development system. Conceptually, such a system may be illustrated as follows: MICROCOMPUTER CPU CONSOLE RAM SIMULATING MICROCOMPUTER DEVELOPMENT SYSTEMS DATA ENTRY DEVICE MICROCOMPUTER DEVELOPMENT SYSTEM BUS PRINTER BULK STORAGE DEVICE LOGIC TO YOUR MICROCOMPUTER PRODUCT 25-4 Since there is no established term to describe microcomputer development systems as illustrated above, we will call it a "Simulating Microcomputer Development System i ,. In reality, the only parts of your system that will indeed be simulated are read only memory, interrupts, direct memory access and I/O. Q w ~ a: oQ. a: o o ~ u) w ~ g CI) CI) c( o!I w Z a: oen CI) o :!: c( Q c( @ If read only memory can be accurately simulated within the development system. then you will be able to bypass the Programmable Read Only Memory creation step. at least until you are certain (to the extent that you can be certain) that your programs are error-free. By allowing the product you are developing to be handled as though it is an external device. the microcomputer development system serves the double purpose of allowing you to create object programs and. at the same time. of allowing you to check that the object programs. together with your external digital logic. perform as required. In theory. the microcomputer development system can now take you right up to the point where you can define your ROMs and organize a production line. Another development system enhancement that is appearing with greater frequency is the system that can handle more than one microcomputer. Intel. for example. sells not only the Intel 8080A, which is described in this book. but also the Intel 8008. two 4-bit microprocessors and the 3000 Series chip slice. You can use Inters ICE microcomputer development system to develop logic around any of the microcomputers sold by Intel Independent manufacturers of microcomputer development products are attracted to the idea of a microcomputer development system that can be used with more than one microcomputer. since this gives them the flexibility of selling into more than one manufacturer's market. MICROCOMPUTER SYSTEM SOFTWARE Neither a time-sharing computer service nor a microcomputer development system is of any value without programs that give you access .to the capabilities of the system. We refer to these programs collectively as system software. We have described in Volume I, Chapter 6 how a program must first be written in a programming language using pencil and paper. The program is then converted into a sequence of binary digits, stored in computer memory. Microcomputer systems demand an additional step, that is, the creation of a read only memory device, within which the object program is implemented. I I Figure 25-1 illustrates the components of system software which are routinely found in EDITOR microcomputer systems. The Editor. Assembler and Compiler have already been .described in Volume I. Chapter 6. Referring to Figure 25-1. step 1 shows how an Editor program, is loaded into computer memory and is used to create a source program. which is then stored in a computer-readable form on paper tape. magnetic cartridge or disk. The Monitor is a small resident program that simply lets you identify and load individual system software modules. In Figure 25-1, step 2, the source program is either assembled or compiled, depending upon whether the source program was written in assembly language or a higher level language. An object program is created. I MONITOR I I ASSEMBLER I A number of aspects of source and object program creation are not self-evident. The first and most obvious question to ask is whether the amount of memory available in the microcomputer development system for source and object programs will be sufficient. In Figure 25-1. step 2. memory is illustrated holding. at one time. source programs. object programs. an Assembler or Compiler. and a Monitor. What if the source program and object program are simply too big to fit into memory as illustrated? There is another potential problem. the object program developed in step 2 is almost certain to,contain errors. and it is not unreasonable for a source program to be corrected and re-assembled ten. twenty or more times before an error-free object program results. How long will it take to load the Editor for step 1, then reload the Assembler for step 21 Let us first consider those problems associated with the need to constantly edit and re-assemble a source program, while detecting and correcting program errors. Are there any hidden problems to watch out for in this process? 25-5 EDITOR/ ASSEMBLER COMBINED Monitor Monitor A!:sembler Editor or Compiler Source Program Source Program Object Program STEP 2 STEP 1 Monitor Simulator Debug Object Program Object Program Linking Loader STEP 3 STEP 4 60xes represent microcomputer memory space. If your development system uses magnetic tape cassettes or floppy disks as the bulk storage device. you will have no problems; it will just take a few seconds to load either the Assembler or Editor into memory; therefore. an inconsequential amount of time will be wasted shuttling between steps 1 and 2 of Figure 25-1. On the other hand. if you are working with a very low budget and your development system uses the teletype paper tape reader/punch as the storage medium for all programs, you could be faced with a very severe problem; it could take as much as half an hour simply to load the Editor and Assembler into memory. This being the case. you will waste a very substantial amount of time and money watching the teletype paper tape reader monotonously load and punch paper tapes. Some microcomputer manufacturers get around this problem by combining an Editor and Assembler into one program. By breaking up your application into sufficiently small modules. you can generate a single memory load as follows: . MONITOR EDITORi ASSEMBLER SOURCE PROGRAM OBJECT PROGRAM 25-6 Now you do not need to waste time reloading the Editor. and then the Assembler. every time you wish to makeacorrection to your source program. cw ~ a: oa.. a: o o Let us first describe how you go about developing programs which are too big to constitute a single memory load, as illustrated in step 2 of Figure 25-1. The solution is self-evident: create the program in pieces. Implementation of this solution is not quite so straightforward. If the program is to be developed in pieces. then clearly the pieces will each occupy different areas of memory. On the other hand. one specific area of memory may be assigned to object programs by the Assembler. This is the situation which arises: ~ en w ~ YOUR PRODUCT DEVELOPMENT SYSTEM 0000 OOOO~--'"" g 0800 CI) CI) < 1000 a!I w Z a: RELOCATABLE OBJECT PROGRAMS o en 1800 ....- - . . . . . o 2000 ....- - . . . . . CI) l This space reserved for 1800 obJect program 2000 This space used by object programs :E < c < @ 2800 etc. The necessary solution is to create object programs which are one step removed from being truly executable. In these "pseudo-object programs". every object program byte that encodes an absolute memory address will instead encode a displacement from the beginning of the object program. This may be illustrated as follows: PSEUDOOBJECT OBJECT PROGRAM 0400~ 0401 0402 0400 §PROGRAM Program Origin . 0402 0403 0403 I I I 061A~1 I 0 6 1 A § § 1I 0618 I 3A I I I I 061e 06 1C 0610 0401 Jump to memory } location 083A 061C 0610 06lE 061E A Jump to memory } location "Program Origin" plus 043A This pseudo-object program will be loaded into memory by a system software program referred to as a "Relocatable Loader"; the Relocatable Loader acqu ires its name from the fact that it can relocate the pseudo-object program anywhere in memory. changing all the displacement addresses to reflect a new origin. RELOCATABLE LOADER An Assembler which is able to create pseudo-object programs as described above is called a Relocating Assembler. RELOCATING ASSEMBLER 25-7 If programs have been written in pieces and the pieces must be loaded into memory to form a unit, then it is quite possible that a memory reference instruction in one piece of program may reference a label in another piece of program: . PROGRAM 061A [§MEMORY 061B 061C 0610 061E } Jump to memory location ADDR in program module 3 A loader that can relocate program modules and, in addition, link memory references from one module to another is' called a "Linking Loader". A Linking Loader works in conjunction with an Assembler that generates linkable object program modules. I I A Relocating Assembler will replace every absolute address in the object program with a code LABEL TABLE which represents a label number. Then, at the end of the object program. the Assembler will generate a Label Table identifying every label number as representing a specific object program byte in a defined object program module. When the Linking Loader loads object program modules, it will identify the real memory address into which every object program byte which owns a label actually gets loaded. Now the Linking Loader can replace label numbers in object programs with the actual memory address that happens to correspond to the label number. For example, the Jump instruction illustrated above may get encoded by the Assembler as three bytes which say: Jump to label number 4 in program module number 3. At the end of the object program. the Assembler will. in some coded fashion, identify label number 4 as corresponding to byte number 32A16 of program module 3. The Linking Loader will wait until program module number 3 has been loaded into memory, at which time it can determine the exact memory address for byte number 32A16 of program module 3. This memory address is equal to the origin of program module 3, plus 32A16. This becomes the address which the Linking Loader inserts into the Jump in!';tnJ(~tinn The only thing that is important to you, as a microcomputer programmer, is to realize that, given a Relocating Assembler and a Linking Loader, you can write programs in small modules and not have to worry about changing object code depending upon where each module resides in memory. It is very important to ascertain whether a microcomputer development system offers Relocating Assemblers and Linking Loaders, because they will make the task of developing object programs much simpler. I I Once an object program has been created, it must be executed in order to check it for errors. DEBUG Another system software module, referred to as a Debug program, will always be required at this point. The Debug program allows you to conditionally execute your object code. stopping at will to examine the contents of memory or programmable registers. or to temporarily make changes to the object program as a means of determining what went wrong. While you are debugging your object programs, there are certain parts of your system which do not exist and whose presence must therefore be simulated. If you have a Simulating Microcomputer Development System, then the Simulator program only has to simulate interrupts, direct memory access, and external devices communicating through I/O ports. If you have a simple microcomputer development system, then it must have a Simulator capable of representing the entire environment beyond your microcomputer. There is one further set of software modules which is extremely important in the world of minicomputers, but less important in the world of microcomputers; these are Utility and Input/Output routines. I UTILITIES I SUBROUTINE There are a number of programming procedures which virtually every microcomputer application is going to encounter: these include routines to move data around memory. to transfer data betLIBRARY ween memory and external devices. or to perform arithmetic operations. In the world of minicomputers. such programs are bundled up as a package so that a minicomputer programmer never has to write programs to 25-8 perform such basic operations. Instead. a minicomputer program will simply call subroutines out of a subroutine library in order to perform standard operations. Is the same idea feasible in the world of microcomputers? Unfortunately. not always. c w ~ a: oa.. a: o CJ ~ enw ~ oo en en c:( The concept of an I/O subroutine library is doubtful. since from one application to the next. you cannot even be sure that I/O will be implemented in the same way. let alone that external devices will be similar enough to allow any form of general purpose program to control input/output operations. Remember that we are no longer dealing with a CPU that interfaces with standard peripheral devices. such as disk. line printer. card reader. etc: we are dealing with a microcomputer that is connected to various and sundry discrete logic systems. Even such routine operations as multibyte arithmetic frequently cannot. be standardized. One microcomputer system may have a total of 512 bytes of memory: another may have 4096 bytes of memory. In each case. saving bytes will be extremely important. Any type of generalized program will be unacceptable if generality is bought at the price of extra memory bytes. An application that will never require more than 16 binary digit numbers cannot efficiently use a multibyte addition subroutine which has been written to handle multibyte numbers of indefinite length. The fact that someone else has already written that very general purpose multibyte addition program will not prevent you from rewriting your own addition program to serve your very limited needs - and nothing more~ Your highly specialized addition program may only require half as much memory and in a product that may be reproduced thousands of times. oil w Z a: o en en o ~ c:( c c:( @. A microcomputer program written making liberal use of subroutines out of a library may well finish up using twice as much memory as a.program written to meet the immediate needs of a single application. Suppose writing your own program allows you to reduce program memory from 2K bytes to 1K bytes of ROM. Realistically, your programming expenses may be increased $3,000 or $4,000 because you did not use an existing subroutine library (presuming that such a library exists). However, your product does not have to have a very large volume before the extra programming expense becomes trivial compared to the money spent on extra memory devices, larger PC cards, more power supply and higher assembly expenses. The very same argument determines whether you will write your source programs in assembly language or in a higher level language. A higher level language will result in object programs that are anywhere from 2 to 1.4 times as long as the object program would have been had the source program been written in assembly language. On the other hand. it will probably take twice as long to develop programs in assembly language as it would to develop the same programs in a higher level language. You may have to deduct from the time saved. time your programmers spend learning a new language. In any event. it is clear that for very low volume systems. programming in a higher level language has always got to be more economical. In high volume systems. programming in assembly language has always got to be more economical and. depending upon individual circumstances. it becomes a tossup at some intermediate level. AN ECONOMIC EXAMPLE We will now give substance to the discussion of microcomputer development economics by looking at some hypothetical but realistic numbers. Table 25-1 lists possible numbers for three different microcomputers. If we assume that fixed costs consist of programming expense and product development expense only. while variable costs consist of CPU and support device costs only. then Table 25-2 shows how unit costs will vary as a function of product volume. Observe from Table 25-2 that at very low volume, higher language program development is less expensive. If you are building more than a thousand units, on the other hand, in almost every case it will be cheaper to use assembly language programming. Costs associated with products A. Band C have been purposely skewed to demonstrate the impact of fixed and variable costs. Notice that product C. having lower fixed costs. generates the smallest unit price at low volume even though the cost of the microcomputer devices themselves is high. The problem with Table 25-2 is that it oversimplifies the factors which influence eventual unit price. You should look at Table 25-2 as an illustration of general price versus volume relationships and nothing more. 25-9 Table 25-1. Some Typical Microcomputer Based Product and Development Costs MICROCOMPUTER SELECTED PRODUCT A SOURCE OF EXPENSE Microcomputer CPU. plus supportdevices and logic ($/unit) Cost of extra memory if programs are written in higher level language ($/unit) Cost of writing programs ($ total): a) .In assembly language b) In higher level language Cost of developing prototype ($ total) PRODUCT B' PRODUCTC 63 78 91 10 8 3 8000 5500 42000 7500 5000 40000 6500 3000 40000 Table 25-2. Unit Prices For Microcomputer Based Products UNIT PRICE ($) VOLUME PRODUCT A ASSEMBLY PRODUCT A HIGHER PRODUCT B ASSEMBLY PRODUCT B HIGHER PRODUCT C ASSEMBLY PRODUCTC HIGHER 100 500 1000 5000 10000 563.00 163.00 113.00 73.00 68.00 548.00 168.00 120.50 82.50 77.75 553.00 173.00 125.30 87.50 82.75 '536.06 . 176.00 131.00 95.00 90.95 556.00 184.00 137.50 100.30 95.65 524.00 180.00 137.00 102.60 98.30 Assembly = Assembly language programming. Higher = Higher level language programming A LOOK AT THE FUTURE Let us take a moment to gaze into a crystal ball. What types of microcomputer products can we expect to see in the future, and what impact will they have on the minicomputer market? !f thc:-c :: vi'iC ~~uy u:;;igct uf iii;~iuCuiii~utgi dg~iijii whict waS iiut iliiiiicdiatciy Ci~~di-i:iii. uui. i~ Ut:l;UllliIl9 ,,,urt: apparent every day, it is that the way logic is distributed among various devices of a microcomputer chip set is fundamentally the most important feature of any microcomputer product.Asse~bly language instruction sets. addressing modes and even instruction execution times are all of secondary importance in that they become inconsequential providing they meet modest criteria of sufficiency. The logic designer IJsing microcomputers is likely to be far more influenced by control signals on the system bus and by the number of devit'es he 'has t6work with. rather than by the complexity of the instruction set or its addressing modes. And this. we believe. ist:he'key to a future drift into two types of microcomputer product: the logic device and the computer. . ,r":' .' If there will"be a branch of the microcomputer industry which builds minicomputer look-alikes. whqt impact will this have on the microcomputer industry? In truth. most manufacturers of computers. mini or larger. are already scrambling to build their central processing units and support logic out of large scale integration devices; therefore. we may conclude that within ten years every computer will be a microcomputer in that every computer will be built out of large scale integrated logic. This does not mean that the microcomputer manufacturers of today wilt overwhelm the mini~omputer and large computer manufacturers of yesterday. This. is because programming expellsesconstitute an already expended front end fixed cost for most users of minicomputers and larger computers: the hardware savings that might be gained by switching from a minicomputer to a microcomputer are simply insignificant when compared to reprogramming expenses. Therefore. those minicomputer manufacturers who can defend their current sales with existing software are likely to be impacted very little by microcomputers. Those minicomputer manufacturers who are essentially seliing components are likelytq be eliminated from the component market entirely. unless they are able to scale down their minicomputers into microcomputers and survive as component suppliers at the new microcomputer price levels. It' is this reduction in prices that'opens a window for new products such as the National Semiconductor and Signetics microcomputers to attack markets that, look- characteristically like minicomputer markets. These are markets which were suited to minicomputer-tYpe. products. ,but in the past could not use minicomputers because of pricing considerations. Now that minicomputer~!ike dyvices are available for a few hundred dollars. a large number of new markets open up. none of 25-10 which have used minicomputers before and none of which have invested in the front end program development fixed costs; the new markets are therefore equally likely candidates for the old minicomputer manufacturer's product or the new microcomputer manufacturer's product. This pseudo-minicomputer buyer will be interested in buying a great deal of support in addition to hardware and will not be quite so influenced by small dollar differences going from one product to another. c w ~ a: oD. a: o o ~ enw ~ U otJ) tJ) oCt ell w Z a: o al tJ) o ~ oCt C oCt @ It is in the area of discrete logic replacement that we may expect to see the greatest volatility among microcomputer manufacturers. The microcomputer user in this market will usually be buying in huge volumes with very little front end programming expense; therefore. this user has a much greater incentive to switch from one microcomputer to another. based solely on pricing considerations. This being the case. the logic device replacement market is the one which will be hardest for established microcomputer manufacturers to defend. and the most attractive to latecomers into the field. It is quite probable that a microcomputer manufacturer who has not established a market for mls on the system bus and by the number of devices he has to work with. rather than by the complexity of the instruction set or its addressing modes. And this we believe is the key to a future drift into two types of microcomputer product: the logic device and the computer. If there will be a branch of the microcomputer industry which builds minicomputer look-alikes. what impact will this have on the microcomputer industry? In truth. most manufacturers of computers. mini or larger. are already scrambling to build their central processing units and support logic out of large scale integration devices; therefore. we may conclude that within ten years every computer will be a microcomputer in that every computer will be built out of large scale integrated logic. This does not mean that the microcomputer manufacturers of today will overwhelm the minicomputer and large computer manufacturers of yesterday. This is because programming expenses constitute an already expended front end fixed cost for most users of minicomputers and larger computers; the hardware savings that might be gained by switching from a minicomputer to a microcomputer are simply insignificant when compared to reprogramming expenses. Therefore. those minicomputer manufacturers who can defend their current sales with existing software are likely to be impacted very little by microcomputers. Those minicomputer manufacturers who are essentially selling components are likely to be eliminated from the component market entirely. unless they are able to scale down their minicomputers into microcomputers and survive as component suppliers at the new microcomputer price levels. It is this reduction in prices that opens a window for new products such as the National Semiconductor and Signetics microcomputers to attack markets that look characteristically like minicomputer markets. These are markets which were suited to minicomputer-type products. but in the past could not use minicomputers because of pricing considerations. Now that· minicomputer-like devices are available for a few hundred dollars. a large number of new markets open up. none of which have used minicomputers before and none of which have invested in the front end program development fixed costs; the new markets are therefore equally likely candidates for the old minicomputer manufacturer's product or the new microcomputer manufacturer's product. This pseudo-minicomputer buyer will be interested in buying a great deal of support in addition to hardware and will not be quite so influenced by small dollar differences going from one product to another. It is in the area of discrete logic replacement that we may expect to see the greatest volatility among microcomputer manufacturers. The microcomputer user in this market will usually be buying in huge volumes with very little front end programming expense; therefore. this user has a much greater incentive to switch from one microcomputer to another. based solely on pricing considerations. This being the case. the logic device replacement market is the one which will be hardest for established microcomputer manufactu rers to defend. and the most attractive to latecomers into the field. It is quite probable that a microcomputer manufacturer who has not established a market for minicomputer-like devices within the next two or three years will have no further opportunity to do so. however interesting the products he designs. No such window exists in the logic replacement market. where ten years from now a manufacturer who is able to sell microcomputer devices for 1O¢ each. where the going rate has been 25¢ each. will be able to establish himself. In conclusion, we predict that microcomputer devices will separate into minicomputer look-alike and logic device replacements. The minicomputer look-alike market will become increasingly harder to break into and will stabilize fairly quickly. The logic device replacement market will continue to spawn products that look nothing like minicomputers and will continue to be extremely volatile until prices have been driven so low that there is simply no room left for further economie.s. (We have not changed a word of this prediction from the first edition of December, 1975.) 25-11 AN INTRODUCTION TO MICROCOMPUTERS VOLUME 2 SOME REAL MICROPROCESSORS 1978-1979 Update Series Update 5 July 1979 OSBORNE/McGraw-Hili Berkeley, California Update 5 of six of 1978-1979 Update Series to AN INTRODUCTION TO MICROCOMPUTERS: VOLUME 2 -SOME REAL MICROPROCESSORS September 1978, by Adam Osborne with Jerry Kane, published by the Osborne division of McGraw-Hili, Inc. Updates sold on a yearly subscription basis. This update contains the following pages: Table of Contents .......................... xx-c through xx-d replace current page xx-c List of Figures ............................. xxx-a through xxx-b replace current page xxx-a List of Tables .............................. xxxiv-a through xxxiv-b replace current page xxxiv-a Quick Index ................................ xlvi-g through xlvi-h replace current page xlvi-g Chapter 1, The PPS4/1 ..................... 1-49 through 1-D2 insert new material in page number order 1-D 17 through 1-D22 Chapter 9, The MC6809 Microprocessor ...... 9-175 through 9-02 insert new material in page number order 9-D31 through 9-D39 OSBORNE/McGraw-Hili 630 Bancroft Way, Berkeley, California 94710 United States of America (415) 548-2805 TWX 910-366-7277 Copyright ~ 1979 by McGraw-Hili, Inc. All rights reserved. Printed in the United States of America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the publishers. ii TABLE OF CONTENTS - UPDATE 4 CHAPTER 8 9 1:C) ';: >a. o U PAGE The Zilog Z8 ZS Programmable Registers. Memory Spaces. and Addressing Modes ZS Status ZS Microcomputer Pins and Signals ZS External Memory Select Logic ZS Timing and Instruction Execution Interrupt Logic ZS Reset Operation ZS Power-Down and Standby Power Supply ZS I/O Ports and I/O Data Transfers ZS Serial Input/Output ZS Counter/rimer Logic The ZS Instruction Set The ZS Senchmark Program The ZS/64 Development Microcomputer Data Sheets TABLE OF CONTENTS - UPDATE 5 CHAPTER 9 8·1 S-3 S-14 S-14 S-19 S-21 S-23 S-26 S-27 S-2S S-37 S-39 S-44 S-44 S-53 S-D1 PAGE The PPS4/1 PPS4/1 Programmable Registers PPS4/1 Memory Addressing PPS4/1 Status Flags PPS4/1 Input and Output Logic PPS4/1 Pins and Signals PPS4/1 MM76C High-Speed Counter Option Description of PPS4/1 MM76C Counter Subsystem PPS4/1 Series Microcomputer Instruction Execution PPS4/1 Series Microcomputer I nstruction Set The Senchmark Program PPS4/1 Instruction Mnemonics PPS4/1 Instruction Object Codes PPS4/1 Instruction Execution Times PPS4/1 Abbreviations Data Sheets 1-50 1-52 1-53 1-53 1-54 1-55 1-59 1-60 1-65 1-65 1-65 1-65 1-65 1-66 1-66 1-01 The MC6S09 Microprocessor The MC6S09 CPU The MC6S09 Programmable Registers MC6S09 Memory Addressing Modes MC6S09 Status Flags MC6S09 CPU Pins and Signals MC6S09 Timing and Instruction Execution MC6S09 Direct Memory Access MC6S09 Interrupt Processing and Reset The MC6S09 Instruction Set Data Sheets 9-175 9-175 9-176 9-17S 9-1S6 9-1S6 9-1S9 9-191 9-193 9-19S 9-01 Volume 2 Rev, A, Update 5 xx-c 6-79 xx-d LIST OF FIGURES - UPDATE 3 PAGE FIGURE U .E J: ~ ~ (!) u ~ en "en @ :EC) .~ a. 0 u 1-10 1-11 1-12 1-13 1-14 1-15 1-16 1-17 1-18 Logic of the COP400 Series of Microcomputers MICROBUSB Read Sequence MICROBUSB Write Sequence COP410L Signals and Pin Assignments COP411 L Signals and Pin Assignments COP420. COP420C. and COP420L Signals and Pin Assignments COP421. COP421 C. and COP421 L Signals and Pin Assignments COP402 and COP402M Signals and Pin Assignments COP400 Clock Options 1-24 1-29 1-29 1-32 1-33 1-34 1-35 1-36 1-38 9-40 9-41 9-42 9-43 9-44 9-45 9-46 9-47 9-48 9-49 9-50 9-51 9-52 9-53 9-54 9-55 9-56 9-57 9-58 9-59 9-60 9-61 Logic of the MC6801 Microcomputer MC6801 Functional Block Diagram MC6801 Port 3 and Port 4 Usage MC6801 Memory Map MC6801 Internal Registers MC6801 Signals and Pin Assignments MC6801 Typical Mode Selection Circuit MC6801 Interrupt Vectors MC6801 Port 3 Control/Status Register MC6801 Port 3 Used in Handshake Mode MC6801 Single-Chip Mode (Mode 7) MC6801 Expanded. Non-Multiplexed Mode (Mode 5) Interfacing Standard MC6800 Peripherals to the MC6801 MC6801 Non-Multiplexed Bus Timing (Read Cycle) MC6801 Non-Multiplexed Bus Timing (Write Cycle) Expanded. Multiplexed Mode (Mode 6) MC6801 Expanded. Multiplexed System MC6801 Bus Timing for MUX Operation (Read and Write) MC6801 Memory Maps for Multiplexed Operation MC6801 Timer Control/Status Register (TCSR) MC6801 Transmit/Receive Control and Status Register (TRCS) MC6801 SCI Rate/Mode Control Register 9-132 9-134 9-136 9-137 9-138 9-141 9-143 9-144 9-146 9-147 9-149 9-149 9-151 9-151 9-152 9-152 9-154 9-154 9-155 9-157 9-162 9-162 10-1 10-2 10-3 10-4 10-5 10-6 10-7 10-8 10-9 10-10 10-11 10-12 10-13 10-14 10-15 10-16 10-17 10-18 10-19 10-20 10-21 10-22 10-23 10-24 Logic of MCS6500 Series CPU Devices MCS6502 Signals and Pin Assignments MCS6503 Signals and Pin Assignments MCS6504 Signals and Pin Assignments MCS6505 Signals and Pin Assignments MCS6506 Signals and Pin Assignments MCS6512 Signals and Pin Assignments MCS6513 Signals and Pin Assignments MCS6514 Signals and Pin Assignments MCS6515 Signals and Pin Assignments Time Base Generation for MCS650X CPU Input Clocks Logic of the MCS6522 PIA MCS6522 PIA Signals and Pin Assignments Auxiliary Control Register Bit Assignments Peripheral Control Register Bit Assignments Logic of the MCS6530. the R6531 and MCS6532 Multifunction Support Devices Logic Provided by the MCS6530 Multifunction Device MCS6530 Multifunction Device Signals and Pin Assignments Logic Provided by the MCS6532 Multifunction Device MCS6532 Multifunction Device Signals and Pin Assignments Logic Provided by the R6531 Multifunction Device R6531 Multifunction Device Signals and Pin Assignments SY6551 ACIA Signals and Pin Assignments SY6551 Interrupt Service Routine. Status Register Testing Logic Portion 10-3 10-9 10-10 10-11 10-12 10-13 10-14 10-15 10-16 10-17 10-21 10-35 10-36 10-40 10-40 10-55 10-56 10-57 10-60 10-61 10-64 10-65 10-77 10-85 xxx-a Volume 2 Rev. A, Update 5 6-79 LIST OF FIGURES - UPDATE 4 FIGURE 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 8-9 PAGE Functional Logic Included in the Z8 Microcomputer Z8 Microcomputer Block Diagram Z8 Microcomputer Address Spaces Z8 Microcomputer Internal Registers Z8 Microcomputer Signals and Pin Assignments A Z8 Memory Read or Instruction Fetch Machine Cycle A Z8 Memory Write Machine Cycle Z8 Interrupt Acknowledge Sequence Z8 Counter/Timer Logic LIST OF FIGURES - 8-2 8-3 8-4 8-5 8-13 8-22 8-23 8-26 8-39 UPDATE 5 FIGURE PAGE 1-19 1-20 1-21 1-22 1-23 1-24 1-25 1-26 Logic of the PPS4/1 Family of Microcomputers PPS4/1 MM75 Pins and Signals PPS4/1 MM76 and MM76E Pins and Signals PPS4/1 MM76L and MM76EL Pins and Signals PPS4/1 MM77 and MM78 Pins and Signals MM76C Counter Logic PPS4/1 MM76C Pins and Signals Generation of Quadrature Inputs 1-51 1-55 1-56 1-57 1-58 1-61 1-62 1-63 9-62 9-63 9-64 9-65 9-66 9-67 9-68 9-69 9-70 9-71 9-72 9-73 9-74 Logic of the MC6809 Microprocessor MC6809 Direct Page Addressing Scheme MC6809 Post Byte Bit Assignments MC6809 Constant Offset {Indexed Model Addressing MC6809 Constant Offset Indexed Indirect Addressing MC6809 Long Branch Addressing· MC6809 Relative Indirect Addressing MC6809 CPU Signals and Pin Assignments MC6809 E and Q Timing for Write Cycles MC6809 E and Q Timing for Read Cycles MC6809 Timing and Signals for Cycle-Stealing DMA MC6809 Signals for Externally Vectored Interrupts MC6809 SYNC Instruction Logic 9-176 9-178 9-179 9-180 9-183 9-184 9-185 9-187 9-190 9-190 9-192 9-195 9-197 xxx-h LIST OF TABLES - UPDATE 4 TABLE c.i .= :I: ~ co t5u ~ en ..... en 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 Z8 Interrupt Sources Z8 Control Register Contents Following a Reset Z8 I/O Port Data Transfers with Handshaking Z8 I/O Ports O. 1. and 2 Options Su mmary Counter/Timer 0 Baud Rate Generation Mnemonics. Object Code Bits and Interpretation for Z8 Condition Codes A Summary of the Z8 Microcomputer Instruction Set Z8 Instructions Listed by Op-code LIST OF TABLES - @ :E .Ql PAGE 8-24 8-27 8-29 8-30 8-41 8-45 8-46 8-55 UPDATE 5 >- TABLE 0 1-11 1-12 1-13 1-14 1-15 1-16 Summary of the PPS4/1 Family of Microcomputers PPS4/1 ROM Addressing Sequence A Summary of the PPS4/1 Microcomputer Instruction Set PPS4/1 Instruction Mnemonics PPS4/1 MM75. MM76 Instruction Object Codes PPS4/1 MM77. MM78 Instruction Object Codes 1-50 1-53 1-68 1-75 1-76 1-77 9-19 9-20 9-21 9-22 MC6809 Indexed Addressing Post Byte Register Bit Assignments MC6809 Bus Status Signals MC6809 Mnemonics (New and Modified Instructions are Shaded) A Summary of the New and Enhanced Instructions for the MC6809 9-179 9-188 9-202 9-204 c. u PAGE Volume 2 Rev. A, Update 5 xxxiv-a 6-79 xxxiv-b QUICK INDEX - UPDATE 4 (Continued) INDEX c.i .E @ 1: Cl .~ 0. o U PAGE Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Z8 Register Indirect Addressing Registers Serial I/O Character Format Serial I/O Counter/Timer 0 Baud Rate Generator Serial I/O Overflow Error Serial I/O Overrun Serial I/O Parity Error Serial I/O Parity Logic Serial I/O Receive Logic Serial I/O Select Serial I/O Transmit Logic Stack Stack Location Select Stack Pointer Word Addressing Working Registers 8-9 8-6 8-38 8-40 8-38 8-38 8-38 8-37 8-38 8-37 8-38 8-12 8-35 8-35 8-9 8-6 Volume 2 Rev. A. Update 5 xlvi-g 6-79 QUICK INDEX - UPDATE 5 INDEX PAGE E External VMA 9-192 M MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 MC6809 9-191 9-181 9-199 9-182 9-182 9-191 9-188 9-189 9-180 9-192 9-178 9-200 9-194 9-191 9-196 9-178 9-182 9-194 9-193 9-194 9-200 9-199 9-194 9-178 9-199 9-190 9-182 9-185 9-194 9-194 9-196 9-194 9-196 9-198 9-188 9-190 9-181 P PPS4/1 PPS4/1 PPS4/1 PPS4/1 PPS4/1 PPS4/1 PPS4/1 PPS4/1 PPS4/1 Accessing Slow Devices Accumulator Offset Addressing Added Mnemonics Auto Decrement Addressing Auto Increment Addressing Bus Grant Bus State Controls C lock Options Constant Offset Indexing Addressing Cycle-Stealing DMA Direct Page Addressing Exchange Register and Transfer Register Post Byte Fast Interrupt Request Halt Mode DMA Hardware-Software Synchronization Indexed AddreSSing Indexed Indirect Addressing I nterrupt Priorities Interrupt Vector Addresses Interrupt Vectoring by External Devices LEA Instruction Missing Mnemonics Non-Maskable Interrupt Post Byte Push and Pull Instructions Read Timing Relative AddreSSing Relative Indirect Addressing Reset Software Interrupts SWI. SWI2 and SWI3 Stacking During Interrupts Standard Hardware Interrupts SYNC Instruction Use of SYNC for DMA VMA Condition Write Timing Zero Offset Addressing 1-58 1-65 1-64 1-54 1-54 1-53 1-54 1-54 1-53 Clock Logic MM76C Clock Logic MM76C Counter Instructions Decode Matrix Interrupt Inputs Memory Addressing Parallel I/O Serial I/O Status Flags xlvi-h c..i E 1: C'l .~ a. ATTENTION WRITERS o U OSBORNE/McGraw-Hili is seeking qualified contributors to future updates of Volumes 2 and 3. Qualified contributors must have an excellent technical background, and they must be able to write clearly and without bias toward any manufacturer of products covered. Faculty at universities are particularly welcome as contributors. A contributor, when selected, will be assigned a specific category of parts to keep up~ dated. Keeping parts updated will include describing new parts in the category as they appear, and improving the description of parts that are already covered. Individual one-time contributions are also welcome. If you would like to become a contributor to Volume 2 and/or Volume 3, please write stating your qualifications and the categories that you believe you could cover competently. If possible, send us a sample of your work; we suggest two or three pages of a part description following the format presented in these books as closely as possible. Send material to: OSBORNE/McG.raw-Hili 630 Bancroft Way Berkeley, California 94710 Attention: Volume 2/3 Contributors Volume 2 Rev. A. Update 5 7-79 Table 1-10. National Semiconductor COP400 Series Instruction Object Codes INSTRUCTION o .5 @ E .~ >. Co o U ADD ADT AISC ASC CAB CAMO CASC CBA CLRA COMP COMA HLTT ING INIL ININ INL JID JMP data4 addr10 JP JP JSR addr6 addr7 addr10 JSRP LBI addr6 reg.digit LBI LD LDD reg.digitp reg reg.digit OBJECT CODE BYTES 31 4A 0101dddd 30 50 333C 10 4E 00 40 332C 3339 332A 3329 3328 332E FF 011000pp mm 11qqqqqq 1nnnnnnn 011010pp mm 10qqqqqq 33 10rrdddd OOrreeee 00rr0101 23 OOrrdddd 1 1 1 1 1 2 1 1 1 1 2 2 2 2 2 2 1 2 1 1 2 1 2 INSTRUCTION LEI * LOID NOP OBD OGI * OMG RC RET RETSK RMB SC SKC SKE SKGBZ * * * * SKGZ SKMBZ SKT 5MB STII X XABR XAD * * 1 1 2 XAS XDS XIS XOR * This instruction is not available on all COP400 models. data4 data4 bit bit bit bit data4 reg reg.digit reg reg 9BJECT CODE BYTES 33 0110dddd BF 44 333E 33 0101dddd 333A 32 48 49 0100bbbb 22 20 21· 33 000cccc1 3321 000cccc1 41 0100aaaa 0111dddd 00rr0110 12 23 10rrdddd 4F OOrr0111 OOrr0100 02 2 1 1 2 2 * 2 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 * * 1 1 1 1 * This instruction is not available on all COP400 models. Volume 2 Rev. A. Update 5 1-49 7-79 THE PPS4/1 The PPS4/1 family of microcomputers was developed as the single-chip replacement for the Rockwell. PPS4 family. The PPS4/1 family has been used extensively in consumer products. Its sales. like those of the other established 4-bit microcomputers. number in the millions. The PPS4/1 is very similar to the TMS 1000. Both share similar approaches to memory organization. both have a similar I/O structure. and both lack a true interrupt capability. The major differences between the two families are: 1) Most models of the PPS4/1 family have a serial I/O capability. 2) The PPS4/1 microcomputers are not microprogrammable. as is the TMS1 000. 3) The PPS4/1 family has a special purpose member. the PPS4/1 MM76C. which handles high-speed counting. The TMS 1000 has no counterpart to this processor. There are ten members of the PPS4/1 family. They are summarized in Table 1-11. Figure 1-19 illustrates those parts of our general microcomputer model implemented by the PPS4/1 microcomputer. This figure is deceptive. since it would appear that a PPS4/1 has a System Bus. This is not the case. The bus illustrated is purely internal. The only means available to a PPS4/1 for communication to the outside world is. via its I/O pins. No provision for external RAM or ROM has been made. Furthermore. the operations provided are primitive compared to those in 8-bit microprocessors or their support devices. For example. the serial I/O logic of the PPS4/1 cannot be compared to that of the Intel8251 USART. or even the 1602 UART. The serial I/O logic merely serializes a 4-bit nibble into a bit stream (and the inverse). No provision is made for synchronization or for detecting framing or overrun errors. Buffering must be explicitly performed by the software. Nonetheless. the serial I/O interface is a very useful feature. Table 1-11. Summary of the PPS4/1 Family of Microcomputers MM75 MM76 MM76C MM76E MM76EL MM76L MM77 MM77L MM78 MM78L 640 640 640 1024 1024 640 1344 1536 2048 2048 RAM (nibbles) 48 48 48 48 48 48 96 96 128 128 Total I/O Lines 22 31 39 31 31 31 31 31 31 31 ROM (bytes) Conditional Interrupt 1 2 2 2 2 2 2 2 2 2 Input 4 8 8 8 8 8 8 8 8 8 Bidirectional 17 18 18 18 18 18 18 18 18 18 Serial -- 3 3 3 3 3 3 3 3 3 28-pin dual 42-pin quad 52-pin quad 42-pin quad 40-pin dual 40-pin dual 42-pin quad 40-pin dual 42-pin quad 40-pin dual -15 -15 -15 -15 -11 to -6.5 -11 to -6.5 -15 -11 to -6.5 -15 -11 to -6.5 8 8 12 3 3 3 8 3 8 3 Package (Dual In-Line or Quad In-Line) Supply Voltage (V) Supply Current (rnA) All devices of the PPS4/1 family are implemented using PMOS technology. A single -15 volt power supply is required for all members of the PPS4/1 family except the L series parts (MM76EL. MM76L, MM77L, and MM78L). The L series parts will work with a power supply in the range of -11.0 to -6.5 volts with as little as 3 mA of current. This makes them quite suitable for battery powered applications. Most members of the PPS4/1 family operate at a maximum clock frequency of 80 kHz, which gives a 12.5 microsecond cycle time. The L series parts can run at up to 100 kHz, yielding a 10 microsecond cycle time. Since all instructions execute in one or two clock cycles. the PPS4/1 has a slight speed advantage over the TMS 1000. but is at a severe speed disadvantage to the COP series. The primary manufacturer of the PPS4/1' series is: ROCKWELL INTERNATIONAL Microelectronic Device Division P.O. Box 3669 Anaheim. CA 92803 .r 1-50 * Not present on MM75 Clock Logic ** Present only on MM76C U .E Logic to Handle Interrupt Requests from External Devices Accumulator Registeris) Arithmetic and Logic Unit Data Counterisl @ :E Stack Pointer .~ >. a. o u Interrupt Priority Arbitration Program Counter System Bus Interface Logic Interface Logic Interface Logic Read Only Memory I/O Ports Figure 1-19. Logic of the PPS4/1 Family of Microcomputers Volume 2 Rev. A, Update 5 1, -51 7-79 PPS4/1 PROGRAMMABLE REGISTERS PPS4/1 programmable registers may be illustrated as follows: 4-bit Accumulator r--co L __ Data Counter 6- or 7-bit 8 register 17-bit on MM77. MM77L. MM78. MM78L) 5-bit Page register .} ll-bit Program Counter 6-bit Offset register ll-bit SA register r-'--~--'--T--r--r--r--~-'--T·' I i I I I I I I I I Ill-bit S8 register L.-,-__ l._L __ L • • _J __ .L_.L • ..L._..L. __ I (MM77. MM77L. MM78. J MM78L only) I I I I II L__ J. __ 1.__ L._ . J 4-bit X register l One or Two level subro.utine stack (MM77. MM77L. MM78. MM78L only) 4-bit S register The Accumulator acts as a primary Accumulator in a single-address machine architecture. It is the principal source and destination of every arithmetic and logical operation. The B register is the primary Data Counter. The only way to access locations in RAM is implied addressing via the B register. RAM cannot be directly addressed on the PPS4/1. The RAM memory is addressed as a contiguous block of 4bit nibbles. The B register is often .treated as two separate registers concatenated together, called B lower and B upper. B lower consists of the least significant four bits of the B register. while B upper consists of the most significant two or three bits of the B register. This division is necessary due to the 4-bit data paths within the PPS4/1. Many instructions will operate on B lower differently than on B upper. For example. the INCB instruction increments Blower while exclusive-ORing B upper with an immediate value. For this reason it is often convenient to view the RAM memory as a collection of16~nibble pages. Many operations will show a wrap-around effect within a single 16-nibble page. since these operations modify B lower but not B upper. The X register is used as a scratch register and as a buffer register for certain I/O operations. The X register is present on the MM77. MM77L. MM78. and MM78L models of the PPS4/1 family. The S register is used by serial 110 logic. It holds parallel data that is being shifted in or shifted out. The P register is the Program Counter. It consists of two parts. a 5-bit Page register and a 6-bit Offset register. Program memory is separate from data memory and is read-only. Program memory is organized as 32 pages of 64 bytes each. Single-byte subroutine call instructions always transfer to the two highest pages of the program address space. i.e .. pages 30 and 31 (addresses 78016 - 7FF16). The PPS4/1 uses circular shift logic rather than an adder to increment the Program Counter. This means that the instructions in a given page are not in sequential order. This is of no significance except to the assembler and other program development software. Table 1-12 lists the correspondence between execution sequence and physical addresses within a page. The SA register is a return address save register. It is used for saving the return address during a subroutine call. The MM77. MM77L. MM78. and MM78L all have an additional save register called the SB register. The SA and SB registers function as a two-level Stack. Hence the MM77. MM77L. MM78. and MM78L can have two levels of subroutine nesting rather than just one. 1-52 Table 1-12. PPS4/1 ROM Addressing Sequence o .s @ 1:C) .~ c. o U Execution Sequence 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Address Address Binary Value Hex Value Execution Sequence Binary Value Hex Value 000000 100000 010000 001000 000100 000010 100001 110000 01 1000 001100 000110 100011 010001 101000 010100 001010 100101 1 10010 1 1 1001 111100 011110 1 01 1 1 1 0101 1 1 001011 000101 100010 110001 1 1 1000 011 100 001110 100111 010011 00 20 10 08 04 02 21 30 18 OC 06 23 11 28 14 OA 25 32 39 3C 1E 2F 17 OB 05 22 31 38 1C OE 27 13 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 001001 ]00100 010010 101001 1 10100 01 1.010 101101 1 101 10 111011 011 101 101 1 10 1 1 01 1 1 011011 001101 100110 110011 011001 101100 010110 101011 010101 101010 110101 1 1 1010 111101 1 11 110 111111 011111 001111 000111 000011 000001 09 24 12 29 34 1A 20 36 3B 10 2E 37 1B 00 26 33 19 2C 16 2B 15 2A 35 3A 3D 3E 3F 1F OF 07 03 01 PPS4/1 MEMORY ADDRESSING The PPS4/1 contains separate and distinct program and data memories. Program memory is strictly read-only. Instructions cannot be executed out of data memory. Program memory can be addressed only by instruction execution. No means of storing constants in program memory PPS4/1 MEMORY ADDRESSING has been provided other than as the operand of immediate instructions. The branch instructions provided allow program memory to be addressed in its entirety. in banks of 15 pages or as 54-byte pages. The top two pages of program memory are the primitive subroutine pages. These pages can be addressed from anywhere in the program address space by the TM instruction with only a 6-bit address. Frequently used subroutines should be located in these pages. Data memory is addressed via implied addressing. The B register is used as a data counter which addresses data memory. There are no other means of accessing data memory. PPS4/1 STATUS FLAGS The PPS4/1 has only one program-accessible status flag - the Carry. There is also an internal skip status bit; if this bit is set during an instruction execution. the following instruction will be skipped. PPS4/1 STATUS FLAGS Volume 2 Rev. A. Update 5 1-53 7-79 PPS4/1 INPUT AND OUTPUT LOGIC All members of the PPS4/1 family have parallel I/O capability. All members of the PPS4/1 family except the MM75 also have a serial I/O capability. . PPS4/1 PARAllEL I/O There are four types of parallel I/O available in the PPS4/1 series They are: 1) 4-bit parallel inpuLpcirts 2) 4-bit bidirectional ports 3) Discrete I/O lines 4) Conditional interrupts All members of the PPS4/1 family except the MM75 have two parallel input ports. The MM75 has only one parallel input port. These 4-bit ports are referred to as the P inputs. The two P ports are referred to as Channell (pins P1 - P4) and Channel 2 (pins P5 - PS)' The signals entering Channel 2 are internally inverted before reaching the Accumulator. The MM75 implements only Channell. All members of the PPS4/1 family have two bidirectional 4-bit ports. referred to as the R PPS4/1 ports. On all PPS4/1 microprocessors pins R1 - R4 are called Channel A. On the MM75. MM76. DECODE MM76E. MM76EL. and MM76L pins R5 - R8 are called Channel B. On the MM75. MM76 . MM76E. MATRIX MM76EL. and MM76L both the A and B channels' outputs can be obtained from a 16 x S decode matrix. This matrix allows a 4-bit quantity inthe Accumulator to generate an S-bit output. This is very helpful for applications using seven-segment displays. The contents of the decode matrix are alteraqle as a mask option. The standard chip comes with a BCD toseven-segment conversion table in the decode matrix. Loading the Accumulator with the digits 0 - F16 allows Channels A and B to output the seven-segment codes for 0 - 9. A. -. P. D. E. and blank. respectively. The MM77. MM77L. MM7S. and MM78L lack this decode matrix capability. On these processors R5 - R8 are referred to as Channel X. Channel X is routed through the X register on both input and output. Channel A functions normally except for the lack of the decode matrix on output. All members of the PPS4/1 family except the MM75 have a 10-bit discrete I/O port called the D port. The MM75 has a 9-bit D port. The lines comprising the D port can be read or written independently {i.e .. individual bits of the port can be manipulated), This port is designed for use with asynchronous inputs. All members of the PPS4/1 family have two conditional interrupt lines. The MM75. has only PPS4/1 INTERRUPT one dedicated conditional interrupt input. However. RS can be used as either an R input or an interrupt line. The conditional interrupt lines INTO and INT1 are very similar to the D port lines. exINPUTS cept that they can be tested by single instruction. This feature allows the rapid testing of the conditional interrupt lines Note that this is not a true interrupt capability. The microprocessor is not interrupted asynchronously. Instead. the program must test for the interrupt condition and take appropriate a,.c_ti_o_"._ __ a All members of the PPS4/1 family except the MM75 have a serial I/O facility. This facility is implemented via three I/O lines connected to the S register: a serial input line. a serial output line. and a bidirectional serial shift clock line The serial output line is connected to the high-order bit of the S register. Data to be shifted out is first transferred from the Accumulator to the S register. When the S register is shifted. the new high-order bit appears on the serial output line. and the value of the serial input line is shifted into the low-order bit of S. Two types of serial I/O timing are allowed: internal and external. Ifoperation with the internal shift clock is selected. then the shift operation begins after an lOS instruction and takes two cycles of the internal clock (CLKA) for each bit or eight cycles for four bits. A data clock is output on the Shift Clock line. The timing can be illustrated as follows: Internal Clock (CLKAI lOS 2 3 4 . Shift Clock Output Serial Data Output 1-54 5 6 7 8 9 If an externally supplied shift clock is provided, the S register is shifted left once for each CLKA cycle that the shift clock is input high. This timing is shown below: Internal Clock (CLKAI Shift Clock Input _ _ _ _ _ ~ Serial Data ---------~~"---------~~,,,..--------~~'\,..----Output - - - - - - - - - - _ , ' -_____________ ________________ _ _ _ _ __ J~ J~ © E PPS4/1 PINS AND SIGNALS >- Figures 1-20 through 1-23 illustrate the pins and signals for most members of the PPS4/1 family. Note that the .!2l c. o U majority of the signals are consistent across the entire PPS4/1 family. For this reason we will combine the discussions of pins and signals for all members of the PPS4/1 ~amily. The MM76C and its pins and signals are described later in this section. Data inputs are provided by P1 - P8. P1 - P4 constitute the Channel 1 input port. while P5 - P8 constitute the Channel2 input port. RB/INT1 R1 R2 R3 R4 DO D1 D2 D3 D4 D5 D6 D7 VSS 6 7 8 9 10 11 12 13 14 PPS4/1 MM75 28 27 26 25 24 23 22 21 20 19 18 17 16 15 R7 R6 R5 INTO PO P4 P3 P2 P1 TEST VDD Vc CLKA DB Pin Name Description Type DO-DB P1-P4 R1-RB/INT1 INTO,RB/INT1 PO Vc CLKA TEST VDD,VSS Discrete I/O Pins Input Port I/O Port Interrupt Request Power-on Reset Clock Clock Device Test Power, Ground Bidirectional, Open Drain Input Bidirectional, Open Drain Input Input Input Output Input Figure ·1-20. PPS4/1 MM75 Pins and Signals Volume 2 Rev. A, Update 5 1-55 7-79 CLKA EXCLK CLKIN ... .. · Vc VOO VSS TEST P2 P6 Pl P5 P7 P3 P8 -.. ~ 'P4 ... :. ... · VOO PO INTO INTl R5 R6 ..-.. ..-· ... --.. . ~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 PPS4/1 MM76, MM76E 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 . 27 26 25 24 23 22 - .-..... ... ~ - --- --..-.. ---- ......-.-. -- ..- ...... -::- :.-. ----- ......... -" CLKB 09 08 nc 07 06 05 04 03 02 01 00 SSC SOl SOO R4 R3 R2 R1 R8 R7 Pin Name Description Type 00-09 Pl-P8 R1-R8 SOl SOO SSC INTO, INn PO VC, EXCLK, CLKIN CLKA,CLKB TEST VOO,VSS Oiscrete 1/0 Pins Input Port 1/0 Port Serial Oata Input Serial Oata Output Serial Shift Clock Interrupt Request Power-on Reset Clock Clock Oevice Test Power, Ground Bidirectional, Open Orain Input Bidirectional, Open Orain Input Output Bidirectional, Open Orain Input Input Input Output Input Figure 1-21. PPS4/1 MM76 and MM76E Pins an? Signals 1-56 U -= J: ~ ~ (!) u ~ en f' en ... @ ~ Cl .~ a. 0 U ClKB Vc XTLIN XTlOUT VDD P2 TEST P6 P1 P5 P7 P3 P8 P4 PO INTO INT1 R5 R6 VSS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 PPS4/1 MM76l. MM76El 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 ClKA D9 D8 D7 D6 D5 D4 D3 D2 D1 DO SSC SDO SDI R4 R3 R2 R1 R8 R7 Type Pin Name Description DO-D9 P1-P8 R1-R8 SDI SDO SSC INTO.INT1 PO VC. XTLIN. XTlOUT ClKA.ClKB TEST VDD·VSS Discrete I/O Pins Input Port I/O Port Serial Data Input Serial Data Output Serial Shift Clock Interrupt Request Power-on Reset Bidirectional. Open Drain Input Bidirectional. Open Drain Input Output Bidirectional. Open Drain Input Input Clock Clock Device Test Power. Ground Input Output Input Figure 1-22. PPS4/1 MM76L and MM76EL Pins and Signals· Volume 2 Rev. A, Update 5 1-57 7-79 CLKB CLKA CLKIN EXCLK Vc VDD VSS nc TEST P4 P8 P3 P7 P6 P2 P5 VDD Pl PO R5 R6 ---- -.. ... ... --...... .. p ... ... --... p ... -.. . - - -... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 PPS4/1 MM77. MM78 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 --- ..-.-. .. ... -.. .-.. ------.. -... --"" -... -- -- ----- ------ ..--. -- .... -- -.. - ... p --- -..... D9 D8 D7 D6 D5 D4 D3 D2 Dl DO INTl INTO SDI SDO SSC R4 R3 R2 Rl R8 R7 Pin Name Description Type DO-D9 Pl-P8 Rl-R8 SDI SDO SSC INTO.INTl PO VC. CLKIN. EXCLK CLKA. CLKB TEST VDD. VSS Discrete 1/0 Pins Input Port 1/0 Port Serial Data Input Serial Data Output Serial Shift Clock Interrupt Request Power-on Reset Bidirectional. Open Drain Input Bidirectional. Open Drain Input Output. Open Drain Bidirectional. Open Drain Input Input Clock Inputs Clock Outputs Device Test Power. Ground Input Output Input Figure 1-23. PPS4/1 MM77 and MM78 Pins and Signals The bidirectional I/O port is provided by pins R1 - R8. R1 - R4 implement the A port while R5 - R8 implement the B or X port. depending on the microcomputer. The discrete I/O lines are provided by DO - 09. Serial I/O logic is implemented via the SOO. SOl. and SSC pins. SOO is the Serial Data Output line. SOl is the Serial Data Input line. and sse is the Serial Shift Clock line. PPS4/1 ClKA ClKB (except MM751. VC. and PO are common timing and reset pins present on all memCLOCK bers of the PPS4/1 family. There are differences in the clock oscillator options for the low power l LOGIC series. The l series uses two pins. called XTlOUT and XTLIN. while the other members of the PPS4/1 family use EXClK and ClKIN. The standard PPS4/1 (except the MM75) can be connected for either an internal or an external clock. To use the internal clock. a resistor is connected between Vc and VOO. A 56 k 0 resistor will S8t the clock frequency to a nominal 80 kHz ±50%. If more precise timing is required. a precision external oscillator can be used. The external oscillator is connected to ClKIN. and the EXClK pin is tied to VOO. Frequencies within the range 40 kHz to 80 kHz are allowed. 1-58 U .E The l series microcomputers have four timing options available: internal oscillator. external oscillator. crystal. and slave. The internal oscillator and external oscillator options are the same as the standard internal and external clock modes. The crystal mode allows connection of a crystal to drive the internal oscillator. Slave mode is used to synchronize two microcomputers. In this mode ClKA and ClKB are employed as inputs which accept the ClKA and ClKB outputs from another PPS4. The table below shows how an l series device is connected for the four clock options . @ :cen Mode Vc XTLIN XTLOUT ClKA. ClKS Frequency (kHz @ VOO = -8 VI Internal VOO VSS nc Outputs 70-130 External Clock VSS Clock Input nc Outputs 400-800 External Crystal VSS One side of crystal Other side of crystal Outputs :::::800 Slave VOO VOO nc Inputs 50-100 .~ 8c. The PO input pin is the standard power-on reset input. The following circuit will generate a proper reset pulse: VSS~ 0. 47 /L F . o-----,o---ilI~ PO 180 kfi VOO - - - - ( ) - - - - ' The standard power-on reset causes the microprocessor to start execution at location 3C016· This location must contain either a Nap. a Reset Carry. or a Set Carry instruction. The following location may contain any valid PPS4/1 instruction. The INTO and INTl inputs can cause conditional branching when tested by the INTOl. INTOH. INn L. INn H. DINO. and DIN 1 instructions. The TEST input is normally connected to VSS. ROM. RAM. and instruction logic can be tested by connecting TEST to VDD· PPS4/1 MM76C HIGH-SPEED COUNTER OPTION The PPS4/1 MM76C is an enhanced version of the standard PPS4/1 MM76 that contains 16 bits of high-speed counter capability. Fourteen programmable modes of counter operation are available. The options available include: 1) Single 16-bit counter 2) Dual 8-bit counters 3) Quadrature input 4) Event input 5) Up or down counting 6) Automatic preset of counters 7) Shifting of counters Counter control is provided by assigning special meanings to five of the standard PPS4/1' MM76 I/O instructions when the microprocessor is executing in the special counter mode. The rich variety of counter configurations makes the PPS4/1 MM76C a very powerful tool in producing minimal hardware systems. Applications for the PPS4/1 MM76C include motor control with direction sensing. frequency counting. digital-to-analog conversion. and frequency synthesis. Entire control systems can be implemented with only a PPS4/1 MM76C microcomputer. 1-59 Volume 2 Rev. A. Update 5 7-79 Description of PPS4/1 MM76C Counter Subsystem In addition to the standard PPS4/1 MM76 hardware the PPS4/1 MM76C contains logic for the counters. This logic consists of the following functional blocks: 1) Input circuitry 2) Lower counter register (S bits) 3) Lower data register (S bits) 4) Lower carry 5) 6) Upper counter register (S bits) Upper data register (S bits) 7) Upper carry S) Control register (4 bits) 9) Control flip-flops (3 bits) Figure 1-24 shows the relationship of each of these functional blocks to the architecture of the PPS4/1 MM76. The additions to the standard PPS4/1 MM76 are shaded. Eight additional pins are provided for counter control and status. Figure 1-25 shows the device's pins and signals and summarizes those signals not present on the PPS4/1 MM76. The 16-bit counter of the PPS4/1 MM76C is divided into two S-bit counters called the Upper Counter and the Lower Counter. When the counter circuitry is configured as a single 16-bit counter the Upper Counter contains the most significant eight bits and the Lower Counter contains the least significant eight bits. Both counters can be preset using the C/DI serial input line. Data is clocked onto the C/DI serial input line by the serial shift clock SCCID. The timing of this serial input operation is exactly the same as the standard PPS4/1 serial 110 explained above. By this arrangement. external logic can preset the counters. To preset the counters under program control by the PPS4/1 MM76C, simply wire the microprocessor as shown below: Since the PPS4/1 serial I/O logic handles only four bits at a time, two serial transmissions must be executed to load an S-bit counter. The first serial transmission loads the least significant four bits of the Lower Counter; the second loads the most significant four bits of the Lower Counter; the third loads the least significant four bits of the Upper Counter; and the fourth loads the most significant four bits of the Upper Counter. Note that the serial input line C/DI will also be used to load the Control register. Care should be taken to preset the counters only when the PPS4/1 MM76C expects to receive counter data on the C/Dlline. Each counter has a carry bit that is set whenever the counter overflows or underflows. The state of these carries is made available to external logic at the CAS (Lower Counted and CA 16/0 (Upper Counted pins. Associated with each counter is an S-bit buffer register; these are called the Upper Data register and the Lower Data register. Via the Data registers, the Counters may be read while counting is taking place. The Upper Data register has two special functions not implemented in the Lower Data register: shifting and presetting. Shifting of the Upper Data register can occur in only two of the 14 operational modes. Data can be shifted into the Upper Data register via the control/data serial input pin (C/DO and out of the Upper Data register via the Upper Counter's carry bit (CA 16/0). Control of all shifting operations is governed by the control/data serial shift clock (SCc/D). The presetting function automatically transfers the contents of the Upper Data register to the Upper Counter register whenever the Upper Counter overflows. Two input modes are implemented: these are event input and quadrature input. Event input simply counts transitions on the input line. PC 1 is the event input for the Lower Counter and SYEV is the event input for the Upper Counter. Both the Upper and Lower Counters can count up or down. The control of up or down counting on the Lower Counter is set by PC2. When PC2 is high the Lower Counter will count up; when PC2 is low the Lower Counter counts down. The Upper Counter can be set by the program to count either up or down. If the Upper Counter has been configured as the most significant eight bits of a 16-bit counter, its counting direction follows that of the Lower Counter. Event counting can take place at rates up to 2 MHz. 1-60 100lscrete Inputs/Outputs VSS----t VOD----t ,-'OnF VSS ---1 TEST VDO iQ) E I.I"-_....;R,;;;I/.:..O..:..'-..:..4_--.J'-'\. 1/0 .21 >-0. f'v--------r--./ Channel A RI/O 5-8 _---1"""1/'-_ _ ...:..-_ 1/0 f\.---------._' Channel 8 a U r----,.._------------+-- 8P-~~---~----~ DATA IIS.riallnl ~---------------lf,. DATA 0 IS.rial Outi PI 1-4 Upper Data Channel 1 Register IlatchlShiftl PI 5-8 Channel 2 rn:ot---~ Control Register CAl SID IUpper Carryl Serial Data Outl PC2 PCI IUp/DowniIE vent/lnputi ~ Serves 8S Counter Input or Quadrature ENABl CA8 Ciol (Lower (Controll Conry outi SCCIO IShift Clockl SYEV IS.riel for Control/Detat Event Input) Oat. Inputl Inputs Figure 1-24_ MM76C Counter Logic 1-61 Volume 2 Rev. A, Update 5 7-79 R5 R6 R7 R8 R1 R2 R3 R4 SOl SOO SSC DO 01 02 03 04 05 06 07 08 09 XTLIN XPWR XTLOUT CLKB CLKA ---... ·-----.. ·-......--.- ·---..... .. :- - .. .. --- ... -.. . - .-. - ... .. -- ·- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 PPS4/1 MM76C 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 -.. -- -- -. --.. -.. ------ --- -- .... INT1 INTO PO TEST CA16/0 SCC/O C/OI SYEV P4 nc P8 P3 P7 P6 P2 P5 P1 nc nc nc CA8 ENABL PC2 PCl VOO VSS Pin Name Description Tvpe 00-09 P1-P8 R1-R8 SOl SOO SSC INTO.INT1 PO XTLIN. XTLOUT CLKA.CLKB TEST PC1.PC2 ENABL CA8 CA16/0 SYEV C/OI SCC/O XPWR VOO·VSS Discrete I/O Pins Input Port I/O Port Serial Data Input Serial Data Output Serial Shift Clock Interrupt Request Power-on Reset Clock Clock Device Test Input to Lower Counter Upper & Lower Counter Enable Lower Counter Carry Status Upper Counter Carry Status Input to Upper Counter Serial Control or Data Input Shift Clock for C/OI Input Clock Control Power. Ground Bidirectional. Open Drain Input Bidirectional. Open Drain Input Output Bidirectional. Open Drain Input Input Input Output Input Input Input Output Output Input Input Input Input Figure 1-25. PPS4/1 MM76C Pins and Signals Quadrature input mode measures the frequency and relative phase relationship of two input signals. It uses two signals 90 degrees out of phase at PC1 and PC2. Input signals of this type are commonly generated by standard incremental rotation sensors. (See Figure 1-26.) A count is generated any time a transition occurs at PC1 or PC2. The counting direction is determined by the phase relationship between the two inputs. If the signal at PC1 leads the signal at PC2. the counter counts up; if the signal at PC1 lags the signal at PC2. the counter counts down. In systems such as the one outlined in Figure 1-26. a change of phase indicates a change of direction of rotation. The count recorded in the counter over a fixed period is proportional to the rotational velocity. 1-62 c.i .E: I INCREMENTAL ROTATION ENCODER ~ e (!) u ~ m m I' @ :E .Q> >- 0. 0 OPTICAL PICKUP U e + 90° signal to PC2 I I I••- - Stopped ---l~.----Reverse ~----- Forward Rotation------..... I Rotation--------~I I Figure 1-26. Generation of Quadrature Inputs In quadrature input mode a maximum input frequency of 500 kHz on each input is allowed. Quadrature input imposes a few timing constraints that must be maintained to ensure proper operation of the input logic. A count reversal must not occur sooner than 500 ns after the last count. This timing is illustrated below: ~__ \...L_as_t_up_c_o_un_' ( ,;,,' Dow" CO,"' PCl PC2 -.l \_-----~I~I~--_I -I F \ \~________ 500 ns minimum - - - - - - C o u n t Up _I_ Count Down - - - - - - - - - - Volume 2 Rev. A, Update 5 1-63 7-79 Another constraint exists when quadrature input is used with a 16-bit counter. When a carry is produced from the Lower Counter to the Upper Counter. a single phase reversal is handled as outlined above. However. any subsequent phase reversals must not occur for at least three cycles of the microprocessor's CLKA. This timing may be illustrated as follows: ,;,,' Re,e",' ~ ··m \ PC1 r-- mm,mum _r_-_-_-_-_-~~~~c-o-u-n-t-U-p~~~\""--:::::::~t..;~I-.:::::::-C ... !uo, Dowo Pc2--1 .. 'T' . 3 CLKA c v c l e , - < / Secood Reve,,,' -----It~I ....---Co",, r u~" - - - - :.- ----_-~- The Control register and the Control flip-flops control the operation of the counter logic. One of the 14 possible modes of counter operation is selected by writing an appropriate bit pattern into the Control register. The Control flip-flops are set and reset by the special I/O instructions used in counter mode to control the state of the counter logic. Control register contents are interpreted as illustrated below: 3 2 0 " , - B i t No. Control register \ . - - - - Upper Counter Preset Control a = Software preset 1 = Automatic or software preset \ . - - - - - - Lower Counter Input Mode Control a = Quadrature inputs 1 = Event and up/down inputs L -_ _ _ _ _ _ 16-bit Counter Configuration OOxx = Full 16-bit operation 01 Ox = Upper Data register is shift register whose MSB shifts through Upper Carry to CA16/D 011 x = Upper Data Register is shift register with carry output disabled ......- - - - - - - - Counter Length Control a = One 16-bit counter 1 = Two a-bit counters Rather than adding new instructions to the MM76 instruction set to control the counter on the PPS4/1 MM76C. a second meaning is given to a subset of MM76 instructions when the MM76C is MM76C operated in counter mode. On the MM76C the SEG 1 instruction performs the combined funcCOUNTER tions of the standard SEG1 and SEG2 instructions. SEG2 does not perform its regular function: INSTRUCTIONS rather. it initiates the counter mode of operation. In the counter mode the instructions SEG2. lAM. IBM. 11. and 12C are used to control the counter logic. You must use these instructions carefully since their function depends on their sequence in the program. For example. 11 transfers the lower bits of the Lower Data register to the Accumulator if it precedes an 12C instruction. while it transfers the lower bits of the Upper Data register if it follows an 12C instruction. 1-64 The PPS4/1 MM76C internal clock provides a slightly different set of operating modes than the rest of the PPS4/1 family. These operating modes are summarized below: @ Mode XPWR Internal XTLIN XTLOUT CLKA ClKe PPS4/1 MM76C CLOCK LOGIC Frequency (kHz) VSS VDD No Connection Outputs 75-125 External Crystal VDD One side of 3.57 MHz crystal Other side of 3.57 MHz crystal Outputs 89 Slave VSS VSS No Connection Inputs Unspecified ~ .!? ~ 8 PPS4/1 SERIES MICROCOMPUTER INSTRUCTION EXECUTION Almost all PPS4/1 instructions execute in a single clock cycle. Notable exceptions are transfer. cond'itional transfer. and macro instructions. PPS4/1' SERIES MICROCOMPUTER INSTRUCTION SET There are variations in the instruction sets of the different microcomputers of the PPS4/1 series. However. the similarities outweigh the differences. so all the instruction sets are described in Table 1-13. Separate columns have been provided to show which instructions correspond to which microcomputer. The PPS4/1 instruction set is weak when compared to that of other microprocessors. However. the PPS4/1 series was designed as a low-cost digital logic replacement and functions more than adequately in this role. The economics of its use in a high-volume product make any programmer inconvenience irrelevant. The type of product for which tho PPS4/1 is designed is produced in the tens of thousands. An extra week or two of programming offort is insignificant in such an application. THE BENCHMARK PROGRAM As stated in the TMS1 000 section of this chapter. a special benchmark more suited to the 4-bit microcomputers will be used. This benchmark consists of inputting a 1- to 16-nibble packet of data from an input port. LBL BUFFER 11 LBA LOOP 11 XDSK o T LOOP GET BUFFER ADDRESS INPUT BUFFER lENGTH SAVE BUFFER LENGTH INPUT DATA STORE DATA GET MORE DATA PPS4/1 INSTRUCTION MNEMONICS Table 1-13 summarizes the PPS4/1 instruction set. The MNEMONIC column shows the instruction mnemonic, and the operands, if any, are shown in the OPERAND column. Macro instructions (combinations of basic instructions) are not included. The fixed part of an assembly language instruction is shown in UPPER CASE. The variable part (immediate data, label or address) is shown in lower case. PPS4/1 INSTRUCTION OBJECT CODES For instruction bytes without variations, object codes are represented as two hexadecimal digits (e.g., 40). For instruction bytes with variations in one of the two digits, the object code is shown as one 4-bit binary number and one hexadecimal digit (e.g., 5 dddd). For other instruction bytes with variations, the object code is shown as eight binary digits (e.g., 11aa aaaa). The object code, execution time, and instruction length in bytes is shown in Table 1-14 for each instruction. Tables 1-15 and 1-16 list the object codes in numerical order. 1-65 Volume 2 Rev. A, Update 5 7-79 PPS4/1 INSTRUCTION EXECUTION TIMES Tables 1-13 and 1-14 list the instruction execution times in clock periods. Realtime can be obtained by dividing the given number of clock periods by the clock frequency. For example, for an instruction that requires one clock period, a 100 kHz clock will result in a 10 microsecond execution time. PPS4/1 ABBREVIATIONS These are the abbreviations used in this chapter: A aaaaaa AB addr6 addr7 addr10x addr10y addr10z B bit2,bb C CR CR1 CR2 CR3 D dnw2 dnW3 data4 data4x dd ddd dddd DM eeee ffff gg ggg hhhh [INTO] [lNT1] LC LDR P PC PPPP R S SA SB UC UDR X XB xx xxxx [] The 4-bit Accumulator A 6-bit address used to specify an offset within a page !low-order address bits) The 4-bit Accumulator Buffer register A 6-bit address constant A 7-bit address constant A 10-bit address constant in the range 0-37F16 A 1O-bit address constant in the range 0-3FF16 A 10-bit address constant in the range 40016 - 77F16 The 6-bit Data Counter (7 bits in MM77, MM78) A 2-bit immediate field used to specify a single bit in a 4-bit nibble as follows: 002 - selects least significant bit 012 - selects next to least significant bit 102 - selects next to most significant bit 112 - selects most significant bit Carry flag The 4-bit Control register (MM76C only) Control flip-flop 1 (MM76C only) Control flip-flop 2 (MM76C only) Control flip-flop 3 (MM76C only) The 1O-bit discrete I/O port (9 bits on MM75) A 2-bit immediate field . A 3-bit immediate field A 4-bit immediate field A 4-bit non-zero immediate field Two bits of immediate data Three bits of immediate data Four bits of immediate data The 128-bit Decode Matrix (not on MM77, MM78) A 4-bit non-zero immediate field Least significant four bits of an immediate data field wider than four bits Most significant two bits of a 6-bit immediate value Most significant three bits of a 7-bit immediate value Four bits of non-zero immediate data The INTO flip-flop The INT1 flip-flop The 8-bit Lower Counter register The 8-bit Lower Data register The 8-bit Input Port (4 bits on MM75) The 1O-bit Program Counter (11 bits in MM77, MM78) A 4-bit page address (high-order address bits) The 8-bit Input/Output port The 4-bit Serial Input/Output register The 10-bit Subroutine Save register (11 bits in MM77, MM78) The 11-bit Subroutine Save register (MM77, MM78 only) The 8-bit Upper Counter register (MM76C only) The 8-bit Upper Data register (MM76C only) The 4-bit X register (MM77, MM78 only) The 4-bit X register buffer A 2-bit "don't care" A 4-bit "don't care." Values of 00002 and 00012 are not allowed. Contents of the location within brackets. If a register is enclosed by brackets, then the contents of that register 1-66 <> 0 .!: :I: ~ CO ~ u ~ iff 0) ..... 0) A IQ) + 1:C) .~ a. 0 U x If) Subfield specifier. Specifies a subset for a register or memory location. A single digit enclosed by angle brackets specifies only a single bit. Two numbers separated by a comma and enclosed by angle brackets specify a range of bits. The first number specifies the least significant bit position of the subfield. while the second digit specifies the most significant bit. All bits are numbered from least to most significant. with bit 0 being the least significant bit. For example: A <0 > specifies the least significant bit of the Accumulator UC<4.7> specifies the most significant four bits of the Upper Counter register Data is transferred in the direction of the arrow Data is exchanged between two locations If and only if Test for equality between two values Logical AND Multiplication Addition Complement of x Exclusive OR New carry not valid until second cycle after instruction execution completes Value of Carry during previous cycle is used New B register contents may not be valid until second cycle following execution of this instruction lOS executes in one cycle. I/O register shifting continues for B more cycles. Volume 2 Rev. A. Update 5 7-79 Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set OBJECT CODE TYPE MNEMONIC OPERAND(S) MM75 MM76 MM77 MM78 STATUS CLOCK CYCLES C SKIP lAM 1A 1 IBM 1B 1 [A)- [R) <0,3> A [A) Input least significant 4 bits of the R port, ANOed with A, to A. [A)- [R) <4,7> A [A) Input most significant 4 bits of the R port. ANOed with A, to A. , lOA 7B OPERATION PERFORMED 1 [A)new [AB)new - 11 4A 11SK lOS g 12C 40 4B IX 1 60 1 20 1···· 78 1 72 1 OA 18 1 OB 19 1 OX ROS 1 01xx 73 1 71 1 X [AB)old A [R)old <0,3> [A)old [R)new < 0,3> - [AB)new Simultaneously input the least significant 4 bits of the R port, ANOed with the A buffer, to A while transferring the contents of A to the least significant 4 bits of the R port via the A buffer. [A)- [P) <0,3> Input least significant 4 bits of the P port to A. [A) - [P) <0,3> + [A) Input and add least significant 4 bits of the P port to A. Skip if no overflow. Serial ~3~ O~ Shift the Serial I/O register left 4 times. Shifting takes 8 cycles after lOS executes. [A)- [P) <4,7> Input the complement of the most significant 4 bits of the P port to A. [X)- [XB) A [R) <4,7> Input most significant 4 bits of the R port, ANOed with the X register buffer, to the X register. [R) <0,3> - [A) Output Accumulator to least significant 4 bits of the R port. [R) <4,7> -[A) Output Accumulator to most significant 4 bits of the R port. [XB)-[X) [R) <4,7> - [X B) Output X register to 4 most significant bits of the R port via the X buffer. [0) <[B) <0,3> > - 0 Reset the discrete I/O pin selected by the least significant 4 bits of B when B·<4,5> = 112 (MM75, MM76) or B <6> = 0 (MM77, MM78). If B <0,3> = 10102, reset INn flip-flop. If B <0,3> = 10112, reset INTO flip-flop. Copyright © 1979 McGraw-Hili, Inc. Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set (Continued) OBJECT CODE TYPE MNEMONIC OPERAND(S) MM75 MM76 MM77 MM78 CLOCK CYCLES SEG1 OE 1 SEG1 OE 1 SEG2 OF 1 SOS 1 OOxx lAM 1A 1 IBM 1B 1 11 4A 1 -:aG :J .~ c 0 g g 70 1 g a: w IZ ~ 0 u u co ,... :!E :!E STATUS OPERATION PERFORMED C SKIP [R] <0,3> +- [DM] < [A]-S, ([A]-S) +3 > Output the lower order 4 bits of the Decode Matrix entry selected by A to the least significant 4 bits of the R port. B must point to the complement of A. (Except MM76C). [R] +- [DM]· < [A] -S, ([A] -S) + 7 > Output to the R port the S bits selected from the Decode Matrix by the contents of the Accumulator. The B register must point to a RAM location that holds the complement of A. A mask option allows the most significant bit of R to display the current state of C. (MM76C only) [R] <4,7> +- [DM] < ([A]-S) +4, ([A]-S) +7 > Output the higher order 4 bits of the Decode Matrix entry selected by A to the most significant 4 bits of the R port. B must point to the complement of A. Also, a mask option allows R < 7 > to be set to the current state of C. (Except MM76C) [D < [B] <0,3> > +-1 Set the discrete 1/0 pin selected by the least significcmt 4 bits of B when B <4,5>= 112 (MM75, MM76) or B <6> = 0 (MM77, MM7Sl. If B < 0,3> = 10102, reset INT1 flip-flop. If B < 0,3> = 10112, reset INTO flip-flop. [A] +- [R] <0,3> A [A] [UC] +- [LC] +- 0 iff modes 1-5 (16-bit counter modes) [UC] +- 0 iff modes 6-14 A [CR2] = 1 (S-bit counter modes) [LC] +- 0 iff modes 6-14 A [CR 1] = 1 (S-bit counter modes) Input least significant 4 bits of R port, ANDed with A, to A. Clear both counters if configured as a single 16-bit counter. If configured as two a-bit counters clear Lower Counter register if CR 1 flip-flop set. and clear Upper Counter register if CR2 set. [AJ- [RJ<4,7> A [AJ [UC] +- [UDR] Input most significant 4 bits of R port, ANDed with A, to A. Load Upper Counter register from Upper Data register. [A]- [LDR] <0,3> iff [CR1] = 1 A[CR2] = 0 [A]- [UDR] <0,3> iff [CR1] = 0 A [CR2] = 1 If no 12C instruction has been executed, then load A with the least significant 4 bits of the Lower Data register. If an 12C instruction has been executed, then load A with the least significant 4 bits of the Upper Data register. Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set (Continued) OBJECT CODE TYPE MNEMONIC OPERAND(S) MM75 MM76 MM77 MM78 CLOCK CYCLES 12C 4B 1 SEG2 OF 1 ~ .. a! :::J c c " 0 ~ g a: w ..... .!.J o ~ Z :J 0 t) t) CD ,... ~ ~ L data2 500dd 500dd 1 X data2 510dd 5 11dd 1 > a: 0 w ~ t) w Z ~ w >15 a:u. C(W ~a: a: Q. STATUS C SKIP OPERATION PERFORMED [A]- [LDR] <4,7> iff [CR1] = 1 A [CR2] = 0 or [A]- [UDR] <4,7> iff [CR1] = 1 A [CR2] = 0 [CR1]-O [CR2] - [CR2] [CR3]-O The first 12C instruction wi" load A with the most significant 4 bits of the Lower Data register. The second 12C wi" load A with the most significant 4 bits' of the Upper Data register and exit counter mode. Enables counter logic iff [CR 1]= 0 [LDR]- [LC] iff [CR1] = 0 [UDR] - [UC] iff [CR1] = 0 . Gate serial data input to UDR iff [CR1] = 0 Gate serial data input to CR iff [CR 1] ~ 0 UC configured to count up iff [CR 1] ~ 0 Disable UC enable input iff [CR 1] ~ 0 Disable UC preset iff [CR1] ~O LC configured to -quadrature mode iff [CR 1] ~ 0 [CR3]-1 iff [CR1] = 0 [CR1]-1 First SEG2 executed enables counter logic, loads the Upper and Lower Data registers from their respective counters, gates the serial control/data input to the Upper Data register, and sets the CR 1 flip-flop. The second and a" subse. quent SEG2s executed (until counter mode terminates) cause the Upper Counter register to be configured as an up counter, the Lower Counter register to be configured for quadrature inputs, the serial control/data input to be gated to the Control register, the Upper Counter register enable input and preset control to be disabled, and the CR 1 and CR3 flip-flops to be set (MM76C only). [A]-[[B]]; [B] <4,5> - [B] <4,5> + data2 Load the Accumulator from the RAM location addressed by B. Exclusive-OR bits 4,5 of B with data2. [A]--[[Bll; [B] <4,5> - [B] <4,5> + data2. Exchange the Accumulator with the RAM location addressed by B. ExclusiveOR bits 4,5 of B with data2 Copyright (Q 1979 McGraw-Hili, Inc. Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set (Continued) I-:":":,O,:":B=:J:-EC_Tr-::C-:-O:-:D:-::E~~ CLOCK TYPE STATUS MNEMONIC OPERAND(S) MM75 MM76 MM77 MM78 XDSK data2 5 11dd 5 10dd 1'" x XNSK data2 501dd 501dd 1'" x CYCLES C ;; ~ !l o .: ::E E w 0 ::E 2 >w a:O a: ACSK 41 70 l' x ASK 43 zw w u.. w o ::E w ::E > a: < c z o ow X X RB bit2 1 01bb 201bb SB bit2 1 OObb 200bb AISK data4x 6 eeee 6 eeee (/) X w I- < a: DC 66,00 data2 < EOB data3 ::E ~ LAI data4 66,00 1 11dd 2 X 1 X o w I- Q w [A]- -[[Bll; [B] <0,3> - [B] <0,3>-1 [B] <4,5> - [B] <4,5> EBdata2 Exchange the Accumulator with the RAM location addressed by B. Exclusive-OR bits 4,5 of B with data2. Decrement least significant 4 bits of B. Skip if least significant 4 bits of B equal 11112. [A]-- [[Bll; [B] <0,3>-1 [B] <0,3> - [B] <4,5> - [B] <4,5> ~data2 Exchange the Accumulator with the'RAM location addressed by B. ExclusiveOR bits 4,5 of B with data2. Increment least significant 4 bits of B. Skip if least significant 4 bits of B equal 00002. [A] - [A] + [[Bll Add contents of RAM location addressed by B to Accumulator. [A] - [A] + [[Bll + C Add contents of RAM location addressed by B with Carry to Accumulator. Carry not valid for one additional cycle. [A] - [A] + [[Bll + C Add contents of RAM location addressed by B with Carry to Accumulator. Skip if no carry (overflow). Carry not valid for one additional cycle. [A] - [A] + [[Bll Add contents of RAM location addressed by B to Accumulator. [[Bll - 0 Reset bit bit2 of the RAM location addressed by B. [[Bll -1 Set bit bit2 of the RAM location addressed by B. [A] - [A] +data4 Add immediate to Accumulator. Skip if no overflow. EOB w Q. OPERATION PERFORMED SKIP 7 dddd 01ddd x 4 dddd x Same as AISK 6. Must always be followed by NOP as shown. [B] <4,5> - [B] <4,5> (f)data2 Exclusive-OR data2 with most significant 2 bits of B. Skip until next non-LB, -EOB or -LBL instruction. [B] <4,6> - [B1<4,6> (f)data3 Exclusive-OR data3 with most significant 3 bits of B. Skip until next non-LB, -EOB or -LBL instruction. [A]-data4 Load Accumulator immediate. Skip until first non-LAI instruction. Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set (Continued) OBJECT CODE TYPE MNEMONIC OPERAND(S) MM75 MM76 MM77 MM78 LB data4 2 dddd 1 dddd T addr6 11 aa aaaa T addr6 TL addr10x TL addr10y TLB addr10z CLOCK CYCLES STATUS C OPERATION PERFORMED SKIP ...w < a: ~.~ 1 X o ! ..... < 5 w.: e.g w [B] <0,3> - data4 [B] <4,5>-0 . Clear bits 4,5 of B and load least significant 4 bits with data4. Execute any EOB instruction that immediately follows. Skip until next non-LB,-EOB, or -LBL instruction. ~ ~ 2 11 aa aaaa [PC] <0,5> - addr6 [PC] <6,9> - 11.102 iff PC is 38016 - 3FF16 On-page transfer if executing from pages 0-13. If executing on pages 14-15, always jump to page 14. [PC] <0,5> - addr6 [PC] <6,10> -111102 if PC is 78016 -7FF16 On-page transfer if executing on pages 0-29. If executing on pages 30-31, always jump to page 30. [PC]- addr1 Ox Transfer to an address on pages 0-13. [PC] - addr1 Oy Transfer to an address on pages 0-15. [PC] - addr1 Oz Transfer to an address on pages 16-29. 2 Q. ~ .., :::) Z a: RT a: RTSK 3 pppp 11 aa aaaa 02 ...w 3 3 3 pppp 11aa aaaa 3 pppp 3 xxx x 11 aa aaaa 4 2F 2 [PC]~[SA] :::) c ~ 03 2E 2 Z < ...I ...I < u TM addr6 TM addr6 2 10aa aaaa w Z i= :::) 0 a: CD :::) CI) [SA] - [SB] (MM77, MM78 only) Return from subroutine. [PC]-[SA] [SA]- [SB] (MM77, MM78 only) Return from subroutine and skip next instruction . [SA]- [PC] + 1 iff executing from 0 - 37F16 [PC] <0,5> - addr6 [PC] < 6,9 > - 11112 Subroutine call to primitive subroutine page (page 15) if executing on pages 0-13. Jump to primitive subroutine page if executing on pages 14-15. [SB] - [SA] iff executing from 0-77F 16 [SA] + - [PC] + 1 iff executing from 0-77F 16 10aa aaaa 2 X Copyright © 1979 McGraw-Hili, Inc. Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set (Continued) TYPE MNEMONIC OPERAND(S) OBJECT CODE MM75 MM77 MM76 MM78 STATUS CLOCK CYCLES C SKIP [PC] <0,5> -addr6 [PC] < 6, 1 0> 111112 Subroutine call to primitive subroutine page (page 31) if executing on pages 0-29. Jump to primitive subroutine page if executing on pages 30-31. [SA] - [PC] + 1 [PC] - addr1 Ox Subroutine call to pages 0-13 . [SB]-[SA] [SA] - [PC] + 1 [PC] - addr1 Oy Subroutine call to pages 0-15. [SB]-[SA] [SA] - [PC] + 1 [PC]- addr10z Subroutine call to pages 16-29. Z II: ~ I- w II: c_ TMl addr10x TMl addr10y 3 pppp 10aa aaaa 3 TMlB addr10z 30 3 pppp 10aa aaaa 4 Z"C < CD:s 3 pppp 10aa aaaa 3 ..J C ..J '';::: < C CJ 0 w g z ~ ~ 0 II: a:I ~ (I) DINO 07 1 X DIN1 06 1 X 1 1 1 1 1 1 X X X X X X 01 1 X 7F 02 2C 1 1" 3+[A] X X X Z 0 INTOH INTOl INT1H INT1l SKBF SKISl Z 0 SKISl Z 0 ~ C CJ 03 04 05 bit2 o 10bb o 10xx 04 210bb :J: (.) Z < II: a:I SKMEA SKNC TAB 47 01 OPERATION PERFORMED [INTO]-1 Skip next instruction if INTO = O. Set INTO = 1. [INT1]-1 Skip next instruction if INT1 = O. Set INT1 = 1. Skip next instruction if INTO = 1. Skip next instruction if INTO = O. Skip next instruction if INT1 = 1. Skip next instruction if INT1 = O. Skip if bit of RAM location addressed by B and selected by bit2 is O. Skip if discrete input selected by least significant 4 bits of B is O. B <4,5> must be 112. Skip if discrete input selected by least significant 4 bits of B is O. B < 6 > must be O. 8 <0,3> = 10102 selects INT1 flip-flop. 8 < 0,3> = 10112 selects INTO flip-flop. Skip if A equals contents of RAM location addressed by B. Skip if Carry = O. Table lookup based on contents of A. Executes the next instruction, which must be a NOP, TM, T, RT, RTSK, SC, RC, SB, RB, SOS, ROS, OX, IX, or TL. Then skips the next [A] + 1 instructions. [A]- 11112 Table 1-13. A Summary of the PPS4/1 Microcomputer Instruction Set (Continued) OBJECT CODE TYPE MNEMONIC a:w OPERAND(S) STATUS CLOCK CYCLES C SKIP MM75 MM76 MM77 MM78 COM 45 77 1 DC 66,00 66,00 2 LBA 44 76 1··· W LSA 4C ::E LXA 75 1 SAG 07 1 WII-~ ~a: CJW wQ. a:O > 0 a: X I- 1 (; W a: Ii: W I- XAB 46 7A 1··· XAS 4E 74 1 79 1 U) (; W a: XAX U) RC 00 05 1 0 SC DC 06 1 1 NOP 00 00 1 ::l I- ~ I- .U) [A]-[A] Complement Accumulator. [A] -[A] + 6 Decimal correct Accumulator by adding 6. [B] <0,3> - [A] Load least significant 4 bits of B from A. [S]-[A] Load S register from A. [Xl-rAJ Load X register from A: [B] <4,6> 0112 (for next instruction only) Causes B to address roW' 3 for the next instruction only. The contents of Bare not modified. [B]--[A] Exchange B with A. [S]--[A] Exchange S with A: [X]-"-[A] Exchange X with A. W U) OPERATION PERFORMED [C]-O Reset Carry. [C]-1 Set Carry. No operation. Table 1-14. PPS4/1 Instruction Mnemonics MNEMONIC 42 40 41 6 eeee 43 7E 7C 70 6 eeee COM 45 77 1 1 DC DINO DIN1 66,00 07 06 66,00 2 1 1 2 1 1 EOB data2 EOB data3 1 11dd 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1···· 1 1 1 1 1 1 1 1'" 1 1 A AC ACSK AISK data4x ASK @ 1:C) .~ c. o U MM76, MM76 MM77, MM78 BYTES CLOCK OBJECT CODE OBJECT CODE lAM IBM INTOL INTOH INT1L INT1H lOA lOS IX 11 11SK 12C L data2 LAI data4 LB data4 LBA LSA LXA o 1ddd 1A 1B 04 03 04 05 40 7B 20 72 4A 4B 60 78 1 1 1 1 1 l' l' 1 500dd 7 dddd 2 dddd 44 4C 500dd 4 dddd 1 dddd 76 75 1 1 1 1 1 1 NOP 00 00 1 1 OA OB OX RB bit2 RC 18 19 73 201bb 05 1 1 1 1 1 1 1 1 1 1 1 01bb 00 MNEMONIC MM76, MM76 MM77, MM78 BYTES CLOCK OBJECT CODE OBJECT CODE ROS RT RTSK 1 01xx 02 03 SAG SB bit2 SC SEG1 SEG2 SKBF bit2 SKISL SKMEA SKNC SOS 100bb OC OE OF o 10bb o 10xx 47 01 1 OOxx T addr6 TAB TL addrl0x 11 aa aaaa TLB addrl0z 10aa aaaa 3 pppp 10aa aaaa TML addrl0y TMLB addrl0z X data2 XAB XAS XAX XDSK data2 XNSK data2 1 1 1 1 1 2 07 200bb 06 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1" 1 210bb 01 7F 02 70 l1aa aaaa 2C 3 pppp 11 aa aaaa TL addrl0y TM addr6 TML addrl0x 71 2F 2E 510dd 46 4E 511dd 501dd 3 pppp 11 aa aaaa 3 pppp 3 xxx x 11 aa aaaa 10aa 110110 1 1 2 2 3 + [AI 3 2 3 3 4 1 2 2 3 3 pppp 10aa aaaa 30 3 PPPP 10aa aaaa 2 3 3 4 5 lldd 7A 74 79 510dd 501dd 1 1 1 1 1 1 1 1'" 1 1 1'" 1'" Volume 2 Rev. A, Update 5 1-75 7-79 Table 1-15. PPS4/1 MM75, MM76 Instruction Object Codes OBJECT CODE MNEMONIC OBJECT CODE MNEMONIC 00 01 02 03 NOP SKNC RT RTSK 42 43 A ASK 04 05 06 07 INTOL INT1H DIN1 DINO 44 45 46 47 LBA COM XAB SKMEA 08 -OB SKISL or SKBF 0 - SKBF 3 SC RC SEG1 SEG2 48,49 4A 4B not used 11 12C 4C 40 4E 4F LSA lOS XAS not used OC 00 OE OF 10 - 13 14 - 17 50 - 53 54 - 57 58 - 5B 5C - 5F SOS or SB 0 - SB 3 ROS or RB 0 - RB 3 18 19 1A 1B OA OB lAM IBM 1C - 1F 20 - 2F 3 pppp 10aa aaaa 3 pppp 11aa aaaa EOB 0 - EOB 3 LB 0 - LB F TML pp ppaa aaaa TL pp ppaa aaaa 40 41 AC ACSK 1-76 L XNSK X XDSK 0 0 0 0 -L 3 - XNSK 3 -X 3 - XDSK 3 60 - 6F 66,00 70 - 7F AISK 0 - AISK F DC,NOP LAI 0 - LAI F 80 90 AO BO - 8F - 9F -AF - BF TM 3F TM 2F TM'1F TM OF CO DO EO FO - CF OF EF FF - TM - TM - TM - TM 30 20 10 00 T 3F - T 30 T 2F - T 20 T1F-T10 T OF - TOO Table 1-16. PPS4/1 MM77, MM78 Instruction Object Codes OBJECT CODE MNEMONIC OBJECT CODE MNEMONIC 00 01 02 03 NOP SKISL SKNC INTOH 61 - 6F 66,00 AISK 1 - AISK F DC 70 71 04 05 06 07 INT1L RC SC SAG 72 SOS ROS IX OX 08 10 20 24 - iQ) :E Cl .~ 0.. o OF 1F 23 27 28 - 2B 2C 20 2E 2F U 30, 30, 3 3 3 pppp, 10aa aaaa 3 pppp, 11 aa aaaa pppp, 1Oaa aaaa pppp, 11 aa aaaa 40 -4F 50 - 53 54 - 57 58 - 5B 5C - 5F 60 EOB LB SB RB 0 0 0 0 73 - EOB 7 - LB F - SB 3 - RB 3 SKBF 0 - SKBF 3 TAB lOS RTSK RT TMLB 01 pp ppaa aaaa TLB 01 pp ppaa aaaa TML OOpp ppaa aaaa TL OOpp ppaa aaaa LAI L XNSK XDSK 0 0 0 0 77 XAS LXA LBA COM 78 79 7A 7B 12C XAX XAB lOA 7C 70 7E 7F AC ACSK A SKMEA 74 75 76 - LAI F -L 3 - XNSK 3 - XDSK 3 X 0 -X 3 11SK 80 90 AO BO - 8F 9F AF BF CO DO EO FO - CF OF EF FF TM TM TM TM 3F 2F 1F OF - TM - TM - TM - TM 30 20 10 00 T 3F - T 30 T 2F - T 20 T1F-T10 T OF - TOO Volume 2 Rev. A. Update 5 1-77 7-79 1-78 DATA SHEETS This section contains specific electrical and timing data for the following devices: • • • • TMS1000 series microcomputer COP420/421 microcomputers COP402/COP402M ROM less microcomputers PPS4/1 Series Microcomputers Volume 2 Rev. A, Update 5 1-01 7-79 'TMS 1000/1200 AND TMS 1100/1300 ABSOLUTE MAXIMUM RATINGS OVER OPERATING FREE·AIR TEMPERATURE RANGE (UNLESS OTHERWISE NOTED)* . -20V "":'20 V to 0.3 V -20 V to 0.3 V -20 V to 0.3 V -24mA -14mA -48mA -28mA 400mW 600mW O°C to 70°C -55°C to 150°C Voltage applied to any device terminal (see Note 1) Supply voltage, VDD Data input voltage Clock input voltage . Average output current (see Note 2): 0 outputs R outputs Peak output current: 0 outputs . R outputs . Continuous power dissipation: TMS 1000/1100 N L . TMS 1200/1300 N L . Operating free-air temperature range Storage temperature range. ·Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to thll' device. This is a stress rating only and functional operation of the device at these or any other conditions beyond those indicated in the "Recommended Operating Conditions" section of this specification is not Implied. Exposure to absolute-maximum-rated conditions for extend~d periods may affect device reliability. RECOMMENDED OPERATING CONDITIONS PARAMETER Supply voltage. VDD (see Note 3) K High-level input voltage, VIH (see Note 4) INIT or Clock Low-level input voltage, VIL (see Note 4) MAX UNIT -15 -1 -1 -17.5 0.3 0.3 V -4 VDD INIT or Clock VDD -15 2.5 15 1 1 1.25 1.25 100 0 3 Instruction cycle time, tc Pulse width, clock high, tw(H) Pulse width, clock low, twlcbLl Sum of rise time and pulse width, clock high, tr + twlthHI Sum of fall time and pulse width, clock low. tf + twlcbLl Oscillator frequency. fosc Operating free-air temperature. T A 1. 2. 3. 4. NOM -14 -1.3 -1.3 K Clock cycle time, tclcP) NOTES: MIN -8 10 60 V V J,lS J,lS J,lS /lS /lS /lS 400 70 kHz °c Unless otherwise noted. all voltages are with respect to VSS. These average values apply for any 1 OO-ms period. Ripple must not exceed 0.2 volts peak-to-peak in the operating frequency range. The algebraic convention where the most-positive (least-negative) limit is designated as maximum is used in this specification for logic voltage levels only. VSS VDD ~.~_-. _______V:~'~I J1-~ ~ -+I I--tf /4- twlc,'lL) -+/ j+-tr -+/ j.- IIC"~----- tclc;» I twlr,'>H) -JI -----~~I NOTE: Timing points are90% (high) and 10% (low), EXTERNALLY DRIVEN CLOCK INPUT WAVEFORM Data sheets on pages '-02 through '-07 are reproduced by permission of Texas Instruments Incorporated. 1-D2 COP402/COP402M D.4 1.15 1.5 D.3 < ..s ~ 0.2 1.25 < ..s ~ 1.0 .... '\ 0 0.15 1\ MAX 0.5 1 "\ D~ '\ MIN VOUT (VOLTS) DEVICE 1 0.25 YOUT (YOLTS) VOUT (VOLTS) OEVICEZ Depletion Load OFF Source Current Output Sink Current Standard Output Source Current 20 /1\. I 17 \. VCC' 6.3V (MAX) I 11 16 14 < < ~ .... :> ..s < 12 .... :> 10 ..s ..s 0 0 ..... \. VCC· 4.5V (MAX) 1\.... .....1 1 \ \ VCC· 4.1 V (MIN) V I I , 8 \ "" 4 DEVICE 2h YOUT (YOLTS) High Drive Source Current ~ VCC· B.lV (MIN) I I / ~~ I _'-1. VOUT (VOLTS) DEYICEl I I I I t-- X VOUT (YOLTS) OEVICE 2 OEVICE 4 LED Output Source Current Push· Pull Source Current 18~r-T-~~~~~~-r~ 1& I-+-+--+---+--+--.t--M+-A-X+-V-t.·..:, 1.5 15 14~+--+-+-4-4--+-~-~~~+-- 12 I-+-""- -+-.2~.0'-Y-vf-""",,"+--+-+--I YOUT 1. . 10~~~+-~~-+--+-~-+~v E 8 ..' V < ..s .... < ..s.... 10 1.0 :> 0 0 0.5 .. , ....I--+6.5 5.5 YCC (VOLTS) 2 DEVICE4 LED Output Direct LED Drive TRI·STAT~ 3 4 VOUT (YOL TS) DEYICE 5 Output Source Current Input Load Source Current Output Characteristics Volume 2 Rev. A, Update 5 1-017 7-79 PPS4/1 MM75 SPECI FICATIONS OPERATING CHARACTERISTICS Supply Voltage: Open Drain Driver Leakage (R OFF): VOO = 15 Volts ±.S% (Logic "1" = most negative voltage VIL and VOL') -:::::10 ",a at ·30 Volts Operating Ambient Temperature (TA): VSS = 0 Volts (Gnd.) (Logic "0" = most positive voltage VIH and VOH.) OOC to 70 0 C (T A System Operating Frequencies: = 2S o C unless otherwise specified.) Storage Temperature: BO kHz ±.SO% with external resistor ·SSoC to 120 0 C Device Power Consumption: ABSOLUTE MAXIMUM VOLTAGE RATINGS (with respect to VSS) 7S mw, typical Input Capacitance: 2' 6.0 ma max. c- o U The MC6809 retains all the MC6800 addressing modes and adds some new ones. These modes include long relative branches, sixteen variations of indexed addressing, Program Counter relative modes, and extended indirect modes. This extension of existing modes retains the ease and familiarity of the 6800 language. but adds high performance capability where needed. Hardware improvements have also been implemented on the MC6809. On-chip clock facilities have been added, an internal Schmitt trigger circuit has been incorporated to permit the use of an RC Reset Circuit, and the bus timing specifications have been improved to make the system easier to use. Some bus signals have been redefined, and new ones have been added, to permit the CPU to function in multiprocessor applications while still retaining compatibility with existing parts. In all. these enhancements. combined with the software enhancements. simplify the use. increase the throughput. and make the CPU tremendously more capable than its predecessor. Motorola has clearly aimed the MC6809 at the vast consumer markets yet to come. as well as at existing markets that have already been penetrated by the MC6800. With the MC6809. Motorola has maximized the performance of its midrange 6800 family. and now offers an updated product line that spans the range from the low-end single-chip MC6805 series through the expandable single-chip MC6801 and the mid-range MC6809. up to the newly introduced 16·bit pro' cessor. the MC68000. . The principal manufacturer is Motorola. The primary second source is AMI. and other firms that second source the MC6800 may also second source the MC6809. The MC6809 family is fabricated using N-channel, silicon gate, ion-implanted depletion load technology. It has TTL-level compatible inputs and outputs and operates from a single +5 volt power supply. All outputs are able to drive 130 pf (typically eight MaS devices) plus one standard TTL load (or four Low Power Schottky loads) at full rated bus speed. THE MC6809 CPU Figure 9-62 illustrates that part of our general microcomputer system that is implemented on the MC6809. Enhancements over the MC6800 include an on-chip clock. control logic for cycle-stealing DMA. and interrupt-priority arbitration. Not evident in this illustration is the enhanced register complement provided by the MC6809. 9-175 Volume 2 Rev _A, Update 5 7-79 I/O Ports Interface Logic Interface Logic Programmable Timers --Read Only Memory I/O Ports Memory Figure 9-62. Logic of the MC6809 Microprocessor THE MC6809 PROGRAMMABLE REGISTERS The MC6809 has an enriched set of registers as compared to the basic MC6800. The register complement consists of two Accumulators, a Status register, two Index registers, two stack Pointers, a Program Counter and a Direct Page register. The mobility of data between the registers has been improved by the introduction. of a "Transfer Registers" instruction (TFRI. This instruction. and the indexing capability of four of the MC6809 registers. overcomes most of the weaknesses of the 6800 CPU identified at the beginning of this chapter. 9-176 The following illustration shows the programmable registers provided by the MC6809. The registers that have been added beyond the basic 6800 CPU complement are shown shaded. -. 16 bits Index Register Y ... 16 bits Program Counter 16 bits Stack Pointer S - >. c. o Accumulator B Index Register X .~ 8 bits ... -... ~ Accumulator A 16 bits - .... 8 bits 16 bits Stack Pointer U 8 bits Status Register 8 bits Direct Page Register DP U These four registers function as Index Registers The Program Counter has limited indexing capabilities Sixteen-bit operations are implemented by concatenating the A and B Accumulators to form one double-precision Accumulator D as follows: ACCB ACCA ~,--------~~~--------~~ ACCD This concatenated Accumulator is referred to as ACCD. Four registers (X, y, S, and U) pro"ide indexing capability. They permit a 16-bit Effective Address (EA) to be formed by the addition of an optional offset to the pre-loaded contents of the specified register. There are some differences in the ways in which these registers operate and can be used. . . Registers X and Y have been designated the Index registers. Both are capable of performing the same indexing functions as were implemented on the basIc MC6800. plus a great deal more. Full details are included below. in the memory addessing section. Two Stack Pointers have been provided, permitting the implementation of two independent Stacks. These Stacks are implemented in read/write memory at the locations pointed to by their respective Stack Pointers. These Stacks function on a "Last-In. First-Out" (LIFO) basis Stack Pointer S is a hardware stack pointer used by the processor to automatically save machine status and active register contents during subroutines and interrupts in a manner similar to that of the MC6800. With the MC6809 .. however. the user has the option to save a subset only. or the entire register complement. Stack Pointer U is a User's Stack Pointer, controlled exclusively by the user's software. It facilitates the passage of arguments to and from subroutines. The Stack Pointers U and S feature the same indexing capabilities as the X and Y registers: thus. Sand U are essentially enhanced index registers. (There are some differences when using the "Load Effective Address" (LEA) instructions. This will be discussed later.) The Program Counter points to the next instruction to be executed. Its capability has been enhanced such that Program Counter relative addressing is now provided. This capability' effectivelyp~rmits the Program Counter to be used as an index register with limited capabilities. The Direct Page register (DPR) permits enhanced direct addressing by allowing a page (in addition to the base page) to be software relocated anywhere in memory during program execution. By way of contrast. the MC6800 does not have a Direct Page register. All MC6800 instructions using the direct mode have their high-order address bytes fixed at 00 by hardware. This limits direct addreSSing in the MC6800 to the first 256 memory locations (0000 to OOFF). Volume 2 Rev. A, Update 5 9-177 7-79 D;,ec' Page Reg;'''' 9 + - Op-Code pp ! EA = } Two-Byte Instruction !: xx + pp ----j.~I:=======Ilocatton Accessed EA = Effective Address Figure 9-63. MC6809 Direct Page Addressing Scheme To enforce compatibility with the MC6800, the contents of the Direct Page register on the MC6809 are automatically cleared on Reset. To move the page to some other location, the Liser must software relocate it by loading the high-order address bytes into the Direct Page register during program execution. When an instruction using Direct Page addressing is executed, the contents of the Direct Page register are automatically concatenated with the usual 8-bit address byte contained in a direct instruction. MC6809 MEMORY ADDRESSING MODES Let us now look at the addressing enhancements provided by the MC6S09. , With the incorporation of a Direct Page register, direct addressing has been extended MC6S09 DIRECT PAGE throughout all memory. Direct page addressing uses a two-byte instruction format in which the ADDRESSING second byte specifies the address to be added to the Direct Page register contents. This scheme is illustrated in Figure 9-63. The Direct Page register contains the most significant byte of the 16-bit address to be accessed, while the second byte of the instru'ction contains the least significant byte. Since the contents of the Direct Page register are software defined, this page can be dynamically relocated within the read/write memory as desired during program execution. Many of the new addressing modes require a byte immediately following the operation code to further define the interpretation of the instruction. This is called a Post Byte. Op-Code Post Byte While this added byte may at first seem wastefu I of memory space, the extra power and flexibility provided far outweigh the small additional amount of memory required. It should also be noted that many programs will be composed primarily of familiar 6800-type instructions and that the amount of additional memory space consumed by those instructions requiring Post Bytes will usually constitute a relatively small percentage of the total memory ·used. ~ The meaning ascribed to the various bits in the Post Byte depends on the addressing mode - see Table 9-19. The four registers X, y, S, and U are indexable. The Post Byte in this case defines the options ac- MC6S09 INDEXED ADDRESSING cording to the scheme shown in Figure 9-64. 9-178 7 Op·Code I Post Byte I Offset 1 Offset 2 ... 6 5 4 3 2 1 O~ Bit T"'-r No. I I I I I I I I .r:; Addressing Mode Field Indirect Field (Sign bit when B7 = 0) Register Field 00: R = X 01: R =Y 10: R =U 11: R =S .~ Sa. o U Figure 9-64. MC6809 Post Byte Bit Assignments Table 9-19. MC6809 Indexed Addressing Post Byte Register Bit Assignments Bit Number 7 6 5 4 3 2 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 R R R R R R R R R R R X X X R R R R R R R R R R R X X X X 0 I 0 I I I I I I I I I 1 X 0 0 0 0 0 0 0 1 1 1 1 1 1 X 0 0 0 0 1 1 1 0 0 0 1 1 1 X 0 0 1 1 0 0 1 0 0 1 0 0 1 X 0 1 0 1 0 1 0 0 1 1 0 1 1 L • " - - t Addressing Mode Line ±4·Bit Offset Auto Increment by One Auto' Increment by Two Auto Decrement by One Auto Decrement by Two Zero Offset Accumulator B Offset Accumulator A Offset ±7·Bit Offset ± 15·Bit Offset Accumulator D Offset Program Counter ±7·Bit Offset Program Counter ±15·Bit Offset Indirect 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ./ Addressing Mode Field Indirect Field (Sign bit when B7 = 0) Register Field 00: R = X 01: R =Y 10: R = U 11: R = S Volume 2 Rev. A. Update 5 9-179 7-79 Sele""" Reg;"e, ~ ···L Op-Code Post Byte ... + { j EA aa } Off'e' (Two by'e, Hiu""ted) bb .. ~ .... ..... ... , .. .... ........ .- = xxyy + aabb ~,·:'~2·' .... --- Location Accessed Figure 9-65. MC6809 Constant Offset (Indexed Model Addressing Many options are provided - they are constant offset, accumulator offset (using Accumulator A, Accumulator B, or Accumulator 0), auto increment or decrement (by one or two) and indirection. Figure 9-65 illustrates a two-byte offset. However. some options do not require any offset. while others require one and still others require two Thus. depending on the option chosen. the indexed mode may require two. three. or four bytes. Note: Most MC6S00 indexed instructions map into an equivalent two bytes on the MC6S09. In the constant offset mode, the offset is temporarily added to the value contained in the specified register to form an Effective Address (EA). Note that these offsets may be positive or negative. I n contrast. the MC6800 permits only positive offsets. Several variations of constant offset indexing are provided. One of the variations uses bit space in the Post Byte itself to specify the offset. In this case. the offset is limited to that which may be specified by four bits. The instruction thus consists of the op-code and the Post Byte - no additional offset bytes are used. The offset is specified by the bit pattern contained in bit positions o through 3. Bit position 4 contains the sign of the displacement. this can be illustrated as follows: .. '.. Op-Code 7 6 5 4 3 2 1 0.- MC6S09 CONSTANT OFFSET INDEXING ADDRESSING Bit No. :-:ojxlxlxlx Ixlxlxl Offset ....... , ............ ,.. '.....~ J T~-r Offset Twos Complement Sign Bit Register Select Bit 7 9-180 = ° The second constant offset mode is a three-byte instruction. consisting of an op-code. a Post Byte. and a 7-bit twos complement offset. This mode can be illustrated as follows: 7 Op-Code Post Byte Offset 6 5 3 4 ~ t @ 1 0.....-- .,-- :-i1 IxIxl o l1 j 2 Bit No. 10 1 0 10 1 j . Pattern for 7-Bit Offset Address is Direct Register Select Bit 7 = 1 1: .~ >co U To achieve longer offsets than provided above. two offset bytes are used; a four-byte instruction results. The offset IS specified in twos complement form. The applicable Post Byte is shown as line 10 in Table 9-19 ..._ _ _ _ _ _ _-. Accumulator offset is implemented as a two-byte instruction. There are three variations, one for each of the Accumulators A, B, and D (see lines 8. 7. and 11 of Table 9-19), The contents of the specified accumulator are treated by the instruction as a twos complement offset. Since this is rather complex. let us illustrate With an example. Suppose Accumulator 0 contains 110716 and Index Register X contains 103216 The Post Byte. shown here. 6 4 3 o MC6809 ACCUMULATOR OFFSET ADDRESSING '--BitNo. ~p'ttem fm Accumulata, 0 ,efe,en.. L...----------Address is Direct ' - - - - - - - - - - - - - R e g i s t e r Select 00 = X ' - - - - - - - - - - - - - - - - Bit 7 =1 specifies that the contents of Accumulator 0 are to be added to the contents of the X register to form an Effective Address (EA): EA = 110716 + 103216 = 213916 This is the address to be accessed by the instruction A zero offset addressing option is also defined in which the selected pointer register (X, Y, S, or U) contains the effective address of the data to be used by the instruction. ThiS IS a twobyte instruction which may Incorporate an automatic increment or automatic decrement of the addressing register's contents as part of the addressing mode mechanization. MC6809 ZERO OFFSET ADDRESSING Volume 2 Rev. A, Update 5 9-181 7-79 When 8utoincrement is employed, the address in the designated register (X, Y, U, or S) is used to access the desired memory location, then the contents of the register are automatica"y incremented. Incrementation is by one or two. depending on the bit configuration of the Post Byte - see Table 9-19. lines 2 and 3 (reproduced below). 11 X I X I T X X 0 I I I I X I 0 0 0 0 0 I I 0 0 MC6809 AUTO INCREMENT ADDRESSING ~ Increment by One I..-Increment by Two , " " - - - - - - - - - S p e c i f y Direct or Indirect Addressing - Select Desired Register When auto decrement is employed, the address in the designated register (X, Y, U, or S) is decremented, then the updated address is used to access the desired memory location. Decrementation is by one or two. depending on the bit configuration of the Post Bytesee Table 9-19. lines 4 and 5. . MC6809 AUTO DECREMENT ADDRESSING MC6809 Indexed indirect addressing is also provided for a" indexed options except the ± 5-bit offset INDEXED case and the auto increment/decrement-by-one cases. Bit 4 of the Post Byte is used to define INDIRECT whether the instruction is indirect or not (see Table 9-19). Indexed indirect addressing as impleADDRESSING mented on the MC6809 is a pre-indexed mechanization. as described in Volume 1. Chapter 6. The offset value referenced by the instruction is temporarily added to the contents of the designated pointer register {X. Y. U. or S} to form an indexed address. The memory location pointed to by this indexed address con. tains the actual address desired. The offset for indexed indirect addressing is specified as 8-bit or 16-bit twos complement offset following the Post Byte. as illustrated in Figure 9-66. Accumulator indexed indirect addressing obtains the offset as a twos complement number from one of the Accumulators A. B. or 0 as specified by the instruction. Indirect addressing for the auto increment/decrement cases is implemented only for the increment by two and decrement by two cases - thus indirect increment and indirect decrement by one are not permitted. For the case of auto increment indirect, the address in the designated pointer register (X, Y, U, or SP) is used to recover an address from memory. This recovered address is the address of the location to be accessed (the Effective Address). Fo"owing this transaction, the contents of the Pointer register are incremented by two. Post Byte bit definitions are indicated in Table 9-19. . Auto decrement indirect is similar to auto increment indirect. In this case, however, the specified register contents are decremented twice before the indirect address is abstracted from the register. Post Byte bit definitions are indicated in Table 9-19. Limited indexed mode addressing is also permitted with the Program Counter. This is detailed in Table 9-19 (lines 12 and 13). Note that 8-bit and 16-bit offsets only are provided. Relative addressing in the MC6809 has been greatly enhanced over that provided in the basic MC6800. First, it is no longer limited to branch instructions and, second, the relative range has been extended-through the use of a 16-bit twos complement offset. MC6809 RELATIVE ADDRESSING Relative addressing is an important ingredient in position-independent coding. and the enhanced scheme provided on . the MC6809 greatly facilitates this method of program structuring. All branch instructions have been implemented in the traditional MC6800 form {referred to as the short form} and in a long form. The short form takes a one-byte op-code with a one-byte offset. while the long form takes a one- or two-byte op-code with a two-byte offset. For the long branch case. the actual address is formed by adding the 'two bytes following the op-code as a twos complement number to the Program Counter. {Remember. the Program Counter points to the next instruction - thUS. it has already stepped over the offset bytes.} 9-182 Selected Reg'''e, 'T + @ { ~ I xxyy Op-Code Post Byte aa •• • I I I - + aabb --- } Offset (Two bytes illustrated) bb qq } EA = qqrr rr 1: Ol ·c >- I o i c. U .. I ; I Location Accessed Figure 9-66. MC6809 Constant Offset Indexed Indirect Addressing Relative addressing has been extended to include all memory reference instructions. It has been implemented as Program Counter relativo indexed addressing. Two variations are permitted; one uses an 8-bit twos complement offset (for short reaches!' and the other uses a 16-bit twos complement offset (for long reaches). Table 9-19 defines the Post Bytes for these two cases !lines 12 and 13). The general address formation scheme is similar to that of Figure 9-67. This is illustrated below for a short relative transfer. Volume 2 Rev. 9-183 A. Update 5 7-79 ,...., J Program Counter Op-Code 1 lOP-COde: One or Two Op-Code 2 Bytes long aa t+ I . ....... • I I .1. I I t. Ppqq Offset (One or Two Bytes) bb I Next. ......- Destination if Branch nstructlon not taken { Updated Contents of Program Counter = ppqq + aabb I ~~~~"at;O" ;1 .""h Figure 9-67. MC6809 Long Branch Addressing This example illustrates the position-independent nature of this form of addressing: LDA $104A. PCR TTIo-__. .:~ . - Data to be accessed is at location $1 04A Load the data into Accumulator A The MC6809 assembler requires that you use the mnemonic "PCR" for Program Counter relative addressing. The assembler then automatically computes the distance or offset from the "present" Program Counter value to the specified location. From Table 9-21. we determine that the hex code for LOA (indexed) is A6. From Table 9-19. line 12. we get the Post Byte. 8 C ~~ 11101010111110101 tLIo-_.---- T - None of the Registers X. Y. U or S is used Reference is Direct Bit Pattern from line 12 of Table 9-19 9-184 Program Counter Op-Code Post Byte . . - Table 9-19 Line 12 or 13 Updated Contents of Program Counter t aa bb = xxy:J{ t----~~ Next Instruction + t xxyy + } Offset (One or Two Bytes) , I i l I I Pointer .. _I "I aabb----t~ + ... } I Eff"H,. Add,." 'J--q -----tq .t: .~ S-- ~ Co o U pp ppqq J location Ace"'ed Figure 9-68. MC6809 Relative Indirect Addressing Assume the program segment starts at address 100016. Add ress Program Counter 1000 A6 1001 8C ,-- 1002 Updated Contents of Program Counter 47 J/ 1003 . . . . r / + - 104A '104A. . •- ..- Code for LDA (Indexed) Post Byte Offset (computed by assembler! Next Instruction ~ ~this Dot_ i. ,.'''e,ed "om address During execution. the updated Program Counter value is added to the offset: thus. if the program is relocated. it still functions correctly since the location referenced remains the same relative distance away. Long reaches are similar to the above. except that the Post Byte is 8016 (line 13 of Table 9-19). and two bytes are required for the twos complement offset. Relative indirect addressing is an extension of relative addressing. The Program Counter is used again as an indexed register. The general scheme is illustrated in Figure 9-68. The offset (one or two bytes. twos complement) is added to the updated contents of the Program Counter to form a pointer to a pair of memory locations which contain the actual address to be accessed. For a one-byte offset. the Post Byte is 9C 16: for a two-byte offset. the Post Byte is 9D 16 see Table 9-19. lines 12 and 13. MC6809 RELATIVE INDIRECT ADDRESSING Instructions that use indirect addressing require four bytes of object code: an op-code, a Post Byte and two bytes which specify a 16-bit address. These last two bytes are a pointer to a location that contains the actual address to be referenced. This approach to indirect addressing differs from that of Volume 1. Chapter 6 only in that a Post Byte is used. The Post Byte has a value of 10011111 (9F16) as defined by line 14 of Table 9-19. (This mode is shown in Table 9-19. since .it is actually implemented as an indexed. indirect instruction. relative to the Program Counter.) Volume 2 Rev. A, Update 5 9-185 7-79 Me6S09 STATUS FLAGS The MC6809 has a Status register which maintains five status flags and three interrupt control bits. The five status flags are: Carry (C) Overflow (V) Sign (S) Zero (Z) Auxiliary or Half-Carry (H) Statuses are assigned bit positions within the Status register as follows: 7 6 5 4 3 2 0 . - B i t No. IEIFIHlllslzlvlcl Note that the two high-order condition codes (bits 6 and 7) are used here: in the MC6800, MC6801. and MC6802 they are permanently set to 1. . Bits 0 through 5 are the same as the corresponding MC6800/MC6801/MC6802 Status register bits; however, there are differences in how some of the instructions affect these bits: 1) On the MC6800 and MC6802, only the Z bit is set correctly when the CPX instruction is executed. On the MC6809. all bits are handled correctly. 2) The multiply instruction (MUll on the MC6809 sets the Z bit (if appropriate). The MUL instruction of the MC6801 does not. 3) On the MC6800, MC6801. and MC6802, the right shift instructions (ASR, LSR, and ROR) set the overflow bit (V) if applicable: the corresponding instructions on the MC6809 do not affect Overflow status. 4) The TST instruction on the MC6800. MC6801, and MC6802 clears the C bit: the MC6809 TST does not affect it. 5) The H bit is undefined on the MC6809 after the operations CMP, NEG, SBC, and SUB. The corresponding MC6800, MC6801, and MC6802 instructions all clear H. Details of the effect of each instruction on the Status register bits are included in the MC6809 Instruction Set Summary - Table 9-23. Before describing the three remaining status bits, we must look at the .hardware and software interrupts that are provided on the MC6809. An additional maskable hardware interrupt, designated FIRQ, has been provided on the MC6809. This is a Fast Interrupt Request input, masked by bit 6(F) of the Status register. FIRO causes only a subset of registers to be pushed onto the Stack. The three hardware interrupts are, in order of priority, NMI (highest and non-maskablel. FIRO (maskable by the F bit) and IRO (lowest and maskable by the I bit). Three software interrupts are provided. They are SWI, SWI2 and SWI3. Let us now return to the three status bits I, F, and E. I is the external interrupt disable flag associated with hardware interrupt input IRQ. When I = 1, interrupts via IRO are disabled: when I = 0, interrupts via IRO are enabled. NMI. FIRO, IRO, RESET and SWI all set I to 1. SWI2 and SWI3 have no effect on I. F is the external interrupt disable flag associated with hardware interrupt input FIRQ. When F = 1, interrupts via FIRO are disabled: when F = 0, interrupts via FIRO are enabled. NMI. FIRO, SWI and RESET all set F to 1: IRO, SWI2 and SWI3 have no effect on F. E is the Entire flag bit. The occurrence of NMI. IRO, SWI. SWI2 or SWI3 sets E and stacks the entire machine register complement. while FIRO clears Eand stacks only the Program Counter and the Status register. Note that only the E bit in the saved or Stack Status register has any significance. E is used at the end of interrupt processing to determine how much to unstack. When the RTI instruction is executed at theend of an interrupt. the processor checks the E bit from the recovered Status register. If E = 1, the full complement of registers is restored from the' Stack. whereas. if E = 0, only the subset consisting of the Program Counter and Status register is retrieved. MC6S09 CPU PINS AND SIGNALS The MC6809 CPU pins and signals are illustrated in Figure 9-69. A description of these signals is useful as a guide to the way in which the MC6809 works and to the ways in which it differs from the MC6800. 9-186 -='" J: ~ E (!) (J ~ m r-. m ... @ .r: .!2l :;. 0. 0 U VSS NMI IRQ FIRQ BS BA VOO AO A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 .. . ~ .. ~ ---- -- ----------- --- --- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 MC6809 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 ----- - .-. ~ ~ -- ---.. -~ -- -- ------ ..... ~ ~ ~ ~ .... - HALT XTAL EXTAL RESET MREAOY Q E OMA/BREQ Rm DO 01 02 03 04 05 06 07 A15 A14 A13 Pin Name Description Type "AO-A 15 "00-07 "E, Q "R/W "BA "BS EXTAL,XTAL "MROY "OMA/BREQ "HALT "RESET NMI "FIRQ "IRQ VOO,VSS Address Lines Data Bus Lines Clock Signals Read/Write Bus Available Bus State Crystal Memory Ready OMA/Bus Request Halt Reset Non-Maskable Interrupt Fast Interrupt Request Interrupt Request Power and Ground Tristate, Output Tristate, Bidirectional Output Tristate, Output Output Output Input Input Input Input Input Input Input Input "These signals connect to the System Bus. Figure 9-69.' MC6809 CPU Signals and Pin Assignments The RESET input is used to initialize the CPU. To reset it. the RESET line must be asserted low for at least one bus cycle. This aborts the current operation. An internal Schmitt Trigger circuit on the RESET input permits the use of a simple RC network to reset the entire system. RESET - - - - - - - - -... ~ "Abort current instructions "Set F and I of Status "Clear OP Restart CPU if . not in HALT or OMA state "Disarm NMI Volume 2 Rev. 9-187 A. Update 5 7-79 EXTAL and XTAL are inputs for a parallel resonant crystal; alternatively, EXTAL may be driven by an external TTL-; level compatible clock by grounding the XTAL pin. The Enable pin E distributes the clocking signal to the rest of the system. It is a standard 6800 Bus system timing signal and is usually connected to the E inputs of MC6800 family devices. Q is a new clocking output signal that has no counterpart in the MC6800. MC6801. or MC6802 versions. Its positive transition indicates when stable address exist on the system busses. Memory Ready (MRDY) is an input control signal that is used to extend the data access time when slow memories are used. It is also used to extend the access time in multiprocessor applications when shared memories are used. The Address Bus lines (AO to A 15) and Data Bus lines (DO to 07) are standard 6800 peripheral-compatible busses. Their relationship with bus control signals is detailed later. RIW is the same as the MC6800 signal. It is valid with the positive transition of Q. Control signals on the MC6809 Control Bus may be divided into bus state controls. bus data identification. and interrupt processing. There are some lines here that do not exist on the MC6800. MC6809 BUS STATE CONTROLS These are the bus state control lines: DMA/Bus Request (DMA/BREQ): T.his is an input line used for DMA or memory refresh operations. When asserted low, it suspends CPU operation (by stretching the internal CPU clock), takes the processor off the bus and tristates the system busses. (There is no equivalent to this line on the MC6800 - in fact. it tClkes two lines, TSC and DBE. just to float the system busses.) No DBE (Data Bus Enable) input is provided on the MC6809. The equivalent of DBE is generated internally by the processor. HALT: When this input is asserted low, the CPU ceases operation at the end of the current instruction and the system busses (Address, Data and R/Wl are tristated. The CPU may remain in the halted state indefinitely without loss of data. Bus Available (BA): This output line (when driven high by internal logic) indicates that the system busses (Address, Data and R/W) are in their high impedance state and available to external devices for Direct Memory Access (DMA) transactions or any other form of bus sharing activities permitted. BA high does not imply that the bus will be available for more than one cycle, however. When driven low (by internal logic) an additional bus cycle at high impedance occurs before resuming operation. . Bus State (BS): This is an encoded output Which, in conjunction with output BA, indicates the current state of the CPU. Combinations are listed in Table 9-20. Table 9-20. MC6809 Bus Status Signals BA BS 0 0 0 1 1 0 1 1 . Function Normal Operation (Running) Interrupt Acknowledge SYNC Acknowledge BUS GRANT or HALT Acknowledge Status indications are valid on the leading edge of Q. No VMA (Valid Memory Address) output is provided on the MC6809 - instead. when the MC6809 processor does not need to use the system busses for a data transfer. it simultaneously sets VMA all address lines high (FFFF16) and R/W = 1. This is a "dummy" read of address FFFF. During CONDITION this dummy read, both BA and BS = O. The only other required read of address FFFF occurs during a fetch of the low-order Reset vector address. During this access of FFFF, however, BA = 0 and BS = 1 (see Table 9-20). Thus, the status of lines BA and BS permits the user to differentiate between these two situations. (Note that MRDY cannot be used to extend one of these dummy cycles.) These are the three interrupt processing signals: Non-Maskable Interrupt (NMI): This interrupt cannot be masked. It is an edge-sensitive (as opposed to level-sensitive) input that responds to a high-to-Iow transition. On NMI. the full register complement is stacked. NMI has the highest priority. 9-188 IRQ is a hardware Interrupt Request input. An interrupt generated at IRO stacks the full complement of CPU registers. IRO has lowest priority. FIRQ is a Fast Hardware Interrupt Request input. It provides fast response by stacking only the return address and the Status register. It has higher priority than IRO but less than NMI. MC6809 TIMING AND INSTRUCTION EXECUTION An internal divide-by-four circuit on the MC6809 permits the use of inexpensive, parallel resonant crystals. Alternatively, EXTAL may be driven by an external TTL-level compatible clock. Since the internal divide-by-four circuit is still utilized. the bus frequency is 1/4 input frequency. MC6809 CLOCK OPTIONS Clock ... 4f Crystal Operation ~ C) .~ a. o U -r::-f 4f .-e-f EXTAL E XTAL Q t?ZA } EXTAL E XTAL Q f ~ MC6809 -. ~ MC6809 The phase relationship between the MC6809 timing outputs E and Q is shown below. Q is a quadrature clocking signal that leads E. IlEn ... @ ..r:. Cl .~ C. o U The CPU acknowledges DMA/BREO by asserting BA and BS high. This is the BUS GRANT signal. It signifies to the DMA device that the CPU has been removed from the busses. and that a DMA transaction may take place. The bus clock signals E and 0 continue to furnish bus timing to the DMA interface. At the end of the transfer. the external device returns DMA/BREO high. restoring the CPU to normal operation. This must occur before the trailing edge of O. and the DMA device must get off the bus a hold time after the trailing edge of E (in the same cycle). The CPU busses will begin to emerge from their floating condition after the dead cycle. Again. the system must provide a low VMA signal (DMAVMA) to prevent false accesses while the Address Bus and R/IN line are going through this floating state. Dynamic memory refresh can also be implemented on a cycle-stealing basis by making the refresh controller a high priority DMA device. and accessing the required number of consecutive locations within the time required to maintain data integrity. Another way of refreshing dynamic memory would be to simply perform a high-speed scan through 64 or 128 consecutive memory locations. This is easily done through a single-instruction subroutine consisting of 63 (or 127) pre-bytes and an RTS (or RTI). MC6809 DYNAMIC MEMORY REFRESH OPERATIONS MCSS09 INTERRUPT PROCESSING AND RESET Interrupt capabilities implemented on the MC6809 are: o Hardware Interrupts NMI. FIRO. and IRO o o Software Interrupts SWI. SWI2 and SWI3 RESTART NMI and IRQ are equivalent to the corresponding interrupts on the MC6800. FIRQ is a Fast Interrupt Request that has no counterpart on the MC6800. It is a maskable, hardware interrupt of higher priority than IRQ. Its implementation provides the MC6809 with an easy to use two-level vectored interrupt scheme. An interrupt on IRO automatically vectors to its own software handler routine. while an interrupt on FIRO automatically vectors to its unique software handler routine. The higher priority device is connected to FIRO to achieve priority response. Within each of these levels. software polling may be used if more than one interrupt device is connected on each interrupt input. However. as noted in the MC6800 description. software polling greatly increases interrupt latency and can quickly become untenable. An alternate scheme that permits direct vectoring by the interrupting device itself to anywhere in memory may be implemented. This is described later. The MC6809 sets aside the sixteen highest addressable memory locations for interrupt processing purposes. Seven 16-bit addresses are stored in these locations (one pair of locations is reserved for future definition). These seven addresses identify the starting addresses of the service routines for the seven possible sources of interrupt. 9-193 MC6809 INTERRUPT VECTOR ADDRESSES Volume 2 Rev. A, Update 5 7-79 This is how the memory locations are used to store the interrupt vectors: FFFO FFF2 FFF4 FFF6 FFF8 FFFA FFFC FFFE and and and and and and and and FFF1 FFF3 FFF5 FFF7 FFF9 FFF8 FFFD FFFF Reserved SWI3 SWI2 Ffi'ID IRQ SWI NMI RESET ....MC6809 ----.,. The lower address of each pair (FFFO. FFF2. FFF4 .... FFFE) holds the high-order byte of the starting address . In the event of simultaneous interrupt requests. this is the priority sequence during the acknowledge process: Highest Jest 1) 2) 3) 4) 5) INTERRUPT PRIORITIES RESET Non-Maskable Interrupt (NMIl Software Interrupt (SWI) Fast Interrupt Request FIRQ Standard H,ardware Interrupt (iRQ) We will begin our discussion of MC6809 interrupt processing by describing the various interrupts . Consider first F'iiffi.. Fiiffi. permits high-speed response to hardware interrupts by stacking only a subset of the register complement - only the return address and the Stack register contents are pushed onto the Stack. At the end of the interrupt. these two items only are restored from the Stack. Status register flag bits F and I are set to. mask out the present FIRQ and further IRQ and FIRQ interrupts. (If you wish to admit multiple-level interrupts. you can now clear the F and I flags.) ..----MC6809 FAST INTERRUPT REQUEST We wm refer to IRQ as the standard hardware interrupt. It provides slower response than FIRQ. because it stacks the entire machine state. Thus. IRQ functions in the same way as the MC6800 IRQ. FIRQ can interrupt IRQ. but IRQ cannot interrupt FIRQ. since FIRQ disables IRQ by setting the I bit of the Status register. MC6809 STANDARD HARDWARE INTERRUPTS The MC6809 includes three software interrupts. SWI has higher priority than IRQ and FIRQ. and disables these interrupts by setting the Status flags F and I. SWI2 and SWI3 do not disable any interrupts. All three save the entire machine status by pushing the contents of all the active registers onto the Stack. MC6809 SOFTWARE INTERRUPTS SWI. SWI2 AND SWI3 SWI is implemented on the MC6800. but the MC6800 has no counterpart to SWI2 and SWI3. Note that these instructions cause the MC6809 to go through the complete logic of an interrupt request. even though . the interrupting source is within the CPU. The non-maskable interrupt NMI. as with the MC6800. cannot be disabled. Like IRQ. it stacks the entire machine status. 8ecause NMI is not masked. repeated NMI interrupts occurring before the previous ones have been terminated by an RTI (Return from Interrupt) instruction can cause the Stack to overflow. This will cause a fatal error. MC6809 NON-MASKABLE INTERRUPT A detailed discussion of RESET versus Interrupt response is included with the MC6800 description and will not be repeated here. However. the following points should be noted: • • • If the HALT or DMA/BREQ inputs are asserted low when RESET makes its low-to-high transition. it will be latched. and the CPU will wait until the resumption of a running state before completing the reset. Asserting RESET will 'not bring the CPU out of tristat~ during a HALT or DMA condition. Because a Schmitt trigger is used on the RESET input. a simple RC network can be used to reset the CPU. This is'much less stringent than the 100 nanosecond rise time limit of the MC6800. Normally. the reset action takes five bus cycles. However. since DMA may occur during reset. the actual reset may take considerably longer. MC6809 Through the use of some external logic. it is possible for the interrupting device to force INTERRUPT a vectored jump to anywhere in memory. This scheme makes use of the Interrupt VECTORING Acknowledge (lACK) Signal. BY EXTERNAL DEVICES Table 9-20 shows the lACK is indicated by BA = 0 and BS = 1. These status indications are valid on the leading edge of Q. 9-194 e,j E .E :I: ~ Q co c!J (,) ~ m m " @ 1: lACK _ _ _ _ _ _ _ _ "'-~""".... - - - - - - , - - j Use lACK to remove the ~ ROM from the Data Bus Address Bus Address FFFX .~ >a. 0 Data Bus ( U '={ Address Byte )..- - - - - Address Byte jammed on by the external device. Figure 9-73. MC6B09 Signals for Externally Vectored Interrupts lACK indicates that a byte of vector address is being retrieved from one of the memory locations FFFO to FFFF as a result of an interrupt (RESET. NMl. FIRG. fRO. SWI. SWI2 or SWI3). lACK is valid during both the high-order and low-order vector address byte fetches. Note that the address locations corresponding to the seven vectors are all of the form FFFX. where X is between 0 and F; thus. only the last four bits of the address differ. By externally decoding these four low-order bits plus the lACK signals BA and BS. you can determine what type of interrupt has been accepted. disable the ROM containing addresses FFFO to FFFF. and jam onto the Data Bus the address of an appropriate interrupt service routine. This is done in turn for both the high-order and low-order address bytes by external device logic. Figure 9-73 illustrates the sequence for externally vectoring an interrupt. Note that the address byte jammed onto the Data Bus is loaded into the Program Counter by the CPU as its normal response to an interrupt request. but now the 16-bit address loaded is the address supplied by the eXLernal device. not the address normally retrieved from the applicable address pairs FFFO/FFFl to FFFE/FFFF. At the end of this transaction. the program commences execution at the address supplied by the interrupting device. ' Thus. a vectored jump to the device service routine has been effected. This technique can drastically reduce interrupt response time as compared to a polled approach. ' Volume 2 Rev. A, Update 5 9-195 7-79 Stack Pointer SP is used during interrupts. For all interrupts except FIRQ, the full complement of registers is stacked. The sequence in which the registers are saved on the Stack can be illustrated as follows: FFFF ElE -.--. I I :LI • o·Irectlon . I B •I I I --r--,, ~ MC6S09 STACKING DURING INTERRUPTS PC (low) PC (high) U (low) U (high) STACK .Y (low) Y (high) X (low) X (high) OP B A , Status ~ 0000 After Interrupt Before Interrupt The MC6S09 Stack Pointer(s) points to the last item placed in the Stack, instead of to the next empty location as with the MC6S00, MC6S01, and MC6S02. The new stacking order interchanges the order of Accumulators A and B to make A the high-order byte instead of B. as is the case on the MC6800. MC6801. and MC6802. The MC6S09 provides two methods of achieving external process synchronization. The first method we will consider is similar to the one implemented on the MC6S00. It uses the CWAI instruction, which is similar to the MC6800 sequence CLI WAI. However. CWAI does not float the system busses as WAI does on the MC6800. (No WAI instruction exists on the MC6809.) . MC6S09 HARDWARESOFTWARE SYNCHRONIZATION When the CWAI instruction is executed. the processor logically ANDs the immediate-b'lte of the instruction into the status register. stacks the entire machine status. then sits idle until an interrupt occurs. When an interrupt occurs. it can be processed immediately. as no time need be spent in stacking machine status. The CWAI instruction is an immediate mode instruction. with the immediate data being a mask byte. During execution. this byte is automatically ANDed with the Status register byte to clear interrupt bits F and I if required. When an interrupt occurs. it wi" (if it hasn't been masked) cause a 'transfer to the appropriate interrupt service routine. Note that when an FIRG occurs. it will enter its service routine with the entire machine status stacked (instead of just the Program Counter and Status register); however. the corresponding RTI instruction wi" correctly unstack it. since the state of the stacked E bit wi" properly indicate how much status was stacked. The second method of synchronization uses the new MC6S09 SYNC instruction. When exMC6S09 SYNC ecuted, SYNC causes the processor to cease further execution and wait for an interrupt to INSTRUCTION occur. Any of the interrupts NMI, FIRQ or IRQ may release the processor from the SYNC state. If the interrupt is enabled, the processor will service it; if it is disabled, the processor simply continues on to the next instruction in sequence, without stacking the machine status. The logic of the SYNC Instruction is illustrated in Figure .9-74. 9-196 Begin execution of the SYNC instruction. SYNC Interrupt Occurs Wait for any interrupt. I @ I 1: .g> >- c. o u No Continue execution at the next instruction in sequence. Stack the entire machine Status and transfer to the applicable Interrupt Service Routine. Float the System Busses Set BA = 1 BS = 0 Figure 9-74. MC6809 SYNC Instruction Logic Volume 2 Rev. A. Update 5 9-197 7-79 One obvious use of the SYNC instruction would be to implement high-throughput program/device synchronization. The following diagram illustrates this concept. (To keep it simple. we have assumed that only one interrupting device is connected to the system.) Wait for data byt'e available SYNC t Device generates an interrupt when a byte of data is available. Interrupt Occurs I Load byte into Accumulator and store in buffer area. Decrement Byte Counter Has all the data been transferred? External logic can determine when the CPU is in the SYNC state by decoding the MC6809 8A and 8S signals. A SYNC acknowledge status is indicated by 8A = 1 and BS = O. as shown in Table 9-20, Note that since BA = 1. the system busses are floated. SYNC can also be used to mechanize block transfer of data under DMA control. When SYNC is executed, the busses are floated and BA = 1, BS = 0 announces to the DMA device that' it may take over the system busses. At the end of each block transfer. the DMA device advises the CPU by asserting an interrupt request. and the program resumes execution. MC6809 USE OF SYNC FOR DMA Note that the MC6800 does not have a SYNC instruction. Block transfer DMA for the 6800 can be implemented via the . WAI instruction as described in the MC6800 section. THE Me6S09 INSTRUCTION SET Table 9-21 lists the MC6809 instruction mnemonics, while Table 9-22 summarizes the instructions which differ from those that appear in the MC6800 instruction set. Note that all MC6800 addressing modes have been implemented. plus the enhanced modes that we described at the beginning of this section. When' comparing the MC6809 instruction set to the MC6800 set. you will notice that Direct Page addressing for the MC6809 applies to all memory reference instructions. not just the primary memory reference instructions as is the case for the MC6800. In addition. the Direct page can be dynamically relocated. During our discussion of the MC6800, we noted the paucity of index registers and the lack of data mobility between them. These deficiencies have been corrected and the MC6809 set includes two types of instructions for register-to-register transfers - the Exchange and the Transfer instructions. The only restriction on the use of these instructions is that the source and destination registers must be the same size (Le .. both 8 bis or both 16 bits). 9-198 An examination of the MC6809 set reveals that some of the familiar MC6800 instructions MC6809 are missing. However, provision has been made to perform the missing operations in alterMISSING nate ways. For example. the instruction to clear the Carry bit C is implemented on the MC6800 as MNEMONICS CLC; to perform this on the MC6809. one must use ANOCC #$FE. The result of these changes is that. even though the MC6809 is fully software compatible (at the source code level) and much more powerful. it uses fewer mnemonics than the MC6800 (59 versus 72). The MC6809 contains many instructions that the MC6800 does not. Some of these we have already noted. such as Synchronize with Interrupt (SYNC). Clear and Wait for Interrupt (CWAI). Exchange Registers (EXGl. Transfer Register (TFRl. and the Software Interrupts SWI2 and SWI3. Some of the remaining differences are simply extensions of the existing instructions to make them apply to the new registers - e.g .. ANOCC. LOY. etc. - while others are totally new - e.g .. Sign Load Effective Address (LEA). @ E MC6809 ADDED MNEMONICS Extend (SEX) and Some mnemonics that are used with both the MC6800 and the MC6809 have slightly altered meanings. This is illustrated below for the "Load Accumulator" instruction. .2l >- 0. o (J MCGSOO/MCGS01/MCGS02 MCGS09 . Generic Form: LOA Generic Form: LO LOAA = Load Accumulator A LOAB = Load Accumulator B LOA = LOB = LOO = LOS = LOU = LOX = LOY = Load Load Load Load Load Load Load Accumulator A Accumulator B Accumulator 0 Hardware Stack Pointer User Stack Pointer Index Register X Index Register Y The "Store Accumulator" instruction has similarly been altered. The Push and Pull instructions have been enhanced such that any, all, any subset, or none of the CPU registers can be pushed or pulled from the stacks. PSHS and PULS access the Hardware Stack. while PSHU and PULU access the User Sta,ck. These instructions require a Post Byte. as shown in the following illustration: Push or Pull - I > Op-Code Post Byte .... • I 7 I~ 6 5 4 3 2 1 I I I I I I I , • I~ . ~ I ~ 0 6 34 t1 06 0 0 1 1 0 0 3 4 0 11 11 1 0 1 0 r--- ~BitNo. tt (Post Byte) } Stack Accumulators A and B Note the interpretation of bit 6. When executing PSHS. if bit 6 = 1. the contents ofU are saved. When executing PSHU. if bit 6 = 1. the contents of SP are saved. Note that PSHS cannot save the contents of SP and PSHU cannot save the contents of U. The Exchange Registers and Transfer Register instructions also require a Post Byte to identify the source and destination registers, as shown in the following diagram: 6 o 4 MC6809 EXCHANGE REGISTER AND TRANSFER REGISTER POST BYTE - ~ c. o U Contents of the Program Counter after it has "stepped over" the offset bytes in a multi-byte instruction - thus. PC' is the address of the next instruction in sequence. R1. R2 Register pairs. both 8-bit or both 16-bit LIST List of registers to be stored on or retrieved from the Stack EA Effective Address OFFSET.R This symbology is used to denote all forms of indexed addressing and all forms of indirect addressing. For this addressing scheme. the total byte count is the sum of the base count indicated inTable 9-22 and the appropriate value from the following chart. Indirect Non-indirect Type Form 1/1 1/1 Assembler Form Post-Byte Op-code ~ >- aI Post-Byte Op-code 1 2 a a No Offset 5-Bit Offset a-Bit Offset 16-Bit Offset •A n. A n. A n. A lAA00100 OAAnnnnn lAA01000 lAA0100l a a L Al Constant Offset from A 1 2 [n.Al [n.Al lAA10l00 defaults to a-bit lAAll000 lAA11001 Accumulator Offset from A A - Aegister Offset B '-- Aegister Offset o - Aegister Offset A.A B. A D. A lAAOOll0 lAA00101 lAA01011 IA.Al [B. Al [D. Al lAA10110 lAA10101 lAA11011 Auto Increment/ Decrement A Increment by 1 Increment by 2 Decrement by 1 Decrement by 2 •A+ •A+ + • -A • --A lAAOOOOO lAAOOOOl lAAOO010 lAAOOOll a a a a a a a n. PCA n.PCA lXX01100 lXXOll0l - - Constant Offset from PC a-Bit Offset 1 6-Bit Offset Extended Indirect 16-Bit Address CD Assembler Form >- aI a b L Al not aI/owed lAA10001 not aI/owed lAA10011 1 2 In. PCAl In. PCAl lXX11100 lXXlll0l 1 2 - [nl 10011111 2 [. A + +l 0 a A = X. Y. U. or S X = Don't Care Note: This chart conforms to Motorola nomenclature; their use of square brackets [ 1indicates to the assembler that the addressing mode is indirect - thus. their use of I 1 differs from the use in Table 9-22. 9-203 Volume 2 Rev. A. Update 5 7-79 Table 9-22. A Summary of the New and Enhanced Instructions for the MC6809 STATUS TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED E LDD w 0 zw STD a: w u.. w a: LDU > a: 0 :E w :E > a: ct LDY STU :E a:D. STY ADDD CMPD w 0 zw a: W w u.. Iw ct a: a: w > a: D. 0 CMPS CMPU CMPY CMPX :E > w a: :E 0 > ~ a: :E ct- LSL 0 Q z 0 0 w (I) SUBD F C Z S V X X 0 X X 0 X X 0 X X 0 X X 0 X X 0 ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R 'ADR8 ADR16 OFFSET,R 2 3 2+ 2 3 2+ 2 3 2+ 3 4 3+ 2 3 2+ 3 4 3+ ADR8 ADR16 OFFSET, R ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R ADR8 ADR16 OFFSET,R 2 3 2+ 3 4 3+ 3 4 3+ 2 3 2+ 2 3 2+ X X X X X X X X X X X X X X X X X X X X ADR8 ADR16 OFFSET,R 2 3 2+ X H I [ACA] + - [MEMl. [ACB] + - [MEM + 1] Load double Accumulator using base page direct, extended direct, indirect or indexed addressing. [MEM] + - [ACAl. [MEM + 1] + - [ACB] Store double Accumulator using direct, extended, indirect or indexed addressing. [REG(HIl] + - [MEMl. [REG(LO)] - [MEM + 1] Load specified register (U or Yl using direct, extended, indirect or indexed addressing. Sign status reflects REG bit 15. [MEM] - [REG(Hlll. [MEM + 1] - [REG(LO)] Store contents of specified register (U or Yl using direct, extended, indirect or indexed addressing. Sign status reflects REG bit 15. X (ACD] - (ACD] + [MEM]: (MEM + 1] Add 1 6-bit value from locations MEM and MEM + 1 to D Accumulator using direct, extended, indirect or indexed addressing. [ACD]- [MEM]: [MEM + 1] Compares 16-bit number from locations M and M + 1 with contents of D Accumulator and sets status bits as appropriate, Only Status register is affected. [REG]- [MEM]: [MEM + 1] Compares 16-bit number from locations M and M + 1 with contents of register (5, U, Y or Xl specified in the mnemonic and sets status bits as appropriate. Only Status register is affected. 01'-0 EJ 1- 0 a: ~ Wa: I-w ~ti CJ_ WCJ a:w a: DISP16 DISP16 DISP16 DISP16 DISP16 DISP16 DISP16 DISP16 DISP16 DISP16 DlSP16 DISP16 DlSP16 DISP16 DISP16 . DISP16 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 EXG Rl. R2 2 TFR R1. R2 2 LBCC LBCS LBEQ LBGE LBGT LBHI LBHS LBLE LBLO LBLS· LBLT LBMI LBNE LBPL LBVC LBVS ·F C Z S .V [Rl] - - [R2] Exchange contents of specified registers. Status register not affected unless R 1 or R2 is Status register. [R2]- [Rl] Transfer contents of Rl to R2. Status register is not affected unless R2 is Status register. ABX 1 MUL 1 X SEX 1 X w I- ~~ a:w We.. ti° S w a: I Conditions are the same as shown in the Branch On Condition Table for the MC6800. a: en S~ H ;X 0 [X) - [X) + [B) Add unsigned contents of B Accumulator to Index register. [D) - [A) x [B) Multiply unsigned' numbers in Accumulators A and B and place result in D. Carry bit is set if Accumulator B bit 7 is set. [A) - FF 1 6 if Accumulator B bit 7 = 1 [A) - 00 l6if Accumulator B bit 7 = 0 Transform an 8-bit twos complement number in B to l6-bit twos complement number in D. a Copyright © 1979 McGraw-Hili, Inc. Table 9-22. A Summary of the New and Enhanced Instructions for the MC6809 (Continued) STATUS TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED E .w ~ a: w Q. LEAS LEAU OFFSET,R OFFSET,R 2+ 2+ LEAX LEAY OFFSET,R OFFSET,R 2+ 2+ F C Z S V I [S]-EA [U]-EA X X [X]-EA [Y]-EA 0 EA is the Effective Address Form the Effective Address EA according to the addressing variation used. Load this address into designated register (for later use) rather than outputting it on Address Bus at this time. a: .-w CI) S w a: H LSL ACX 1 X X X X oJ.-o 8 0 - 1 7 .. ~ = b7 .lJ.b6 (ACX) PSHS LIST ~ (,) ~ .- CI) ~ 2 Test Post Byte and stack as follows. Condition: b7 = 1; [SP] - [SP] -1, [[SPll - [PC(LO)] [SP] - [SP] - 1, [[SPll - [PC(HIll b6 = 1; [SP] - [SP] - 1. [[SPll - [U(LO)] [SP] - [SP] - 1. [[SPll -[U(HIll b5 = 1; [SP] ...... [SP] - 1. [[SPll ...... [Y(LO)] [SP] ...... [SP] - 1. [[SPll ...... [Y(HIll b4 = 1; [SP] ...... [SP] - 1. [[SPll ...... [X(LO)] [SP] - [SP] - 1. [[SPll ...... [X(HIl] b3 = 1; [SP] ...... [SP] - 1. [[SPll - [DP] b2 = 1; [SP] ...... [SP] - 1. [[SPll ...... [B] b1 = 1; [SP]-[SP] - 1. [[SPll ...... [A] bO = 1; [SP] ...... [SP]- 1. [[SPll ...... [SR] Push any. all. none or any subset of registers onto Hardware Stack (except the Hardware Stack Pointer itself). Table 9-22. A Summary of the New and Enhanced Instructions for the MC68()9 (Continued) STATUS TYPE MNEMONIC OPERAND(S) E PSHU LIST 2 . co ~ o to OPERATION PERFORMED BYTES F C Z S V H I Test Post Byte and stack as follows. Condition: b7 = 1; [U) - [U) - 1. [[UJ) - [PC(lOI) [U) - [U) - 1. [[UJ) - [PC(HIl) b6 = 1; [U) - [U) - 1. [[UJ) - [SP(lO)) [U) - [U) - 1. [[UJ) - [SP(HI)) b5 = 1; [U)- [U) - 1. [[UJ) - [Y(lO)) [U) - [U) ~ 1. [[UJ) - [Y(HIl) b4 = 1; [U)-[U) - 1. [[UJ) - [X(lOI) [U) - [U) - 1. [[UJ) - [X(HIl) b3 = 1; [U) - [U) - 1. [[UJ) - [OP) b2 = 1; [U) - [U) - 1. [[UJ) - [B) b1 = 1; [U)-[U)-l. [[UJ)-[A) bO = 1; [U) - [U) - 1. [[UJ) - [SR) Push any. all. none or any subset of registers onto User Stack (except the User Stack Pointer itself). ~ CD ~ ~c 0 ~ ::.:: CJ ct t- CI) PUlS LIST 2 Test Post Byte and unstack as follows. Condition: bO = 1; [SR) - [[SPJ). [SP) - [SP) + 1 b1 = 1; [A) - [[SP)). [SP) - [SP) + 1 b2 = 1; [B) - [[SP)). [SP) - [SP) + 1 b3 = 1; [OP) - [[SP)). [SP) - [SP) + 1 b4 = 1; [X(HIl) - [[SP)). [SP) - [SP) + 1 [X(lO)) - [[SP)). [SP) - [SP) + 1 b5 = 1; [Y(HIl) - [ISP)). [SP) - [SP) + 1 . [Y(lOI) - [[SPJ). [SP) ~ [SP) + 1 b6 == 1; [U(HIl) - [[SP)). [SP) - [SP) + 1 [U(lOI) - [[SP)). [SP) - [SP) + 1 b7 = 1; [PC(HIl) - [[SP)J. [SP) - [SP) + 1 [PC(lOI) - [[SP)). [SP) - [SP) + 1 Pull any. all. none or any subset of registers from Hardware Stack (except the Hardware Stack Pointer itselfl. The Status register bits are determined by byte pulled from Stack. - Copyright ~ 1979 McGraw-Hili. Inc. Table 9-22. A Summary of the New and Enhanced Instructions for the MC6809 (Continued) STATUS TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES E PUlU LIST 2 -:aII :::J .~ c 0 .2 ~ (J « tCI) F C Z S V H I Test Post Byte and unstack as follows. Condition: bO = 1 ; [SRI - HU]l. [U] - [U] + 1 b1 = 1; [A] - [[U]l. [U] - [U] + 1 b2 = 1; [B] - [[Ull. [U] - [U] + 1 b3 = 1; [DP] - [[Ull. [U] - [U] + 1 b4 = 1; [X(HIl] - [[Ull. [U] - [U] + 1 [X(lOI] - [[Ull, [U] - [U] + 1 b5 = 1; [V(HIlI - [[Ull. IU] - [U] + 1 [V(lOI] - [[Ull. [U] - [U] + 1 b6 = 1; [SP(HIl] - [[UIl, [U] - [U] + 1 [SP(lOI] - [[Ull. [U] - [U] + 1 b7 = 1; [PC (Hill - [[Ull. [U] - [U] + 1 [PC(lOI] - [[U]l. [U] - IU] + 1 Pull any, all. none or any subset of registers from User Stack (except the User Stack Pointer its·elf): Status register bits are determined by byte pulled from Stack. co N o CO RTI t- a.. ::I a: a: w t- ~ c< -02Q.c ..... !!!3 .!.,,(l)(l) COOl/\) 1 Pull registers from Hardware Stack in accordance with value of E of Status Register. If E = 0, pull the subset. [SRI - [[SP]I. [SPI - [SP] + 1 [PC(Hil] - [[SP]l. [SP] - [SP] + 1 [PC(LO)] - [[SP]l. [SP] - [SP] + 1 If E = 1, pull the full complement. [SRI - [[SP]I. [SP] - [SPI + 1 [Ai - [[SP]I. [SP] - ISP] + 1 [B] - [[SP]l. ISP] - [SP] + 1 [DP] - [[SPll, [SP] - [SP] + 1 [X(Hil]- [[SPIt [SP]-I.SP] + 1 [X(lO)] - [[SPIl, [SP] - [SP] + 1 [V(Hil] - [[SPIl. [SP] - ISP] + 1 [V(lO)] - [[SPIt [SP] - [SP] + 1 [U(HI)] - [[SPIt [SP] - [SP] + 1 [U(lO)] - [[SPIl, [SP] - [SP] + 1 [PC (Hill - [[SPIt [SP] - [SP] + 1 [PC(lOI] - [[SP]l. [SP] - [SP] + 1 Status bits are as received from Stack. 'Table 9-22. A Summary of the New and Enhanced Instructions for the MC6809 (Continued) STATUS TYPE MNEMONIC OPERAND(S) BYTES OPERATION PERFORMED E F C Z S V H I [SR] - CWAI ;:; 2 [SR] A [B2] This may clear SR bits. E-1 [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] - [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] - 1, - 1, - 1, - 1, - 1, - 1, -1, - 1, - 1, - 1, - 1, - 1, [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] [[SPJ] - [PC] - [PC] - [U] - [U] - [Y] - [Y] - [X] - [X] - [OP] - [B] - [A] - [SR] II) :s 'Ec 0 2 .Q. :l a: a: .LLI !: Pushes registers onto Stack and waits for an interrupt. When non-masked interrupt occurs, vectors to corresponding interrupt service routine. FIRQ enters its serVice routine with all registers saved, but since E = 1, they will un stack correctly on RT\' (System busses are not floated by CWAI.) Copyright (Q 1979 McGraw-Hili, Inc. Table 9-22. A Summary of the New and Enhanced Instructions for the MC6809 (Continued) STATUS TYPE MNEMONIC OPERAND(S) OPERATION PERFORMED BYTES E F C 1 SWI Z S V H I E-1 [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] -:cGI :l c c ~ 1 -1. 0 g [SP] [SPl[SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] [SP] F- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) ([SP)) 1. [PC] - - [PC(lO)] [PC (Hill [U(lO)] [U(HIll [Y(lO)) [Y(HIll [X(lO)) [X(HIll [DP] [B] [A] [SRI t [FFFA]: [FFFB] Transfer control to interrupt subroutine. l- e.. ::l a: a: - SWI2 2 E-1 Push registers onto Hardware Stack (same as above). [PC] - [FFF4]: [FFF5] Transfer control to interrupt subroutine. w I- !: SWI3 2 E-1 Push registers onto Hardware Stack (same as above). [PC]- [FFF2]: [FFF3] Transfer control to interrupt subroutine. SYNC 1 j) (/) e( l(/) ANDCC DATA 2 ORCC DATA 2 BRN lBN DISP DlSP16 2 4 -- Stop processing instructions: float system busses: wait for an interrupt. When an interrupt occurs, resume processing as follows: ij) ::l l- - 1 If interrupt is enabled. transfer to the service routine. If interrupt is disabled, continue execution at next instruction in sequence. [SR] - [SR] A DATA AND immediate. Used to clear SR bits. [SR]- [SRI V DATA OR immediate. Used to set SR bits. Branch Never. This is a No Operation long Branch Never. This is a No Operation. DATA SHEETS This section contains specific electrical and timing data for the following devices: • • • • • • • • • • • • • MC6800 CPU MC6802 CPU/RAM MC6870A Clock MC6871A Clock MC6871 B Clock MC6820 PIA MC6850 ACIA MC6852 SSDA MC6840 PTM MC6844 DMAC MC6846 ROM-I/O-Timer MC6801 One-Chip Microcomputer MC6809 CPU Volume 2 Rev. A, Update 5 9-01 7-79 MC6800, MC68AOO, MC68BOO TABLE 1 - MAXIMUM RATINGS Rating Symbol Value VCC -0.3 to +,7.0 Vdc Input Voltage Vin -0.3 to +7.0 Vdc Operating Temperature Range-TL to TH MC6800, MC68AOO, MC68BOO MC6800C, MC68AOOC MC6800BQCS, MC6800CQCS TA Supply Voltage Unit °c o to +70 -40 to +85 -55 to +125 Storage Temperature Range T stg Thermal Resistance (JJA Plastic Package Ceramic Package -55 to +150 This device contains circuitry to protect the inputs against damage due to high static voltages or electric fields; however, it is advised that normal precautions be taken to avoid application of any voltage higher than maximum rated voltages to this high impedance circuit. °c °C/W 70 50 TABLE 2 - ELECTRICAL CHARACTERISTICS (VCC = 5.0 V, ± 5%, VSS = 0, TA = TL to TH unless otherwise noted) Symbol Min Typ Logic 1/>1,1/>2 VIH VIHC VSS + 2.0 Vce -0.6 - Logic 1/>1,1/>2 VIL VILC Characteristic Input High Voltage \ Input Low Voltage Input Leakage Current (Vin =0 to 5.25 V, VCC = max) (V in = 0 to 5.25 V, VCC = 0.0 V) lin Logic' 1/>1,¢2 Three-State (Off State) Input Current (Vin = 0.4 to 2.4 V, VCC = max) 00-07 AO-AI5,R/W Output High Voltage (I Load = -205 /lAdc, VCC = min) (I Load = -145 /lAdc, VCC = min) (I Load = -100 /lAdc, VCC = min) 00-07 AO-AI5,R/W,VMA BA ITSI Max Unit Vdc - VCC VCC +.0.3 VSS - 0.3 VSS - 0.3 - VSS + 0.8 Vss + 0.4 Vdc - 1.0 2.5 100 /lAdc 2.0 - VSS + 2.4 VSS + 2.4 VSS + 2.4 VOL Power Dissipation Po Capacitance (Vin = 0, T A = 25 0 C, f = 1.0 MHz) Cin 1/>1 ¢2 00-07 Logic Inputs AO-A 15,R/W, VMA Cout /lAdc Vdc VOH Output Low Voltage (I Load - 1.6 mAdc, VCC = min) 10 100 - - 0.5 VSS + 0.4 1.0 Vdc W pF - 25 45 10 6.5 35 70 12.5 10 - 12 pF TABLE 3 - CLOCK TIMING (VCC = 5.0 V, ± 5%, VSS = 0, T A = TL to TH unless otherwise noted) Symbol Min Typ Max Unit Frequency of Operation MC6800 MC68AOO MC68BOO f 0.1 0.1 0.1 1.0 1.5 2.0 MHz Cycle Time (Figure 1) MC6800 MC68AOO MC68BOO tcyc 1.000 0.666 0.500 - 10 10 10 /lS 9500 9500 9500 ns - ns Characteristics Clock Pulse Width :(Measured at VCC - 0.6 V) 1/>1,¢2 - MC6800 1/>1,¢2 - MC68AOO 1/>1,¢2 - MC68BOO Total 1/>1 and cf>2 Up Time MC6800 MC68AOO MC68BOO Rise and Fall Times (Measured between VSS + 0.4 and VCC - 0.6) PW¢H 400 230 180 tut 900 600 440 tl/>r, t¢f Delay Time or Clock Separation (Figure 1) (Measured at VOV = VSS + 0.6 V @ tr = tf .;; 100 ns) (Measured at VOV = VSS + 1.0 V @ tr = tf';; 35 ns) td - - - - 100 0 - 9100 0 - 9100 - Data sheets on pages 9-02 through 9-030 reprinted by permission of Motorola Semiconductor Products, Inc. 9-02 ns ns Me6809, MC68A09, MC68B09 MAXIMUM RATINGS Symbol VCC Value -0.3 to +7.0 Unit Vdc ~ RESET· o !:O Add,,,,, s: rT"'rnC"t"""!~·!n-TT"",,, (") Bus en CO CD o CD BA ~~~~~~~_____________________H_'B_y_te__L_O_By_t._______'n_st_,uc_t'_on______~~-----------------------------------------H,-BY-t,-.__L"_8_"_'_______________ 1 BS\SS\\W~ \L____________~rr~----------------------------~/ I \L__________ I ·Note Parts WIth dilte codes pref,xed by 7F WIll come out of Reset one cycle sooner than shown CRYSTAL CONNECTIONS AND OSCILLATOR START UP 6809 Crystal Parameters' 75 V Voo 3.58 MHz 6.0 MHz 8.0 MHz 30-500 20-400 600 500 3.5 pF 4-6 pF 4-6 pF 6.5 pF Co 015 pF 025 pF 01-.02 pF 01- 02 pF C1 25 pF 25 pF 25 pF 25 pF Cin. Cout 40 K 30 K 20 K 20 K ...U All Parameters Are· 10')-0 "Note: These are representative AT-cut crystill parameters only. Crystals of other types of cut that work may also be lIsed -+-----;~ Fmrr 4.00 MHz RS --------4-----~t~R-C---f~r-~-08V 38------11 D -----39 1-1 MC6809 Yl 8 MHz 6 MHz 4 MHz em 18 pF 20 pF 24 pF Cout 18 pF 20 pF 24 pF 38 Yl 39 D CI'I' 'I'l.O ~~ 3B~'E----J39 Co MC6809, MC68A09, MC68B09 H'A'tT AND SINGLE INSTRUCTION EXECUTION FOR SYSTEM DEBUG 2nd To Last Last Cycle ~~~Ir:~f Cu~r~nt I.• Inst I ad Inst I Dead I· •.• Cycle I.' ,"P _____ .,If4• Dead Instruction Instruction Dead ~H:::al.:::te:::..d_ _ _ _ _ _ ... ...:c:..:.y~Cle:......+,...:....:Fe:::tc::.:.h-r+..:E:.;.:x.:.:ec.::.ut.::.e~I_C...:.YC_le-lI~I_H_a_lt_ed_ I.' ... ..1 o. Q HALT ) C Address Bus , RN/ BA BS Data Bus ~ Fetch Execute ('l \ ~ / \ / ( / / c.)2 t'c.'l ~ (' Instruction Opcode Volume 2 Rev. A. Update 5 9-035 7-79 3: (") IRQ AND NMT INTERRUPT TI MING I--n -----/.- n , '--+-n '2--1-n 'J--!--n • '--!--n • 5--+-n • 6 -+-n • 7--j.-n • 8--1-n '9--+-n , lO+n , 11-\.-n , 12...j-n' 13--+-n , 14-1-n' 15../.·n' 16-1-n + 17.J..n • 18.J..n , 19.J..n , 20.J..n + 21..1 en CD o !.D 3: (") en CD »o AJdress -. , - - , r------. Bus Next ~ tPC'S IROor NMI I~ Instruwon FFFF SP· 1 SP 2 SP 3 SP 4 SP 5 SP 7 SP B SP 9 SP 10 SP 11 SP 12 FFFC (NMll FFFO (NMII FFF8 tiRO) FFF91IRO) FFFF New PC New PCH I ~O.~8V~ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ____ en CD III o Data Bus CD Of Interrupt ServLce Routme RIW~ !.D 3: (") Fetch \~------------------------------------------------~/ 'C 8A:\\SSSS\, BS~ / FiRCi RIW~ INTERRUPT TIMING \'--___~r_ BA~ BS~ / \~-------- \'-------- MC6809, MC68A09, MC68B09 E/Q RELATIONSHIP Elld "f Cyell' fL.llr" Dal,,) 51.1" "f C:yc!t· I E I ~I....---- ---{'----_----JI I_"vs-<{ o I ~-7-4V-----------'\~____~i : I FIGURE 13 F\ I MRDY TIMING \IS~ / \ ______ I Add,,·s' V"I,d 1'-. ____ 1 0 MRDY I \ / \ \\\\\~ 1 I I "I I I JJ I If'CSH f~ Volume 2 Rev. A. Update 5 9-037 7-79 MC6S09, MC6SA09, MC6SB09 TYPICAL DMA TIMING ("14 CYCLES) MPU DMA DEAD DEAD MPU Q r- 'peso \~-- SA. BS \'------.J1 ADDRIMPU) __________________ ~)~----------------------------------------------------~~ ADDRIDMACI------------------------~(~_________________________________________J)~------------I NOTE: 5"MAViiiiA IS iI Signal which IS (h,v"lofJed ",wrnally bll' I~ (l svstt-!1l1 rp.qUHt>mt'nt for DMA AUTO-REFRESH DMA TIMING ( 14 CYCLES) I IDEAD 1"1141-----------------14 DMA I 1 1 I I 1 I I I I CYCLES-------------------~~IDEADI MPU DFADI.--DMA--' I I 1 1 1 Q I DMA BREO~~I____________________________________________________+I--~I--~I----------------I I I I I BA BS---1lr~----------------------------------------------~~r~~----------~ DM AVM A j _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _~\1 "----/ "I "---../ . 9-038 I~---------- "---../ s:n en CO o !,D s:n en CO SYNC TIMING Last Cycle Of Previous Sync Opcode l> o Dead -i- 1~.~ln~s~t~.+I.~F~et=c~h~.~I~.~E~xe=c~ut~e~.~I.~C~y~CI~e~.~I••____~~f-------_SYNCACK Dead Cycle Instruct I.. Fetch •.I I Q !,D s: n en CO m o CD Address Fetch <0 6 Data w <0 RM BA =x:==A'---____----'! l BS~~____________________~~------+_---------------------------------IRQ { FIRQ NMI See Note 2 tPCS NOTE: 1. ::0 2. (I) :.:: }> ~~ Q.c: ~~~N ..... ''::: >a. o ATTENTION WRITERS U OSBORNE/McGraw-Hili is seeking qualified contributors to future updates of Volumes 2 and 3. Qualified contributors must have an excellent technical background, and they must be able to write clearly and without bias toward any manufacturer of products covered. Faculty at universities are particularly welcome as contributors. A contributor, when selected, will be assigned a specific category of parts to keep updated. Keeping parts updated will include describing new parts in the category as they appear, and improving the description of parts that are already covered. Individual one-time contributions are also welcome. :If you would like to become a contributor to Volume 2 and/or Volume 3, please write stating your qualifications and the categories that you believe you could cover competently. If possible, send us a sample of your work; we suggest two or three pages of a part description following the format presented in these books as closely as possible. Send material to: OSBORNE/McGraw-Hili 630 Bancroft Way Berkeley, California 94710 Attention: Volume 2/3 Contributors Volume 2 Rev, A. Update 5 7-79


Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37
Create Date                     : 2012:07:13 17:48:56-08:00
Modify Date                     : 2012:07:13 21:12:26-07:00
Metadata Date                   : 2012:07:13 21:12:26-07:00
Producer                        : Adobe Acrobat 9.51 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:78ab6411-b726-4fd6-92b9-126451d5d120
Instance ID                     : uuid:98caf109-5d0a-42e7-b252-f967b96f18b9
Page Layout                     : SinglePage
Page Mode                       : UseOutlines
Page Count                      : 1470
EXIF Metadata provided by EXIF.tools

Navigation menu