california state university, northridge design of 8086

158
CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086-BASED SINGLE BOARD COMPUTER A graduate project submitted in partial satisfaction of the requirements for the degree of Master of Science in Engineering by Sirichai Tivattanasuk August 1985

Upload: others

Post on 04-Jul-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

CALIFORNIA STATE UNIVERSITY, NORTHRIDGE

DESIGN OF

8086-BASED SINGLE BOARD COMPUTER

A graduate project submitted in partial satisfaction of the requirements for the degree of Master of Science in

Engineering

by

Sirichai Tivattanasuk

August 1985

Page 2: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

The Graduate Project of Sirichal Tivattanasuk is approved:

william MacDonald

Dr. Robert Wo <Chair>

California State University, Northridge

ii

Page 3: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Abstract

Chapter 1

1 . 0 1 • 1 1.2 1.3 1.4 1.5 1.6 1.7 1.8

Chapter 2

2 • 1 2.2

2. 2. 1 2" 2. 2 2. 2. 3 2. 2. 4 2.2.5

2.3 2.4 2.5 2.6 2.7

Chapter 3

3. 1 3.2

3. 2. 1 3. 2. 2 3.2.3

Chapter 4

4. 1 4.2 4.3 4.4

TABLE OF CONTENTS

Hardware Overview ................... .

Introduction ........................ . Central Processing Unit ............. . Read-Only-Memory .................... . Read-Write-Memory .................•.. Input /Output Port ................... . Keypad . ..................... -........ . System Clock ........................ . Decoding Circuitry .................. . Seven-Segment Display ............... .

8086 Architecture .•..........•.•.....

Overview . ............................ . Features .................... "' .... <I ••••

Segmen tat 1 on ........................ . Register Set ........................ .. Physical Address Generation ......... . Plpelined Architecture .............. . Dynamic Re 1 oca table Code ............ . Memory Access Method ................ , Input/Output Operation .............. . Interrupts .......................•.•. Interrupt Pointer Table ...•.......... System Reset ........................ .

Software Development ................ .

Development Tools •................... Programm 1 ng 1 n ASM8 6 ................ . SEGMENT /ENDS directive .............. . ASSUME directive .............•....... Subroutine .......................... .

Hardware Design ..................... .

8284 Clock Generator ........•........ 74LS164 Wait State Generator ........ . 8086 CPU . .•...•........••...•........ 2764 EPROM . .•........................

iii

Page

v 1 ! 1

1

1 1 3 3 3 3 4 4

5

5 7 7 0 --

14 16 19 19 20 20 21 23

25

25 25 26 27 29

32

32 32 34 37

' '

Page 4: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

4.5 4.6 4.7 4.8 4.9

Gha.pte:r 5

5. 1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9

5. 10 5 • 1 1

Chapter 6

6. 1 6. 1 . 1 6. 1. 2 6. 1. 3 6. 1. 4 6. 1. 5 6. 1 . 6

6.2 6.3 6.4

6. 4. 1 6. 5. 1

6.6 6.7 6.8 6.9

6. 10

Chapter 7

References

TABLE OF CONTENTS <CONT>

6 1 16 RAM ............................ . Memory Decoder 74LS138 .............. . 74LS138 I/0 Decoder ................. . 8255 Programmable I/0 port .......... . Display and Keypad .................. .

Ope:t'a.tional Pr·oced\l:r··es •••••••••.•..••

Keypad Functions .................... . Notation ............................ . Examine Bytes or Words .............. . Examine Registers ......•....•..•...•. Input Byte and Input Word .......... .. Output Byte and Output Word ..•.....•. Set Breakpoint ...................... . Clear Breakpoint Address .....•....... Execute User's Program ..•............ Single Step Execution •............... Move Block of Data .................. .

System Monitor Design ..•.............

Program Segmentation ................ . CODE Segment .......•................. INT_SEG Segment ..................... . DATA_SEG Segment ....•..••............ DATA_RAM Segment .................... . STACK Segment .......................• INT_PTR Segment ..................... . Scan Keypad and Display Routine ..... . Initialization Routine .............. . Command Routines in CODE Segment ..•.• EXAMMEMO Routine ...........••........ EXAMREG Routine ..................... . INTBTWRD Routine .•................... OUTBW Rout 1 ne •••••••••••••.••••.•.••• MVBLOCK Rout i ne ..................... . STEPMODE Routine .....•.........•..... GO Rout 1 ne ................ o .......... .

Design Conclusion ................... .

iv

page

40 40 41 42 43

45

45 49 50 56 59 62 64 67 68 69 71

75

75 76 76 77 77 77 78 78 80 81 81 83 85 86 87 88 89

90

92

Page 5: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

TABLE OF CONTENTS <CONT>

page

Appendix A Program Listing...................... 93

Appendix B Link86 Map .....•..................... 144

Appendix C Loc86 Map ............................ 146

Appendix D Schematics ........................... 148

v

Page 6: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Table 2. 1 Table 4. 1 Table 4.2 Table 4.3 Table 5.1 Table 5.2 Table 5.3

LIST OF TABLES

page

Initialization on Registers ........... 23 Byte/Word Enabling .................... 38 Memory Decoding Scheme ................ 41 I/0 Decoding Scheme ................... 42 Keypad Functions. . . . . . . . . . . . . . . . . . . . . . 46 Registers Initialization •....•........ 48 8086 Registers ........................ 57

vi

Page 7: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig.

1 • 1 2. 1 2. 2 2.3 2.4 2.5 2.6 2.7 4. 1 4.2 4.3 5. 1 5.3 6.2 6.3 6. 4. 1 6. 5. 1 6. 6. 1 6. 7. 1 6.8 6.9 6.10.1

LIST OF FIGURES

Computer Board Layout ................ . 8086 CPU ............................. . Memory Segmentation .................. . CPU Register Set ..................... . Flags ................................ . Physical Address Generation .......•... Execution and Bus Units .............. . Interrupt Table ...................... . System Timing ........................ . Minimum Mode Configuration ........... . System Memory ........................• Keypad Layout ........................ . Memory Allocation .................... . SCAN_DISP Flowchart ..•.......•...•••.. Initialization Flowchart ............. . EXAMMEMO Flowchart ...•.......•...•...• EXAMREG Flowchart .................... . INBTWRD Flowchart ....•................ OUTBW Flowchart ..............•........ MVBLOCK Flowchart .•.....•.•..•.....•.. STEPMODE Flowchart ................... . GO Flowchart .........•................

vii

page

2 5 8 9

12 14 17 22 33 35 39 45 49 79 80 81 83 85 86 87 88 89

Page 8: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

ABSTRACT

DESIGN OF

8086-BASED SINGLE BOARD COMPUTER

by

Sirichai Tivattanasuk

Master of Science in

Engineering

Intel 8086 is the advanced, high-performance, 16-blt

microprocessor currently used in computer industry. It

is substantially more powerful than 8-bit

microprocessors previously offered by Intel. In this

project, a computer was designed with sufficient

amount of memory to program in 8086's machine code,

examine and modify contents of memory, examine and

modify system registers, set a breakpoint address for

program execution, perform single step execution

send or receive data to and

for

from debugging

I/0 ports,

purposes,

and move blocks

viii

of data. Interfacing

Page 9: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

r- (ll( ,' ', 1

between the computer and users is through the :::2.-f:e:

keypad. The computer a8cepts key commands or request3

from the user through the keypad and executes

appropriate system routines according the corresponding

commands. The computer consists of the 8086, used as

the main central processing unit <CPU), 16K bytes of

read-only-memory <ROM>, 4K bytes of ramdom-access-

memory <RAM>, and·input/output ports. The computer

consists of about 20 integrated circuits on a single

board. It :represents a powerful system built at low

1,, costs. It may be used as a controller and

v expanded to a more sophisticated sys~e~~ The monitor

program which. controls operations of the system is / ..

J>J;i/1 ', (' ·\, written in ASM86 assembly language and stored in PROM.

The system runs at 4 MHz without any wait state for the

memory. All components are selected to be able to

handle faster speed rate so that the sys~em can be

updated in the future by using a faster clock. Both

hardware and software designs of the system are

described in this report. The system was constructed

with its software implemented. System was found to be

operating properly.

ix

Page 10: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

1.0 Introduction

c r·l·3. t) t e r·· i Hal~lih'are 0·/-;:;:~v ie·,,-:

This chapter describes the overview of the 8086-

based computer in terms of its hard\vare. Fig. 1.1 sho'f>'S

the computer design layout. The system requires a +5

VOC power supply to operate and consists of about 2C

integrated circuits. Two 28-pin sockets are provided to

expand the memory, if needed. The board has a keypad

with seven-segment displays for I/0 operations.

1.1 Central Processor Unit

The 8086-2 microprocessor is used as a central

processing unit running at 4 MHz of clock frequency.

With 20-bit address bus, the CPU can access up to one

million <1,048,576) bytes of memory. The maximum clock

rate for 8086-2 itself is 8 MHz.

1.2 Read-Only-Memory

Two 2764 EPROMs were selected to contain system

monitor and data needed to operate the computer. 2764

itself is a 8K x 8 type of memory. To be compatible

with 8086's data bus, two 2764's were needed to form a

complete 16-bit -word data bus. One is for lower bytes

of data (07-00) and the other is for upper bytes of

data (015-08). The total amount of memory of EPROM is

1

@ •

Page 11: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

16~ t;:cs or BK w~rds ~ 1'-'; -:: ~ .....,.. ... -... .. l.,j, o...J ... .... ._ ..

U9 611&-4

-ooo .

ODD ODD DOD

DODD DODD DODD DODD

Fig. 1.1 Computer Board Layout

(\ '

2

Page 12: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

3

i ·~ .t .. ·-'

To form a complete 16-bit data bus, two 6116's

stat!c RAMs were also needed. Organized as the EPROM,

one RAM is for lower bytes of data. The othel~ RAH is

for higher bytes of data.

1.4 Input/Output Port

The system was designed to have two input/output

ports. one 16-bit parallel I/0 port or two 8-bit

parallel I/0 port.

1 • 5 Keypad

28-key keypad was used to communicate between the

computer and the user. Most keys have functions built

in to serve the designated purposes. Keypad can be used

to enter programs, examine memory and examine

registers. User's programs· have to be in machine

language to allow the CPU to execute.

· 1.6 System Clock

Intel 8284 is a system clock generator for the

8086 microprocessor. The chip contains a crystal

controlled oscillator. The crystal frequency is 12 MHz.

CLK pin has an output frequency 1/3 of the crystal

frequency and is connected directly to the CPU.

·Therefore, the CPU runs at 4 MHz instead of running at

12 MHz.

Page 13: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

1.7 Decoding Circuitry

Two decoding circuits were implemented by using

74LS138 3-line to 8-line decoders. Larger memory c~n

be expanded without adding any other control logic.

The first pair is used to control Chip Selects of the

memory, while the second pair is used to control Cb.ip

Selects of the input/output ports.

1.8 Seven-Segment Display

Eight seven-segment displays were used to display

system messages and contents of memory as requested by

the user.

Input and output ports are programmable as required

by any specific application. The I/0 ports can be

programmed to have byte input/output operations or word

input/output operations.

4

Page 14: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~:t·~,s.p ~e r· 2 3C26 Arc~itec:ure

cha~ter br~ef~y describes 8086 internal

arc:hitecture ar..d the over~iew of features ;.;hich

inherent in the CPU.

2.1 Overview

The 8086 is considered third generation micropro-

cesser. It is designed with a 1~-bit external data

path to memory and I/0. The chip is housed in a

standard 40-pin dual in-line package and operate from a

single +5V power supply. Pin assignment of the 8086 is

shown in Fig. 2.1.

l-ND vee. A Jilt A)lS AJI3 AI6/B ADI~ AI? I~ Agl/ AJ81St A)/0 Alt/st. AP9 &iii/57 AD8 1'111/li"i AP7 liD ,'\1)6. ~/~TI(HO~) A05" ~&TI c..!:LM) A" ~K. C Wit} li~ $4 tfo4/i0) "~ Si c vrli > A»> !;0 clii'N> ADO QSO CAL.!) NHI Ul C i;;TA)

lliTR iiST CI.K. !tEADY ~~0 ltiS'ET

3036

5

Page 15: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

6

2C36 ls cbt.a i nec1 h·.• ...... i

combining ~he :6-bit aa~a path with a pipelined archi-

tecture th~t u:lows iastructions to be prefetched

during spare bus cycles. Standard microprocessors,

such as 8030/8085 and Z-80 execute the instruction by

first fetching the instruction to be performed, the~

execute the instruction during the next cycle. The

hardware spends a lot of time waiting for instructions

to be fetched. The 8086 microprocessor eliminates this

waiting time by prefetching up to six instructions at a

time. Therefore, the system throughput is

substantially improved.

The CPU is also designed to operate with 8087

Numerical Processor, 8089 Input/Output Processor, and

other processors in multiprocessing or distributed

processing systems. The mode described above is

~ormally called Maximum Mode as opposed to Minimum Mode

for a single CPU operations.

From software standpoint, the 8086 systems need

not be written in assembly language. The CPU is

designed to provide direct hardware support for pro-

grams written in high-level languages such as PL/M-86

and Pascal-86. Of course, programs may also be written

in ASM86 <the 8086/8088 assembly language). In certain

Page 16: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~pplications, u5e~s m3f want to link PLIM-86 wtth ASMS5

by using LINK86 CLinker) which allows users to save

developing cost and time.

2.2 Features

Key architectural concepts in the 8086 can be

summarized as follows.

a) Memory segmentation

b) Operand addressing structure

c) Operation register set

d) Instruction encoding scheme

e) Pipelined architecture

f) Minimum and maximum modes in single/multiprocessing

g) Dynamic allocation memory

2.2.1 Segmentation

8086 microprocessor has 20-bit address bus which

can address up to 1,048,576 C one million) bytes of

memory as shown in Fig. 2.2. The CPU views the

megabytes of memory space as a group of four segments.

A segment is a logical unit of memory consisting of ~P

to 64K bytes. Each segment is made up of contiguous

memory locations and is assigned a base address, which

is its starting location in the memory. The starting

address is stored in a segment register. Memory

segmentation is useful in developing modular

7

Page 17: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

be composed of multi?le processes, with each process

constructed from m~l:lple modules. Processes send

messages to each other for communication, whl:e modules

generally share common data when needed. The four

segments may be adjacent, disjoint, partially

overlappling, or fully overlapped.

roooo t----------;

~,,,,.-t et·di,-' [ F 0 0 0 I cs

SQl''"ut £if•~T 4 I D 0 0 0 IE"$

.. ~ ........ . . :;) . Segmer. t.:J t: cr:

8

Page 18: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

AX {3Y.

ex I> X

sp

BP Sl

:DI

7 0 7 0

AH AI-

6H BL.

CH C.L.

:PH I> I..

IS 0

15 0

I stack PoiJtin

f---------------1 Bc.LM! Poi11UY" ·

1-----------------l s-ru lnJtx .__ ____________ ___J Dut;n"{;on 1-,Juc.

15 0

C.S (oJ.A

J:)S t---------------4 ~c.ta. ss sfack

~-------------------------4 'ES ExtrA. ~---------------------4

15 0

Fig. 2.3 CPU Register Set

2.2.2 Register set

7he has gener-al regi3te:s

9

3 . .3

Page 19: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

10

shown in Fig.

subdivided into two sets of four registers each <high-

order registers, and lew-order registers). The upper

and lower halves of the data registers are separately

addressable. Each data register can be used inter-

changeably as a 16-bit register, or as two 8-bit

registers. The 16-bit registers are named AX, EX, CX,

and DX. The 8-bit registers are named AL, AH, BL, BH,

CL, CH, DL, and DH, where H or L suffix designates

high-order or low-order byte of the 16-bit register.

The other registers are always accessed as 16-bit units

only.

The pointer and index registers consist of the 16-

bit registers SP, BP, SI, and DI as shown in Fig. 2.3.

These registers usually contain offset addresses for

addressing within. a .segment. This register set is

divided in(o the polriter subset CSP and BP) and the

index subset <SI and DI). The pointer registers pro-

vide convenient access to the current stack segment SS

(as opposed to the data segment DS>. Unless otherwise

specified in the instruction, pointer registers refer

to the current stack segment while index registers

refer to the current data segment. In certain

instances, specific uses of SP, EP, SI, and DI are

Page 20: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

pc-lnter;1 .. .. source i nde z," and "dest ir.~..at i ;_:.~_

inde:-{··.

Segment Registers

The segment registers are 16-bit registers which

are used to specify the four currently addressable

memory segments: CS <code segment), DS <data segment),

SS <stack segment), andES <extra segment>. All in­

structions are fetched from the current code segment,

offset by the instruction pointer <IP> register.

Operand fetches are usually made from the current data

segment <DS> or the current stack segment <SS>,

depending on whether the offset address was calculated

from the contents of a pointer register. The extra

segment register <ES> points to the current extra

segment which is typically used for data storage.

Instruction Registers

The 16-bit instruction pointer <IP) is analogous

to the program counter <PC> in earlier CPUs. It points

to the next instruction to be executed. The

instruction pointer contains the offset of the next

instruction from the beginning of the current code

.segment.

11

Page 21: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Fig. 2.4 Flags

Status Flags

The status flags as shown In : .. 4

status information to reflect certain conditions as o.

result of an arithmetic or logic operation. Di ffel"'en:

instructions affect the stat~s flags differently. T t"": ... .. general, the flags reflect the following conditions:

1) AF <Auxiliary Flag): It is

carry out cf :he low • ' 1 .,

n1001e into the high nibble or

borrow from the high nibble into low nibble of

8-bit quantity.

2) CF (Carry Flag): It is set, if there has been a

carry out of, or a borrow into, th~ high-order bit cr

the result CS- or 16-bit). The f:ag is affected b;

instructions that add, or subtract multibyte nuffibers.

Rotate inst~uctic~s ca~ also ioolate a bit in mern~r; c~

12

Page 22: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

,:;, l'egister by placing it in-::~:::- .-. ·~-· \'"' ...... ~ . ._ .. _ .... - 1

3 ) 0 F ( 0 v e 1~ f l o w F 1 a g ) : I t i s s e t , : f 2. n. 3. ::- t :-, ~. e t ~ c o v e r -

flow has occurred. An opt i onctl ir ... :erTupt on over f 1 ow

is available that generates an interrupt in this

situation.

4) SF <Sign Flag>: It is set, if the high-ol~der bit of

the result is a 1. Since negative binary ~u~bers are

represented by standard two's complement nctation,

indicates the sign of the result (()=positive,

l=negative).

5) PF <Parity Flag): It is set, if the result has even

parity.

6) ZF <Zero Flag): It is set, if the result of the

operation is 0.

Three additional control flags can be set and

cleared by programs to alter processor operations:

1) OF <Direction Flag) causes string instructions to

auto-decrement to process strings from high addresses

to low address, or from right to left. Clearing OF

causes string instructions to auto-increment, or to

process strings from left to right.

2) IF <Interrupt-Enable Flag) allows the CPU to

recognize external (maskable) interrupt requests.

Clearing IF disables these IF

13

Page 23: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

14

has no affect on either nonmaskable interrupts.

3) TF <Trap Flag) puts the processor into single-step

mode f 01" debugging. In thls mode, the CPU

automatically generates an internal interrupt after

each instruction, allowing a program to be inspected as

it executes instruction by instruction.

0 A 5 o I Offsc.t AJJ,.-.us

12340 -f 0 A 50

I 2.090

19 g

I I 2. D 9 0 I 20- ~;# Ply~; ca/ A~~f#$$

Fig. 2.5 Physical Address Generation

2.2.3 Physical Address Generation

Every segment is assigned a base address, which is

in the segment register. The CPU requires 20 bits to

address a megabyte of memory. The physical address can

range from OH to FFFFFH. The 20 bits are composed of

two portions. The first portion is the 16-bit value

which is in a segment register. The second portion is

Page 24: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

0 '

15

of

a 20-blt a6dress. Each phys:cal seg~ent always begin~

at an address whose low fo~r bits are zero.

location is called a "paragraph boundary." The value

in a segment register is called a "paragraph number".

Thus the location l2340H is indicated by the "paragraph

number" 1234H. For a segment register to point to this

location, it would be loaded with the value 1234H

defining a 64K segment starting at absolute address

12340H.

The physical address is generated as follows. The

paragraph number in the appropriate segment register is

multiplied by 16 <shifted left 4 bits). the result i:.

then added to the offset yielding the 20-bit address as

show~ in Fig. 2.5. The hardware ~utomatically performs

this operation.

An important concept to keep in mind while pre-

gramming is "addressability.· The proper value must be '

loaded into a segment register before the object is

referenced by an instruction. This is accomplished by

using the appropriate sequence of instruct i or.s to

initialize the segment register.

Page 25: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

16

=~~truc~!c~s are always fetched ~:om ~he c~rren~

The in.=--::ru:-:tion pointer

c:P) ~cntains ~he offset of the target i~struction from

t:)e beginning of tf1e segment. As described above,

shifting cs left by A bits and adding IP to it w i 11 '"i

point to the physical address containing the next

instruction to be executed.

Stack instructions always operate on the current

stack segment <pointed by SS). The stack pointer <SF)

contains the offset of the top of the stack. Popping

or pushing operations will update SP accordingly, but

not on SS unless it is reinitlallzed. Register BP, by

default is also operated on the current stack segment.

It thus provides a convenient way to address data on

the stack.

2.2.4 Pipelined Architecture

There are two major units in the 8086 CPU, the

execution unit <EU> and the bus interface unit <BIU> as

shown in Fig. 2. 6. The execution unit executes

instiuctions, while the bus interface unit fetches

instructions, reads operands and writes results. The

two units can operate independently of one another and

are able to overlap instruction fetch with execution.

The result is that the time normally required to fetch

Page 26: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~twtiDn /Jn;f CEU)

~~rur-J R.t,,· s iJ..f"!.

8u.s. lttf:ttf.u {),;t (Bill)

~,,Uli

/(., ,.· sli r ~

.----..=io.o:;_ __ M11-l li/tul AJAt:atS B~ots

1:$ tfU.,..,.t/4" llr B"'s Cordr•(

Fig. 2.6 Execution and Bus Units

17

Page 27: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~s :ransferred between

dev~ces upon demand fro~ the

:he EU lS busy execu~~ng ins:~~cticns, :he 3: U

- ; .-- .........

~ .. -, '·. :... .. .. v ,.,.. • ~ ....

a he ad and f e t c he s more i n s t r u c: i on s £ l:- o m me r.; a 1' y . ':' h ::-

instructions are stored in an intern3l ?A~ a~ray ca:leJ

the instruction stream queue.

to six instruction bytes. The

obtains two instruction bytes if a. pr ... cgr·a~

transfer forces fetching from an odd address, the SCS6

BIU automatically reads one byte from the odd address

and then resumes fetching two-byte words from :he

subsequent even addresses.

The instructions in the queue are these stored

the memory locations immediately adjacent tc and higher

than the instruction currently being exec~ted.

is, they are the next logical instructions so long as

execution proceeds serially. If the EU executes a~

instruction that transfers control to another location,

the BIU resets the queue, fetches the instruction fro~

the new address. However, the BIU suspends instruction

fetching whenever the EU requests a memory or I/0 re2c

or write <except that a fetch alreQdy in progress

completed before executing the EU's bus reqJes~).

18

Page 28: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

The

it pcssitle

i nde pe L""ide n. t,

. . . ' - - ,_. - - -

'"\ A r-. .­:} ',) ,;:_ '~

t~a: are positic~-

relocation allo~s a ffiultiprogramming or multita3king

system to make particularly effective use of available

me mor 1·. In order to be dynamically relocatable,

program must not load or alter its segment registers

and must net transfer directly to a location outside

the current code segmen:. :n other words, all offsets

in the program must be relative to fixed value:=

contained in the segment registers. This allows t~)e

program to be moved anywhere in memory as long as the

segment registers are updated to point to the new base

addresses.

Memory Access Hethod

The 8086 can access either 8 or 16 bits of memory

at a time. If an instruction refers to a word variable

and that variable is located at an even numbered

address, the 8086 accesses the complete' word in one bus

cycle. If the word is located at an odd-numbered

address, the 8086 access the word one byte at a time i~

two consecutive bus cycles.

To max~m~ze thr~~snput .~ 8026-based systems, lC-

19

Page 29: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

20

-' :·. - ~·

t·1 ~~ vert he l e s s , e~~ep~ fer the performance

is totally transpare~t tc

This allows maximum data packing where

memcry space is constrained.

2.4 !nput/C~tput Operation

The 8086 I/0 space can accommodate up to 64K e-bit

ports or up to 32K 16-bit ports. The I/0 space is not

... -segmen. L.ea. To access a port, the CPU simply places the

port address C0-64K> on the lower 16 lines of

2.5 Interrupts

The 8086 can handle up to 256 differe~t interrupt

types. Interrup~s may be initiated by devices external

to the CPU, or triggered by software interrupt

The CPU has two lines that external

de•:ic:es may use to signal interrupts <INTR and NHI).

The !NTR CI~terrupt Request) line is usually driven

!nterrupt Controller. 1-Jhen the INTR is active, the

either responds or ignores the interrupt depending upc~

Interrupt Enable Flag CIF>. I f I F i s c 1 ear , the CPU

ig~cres ~he int~rrupt reques~ ana precesses the nex:

Page 30: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

21 (l '

. - ••• _,. ·- ~ •. it. ... •

l' i gh ~

in.stt·uc: ion. in.tel""'l~t:~ l 3

normally ca:led maskable interrupt.

An external non-maskable interrupt means that the

Interrupt request arriving on NMI cannot be ignored. If

<non-maskable interrupt) and INTR arrive at the

same time, the NMI always has th~ higher priority than

an interrupt request on INTR.

2.6 Interrupt Pointer Table

Interrupt pointer table occupies up to the first

lK bytes of low memory (starting from 0 through 3FFH>.

There may be up to 256 entries in the table, one for

each interrupt type that can occur in the system.

Refer to ,..., . r 1 g. 2.7, each entry in the table a

dcubleword pointer containing the address of the

procedure that is to service interrupts of that type.

The higher-addressed word of the pointer contains the

base address of the segment containing the procedure.

The lower-addressed word contains the procedure's

offset from the begining of the segment. Since each

entry is four bytes long, the CPU can ca:culate the

·location of the correct entry for a given interrupt

type by sim~ly multtplying <type x 4).

Page 31: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

·interrupt type 6 starts at location 6 x 4=24 <or 18H>.

A.,A;{,J,If irtt:irr..-rt fo; .. iit..s l n4)

Fig. 2.7 Interrupt Table

22

Page 32: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

GPU CoM potJENT CoNT=NT

Flo.a~ cltar

IP ~sil'tlr ooooH

c.s !Qgi~lir .,: FF~ H

'DS !U3i~1i., o ooo ...

ss ~J;S tit o oooH

E~ Elgi~t.'( 0 ooo ...

Q\A.Cl\4!" t"Wtp~

Table 2.1 Inlti~lizatio~ on Registeis

2.7 System Reset

The 8086 RESET line provide an orderly way to

start or restart an executing system. When the

processor detects the positive-going edge of a pulse on

RESET pin~ it terminates all activities until the

signal goes low, at which time it initializes the

system as shown tn Table 2.1.

23

Page 33: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Since the coae segment registe~ c~nta:~s FFFFH 3nd

the instruction pointer contains OH, the processor

executes its first instruction following system reset

from absolute memory location FFFFOH. This location

normally contains an intersegment direct

instruction for information in the program

Jt1P

that

identifies its first instruction.

24

Page 34: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Ct1a.pter .. 3 S~ftwa~e Development

3.1 :·evelopmetlt 7ools ·

The development system needed is ISIS-II~ Intellec

Development Systems, series III from Intel. The Series

III is the updated version of Series II. It is an

8086-base development system which has the 8086 and

expanded memory included in the system's Multibus. The

actual tools to develop this project are list below:

1) ASM86--an 8086/8088 macro assembler which generate

object modules from assembly language programs.

2) LINK86--a linker combinding object modules into load

modules.

3) LOC86--a loader. which binds load modules to the

absolute object file.

4) OH86--a hexadecimal file converter which converts

the absolute object file into a hexadecimal object

file.

5) ICE86--an In-Circuit Emulator for the 8086 CPU.

3.2 Programming in ASM86

Executable instructions is always in a physical

segment defined by the value· in CS. Any stack

operations occurs within the segment defined by SS.

·Data is normally found in the segment defined by DS,

but it can be placed in the segments defined by the

25

Page 35: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

26

any number of logical segments that were specified '· ~-. . '.

the program so~rce code. To start programming, the

SEGMENT directive is used to define a logical segment

which is described in the next section below.

3.2.1 SEGMENT/ENDS directive

The syntax for SEGMENT/ENDS declaration is:

name SEGMENT

name ENDS

Instructions or data should fall within SEGMENT

and ENDS declaration to let the assembler know where

the beginning of the segment is and where it ends. For

example, we could have two segments named CODE

DATA. The first is for code instructions and th2

latter is for data.

ASSUME CS:CODE, DS:DATA ; to be described later

CODE SEGMENT begin of segment CODE

MDV AX,DATA Two instructions are

MDV OS, AX ; used to initialize OS

MDV AX,3

Page 36: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

MGV

MOV

CODE ENDS

DATA SEGMENT

ABYTE DB

BBYTE DW

DATA ENDS

DX,AX

AL,ABYTE

?

?

3.2.2 ASSUME directive

; get operand based en DS

; end of CODE segment

begin of DATA segment

allocate a byte

; allocate a word

end of DATA segment

At run-time~ every memory reference requires two

parts in order to be physically addressed: a paragraph

number <segment part) and an offset <within the

segment). The paragraph number will be in one of the

segment registers~ defining the physical segment in

which the variable lies. The offset value will be

contained in the instruction which makes the reference.

The ASSUME directive is used to define what the

contents of the segment registers will be at run-time.

The assembler will check each memory reference for

addressability based on the contents of the ASSUME

directive. One important thing is that the ASSUME

directive does not initialize the segment registers.

27

Page 37: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

It is used by the assembler T .-· - 1,.. '

addressability of the code and data. The c~~m~le belc~

demonstrates how to use the ASSUME direc~ive.

ASSUME CS:CODE, DS:DATA, ES:NOTHING

; Begin of CODE segment

CODE

CODE

SEGMENT

MOV AX~DATA

MOV

MOV

MOV

ENDS

DS,AX

AX,TEST1

BX,TEST2

; Begin of DATA segment

DATA

TEST!

ABC

DATA

SEGMENT

ow

OW

ENDS

3

4

; Begin of DATAl segment

DATAl SEGMENT

; OS points to DATA

Instruction uses the

; offset to obtain

; TESTl

; This instruction is

; error. TEST2 is

not addressable.

; define data

28 (l '

Page 38: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

29

TEST2

DA T.i\ 1

There are ~hree segments: CODE? DATA, and DATAl ic

the previous example. Since the ASSUME has bee~

declared to point to CODE and DATA only, trying to ge:

operand TEST2 will generate an error. If the 11. QQfT~,.~:"" C.."-..J'-" v ......

directive had been declared as follows:

ASSUNE CS:CODE, DS:DATA, ES:DATAl

Trying to get operand TEST2 would have been correct.

3.2.3 Subroutine

A PROC directive is used to define a label and to

delineate a sequence of instructions that are usually

interpreted to be a subroutine. Each subroutine is

contained within the PROC/END declaration as below.

name PROC

<subroutine>

name ENDP

where name is the name of the subroutine.

The PROC Is an a5sembler directive,

Page 39: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

The PST Cre:urn lnstructlon) 1~ normally

pla2ed in f~cn: of :he ENDP. There are two types of

RET i~s~ruc~ian, "near· and ·far", that correspond to

the type of CALL made. The near type RET is generated,

if the subroutine is within the same segment as its

calling segment. Otherwise, the far type RET is

generated, ·~ 1 ~ the subroutine is located in different

segment. The difference between the two is that the

far RET also pops code segment into the CS segment

register right after popping the top of the stack into

SP. Normally when creating a subroutine, either NEAR

or FAR is declared after the PROC as follows.

EXAMPLE SEGMENT

SUBl PROC NEAR ; begin of subroutine 1

(near subroutine within the EXAMPLE segment)

RET ; type near RET is generated

SUBl ENDP ; end of subroutine

CALL SUBl ; intrasegment call

SUE2 PROC FAR ; begin of subroutine 2

; to be called from other segment

30

Page 40: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

(far subroutine for segment INTER)

SUB2

RET

ENDP

EXAMPLE ENDS

INTER SEGMENT

; type far RET is generated

; end of subroutine

CALL SUB2 ; intersegment call

INTER ENDS

; CS and IP are pushed onto

; the stack.

Intrasegment CALL and intersegment CALL are

differentiated by declaring the PROC to be either NEAR

or FAR as the example above. The intrasegment CALL

pushes only IP onto the stack. The target procedure's

displacement can be up to ± 32K within the segment. For

intersegment CALL, not only is IP pushed onto the

stack, CS is pushed onto the stack and is then replaced

by content of the new CS of the subroutine.

31

Page 41: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Chapter 4 Hardware Design

This chapter describes the details on the circuits

of the computer. The schematics are included in

both Appendix D and small pocket on the back cover.

4.1 8284 Clock Generator

The clock generator accepts a crystal input which

operates at a fundamental frequency of 12 MHz. CLK

output divides the crystal frequency by three to

produce the 4 MHz CLK signal required by the CPU. The

clock generator provides two control signals which are

synchronized to the 4 MHz CLK signal; ROY <ready> and

RST <reset). RST is used to reset the computer to an

initialized state and occurs when the RES input is low

<when power first is applied or when RESET key is

pressed). The READY output is active when the RDYl

input from the wait state generator <74LS164) is

active. The wait state generator is to be described

later. The READY output of the 8284 is connected

directly to the READY input of the CPU. When READY is

high, lt enables the CPU to continue what it ls (

supposed to do in T4 cycle.

4.2 74LS164 Wait State Generator

74LS164 is a shift register used to operate as a

32

. .

Page 42: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

33

\ To 1 n 1 <3 1 rw.<tl T~ I TJ 1 T> 1 T3 1 r.,,,r T't I CL.~

ALE

sz.-50 \ 7/il~!i! \ !JliJji,f 1!1 \ AJ.Jt/ st.ct-.s S7-~3 S7-S3

AJkf~da. l>..,tQ. Cut (Dis--Do) .-cc_ iD, ,iifit

W.rrf

rfrli

DiN

Wjit

Fig. 4.1 System Timing

wai: state generator.

Page 43: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

34

for a slow peripheral ItO, or even slo>-;

me~ory, ~o allow on-board I/0 operations ~o function

correctly when the CPU is operated at a 4 MHz rate.

Two wait states have been inserted for I/0 operatipns.

For memory operations, no wait state has been inserted

at all, allowing the CPU to quickly execute memory

instructions.

The wait state generator is cleared following

every read, write or interrupt cycle (if to be used),

and subsequently is enabled at the beginning of the

next read, write or interrupt cycle when the CLEAR

input to the wait state generator goes inactive (low).

After enabled <high>, the 74LS164 begins to shift a

"one· through its register. QB output starts to go

high after two shifts causing the clock generator's

READY output to the CPU go active <high).

If two wait states is not sufficient to operate

slow I/0 peripherals, slight modification can be made

by selecting either QC, or QD to allow us to include

three or four wait states in the CPU bus cycle .

. 4.38086C?U

The system uses the 8086 as the CPU which 1s a

Page 44: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Q '

35

12./'1Hz

D r 'i 1 5V

p

' ~:Z.$~ ~ 7tfJl ~ Yo ·-; ,__ ees - ~

cJ.I\. '""=' p.)

- CIDGk - s~r _:JV r-r-V Yo -

J 6-,t~ttrD..fo r i-- _,. RaH l'tN/ii.i

ALE

4r ~026-2 I c.pu M -"'fro

A~...t'" :A "" 7H73

.AI6-AI! ~~~ t3)

74/~~ m wo.<t L l StAt&. - ..-Wit ~tJ

qcntYJ,y l L I Tl

't>A. tA. 8kS.

~

ro~ 'l .. J Ad. " lA)

~Ji 1--J l " ~I.. CSH

i- 7'1-/36 6116 AAH c:1) 2.764-~ (~ 82&51/C (.z)

~ (2.) .:zk:r-t ~j(i 9KlC8 SK;:S

Yo csH 1 est. CsL I CSH I 'fr '{f) 1 T r-T l

Fig. 4.2 Minimum Mode Configuration

truly external, 16-bit data bus microprocessor ~s

Page 45: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

BC~38 does h2~ve ir:..-sern.al arch:tect=lLe equivalent. .. vc~ ·~>:].:

of the 8086. But when it comes to fetch a :6-bi~ J2ta,

the 8086 is faster that the 8088. The rsason iE ~hat

the aoe6 only needs one fetch cycle instead of two to

get an 16-bit data at one time. Th~ s.ystem i.3

configured to be in Minimum Made, whlch does not

require to communicate with any coprocessors. By tieing

the MN/MX high, the 8086 is !n the Minimum Mode.

The CPU has a combined address and date bus which

is timed multiplexed. The CPU bus cycle consists of at

least four clock cycles Tl, T2, T3, and T4. The

address is emitted frcm the processor during Tl and

data transfer occurs on the bus during T3 and T4.

During Tl of any bus cycle, the ALE (Address Latch

Enable) signal is efuitted. The CPU's time multiplexed

bus is connected to t~ree 74LS373 latches. The ALE

output latches the addresses into the 74LS373 upon the

positive transition. At the trailing edge of this

pulse, a valid address is latched. The ot:tput of

74LS373s are the address bus connected to RAM, EPROM,

and input/output por~ as shown in Fig. 4.2.

The INTR# TEST, and HOLD inputs to the 8086 are

·disabled. There is no interrupt support and any use of

TEST, and HOLD. t..Ji1I (no~-ma.skable interrupt) :s a.lso

36

Page 46: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

used . f: 1 ... more

scphi£:~cated re~iphe~als or another configuration iL

t o be i r1 c l u de cl .

When the system is reset~ the 8086 executes the

instruction at location FFFFOH. The instruction at

this location is an intersegment jump Cso called FAR

jump) to Initialization segment to load CS~ OS~ and SS

segment registers with initial values. After the

Initialization segment~ the CPU starts to execute the

monitor program.

4.4 2764 EPROM

The system includes 16K bytes of EPROM Cin two 8K

X 8~ 2764 EPROM devices) containing the system monitor

required to operate the computer. The system monitor

program resides in locations FCOOOH through FFFFFH.

Each EPROM is enabled by the corresponding output from

decoder 74LS138. The memory is divided into two banks;

high EPROM and low EPROM. One bank is connected to the

lower half of the 16-bit data bus <07-00), containing

even addressed bytes CAO=O>. The other bank is

connected to the upper half of the 16-bit data bus

(015-08), containing odd address bytes <AO=l). The

high EPROM is controlled by Ul7 (74LS138 decoder); the

37

Page 47: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

38

··-·- -···,--.--

AO CHA~AC.IERI.S.T1CS BHE.

0 0 Whole WmL

0 I Upp.t'( Bytt odJ A~Jr.tss

I 0 lPWH Bytt. fvc~t AAar.tss

I I Noru

Table 4.1 Byte/Word Ena~ling

low EPROM is controlled by Ul6 (the other 74~3:32).

Refer to Table 4. l, to access even addressed sizteen

bit words (two consecutive bytes with the least

significant byte at an even byte address), AO and BHE

are low, enabling both decoders U16 and c:7

_s i m u 1 tane o us 1 y. To perform byte· transfers to odd

addresses, the infcrnation is transferred over the

upper half of the data bus <015-08) in which the ·BHE

<low state) enables the upper bank decoder U17 and AO

<high state) disables the lower bank decoder U16.

perform byte transfers to even addresses,

the information is tra~sferred over the lower half of

the data bus (07-00). ln this case AO is low, enabling

the lower ban~ deccjer BHE is

Page 48: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

.. ~-..;. ... ._: '..::. .. _. ~ . . . ::~

16-b!t ~crd. :he least significant byte i c

first transferred over the of the CEHE

:s lo>..-, while AO is high). The significant byte

is then transferred over the lower half of the bus CBHE

:s high, while AO is low). Directing the upper and

lower bytes o£ the 8086 transparent to

programmer. When it comes to designing hardware, the

designer has to be aware of accessing method of the

CPU.

OH

ft:/1 1ot1H

FFFH

FF'ffFH

~OM

Mon;t·or

~

fc-

Il1fin-1Aft ~d()T .s

sysfi'"" sf~k

Fig. 4.3 System Memory

39

Page 49: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

40

., ;:::::: .- • 1 - -.._ •, ~I

·cc • ~ \: • ~ ~ :C.,., .. ,

7wu 6116 devices are included to have 4f by:es of

':'he 4f~ bytes of RAt1 . . .Lc~c-3..:ea memor'y.

at the lew end of memory~ locations OOOOOH through

003FFH and controlled by U16 and Ul7 decoders.

acces~ method is exactly the same as the one described

in the previous section. These two decoders control

access low~ high~ or beth bytes of memory. The first

256 locations <OOOOOH through OOOFFH) ..... v

stored interrupt vector tables and system stack a~

shown in Fig. 4.3. The rest of memory can be used by

the user to read and write his application programs.

4.6 Memory Decoder 74LS138

U16 and U17 are used for memory decoding. 74LS138

is a 3-to-8 line decoder which can expand the memory ic

case it is needed. Whenever the CPU fet:.::hes

instruction or operand~ the CPU,s H/IO !s high

<indicating memory operation) which enables U16 ana

U17's Gl input pin. U16 and U17's G2A inputs are usea

to either enable the upper bank of memory or enable the

lower bank of memory as described above. Memory tabl<:

describing the decoding scheme of the two decoders is

shown in Table. 4.2.

Page 50: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

41 " '

I 3HE AO AlB At7 .. Alb ACTIVE'· PIN ON 74-138 ( Ulb, 17)

0 0 0 136tk Yo:S (=c)

0 0 I Both. y,·s .,

0 I 0 Bo~ Y:z.'s " 0 0 0 I I SDU.. Y3'S "

I 0 0 f.>otl.. Y~+'s " I 0 I .Botf.. '(5 's " I I 0 !!>oU.. Y6'~ ., I I I 5otl Y1s .,

0 0 0 Ut7'.s Yo .. 0 0 I U17'.S '{j n

0 I 0 U17'5 Yz. " 0 I 0 \ I UI7'S Y3 If

I 0 0 Ul7 '.s Y4 ' I 0 I u t7's Ys ,, I I 0 U17'~ '1'6 II

I I I U17'.S Y7 ,, 0 0 0 lllb :s io ,, 0 0 I UI~'S '(J ., 0 I 0 Ulb'S. Y.z. •

I 0 e> I I Uf6!s '(3 1/

' 0 0 UI6'S '(4 II

( 0 I IJI6'5 IS ,, l I 0 Ulb'~ "({, • r I ' u 1(, '.> 'f7 ,,

Table 4.2 Memory Decoding Scheme

· 4.7 74LS138 I/0 Decoder

Two 74LS138 <Ul8 and Ul9) are included to decode

I/0 addresses. The I/0 operations can be either bytes

or words. The CPU's M/10 is low (indicating I/0

operations>, whenever I/0 read or write cycle occurs.

Refer to Table 4.3, besides M/IO, ~7 also has to be

'high to enable U18 and U19. UlS controls upper bank

pert; U19 control lower bank port.

Page 51: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

42

- AD A7 As BHE A .If A3 ACTIVE fiN ON 7Jf138 ( UIB, 19) J 0 0 0 Botk. Yo5 (:0) i

I 0 0 I B6ti Yr's. II

0 I 0 soti '(::z.'s ,, I 0 0 I 0 I &~ Y3'> 1/ I

I I

I 0 0 B4d- '<4'> If

I 0 I ~~ '(s'.s IJ

I I 0 Satl-. 'lb'> 1/

I I I B~ .,....,~ • 0 0 0 UIS'S Yo " 0 0 I Ul9~ YJ " 0 I 0 UIS'.S Y:z. II

0 I I 0 l I U15'> 't3 ,, I 0 0 l) 18'> '(+ u

I 0 f l) IS'S '(5 " I I 0 u lfO:S y, " I I I JlJ.a'S '(I II

0 0 0 UI9'S '{o .. 0 0 I Ul9'> '(I " 0 I 0 UI9'S 't'l. " I 0 I 0 I I ur~·s '(3 II

I 0 0 Ul9~ '(lt v

I 0 I UI~S '1'5 " I I 0 l)(9:.S Y& ,, I I I U19'~ '17 II

Table 4.3 I/0 Decoding Scheme

4.8 8255 Programmable I/0 Port

Two 8255's <Ull and Ul2) are input/output ports

partially used by the system and partially available

for the user. I/0 operations can be either byte

··word accesses. For word I/0 operation, both

are en3.bled and the CPU can either re3.d frcrc: cr ;;r i -::"'

Page 52: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

activ~te elg:h !-segment displ5ys and read the keypad.

Cnly port B of both 82~5's is available for the user.

To use port B as an in~ut or output port; simply write

a command byte to the 3255's contol register. If word

input/output port is required, the same command byte to

both 8255's can be used. For the system, port A in Ull

is always used as output; port C in Ull is always

input. Port A in Ul2 is always used as output; port C

in U12 is input.

4.9 Display and Keypad

Eight 7-segment display LEOs are used to display

hexadecimal numbers or messages to the user. They are

common-cathode LEOs <Hewlette Packard 7760). Each 7-

segment LED is controlled QY a high sink current

tran&istor <ST1602), which is in tutn contolled by the

CPU thru port A of U12. The system monitor handles

displaying any number by activating the transistor one

at a time. For example, to display '1234 AB70', the

CPU first sends displaying code for '1' to port A of

Ull, then it turns on Q1 by resetting PAO of Ul2. Q2-

Q7 are off at this moment. As a result, '1' will be

._displayed at the first 7-segment LED. After , 1 , . is

displayed, the CPU sta~:s to send displaying coae for

43

Page 53: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

44

-so t='cYt A of Ull artd turning on. 0.2 t>y re;:.ett~tl;;:;

.r,. s a 1- e .:; u l t , 1 2 1 w i 1 1 be d i s p l aye d a t the s e::: on i

7-seg:nent LED. 7hese activities are repeated until the

last digit '0', then the CPU will start scanning the

keypad. If no key is pressed, the CPU will start fro~

the first digit and repeat to display the numbers al:

over again. The design puts the amount of work lt:

software, but it makes hardware design easier and less

expensive.

The CPU reads the keypad from port C of Ull a~J

that of Ul2. Two types of keypad are used. One is th~

regular on/off keypad; the other is the matrix type of

keypad. The CPU starts off by scanning the matrix

keypad by resetting PAO and reads PCO, PCl, and PC2 cf

Ul2. IF no key is pressed, the CPU will reset PAl and

read PCO, PCl, and PC2. Once scanning the matrix

keypad is done, the CPU will start reading i~

individual key switch starting from PC3 of U12 and end

at PC7 of Ull.

Page 54: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~-- -. \-.- -·-- ~ ~ __ , [-" ·~· ~ - --·

. - · ·~ ·• ·· ··~-'~:..I : ~ .:2:::(.: .: ;: :-_~ .:-~

5.: - . c ~::·~~::: ~ :.~~..:

-· ._;

communicate to ~he computer.

individual keypad command and function.

D ~ 9' [:] I tpl I fcLI 00 j Sbr j j'f;;c~l b~;d ~l~cJ lo2/rl31 I f.ss I I /~S I I ENDI lEg/A)£' le~s~l ~ p lo~J ~M~szl lew/Dzl

QGJD i~serl ODD

Fig. 5.1 Keypad Layout

General Discripti~n

Whenever the computer is powered up~ tbe

45

Page 55: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

lr:a~Ax\

I ::J;axl l(fl7t~l IST~:~/D~ IIFfftspj

I otJsrl I M:/srJ ..

• [EJ/I>~ hw~cs[ loJ/DSI [k} [&] I ,1-P I [X]

0 ITJ I ~esErl

ITJ u f1'&J q.

=~amine Ey~e, AX register

E~amine ?~gis~er, 3X register

·3G, CX l'eg i ster

Single step, DX register

Input Byte, SP register

Output Byte, BP register

Move a block, SI register

Examine word, DI register

Input word, CS register

Output word, DS register

SS register

ES register

IP register

Flags

nothing

nothing

The system 'reset' allows the user to ter­minate present activity and to return to an initial state.

'is used to increment address in Examine or Examine Word

is used to decrement address in Examine or Examine vJord

is used to Jisplay any register contents and clear a breakpoint address

Byte

Byte

46

Page 56: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

------------------------------------------------------Keypad : Fu!1ction

is used to separate an address to be s~:~~~d into two parts; a segment value a~d an o~f­set value

is used to start displaying or activating certain activity according to the command

is used to signify ending of the command

is a spare key

Table 5.1 Keypad Functions

47

Page 57: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~ . 1~\ ...... + ."'""': ,. .... ·, - ._,. '"' ........ t-~.ble, und 8255s are in.i t iul izell.

Table 5.2 ~haws all register values ~ar cold start.

Register

DS ss ES IP AX BX ex DX SI DI BP SP

Value

0030 0030 0020 0030 0000 0000 0000 0000 0000 0000 0000 0000 0100

Table 5.2 Registers Initialization (Cold Start)

If the <RESET> key is pressed while the power is

on, none of the registers is initialized. This 'warm

start' allows us to~etain our registers~ if changed

after the cold start. Refer to Fig. 5.2, user's program

can start from address 300H. System data and system

·stack are all~cated in the first page and second page.

User's stack is allocated in the third page of the

me mary.

A Message k'PCP-80~6' is always displayed on 7-~

segment LEOs when i t is .r_t: a_9.y ___ ! . .C?. .. _~s;s:~.E.~.~·---~!::.~ ... _._C::_~-~~~~!~.

from the user. J1g_;:;_t commanc]s and functions end right

after the_~NQ! key is pressed. The left four LEDs is

considered to be the address field, while the right

48 (l •

Page 58: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Q '

49

OOODOI-{ :Ctrflr'f)/.,t foi,Ttrs. 'ic

<;'jSGM t;f"'J.:.

t;,str~ ~tda..

U~r's st~J:. 6116X2.

usus Ar..e~

coFfFfi

Mort.itor i fr"I',.M,

Fig. 5.2 Memory Allocation

four LEOs is con&idered to be the data fiel~. Since

there are only four LEOs to represent any address

instead of having five LEOs, there is always a segme~t

register involved.

5.2 Notation

Page 59: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

so

The command notations are described below.

[AJ Indicates that 'A' is optional

CA1* Indicates that there can be one or more of ·~'

<A> Indicates that 'A? is the category required

(A) Indicates a key 'A'

. - Indicates 'defines?

end the current command. The main purpose of having to

press the <END> key is to inform the computer of

accepting new command automatically without waiting

for the user to press the <RESET> key every time, as it

normally would, to start entering new command. After

pressing an <END> key, an _';_!lg ________ ~ message is shovm

on the ~l~pJqy __ J_gx_ ___ tW_Q seconds. Then it displays 'PCP-

8086' meaning that the computer is ready to accept new

command. Normally, user has to follow the· syntatic

rule specified in the command, or an 'Err ' message

will be shown on LEOs which tends to abort the current

command in some cases.

5.3 Examination of Bytes or Words

The Examine Byte <EB) and Examine Word <EW)

commands are used to examine the contents of selected

memory locations. Both commands also allow us to

modify the contents of byte locations or 'r.'ord

Page 60: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

locations.

Syntax:

<EB> <address> C,) i <data>] <END)

<Et-D <address> (,) [.(,data> l <END>

<addres£ :=/(<REG> [(segment reg>l* (:) J <hex> ' --

<segment reg/ :~--(-(-c~> : <DS> : <SS> : <ES> }

v <data> := <hex>

where <hex> indicates hexadecimal numbers.

Operation

Whenever either key is pressed, the decimal ~q_int_~

in the address field will light ~o indicate that

subsequent entry will be routed to the address field)

The number in the address field is 9-9tually ;an gJJQet

value. Note that all memory addresses consist of both

a segment value and an offset value. Pressing the

<REG) key. and a segment register will speci"fy which

segment register is selected. ~hen no segment register

is specified, the default segment value is the current

contents of the code segment CS registe,rJ (when a

segment register is specified, the first address entry

is the segment value, a colon(:) is entered as a

seperator, and the second address entry is the actual " r

offset value) ()f more than four

entered, only the last four digits are

hex digits

valid.) /

are

51

Page 61: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

0£ter the address is en~ered, press the (,) key

byte or· contents of the

addressed memory, depending upon which key was pressed)

When using the Examine Word command, four LEOs will

light in the data field. The decimal points appeared

now indicates that subsequent entry will be routed into

the data field. The low byte contents of the memory

are in the two least significant digits in the data -- ------ ---~-.~

field <two rightmost LEOs). The high byte contents of

the memory (address +l> are in the two most significant

digits in the data field <two left LEOs>. If no

modification is to be made, pressing the <END> key will /

terminate this command. (Pressing any hexadecimal key

before the <END> key will modify the memory contents

right away.)

When using the Examine Byte command, two right

LEOs will light in the data field, and so will two

decimal points. No matter what odd or even address is,

displaying byte contents is always on the least

significant two LEOs.

Whenever ~XC3,minin9consecutive words or ):)ytes is

. desired <normally required to check contents of pro-

grams or data befcre execution>, pressing (+) key after ~ ........

52

Page 62: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

53

the d~ta f!eld !s dis;::ayed vdll i ncre men t

by 1, for Examine Byte comrr.and, or by 2, :or Exa7.'.: ne

Word command, and will display next consecutive byte or

word accordingly. Pressing <-> key will similarly

decrement by 1 or 2 depending upon Examine Byte or

Examine Word.

Error Conditions

Attempting to modify a read-only memory <EPROM)

location.

Example 5.3.1: Examining a series of memory word

locations, relative to the CS register, starting from

lOH.

DDDDDDDD

Page 63: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

54

@J[Q]lillQDDDD ~

@J[g]Ql2JDDDD ~

@][Q][J@JGJG100 Q

@]@][!]@10000 [!]

@]@0El0EH~GJ G

@JIQI0~0000 D . @1@111]@8000 . GJ

0G~DDDDD ~

[!j[S[a[j~(g~!m

Example 5.3.2 Examining and modifying memor-y- byte

Page 64: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

55 (l '

loca:lon 32H relative tc :he SS reg~~:er.

[f][f]@]{j[iij[g[m@ l~serj

DDDDDDDD IE~A1

BDDDDDDD [;] ~

. 0~000000 I ~~I DDDDDDDD [U

0@1@1~0000 Q{J

@J[qJr!Jra.lDDOD ~·1~ 0~0@100EIEI GJ

. 0000000EI ~~

·0G0DDODD I~NDI

0008~@1@0 Example 5.3.3. Examining and modifying memory

Page 65: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

56

lo~a:ions ~~ PROM.

DODDDDDD rn GDDOODDD ~

00000000 IIw~~

OQCIOODOD CD

@J@J@J@JDDDD jes!AXI

0@1_0@]~@]00 0

@J000[qJ@J@l0 [!J

0BBDDDDD lr~csl

5.4 Examine Registers

The Examine Register <ER> key is used to examine

and ~odify the contents of any 8086's registers.

Page 66: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Register Name Display fonT;C--::.

AX A BX B ex c DX d SP SP BP bP SI SI DI di cs cs DS dS ss ss ES ES IP IP FL <Flags) FL

Table 5.3 8086 Registers

Syntax:

CER) <register key> [[(data)] (,)]* CEND)

<data> := <hex>

Operation

After pressing the CER> key, ,r ' will prompt

on the display meaning that pressing any register key

is required to display the contents· of the register.

The address field always shows register,s namei the

data field always displays the current register,s

contents. Four decimal points will light in the data

field while register,s contents are displayed.

Pressing any hexadecimal key now will alter the

contents of the current register. When modification is

done, pressing the <END) key wlll terminate the Examine

57

Page 67: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

-.... - .~· . .. ~- - ,..... ... _ •I\ .......... ~ ~ -~ .£ ... .1. ~

be done by pressing the (,) k~; afte~ the r2g!3ter's

contents are d~splayed. The nex: register t~ be

displayed is always ready because all reg!sters are

ordered

current register is DX.

i:1 Table ....----.___

G_ressing ':.he (,) key

the

v; i 1 l

display the contents of the next registe0which is SP

register. The sequence is circular, mear. i ng that

register will display again after FL, until the <END)

key is pressed.

Example 5.4.1 Displaying and modifying DS register.

0DDDDDDD

0G0DDDDD Example 5.4.2 Dis~laylng CS and a series of registers

58

Page 68: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

59

GDDDODDD ~

00000000 lr~csl

00DDGGJ0G 0

00DDGJGJ00 8

000'00000 ~

00DD00GJGJ 0

0B~DDDDD El. 5.5 Input Byte and Input Word

The Input Byte CIB) and Input Word CIW) are used

to read a byte 0~ word froffi s~ input port.

Page 69: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

60

<IB) <port address> [(,)]* <END>

<IW> <port address> ((,)]* <END>

<port address> := <hex>

Operation

When either the IB or IW key is pressed, four

decimal points in the address field indicates that a

port address entry is required. Using the hexadecimal

key to ente~ the port address of the port to be read.

Note that port address can be anywhere from OH to FFFFH ----·~~-~-------· ~-.~~·--·-------

(64K).

After the port address has been entered, pressing

the (,) key will display the current data byte or word

at the addressed input port, depending upon which key

was pressed. No decimal points ln the data field will

be displayed in both commands. Pressing the (,) again

will update the display until the <END> key is pressed.

Both commands can be used to read 8255 parallel I/0

ports <on board) or peripheral devices.

Example 5.5.1 Byte Input from Port SOH

DODD DODD

Page 70: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

61

0fEJ@J@0DDD ~

@1@]0@]0000 ~

@1000000@] 0 @@]@@)000@] 8

@J@J0@000[iJ 0

0G00DDDD §] Example 5.5.2 Word Input from Port 33H

0r£J0B!mlmlliJ~· l~s~

QQQQDDDD ~

@l@J!QJ l!JDD DO ~

@10000000 ~

Page 71: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

0000G000 G

08000000 E1

000El0@JI!l0 5.6 Output Byte and Output Word

Th~ Output Byte COB> and Output Word <OW>

to output a byte or word to any output port.

Syntax

COB> <port address> [~,)(data>l* <END)

<OW> <port address> [C,)<data>l* CEND>

Operation

are used

When either the COB> or COW> key is pressed, four

declrnal po1nts 1n the address field will +- .••·

62

Page 72: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

63 @ '

indicate that a por·t ad:i.:--ess en:r·y ~5 e}:pec:ed.

the port address is entered, press the (~) key. The

decimal points in the data field will light to indicate

that the data byte or word to be output now can be

entered. Use the hexadecimal key to enter data byte or

word. After the data is entered, press the ( ~~--~.e.J:' ___ !o ---~-~·-··-··-···- ·---·---·-----.. -.. ---·~-------~~ .. -----------·-----··------·----··

either byte o--f0%word to the

Similarly, pressing the (,) key again will output it to

the output port until the <END> is pressed.

Example 5.6.1 Output byte 08H to 80H port

QQQDDDDO

@[~000000

00@@]0000

0G00DDDD

Page 73: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Exa~~!e 5.6.2 Outp~t word 0089H to 86H address

DDDDDDDD [q]~~~DDDD

@1@]@100000

00000000 00000@1@10 000(ill@I@J~EJ

00[§]~@1@0~

0G0DODDD 5.7 Set Breakpoint

The Sbr CSbr> key is used to set an address at

which the CPU stops executing user's program.

Syntax

<Sbr> [(address)] <END>

64

Page 74: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

65

3etting a bre~kpoint permits the CPU to stc~

exec~tion at the address to be specified by this

The breakpoint address is always relative to

~_regis t.er. To enter a breakpoint address, press the

(Sbr) key. If a breakpoint has not been entered

before, an message '_?b~ ----' is displayed on the LEDs

where hyphens in the data field exactly means no

breakp~Ln~ address has been specified. Entering the

breakpoint address now will appear in the data field.

Note that enabling the breakpoint is achieved right

after the <END> is pressed.

If a breakpoint address has been specified,

pressing the <Sbr> key will display current breakpoint

address thru ,Sbr-__~-~~-;· message <where x represents a

hexadecimal digit>. Four decimal points appear in the

data field. If changing the current breakpoint adress ~----- ·~--···-~·-·-·-·-

is desirable, upd<~te the address ~J- pressing the

hexadecimal key. It is desirable to have the location

specified by the breakpoint address contain the first '

byte of the instruction, or an undefined condition and

execution failure may occur. Always press the <END)

after entering the breakpoint address to exit, or

setting breakpoint will not be enabled.

Page 75: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

------ ~ ---- -~ -- - -- -- --------- - - -- ~-- --

66

~--::.~~-1.,. ") '7 l C:.:.+-tin-g hv.:.::.'··--···-'··.-; --· - . .::: . .:::-, -- ·,.\'_',~· • ...:, ~ .. -.. v ·l !:-' • ., .... .. , • '1....- ....... '"'" J. ,..,.. ... ..... '-" .... _ ...... J. l.l ·~ ... ~. ... ._i.. ._... ........ r e ~ ~J ... ..J I • -

relative to CS register.

0008@1@]~@]

0~BDGtJGEJ 8

00G00@J@[!J ~ .

~@80@J@!Q0 ~

00B0@J[!J@J@J · ~

0B~DDDDD ~

000tJ0000 Example 5.7.2 Changing the existing breakpoint address

to be 20. -

0008~@1~0

0!BBD0GJEJG B

Page 76: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

0B0DDDDD 5.8 Clear Breakpoint Address

The Clear Breakpoint <Crb) key is used to disable

current breakpoint address.

Syntax

<Crb)

Operation

The current breakpoint address can be eliminated

or disabled simpl_y by pressing the <Crb) key at any - -·-----·--·- .

time when 'PCP-8086' is displayed. Pressing this key

wlll prompt 'Crbr ' for two seconds, meaning that

the breakpoint address has been disabled. After that,

·the message 'PCP-8086' is shown for next command.

Example 5.8.1 Clear Breakpoint address.

000 EHill@lfm~ 0G~BDDDD

000EJ00000

67

Page 77: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

The Go CGo) Key ~asses control to the user's

program.

Syntax

<GO> [<address> J <END>

Operation

when the <Go) key is pressed, 'GO--xxxx' is

displayed. The contents of IP (instruction pointer)

and four decimal points are displayed in the data field

of the LEDs indicating that an alternate starting

address can be entered. Use the hexadecimal key to

enter new a~9X~~;;?.~ if desired. To begin program ------------

execution, simply press the <END> key. The control

will be passed to the user's program at the end of the

<END> key.

If a breakpoint address was previously specified,

the computer will stop execution at the breakpoint

address after pressing the <END> key.

the program execution, ,_· t . . 1 alsp,ays

Once it stops

the breakpoint

address for two seconds to let the user know where it

stops and transfers control back to the system

monitor.

Example 5.9.1 Executing a program starting at 30H.

68

Page 78: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

69

DDDDDDDD 5.10 Single Step Execution

The Single Step <STEP) key permits execution of

the program one instruction at a time.

Syntax

<STEP) [<address> l [ ( ~) J <END>

Operation

When the (STEP) key is pressed~ 'Stp-xxxx' ·is

displayed. The contents of IP are displayed in the

data field. User can select new starting address by

entering the hexadecimal address. The new address will

be responded in the data field. When ready, pressing

the ( , ) key will cause the computer ·to execute one --~,-~---~~~·~~---~,,

user,s instruction and display next instruction to be

executed. The (,) key can be pressed as many as the

user Ylants. The user can verify current condition

Page 79: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

resulting from the previous instruction just executed

by pressing the <END> key. Pressing the (END> key will

terminate the single step mode and allow the system

monitor to take over. To go back to the single step

mode using the current IP, press the (STEP> key and

then the (,) key •

Example 5.10.1 Single-stepping start at 30H

~0!BB0000

[J008@@J@[i]

[fH~0G~@0~

00080[gJ~[!J

000[]0000

0G~ODDDD

00[~f80§01il

70

Page 80: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

5.11. Move Blo~k of Data

The Hove <HV) is used to move a blc.:c!~ c:;: cede ol-

data within a segment or between two segments.

Syntax

<MV><start addr)(,)(end addr><.><dest addr><END)

<start addr> := [(REG><segment reg><:>J <hex>

<end addr> := <hex>

<dest addr> := [(REG><segment reg)(:)l <hex>

<segment reg> := { <CS> : <DS> : <ES> : <SS> }

Operation

Pressing the <MV> key will prompt •s--- .... •

waiting for the user to specify starting address of the

data block to be moved. Pressing the (,) key after

entering the starting address will prompt 'E--- .... ' to

let the user enter ending address of the data block to

be moved. Pressing the (,)key again ~ill prompt 'd--­

.... ' for destination address. Whenever the <END> key

is pressed, the data block specified by the starting

and ending addresses is moved to new portion of memory

specified by the destination address.

Moving data block is assumed to be within CS

segment. If. moving data block other than the default

CS segment is desired, the user has to specify which

segment to move the data block from and which segment

71

Page 81: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

72

move the data block to. C~ta bloc>: ce moved

within the same segment or to different segment. For

example, the data block can be moved from CS segment to

DS segment, from SS to DS, etc. By specifying the

desirable segment upon entering the starting address

and destination address will be an inter-segment Move.

If no segment is specified in the destination address,

the destination segment is assumed to be the same as

the segment that contains ihe data block.

The starting address has to be smaller than or

equal to the ending address. Otherwise, an 'Err ,

message is generated after pressing the second (,) key,

resulting in user's request is aborted. Moving block is

achieved on byte basis. The computer moves one byte at

a time from the starting address to the destination

address until the ending address is reached.

Example 5.11.1 Moving a block within CS segment

~GGBOODO I u1;sii

0888@1@@1~1 1.;·1 08ElGOOQO 0 0GBG0000 I M:;nl

Page 82: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

73

~GGBDODD [] 0GG8@J@l0~ I tss I 08000000 8

Example 5.11.2 Moving a block between two segments

I 0GBBODDD I M!;Sll

0tJBEl@l@l@l0 ls:Jd

0GBBDDDD GJ 0GBB00@~ 0 0tJGGCJQOD 0 GDDDDDDD . 1~1 ..

0~000000 I ~~I 0GGGOQQO []

0BGG~~@J~ j,tl

0G0DDDDD I~DI

75

Page 83: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

74

F' •• a-'"' 1.:.. r-: • l ·"'I ti - ,, I ti - - l- .1 - - , ' , , , ~ .",. JH t:-1 .._. .) ... i. • .J v U \1 ... o •:l. J.) 0': i'"- ~-,~ J. 7: r l ' ~-l ~- ~-i ~ ..:: 4 ,-,..:.. ·= ... --.... ~-" 11,:.. }": -. ~ - " • • "• _.., ... _ ._,,_ ,,._ •-'·. ~L~··-·l.i- •

othe1· than CS

0GGEJDODD ~

BDDDDDDO [;] q.

00nDGG00 lot;DS/

0GGGDDnD r:r f5lf][jf][g[@@]@J IJA~I

0UBGD.OCJD GJ 0GGGfD.l000 · fJ;l

0EIGUDDQQ 0 0GGE1@1@@0 I EPI

0G~DDODD 1~·~1

Page 84: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Chapter 6 System Monitor Design

This chapter describes the implementation cf

monitor program thru flowcharts. The system monitor is

written in ASM86. The monitor listing is included in

Appendix B. The program is divided into several

segments without specifying the absolute address of

each segment. It is because those segments can be

1 inked and eventually located into memory that

physically exists. Appendix C contains link and locate

map listings generated by LINK86 and LOC86.

6.1 Program Segmentation

The monitor program is divided into several

segments as follows:

i) CODE segment

ii) INT_SEG segment

iii) DATA_SEG segment

iv) DATA_RAM segment

v> STACK segment

vi) INT_PTR segment

advantage of dividing the program into

segments is relocatability. During final allocating

process, the segment can be relocated by calling LOC86 \

•t~ithout reassembling the programj<which takes about

75

@ •

Page 85: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

six minutes and uses lots of disk space just t_

campi le).

sections.

The segments are described in the following

6.1.1 CODE Segment

This segment contains 80% of computer capabalities

of handling commands. Eighty percent of the time

computer executes routines in this segment. Each

command has a corresponding routine to handle the

command. Big routines are listed below.

i) CLRBR clears breakpoint address.

ii) GETBRK gets the breakpoint address.

iii) EXAMMEMO examines and modifies bytes or words in

the memory.

iv) INBTWRD inputs bytes or words from an I/0 port.

v) OUTBW outputs bytes or words to an I/0 port.

vi) MVBLOCK moves a block of data within memory.

vii) EXAMREG examines and modifies system registers.

viii) STEPMODE performs single step function.

ix) GO passes control to user,s program.

Each subroutine above usually consists of several

other small routines in order accomplish certain tasks.

Those small routines are normally shared among the

bigger routines.

6.1.2 INT_SEG Segment

(l '

76

Page 86: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

77

may o~cur due to user request or some potential causes.

Routines in this segment are:

i> STEP handles single-step interrupt.

ii) SAVEREG saves all register upon interrupt.

lii) BRKPOINT handles breakpoint interrupt.

iv) NONMASK handles non-maskable interrupt, if any.

v) DOERROR handles overflow or divided-by-zero

interrupt.

6.1.3 DATA_SEG Segment

The DATA_SEG segment contains all data con~tant§ __ , r ·'-··----···-·~·--·---""-

tables, This segment is to

be located in system PROM by LOC86 locater. Normally

during program execution of the CPU, the segment is

pointed to by the DS segment register.

6.1.4 DATA_RAM Segment

This segment is to be located in RAM by the

locater. It contains temporary data, user data <user

registers, addressses), display buffer for LEOs, etc.

6.1.5 STACK Segment

The STACK segment is allocated for system stack.

It is also to be located in RAM. Each location is

undefined.

Page 87: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

6. i.6 INT_PTR Segment

It is allocated fer stori~g interrupt vectors upon

system reset. Each interrupt vector points to the

interrupt handling routine which is in PROM.

There are small dummy segments which have defined

nothing within the segments. These segments are

USRCODE, USRSTACK, and USRDATA. They are initialized

an absolute starting address by LOC86.

6.2 Scan Keypad and Display Routine

One of the most important routines which allows

the computer to accept user,s commands and display the

system messages is SCAN_OISP. Most of the time the

computer executes

display whatever

simultaneously.

this routine to scan

is in display buffer on

Refer to Fig. 6.2,

keypad and

eight LEOs

the routine

displays the

one at

LEOs,

t i ine •

message by activating one 7-segment LED

After displaying all eight 7-segment

it starts scanning the keypad. Whenever a key

is pressed, SCAN_OISP stops scanning and returns key

number to caller. There is debouncing handling every

time a key is pressed.

78

Page 88: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~-- -------- ·-- ~ - ~--

79

Flg. 6.2 SCAN_DISP Flowchart

Page 89: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

6.3 Initialization Routine

The initialization routine is -.:.:-1e .::i:-~1: LJu'tinc:

executed upon cold start or warm start. It lr~itiali::e~

I/0 control registers, interrupt table, system -- n -:­c .. l...

user's registers, and calls SCAN_DISP to display 'PCF-

8086' and scan the keypad. The flowchart is shown 1~

Fig. 6.3.

Fig. 6.3 Initialization Flowchart

80

Page 90: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

81

6.4 Com~and Ro~:ines_ tn ~ODE Segment

Larger routin2s in COJE segment handle commands

request by the user as follows.

6.4.1 EXAMMEMO routine

The EXAMMEMO handles examining bytes or words in

the memory. Its flowchart is shown in Fig. 6.4.1.

Fig. 6.4. 1 EXAMMEMO Flowchart

Page 91: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

(l •

82

Fig. 6.4.1 EXAMMEMO Flowchart <Cant)

Page 92: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

(l '

83

6.~. 1 E~~MREG Routine

This routine handles examining and modifying

r~gi.sters as shown in Fig. 6.5.1.

Fig. 6.5.1 EXAMREG Flowchart

Page 93: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

84

Fig. 6.5.1 EXAMREG Flowchart CCont)

Page 94: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

85

ih i:: 1·outine handles reading a or ~'lord fro;n

an I/0 port.

Fig. 6.6.1 INBTWRD Flowchart

Page 95: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

86

6.7 OUTBW Routine

This routine handles sending a byte or word to an

I/0 port .:;.b.own in Fig. 6.7.1.

Fig. 6.7.1 OUTBW Flowchart

Page 96: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

87

6.8 MVBLCCK Routine

This routine takes care of moving a block of data

shown in Fig. 6.8.1.

Fig. 6.8.1 MVBLOCK Flowchart

Page 97: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

88

6.9 STEPMODE Routine

This routine handles single step command as shown

in Fig. 6.9.1.

Fig. 6.9.1 STEPMODE Flowchart

Page 98: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

89

6.10 GO Routine

The GO routine to the

program as indicated in Fig. 6. 10.1

Fig. 6.10.1 GO Flowchart

9 1

Page 99: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

C: [·i Ci_ r; ~~ ~ r· 7 D~sign Coc.::lu~i:::ln

The design cf the single board computer described

in this paper formed the basis upon which more

sophisticated systems can be designed. The 8086 and

8088 were first chips coming out as 16-bit

microprocessors. Currently there are advanced

versions of 8086 and 8088; 80186 and 80188 CPUs. The

latter two use the features of the 8086 and 8088 CPUs

plus two independent high-speed DMA channels, two

programmable timers, a programmable interrupt

controller, three programmable timers, and a clock

generator all resided in a single chip. Should the

80186 or 80188 is used instead of the 8086, there will

be minor changes. Since register set of the 80186, 188

is identical to that of the 8086 and 88, upgrading

the existing system can be done without·modifications,

especially in software. Programs written for the 8086

systems can be applied directly to the 80186 systems.

·The single board computer described in this

paper is a small, general purpose system. It is not

intended to be a sophisticated system because it would

be quite costly to build one. The cost of the CPU is

rather expensive when compared to other general 8-bit

90

Page 100: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

91

it does have the potential

inclujing several coprocessors by converting it into a

Maximum Mode configuration CMN/MX pin tied to ground).

In the paper', a Minimum Mode system was designed. Ir.

designing a sophisticated computer, many of the design

considerations and design features can apply to the new

systems. Note that programming in the 8086 assembly

language is different from programming for general 8-

bit microprocessors. A beginner of the 80S6

programming language may have to spend quite some time

to get used to segmentation concepts of the 8086.

However, once the hands-on experience is obtained, much

rewarding work can be done with this system.

Page 101: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

References

1) "iAPX 86, 88 User's Manual", Intel Corporation,

order number 210201, 1981.

2) "iAPX 86/88, 186/188 User's Manual, Programmer's

Reference", Intel Corporation, order number 210911,

1983.

3) "ASM86 Language Reference Manual", Intel

Corporation, order number 121703, 1983.

4) "Microsystem Components Handbook", Vol. I & II,

Intel Corporation, order number 230843, 1984.

5) "Memory Components Handbook", Intel Corporation,

order number 210830, 1984.

6) "8086/8087/8088 Macro Assembler Operating

Instructions for 8086-Based Development systems•, Intel

Corporation, order number 121628, 1982.

7) ·iAPX 86, 88 Family Utilities User's Guide", Intel

Corporation, order number 121616, 1982.

8) •Intellec Series-III Microcomputer Development

System Console Operating Instructions·, Intel

Corporation, order number 121609, 1981.

9) "ICE-86A/ICE-88A Microsystem In-Circuit Emulator

Operating Instructions for ISIS Users", Intel

Corporation, order number 162554, 1983.

92

Page 102: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Appendix A

Program Listing

93

Page 103: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

ciiJU6/UUUl/6'-•B!:J 1'1,\CRQ ,,S:.:Ot:.i·tDU:=.H MCrH roR LHHHH~ 06/01 /0~ P.-V.;

SERIES-III 808~/8087i8088 NACRO ASSEMBLER VI. I ASSE~IBLY OF 11/JDULF.: Ml•lNJ1UD\JLE OBJECT 11001JLC f'L'•CEO IN ; Fl: MDNI!. OBJ ASSE.I1DLER INVIJ~\ED BY: :F4:ASM86.86 :FI:110NII.SRC PRINT<:F1:110Nl.LST)

UJC llU.J

OOIJO 0081 0082 0033 OO:J4 OOflS 0086 0087 0080 0082 0084 00fl6

B9B9 0000 0000 0001 0002 0003 0004 0005 0006 000., 0000 000? OOOA 0000 oooc 0000 OOOE ooor-0010 OOll

l..HIE

>1 2 t-1 J >1 4 >I 5 +I 6 7 8 9

10 II 12 13 14 IS 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ::JI, 3.7 38 39 40 41 42 43 44 45 46 47 48 49 :;o 51 ~2

53 54 55 !>6

SOIIRCio

~<:RROHPill NT HITLEC~IONITDR LISTING) ~PAGEUO:NGTH ( 66) OXIlF.F I>I,.JDR!<.F l'LF.:fi(: F 1:, : FO: )

print erroT, if it occur~ print title oP th~ listing 66 lin~s per page

i gene1•ate cross reference at the Pnd

;******************************•******************•*************•**************

Gradui..tt.e Pl'oJeCt Design of 8086-ba~ed Single Do~rd Computer

biJ: Sirichai Ti\Jattanasulc

This modul• contains all routin•s ne~ded to operate the ~ingle board computer.

NANE MAIN_MODlJLE 1 module name

; ****************************************************************************** l EOU declaration

PA_LOW EGU BOll I low port A addre5s PA_HIGH EGU Bill I high port A address PD_LOW EGU 8::!11 I low port a address PO_HIGH EGU B311 I high port B addre~s PC_LOW EGU ::J4H I low port C addre!is PC HIGH ECIU BSH I high port C address CR=LOW EUU BbH I low control address CR_HIGH EOU B7H I high control address PA_WORD EGU PA LOW 1 port A word address PO_WORD EQlJ PD-LOW I port D word address PC_WOilD EGU PC-LOW I poPt C word •ddress CR_WORD EUU CR=LOW ; cor1trol word address

CONTRL EUU B?El9H I control word for 8~55's DLMIK EQU 0 I blank code SP•\REI EQU 0 I spare key REO EUU l i UI'G/Cbr k~y COLON EQU ~! I : k L'Y URI\EY EGU 3 i break point key co 2 ex EQlJ 4 i hex key/GO/CX sr:::3:=ox EGU 5 i hex key/ST/DX Ef!DKEY EGU 6 i HID koy ED_O._AX ECili 7 t.£ox kt>•Jii::.D/AX ER_t_nx EGlJ 8 I ht>ll key/ER/DX CDMt·tA El•lJ 'I I key PLUS EGlJ 10 i t- key MINUS EGlJ II i - kt:"~ SPARE2 EGli J ~! I ~.pare kelJ IU_4_SP EGU I:J t.L-x kcy/10/GP ao_s_np ElllJ J1 I1PX key/OD/DP MV 6 51 E.GlJ 15 hex Jc P.IJ/1'1V/SI EW-7-Dl l:OU IL, i t•E-X kt~lj/EW/D! rw:::a:::cs EUU u i he:c ketJ/HI/C:S

\0 .J::--

Page 104: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

80861801-)7 i 80dt) i'l.!\t;f~O ,!..33Ei'ii3Lt:R .~OrHTOR LIST!NG

LUC ue.J Lli•IE SOURCE

0()12 57 ot.J_9 _us EOU 0013 :;u A !JS EGU 0014 :)9 a::.Es EOU ooJ:; 60 C IP EOU 0016 61 o:::FL EGU 0017 6::! E EOU 00 Ill 63 F EOU 0000 64 ENADLE EQU OOFF 65 NMATCH EGU 0000 66 FIRST E"OU 0001 67 BVT EGU 0001 69 ERROR EGU

69 +I $~JECT

IU I? 20 :':!J ;~2

23 24 0 OH'H 0 • I • I '

h~x k~y/DW!l!> he~ ktoy/GS ht:o:c lrcy/E'~ IIL-:C k L•y/ IP hex kc.•y/fL hli'l k t'tj

he:c kciJ 'rn~hle' bt·ca~point fla~

'not match' fL1q • f i 1'!.>. t ~ key flag 'reudiny byte dat~· fl~~ el'l'OT'

•J>tOl/C5 P/IG 2

\.0 Vl

Page 105: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8•.)8~/0087/80!:19 ri1-\0..:RO ,~SSEMDLER MONITOR LIBTING 06/01/05 P1\C

UiC llllJ LINE sourh:t=:

70 71 i ~···•***~•••********~*********~~*-~***************•*•••*****•****

0000 liD 0001 30 0002 ?D 0003 DA 0004 36 0005 liE 0006 AF 0007 38 0008 DF 0009 DE OOOA 3F 00011 f\7 OOOC DD 0000 03 OOOE DF OOOF OF 0010 FF

oo11 oo· 0012 00 0013 00 0014 00 0015 02 0016 03 0017 00 0018 00 0019 01 001A 00 0010 00 001C 00 001D 00 001E 04 001F 05 0020 OI.J 0021 07 0022 00 0023 09 0024 OA oo25 on 0026 oc 002., 00 00~1EJ OE 0029 OF

7:,? 73 74 75 76 77 78 l'l DO Dl D2 D3 84 85 D6 87 DB 09 90 91 92 93 94 95 96 97 98 99

100 101 102 103 !04 105 106 107 108 109 110 Ill 112 113 114 115 116 117 118 119 l20 121 !22 !23 LH 125 126 t.~tl l;;:fJ !29 l::JO

D,\ rA._SEt: · :;ECi'II·NT

DATA_~LC is a· segmt.'nt ca11tainir•g all constants, codes, and tables. This s~qment is alloc~te~ in ~~stvm lfUHs.

;--------------------------------------------------------------------------A table to convert a he~adecimal number into a code for 7-segment displ~~

CNVRT DD OOl>li i ·o• DD 030lt i '1' DO O'iicH i '2' DO Ollt\li i '3' DO 0361i i '4' DO OAHI I '5' DB 0111'11 i '6' DD 0301! i '7' DO ODHI I •a• DD OB~H I '9' DD OJFII I 'A' DO OA'/11 I 'b. DB OBDH I ·c· DB 0031! I • d. Do OOfH I 'F.' DD OO~H i 'F' DD OFFH

A table to convert • ke~pad numb~r into hexadecimal number corre•ponding to the keypad number. The keyp~d number is used ~G an jndex to acc~ss the cont~nt of hexad~cimal number.

KEYjiEXTt\D DB 0 j not used DD 0 DB 0 DB 0 DB 2 i for ~e~ numb&r ~ 4 DD 3 i for ke~ number ~ 5 DD 0 i not use-d DD 0 I

.. DD I i for ke~ number = 8 DB 0 I not usid DD 0 DO 0 DB 0 DB 4 i for ke~ number = 13 Dll :; ' for key numb~r = 14 DB 6 i fnr ke~ number = lS DB '} i for k~~ numb~r = 16 DB 8 I For key number= 17 DB 9 I For ke~ number = 13 DD 10 i For ke~ number = 19 DD Jl i for ke~ numbtir ~ 20 on 12 For ke~ number = ~1 DO 13 Fur ke~ numb~r = ~2 DB 14 i For key number = 23 DD 15 for ke~ number = 24

:J

\0 0\

Page 106: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

80.9bi00EJ7 / ar:,·~~J 11,\t:P.O ;,.:Y."E•·IOLEP. •'0tl! TOR Ll ~lT I NG 06/0 I /05 P1\r.

LtlC llUJ LINE SOtJRCE

131 j---------------------------------------------------------------------------!J2 ; A l1st of 7-segm~nt displa~ codes used to display on e14ht 7-seqment LEU'~. IU

002;\ O:J l:J•l 1111l:SO . 00 0311. '/ lJlJI' (Jfl.I\NIO '1•

oo;m '7 00 ,

0032 DF l'J5 El!ll DD f::1FH, 2 rJUPC03H). ~~ DUP(DL,\I'nU ; 'E·rJ· 003:.J (.::::!

o:J , 0035 (5

()(J , OO:JA C4 136 DECPOJNT OD 4 IJUP ( ~Dill• 4 DUP ( DLANK l

~0 . , 003E C4

00 , 00•12 (4 137 A POINT DO 4 UUP!ULANKl, 4 UU1'!40Hl

00 , 0041. (4

~0 , 004A SF 138 END~IESG DB 8FH,23H,OD3H.5 DUPCDLANKl 'End 0049 ;!3 004C U3 004D ( 5

00 )

0052 AE 139 STARHISG DB OAEH,3 DUPC2l.4 UUPC40Hl '5---.. 0053 (3

02 )

0051. (4 40 )

005A OF 140 ENt\ORNSG DD 8FH,3 DUP!21,4 DUP!401ll 'E---.. 0050 <:3

02 )

005E (4 40 )

001.2 03 141 DSADR~ISG DB OB3H.3 DUP!2l.4 DUI'C40Hl 'd---....• 0063 (3

o:~ )

OObf., (4 ~0 )

OOI>A AF 142 G~IESG DD OAFH, ODDH, 2 DUP i 2 l, 4 DUP ( DL1\NK l; 'GO--0060 UD 006C C2

()2 )

006E <4 00 ,

•I

1.0 --.J

Page 107: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/8088 ii1\CRO ,;SSE£·1BLER

LOC UDJ

0072 A7 0073 03 0074 IF 0075 (5

(lQ

I 007A IF 0070 OD 007C IF 0070 00 007E IIF oo7F no 0080 OF 0081 AF 0082 AE 0083 87 0084 IF 0085 02 0086 14

00 )

OOBA 80 0080 03 ooac A7 0080 03 DOSE 14

00 )

0092 A7 0093 03 0094 IF 009:1 00 0096 14

009A

02 )

009A :JF 00?0 13

00 )

009E A7 009F I:J

00 )

00A2 BD 00A3 I:J

00 )

OOA6 03 00A7 13

00 I

OOAA AE OOAB IF

LINE

143

144

145

146

147

148 149 ISO lSI 152 153 154 155 156

1'S7

!58

159

lbO

I"!DfHTOR LltiTING 06/01/S~ Pt\C

50\JRCE

Ofii'IESG on OA/Il, :JH, IFII, S DUI' I DLANI-\1 1 'brP

SVMESG DO IFH, DDft, IFH, BLANK, OBFH, OIJOH. ODFH, OAFH1 'PCP 80D6'

STP~ISG DD 01\EH, 87H, lFH, 2H, 4 DUP ( DLI\NKI 1 'Stp-

CLRB DB SOH, :JH, OA7H, 3H, 4 DUP I BLANK l 1 'Crbr

BRDASH DB OA7H, 3H, 1FH, BLANK, 4 DUP121 1 'brp ----•

i REGFIELD containl 7-segment code1 fo~ diiplAying designated register ; letters on the •ddress field.

i Begin of REGFIELD

EVEN REGFIELD LABEL BY"IE AX CODE DB 3FII, 3 IJUP IDLANK I 'A

BXCODE DB OA71i,3 DUPIBLANKI I 'b

CXCODE DO BOlt, 3 DUPIDLt\NI\l ; 'C:

DXCODE DB 00311. 3 DUI' < BLANI\1 'd

SPCODE DB OAEH, IFU,;> DUP<BLANKl i I ~11-J

!j

\D CXl

Page 108: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/8088 M1\CRO ASSE~I3LER

LOC OOJ LINE

OOAC 12 00 )

COAE A7 II> I 001\F IF OOilO 12

00 )

0002 1\E 1.:.2 OOB3 30 0004 12

0() )

0001> 03 11>3 0007 ::JO 0008 12

00 )

OOBA EID 11>4 COBB 1\E OOBC (2

00 )

OOBE 03 11>5 OOBF AE ooco 12

00 I

OOC2 12 1.:.1. AE )

OOC4 (2 00 I

OOC6 GF 11>7 OOC7 AE ooco (2

00 I

COCA 30 168 OOCB IF oocc (2

00 )

OOCE OF 169 OOCF US 0000 (2

00 I

170 I'll 17? 173

OOD2 04 174 0003 05 OOIH 07 000~ OEl 00l)~ 00 0007 OE OODO OF 000'1 10

l1CN!TGR LI~-;TING

SOURCE

DPCOOE DO OA'lll, IFII.;? DUPillLANI\l

S!CODE DB OAI!H, 3011, 2 DUP (BLANK l ;

DICODE DB OD:Jil, :JQii, 2 DUP lliLANK l J

CSCODE DB BDH,DAEH.2 DUPIDLANKl J

DSCODE DO OB3H,OAEH,2 DUPIDLANKI i

SGCODE DB 2 DUP(OAEHl,2 DUPIBLANKl J

ESCODE DB BFH, 01\EH, 2 CUP I BLANK l I

IPCODE DB 30H, IFH,;:! DUPIBLANI\1 I

FLCDDE DO OF! I, 0~11. 2 DUPIBL.ANI\1 J

End of REGF!ELO

CODEIIEX DB 4, 5, 7, B, 13, 14, 15, II>, 17, IB, 19,

'bP

'SI

'dl

•cs

'd5

'SS

'ES

'IP

'FL

06/01/85 PM) 1..

\0 \0

Page 109: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8036/80S7/8iJiJ,~ I'T/,CRO ;.., ~2Ei"l2LER IWNITDR Ll~H lNG 06/01/0~ Pt\!:

LOC UC,J

oon,\ 11 OOIJU 12 OOIJC tJ OO!ll) 14 CCJOJ-; J5 OODF 16 OCEO 1'1 OC!I:.i JS OOE2 J 1 OOF.3 12 OOE1 13 OOE~ 11

OOE6 4702 COEa 8905 OOEA 4102 OOEC lAOS OOEE 3004 OOFO 4C03 OOF2 4702 OOF4 0000 OOF6 4902 OOFB 4702 OOFA 4702 OOFC 4"702 OOFE 4702 0100 4007 OJO;'! FA07 0104 ?005 0106 0000 OJOB ·1007 OIOA FA07 OIOC 470;1 OJ OE 4702 0110 ·1702 0112 4702 0114 17(J2 0116 4102

L HIE SOIJRCE

I 1~

t:J&

Ill 170 17~

~

SEGIIEY

20, :!J' ~!2. ;.!3. 24

DO HI. S_C!:i, OW_9 __ DS, f\_S!;, B .. EH

180 A Job table containing the fi~st sta~ting addre~s o~ the JOb. Each 181 ; JOb perForms the routin~ being requested b~ the user thru keypad. 102 IBJ

184

185

186

187

lEIS

Hl9 1110 191

JOOTAOLE DJ.J

8.

8.

&

!.

ow

DJ.J

DATA._SEG END!l

NOJOD, CLIIDR, NOJOB, GETDRK, ; ketJ-=0· 1, 2, 3

GO, STEPNODE, NOJQD, EX•\NMEMQ, ; key=4, 5, 6, 7

EXt\NREG. NOJOD, NOJQD, NOJQD, k•y=IJ, 9, 10, II

NOJQB, INBTWRO,QUTBW.MVDLOCK. ; key,l2,J:l,J4,J~

EXAM~II:I'JO, INBTWRO, OUTBW. NOJDB 1 key=!~ I~ 18.!9

NOJOB, NOJCJB, NOJOD, NDJOB ; key=2Q. 21. 22, 23.

NOJOD ; kl:'tj-=~4

1~2 j ********.**********************************~*************************** 193 +I ~EJECT

.,

1-' 0 0

Page 110: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

1~(.)[161 f.fOCill 80!J!:1 I"'Jh( HU ,;r;)~:.E.M!~LI~R i1C/Nif1JH Ll~lT!NG V0/01/B:J PI~{)

LOC OD.J

0000 ( 12fl ????

0100

-.!--

0000 (100 ???? ,

ooc8

000()

LINE SUURCE

!94 '******»*~***************.********************************************** l% 196 19'7 19B

199 200 201

i A ~eqm~nt reserved for user's ~tnck USIWT1\CI< SE::(;;I"'[~NT

·O~J 120 DUf' (7')

USRTOP USRSTACK

LAillL ENDS

~101<0

202 ;**********************************«****************************•******* 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218

. 219 220 221 222 223 224 225 226 227 228 229

230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250

; A segment reserved far u~er~s code painted b~ uaer's CS L'SRCODE SEGN!;NT USRCODE END:l

i****************************************************•******************

; A 5egment reserv~d for user's d~ta pointed b~ user's DS USHDATA SEGMENT USRDATA ENDS

'***********************************************************************

; A segm~nt ~eserved fo~ u~er's ES USREXTRA SEGNENT USREXTRA ENDS

i:*****************************~****************************************

STACK

This is ~ s~stem stac• segment allocated for 100 words long. The stack is in the RAN ~hich is located within page ~

SEGMENT DW 100 DUP(?l ' allocate 100 locations lor stac~

STACK_ TOP STACK

LABEL END5

worlD ; name top of stack

;***********************************************************************

This segment is far interrupt pointer tables located at OH in RAM memor~. The interrupt table is initialized upon &~stem reset. Each entry in the table is a double word pointer containing the address of the procedure that is to serve interrupt of th~t type.

The higher-addressed word has the ba5e address of the segment containing the procedure. The lawer-add~essed word has the procedure's off~et f~om the beginning of the segment.

!NT •. PTfl

TYPE_.O

SEGrJ~NT

L1\B~L LlWORU; divided by zero intL•rrupt

0

1-' 0 1-'

Page 111: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

i3tJB.~/COB7 /80::8 'i'lrl( 1~0 t\S:3Ef•i~LE'R rlOrJITOR LISTING 06/01/05 p,,()

LIJC OEJ

0000 ???? ooo;! ???? 0001 OOG•l ???? 000.~ '!??? 0000 0008 ???? ooo,, 77?? oouc Oi'JOC ???? OOOE ???? 0010 0010 ???? 0012 ?'???

0000

0000 0000 ?? 0001 ?? 0002 ?? 0003 ?? 0004 0004 ?? 0005 ?? 0006 ?? 0007 ??

0008 '?? OOO<i ?'?

OOOt\ ?? 0000 ?? oooc ~,..,

OOO!l ?0 00010 OOOl:: ???? 00!0 ???? 0012 ???? 0014 ???·?

LINE SOIJRCE

251 252 253 25-t 25~

2S6 257 258 2!j'.f 260 26l 262 263 264 265 266 267

INTO_IlFF fNfO,_::ii.:.G TYPE._l INTI._UFF lNT1 GEG TYPE:=2 INT2 .• 0FF IrH::! ~=.;EG

TYI'E~-::1 1•rrJ_nFr­IN.r3 SEG TYPE:::4 INT4_0FF INH ..• SEG

J}~J

fJJ,.J I_,,DLL r.w ow LADEL. D~l OW LADLl. mJ DW L;,BEL D~J D~l

? •'t

VWORIJ; ~ingl~-stcp int~rrupt "t ? owonu; nor,-maskable interrupt (if an~)

':'

DWtiiUJ; b1·eak pCiint 1nterrupt ? ? HWOilU; DVt>rflo111 interrupt 'f ?

268 INT_PTI{ ENDS 269 270 271 i****************************************************••***********•***** 272 273 274 275 276 277 2713 279 280 281 282 283 284 285 286 287 2813 289 290 291 292 293 294 295 296 297 2913 299 300 301 302 303 304 305 306 307 3013 309 3l0 311

OATA_RAM segment is • s~stem data segment loc•ted in RAM. It is reserved for user registers, display buffer. and those whose value change& during run time.

DATA_f<Ai'l SEGNENT

displn~ buffer starts hero

DISBUFF LA DEL BYTE I starting address of displaij buffer

ADF IELD LABEL BYTE I ~ddre5s buffer starts here CODE! DB ? ' leftmost 7-segment code CODE2 DB ? I 2nd 7-segmQnt code CODE3 DB ? I 3rd 7-segment code COCE4 DB ? ' 4th 7-segment code DTFIELD LABEL BYTE ' data buffer starts here CODE5 DD ? I 5th 7-~egment code CODE6 DB ? I 6th 7-segment code CODE7 DD ? I 7th 7-segment code CODES DD ? ' rightmost 7-segment code

end of di~play buFf~r

SEGSTATS DD ? ; segmL"nt status RDSTATS DD ? ' read statu~

COUNT fJR 't KEY DB ? ; kP-tJpatJ numb~r IN5V DD ? s~ve us~r·~ byte in breakpoint

AGCONT is the area to store user~s registers.

EVEN RGCON"I LABEL ~101m AXlJSR mJ ? AX register cnntPnt DXUSR D>l -, ux CXUSR D~J ? ex DXIJSf1 [lt.J ? L>X

'7

~

0 N

Page 112: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/808::1 it1V::HJ A3~Ei·!DLC:R i'ION!TOH LISTING

LUC UCJ LINE SOURCE

OOUl ???? 312 SPUSR D\1 ? ' 00\0 ???? 313 BPUSR [>~I ? ' 00 ll\ -:•??? :Jt 4 SIUSR DH '/ 001C r:<·? JJS DIUGR D'l ,,

' oou: ???? 316 CSUSR mt ? 0020 ???? 317 OSUSR D~l ? j

0022 ???? 319 .SSUSR D'l ? i 002'1 ??':'? 319 ES\ISR D~l ? ' 00:?/J ???? 320 !PUSR D~l ? ' 002H ?'??? 321 FLUSR Dll ? ' 322

323 i Enrt of RGCONT 324 325 System register~ reserved ar~a 3~!6

oo:=!A 327 SY:JREG LABEL ~IOilD 0021\ ???? 329 AXSVS ow ? j

002C ???? 329 BXSYS ow ? j

002E ???? 330 cxsvs DW ? j

0030 ???? 331 DXSYS Dll ? ' 0032 ?'??? 332 SPSYS ow ? ' 0034 ???? 333 BPSVS ow 7 ' 0036 ??7? 334 SISVS ow ? j

0038 ???? 335 D!SVS DW ? j

OOJA ???? 336 cssvs DW ? j

003C ???? 337 OSSVS ow ? j

003!:: ???? 338 sssvs DW ? ; 0040 ???'? 339 ESSVS ow ? ' 0042 ???? 340 IPSVS ow ? ' 0044 ???? 341 FLSVS DW ? j

:J42 0040 ???? 343 AORHEX ow ? j

0018 344 DATfiEX LABEL WORD l 0048 .-r'? 345 LOWDAT DB ? 0049 ?? 346 H!GHDAT DD ?

347 348

0041\ ???? 349 START AD ow ? ; 004C ???'? 350 ENDADR DW ? ' 004E ???? 351 OESAOR ow ? ;

352 0050 ?? 353 BRFLAG DD ? ; 0051 ?? 354 INSTATUS DB ? ' 005;] ?? 355 OUTSTATUS OD ? ; 0053 ?? 356 ~IVSTATUS DD ? ' 0054 ???? 357 GOADT DW ? ' 0056 ???? 3S8 BRADT 011 ? ; 0038 ???? 359 RIND X m1 ? ' 0051\ ???? 360 STSEG ow ? ; 005C ???? 361 DSSEG OW ? 005E ???7 362 SCriADR Dll ? 0060 (20 :.J63 POWSTATG DO 20 DUP (7) ;

?'? )

0074 ?? 364 WRFLAG DD ? ' 365 366 DATA_11AN ENOS 367 369 +1 $EJEC I

06/0t/85 PI\C

SP llP GJ Dl cs llS ss EB IP FL

AX s~stem reni5ter content OX s~stem reQister content CX s~stem register content OX s~stem register content SP ~~stem register content DP s~stem register content SI svstem register content Dl system register content CS svstem register content DS svstem register content SS s~stem register content ES s~stem register content IP svstem register content FL s~stem flag content

addres• buffer in hex data bufFer in hex

starting address for (Move Block) end address for (H~ve Block) destination address for (Move Block)

breakpoint enable flag input itatus (reading port d~ta) output statu~ <sending port data) move status (f~r Nove Block routine) go addrc!ios break point address index pointer for updating the registe starting segment (in mavin?, a block) destination segment ( )

'""egment ad1lress power status

writ!.' fla.q

J(J

I-' 0 w

Page 113: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

31J'-16/0C·37 /80tjfJ ~lr\CRO ASSE/"IBLER

l.OC LlDJ

0000

0000 ES0400 0003 58 0004 58 0005 ~8 0006 09261600 OOOA 98----0000 3EOO OOOF 8026CEJOO OO!:J UE061EOO 0017 l101E2600 0010 40 oo1c "oocoo 001F 268607 0022 09!E4000 0026 El91E2600 OO;::!I\ na----oo;~o aEco 002F os----003;! 8E08 1)0'34 9AO 105----

R

R

R

R

LINE

369

425 4~6

427 429 429

•1

MONITOR LC,;TJNG 01>/01/B~ P"C

SOURCG:

INT_SE<J SEGtlloNT

ASSU~!E ,, OS: Dt,TA .. nAr

" SS:S

" ~GEN ' Enable macro code ~enerotion

7.•DEFINE<DELt\Y(TJMEH LllCt\L STY ( 7.' This i~ a dela~ ~outine declared as a MACRO X' Th~ dela~ gets a parameter to drtDrmine how lonq' X' the delay should be.

PUSII ex ~IIJV ex, Y.TINE

Y.STY: NOP NOP LOOP Y.STY POP CX

SNOGEN Disable macro code expansion in source code

; ********•***********••********** BRKPOINT PROC FAfl

;******************************•*

This is an interrupt routine of type 3 (breakpoint interrupt). This routine is called when th• interrupt ln~truction INlT is executed in the user's progr~m. INIT ~as previous!~ insert~d in the user's program in order to cre~te breakpoint interrupt such that the s~stem can take over at that point.

The routine saves ~11 u~er's regist•r~ and restore s~stem control.

BRENTRY: CALL POP POP POP ~IOV

MOV MOV LEA MOV NOV DEC NIJV XCHG MOV IIOV CIOV NOV ~IOV

I"'IOV C1\LL

SAVER!oG AX AX AX SPUGRt SP AX, 3Tt\CK SS.t\X SP, STt\CK TOP; ES,CS\JGH-DX. IPUSR JlX AL, IN~;v AL,f:S: CDXl DATI lEX, OX IPUSR,JJX 1\X, Jlt\'fA UAI"I ES, t\X ·-

AX. nt\TA_!"ii:C

save all user'5 registers discard user's IP discard u~er's CG discard U5er's Fla~s

s~ve user's SP in SPUSR

initialize system's stack segment restore sy~tem's stack pointer ES paints to user's program se~ment DX points to next instruction ~dJ'•st nx ~et the prestored op tode restor@ thi$ op tode save the breakpoint address ~dJU~t u~er's JP

in1tialll~ ES b~fore far callitlg

DS.t\X initi~I!zr.- D3 befor~ far calli119 FAH PTii EI'IDAOOR; di'3ol·3tl the breakpoint address

11

I-' 0 .p..

Page 114: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8liG6/G087/J30rJ8 f"t.V:RO ,.;:J=EMDLER

Ll1C OUJ

0039 E"AC70D --··-

003E

003E E87600 0041 53 0042 58 0043 sa 0044 89261600 0048 DB----004D BEDO 0040 BD263200 0051 DB----0054 BECO 0056 Al2600 0059 A35400 005C DB----005F DEDB 0061 EASC03----

0066

0066 EB4EOO 0069 :;a OOM 58 0068 :JB 006C 2689261600 0071 RB----0074 ElEDO 0076 368D26CEJOO oo7D na---­oo7E ElEDB 0080 DB----0083 ElECO 008!l BD1E3200 00139 BEOOOO oooc 890800 008F 01\07 0091 Fl.DO 00?3 2681304 00?6 43

R

R

R

R

R

R

R

R

LINE

430 '131 -1:12 4:l:J 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 ·186 487 488 489 490

MDri!TOR Ll~iTWG 01.101/B!l p,~o

SOlJR~t:

J~IP

ENDP FAH PTU INFINITE; Jump far to have normal st.-~te

DRI\POINr

. ···~*··~~~****~*****~**~***»•·~~ STI:P PROC FAll i ********~************•******•*••

The interrupt service routine of t~pe 1. Thi5 routine is called when CPU JUSt single-steps one instruction in the use~·s program. Since the single-stepped flag was pr~viousl~ set, CPU onl~ executes one instruction in the us•r's program and JUmps into this routine imm•diatel~. This routine basic•llv stor•s all UsRr's r•gist~rs and reinitialize some s~stem's sRgment registers before Jump (far) back to STEPHODE routine.

STEPENTRV:

STEP

ASSUME

"

CALL POP POP POP MOV MDV MDV MOV MDV MOV MOV 110V MOV MOV JMP

ENDP

DS: DATA_JiEO# ES: 01\TA._RAM

SAVI..Jlli:G AX AX AX SPUSRoSP AX, STACK SS.AX SP, 8/'STS AX.DATA RAN ES,I\X -AX. IPlJSR GOADT,AX AX, OATil SI,:Cl

save all user's registers disc~rd user's lP discard use~'s CS discard user's flags •~ve user's SP in SPUSR

initi~lize s~5tem stack segmeJ•t restore s~:~stem's GP

initialize ES before far JUmp

next •ddr~ss to be executed

DS. AX - ; initialize DS before far JUmp FAR PTR NOilMAL 1

JUmp far ta STEPMODE routine

i******************************~* DOERROR PROC FIIR ;********************************

An interrupt routine for t~pe 0 and 4 (divide b~ z~ro and overflow>. This is included in case there is an error cauaed b~ the user's program.

DOENTRV:

AGP3:

CALL POP POP POP MOV 110V 110V MOV MOV 110V MOV 110V LEA 110V MOV MOV NOT MDV INC

SAVEIIEG fiX IIX AX SPUSR,SP AX, STACK SS,I\X SP,STIICK rop AX, I)A Tl\_~it:r} DS,AX AX, UA fA_nAI1 ES,AX BX,EHR SI, I.JFF>JET DISDIJFF CX,II AL, CBX1 IlL ES:DVfE PTRCSIJ,fiL ~X

12

1-' 0 V1

Page 115: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/8088 Mf1CRO ASSEMBLER

LDC DBJ LINE

009"1 ~6 491 0073 E'2F5 492 009t\ nOFF 493 009C DDOOOO 494 009F B90SOO 495 OOf"D UODO 496 OOA4 2.!.8A27 497 OOA7 E780 498

499 OOU2 43 510 0083 E~ED 511 ODDS EDE3 512

513 514 515 516 517 518

OOD7 519 520 521 522 523 524 525

0000 526 0002 527 0004 528 0006 529 0000 530

531 532 533

0007 50 534 OODB IE 535 OOD9 88---- R 5:lb OODC BEDS 537 OOOE 58 538 OODF A:l2000 539 00Ci1 58 540 OOC3 AJOEOO 541 OOC6 55 542 OOC'l ODEC 543 OOC9 891EJOOO 544 OOCO 890E1200 545 0001 89161400 546 0005 89361A00 547 0009 893EJCOO 548 0000 OC062400 549 OOEI OC162200 550 OOE5 804604 551 OOEB A:l2600 552 ODED 8D4606 553 OOE"E #\31EOO 554 OOFI 804608 555 OOF4 #\32800 556 OOF7 50 557 OOFB 892E1800 558 OOFC C3 559

560 561

MONITOR LISTING Ob/01/05 PfiC

SOURCE

INC Sl LOOP A(;l•3

AGP1: NOV 1\L,OFHl t·IOV OX, DFf-~ET DISDUI"F MDV ex. s

AGP4: RCL AL, I MDV 1\H. ES: COX l ou·r PA,)JOHD, I\ X 7.0ELAV!30HJ INC OX LOOP AGJ•4 -J~IP AGI'J

DOERR OR ENOP

ASSUME DS: DATA_RAM.

" ES:NOTHING '**********~********************** SAVEREG PROC NEAR i******************************•••

I A routine to ~ave all user's registers except SP into u'er's regi~ters area. I This routine is t•lled right efter an interrupt occurs.

STCK_LAVOUTI STRUC ULO_DP ow ? I saved UP, base of ~tructure RETURN_AODR OW ? I T'eturn address IPRGTER ow ? ' ut.er's Jfl CSROTER OW ? ' user's CS FLRGTER ow ? ' us•r'a flags STCK_LAVUUTJ ENDS

PUSH AX I temporarilv save user's AX PUSH OS ' tempor~rily save us~r'• OS MOV AX, DATAJlAH MOV OS, AX I initi•lize system's DS POP AX I get u5er's DS from the stack NOV DSUSR.AX I ~ave user's DS in DSUOR POP AX I get user's AX from the stack MOV AXUSR.AX I save user's AX in AXUSR PUSH llP I tempor•ril~ save user's UP MOV BP,SP ' DP points to b~se of structure MOV BXUSR,BX I s~ve user's BX in BXUSR MOV CXUSR.CX ' save user's CX in CXUSR MOV oxusn.ox ' save user's DX in DXUSR MOV SIUSR.SI • save user's SI in SIUSR MDV OJUSR. OJ I save user's Dl in D1USR MDV ESUSR,ES • save user's ES in ESUSR NOV SSUSH.SS ' save user'~ SS in 5SUSR NOV AX, rDPl. II"RGTEil j get us.er's IP from the stack MOV IPliSfl, 1\X ' suve user's IP in IPUSR NOV AX, £DPJ.C5RGTER 1 get user's CS from the stack riDV CSUSR,I\X i save user's CS in CSUSR MDV AX, CDPJ.FLRGTER 1 get user's flags from the stack MDV FLUSH, AX save user's flugs in FL.USR PDP DP i"'OV BPUSR.llf' i save user·~ DP in OPUSR. RET

SAVEflEC ENDP

\3

........ 0 0'\

Page 116: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

107

.,.

~ 0..

'~ ~ • • ~ • • _, • 0 • .

• • • • • • . • • • . • : . . . • • • • • • • . • • • • • • • • • • • • • • • • • • • 01 •

<>• z. UIO . •

"' • ~ • • >- • ;] • ..J !

<>• a: Ul woo-

"' u "'*'-' .... a:: ! * IJ.i ::> !- • .., z 0 ZOUI 0 U1 ~ .... ;;::

a:: Ul l"ll ("] "1" Ul ~

_,.,,_,, ..J "'""" "' ...J E Ul lil lil <[

0 0:

~ >:

"' "' 0 ro .... ..... ro .., 0 "' "' 0 .... "' "' u 0 0 Ol .J

Page 117: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

S086/il087 /3088 IIACRO .~SSE~IlJLO:R f'!OfHTOR LISTING 06/01/85 PAC

LOC ODJ LINE SOURCE

565 i*************************************************•~····················

0000

0000 26AOOBOO 0004 :JCIO 0006 7408 0008 26C606090001 OOOE EB06 0010 26C6060900FE 0016 80063AOO OOIA 50 OOIB E8A80A ODIE E8CF09 0021 26AOOBOO 0025 3COI 0027 7503 0029 E9FCOO OO::lC 0411 002E 2688260800 0033 E8BIOA

0036 3CFF 0038 7503 003A E96601 0030 B500 003F E81A09 0042 E8AD09 0045 E89FOA 0048 :JCFF 004A 7407 004C B5FF 004E E80D09 0051 EDEF 005:3 26AOOUOO 0057 JC09 00~9 740:3 0050 E94501 005E 26A00000 0062 8D!EOOOO orJ.~6 ft90·hl0

566 567 568 569 570 571 512 573 574 575 576 577 :;-18 579 580 581 582 583 584 ::.as 586 587 538 589 590 591 592 5'13 594 595 5'16 5'17 598 599 600 601 602 60J 604 605 606 607 608 609 610 611 612 61J 614 615 616 617 618 619 620 621 622 b23 ~24

625

C(JDG. is the main se~ment locgted in tclJN whose starting addr~~s i$ to b• FCOOOH. The CODE contains all control programs, data, and subroutines to control the whole operation of this ccllnputer.

lr•form assembler of &egmant rRgi~ters by using ASSUME directive.

CODE ASSUl"'E

" & 1!.

SEGNffNT cs: cooc;:, OS: 0/\TA •. tiC:G, SS: STACI(., ES:DI\TA_IlAN

J*******************************'* EXANMENO PROC NI!Ail •********************•**********•*

A routine to handle examining and modif~ing words and bytes in th• mem01'1J.

EXWORD: CONTI:

SKIP4:

SKIP!:

LOOP12:

FOR•II:

SKIP2:

MOV CMP JE MOV JMP MDV LEA PUSH CALL CALL MOV CNP ..JNE JMP MOV NOV CALL

CMP ..JNE JMP MOV CALL CALL CALL C~IP JE MDV CALL JNP NOV CMI' JE ..J~IP

NOV LEA MDV

AL,KEY AL, 11~1_7_01 EXWOI<O RDSTATS,BYT SHORT CONTI RDSTATS,NOT BYT AX.DECPOINT AX LDMIO:SG SCAN_DISP AL. KEY AL,REG SK!P4 OISPLR AH, IW_8_CS SEGSTATS,AII KEYCHK

AL, NNATCfl SKIP! ERR I CH,FIR!lT UPADfJR SCAN._DIGP KEYCIIK AL, N~lt\TCii FOR•II CH, NOT Fl:l!JT UPADDtl L001'12 AL,Kf'Y AL, CON~IA 51-(IP2 EllRI AL,IIE'I BX,flllFI~LD

r.x.4

get •ey number Examine Word? if ljes. JUmp update read status

1 update read statu&

J loud ' ... . i display ' ... .

J is REG keiJ?

into buffer ' and Stjln

i ~ ges, Jump to DISPLR cs is ~elected by default save segment status check if it is a hex key?

J not a hexadecimal key? J hex key!, JUmp to SKIP1 ; jump to display 'Er1' ; it is first key ; update address buffer

display and scan keypad check if it is a hex key~ not a he:c kry? '

1 J\'mp if not a heox kcq no longer the first key update address

is a comma: key?

.1 if not, it is an erl'or

delete 4 decimal points in the address buffer b~

J:;

,_. 0 co

Page 118: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

808618087/80:.10 m•·:r.o ASSE~I[L£R ~ION!TtJR LlllTING

LDC llD.J LitlE SOlJRCF.

0069 £8760? 62~ CALL 006C 2681\2QOUOO 627 MDV 0071 OOfCII 628 Ci'IP 0074 7411 629 . ..IE 0076 OOFC12 630 C~IP 0079 7413 631 ..IE 0070 BOFC13 632 CNP 007E 741~ 633 .JE 0080 268DIE2400 634 MDV 0085 ED13 635 .JNP 0037 268B!E!EOO 636 CSBASED: MOV 008C EBOC 637 .JNP 008£ 268BlE2000 638 DSOASED: MDV 0093 FBOS 639 .JNP 0095 ::!6801£2200 640 SSDASEO: NOV 009A 8003 641 FOHW2: MDV 009C 268AOEO?OO 642 MDV OOAl £83808 643 NEXT20: CALL OOA4 E86503 644 CALL OOA7 0500 645 MDV OOA9 268AOE0900 646 NEXTl•l: MDV OOAE 80F90l 647 CMP 0001 7503 648 .JNE 0003 £83707 649 CALL 0086 £83709 650 NOULK: CALL 0009 E82DOA 651 CALL OOBC :lCFF .652 CMP OOBE 742A 653 .JE OOCO 26AI5EOO 654 MDV OOC4 50 655 PUSH OOC5 26Al4600 656 MOV OOC9 50 657 PUSH OOCA E80A01 656 CALL OOCD 26B03E740001 659 CMP 0003 7503 660 .JNE 0005 E9CBOO 661 .JMP 0008 268AOE0900 662 OKI~KI: MDV OODD E8FC07 663 CALL OOEO E8C208 664 CALL OOE3 E8C900 665 CALL 00£6 B5FF 666 MOV OOE8 EBBF 667 .JMP OOEA 26AOOBOO 668 PLUSCHK: MDV OOEE 3COA 669 CMP OOFO 7517 670 .JNE OOF2 2hA00900 671 MDV OOF6 3C01 672 CMP OOF8 7405 673 .JE OOFA 26FF064600 674 INC OOFF 26FF064600 675 BYTREAD: INC 0104 E81401 676 CALL 0107 EB98 677 .J~lP 0109 3COB 678 MINUSCHK: CNP 0100 7403 679 .;e 0100 £98900 680 ..IMP OliO 26A00900 681 SKIP 123: MDV 0114 3COI 682 CNP 0116 7405 683 .JE 0118 26FFOE4600 684 DEC 0110 26FFOE4600 685 BYTRREAO: DEC 0122 EAF600 686 CALL

DELPUINT ' AH,!lEGSTATS ' AH, HI_O ... Cri CSOA:Jt:::U ' AH.mi_?_D:1 DSDASED i

Atf, A~_S~ SSOAUEO i

BX.ESUGR I

StiORT FOil~l::! BX,CSUSR SHORT FOil~l2

BX,DSUSR SHORT FOil~l2

SX, SSUGR ox. ox I CL,RDSTATS ' GEniE~!

DTRANS I CH,FIRST I CL,RDSTATS CL,IJYT I

NODLK I DLKHIO I

SCAN_.DISP I KEVCHK AL,NtiATCH ' PLUSCIIK AX, SG~IADR AX AX,ADRHEX AX MEMCIIK I WRFLAG,ERROR I

OKKK1 ERR! CL,RDSTATS ' GETMEM ' UPDATAW WRDATA I CH, NOT F IllST ' NEXT14 AL,KEY AL,PLUS ' MINUSCHK AL,RDSTATS AL,DYT DVTilEAD ADRHEX ADRHEX ' UADilDUF ' NEXT20 I AL, NINUS ' SKIPJ23 ENDCIIK I AL,RDSTATS AL.IJYT BYTilREAD ADRHEX ADRHEX ' UADRDUF

tJ6/01/8:i Pt1G

calling 'Di:OLPOINT'. ~heck se9ment ~tatos

JUonpr if <;S

JUI>Ip, if OS

JUfUP• if ~s otherwise. ES

save temporaril~ tell GETMEM ~hat to read

translate routine this is the first ke~

check status no need to insert blank blank two 7-segment LED's di5pla~ current content

is hex ke~?

check me-moriJ error?

t•ll GETMEM what to read r•ad in data

~rite data into that address no longer the first Ice~

is + key?

increment offset updat~ address display burfer Jump to read data again is - keCJ?

JUmp to check an END key

decrement off!",et: uo~ate addres~ disDla~ buFf~r

16

I-' 0 \0

Page 119: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

80>36/8087 /8088 HI,CRO ,;SSEHBLER MON!TiJil L!:iTING

LDC DBJ LINE SOlJRC£

012~ E979FF .!.87 JrtP NEX"I20 01::!8 800o2AOO bBB DISPLR: LEA AX,Hi'll:.GO 012C 50 bB9 PUS~I AX 01::!0 EB9609 o90 CALL LDI'IE:::JG OIJO EBDDOB .!.91 ~jSEG: CALL. SCAN_DISP OI:JJ 26AOOUOO 692 MDV AL,IIFV DIJ7 3C11 o93 C~IP AL, UUl __ CS 0139 7421\ 1.94 JE PCS1 0130 3C12 .!.95 CNP AL, Ol!J_? __ DS 0131l 7433 1.90 JE POS1 013F JCI3 b97 CNP AL,A_SS 0141 743C o9B JE PSSI 0143 3Cl4 1.99 C~IP AL., D_ES 0145 7445 700 JE PES1 0147 3C02 701 CMP AL,CDLON 01·19 7558 702 JNE ERR I 0140 BOIE3AOO 703 LEA OX.DECPOINT 014F ::i3 704 PUSH ox 0150 EB7309 70~ CALL l.DMESG 0153 E89A08 701. CALL SCAN_DISP 015.!. E88E09 707 CALL KEVI:IIK 0159 3CFF 708 CNP AL.. N~li\TCH 0150 7441> 709 JE E"IIRI 0150 0500 710 MDV CH,FIRST 015F E"BFA07 711 CALL UP AU DR 0162 E9DOFE 712 JrtP l.ODI'l2 01.!.5 26A20800 713 PCSI: MDV SEOSTATS,AL 0169 D8DAOO 714 MDV AX,DFFSET CSCDDE Oli>C 50 715 PUSH AX 0160 E89207 7lb CALL LDREI: 0170 EDDE 717 JMP NSEI: 0172 26A20800 718 PDSl: MDV SEQSTATS.AL 0176 B8DEOO 719 MDV AX.DFFSET DSCDOE 0179 50 720 PUSii AX 017A E88507 721 CALL LOREG 0170 EDDl 722 JMP NSEQ 017F 26A20800 723 PSSI: MDV SEGSTATS.AL. 0183 DSC200 724 MDV AX,DFFSET SSCDOE 0181> 50 725 PUSH AX 0187 E87B07 726 CALL LOREQ 018A EDA4 727 JMP NSEG 018C 21>A20800 728 PES!: MDV SEGSTATS.Al. 0190 08C600 729 MDV AX,DFFSET ESCDOE 0193 50 730 PUSH AX 0194 E8oD07 731 CALL LDREG 0197 EB97 732 JHP NSEG 0199 :JCOI> 733 ENDCHK: CMP AL,ENDKEV 0190 7506 734 .JNE EARl 0190 B0064AOO 735 LEA AX, EMDriESG 01AI ED04 7:36 JMP SHDflT OUT! 01A3 BDOI>3200 737 ERfl1: LEA AX. ERR 01A"l ::iO 738 DUTl: PUSII AX 01AB E81D09 739 CALL LDHGSG OlAD E8F308 740 CALL DSHDRT OlAE C3 741 RET

742 EXANME~IO ENOP 743 744 i******~***~*******~•••«*******~*

OlAF 745 WRDATA PRDC NEAf< 746 ; ******•*******************••··~· 747

' ' ' • ' ' ' •

' '

' '

' j

• ' •

I

j

j

I

j

'

' • • I

I

Oo/OI!ll5 Pt&O

JUmp to read data again point to 'r

lodd message to buffer dilpla~ and ~cvn for ne•t ke~

cs keq?

ds key?

ss lce4J?

es lre1J?

: key? Jump to display 'Err

load .... ' into buffer displa~ .... ' 8c scan

the first key update the •ddresi JUmp to display •nd ICan s.ave- CS !ltatuti load content of CS

t•v• DS status load content of OS

IS.V• SS 5tatu& lo~d content of SS

save ES status lo~d content of ~S

is END ke1J? if not . it ts error-pojnt to 'End

point to 'Err

loud 'l::l'T"

di~play for • while

17

f-' f-' 0

Page 120: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087/8088 NACR!J 1\SSE~IDLER NOI·I!TOfl LinTWG 06/0 I /85 PAG

LOC ODJ

011\F IE DIDO 50 Ollll :l3 0102 26SEIE5EOO OIB7 268BIE4600 O!BC DOD! 01BE 263A060900 01C3 7408 OIC5 26AI4800 OIC9 8907 OICD ED06 O!CD 26A14800 0101 8807 0103 59 0104 58 0105 IF 0106 C3

0107

0000 0002 0004 0006

0107 55 OIOB OBF.C OIDA 50

.OIOB 53 OIDC 51 DIDO 52 OIOE 26C6067400FE OIE4 BAOOOO OIE7 D90400 OlEA BB5E06 OlEO OIE3 OIEF 0102

LINE SOURCE

748 ; A routine to write wh.:.tev11r is in •D1\THEX' into the address specified 749 ; by the segment address <which i!i in '!:3GHAUf(") .ind the offset of that 750 SeQment (which is in 'AIIflHEX~) 7:>1 752 7:;3 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 7B4 785 7B6 787 788 789 790 791 792 793 794 795 796 79'7 798 799 BOO 801 802 803 B04 805 806 807 BOB

R~gisters affected: none

PUSH OS PUSII AX PUSII DX MDV DS,SGMADR j OS points to the s•gment MDV BX,ADRHEX j BX has the offset MDV AL,DVT CMP AL,ROSTATS I check write status JE UBV"fE I if write • b~t~, JUmp MDV AX,IJfiTIIEX MDV CBXl, AX j write a word to th•t address JMP SHORT ONI

UBYTE: MDV AX, DAlHEX MDV [DXJ,AL I write • byte to that •ddress

ON!: POP BX POP AX POP 05 RET

WROATA ENOP

i******************•*****•******** MEMCHK PRDC NEAR ;*******************•*************

A routine to chec• ~h~ther the phvsical addr••• is ROH ar it ; does not exist. The segment and offset values are p•ssed thru J stack before calling this routine. In the routine, it geta tho5e

thru DP pointer.

J Register& affected: none

Calling sequence:

PARM1T DLODP RETURN_AO OFFST 5EGt1NT PAR ANT

AAOB:

STRUC ·DW 0~1

D~l ow ENDS

PUSII MDV PUSII PUSH PUSH PUSH MDV MDV MOV MDV SHL RCL

mov push

a1, (segment value) ax

mov ax, (offset v•lue) push ax call memchk

? ? ? ?

DP DP,SP AX BX ex ox WRFLAG,NOT ox. 0

ERil.OR i assume it is corre-ct

CX,JI OX, [BPl. SECNNTi OX, I OX, J

DX will contain s~gment value set counter to b~ 4 Ctimes) get se~ment value from stack lo~ical shift DX r~tat9 ~hru ca~r·• nx

10

1-' 1-' 1-'

Page 121: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/COBi /8068 MIICRD .;ssE,'IOLER

LOC ODJ

OIFI E2FA OIF3 8lHE04 OIF6 0309 OIF8 7301 OIFA ~2 OIFD 83FAOF OIFE 7508 0200 26C606740001 020b EBOO 0208 !!3FAOO 0208 75F3 0200 81FBFEOF 0211 7FEO 0213 ~A 0214 59 0215 58 0216 58 0217 50 0218 C20400

0218

0218 50 021C 53 0210 51 021E 52 021F 5b 0220 2bA14600 0224 DEOOOO 0227 8D1EOOOO 0228 8104 0220 D3CO 02::?F 8800 0231 240F 0233 07 0234 F600 0236 268804 0239 88C2 0238 46 023C 83FE04 023F 75EA 0241 5E 0242 !")A 0243 ~9 0244 59 0245 58 0246 C3

0247

LINE

809 810 811 812 8!3 Bl4 B!5 Bib Bl7 BIB Bl9 820 B21 822 823 B24 825 B26 B27 82B B29 B30 B31 B32 B33 834 B3:! B36 837 838 B39 B40 841 842 843 844 B45 B4b 847 B48 B49 B50 B51 852 853 B54 B55 85b 857 858 859 860 8bl 862 863 864 865 866 867 868 869

MONITOR LI!iTHIG

SOURCE

SKP70:

AA33:

CHKAGN;

ONE!:

ME~ICHK

LOOP MDV ADD JNC INC C~IP

JNE MDV JMP C~IP

J~IE CMP JG POP POP POP PDP POP RET ENOP

AABB CX, [DPl. OI"I:ST ox. ex 51\1''/0 llX OX,OI"H CHKAGN WRFLI\G,l'IIUOR SIIDRT ONE1 ox. 0 AA3:J BX, DFFiiH Al\33 llX ex ox AX DP 4

I********************************* UAORDUF PRDC NEAR J ••••*****************************

06/01/85 PIIG

repeat until 4 bits aTe done get off5et value from stack computer physical address

increment OX, if catT"IJ ftON'I r.•gment?

er1·or to write

possibl~ RMI? JUinp, iF not exist last word of RAN? Jump if tje5

disc~rd 2 parameter~

i A small routine to convert whatever is in 'ADRHEX' into ?-segment displa~ code in the addre1s displa~ buffer

J Reg i~ter~ afffected: none

TRNEXT:

UAORDUF

PUSH PUSH PUSH PUSH PUSH HOV HOV LEA MDV ROL MDV AND XLAT NOT MDV MDV INC CHP JNE POP POP PDP POP PDP RET ENDP

AX BX ex ox 51 AX,ADRtiEX SI,O BX,CNVRT 1 point to CNVRT table CL. 4 AX,CL OX, AX AL.OFfl CNVnT i trans.late into di~pla~;~ code AL ADFI~LD[SIJ,AL; move the code into addr buffer AX. OX SI 51.4 TRN~XT ; done Qll 4? SI ox ex BX I\ X

i*******************••••••*•****** NDJOD PROC N~Ail i**•••••*******~***************~··

\9

.......

....... N

Page 122: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

!l081>/S087 /8068 Nt\CP.O ASSENDLER

LOC OOJ LINE

870 871 872 :313

02'17 '10 8'74 02~8 C3 875

876 877 878 879

0249 880 881 882 883 884

0249 80062AOO 885 0240 50 886 024E E87508 887 0251 E89C07 888 0254 26AOODOO 889 0258 3C07 890 025A 7437 891 025C 3C08 892 025E 7439 893 0260 3C04 894 0262 7438 895 0264 ·:!COS 896 0266'i43D 897 0268 3COD 898 026A 743F 899 026C 3COE 900 026E 7441 901 0270 3COF 902 0272 7443 903 0274 3C10 904 0276 7445 905 0278 3C11 906 027A 7447 907 027C 3CI2 908 027E 7449 909 0280 3CI3 910 0282 7448 911 0294 3CI4 912 0286 7440 913 0288 3Cl!i 914 028A 744F 915 028C 3CI6 916 02810: 7451 917 0290 E9A600 918 0293 8D069AOO 919 0297 ED•1C 920 0299 BD069EOO 921 0290 E846 922 029F 8D06A200 923 02A3 E840 924 02A5 S006A600 925 02A9 EB3A 926 02AD BD06AAOO 927 02AF E'D34 928 0281 fJD06AEOO 929 02D5 ED?E' 930

i·IONI TOR L1 STING 06/01/85 PAC

SOURCE

' This is a dummy routine c•lled when nothing ne~ds to be dono I after the user h•s entered the keu.

NOP RET

NOJOD ENDP

; ****tO** .. **********••:t•••••••«·*lfiE-* EXAMREG PROC NEAll i*********************************

' A main routine to handle examining u~er's registRrs.

LEA AX.Il~IESG PUSH AX CALL· LDMESQ I load 'r ' to buffer CALL SCAN_DJSP I display it and scan for a •• MOV AL. KEY CMP AL, ED_O_AX I examine AX register? JE AXPilOC I if yes. JUmp CMP AL,ER_I_BX I examine nx register? .JE BXPROC I if ues. JUmp CMP AL,Q0_2_CX I examine CX register? .JE CXPROC I if IJIS• JUmp CMP AL.ST_3_DX I examine DX register? .JE DXPRilC I if IJBS• JUffi(' CMP AL, JD_4_SP l examine SP register? .JE SPPIIOC l i fl tJDS• JUmp CMP AL,08 5 BP I examine DP register? .JE BPPROC - I if ves. JUmp CMP AL, f"IV_6_0I ' examine SI register? .JE SJPROC i if ves, Jump CMP AL,EW_7_DI I eramine DI register? .JE DIPROC I if yes, JUmp CMP AL. xw_8_cs I examine CS register? JE CSPROC I if yes. JUmp CNP AL. OW_'1_DS I examine DS register? .JE DSPHOC I if IJ&SI JUmp C~IP AL. A_SS l ••amine SS register? .JE SSPROC I if ljl'-51 JUmp C~IP AL, D .. ES I examine ES register? .JE ESP ROC I i, IJ&S, JUmp C~IP AL. C_IP I Px~mine IP register? .JE IPPHOC I if tJB5• JUmp CMP AL, D_FL i examine P.lagt. .JE FLPIIOC ' if IJBS, JUmp .J~IP ERR71 I JUmp to display error

AXPROC: LEA AX,AXCODE ' AX points to AXCODE .J~IP SHDR T FOR ~13

8XPROC: LEA AX,DXCODE AX points to DXCODE J~IP SHORT FOIHJ3

CXPROC: LEA AX, CXCODE i AX points to CXCODE .JMP SHORT FOmJJ

DXPROC: LEA AX, DXCODE AX points to DXCODE .JHP SHORT FOR~I3

SPPROC: LEA AX,SPCODE AX points to SPCODE .JNP SHORT FCJn~I::J

8PPROC: LEA AX, DPCODE AX points to DPCODE JHP SHORT FOR~I3

20

f-' f-' w

Page 123: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087/8008 rJ,\CHO ,;S'OEMBLER 110tHTOR LISfiNtJ:

LOC OBJ LINE SDlJRCE

0297 El006D200 931 SIPROC: LEA AX.SICOD!! O~DD El328 932 JNP SHORT FOJI~I:J 0290 80069600 933 DIPROC: LEA AX,OICOPE 0:2C1 ED:;:!2 934 J~IP SHllR T F UU ~13 02C3 BD06DAOO 935 CSPROC:: LEA AX, CGCODE 02C7 EBIC 936 JtiP S~IORT FDII~13 02C9 0006DEOO 937 DSPROC: LEA AX.O:lCODE 02CD 1£916 938 J~IP SHORT FDJIH:J 02CF BD06C200 939 SSPROC: LEA AX.GSCODIZ 0203 E910 940 JNF SHORT FDIUI3 0205 BD06C600 941 ESP ROC: LEA AX.ESCOOE 0209 EBOA 942 JNF SHORT FOR~I3 02DB 9006CAOO 943 IPI'ROC: LEA AX. IPCODE 02DF E904 944 JNP SHORT FOR~I:l 02EI 8D06CEOO 945 FLPROC: LEA AX,FLCODE 02E5 8D1E9AOO 946 FOR~I:l: LEA DX.REGFIELD

code 02E9 2BC3 947 sua AX. OX 02EB BBFO 948 MDV SI,/IX 02ED B500 949 MDV CH, FIRST 02EF 801E9AOO 950 NEXT40; LEA BX,REGF!ELD 02F3 030E 951 ADD DX,SI 02F5 53 952 PUSH BX 02F6 F80906 953 CALL LORE!: 02F9 801E0400 954 LEA BX,DTFIELD 02FD .E8CC06 955 CALL ADDPOINT 0300 E8ED06 956 CALL SCAN_DISP 0303 E8El07 957 CALL 1\EVCIIK 0306 3CFF 958 CNP AL, N~IAICH 0308 740A 959 JE FORHD1 030A E89806 960 CALL UFDATAW 0300 EBEAOO 961 CALL UPDATREO 0310 B5FF 962 MDV CH,NOT FIRST 0312 EBDD 963 J~IP NEXHO 0314 26AOOBOO 964 FOR~JD1: MDV AL,I\EV 0318 3C09 965 C~IP AL, CO~INA 031A 7515 966 JNE DCHI\1 031C B500 91>7 MDV CB.FIIl!JT 03!E 83FE34 968 OIP 51. 13•4 0321 7007 969 JOE NXTr! 03:!3 83C604 970 ADD SI, 4 0326 8500 971 MOV CH,FIRST 0328 EBC5 972 JNP NEXHO 032A BEOOOO 973 NXI2: MDV SI. 0 0320 B500 974 MDV CH.FIRST O::l2F EBDE 975 .Ji'IP NEXT40 0331 26AOOBOO 976 DCHI\1: MDV AL,KI:V 0335 3C06 977 CNP AL,ENilKEV 0337 7407 978 JE OUT3 0339 80063200 979 ERR71; LEA AX, Elm 0330 EB0590 980 J~IP OUT2 0340 8D064AOO 981 0UT3: LEA AX.ENilNf=:lC 0344 :;o 982 0UT2: PUSH AX 0345 E87E07 983 CALL LDNL:.::SG

r 0348 E8:;607 984 CAL.L DSHCI<T 0340 C:l 985 RET

986 EXA~IREG ENDP 987 988 ;*********•*********~~************

034C 989 STEP NODE PROC NF.Ail

06/01/SS FAG

; AX points to SICOOE

1\X point5 to DlCODE

; AX points to CSCODE

; AX points to DSCOOE

,.\X paints to SSCODE

; AX points to ESCODE

; AX points to IPCODE

; AX pointo to FLCODE i BX points to the base of reg

I find offset of the code we w i save it in 51 i QDing to be the first key I ax points to registe~ code i BX points to selected code I pass the •ddress to subrouti I load register content to buf

i enable 4 decim•I points I displa~ content of register i is it a he~ key?

I if nat, JUmp I if ~:~es. update it I update the register

i check next register? i if not. Jump i first ke1:1

ex~mine all register?

; index points to the nelt cod I it is the first ke~

i index points to AXCODE

i is END Ice~?

i if yes. display 'End i or display 'Err

i load the message into displa

di~play for a ~hile

;.,J

or

ffe

f-1 f-1 .j::-.

Page 124: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

803.!./8087/8088 ~1•\C:11J AS3EMCLER MONITOR LISTING 06/01/85 PAC

LDC UO.J LINE SOURCE

990 i*****•**•~****•*****~****·~······

000~[]

034C 80068200 035o :;o 0351 1'87207 0354 :?6A12600 0358 26A35400 035C 26Al:l400 0360 26A34800 0::164 0500 031>6 E8A300 0369 E88406 036C EB7807 036F 3CFF 0371 740F 0373.E8::!F06 037 6 Z'6AI4800 037A 26A35400 037E BSFF 0::180 EBE7 0382 26AOOBOO 0386 3C09 0388 755A 038A 26AI5400 038E 26A32600 0392 2689263200 0397 2.!.8E162200 039C 2.!.80261600 03A1 26A12800 03A5 50 03A6 26A11EOO O:JAA 50 03AD 26A12600 O:JAF 50 0380 80EC 0302 ~6A10EOO 0306 ::?6BB1E1000 O::JDD 26BOOE1200 03CO 2.!.80161•\00 03C5 ::>.!.80361•\00 O:JCA ::?.!.8D3EICOO 03CF ::?68E1E2000 0304 268E0.!.2400 0309 814E040001 03DE 268B2EI800 031'3 CF 03E4 3C06 03E6 7506 03E8 8D064AOO O:JEC F004 0:1EE 80063200

9?1 992 993 994 995 996 997 998 999

1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 lOll 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 102b 1027 1028 1029 1030 1031 1032 1033 1034 1035 103.!. 1037 1038 1039 1040 10·U 1042 1043 1044 1045 104.!. 1047 1048 1049 1050

A routine to take c~re of gRtting thr staTting addreis fram the user in the single-5tepped mode. DasicaJl~. the user hos to enter the address of thP instruction to be single-stepped And pre~s th• comma ke~ to start singlv step that instruction. After the user presse& the comm• keq, th~ control is passed to the user's program b~ lk~T. Nota that the lingle·­stepped control flag h~s to be set before the control i~ P•~sed to the the user's program.

FLAG_IMACE

NORMAL I:

BACK I:

NEXST:

NEXSTI:

ERil29:

EGU

LEA PUSH CALL riOV MDV MDV MDV MDV CALL CALL CALL CMP .JE CALL MDV MDV MOV .JriP MDV CMP .JNE MDV MDV MDV MDV MDV MDV PUSH MDV PUSH MDV PUSH MDV MDV MDV MDV MDV MDV MDV riDV MDV OR MDV 111ET CtiP .JNE LEA .JriP LEA

WORD PTR [0P+4l

AX,STPNSC AX LOMI~~G

AX, IPUSR GOADT,AX AX.GOADT DATHEX,AX Cfi,FIRST DTRANS SCAN DISP KEVCtiK ALoNNATCH NEXST UPDATAW AX.UAlHf,.X COAUT,AX Cl~. NOT FIUST BACK I ALoKEV AL, COrlriA NEXSTl AX,COADT lPUOR,AX SPSVS.SP SS,SSUSR SP.SPUSR AX,FLU51l AX AX,CSUSR AX AX. IPUSR AX OP,SP AX.AXU!1R BX,OXUSR CX,CXUSR DX,DXU!3R 51, SIUSR DI,DlUSfl DS,DBUSH ES,ESUSR FLAG IMAGE,OlOOH BP.DPUSR

AL. I'>IDK!:V EJUC29 AX • ENOtiESC SriORl Bi(l Pf' AX,F.Rn

point to 'StP-

lo.:.d 'StP- into bufh•r

assume IP to be the go-addre&s

; load starting addr•ss into buf

' translate ~OAD"f into 7-code displa~ L &can ke~pad chuck ke~ pressed i1 it not a hex ke~?

JUmp. if not • hex ke~ 1 otherwise. update it 1 get th• ne~ starting address ; updiilte GOADT J no longer first

rep•at •gain get ke~pad number

J is it a comma ke1J? 1 if not a comma ketJ• JUmp i get the •tarting add~e51

save it into lPUSR save !t~!ttem'5 SP

1 load user'ti SG load user'& SP

push user's flags into stack

push user'~ CS into stack

push user'~ IP into stack

load user's AX load user's DX load user's ex load user's DX load user's !Jl luad user's 01 load user's DS load user's ES ~et TF fl•g (single-stepped) load user's UP pass control to user's program

point to 'End

ooint to 'Err

1-' 1-' VI

Page 125: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8066/G087/80>3>3 11f,CI10 ASSEMBLER

LOC OB.J

O~F2 50 O:JF3 ESOOOI> 03FI> E'SABOI> 03F9 C3

O:JFA

O:JFA 50 O:JFB :l3 O:JFC :?I>A14800 0400 21>8DIE~800 O•l05 21>89470E 0409 5B o4oA :;e 0400 C3

040C

040C 50 O'lOD ~J 040E 51 040F 52 0410 51> 0411 :?I>AI4800 0415 DEOOOO 0418 0104 041A D3GO 041C BODO 041E 240F O•l20 80 I EOOOO 0424 07

042:; OC40 0427 FI>OO 0429 26884404 0·120 13DC:2 O•l.2F '16 0430 133FE04 0433 75F..3 Otl:JS !:iE 0436 ~A

LINE

1051 1052 1053 1054 1055 1056 1057 105fl IO:W 1060 1061 10f.o2 101>3 1064 1065 101>6 1067 1068 101>9 1070 1071 1072 1073 1074 1075 1071> 1077 1078 1079 lOBO 1081 1082 1083 1084 1085 1081> 1087 1088 1089 1090 1091 1092 1093 1094 1095 1091> 1097 1098 1099 1100 1101

1102 1103 1104 1105 1101> 1107 1108 1109 1110

r~ONITOR I. 15TIIIG

SOURCE

SKIPP:

STEPriODE

PU£',H Cr\LL C•\LL RF.T ENDP

;•*~*****•••••••••••* UPD,, nu'G PROC

i •*~····~·*****•··~·~

AX LD~I!O::~G

DSHUI~l

06/0 I /05 PI>O

lodd 'Err ' into buff~r displaq fo1· a short time

A amall routine to update the content of the re9i~ter pointed by the index contained in RlNDX. The register content is to be equal to the content in DATHEX.

AX ox AX.DATHEX BX,RINDX ES:RGCDNTCOXJ,AX ox AX

J save registers

J get new content from 'DATtiEX' i get the indell from 'RINDX' 1 update that registeT

l restore registers

UPDATREG

PUSH PUSH MOV MDV MDV POP POP RET ENOP

;******************•**•***•*****~* DTRANS PROC NEAR ;+~*****************************~*

A routine to tran&late the content in 'DATI·IEX' which is in he•adecimal format into 7-segment format starting from 'DTFIELD'. This routine proc11ssa~ onl~ the data field of the displa~ buffer. CL is us~d to control the routine whether blanking two most significant digiti is re~uired. Dlanking these two occurs onl~ when we need to displa~ data byte in the memorv called by Examine Byte routine.

Register affected: none

PUSH AX i save registers PUSH ox PUSH ex PUSH ox PUSH 51 MDV AX, OATIIEX i get data to be translated MDV SI,O initialize the inclex

RWORO: MDV CL.4 i set rotate counter RDL AX.CL i rotate 4 bits MDV DX.AX i temporarilq save it in DX AND AL.OHl i maFtk 4 bits LEA BX. CNVf<T i DX points to the tronslate tab XLAT CNVUT j translate the code into 7-segm

de OR AL,OIOOOOOOO i turn on the decimal point NOT AL ' l's complement it MOV DTF!ELDCSIJ, AI. i store 7-seg code in data buffe MDV AX. DX i Testore previ~us AX INC 51 j incrp1nent countvr Ci'IP 51.4 has it done 4 times? JNE RWDIHl i JU•nP if not POP SI restore registers POP OX

.~3

co

1-' 1--' ~

Page 126: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

80136/8087 /80<1:3 rt .. \·.:r<o .;ssEo'lBLER

LOC ODJ

0437 59 01:::!8 !j0 O·l:J9' ::,e 04:)1\ C3

0130

0430 8D066AOO 04JF 50 0440 E8B306 0443 ::?61\12600 O·l47 26A35400 044D 26o\34800 044F E8DAFF 0'1~2 ES9DOS 04~5 E'BSF06 0458 3CFF 045A 750A 045C 26803EOD0006 0462 74:23 0464 EB:H 0466 9500 0468 E83A05 0468 26A14800 046F 26A35400 0473 E87A05 0476 BSFF 0478 E86C06 0470 3CFF 0470 75E9 047F 26803EOD0006 0485 7503 0487 ESOCOO 0413A 80063200 04BE ~~0 O·l8F E83406 0492 E80C06 0495 C3

0496

LINE

Ill! 1112 1113 1114 1115 1116 1117 1118 1119 11~0

1121 1122 1123 1124 1125 11:26 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171

nGNITOR LIST!i11<:i

SOIJRCE

DTIMNH

POP POP PDP RE'f ENDP

ex DX AX

;•••••••************«*•~·······~·· <;O PROC NEAll j **************~*******~***•••••••

06/01/85 PAQ

A main routine to handler GO •ey. When the user presses this key. it menns that he w•nts to start executing his program on the comput~r. Thi~ routine gets the sta~ting •ddress of th• ~ir1t instruction to be executed from the us~r. Then it pa~ses control to the user's progr~m. Oefore it p~sses the control

GETG01: GETGD2:

USCONTR: ERR19:

NOTHIN: GO

LEA PUSH CALL MOV MOV MOV CALL CALL CALL CMP .JNE CMP .JE .JNP MDV CALL MOV MOV CALL MOV CALL CMP .JNE CMP .JNE CALL LEA PUSH CALL CALL RET ENDP

AX, G~IESG AX LDME:SG AX, IPUGR GOADT,AX DATHEX.AX DTRANS SCAN_Dl5P KEVCHK AL,NNATCH GETGOl KEV,EI-iDKEV USCDNTR SHORT ERR19 CH,FIRST UPDATAW AX,OATHEX GOI\OT,AX SCAN_DH>P CH.NOT FIRST KEVCIIK AL. NHATCH GETG02 KEY,ENIJKEY ERR I? EXECUTE AX, EiiR AX LDMGDG DSHORT

'*****~**••*******··~·····~*······ EXECUTE PROC NEAR i**•*****************,********•·~·

save ~11 s~stem regist~r~

point to 'QO--

load 'GO-·-

save the starting address save in DATHEX to be converte translate DATHEX into 7-code

chec• hell ke~ is it not a hell ke~? if it is, Jump io it an END key? if 'JBS, run Ulil'r 's progra1n if nat. it is. error first key updatir get upd~ted address save it in GOADT displ~y & scan no longer first ke~ call hell keq chec~ routine is jt not a hex ke~? if ges, Jump

i~ ges, ellecute executa user~5 progr~m point to 'Err

load 'ErT' display for short

ch~ck it there is & breakpoint. IF ~es. save that instruction and in~ert ~ bTeakpoint intruction

lo~d ~11 user's TeQi~tPl·s

~~·l

I-' f-l -.._J

Page 127: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

0086/GO,jl /8088 ; It,·.:: ill] .;5SE11BLER

UIC f!UJ LINE

1172 1113 1174

0196 ~6Al5400 1175 049A i:!6A32h00 1176 049~ ~6803E500000 1177 04A4 7515 1178 O•lt\6 ~'680 I E5600 11'79 O•lAD 06 1180 04AC 268E061EOO 1181 04BI DOCC 1182

IIB:J 04D:J 268607 1184 0406 07 1185 040:7 26A20COO 1186 040D 268E162:wo 1187 04CO ~68B261600 1188 04C 5 <~6A 12800 1189 04C9 ~0 1190 04CA ::06A11EOO 1191 04CE 50 1192 04CF 26AI2600 1193 0403 50 1194 0404 26AIOEOO 1195 0408 26891E1000 1196 0400 ::068DOE1:200 1197 04E2 ~680161400 1198 04E7 268B361AOO 1199 04EC 26803E1COO 1200 O~F1 268EIE2000 1201 04F6 268D2E1800 1202 O~FD 268E062400 1203 0500 CF 1204

1205 1206 1207 1208 1209

0~01 1210 1211 1212 1213 1214

0501 BD064AOO 1215 O~',o:; :iO 1216 o:;o6 Esnoos 1217 0509 E800FF 1218 050C 8D1E0400 1219 0510 D90400 1220 0513 E8CC04 1221 0~16 E80805 1222 0519 CD 1223

1224 1225 1226 1227 1228

0511\ 1229 1230 1231 1232

ti<JNITDR LISTING 06/0118~ PI10

SOUilCE

st,art Cll(lcuting user's progrouu

NIJV AX, Gli•\IH ; ~et user's starting offset NOV lPlJSR,/\X ' and load into IPUOR CNP DRFLAG,ENADLE ' is breakpoint enabled? JNE RUNUSER ; if not, st.art to;cecuting NOV DX,Oilt\01 ; load breakpoint .address PUSH ES temporaril~ save s~st&m ES NOV ES.CDUSR j ES paints to user's ~egment NOV AL,OCCH j load AL with INT

' instruction op ~ode XCHG AL.ES: [I!Xl ; exchange ~ith user's code POP ES ; restore s~stem's ES NOV HISV,AI. ; put interrrupt op code

RUNUSER: NOV SS,SSUSR !Odd US&l''S SS NOV SP,SPUSR ' load user'• SP NOV AX,FLUSR PUSH AX ' pu5h user's flags into stack NOV AX,CSUBR PUSH AX ' push user's CS into stack MOV /IX, IPUSR PUSH AX j pu~h user's IP into stack MDV AX,AXUSR I load user's. AX NOV BX.DXUSR ' load U6er's BX NOV CX,CXUSR j load user•• ex NOV OX, DXUSR i load use-r•s DX NOV SI,SIU5R I load user's Sl NOV DI,DIUSR I lo,ad uset''l DI NOV DS,DSU5R j load user•s DS MOV BP,DPUSfj I lo,ad user's DP NOV ES,ESUSR ; load user's ES I RET ; pass control to user's p1"ogram

EXECUTE ENDP

'*********************************

;•*****************»************** ENDADDR PROC FAR i********************»***********~

; A routine to display the ending address

LEA AX, ENUNESG PUSH AX CALL LD~IE!JC CALL DTR1\NS LEA DX,DTFit:;LD NOV CX,4 CALL DELPOINT j delete decimal points CALL DSHURT ; di~pla~ f-or a while RET

ENDADDR ENDP ; ******************••··············

; ******* ""******************•*** 1:·~* GI:TDRK PROC N~Ail

;+••····························~· A routinp to get the bre~~ooint ~ddress fr~m t~~ ~~er

:!:i

f-' f-' (X)

Page 128: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

806<.!8037 /8088 MCRO ASSEi"IELER

LUC UDJ

051A 50 0510 51 051C 80067200 0520 50 0521 EBA205 0524 26803E5000FF 05.:?A 750A 052C 80069200 · 0530 50 0531 E89205 0534 EDOD 0536 26AI5600 053A 26A34800 053E E8COFE 0541 8500 0543 EBAA04 0546 EB9E05 0549 3CFF 0540 7400 0540 26C606500000 0553 EB4F04 0556 D5FF 0558 EBE9 055A 26AOODOO 055E 3C06 0560 7519 0562 BOFDOO 0565 740E 0567 26C606500000 0560 26A14800 0571 26A35600 0575 BD064AOO 0579 ED04 0570 00063200 057F ~0 0580 E04305 0583 E8!005 0506 59 0587 58 0508 C3

0501"1

LINE

1233 1234 1235 1236 1237 1238 1239 12-10 1241 1242 1243 1244 1245 1246 124'7 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1256 '1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1;?80 1281 1282 1.293 1294 1285 1286 1287 1208 1289 1290 1291 1292

~:ON !TO/? L [STIIJG 06/01105 P,\G

SOURCE

This routine is eith~r ralled dircctlv by the user or called b~ GU routin~. All this routin~ does is ~impl~ netting the breakpoint address from the U!:.er ~nd save it in OHADT for future use. U~FLAG cont~ins flag to enable or di~able bre~kpoint function ~hen GO routine i1 called. If this routine is called befor~ GO routine. it enables breakpoint f:unction automaticallv. In other t.~ard5, the user no longer ne•d to hit the breakpoint key to ~pecify that he ~ants program e~ecution to stup at the bre•kpoint address. In enabling ca~e. llllFLAC i!;. equal to ENADLE. Howev~r. if the user makes a s~ntactic error. it disables the breakpoint function right away.

Registers affected: UI, AL

XII:

X12: GOR:

EDCHKl:

Xl3:

ERRI2: BRDONE:

CETilRK

PUSH PUS/I LEA PUS/l CALL CNP JNE LEA PUSH CALL JNP MDV NOV CALL NOV CALL CALL C~IP

JE NOV CALL NOV J~IP ~IDV

CNP JNE CMP JE NOV NOV NOV LEA JNP LEA PUSH CALL CALL POP PDP RET ENDP

AX ex AX.DRMESG AX LDM[;:JG ORFL~G.NOT ENABLE XII AX,IJROASH AX LOM[;!lG SHORT Xl2 AX,DRADT DATHEX,AX OTRANS CH, FIRST 5CAN_Dl5P KEVCHK AL,NMATCH EDCIIK1 DRFLAG,ENAIILE UPDATAW CH,NOl FIRST GDR AL.KEV AL, E~IDI\EV ERR!::! CH,FIR!."i.T Xl3 DRFLAG,ENAllLE AX, D•\TIILX ORADT,AX AX,[;NJJrl[;!lC SHORT DrlDnNE AX, ERR AX LDf'1lZGG OSHORT ex AX

; ••••****~***********•**********r.* CLI!DR PROC NEA/'1 i***•···············~·************

suve registeT"s

point to 'brP

load 'brP

point to 'brp ----'

1 r1ad 'brp ----'

get br~akpoint addrw~s store in OATI·IEX translate it into 7-code Firat fceiJ displ•~ & •can tcevpad ch~ck if it is a hex not • hex key? JUmp, if not a hex keu it can b& enabl• now it is • hex ke\1, update next keu i$ no long•r first get next hex digit gti't key number is it an END ke~? if not. JUmp

enable breakpoint function ~et user~s breakpoint addr save breakpoint addres& point to 'End

point to 'Err

displa~ for short time restore registers

1293 A small routin~ to diGable th~ breakpoint c~p~b~\itij ~fter the mo~ent

:~6

1-' 1-' \.0

Page 129: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

!30ei,;>::.~87/8G88 f'IACr.:o AS·3E~IDLER

LOC OU.J

0589 ~6C60o5000FF 0~8F BD068AOO o59:J ~;o

0594 E8.',F05 0597 ES070S 059A C:J

0~90

0590 80065200 05?F 50 051\0 E8:::?.'30S 05A3 L'B4.;04 05A6 :?6A IIEOO OSAA ~6A3SAOO 05AE 26A00800 0502 3COI 0594 7425 0~06 EB:::?E05 0509 :JCFF 0508 7503 05DD E9F400 05CO 0500 05C2 £:8E003 05C5 26AI48QO 05C9 26A34AOO OSCD E82004 0500 E8140S 0503 3CFF oso:; ·1424 051)1 D5FF 0509 EBE7 0500 E81501 05DE 26891E5r',OQ 05E3 26803EOD0002 05E9 7403 OSED E9C600 OSEE 80065200 05F::! ~0 05F3 EB0004 05F6 EBF703 05F9 EBDD O~>FD ;~6AOOOOO OSFF 3C09 0601 7403 0603 E'lAEOO 0606 800I>5AOO 0/.,QA ~0 o;,on EBU804 06u!O u~oo 0610 E8DD03 01.13 F30104 Oblb 3Cf'F

LHIE

1294 1295 1296 1277 1298 1299 1300 1301 1302 1303 1304 1303 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1::131 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354

t10NITOR LIGTHJG

SOURCE

this routine i5 called.

He~1st~rs a~fected: AX

CLilBR

MDV DIIFLt\G, Nlll EN•\BL[, LEA AX, CLRU PUSH AX C•\U.. CALL llET ENOP

LDME~iG:

DfiHOkT

i******************«*••********•a* ~IVOLOCK PRDC NI0/\11 • •******••*•******••••************

GGSTAR·r:

DGSTART: LS'rART:

SECUASED:

GSTART:

CmiCHIU:

OENO:

LEA PUSH CALL CALL MOV MOV MDV CMP .JE CALL CNP .JNE .JMP ~IDV CALL MOV MDV CALL CALL C~IP .JE MDV .JNP CALL MOV CMP .JE .J~IP LEA PUSII CALL CALL .JtiP MDV CtiP .JE .JNP LEA PUSH

AX,STARTNSG AX LONESG SCAN_OISP AX,CSUGR 8TSEG.AX AL,KEY AL.REG SEGBASEO KEYCHK AL. N~IAlCH DGSTART EllR7 CH.F!RST UPDA'IAW AX, Dt\TIIEX STARTAO,AX SCAN OISP KEVCHK AL, NtiATCH CDNCIIKI Cli. NlJl F mST LSTART GTDASE STSEG,DX KEV,COLDN GSTART EllR7 AX, STARHISC AX LDMESG SCAN DISP GGsrA'RT 1\L,KCY AL, COI'Ii'IA DEND ERR7 AX, ENAOR~ISG AX

Ct\1-L LDt'll:.~.i<J

NOV CH.FIRST CALL SCAN OISP CALL KEVC~IK Ci•IP AL. Nl'll\TCII

06/01 /8~ PI1C

i point to '5---....

load '5---.... 1 displa~ and scan 1 get use~'& CS content 1 CS content to be default ; get key number

is it REG key? i~ ljftS• JUffiP,

J check if it i~ a hex a hex key? if yes, JUmp if not. it is error it is a first key

1 update data buffe~

save starting ~ddress displa~ starting •ddr

; check next kw~a~

J is it not • h•• keCJ? ; JUmp' i P not a hex key

otherwise, no longer firs repeat for next key

; gat b~se s•gment ~ddress save into •tarting segmen

1 point to 'S---....

, load •s---.... ; display it

get starting Addross

is a comma key'? ; JUmp, if yes

otherwise. it is error point to 'E---....

load 'E-~·-.... ' J now. it is the first key i display J call routine to check

is it not a h~x ke~?

Ol]

1-' N 0

Page 130: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

a~Jt3rJ/ 1 :~:·a7/80G8 ; l;\( no MSSEi1GLER

LOC OCJ LINE

Oblll 7~0::1 t:l55 061•\ 1;9'~700 J'"J:51.:. 061ll 1:88503 1J:i7 0620 ;»QAJ4800 1358 0624 26A34COO 1359 Ob~O EBCJ03 1::160 062Q D5FF 1361 062ll ES!1704 1362 0630 3C~F 1363 06::12 7402 1364 0634 EDE7 1365 0636 26A15AOO 1366 063A 26A35COO 1367

1368 1369

063E 26A14COO 1370 0642 268D1E4A00 1371 0647 :JDC3 1372 0649 7003 1373 0648 ED6790 1374 064E 261\00DOO 1375 0652 3C09 1376 0654 7416 1377 0656 ED5C90 1378 0659 £89700 1379 065C 26891E5COO 1380 0661 ~6803EOU0002 1381 066"] 7403 1382 0669 ED4990 1383 066C 80066200 1.384 0670 50 1385 0671 E85204 1386 0674 0500 1387 0676 E"S7703 1388 0679 E86B04 1389 067C 3CFF 1390 067E 750A 1391 0680 26803EOB0001 1392 0696 7401 1393 0688 EB::!A 1394 068A £81803 1395 0680 26AI4800 1396 0691 26A34EOO 1397 0695 E8580J 1398 0698 95Ft=' 1399 0691\ E8~A04 1400 0690 JCFF 1401 069F 7402 1402 06A1 ED!07 1403 06A3 26AOOBOO 1404 06A"/ 3C06 1405 06A9 7509 1406 ObAB E81200 1407 ObAE 80064AOO 1408 0602 ED04 1409 0604 80063200 1410 0608 !)0 1411 0609 E80A04 1412 06DC EBE203 1413 06UF C3 1414

1415

; \]tJI fUR L I ~i"f I iJG 06/01/0~ PIIG

SOI;ACI:

JNE LEND ' JUmp, if it is a hex kev JrtP ERR7 I other·wi se. it i 'i er1·ur

u:rto: CALL UPDATt\~1 j updating DATHEX NOV AX, lli\TIIFX NOV ENDI\Dfl,AX ' tJpdating the ending addr CALL SCAN_DI:JP MDV CH, NOT Fll<ST CALL KEY(;! II( CNP AL, NNATCii JE cmtCIIK2 ' Jump, if not a hex kev JMP LEND j otherwise, JUmp to LENIJ

CONCHK2: NOV AX,STSEQ ' get starting •egment NOV DSSEG,AX j and sot it b~ default

; determine if th• ending address is less than the starting •ddres5 NOV AX. ENDADii NOV BX.STARTAD CMP AXoBX ' is ending ~ddress greater JGE SKK:J I JUmp to SKK3, if ok JMP ERR7 I or. Jump to error mesaage

SKK3: NOV AL,KEV C~IP AL,CONNA ' is it a comma key? JE ODES J Jump ,,. ves JNP ERR?

SECBASED2: CALL GTBASE I get the segment •ddress MOV DSSEG,UX ; upd~te the ending segment CNP KEY, COLON j i& it a colon ke~? JE ODES JNP ERR?

DOES: LEA AX,DSADRN~G

PUSH AX CALL LDMI..!SG NOV CH,FIRST CALL SCAN_DIGP CALL KEVCHK CNP ALoNNATCH JNE LDES CNP KEY, REG JE SEGOASED2 JNP SHORT EflR7

LDES: CALL UPDATAW NOV AX• DATfiEX NOV DESt\DR, AX CALL SCAN _ _DI Sf' MDV C H. NOT F !fiST CALL KEVCiiK CHP AL. N~IATCH JE ECHKI .JNP LDES

ECHKI: MDV AL. K~V CNP AL, LNilKEV JNE ERR? CALL NOVE,O LEA AX, ENDf'IESC J~IP SHORT TT3

ERR7: LEA AX, !-Jill TT3: PUSH AX

Ct\LL LDNEfiQ CALL DSHCJRT RET

l'JVDLOCK EN Dr>

;~Q

f-' N ,_..

Page 131: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/ti<l87/i3008 [1:\CHC! 1\SSEf'IDLER MiJIJlTGR LJ!jf(ii/G 06/01/B:i PAG

LOC OCJ

OoC!l

0000;[] 0000;[]

06C0 50 OhC I 51 06C2 ~6 06C3 ~7 06C4 IE 06C5 26AI5AOO 06C9 llED8 06C3 26AI4COO 06CF 268BOE4AOO 0604 23CI 0606 40 0607 BllC8 0609 2683364•100 060E ;:!6833E4EOO 06E3 26AI5COO 06E7 06 06E8 BECO 06EA F3 06EB A4 06EC 07 06EO IF 06EE ~F 06EF 5E 06FO 59 06FI ~8

06F2 C3

06F3

06FJ 26AI5AOO 06F7 8BD8 06F9 80062AOO 06FI) ~0 06FE EBC503 0701 ESEC02 0704 26AOOBOO 0701l 3C II 070A 740E 070C 3CI2 0701! 7415 0710 3C13 0712 741C 0714 3C14 0716 7423

LINE

1416 1417 1418 IH'I 14:10 1421 1422 1423 1424

SOURCE

;**••*··~~*******4*•~*·~*******~·· r.IO'JED PRDC NEAll i *******t!--* .... ·*· ....... it ........... Mo«.•*

A 5m~ll routine to move a block of data accordin~ to the starting address an the ending addres~. lhe block of data (or code) is moved from the segment ~pecifieJ by STSEC to the segm~nt ~p~cified by DSBEG.

1425 SOURCE EGU DS:DYTE PTR CSIJ 1426 DEST EGU ES:IlYTE PTR COil 1427 1428 1429 1430 H31 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 l442 1443 1444 1445

1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1-175

PUSH AX PUSU ex PUSH SI PUSII DI PUSli OS NOV AXISTSEQ MOV DS,AX ~IOV AX, ENOAIJR MOV CX.STARTAD SUD AX.CX INC AX MOV CX,AX MDV SI,STARTAD MOV DI, DE.SAOR MDV AX,DSSEG PUSli ES NOV ES, AX REP NOVS DEST,SOUWCE

POP ES POP DS POP DI POP Sl POP ex POP AX RET

tlOVEB ENOP

i**********•***************•***••• GTDASE PROC NEAR i******************••··~·······~**

Reg U has the segm~nt address upon return

MOV AX, ST!:n~G MDV BX.AX LEA AX, Ri'IEBG PUSH AX Cl3o.LL LDtUo:lG

NSEG1: CALL SCAN DISP ~IOV AL.KEY CNP AL. n1_s_cs JE SHORT tiCS! CtlP AL. m.J_9_nn -JE SHORT Nt>Sl CtiP AL.A U~ JE SHORT N$!31 CtiP AL,D IZS -JE SHORT l'lr·nl

1 assuming starting segment .1 point to ,.,.

J ) 00:1d 1 1'

displ~~ segment content

J CS ba~ed? 1 yes. JUmp

OS baf>cd? yes, Jump SS ba~ed? 1Jes. JUmp ES bas~d? lfP.S. tump

~·9

1--' N N

Page 132: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

80%;1JOa7/8088 111.Cfl0 ASSEI·IBLER

LOC ClBJ

0718 EO:JO 07lt\ ;?680 lE u.:oo 071F f300£>0l,QO 0723 EDIF 0725 268DIE2000 072A ODOOBEOO 072E EOI4 0730 ::!6DD tE2;?0o 0735 BD06C200 0739 E009 0730 268D1E2400 0740 8D06C600 0744 :;o 074~ ~SOAOI

0748 EOB'l 074t\ C3

0740

0740 261\00000 074F 3COD 0751 7408 0753 26C6065IOOFE 0759 E006 0750 26C606510001 0761 8D063AOO 0765 50 0766 EB~D03 0769 E88402 076C E87803 076F 9500 0771 3CFF 0773 7503 0775 E04590 0778 E8E101 0778 E87202 077E 05FF 0780 E96403 0783 3CFF 0785 75F1 0787 26AOOOOO 0780 3C09 0780 75:!0 078F 801E0000 0793 090400 0796 E84902 0799 E82COO 079C 26803E5100FE 07Ml 7403 07A4 E84600 07A7 E84602 OlAA :?6AOOBOO 07AE 3C09

LII'IE

1476 1477 14.78 1479 1480 1481 1482 1483 1484 1485 1486 1487 14138 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 !50! 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 153S 1536

MON!TOfl L!SriNG

SOIJRCE

JMP SHOAT 01 MCf;t: MOV BX.CHUSR

LEA AX. cncom: JNP SfiURT TTl

MOS1: MOV BX,D9USR LEA AX,QSCOOE J~IP SHOAT TTl

MSGi: MOV BX.SSUSR LEA AX,SSCOllE JrfP SHORT TTl

MES1: MOV BX.ESUSR LEA AX.ESCODE

TTl: PUSII AX CALL LDREG JNP NSEGl

01: RET GTOASE ENDP

i •******«******······~············ INDTWRD PROC NEAR

; ***************••••···············

06/01/05 PI\G

DX hati CG s~~m~nt addre~~ point to CS's content

DX ha~ OS segment addres~ point to DS's content

ax ha~ s~ seQment addJ·ess point to SS 1 5 content

J OX h•s ES segment addr•s5 point to ES's content

A main routin• to get input data from an input part. Thia is ~:all•d right aft•r eith•r Input D~te or Input Word ••v i5 pressed bv the user. This means th•t the us&r w•nts to read in d•t• from •n input port to be !ipe&: 1 fied.

BTEI: FR~ID4:

NEXT22:

NEXT23:

cwn:

MOV CMP JE MOV JMP MOV LEA PUSH CALL CALL CALL MDV CMP JNE JMP CALL CALL MDV CALL CMP JNE MDV CMP JNE LEA MDV CALL CALL CMP JE CALL CALL MDV CMP

AL.KEV AL. IB 4 SP DTEI - -INSTATU5,NDT SliDRT FRWD4 INSTATUS,DVT AX,DECPOINT AX LD~IESG

SCAN DISP KEVCHK CH,FJRST AL, N~IATCii NEXT22 ERR2 UPADCR SCAN_DISP CH,NDT Flr!ST KEVCJiK AL.NNATCH NEXl22 AL,KEV AL.COMMA ERR2 BX,ADFIELO ex. 4 OELPOJNT INPUT JN5TATUS,NDT SHOAl Gill! BLKHID SCAN DISP AL.IIE'f AI_,'=Ot-11'11\

DVT

OVT

• il Input D~te? If yeo, JUmp to DTEI Input Word

1 Input D~Jte

point to ' ....

1 load ' .... J displa~ and scan next key 1 check if it is a hex keq .1 f1rst ke-y

is it a hex key?

' if not • hex ke~, Jump if ves. updat• addr•ss bu display and scan no longer first key check if it is a hex key

is it a comma key? 1 if not. it is error

' delete 4 decimal points if ves. get input data

blank out two 7-segm~nt L display input data

i<t ~nmma kP11?

::o

r

1-' N l.V

Page 133: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/8088 1 IACRO ASSEt1ULER

LOC OD,J

0780 74E7 0792 3C06 0794 7506 0786 80064AOO 07BA ED04 07BC 80063200 07CO 50 07C1 E80203 07C4 E8DA02 07C7 C3

07C8

07C8 2680164600 07CD 26A05100 0701 3C01 0703 7403 0705 ED 0706 ED03 0708 EC 0709 8400 0709 261•34800 07DF E82AFC 07E2 llDIE0400 07E6 £90400 07E9 E8F601 07EC C3

07ED

07ED 50 07EE BOFF 07FO 26A20400 07F4 26/•20500 07F8 58 07F'I C3

07FA

LINE

1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 15bl 1562 ,1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1~81 1582 15133 1584 1585 1SB6 1587 1'i88 1589 1590 1591 15?2 1593 1594 1595 D96 1597

MONITOR LISTING

SOUHCE

ERR2: SKIP?:

INBTWRD

JE CI1P -JNE LEA -JMP LEA PUSH CALL CALL RET ENDP

NEXT23 1\L,t:lllll!I,EY EUR2 AX, ENDI1ESG SHORT SK!P7 AX,ERII AX LDMESQ DSHORT

;*******************~»**********~* INPUT PROC NEAll ; *********************•·••*******• ...

oo.1o 1/El:i Pr.c

is END IHHJ?

lo.=:~d 'End mess.J~e

load 'Err me5isdge

; displa~ for a while

A routine to be cAlled b~ 'INBTWRD' to read either • bvte or a word from the input port specified bv 'ADRHEX' containing the input port •ddress r•ctuested b" the user. This routine inputs either • bvte or • word depending on INSTATUS. If INSTATUS is equal to BVT, it read& in • bvte. Otherwi5e, it reads in a word. It stores the data from the input port in DATHEX iilnd c•lls 'DTRANS' to trans.late dat,a in DATHEX into 7-segment format codes that •r• eventu•ll~ stored in the d•t• buff•r to be displa~ed bV 'SCAN_DISP '.

Registers •ffected: AX, BX, CX, DX

SKIP9:

SKIPIO:

INPUT

MDV MOV CMP JE IN ,Jt1P IN MOV MDV CALL LEA MOV CALL RET ENDP

DX,ADRHEX AL, INSTATUS AL,BVT SKIP9 AX, OX SHORT SKIPlO AL,DX AH,O DATHEX,AX DTRANS BX,DTFIELD cx.4 DELPOINT

;********************************* BLKTWO PROC NEAR i*******************•*************

BLKTI<Il

PUSH t11JV MDV

.MOV POP RET ENDIJ

AX AL,<JFFII CODE::i,AL CODEt..AL AX

;*******~**'•*******************~~· OUTDW PROC NEI\11 ; ~~·····~·~·********~*****•*****~~

1 get port •ddress ; get input status ; is Input Sijte? 1 if qes, JUnlp

a word

1 reild in • byte

1 update DATHEX i transldte it into 7-code ; disable 4 decimal points

in d~ta buffer

turn off the fifth /-s@~

turn off the eigth 7-sea

~H

1-' N +:--

Page 134: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

o-:.3.~. ~~:a?/Gtj€:3 :1.t,~::Hu _j, :>":JE::-mu:-:~

UIC DB,! L r~~:::::

1598 t :.9~1 1 ,!_.r_;.o 1~/)1

1602 160:..! 1 ~.-:>4

07f' A ~~Ut\OOilOO lt..•)'j 07FC: ~lCOE 1606 OGUO 740~:i 1607 0802 26C6065r!OOF'E 1608 080U [,~06 1609 080A 26C6G6520001 1610 0810 80063•\00 1611 Ol'll4 50 1612 031 ~ f,(ME02 1~1J 0818 EBD501 1614 0810 F.3C902 1615 OlliE D~OO 1616 0820 3CFF 1617 0822 7503 1618 0824 E99100 1619 0827 E83201 1620 082A E8C301 1621 OB::!D E80702 1622 0830 3CFF 1623 0832 7404 1624 0834 B~FF 1025 0836 EDEF 1626 0838 26AOOBOO 1627 083C 3C09 1628 083E 7103 1629 0840 EB7690 1630 0843 ~6A05200 1631 0847 3C01 1632 00•19 7406 1633 OO•ID BDIE0400 1634 OB•IF EB 17 1635 0851 8DIEOC.OO 1636 00~5 0102 163.7 08~7 02C9 1638 0859 26BA07 1639 085C 24[1F 1640 085E 268807 1641 0861 43 1642 086::! FEC9 1643 0064 "/SF3 164•1 0866 EllO::J 1645 0868 E.S6101 1646 0060 BDIEOOOO 1641 006F 090400 1648 0072 [06001 UA9 007!; 0500 16~0 0877 E87601 1651 007A E86A02 1652 0871) ::JCFF l653 Oli7F 741 :; 1654 0831 £8,21·J 1 1~1155 ODI3·l E-3iJ~FB 1656 0~)8i' D!:IFF 1657 ooe9 2~~~"·0::-~oo 16:,a

l'lGi'II fOR 1..1~;-rJ.i~\:; 06/01/0:i P/1C

satmcF.

A main rnutin~ to p~oc~~~ sendin~ thp d3t~ to the output port specified by the utier It ch~c~~ s~11t~~ J•ule on e~ch stit~c and di:>plays 'ET'r ~ ao:; net· ess<JriJ. lt procet!d5 b~ ch~c~in~ each ke~ pressed and get the output port address from the user.

i"IOV AL .• I\1·'1 yt.~t key nutnber Ci'IP AL.UU ~Dr is it Out.put UIJte? JE D'fE';.! ; if y P.S, JUmp to on,:• MCV OUTSTfiTUS.NOT DYl ; if not~ Output Word JMP SHORT BI\JP f:2 ' continut>

DTE2: i"IOV OUTSl 1\TUS, lfVT ; it is Output Byte SK1P12: LEA AX, DGCPOI NT point to me~sa~e

PUSH AX CALL LDI"I~SG I load .... CALL SCAN .. Dl!lP ' displalJ und scan CALL KEYCHK ; hex key chc.-clc MDV CH,FJRST first lc~y CNP AL, N~IATCII is a hex key JNE NEXl:Jl ' i 9 ijCS• continue J~IP ERR~ ' if not* it is er1•or

NEXT31; CALL UPADhll ' update address buf~er CALL SCAN.~OlSP I display and scan for nex CALL 1'-EYCHK ' check hex key CtiP AL.N111\TCII is a hex ke:-y? JE FOH~I:; ; if not, checJ1 next MDV CH. NOT FHIST I iF yes. continue !< JMP NEX131 ' JUmp to update addrcns

FDRW5; MDV AL.KEY CMP AL. CON~Ifl ; is it a comma key? JE FDRHD ; if lJes. JUmp J~IP ERR5 ' if not, it is error

FDRW8: MDV AL. OUT STATUS ; get status OIP AL. HYT ' is Output Byte? JE NEXT43 ' if yes. JUmp LEA DX.DTFIELD I enable 4 decimal points JNP SHORT FORIJIB I Jump to call ADDPOINT

NEXT43: LEA DX,DTFIELD+2 ' e11able 2"decimal points MDV CL, ~1 set counter for 2 times AOD CL.CL I clear zero flag

NEXT47: MDV AL. ES: [UXJ ; displav ~ lC ll ll X

AND AL.10111111D NOV ES: [DXJ. AL INC DX DEC CL JNE NEX"f47 J~IP SHORT FOil~!?

FORWIB: CALL ADOPOINT ; call ADDPO!NT FDRW9; LEA OX, ADFIElll

MDV ex. ·I CP,LJ_ DELl' OINT NOV CH, FIRST f i rs.t k L'Y

NEXT25: CALL SCAN ... Dlf.iP display anll S.C<;jn CALL KEVCIIK Ch l"C k h ['X koy OIP t\L. N~l1\'l C:J-1 is it a he~ k e~!? JE FIJHI,J[J if not. Jump CALL UPDA.II\W if 1,1 t'So update data CALL DTRANS tr~nslate into 7-cotle rJOV CH, Ntn FJU!il it is no longer first riOV AL mrrcnATIIS Qet Qutnut o:ot.:Oit:n<~.

=~2

I-' N I..J1

Page 135: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

.-1oa.'1/'JOa7t.Joee :--~.:,uto .\S..:it:::·m:~.:.~r ,",:;: 1 r roR L E; r IN·~ 06/0l/C:3 PIIC

L.OC llBJ

0:380 :JC01 0881: "/Sb!l 089! FiJ~J9FF

0894 fOEJ 0891> ::?6AOODOO 009A :JC09 0!39C 750C 0891: 80FOOO OOA1 HIS OlJA:J F81EOO 08A6 ~5FF OfJAS EBCO OEIAA :JC06 OEJAC 750A OOAE ESJ:JOO 0801 BDOMAOO OEID~ 1'00590 0808 8001>3200 oanc so OODD £0060::? OEICO E80E01 O::JC3 CJ

OOC•l

OflC4 26llD1MC:.OO OEJC9 26'\ 14BO<J OBCD 26BA1E5i:!OO 080~ 80FD01 0005 7403 0007 EF OBOE! 1'001 OBDA EE OBDO C3

OfJDC

Lli·l£

1JJ59 16.!.JO 1661 i .... 6;~ t.:.,6'3 16.<,4 1665 lbb6 166'7 t.:..!:aa 1669 1670 1671 !672 1673 1674 1:075 1676 11>77 1678 1:079 1680 lb81 1682 1:083 lb84 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 11.>95 1696 16'17 11>98 1699 1700 1701 1702 1703 1704 1705 1706 1707

SOURCE

Cl'IP t'\L.U'Il JNE i'IEX'I: 1 ~

C ... \LL DLKHIU Jo·IP NEXT~!:)

FCH;I.~: ~IOV AL,I\I·V CI'IP AL.C:tll'Ji•Jt\ JNE NEX'I:J:J CNP CH,FlnSl JE EHR5 CALL OUTPUT MDV CH. NOT Fli<ST JMP NEXT25

NEXT3J: OIP AL. ENOI\EV JNE ERfl5 CALL OUTf'UI LEA AX, END~IESC,: JNP DONE!

ERR5: LEA AX. Ellll DONE!: PUSH AX

CALL LD~I~:JG CALL DSHOIH RET

OUTD'J ENOP

i ****** *** **** ***** IHI * ***. •*****«•* OUTPUT PROC. NEAll

; *«******** .. *********•**** :t****IH!*

is output byte?

1 blank out 5th •lnf'l lll-h I.E cantimH•

1 ~et key numbt:!r is it a comma key~

if= not. ,1umv to NEX'133 is it stJll first ktry? if not. it is error otherwir.e, send dat<J out

continuo for next key is it an END key? if nut. it is error if yt:·r,, send data r.ut point to JEnd

point to ~Err

load the mes5sege display for a while

A small routine to be called b~ 'OUTDW' to send data to the output port addre~sed by ADRHEX. It sends either a byte or a word to the output port depending upon OUTSTATUS. If OUTSTATUS is equal to BYT. it !:>ends the lower byte oF DATHEX to the output port. Ut.heTwiSI'• it sends the whole content or UATHEX which is a word to the output port.

Registers affected: AX,DL,DX

OUTBVTE: DONE2: OUTPUT

NOV NOV NOV CNP JE OUT JNP OUT RET ENDP

OX.ADRHI:cX AX.UATHEX BL. OUTST ATUS DL,DYT OUTDYTE OX. AX SI!OflT DCJNE2 DX,AL

•*•*****~*~*********~»****•****~** GEHIEM PROC NEAll

get port address get data to be sent get output status is it Output Byte?

; if yes, JUmp whole word of DATH~Y.

lower byte of DATHEX

1708 ; *******~*~~*******************~~· 1709 1710 A routine to read the content of memory whose addr~ss is reque~ted by 1711 the u~er. It reads in either a byte of a word according to CL. 1712 OX contains u~er's segm~nt register previously specified by the user. 1713 This routine uses us~r's segmfrnt register as a paragraph number 1714 and ~dd the offset in 'AORHEX' to r~ad in the data th~ user ~~ants. 1715 The d •• ta is saved in 'DATHEX' right after the r~ading is dOI)e. 1716 17!7 CL is u~~d to decide whether reading a byte instead of reading a word !7!8 is to be done. Since this routin~ is called b~ either E~amime Word 1719 or E~.~min~ Dijte. CL i\ the o~lij ~~au to diPf~re~ti~te re~dinq a b4te

. .:3

f-1 N 0\

Page 136: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

6(18.~/,:.;t:·-3//GO,Jti ;[i·,•,.,.;,J A3SEi'IBL~H ,·JiJ~IITOR LI5TTUG 06/01/8~ P/H~

L.OC OB,J

once ~.o

0000 !j:J ann~ 51 OR!ll' IE OEJEO flEOB OEIE2 ~6391E5l:OO 08E7 ~68BlE4600 OBEC llOF901 OEIEF 7404 OBF1 8307 OGF3 EB04 OOF5 8A07 OBF7 0400 08F9 26AJ4800 OEIFD IF OBFF.: 59 CUFF 50

0'100 '"" 0?01 ( .J

070~

LINt;: SOIJRCE

1720 from reading a wo1·d. 1 7;?1

11:22 ro rei1d the content nf the memorlJ• f•ne of thP. Sll,4itP.m seqment re~isteors hus l723 to be u~~d. 'sincu all segment ~Pyisters are used by the systdm. we net·d 172•' to s~v• one of the segment r•yisters into thP st3ck and load in the user's 1725 segment register overriding the cvstem senment register. DS is selected 1726 in this routine to serve as user's seRment re~ister. lherefore 1727 D~ is pu~hed into th~ ~tack befure it is modifi~d to be the user's !728 s~gment. Once r1tadinq data i!:. dc..ne. OS i'"' immeatatel~:~ re!>tored by !729 popping it5 previous content out oP the stack. 1730 1731 lhgiste-rs afFected: non~ 1732 1l:JJ 17'H 1735 17J6 1737 17JB 17:19 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 175::1 1754 1755 1756 1757 1758 175'7 1760 171>1 1762 176::1 1764 1?.;.5 1:166 1767 171.8 176'~

1170 1771 1772 177:.1 1 i'74 1775 1776 1777 1778 1779

RDYTE:

DDIJE5:

GETNEH

PUSU PUSII PUSH PUSH MDV NOV MOV CNP -'E MOV Ji1P MDV MDV MDV POP POP PDP POP llET ENDP

AX DX ex DU os.ux SCMADfl,UX DX, AllRIIE.X CL,lJYT RDYTE AX. EDXJ SHORT DIJNE5 AL, EDXJ Ali,O DATHEX,AX OS ex ox AX

'******"***********~************** LDRE<l ?ROC NE1\Il '******~~·····~······~•*********~*

save sy~tem DS in st~ck. load user's segment in OS. save segment addre~s get offset from 'ADHHEX'. re~ding byte data?

J if tjes, JUmp to RDVTE. ' otherwise, read in a word.

s re.:Jd in a byte. put zeros in hjgh bqt•. update 'DATHEX '.

J restore SIJstem US.

A routine to load the content oF register into display buffer. No modification of any register is ~valiable in this routine. It is called before SCAN_DISP in order to di~pla~ what content in that re~ister. It accepts one paramPter in the stack. This parameter is the base address of the re~ister code to be di~pla~ in th~ address buffer. for ~xample, to displa~ 'CS ' in addres~ field we pu~h CSCOOE into the stack as follows:

t1nv AX, or-Fsr--r cncaDr£ PUSH AX

From the parameter pa~sed in the st~ck, it points to current content of register and ~ets the current content of the renister from RAM memaTy. The base address of the register content ~.tarts from 'RGCUN'f'. Obtaintng the register content, it converts internal 4 he~adPcimal numb~rs into code5 suitable For 7-se9ment displa~ Format. lt lo~ds foa•r display codes in~o data field buffer to be ready for display thru subs~quent c.:~ll or SCAN_DISP ruutine.

L'80 R~Qistc..·r~ atfectt:d: nn11C

: )'~

1--' N -.....!

Page 137: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

~·~0!3.:.1U(1 .;J7 ,- ?.0'38 : l.:"n:RO .'\·~;sE;·19LER

LLIC llB,J LINE

1701 0?0:1 55 1702 0903 ODI!C 17BJ O?O:i ~0 17lH 0906 53 1785 O'JOl 51 1786 0908 ~·6 17137 0?09 OO:lE04 178B O?OC U90400 1769 090F nEoooo 1790 0912 8A07 1791 0914 F6DO 1792 0916 ::!6B304 1793 0919 46 1794 091A 43 1795 091D E2F5 1796 0910 804604 1797 0920 BD1E9AOO 179B 0924 20C:J 1799 0926 DICB 1800 0928 8008 1801 092A 26A35800 1802 092E 26BD470E 1803 0932 26A34BOO IB04 0936 8D1EOOOO 1805 0?3A DEOOOO 1806 0930 0104 1807 09JF D3CO !BOB 0941 BODO 1B09 0943 240F IBID 0945 07 IBII 0946 F61JO 1812 0948 26884404 IBI3 094C OBC2 1814 094E 46 1815 094F 8JFE04 1816 0952 75E9 1817 0954 5E IBIS 0955 59 1619 0956 50 1820 0957 56 1821 0958 50 1822 0959 C:20200 1823

1824 1825 1826

095C 1827 1828 11329 lll30 1831 18::32 1833 1834 1835 1836 1837 1838 1639 1840 IB41

11CHTOR LI~~Tll·lG

SOIJRC£

PUSH nr ~•nv Of",SP PUS! I AX PU!;II DX PUSII ex PUSH 51 rtOV OX, LDP t·4l MIJV CX.4 i10V SJ,OFFSET DISDUFF

NEXT4: MOV AL,CDXJ NOT AL I NOV ES:DYTE PTR [Sll.ALI INC Sl INC DX LOOP NEXH MOV AX, IDP+4J LEA DX,REGFIELD suo AX.UX ROR AX. I MOV BX,AX MDV RINIJX,AX MOV AX.ES:RGCONTCDXJ MDV DATfiEX, AX LEA BX,CNVRT MDV SI, 0

NEXTS: MOV CL,4 ROL AX,CL MOV DX.AX AND AL.OFH XLAT CNVRT NOT AL MDV ES: DTFIELDCSI J, AI. tiOV AX.DX INC 51 CMP SI, 4 JNE NEXT5 POP 51 POP ex POP ox POP AX POP DP RET 2

LDREG END I'

i*•*******•••••*~****•*~********* UPADDR PROC '**************•*****••********~~

06/01/!J~ Pllll

save registers to be used.

get p~rameter from stack. g~t left four codes. SI points to 'DISDUFF'

l's complement for display. load it into address buff~r

point to nelt location

get param~ter agHin. BX points to base •ddress.

divide it by 2 BX now has index. save the index for later u~e g~t current register content. update data buffer. BX points to conversion table. SI ~s •n index. CL •~ a rotate count. rotate AX by 4 bits. save temporaril~ in DX. m~5k unwanted bits. convert into 7-seg code. 1'5 complement for display. load code into data buffer. restore for next loop.

has done four hex numbers? if not~ do next hex number. re5tore registers.

disc~rd the parameter

A routine to update address buffer (for left four LEU'~) which is in form of seven-segment cod~ and 'AURHEX' which is in hexadecimal format. lhi~ routi~e accepts a h~yp~d number stored in AL.

J Once called. it translates this •~~pad number into a hexadecimal number. Since this ke~pad number is th~ most updated input obtained from SCAN_,DISP. we nelid to insert its hexadecimal number into the right of the address buffer. lhe leftmost hex digit is di~carded. This routine i!i called before subsequent SCAN .. DlBP and is called riRht after a user has entered a ke~ for selecting wh~t address he wants.

A register CH is used to determin~ if initialized 'ADRHEX~ is required. lnitiali:inq 'ADRH~X' is needQd aPter the first ~e~ is entered bu user.

35

1-' N (X)

Page 138: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087/8088 l'i••C."O .~5SEo10LER MG~HTOn LlG"fJ.i·J~ C6;01l85 P:'iC

LOC OBJ

0?5C 50 Qt}50 ~3 095~ 51 0?5F 52 0960 801EI100 0?6·1 U7 0965 268BIE4600 096A 80FOOO 096D 7503 096F DBOOOO 0972 0104 0974 03E3 0'176 0AD8 0978 26El91E4600 097D 8BC3 097F BEOOOO 0982 0500 0984 B104 0986 D3CO 0988 BODO 098A 240F 098C 8DIEOOOO 0990 07 0991 OC40 0993 F6DO 0995 268804 0998 8BC2 0991\ 46 0990 83FE04 099E 75E4 09AO 5A 09AI 59 O?A2 50 09A3 58 09A4 C3

O?A5

LINE SOURCE

1842 It puts zeros into "AilRHEX' and puts zero code!:> in 4 led's address buffer. 1843 After t:hat, it inserts new hex number into ~AORH~X • and its r.orrl.'spondin" 1844 code into the right addrPss bu~F~1·. 10·115 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 181.2 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 11380 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 11396 1897 1898 18?9 1900 1901 1902

Four decimal points are mad• to be shown in the add~ess field.

ReQistcrs affected: SJ

NOZEROI:

NEXTIO:

UPADDR

PUS~ I PUBH PUSH PUSH LEA XLAT NOV C~IP .JNE MOV MDV SHL OR MDV NOV MOV NOV MOV ROL MOV AND LEA XLAT OR NOT NOV NOV INC CNP JNE FOP POP POP POP RET ENDP

AX llX ex OX BX, KcY.JIEXTAB KEY HCXTAU BX.AilRHEX CH, FIRST NOZEROI ox.o CL,4 BX.Cl BL. Al AORHEX, BX AX.BX SI, 0 CH,Q CL,4 AX,CL DX.I\X AL.OFH BX.CNVRT CNVRT AL,Q1000000U AL ADFIELOCSIJ,AL AX.UX SI Sl.4 NEXTIO ox ex DX AX

; ................... ****·•········· ........... . UPDATAW PROC NEAR i******•••••••••***•************•

; save registers

1 AL has a kevpad numb•r. ; fo\L has a hex number now. ~ ~et previous addre~s. 1 is this the first ke~?

J ~es. put zeros to initialize

1 shift 4 z~ros into OX ; updat• address fi~ld ; save it in 'ADRHEX' ; AX now h•s •ddress in hex

J do 4 hex numbersP ; CL as a rotat• count

move to least aigni~icant save in DX For next loop mask unwant•d bits points to conversion t~ble.

translate AL into 7-se~ code turn on decimal point

; 1~1 complement For display ; send it to •ddress buffer J restore AX for n~xt loop

J is it done? if' not, continue donee, •ddre'is field is chan!Jed

1 DATA FIELD LEFT UNCHANGED

A routine to update data buffer (for right four LED'5} which in form of seven-seym&nt codP. It also update~ 'DATIEX' which is in hexadecimal format. This routine accepts a kevpad number stored in AL. It trun5lates an~ ka~pad number into • hexadecimal number and inserts into the right of 'DATHEX'. The leftmost hexadecimal number is discarded. This routine is called right after a user has entered a ke~ for changing the mpmory content or the re9istrr rontent.

A register CH is also used to determine if initializing 'DAlHEX' i5 required. Initializing 'DATH~X' is done after the first ke~ i~ entered b•• th~ u'ier. tt puts zeoro5 h.to 'lJATHE.X' and zero codes ill data bu~~er.

:u,

1-' N \.0

Page 139: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/C:087/C:O£l8 r1.:1CPO r1SSEI10l~R

LOC UOJ

or1Afl !10 O?f\b ~·3 O?A.l 51 0'7A8 BOIEIIDO O?AC 07 09AO 260DIE4:JO() 0902 BOF[IQO 0'785 7503 0'787 880000 09BA 8104 09DC D:JE3 09BE 0A08 09CO 2b891E4800 09C5 E844FA 09C8 59 O?C9 58 09CA 58 O?CD eJ

09Ce

09CC 50 0'7CO 51 09CE 02e9 0900 DI04 0902 268A07 0905 24DF 0907 268807 09DA 43 090D FEC9 0900 75t=3 091)F 59 0'7EO 58 09EI eJ

09E2

LINE

1903 1'104 1905 190b 1907 1908 1909 1'710 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1931> 1937 1938 1939 1940 1941 1942 1943 1944 1943 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 19:;b 1957 19:;9 1959 1960 1961 190.2 1'10.3

i10tH TO!l Ll STING

SOURCE

Register affected: nc'1~e

NOZER02:

UPDATAW

f'!!SH PUSH PUSH LEA XLAT MOV CMP JNE MDV MOV SHL OR MOV CALL POP POP POP RET ENDP

AX DX ex BX. KEY liE X"! AD KEY ll~inAU ax. Ut\lHioX eH. Flf<ST NOZEolCI2 ux.o CL.4 DX,eL DL. AL DATHEX.DX DTRANS ex ox AX

···········~·······••************ ADOPO I NT PROC NEAll '*******•***********••····~······

06/01/85 PAC

save- rE:-giste1·~

1 point to conversion table t~an5late AL into a hex get pr~vious data is key the first? JUmp i~ not

J ~~s. put zeros to initialize CL as a shift count shift 4 zeros in DX

J insart this hex into the rigl1t ; 'ave updated data in 'DATH~X' J translate into 7-seg code

A small Toutine to enable 4 decimal paints in displa~ buffer. Once called, it gets the base address of display buffer from BX register and gets the number of n from CX. Then it reads in 4 codes and enable decimal points ~ithout changing the contents of codes.

R•gisters •Ffacted: UX

NDYTEIO:

ADDPOINT

PUSH PUSH ADD MDV MDV AND MDV INC DEC JNE POP PDP RET ENDP

AX ex CL.eL eL,4 AL, ES: [OXJ AL,l0111111U ES: [OXJ,AL OX CL NDYTEIO ex AX

'********•***********•****«****•* DELPDINT PROC NEAll i*******•*•«******·~~************

clear zero fli:ly set counter to be 4

; get 7-segment cod~ making bit 6 low put it back points to next loc•tion

has done 4 b~tes?

A small routine to disable n dPcimal points in display buffer. Once called, it gets the starting address of displ~y buPfcr frllm OX register and gets n from CX. Then it reads in n codes and disable decimal points without changinR the contents of codes.

T/

f-' (.;J 0

Page 140: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8·J86/D•J37 /31J88 nACRO ,.\SSEI'IBLER

LCJC liBJ LINE

1964 19Q5 1966 1967 1'160 !969

:·tC:iUTOR LISTING 06/0 I /05 P1\G

SOURCE

For e:~ample. to turn ofF 4 decimal points in address buffer. the callinQ sequence Lhould re~d:

lea b~.~dfi~ld mov call

CJC,.,

delpoiut

1970 Registers aFfected: OX.CX

0'iE2 ::iO 09E3 260>107 09E6 OC•\0 O?EB 268007 09ED 43 09EC E2:=s 09EE ~8 O'JEF C3

09FO

09FO ~0 09Fl 53 09F2 51 09F3 52 09F4 0200 09F6 F9 09F7 BOFF 09F9 DDOOOO O?FC B90900 09FF DODO OAOI 26BA27 OA04 E7!JO

OAOf' 43 0•\10 E2Eil OA12 D4f'F OA14 E7!JO

1971 1972 1973 1974 !975 1976 1'177 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1989 1989 1990 1991 1992 1993 1994 1995 1996 1997 1999 1999 2000 2001 2002 2003 2004 2005 2006 2007 2009 2009 2010 2011 2012 2013 2014 2015 ~016

2017 2018 2019 20::!0 2031 20::!2 2033 2034

N8YTE!1:

DELPOINT

PUSH MDV DR MDV INC LOOP POP RET ENDP

AX AL, I!:J: [DXJ AL, 0 JOOOOOC>D ES: CDXJ, AL JJX NDVTEII AX

; *********************"***•******* SCAN __ DISP PROC NEAfl

;•*****************~************~

g~t 7-segmPnt code turn off decimal point

' put it back points to next location has done n bytes?

A m•in routine to displav eight 7-segment displays on board. The routine loads code one •t a time starting ~rom 1 0lSDUFF'. In order to display a 7-segment diapl•v' one corresponding transistor is turned on b~ one law bit. It sends out word one at a time, with higher byte cont•ining 7-&egment code and lower b~te turning on • transistor corresponding to that code.

This routine also scans keyp~d right •fter displaying all 7-senment LED's. In the beginning of each scun, DL starts from zero and increments by itself per each keyp1d. Therefore, UL·acts like a keypad number generator. If a kev is press•d, DL loads its content into 'KEY' and this routine is returned to the caller. If none is pre5sed. it goes into displaying routine to Freshen up all 7-segment displays. This routine b~ itself is in infinite loop. The only moment to return control back to the caller is when a key is pressed by the user.

Registers affected: none

LOOP!:

NEXT!:

PUSH PUSH PUSH PUSH MDV CLC

AX ax ex DX DL.O

MDV AL,OFFH MDV BX,OFFSET DISBUFF MOV CX, 0 RCL Al., I MDV AH,ES:[BXJ OUT PA_~I!IIlD, AX ZDEL1\Y (;!3011 l INC OX LOOP NEXT! MDV AH, CI('FH OUT PA_LO~J. 1\X

save registers

DL as a key number clL·ar carr!J flag

BX points to display buFfer. ~ight 7-segment displays. shift carry into lsb bit. ~et code to be displayed. enable one transistor. let it on for a while. point to ne~t code

~et AH tu br. FFII tu1·n ofF ~11 LEO'G

:m

1-' w ......

Page 141: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087/8088 i'lt\CRO ASSE~IDLER MONITOR LISTING

LOC OBJ LINE SQIJRCE

2035 st~rt to scan keupad here 203b

OA!b 890400 2037 ~lOV CX.4 OAI'i U47F 2038 MOV AH, 0 lllllll B OAIB 9380 20:J9 VERTICAL: MDV BL. 100000000 OAID B700 2040 MDV DH,o OAIF BAC4 2041 MDV AL,Ait OA21 DOCO 2042 RDL AL, J OA23 OAEO 2043 ~IOV AH.AL OA25 E600 2044 OUT PA_Lml.t\L OA27 DOC:J 204~ HORIZON: RDL nL.l OA29 E484 2046 IN AL.PC_LUW OA2B 22C3 2047 AND AL,IJL OA20 7450 2048 JZ KEYPRESS OA2F FEC:! 2049 INC DL Ot\31 FF.C7 2050 INC DH OA33 80FF03 2051 CMP BH,:J OA:l6 7~EF 2052 JNE HORIZON OA:l8 E2EI 2053 LOOP VERTICAL OAJA 090500 2054 MDV ex. 5 OA3D B:J04 205:1 MDV DL• OOOOOIOOB OA:lF DOC:J 2056 U.12: ROL BL. I OA41 E484 2057 IN AL.PC_LDW OA43 22C3 2058 AND AL,BL OA45 74:18 2059 JZ KEYPRESS OA47 FFC2 2060 INC DL OA49 E2F4 2061 Loor• U12 OA40 090800 2062 MDV cx.e OA4E 0300 2063 MDV BL,O OASO 0780 2064 MDV DH. IOOOOOOOB OA52 DOC7 2065 Ull: ROL BH. 1 OA54 E584 2066 IN AX, PC_WORD OA56 23C3 2067 AND AX.IlX OA58 7406 2068 JZ PRES!H OASA FEC2 2069 INC DL OA5C E2F4 2070 LOOP Ull OA5E ED94 2071 JHP LOOP! OA60 2688160000 2072 PRESS!: MDV' KEY, DL

2073 hOELAVC :::!011) OA6E E504 2084 WAITl2: IN AX, PC -~lORD OA70 23C3 2085 AND AX, OX 0A72 74FA 2086 JZ 14Ail12

2087 'l.DELAYI20Hl OA7D EDID 2098 JHP SHORT EXITT

2099 OA7F 2688160000 2100 1\EYPRESS: 11DV KEY,L\L

2101 7.DELAY<20H) OABD E404 2112 WAIT!: IN AL, PC_LOW OASF 22C3 2113 AND AL• ~~-OA91 74f'A 2114 JZ WAIT I

2115 'l.!lELAY ( :~OH) OA9C ~A 2120 EX ITT: POP DX OA9D 59 2127 POP ex OA9E 50 2129 POP ox OA9F 58 2129 POP AX OAAO C:l 21::10 RET

2131 SCI\N._DISP ENDP 2132 21:33 2134 i****•*******•******~~·~***•*•*~*

OAAI 2135 DSHURT PROC NEA!!

' ' i i

' i j

' ' ' I j

' i ' ' j

j

'

I j

'

' j

' '

06/01/85 Pt\C-~

4 vP.rtic:al lint!o.:~

cuntrol hit in AH mar.kbit!i in DL ho·,~i zontal count lo~d activo line pattern update the pattern save the. pattern for next ln a vertical bit is low rotate mask bits read m~trix keypad chec• this key b~ ANDinu. if pressed, JUmp nut update ke~pad numb~r

increment horizontal col•nt horizontal lines are do11e? H not. chec:lc next

th~ rest of ke~s in Ul;~

update keypad number

mask low byte

no key pressed, display agai save this code debouncing dela9

remain in this loop until hi debouncing delay

save this code debouncing delav

remain in this loop until hi debouncing del~y

restore registers

~~f)

f-' w N

Page 142: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087 I 8Qtj8 j·lr\CP.U r\SSE,"IBLER MDrHTOR LISTING 06/01185 PI\C

LOC OBJ

OAAJ 093000 OAA4 DDOOOO OAA7 DO"lF OAA? 0200 OAAD DOCO OAAD 26ElA27 OADO E7BO

0•\DO 43 OADC FEC2 OABE llOFAOB OAC1 75E8 0AC3 E21JF OAC5 C3

OAC6

0AC6 55 OAC7 BDEC OAC9 50 0•\CA 53 OACD 51 01\CC 8D5E04

OACF DEOOOO 0AD2 D'i'OSOO 0AD5 BA07 0AD7 F61JO Ot\09 268804 OADC 43 Ot\llO 46 Ot\DG: E2f5 01-\EO 59 OAEI 50

LINE SOURC£

2!36 ;••••••••••**********~*********(* 2137 21JB A routine to displa~ ~h~tever is on the displa~ bu~f&r for 21J9 a ~hort pertOd of time. lt is u~cd to tell th~ user of what 2140 i the current situation he is involved. 2141 2142 ; Registers affected: AX, UX, CX, DX 2143 2144 2145 2146 2147 2148 2149 2150 2151 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2170! 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 21€19 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206

HOV CX,O:JOH ~et displa~ time LOOP4: MOV

HOV DX,OFFSET DISBUFF AL. 01111111D

nx point5 to displa~ buff~

LOOPS:

DSHORT

MOV RCJL MOV OUT 7.DELAVC2:JOiil INC INC CHP ,JNE LOOP RET ENDP

DL..O AL, I Aft, ES: [ll.XJ Pll_fJORD, AX

DX DL DL.Il LOilP5 LOUP4

'************••··················· LD~IESC PROC NEAll

; ••***************** •********** .:·t:• I

LDHESQ get• the •tarting addrel5 of the mes•age we want to h•ve it app~ared on 7-segment displ•us and loads the message into the displa~ buffer. The calle~ has to push the b~s• address of the message befor• calling this routine. Once it is called, it get~ the base address from the stack (thru BP register) and lo~d eight codes from the

For eaomple, if we want to load 'Err the calling se~uence should read:

lea ax.err push aa call ldmesg

Registers affected: Sl

NDVTE1:

PUSH NOV PUSii PUSJi PUSH MUV

DP BP,SP AX ax ex ax. rnro •4J

SL OFf-GGT ex. a AL, [DXJ AL

' into displa~ buffer,

; 11et ba~e addresfi o~ the ; m~ssage to be di~pla~~d

DISDUFF 1 use CX as iii counter ; get that message code ; l's complement

MDV MOV ~IOV

NOT MDV INC INC LOOP f'OP POP

E5:DVTE f'TR ox

CSJ:J,AL ; load it into bufh;or incr~m~nt point~r

51 NDVT!;I ex DX

dc1ne all 8 codes? restore re~iste1·~

'!0

I-' w w

Page 143: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/3000 I'!:~.CRO ,\SSEi·IELER 110N!TGR LISTWG 06101 /0~ Pi~G

LOC OBJ

0AE2 ~9 OI~C3 :.iD Ot\E4 C20200

OAE"7

OAE7 53 OAE9 51 OAE'I 20AOODOO OAED 9DIED200 OAF! 8'11000 OAF4 3A07 OAFb 7405 OAFS 43 OAF'I E2F9 OAFD DOFF OAFD 59 OAFE 50 OAFF C:l

ODOO

0000 DIED 0002 9008 0004 FF97E600

0008 C3

LINE

2207 2:208 2209 2210 2211 2212 2213

SOURCE

LDI·IESG

POP POP RET ENDP

IIX JfP 2

j ********* ... ********* ... ~********«'**t!-** KEYCHI~ PROC N;;t\1<

2214 ; ••••t::·ll-1tt:!-*1t*********1t:t**********«·•• 2215 2216

; discard the para1neter

2217 J A routine to determine whether CODii, JUSt enter•d by the user. is 2218 1 • he~adecimal kev or not, i.e. o. J,2,3.4,~.6.7.8.9,A.o,c.o,e, o~ F. 2219 ; In this routine. it compares CUOE with Rvf'r"' element in the •rra .. 2220 whose staT'tinq address is COOCHI£X. If one of the elem•nt• is match•d 2221 up with CODE. it returns CODE in AL to the caller. On the other hand. 2222 if none of the elements is matched with CODE, it retur-ns NHATCH, which 2223 ; is equal to OFFH. to the calleT. indicating that the ke\1 it. not il 2224 ; hexadecimal one. 2225 2226 ; Registers affected: AL 2227 2228 2229 22::10 2231 2232 2233 2234 2235 2236 2237 22::19 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260

NDYTE3:

MATCH!:

KEYCHK

PUSil PUSII tiOV LEA NOV CMP JE INC LOOP MOV POP POP RET

ENDP

BX ex AL,KEY BX,CODEilEX CX,LENGTH CUDEHEX AL,DYTE PTR [BXJ MATCH! ox NDYTE3 AL, NtiATCH ex ox

i ******************•·••*********** ACTION PRDC NEAl<

i********************************

i ~et ke~ number OX points to the array CX has the lenth of CODEHEX is CODE matched?

J if \jes, JUmp to MATCH I J if not, adJUGt poi.nt•r ; JUmp i. f not done 1 not a hex key!

A routine to call the routine accordin~ to the keypad number. The routine ~hose starting address is stored in ~ODTABLE is called right after the corresponding keypad number to the routine is pressed,

ACTION

$EJECT

SHL MOV CALL

RET ENDP

AX, I OX. AX JOD·i,\ULE[DXJ

~ulti,l~ OX by 2 m~ve it to nx call the TOlJtine accoTding t~e keypad 11umber t·eturn to m~in program

•11

,_. (.;..) +:--

Page 144: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/0087/8088 ;·1,\CRO ASSEMBLER

LOC OUJ LINE

22/,1 2262 2263

000? 090002 226-~ ODOC ?0 2265 0000 E2FD 2266 OOOF DB---- R 2267 0012 DECO 2268 0014 088989 2269 ODI7 E7E16 2270 ODI9 08---- R 2271 ODIC aEOOOO 2272 ODIF 090500 2273 0022 46 2274 0023 46 2275 0024 268'104 2276 0027 46 2277 0028 46 2278 0029 E2F7 2279 oo2o a8oooo 2280 002E 26A30COO 2281 0032 DB3EOO 2282 0035 26A30400 2283 0939 886.!.00 2284 OB3C 2.!.A30000 2285 0040 26A31000 2286

2287 2288 2289

OD44 na---- R 2290 0047 SECO 2291

2292 0049 091400 2293 004C 080000 2294 004F BOFO 2295 0851 263A6460 2296 0055 7502 2297 0057 FECO 2298 0059 FEC4 :::!299 0050 46 2300 OD5C E2F3 2301 OBSE 3AC4 2302 0060 7503 2303 0062 EB6290 2304 0065 091400 2305 0068 DOOO 2306 OD6A BEOOOO 2307 0060 26984460 2308 0071 FECO 2309 0073 46 2310 0074 E2F7 2311 0076 080000 2312 0079 26A30EOO 2313 0070 26A31000 2314 0081 26A31200 2315 0095 26A31400 2316 0089 Db~o\31800 2317 0080 2bA31AOO 2318 0091 ::?6A31COO 231? 0095 i!~A32600 2320 0099 261\.12800 2321

MONJTOR LlSTHIG 06/01/05 PN;

SOURCE

i ****** •***** ........ •·•••******* ......... *************** .................................... * ASSUI'IE OS; D1\TA GG.(}, I• E5: I Hf i>m ST1\RT. 'i•IOV .. 510ELAY: NOP

LDINTP:

ASSUi'IE

LOOP ~IOV NOV MDV OUT MDV MDV MDV INC INC tiOV INC INC LOOP MDV riDV MDV MDV MDV MDV MDV

ES: DI\TA._RAtl

MDV MDV

CX, ~!OOH

5TDEIAV AX, INT ,,PTU E5,1\X AX,CONIRL CR ~JilfW,I\X AX :-1 NT __ SEC< 51,0 cx,5 51 51 ES: [Sl J, AX 51 51 LDINTP AX.DF~SET DRENTRY 1NT3 .. 0FF, AX AX,OFFSET STEPENTRY INTI OFF, AX AX,DFF5ET DOERROR INTO OFF.AX 1NT4:::0FF.AX

AX, DATA_RAM ES.AX

Determine if it is a MDV MDV NOV

'code staT"t" CX,20 AX,O

AAI: CMP JNE INC

SKP33: INC INC LOOP CMP .JNE ..IMP

5KP34: MDV MDV MDV

AA2: MDV INC INC LOOP t'IOV tiDV MDV MOV MDV J1DV MDV MDV MDII MDV

SI, AX AH, PmJSTATSISll S1\P33 Ill AH 51 AI\ I AL.AH SKP::J4 WARM CX,r!O AL.O sx.o PO~J5TATSI51 J, AL 1\L 51 A1\2 AX,O AXUSR, 1\X BXUSR,AX CXUSil, 1\X DXUDR,AX DPlJSR.AX SIUSil.,\X DIUSH.t\X IPUSR,I\X FLUSJ1,1\X

~et time for delay do nothi11g remain in this loop until du

ES points to interrupt t~ble

initialize a;~j5'5 initialize interT"upt table

set counter ncrem~nt '31 nc:rement ~I nitialize interrupt ncrement Sl ncrement SJ

segment

initialize type 3 address

initialize type 1 addre~s

initialize type 0 address initialize t~pe 4 address

initialize ES

i~ wal·m. no initialization he~e is cold st~rt

make it warm

initialize user 1 5 AX ux ex ox Dl' 51 UI lP Flilfl<:i

•li!

I-' w U1

Page 145: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

aoa6t8087/80c18 >ll•·:?.u /,5SEMD! .. i::R •'IGIHTOR LISTING

LOC ueJ LINE SOIIRCE

2322 ASSUNE oo9o nsooo1 2323

2324 ASSUI'IF. ODA.:l 261131600 2325 OBA4 na---- R 2326 ODA'l 26A:J2200 2327 OBAB DB---- R 23::::!8 ODAE 26A31E'OO 2329 ODOZ! 98---- R 2330 ODD~ 2.0A32000 2331 0009 PB---- R 2332 ODBC 26A32400 23:33 ODCO 26C6065000FF 2334

2335 ODC6 FD 2336 ~IAR~I:

OOC7 BD067A00 2337 INFINITE: ODCD 50 2338 ODCC EBF7FE 2339 ODCF EBIEFE 2340 0002 0400 2341 0004 26AOOD00 2342 ODDS EB25FF 2343 ODDD EDEA 2344

234~ CODE 2346

ES: USI<ST1\CK NOV ES: D•\"1 A. II AN NOV NOV 110V MDV MDV MOV MDV MDV MDV MDV

ST! LEA PUSfl CALL CALL MDV MDV CALL JMP ENDS END

06/0110~ p;\C

AX, or;FDET UfiRTOfl

SPU:<II,I\X 1nitialize u~~er's SP AX, U~illSTIICK SSUSR,I\X I initialile us•r'~ SS AX,USRCODE CSUSR,I\X 1niti~lize u~er'i CS AX, USIWATA DSUSR,AX I initialize u~er's DS AX, USREXTRII ESUSR.AX I initialize u~er's ES DRFLAG,NOT ENABLE I clear breakpoint capability

I enuble int&rrupt AX, SY~IESG I AX points to 'PCP 8086' AX LDNESG I load 'PCP 8086' into buffvr SCAN_DISP AH.O AL.KEY ACTION I Jump to a routine according! INFINITE I remain in infinite loop

START.DS:DATA_SEG.SS:STACK:STACK_TOP

•13

f-' (.,.) C)'\

Page 146: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087/8088 i1ACRO ASSE~mLER tiDNITOR LlSTWG 06/01185 PMI

XREF SYMBOL Tl•llLt: L !STING

NAME TYPE: VALUE ATTR lBUTES. :mF.FS

??SEQ A_SS. AAI . AA2 ""'33. AABB. ACTION. ADDPOINT. ADFIELD ADRHEX. AGPI. . AGP:l .. AGP4. AXCODE. AXPROC. AXSYS AXUSR B_ES. BACK I BLANK

BLKniO. BPCODE. BPPROC. BPSYS . BPUSR . BRADT . BRDASH. OR DONE. BRENTRY BRFLAG. BRKEY . BRKPOINT. BRMESQ. BTEI. . BTE2 .. BXCODE. BXPROC. BXSYS . DXUSR BYT .. BYTREAD BYTRREAD. C_IP .. CIIKAGN. CLRO. CLROil CNVRT CODE. CODE I CODE2 CODE:l COD£4 CQOE5 CODob CODE7 CQOL'A

!iEGUENT NUNDER L NEAR L NEAR L NEAR L NEAR L NEAR L ~lEAR

V BYTE V WORD L NEAR L NEAR L NEAR V DVTE L NEAR V ~lORD V WORD NU~IBER L NEAR NUMBER

L NEAR V BVTE L NEAR V ~lORD V WORD V WORD V BYTE L NEAR L NEAR V BVTE NU~IBER

L FAR V BYTE L NEAR L NEAR V BVTE L NEAR V WORD V WORD NU~IBER L NEAR L NEAR NUNBER L NEAR V DYTE L NEAR V DYTE SEGr!ENT V BYTE V DYTE V BYTE V BYTE V DYTE 'I BYTE V DYTE V OYTE

0013H OBSIH OB6DH 0200H OIEDH OBOOH 09CCH ooooH 0046H 009AH 008FH OOA2H 009AH 0293H 002AH OOoEH 0014H o:l69H OOOOH

07EDH OOAEH o2BIH 0034H OOIBH 0056H 0092H 057FH OOOOH 0050H 0003H OooOH 0072H 075BH OBOAH 009EH 0299H 002CH OOIOH OOOIH OOFFH OIIDH 0015H 0208H OOBAH 0589H OOOOH

OOOOH OOOIH 0002H OOO:JH 0004H 0005H OOOI>H 0007H

SIZE=OOOOH PARA PUBLIC 581 176 b:l2 1>97 910 1472

CODE 2291>1 2:101 CODE 2309 il 23 II CODE 811>1 819 821 CODE 8071 80? CODE 22461 2258 2343 CODE 955 1641> 19281 1952 DATA_RAM 2841 624 854 1527 1647 1875 DATA RAM 343V 656 674 675 684 685 758 845 151>5 1696 1740 1851> 1863 INT_SEG 4931 512 JNT_SEG 4871 492 INT_SEG 4961 511 DATA_SEG 1568 919 CODE 891 9191 DA TA_RAM 320ft DATA~AM :lOBI 541 1035 1195 2313

591 176 699 912 1474 CODE lOIII 1019

381 134 135 136 137 138 142 143 144 145 146 147 156 157 158 159 160 161 162 163 16 166 167 168 169

CODE 649 1533 15831 1592 11>61 DATA SEG 1611 929 CODE- 901 92911 DATA_RAM 3331 DATA RAM 313* 558 1044 1202 2317 DATA-RAM 3588 1179 1258 1277 DATA-SEG 147. 1254 CODE- 1279 12811 INT_SEG 4108 2280 DATA RAM 3531 1177 12~2 1266 127~ 1298 2334

42i INT_SEG 399* 431 DATA SEG 143# 1249 CODE- 1505 15001 CODE 1607 16108 DATA SEG 1571 921 CODE- 893 92111 DATA RAM 32911 DATA-RAM 3091 544 1036 1196 2:114

67i 592 594 647 672 682 759 1506 1508 1531 1567 1608 11>10 1632 1659 1699 1741 CODE 673 6751 CODE 683 bB511

601 914 CODE 815 BIBll DATA_SEG 141># 1299 CODE 103 12908 1304 DATA_SEG 828 847 852 1100 1101 1305 1011 1871 10'/2 SIZE=OBDDH PA~A 5768 577 2345 DATA RAM 2858 DATA=RAM 28Ll:H DATA RAt'1 2871t OAT A::RAM 2B8U DATA_RAr1 29011 1588 DATA_RAM 2918 1589 OATA_RAM 29241 DATA RAM 2931+

~·)

1>5

...... w --..J

Page 147: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087 180•313 111\CRO r,SSEMBLER

Ni\ME

CODEHEX COLON CO~ICIIKI

COi'1CHK2 COMMI\ . CONTI . CONTI1L. COUNT . CR_HIGH CR_LOW. CR_WORD CSBASED CSCOIJE. CSPilOC. CSRGTER CSSYS . CSUSR . CXCODE. CXPROC. CXSYS . CXUSR . D_FL .. DATA_RAM. DATA_SEG. DATHEX.

DCHKJ·. DOES. DECPOINT. DELPOINT. DEND .. DESADR. DEST .. DGSTART DICODE. DIPROC. DISBUFF DISPLR. DISYS DIUSR DN1 . ONE I. DOENTRY DOER !lOR DONE! DONE2 DONE:; DSACR~ISG.

DSBAHED OSCOOE. DSHORT. DSPROC. OSSEO . DSSYS . OSUSR . OTFIELD DTR•INS. OX CODE. OXPROC. DXBVG ox usn

TYP£

II OYTE f'IIJI'1DER L NEAR L i'IEAR NU~IDER L NEAR NUNDER V BYTE NU~IUER NUMBER NUNDER L NEAR V BYTE L NEAR V WORD V WORD V WORD V BYTE L NEAR V WORD V ~lORD NU~IBER

SEGMENT SEGMENT V WORD

L NEAR L NEAR V BYTE L NEAR L NEAR V WORD V BYTE L NEAR V BYTE L NEAR V BYTE L NEAR V WORD V ~lORD L NEAR L NEAR L NEAR L FAR L NEAR L NEAR L NEAR V BYTE L NEAR V BYTE L NEAR L NEAR V ~lORD

V ~lORD V WORD V BYTE L NEAR V BYTE L NEAR V ~IDRD

V l·IORD

VALUE

OOD2H 0002H 05FBH Ob36H 0009H 0016H 8989H OOOAH 0087H 0086H 0086H 0087H OODAH 02C3H 0006H 003AH OO!EH OOA2H 029FH 002EH 0012H 0016H

0048H

033tH 066CH 003AH 09E2H 0606H 004EH OOOOH 05COH OOD6H 02DDH OOOOH 0128H 0038H 001CH 0103H 0213H 0066H 0066H OBBCH OBDDH 08F9H 00b2H OOBEH OODEH OAAlH 02C9H 005CH 003CH 0020H 0004H 040CH OOA6H 02A5H 0030H 0014H

MONITOR Ll5TING

ATTRIBUTES, XllEFS

DATA SEG 174 175D 2232 2233 4lt 701 1336 1381

CODE 1331 134411 CODE 1:Jb4 l:J66ll

48ll 620 965 1021 1345 1376 1525 15~6 16~8 1664 CODE 593 59511

3711 2269 DATA_RAM :JOOll

3HI 30D 35 35ll 2270

CODE 629 636ll DATA SEG 164D 714 935 1478 CODE- 907 935U S FIELD 529ll 553 DATA RAM 3::1611 DATA-RAM 316ll 418 554 636 1030 1181 1191 1315 1477 2329 DATA-SEG 158D 923 CODE- 895 92311 DATA_RAM 33011 DATA RAM 310ll 545 1037 11?7 2::115

61t 916

06101/85 PAC

SIZE~0075H PARA 278ll 366 377 425 452 463 482 516 536 580 2288 2290 2324 SIZE=OI18H PARA 73ll 191 427 456 462 400 :;79 2262 2346 DATA RAM 344t 423 762.765 1008 1016 1067 1094 1134 1145 1259 1276 1326 1358 1396 15

t697 1747 1804 1911 1918 CODE 966 97611 CODE 1377 1382 13848 DATA SEQ t36ll 595 703 1509 1611 CODE- 626 1221 1529 1577 1649 195611 1?80 CODE 1346 1348ll DATA RAM 351ll 1::197 1441 E~: COil 14261 1445 CODE 1322 1324ll DATA SEG 1631 933 CODE- 905 93::111 DATA RAM 2829 485 494 1790 2014 2145 2197 CODE- 602 688tl DATA RAM 335tl DATA -RAM 315U 548 1040 1200 231? CODE- 764 71>711 ~ODE 817 822# !NT SEG 47211 INT-SEG 46511 514 2284 CODE 1675 16771 CODE 1702 170411 CODE 1744 17471 DATA_SEG 14111 1384 CODE 631 638ll DATA SEG 16511 719 9:J7 1401 CODE- 740 984 1053 1158 1222 1283 1302 1413 IS~:; 1679 2135ll 2169 CODE 909 937# DATA RAM 361n 131>7 1380 1442 DATA-RAM 33'111 . DATA-RAM 31711 539 638 1041 1201 1480 23::11 DATA-RAM 289M 954 1104 1219 1575 1634 1636 181::1 CODE- 644 1010 1076~ 1115 1135 1218 1260 1574 16~6 1919 DATA SEG !59D 925 CODE- 897 92511 DATA RAM 33U DATA-RAM 311# 546 1038 ll?~ ~316

l!.:;

1-' w CXl

Page 148: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

S086/8087/8CH38 :MCt\0 .~SS£NBLER

Nllt1E

E. ED_O_ t\X ECHK1 . EDCfiiU. ENAULE. ENADRNSG. EN DAD DR ENDADR. ENDCHK. ENDKEV. ENDMESG ER_I_DX ERR . ERR I. ERR12 ERR19 ERR2. ERR29 ERR5. ERR7. ERR71 ERROR ESC ODE. ESPROC. ESSVS . ESUSR EW_7_DI EXAMMEMO. EXANREG EXECUTE EXITT . Exwono. F .. FIRST .

FLAG_IMAGE. FLCODE. FLPROC. FLRGTER FLSYS . FLUSR . FORW1 . FORW18. FORW2 FORW3 FORII5 FORII6 FORWG FORW9 FORWDI. •. FRWD1 . OBR . GETURK. GETGOI. GETG02. GEniCI•J. CGSr1\RT CI·IE5G GO. co 2 ex oo:\o:i

TYI'E:

NUfiUER NUi'IDER 1- NEAR L HEAR NU~IDER

'I DVTE L I"AR 'I WORD L NEAR NUtiUER V DVTE NU~IDER

V DVTE L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR NU~I9ER V BYTE L NEAR V .lORD 'I IJORD NUtiDER L NEAR L NEAR L NEAR L NEAR L NEAR NUMBER NUMBER

V WORD V DVTE L NEAR 'I IJORD 'I WORD V WORD L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR L riEAR L NEAR L NEAR L NEAR L 1·1~AR

L NEAR v u'ITE L tiEAR NUt'IUEn ~~ t.JQR[\

VALUE

0017H 0007H 06t\3H 055,\H OOOOH 005AH O~OIH

004CH 0199H 0006H 004AH 0008H 0032H OIA3H 057BH 048AH 07DCH 03EEH 08D8H 06B4H 0339H OOOIH OOC6H 02D5H 0040H 0024H OOIOH OOOOH 0249H 0496H OA9CH OOIOH 0018H OOOOH

0004H OOCEH 02EIH OOOBH 0044H 002BH 0053H 0868H 009AH 02E5H 0838H 0896H OB43H 086BH 0314H 0761H 054:JH OSIAH 0466H 046BH 08DCH 0506H 006AH 043DH 0004H 0054H

i'lotHTOR LIST!tlG

ATTRIBUTES. XllEFS

62M 46~ 8'10

CODE 1402 1401• CODE 1265 !270M

64M 1177 1252 1266 ~275 12?8 2334 DATA SEG 140M 1348 CODE- 429 !210M 1224 DATA RAM 3~0# 1359 1370 1435 CODE- 680 73311

45M 733 977 1046 1140 1152 1271 1405 1538 1671 DATA SEG 138# 735 981 1048 1215 1278 1408 1540 1674

47i 892 DATA SEG 1351 484 737 97'1 1050 1155 1280 1'110 1512 1676 CODE- 609 622 661 702 709 734 7371 CODE 1272 !200M CODE 1142 1153 11551 CODE 1517 1526 1539 15420 CODE 1047 10501 CODE 1619 1630 1667 1672 16761 CODE 1323 1338 1347 1356 1374 1378 1383 1394 1406 14101 CODE 918 9791

681 659 803 816 DATA SEG 1671 729 941 14137 CODE- 913 94111 DATA RAM 33911 DATA-RAM 3191 ~49 634 1042 1203 1486 2333

55i 590 904 CODE 184 187 5831 742 CODE 185 880. 986 CODE 1154 116311 1205 CODE 2098 21261 CODE 591 594#

631

06/01/85 P/IG

661 610 616 645 666 710 949 962 967 971 974 1009 1019 1143 1148 1261 1268 1273 132 1332 1351 1361 1387 1399 1514 1520 1616 1625 1650 1657 1666 1669 1857 1912

[BPJ 10001 1043 DATA SEG 1691 945 CODE- 917 9451 S FIELD 530* 555 DATA RAM 3411 DATA-RAM 321* 556 1028 1109 2321 CODE- 615 619D CODE 1635 16461 CODE 635 637 639 6411 CODE 920 922 924 926 928 930 932 934 936 938 940 942 944 946# CODE 1624 16271 CODE 1654 16b31 CODE 1629 16318 CODE 1645 16471 CODE 959 9641 CODE 1507 150?1 CODE 1262# 1269 CODE 183 12291 1287 CODE 1139 11431 CODE 1144U 1151 CODE 643 663 17071 1753 CODE 1320~ 1313 DATA_SEG 14:?i' 11;~9 CODE 184 1118tt 1160

43# fl94 DMTA RAM 357~ 455 1006 1007 1017 1023 1133 1146 1175

•16

1-' LV ~

Page 149: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

608.:,/ Q(:f::l? /80,58 t·l.:,cf~O A'.:iS~MDl ER MON! TGR LIST!i-JG <Jb/01/05 PAC

N/\I'IE I"YI'E VALUE ATTRIBUTES. XIIEFS

GST .;rrr. GTOr\SE CI,.JH HIGHllAT HORIZON IB_4_ SP !NBTWRD li~F!NITE.

INPUT !NSTATUS. INSV. INT_PTR . INT_SEG . INTO OFF. INTO:~SEG. INTl_OFF. INTl __ OEG. INT2_0FF. INT2_SEG. INT3 OFF. INT3::::SEG. INT4_0FF. INT4_SEG. IPCODE. IPPROC. IPRGTER IPSYS . IPUSR . IW_e_cs JOB TABLE. KEY .

KEY _HEXTAB. KEYCHK.

KEYPRESS. LDES. LDINTP. LDMESG.

LDREG . LEND. LOOP! . LOOP12. LOOP4 . LOOPS . LO,.DAT. LSTt\RT. MATCIH. MCSI. MDSI. ME~ICHK. MESI. MINUS . MINUSCHK. MOVEB . MSSL MV_b_SI . MVBLOCK MVSTATUS. NB'IlEl.

I. NEAP. L NEAR L ti!:AR IJ 0'/TE L NEAR t~UriOE.R

L NEAR L t~EAR L NEAR V BYTE V BYTE SEGMENT SEGMENT V HORD V WORD V WORD V WORD V ~lORD V WORD V ~lORD V WORD V WORD V WORD V BYTE L NEAR V WORD V WORD V WORD NUMBER V WORD V BYTE

V DYTE L NEAR

L NEAR L NEAR L I~EAR

L NEAR

L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR V DVTE L NEAR L NEAR L NEAR L NEAR L NEAR L NEAR NUNDER L NEAR L NEAR L NEAR NUMBER L NEAR V DVTE L NEAR

OSEEH ObF3H 07A7H 0049H OA27H OOODH 074DH OOC7H 07C8H 0051H OOOCH

OOOOH 0002H 0004H 0006H 0008H OOOAH OOOCH OOOEH OOIOH 0012H OOCAH 02DBH 0004H 0042H 0026H OOIIH OOE6H OOOBH

OOIIH OAE7H

OA7FH 068AH OB22H OAC6H

0902H 061DH 09F4H 0042H 0AA4H OAABH 004BH O:lC2H OAFDH 071AH 072SH 0107H 073BH OOOBH 0109H ObCOH 0730H OOOFH 059BH 0053H OAOSH

CODE 1337 13:191 CODE 1334 1379 1451.~ 14'/;! CODE !532 1534ll DATA_RA11 34611 CODE 204~* 20~2

521 898 lD04 CODE lSI> 187 !4961 15·17 CODE 430 2337ll 2344 CODE 1530 15501 1579 DATA~AM 35411 1506 1508 1~31 1566 DATA_RAM 3021 421 1186 SIZE=OOI4H PARA 248» 268 2263 2267 SIZE=OOFDH PARA 369M 376 562 2271 INT_PTR 2~1~ 2285 INT PTR 252M INT=PTR 254# 2203 !NT _PTR 25511 !NT PTR 257ll INT ::::PTR 25811 INT PTR 260ll 2281 INT::::PTR 26U INT_fTR 263ll 2286 INT_PTR 26411 DATA_SEG 1688 943 CODE 915 94311 S FIELD 52811 551 DATA_RAM 34041 DATA_RAM 32011 419 424 454 552 1005 1024 1032 1132 1176 1193 2320

56tl 176 603 628 693 906 1468 DATA_SEG 183 18711 2255 DATA~AM 30111 589 599 619 623 668 692 809 964 976 1020 1140 1152 1270 1317 1336 134

1375 1381 1392 1404 1467 1503 1524 1535 1605 1627 1663 2072 2100 2231 2342 DATA_SEG 1058 1854 1855 i909 1910 CODE 60S 613 651 707 957 1012 1137 1149 1263 1320 1329 1353 1362 1389 1400 1513 152

1615 1622 1652 22131 2243 CODE 2048 2059 21001 CODE 1391 13951 1403 CODE 22741 2279 CODE 597 690 705 739 887 983 1004 1052 1131 1157 1217 1251 1256 1282 1301 1313 1341

1386 1412 1465 1511 1544 11>13 1678 ~172fl 2210 ~339 CODE 716 721 726 731 953 1489 17571 1D24 CODE 1355 135711 1365 CODE 201111 2071 CODE 6121 618 712 CODE 21451 2166 CODE 21481 2165 DATA_RAM 345ll CODE 13251 1333 CODE 2235 22391 CODE 1469 1477# CODE 1471 14fJOtl CODE 658 7741 828 CODE 1475 1486#

50# b78 CODE 670 6781* CODE 1407 141B» 1453 CODE 1473 14G3*

541 902 CODE 186 13071 1415 DATA_RAM 356-tt CODE 2199# 2204

•17

so

.......

.p. 0

Page 150: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/8087/8083 M1\CRO ASSE~IBLER

NAME T'fPE VALUE

NBYTE10 L NEAR 0902H NBYTE11 L NEAR 09E3H NDYTI!3. L NEAR OAF4H NEXST . L NEAR 0382H NEXSTI. L NEAR 03E4H NEXT! . L NEAR 09FFH NEXTIO. L NEAR 0984H NEXTI4. L NEAR 00A9H NEXT20. L NEAR OOA1H NEXT~2. L NEAR 0778H NEXT23. L NEAR 0799H NEXT25. L NEAR 0877H NEXT3l. L NEAR 0827H NEXT33. L NEAR OBAAH NEXT4 . L NEAR 0912H NEXT40. L NEAR 02EFH NEXT43. L NEAR 0851H NEXT47. L NEAR 0859H NEXTS . L NEAR 093DH NMATCH. NUMBER OOFFH

NOBLK . L NEAR OOB6H NOJOB . L NEAR 0247H NORMAL! L NEAR 035CH NOTHIN. L NEAR 0495H NO ZERO I L NEAR 0972H NOZER02 L NEAR 09DAH NSEG. L NEAR 0130H NSEGI . L NEAR 0701H NXT2. L NEAR 032AH 01. L NEAR 074AH OB_5_BP NUMBER OOOEH OFFST . V WORD 0004H DKKK1 . L NEAR OOD8H OLD_BP. V WORD OOOOH OLDDP V WORD OOOOH DUll. L NEAR 01A7H OUT2. L NEAR 0344H OUT3. L NEAR 0340H OUTDW . L NEAR 07FAH OUTDYTE L NEAR OBDAH OUTPUT. L NEAR 08C4H OUTSTATUS V BYTE 0052H OW_9_DS NUMBER 0012H PA_HIGH NUNDER 0081H PAJ.-OW. NUMBER 0080H PA_WORD NUtiBER 0080H PAR ANT. STRUC PB_HIGH NUMDER 0083H PO _LOW. NUtiDER 0082H PD_~JUAD NUtiOER 0082H PC_HIGH NUtiBER 0085H PC_LOW. NIJt1BER OOB4H PC_WORD NUMDER OOB4H PCS!. L NEAR 0165H PDSl. L NEAR 0172H PES!. L NEAR 018CH PLUS. NUMBER OOOAH PLUSCHK L NEAR OOEAH POWSTATS. V DYTE 0060H PRESS!. L NEAR OAoOH

~!ONITOR LISTWG 00/01/05 P1\C

A TTR 1 BUTES, X REFS

CODE 1943# 1948 CODE 1973# 1977 CODE 2234* 2237 CODE 1014 1020# CODE 1022 1046# CODE 2016# 2031 CODE 1867# 1879 CODE 646M 667 CODE 643M 677 687 CODE 1~16 15181 1523 CODE 153011 1537 CODE 1651# 1660 1662 1670 CODE 1618 1620# 1626 CODE 1665 16711 CODE 1791!1 1796 CODE 9508 9.!>3 972 975 CODE 1~>33 1636# CODE 163911 1644 CODE 1807# 1817

65# 607 614 652 708 958 1013 1138 11~0 1264 1321 1330 1354 1363 1390 1401 1515 152 1617 1623 1653 2238

CODE 648 650ft CODE 183 183 184 18' 185 ISS 106 187 188 188 188 188 189 868# 876 CODE 458 100711 CODE 1159# CODE 1858 1860# CODE 1913 1915# CODE 691# 717 722 727 73~ CODE 1466# 149o CODE 969 973# CODE 1476 1491#

531 900 1606 S FIELD 793# BID CODE 660 66211 S FIELD 5261 S FIELD 791# CODE 736 73811 CODE 980 98::?# CODE 978 9Blll CODE 186 187 1596# 1681 CODE 1700 17031 CODE 1o6B 1673 1685# 1705 DATA_RAM 3551 1608 1610 1631 1658 1690

57# 176 630 695 908 1470 25M 24* 32 2033 2044 321 49B 201e a150

SIZE=OOOSH #FIELDS=4 790 7?5# 271 26 .. :33 331 29 .. 281 34 204~ 2057 2112 34# 2066 2084

CODE o94 713~ CODE 696 718il CODE 700 7::!811

491 669 CODE o53 66811 OATA_RAM 363tt 2290 2300 CODE 2068 207::!tt

•Hl

1-' .p.. 1-'

Page 151: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

3086/8uB7 /13083 ~1,\CRO 1135Er10LER

~11111E TYPE VALUE

PSSI. L ~lEAR 017FH RBYTE L NE.~R 08F5H RDST1\TS V DYTE 0009H REG . NUI·IDER OOOIH REGFIELD. V BYTE 009AH RETLIRN_AD V WORD 0002fl RETURN_ADDR V WORD 0002fl RGCONT. V 14DRD OOOEH RIND X V ~lORD 0058H RMESG . V DYTE 002AH RPOINT. V DYTE 0042H RUNU::JER L NEAR 04BBH R~IORD . L NEAR 0418H SAVEREG L f·IEAR OOB7H SCAN_DISP L NEAR 09FOH

SEGBASED. L NEAR OSDBH SEGDASED2 L NEAR 0659H SEGKEY. V BYTE OOE2H SEGMNT. V WORD OOOI>H SEGSTATS. V BYTE 0008H SGHADR. V L•ORD 005EH SICODE. V BYTE 0002H SIPROC. L NEAR 02B7H SISYS . V WORD 0036H SIUSR ... V WORD 001AH SKIPI . L NEAR 003DH SKIP I D. L NEAR 07DBH SK1P12. L NEAR 0810H SKIP123 L NEAR OllOH SKIP2 L NEAR 005EH SKIP4 L NEAR 002CH SKIP7 l NEAR 07COH SKIP9 L NEAR 07D8H SKIPP L NEAR 03F2H SKK3. L NEAR 01>4EH SKP33 L NEAR OB59H SKP34 L NEAR 0Bb5H SKP70 L NEAR OIFBH SOURCE. V DYTE OOOOH SPARE!. NUNDER OOOOH SPARF.2. NU~IDER OOOCH SPCODE. V DYTE OOAAH SPPROC. I. NEAR 02ABH SPSYS , V WORD 0032H SPUSR . V WORD OOII>H SSDASED L NEAR 0095H SSCODE. V BYTE OOC2H SSPROC. L NEAR 02CFH sssvs V ~lORD 003EH SSUSR V WORD 002:2H 5T_3_DX NU~IDER D005H STACK . SEGMENT STACK_ TOP V WORD OOCBH START . L NEAR 0009H STARTAO . V ~lORD 004AH STARTi'ISC. V OYTE 0052H STCK .. LAYOUT I. STRUC STDELAV . L NEAR ODOCH S'IEP. L FAR 003EH STEPENTRY L NEAR OD:JEH

~IONITOR LISTING 06/01/85 Pt\(~

ATTRIBUTES, X REFS

CODE 698 7~3# CODE 1742 174:;11 DATA_RIIM 291311 592 5~4 642 .!.•16 662 671 t.fll 'lt.O

401 600 1318 13?2 DATA SEG 15511 946 950 17'/U s FIELD 792tt S FIELD 5278 DATA_RAM 30711 1069 1803 DATA RAM 3591 1068 1802 DATA:::SEG 1341 688 885 1463 DATA_SEG 13711 CODE 1178 118711 CODE 10961 1108 INT SEG 410 444 472 519tl 560 CODE 598 612 650 691 706 888 956 1011 1136 1147 1262 1314 1328 1342 1352 1360 1388

1466 1512 1519 1534 1614 1621 1651 19046 2131 2340 CODE 1319 133411 CODE 137911 1393 DATA_SEG 17611 S FIELD 79411 806 DATA_RAH 29711 604 627 713 718 723 7213 DATA_RAM 362tl 654 757 1739 DATA_SEG 162i 931 CODE 903 931tl DATA_RAM 33411 DATA_RAM 31411 547 1039 11?9 2318 CODE 608 blOt! CODE 1570 157311 CODE 1609 11>1111 CODE 679 68111 CODE 621 62311 CODE 601 603ll CODE 1541 154311 CODE 1568 157111 CODE 1049 10S1tl CODE 1373 1375tl CODE 2297 229911 CODE 2303 23051 CODE 812 814ll DS: CSll 1425. 1445

3911 :1111

DATA_SEG 160# 927 CODE 899 927# DATA_RAM 3:J2ll 451 1025 DATA_RAM 312# 414 448 476 1027 11813 2325 CODE 633 640# DATA_SEG 166# 724 939 1484 CODE 911 939# DATA RAM 3388 DATA -RAM 318tt 550 640 1026 1187 148:::) 2:Ji~7

44ii 39t. SIZE=OOC8H PARA STACK 23011 417 479 2346 CODE 2264# 2346 2346 DATA RAM 34911 1327 1371 1436 1440 DATA-SEG 13911 1311 1339 S!ZE;;:OOOAH IFIELDS=5 525 53111 CODE 2265# 2266 !NT SEG 43411 460 INT-SEG 444tt' 2292

•19

8

1-' +:-­N

Page 152: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

8086/01187/8068 MI•CRO ASSEMBLER MONITOR LISTING

NA11E TYPE VALUE ATTRIBUTES, XUEFS

STEP MODE. L NEAR 034CH CODE 184 9091 1055 STPN~G. V BYTE 0082H DATA SEG 14511 1002 STSEG 'I WORD 005AH DATA:::RAM 36011 1316 1335 136b 1~33 14:•1 STYOO L NEAR OOADH INT_SEG 505M 50'7 STY01 L NEAR OAOAH CODE 202511 2027 STV02 L NEAR 0Ab9H CODE 207911 2081 STY03 L NEAR 0A78H CODE 209311 20'15 STY04 L NEAR 0A66H CODE 210711 2109 STY OS L NEAR OA97H CODE 2121H 2123 STYOb L NEAR OADbH CODE 215711 2159 SVMESG. V BYTE 007AH DATA_SEG 14411 2337 SVSREG. V WORD 002AH DATA_RAM 32711 TRNEXT. L NEAR 022BH CODE 84811 656 TTl . L NEAR 0744H CODE 1479 1462 1465 148611 TT:I . L NEAR 06D8H CODE 1409 141111 TVPE_O. V DWORD OOOOH INT_PTR 250tl TYPE_!. V DWORD 0004H INT_PTR 253ll TVPE_2. V OI.IORD OOOBH. INT_PTR 25bll TVPE_3. V DWORD OOOCH INT_PTR 259ll TVPE_4. V DWORD 0010H INT_PTR 26211 Ull . L NEAR OA52H CODE 20b5tl 2070 U12. L NEAR OA3FH CODE 205611 2061 UADRDUF L NEAR 021BH CODE 676 66b 63241 6b5 UBVTE . L NEAR OICDH CODE 761 76511 UPADDR. L NEAR 095CH CODE 611 b17 711 1516 1620 1827# 1885 UPDATAW L NEAR 09A5H CODE bb4 960 1015 1144 1~67 1325 1357 13'15 1655 188911 1924 UPDATREG. L NEAR O:IFAH CODE 961 105811 1073 USCONTR . L NEAR 0487H CODE 1141 11541 USRCODE . SEGMENT SlZEzOOOOH PARA 20511 206 232[) USRDATA . SEGMENT SlZEaOOOOH PARA 21lll 212 2330 USREXTRA. SEGMENT SIZE=OOOOH PARA 21811 219 2332 USRSTACK. SEGMENT SIZE=O!OOH PARA 19711 200 2322 2326 USRTOP. V l-lORD OlOOH USRSTACK 199ll 2323 VERTICAL. L NEAR OAIBH CODE 203911 2053 WAIT! . L NEAR OASDH CODE 211211 2114 WAIT12. L NEAR OA6EH CODE 206411 2086 WARM. L NEAR OBC6H CODE 2304 233611 WRDATA. L NEAR OIAFH CODE 665 745P 771 WRFLAG. V BYTE 0074H DATA_RAM 3o4ft 659 eo3 ato XII L NEAR 0536H CODE 1253 1258# Xl2 L NEAR 0541H CODE 1257 126U XI :I L NEAR 0575H CODE 1274 127811

END OF SVI1BOL TABLE LISTING

ASSEMBLY CQi•fPLETE, NO ERRORS FOUND

06/01/05 P•\G ~jQ

........

.p.. w

Page 153: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Appendix B

Link86 Map

I •

Page 154: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

SEn ( CS- l I I 80~1b L ll•W. ER, V2. 0

HIPUT FIL~S: : 1'1: tiOi'lli.IJDJ '1Uii'llf FILE: :Fl:i·'ll)!Hl. LNl( COr·ffHC11_S SPEC II-:- (EI.i lN HNOCATION C01'11'11\ND: DIITE: 0£./01/05 THI<::

L!NV, 11.~P OF 11tlllt.IU: 11AJN J'iODULE

I.OCJC:1\L SEGrti,NHl INCLUUCD: LEN<:nt 1\DDREGS AL [CN SEGI'IE'NT CLASS

OOOOH ------ <: ??SEG Ollt:Hi ------ G DATA SEG OIOO!i ------ G U:3RSfACK 000011 -·----·- C USRCDDE OOOOH -·----- C \JSRDIITA OOOOH ------ G IJSilEXl'RA OOCOH ------ G STACK OOJ4ft ------ G INT PTR 00l5H ------ G 01\TA RAM OOFDH -·----- G INT SEG Olii>DH ------ G CODE

HlPUT MODULES INCLUDED: : F I: t10N II. DB .J( 1·1111 N_MilDULE)

li'JC,:HL1\V

1-' .p.. V1

Page 155: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Appendix C

Loc86 Map

146

Page 156: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

SER 1<:5- I II O<ltlb LOCATE:R, 'J:l. 0

INPlJf FILE: :H:i10Nl!.l.tll\ OUfl'llT f"ILE: :FJ:i"\Of\1(1 COtHilOLS SPEClr:u::::o Ir~ 'ti'NOCAT lON CDNI'l;\NO:

1\0( S~ll DATA .. ~'E.G ( iJFFEOOHl, ST1\CI\ ( OJOH l, DATA _ _IIAi"ll IOOHl, !NT _PTR IOHl, CODIC(OFCOOOHl, !NT _SEG !Of'F900Hl, USilCODE (0300Hl, USilSTACI\10200111, USROATAC0300IIl, USREX fRAI0300Hl l l INITCODEIOFFFDOHl DOOT:iT:II\f'

flArE: 06/01/>J:i Tli1.E:

11E1101W 111\P OF 11001JLE MA ltJ_1100lJLE

tlOOUL.E START ADIJRI:SS PARAGRAPH = FFFDH Of'FSET = 000611 SEGtiENT ~lAP

START ST>ll' LE:NGTH ALIGN NAME CL/155 UVCRI_AY

OOOOOH 0001311 0014H G INT PTR 00030H OOOF71i OOCI3H G STACK OOIOOH 00174H 0075H G DATA RAtl 002001i 0021'Fil OIOOH G USRSTIICK 00300H 003(lClH OOOOH G USRCOUE 00300H 00300H OOOOH G USRDATA OO:JOOH 00300H OOOOH G USREXTRA 00300H 00300H OOOOH G ??SEG FCOOOH FCDDCII ODDDH G CODE FF'IOOH FF9FCfl OOFDH G INT_SEG FFEOOH FFFI7H OIIBH G DATA SEG FFFDOH FFFEOH 0019H A ??LOCBb_INITCO CODE

-DE FFFFOH FFFF411 0005H A IADSOLUTEl

1-' p. ........

Page 157: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

Appendix D

Schematic

148

Page 158: CALIFORNIA STATE UNIVERSITY, NORTHRIDGE DESIGN OF 8086

149