M Eng 8086
M Eng 8086
MANUAL
A n Inte grate d D e ve lo pm e nt E nviro nm e nt kit
User's Manual
D o cum e ntatio n V e rsio n 9.1
The first 50 years of the 20th century witnessed the invention of the
internal combustion engine, which greatly extended the physical strength of
the human body.
In the second half of the century, the birth of the microprocessor further
extended our mental capabilities. Applications of this amazing product in
various industries have introduced so much impact on our lives, hence, it is
called the second industrial Revolution.
MDA-8086 Manual - 1 -
1. MDA-8086 SYSTEM CONFIGURATION
① C PU (C e ntral pro ce ssing unit) : U sing Inte l 8086, U sing 4.9152M hz.
③ SR A M (Static R ando m A cce ss M e m o ry) : Input use r's pro gram & data.
A ddre ss o f m e m o ry is 00000H ~0F F F F H , to tally 64K B yte .
⑥ SPE A KE R : A ble to te st so und using w ith spe ake r and furthe r m o re able
to te st synthe size r.
- 2 - MDA-8086 Manual
1. MDA-8086 SYSTEM CONFIGURATION
① Memory map
MDA-8086 Manual - 3 -
2. OPERATION INTRODUCTION
2. OPERATION INTRODUCTION
FUNCTION
DATA KEY
KEY
MON RES
GO STP C D E F
+ REG 8 9 A B
- DA 4 5 6 7
: AD 0 1 2 3
- 4 - MDA-8086 Manual
2-2. BASIC OPERATION
So as to use serial monitor, move jumper P1 which located on the PCB like
this.
◎ ◎ ◎ ◎ ◎ ◎
☞
P1 P1
KEYBOARD KEYBOARD
Whenever RES is pressed, the display becomes FIGURE 1-1 and user can
operate keyboard only in this situation.
MDA-8086 Manual - 5 -
2. OPERATION INTRODUCTION
KEY LCD
- 6 - MDA-8086 Manual
2-2. BASIC OPERATION
※ AD + -
, ,
MDA-8086 Kit ! !
Midas 2109-5964
If on a AD key,
KEY LCD
MDA-8086 Manual - 7 -
2. OPERATION INTRODUCTION
KEY LCD
MDA-8086 Kit ! !
RES
Midas 2109-5964
- 8 - MDA-8086 Manual
2-2. BASIC OPERATION
+
Seg. 0set data
0000 1001 FF
↓
Offset increment
+
Seg. 0set data
0000 1002 FF
↓
Offset increment
+
Seg. 0set data
0000 1003 FF
↓
Offset increment
+
Seg. 0set data
0000 1004 FF
↓
Offset increment
※ REG + -
, , KEY : Display to register contents.
KEY LCD
AX=0000 BX=0000
RES
CX=0000 DX=0000
↓
Current register contents.
MDA-8086 Manual - 9 -
3. EXAMPLE PROGRAM
SP=0540 BP=0000
+
SI=0000 DI=0000
DS=0000 ES=0000
+
SS=0000 CS=0000
IP=1000 FL=0000
+
=....................
↓
Current register contents.
DS=0000 ES=0000
-
SS=0000 CS=0000
SP=0540 BP=0000
-
SI=0000 DI=0000
3. EXAMPLE PROGRAM
♣ STP Single Step
- 10 - MDA-8086 Manual
3. EXAMPLE PROGRAM
2 It is valid only when the display is in current Flag form. Pressing "STP"
key causes the CPU to execute one instruction point according to the user's
PC. After execution, the monitor regains control and displays the new PC and
its contents. The user may examine and modify registers and memory
contents after each step.
KEY LCD
MDA-8086 Kit ! !
RES
Midas 2109-5964
1) MOV AX, 0
(Next address)
↓
MDA-8086 Manual - 11 -
3. EXAMPLE PROGRAM
Result verify !
+ AX=0000 BX=0000
CX=0000 DX=0000
↓
Current Register content
2) SHAF
(Next address)
↓
- 12 - MDA-8086 Manual
3. EXAMPLE PROGRAM
Result verify !
+ AX=DF99 BX=0000
CX=0000 DX=0000
7) SUB AX, 3567H
(Next address)
↓
STP IP=1012 FL=0180
=. . . t s . . . .
Result verify !
AX=AA32 BX=0000
+ CX=0000 DX=0000
MDA-8086 Manual - 13 -
3. EXAMPLE PROGRAM
Result verify !
+ AX=B1FF BX=0000
CX=0000 DX=0000
12) INC AL
(Next address)
↓
STP IP=101E FL=0155
=. . . t . z a p c
Result verify !
AX=B100 BX=0000
+ CX=0000 DX=0000
13) DEC AL
(Next address)
↓
STP IP=1020 FL=0195
=. . . t s . a p c
Result verify !
AX=B1FF BX=0000
+ CX=0000 DX=0000
14) CBW
(Next address)
↓
STP IP=1021 FL=0195
=. . . t s . a p c
Result verify !
AX=FFFF BX=0000
+ CX=0000 DX=0000
15) NEG AL
(Next address)
↓
STP IP=1023 FL=0111
=. . . t . . a . c
Result verify !
AX=FF01 BX=0000
+ CX=0000 DX=0000
16) MOV AL, F0H
(Next address)
↓
STP IP=1025 FL=0111
=. . . t . . a . c
- 14 - MDA-8086 Manual
3. EXAMPLE PROGRAM
Result verify !
+ AX=FFF0 BX=0000
CX=0000 DX=0000
17) MOV BL, 11H
(Next address)
↓
STP IP=1027 FL=0111
=. . . t . . a . c
Result verify !
AX=FFF0 BX=0011
+ CX=0000 DX=0000
18) MUL BL
(Next address)
↓
STP IP=1029 FL=0905
=o. . t . . . p c
Result verify !
AX=0FF0 BX=0011
+ CX=0000 DX=0000
19) MOV AX, F000H
(Next address)
↓
STP IP=102C FL=0905
=o. . t . . . p c
Result verify !
AX=F000 BX=0011
+ CX=0000 DX=0000
MDA-8086 Manual - 15 -
3. EXAMPLE PROGRAM
Result verify !
+ AX=C000 BX=1234
CX=0000 DX=FEDC
22) MOV AX, 00F0H
(Next address)
↓
STP IP=1034 FL=0985
=o. . t s . . p c
Result verify !
AX=00F0 BX=1234
+ CX=0000 DX=FEDC
- 16 - MDA-8086 Manual
3. EXAMPLE PROGRAM
Result verify !
AX=FFFF BX=1210
+
CX=0000 DX=FFFF
27) MOV BX, 1
(Next address)
↓
IP=1041 FL=0145
STP
=. . . t . z . p c
Result verify !
AX=FFFF BX=0001
+
CX=0000 DX=FFFF
28) IDIV BX
(Next address)
↓
IP=1043 FL=0144
STP
=. . . t . z . p .
Result verify !
AX=FFFF BX=0001
+
CX=0000 DX=0000
MDA-8086 Manual - 17 -
4. SERIAL MONITOR
4. Serial Monitor
Serial monitor is the basic monitor program to do data communicate between
MDA-8086 and computer.
┃ ┃ ┃ ☞ ┃ ┃ ┃
◎ ◎ ◎ ◎ ◎ ◎
P1 P1
KEYBOARD KEYBOARD
A:\>INSTALL A: C:
↑Destination drive
ⓑ Then the screen will be clear and will be displayed like follow, later install
will be completed. If there is a same directory name(8086 in here) at
destination drive installation is impossible so change existing directory to other
name.
- 18 - MDA-8086 Manual
3. EXAMPLE PROGRAM
INSTALLING A: TO C:\8086
copy now..
Wait...
( Later the screen will be clear and following message will be appeared )
Install OK.
Move JP1 to serial monitor status and if on a power-up or pressing RES key,
following message will be displayed on LCD and data communication is possible
with computer.
Serial Monitor !
Midas 2109-5964
MDA-8086 Manual - 19 -
4. SERIAL MONITOR
or
C:\8086>COMM
- 20 - MDA-8086 Manual
4-4. HOW TO CONNECT COMPUTER ?
<Line setting>
Change OK (Y/N) ? y
MDA-8086 Manual - 21 -
4. SERIAL MONITOR
- 22 - MDA-8086 Manual
4-5. OPERATION SERIAL MONITOR COMMAND
8086 >?
HELP COMMAND
E segment : offset...................: Enter Data To Memory
D segment : offset length............: Dump Memory Contents
R [register name]..................: Register Display & Change
M address1, length, address2........: Move Memory From 1 to 2
F address, length, data..............: Fill Memory With Any Data
L Return key.......................: Program Down Load
G segment : offset...................: Execute Program
T..................................: Program 1 step execute
Segment Offset
↓ ↓
8086 >E 0000:1000
0000:1000 FF ? 11
0000:1001 FF ? 22
0000:1002 FF ? 33
0000:1003 FF ? 44
0000:1004 FF ? 55
0000:1005 FF ? / ← (Offset decrement)
0000:1004 55 ? /
0000:1003 44 ? . ← (Escaping command)
Segment Offset
↓ ↓
8086 >D 0000:1000
0000:1000 11 22 33 44 55 FF FF FF - FF FF FF FF FF FF FF FF ."3DU...........
0000:1010 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
0000:1020 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
0000:1030 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
0000:1040 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
0000:1050 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
0000:1060 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
0000:1070 FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF ................
8086 > Display the ASCII code to data
MDA-8086 Manual - 23 -
4. SERIAL MONITOR
☞ Verifying ?
8086 >D 0000:1000
0000:1000 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1010 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1020 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1030 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1040 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1050 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1060 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1070 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
8086 >D
0000:1080 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:1090 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:10A0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:10B0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:10C0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:10D0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:10E0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:10F0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
The M command is used to move blocks of memory from one area to another.
☞ Resulting ?
8086 >D 2000
0000:2000 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2010 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
- 24 - MDA-8086 Manual
4-5. OPERATION SERIAL MONITOR COMMAND
0000:2020 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2030 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2040 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2050 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2060 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2070 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
8086 >D
0000:2080 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:2090 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:20A0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:20B0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:20C0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:20D0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:20E0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
0000:20F0 12 34 12 34 12 34 12 34 - 12 34 12 34 12 34 12 34 .4.4.4.4.4.4.4.4
8086 >R
AX=0000 BX=0000 CX=0000 DX=0000
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=1000 FL=0000 = . . . . . . . . .
MDA-8086 Manual - 25 -
4. SERIAL MONITOR
☞ Resulting ?
8086 >R
AX=1234 BX=4567 CX=7788 DX=1111
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=1000 FL=0000 = . . . . . . . . .
8086 >R IP
IP=1000
8086 >
The L command moves object data in hexa format from an external devices to
memory.
8086 >L
Down load start !! ← ( Note : See section 5. Serial monitor experiment)
:14100000B83412BB7856B90010BA00208BF08BFBBD0030BC08
:0910140000408EDA8ED18EC0CCB2
:00
OK Completed !!
8086 >
☞ Set IP
8086 >R IP
IP=1000
- 26 - MDA-8086 Manual
4-5. OPERATION SERIAL MONITOR COMMAND
8086 >T
AX=1234 BX=4567 CX=7788 DX=1111
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=1003 FL=0100 = . . . t . . . . .
↓
Next address
8086 >T
AX=1234 BX=5678 CX=7788 DX=1111
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=1006 FL=0100 = . . . t . . . . .
8086 >T
AX=1234 BX=5678 CX=1000 DX=1111
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=1009 FL=0100 = . . . t . . . . .
↓
Next address
8086 >T
AX=1234 BX=5678 CX=1000 DX=2000
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=100C FL=0100 = . . . t . . . . .
Segment Offset
↓ ↓
8086 >G 0000:1000
Execute Address = 0000:1000
。
。
。
8086 >
8086 >
MDA-8086 Manual - 27 -
5. SERIAL MONITOR EXPERIMENT
For develop the program more efficiently, make source file using with editor
program of computer then assembling this file and make HEX(Intel file format),
down-load to MDA-8086 using with serial monitor. ( See the following example
program)
- 28 - MDA-8086 Manual
5. SERIAL MONITOR EXPERIMENT
DW 7856H
DW 0CDABH
DW 14F0H
DW 5368H
DW 0C4B1H
DW 2010H
;
CODE ENDS
END
C:\8086>
MDA-8086 Manual - 29 -
5. SERIAL MONITOR EXPERIMENT
C:\8086>LOD186
Paragon LOD186 Loader - Version 4.0h
Copyright (C) 1983 - 1986 Microtec Research Inc.
ALL RIGHT RESERVED.
**LOAD COMPLETE
C:\8086>
8086 >L
Down load start !!
- 30 - MDA-8086 Manual
5. SERIAL MONITOR EXPERIMENT
OK completed
8086 >
7 Using T command
8086 >
☞ Set IP
8086 >R IP
IP=1000
MDA-8086 Manual - 31 -
5. SERIAL MONITOR EXPERIMENT
8086 >T ← MOV DS, AX , MOV ES, AX, MOV BX, OFFSET DATA
AX=0000 BX=2000 CX=0000 DX=0000
SP=0540 BP=0000 SI=0000 DI=0000
DS=0000 ES=0000 SS=0000 CS=0000
IP=100A FL=0100 = . . . t . . . . .
- 32 - MDA-8086 Manual
5. SERIAL MONITOR EXPERIMENT
MDA-8086 Manual - 33 -
6. 8086 INTERRUPT SYSTEM
1. Predefined interrupts
2. User-defined software interrupts
3. User-defined hardware interrupts
The interrupt vector address for all the 8086 interrupts are determined from
a table stored in locations 00000H through 003FFH. The starting addresses for
the service routines for the interrupts are obtained by the 8086 using this
table. Four bytes of the table are assigned to each interrupt: two bytes for IP
and two bytes for CS. The table may contain up to 256 8-bit vectors. If fewer
than 256 interrupts are defined in the system, the user need only provide
enough memory for the interrupt pointer table for obtaining the defined
interrupts.
The interrupt address vector (contents of IP and CS) for all the interrupts of
the 8086 assigns every interrupt a type code for identifying the interrupt.
There are 256 type codes associated with 256 table entires. Each entry
consists of two addresses, one for storing the IP contents and the other for
storing the CS contents. Each 8086 interrupt physical address vector is 20 bits
wide and is computed from the 16-bit contents of IP and CS.
For obtaining an interrupt address vector, the 8086 calculates two addresses
in the pointer table where IP and CS are stored for a particular interrupt type.
For example, for the interrupt type nn(instruction INT nn), the table address
for IP=4×nn and the table address for CS=4×nn+2. For servicing the 8086's
nonmaskable interrupt (NMI pin), the 8086 assigns the type code 2 to this
interrupt. The 8086 automatically executes the INT2 instruction internally to
obtain the interrupt address vector as follows:
The 8086 loads the values of IP and CS from the 20-bit physical address
00008H and 0000AH in the pointer table. The user must store the desired
16-bit values of IP and CS in these locations. Similarly, the IP and CS values
for other interrupts are calculated. The 8086 interrupt pointer table layout is
shown in table 6-1.
- 34 - MDA-8086 Manual
6-1. PREDEFINED INTERRUPTS (0 TO 4)
In response to an interrupt, the 8086 pushes flags, CS, and IP onto the
stack, clears TF and IF flags, and then loads IP and CS from the pointer table
using the type code.
Interrupt service routine should be terminated with the IRET( Interrupt
Return) instruction which pops the top three stack words into IP, CS, and flags,
thus returning to the right place in the main program. The 256 interrupt type
codes are assigned as follows;
The predefined interrupts include DIVISION ZERO (type 0), SINGLE STEP
(type 1), NONMASKABLE INTERRUPT pin(type 2), BREAKPOINT INTERRUPT
(type 3), and INTERRUPT ON OVERFLOW (type 4). The user must provide the
desired IP and CS values in the interrupt pointer table. The user may also
imitate these interrupts through hardware or software. If a predefined interrupt
is not used in a system, the user may assign some other function to the
associated type.
MDA-8086 Manual - 35 -
6. 8086 INTERRUPT SYSTEM
Note that in the above [BP+0] rather than [BP] is used since BP cannot be
used without displacement. Now, to set TF, the AND instruction in the above
should be replaced by OR [BP+0], 0100H.
Once TF is set to one, the 8086 automatically generates a TYPE 1 interrupt
after execution of each instruction. The user can write a service routine at the
interrupt address vector to display memory locations and/or register to debug a
program. Single step is nonmaskable and cannot be enabled by STI (enable
interrupt) or CLI (disable interrupt) instruction. The nonmaskable interrupt is
initiated via the 8086 NMI pin.
It is edge triggered (LOW to HIGH) and must be active for two clock cycles
to guarantee recognition. It is normally used for catastrophic failures such as
power failure. The 8086 obtains the interrupt vector address by automatically
executing the INT2(type 2) instruction internally.
Type 3 interrupt is used for breakpoint and is nonmaskable. The user inserts
the one-byte instruction INT3 into a program by replacing an instruction.
Breakpoints are useful for program debugging.
The INTERRUPT ON OVERFLOW is a type 4 interrupt. This interrupt occurs
if the overflow flag(OF) is set and the INT0 instruction is expected. The
overflow flag is affected, for example, after execution of signed arithmetic such
as MULS (signed multiplication) instruction. The user can execute the INTO
instruction after the MULS. If there is an overflow, an error service routine
written by the user at the type 4 interrupt address vector is executed.
- 36 - MDA-8086 Manual
6-2. INTERRUPT EXPERIMENT
; FILENAME : INT1.ASM
; PROCESSOR : I8086
; FILENAME : INT2.ASM
; PROCESSOR : I8086
MDA-8086 Manual - 37 -
6. 8086 INTERRUPT SYSTEM
; FILENAME : INT3.ASM
; PROCESSOR : I8086
- 38 - MDA-8086 Manual
6-4. 8259A INTERRUPT CONTROL
101D 90 NOP
101E CC INT 3
;
101F 03 C3 INT_SER: ADD AX,BX
1021 CF IRET
;
1022 CODE ENDS
END
MDA-8086 Manual - 39 -
7. 8253 INTERFACE
7. 8253 INTERFACE
The 8253 solves one of the most common problems in any microcomputer
system, the generation of accurate time delays under software control. Instead
of setting up timing loops in systems software, the programmer configures the
8253 to match his requirements, initialize one of the counters of the 8253 with
the desired quantity, then upon command the 8253 will count out the delay and
interrupt the CPU when it has completed its tasks. It is easy to see that the
software overhead is finial and that multiple delays can easily be maintained by
assignment of priority levels.
Other counter/timer functions that are non-delay in nature but also common
to most microcomputers can be implemented with the 8253.
- 40 - MDA-8086 Manual
7. 8253 INTERFACE
; FILENAME : D8253.ASM
; PROCESSOR : I8086
MDA-8086 Manual - 41 -
7. 8253 INTERFACE
- 42 - MDA-8086 Manual
7. 8253 INTERFACE
102D EB FD JMP L2
;
102F CC INT 3
;
;
1030 INT_SER:
1030 D0 E4 SHL AH,1
1032 F6 C4 10 TEST AH,00010000B
1035 75 06 JNZ L1
1037 80 CC F0 OR AH,11110000B
103A EB 03 90 JMP L3
; LED out
103D B4 F1 L1: MOV AH,11110001B
103F 8A C4 L3: MOV AL,AH
1041 E6 1B OUT PPIB,AL
;
1043 50 PUSH AX
1044 B8 FFFF MOV AX,0FFFFH
1047 E6 0B OUT CTC1,AL
1049 8A C4 MOV AL,AH
104B E6 0B OUT CTC1,AL
104D 58 POP AX
; EOI command
104E B0 20 MOV AL,00100000B
1050 E6 10 OUT INTA,AL
1052 FB STI
1053 CF IRET
;
1054 P_INIT PROC NEAR
1054 50 PUSH AX
1055 B0 70 MOV AL,01110000B
1057 E6 0F OUT CTCC,AL
;
1059 B8 FFFF MOV AX,0FFFFH
105C E6 0B OUT CTC1,AL
105E 8A C4 MOV AL,AH
1060 E6 0B OUT CTC1,AL
1062 58 POP AX
1063 C3 RET
1064 P_INIT ENDP
;
1064 INIT PROC NEAR
; ICW1
MDA-8086 Manual - 43 -
7. 8253 INTERFACE
- 44 - MDA-8086 Manual
PART II :
MDA-8086 EXPERIMENTS
(SOFTWARE/HARDWARE)
TABLE OF CONTENTS
MDA-8086 Manual - 49 -
EXPERIMENT 1. 8255A INTERFACE
; FILENAME : LED.ASM
; PROCESSOR : I8086
- 50 - MDA-8086 Manual
1-1. LED & 7-SEGMENT
102B 59 POP CX
102C E2 F3 LOOP TIMER2
102E C3 RET
;
102F CODE ENDS
END
MDA-8086 Manual - 51 -
EXPERIMENT 2. DOT-MATRIX LED
General description :
The KMD D1288C is 1.26 inch height 3mm diameter and 8 × 8 dot matrix
LED displays. The KMD D1288C are dual emitting color type of red, green
chips are contained in a dot with milky and white lens color.
- 52 - MDA-8086 Manual
2-2. DOT MATRIX LED INTERFACE
MDA-8086 Manual - 53 -
EXPERIMENT 2. DOT-MATRIX LED
◉ ◉
◉ ◉
◉ ◉
P6
; FILENAME : MATRIX_1.ASM
; PROCESSOR : I8086
- 54 - MDA-8086 Manual
2-3. SPEAKER INTERFACE
;
100B B0 00 MOV AL,00000000B
100D E6 1A OUT PPIB,AL
;
100F B0 01 L1: MOV AL,00000001B
1011 E6 1C L2: OUT PPIC,AL
1013 E8 101E R CALL TIMER
1016 F8 CLC
1017 D0 C0 ROL AL,1
1019 73 F6 JNC L2
101B EB F2 JMP L1
;
101D CC INT 3
;
101E B9 FFFF TIMER: MOV CX,0FFFFH
1021 90 TIMER1: NOP
1022 90 NOP
1023 90 NOP
1024 90 NOP
1025 E2 FA LOOP TIMER1
1027 C3 RET
;
1028 CODE ENDS
END
MDA-8086 Manual - 55 -
EXPERIMENT 2. DOT-MATRIX LED
; FILENAME : SPEAKER.ASM
; PROCESSOR : I8086
- 56 - MDA-8086 Manual
2-3. SPEAKER INTERFACE
MDA-8086 Manual - 57 -
EXPERIMENT 3. 8251A INTERFACE
The 8251A incorporates all the key features of the 8251 and has the
following additional features and enhancements;
◐ 8251A has double-buffered data paths with separate I/O registers for
control, status, Data in, and Data out, which considerably simplifies control
programming and minimizes CPU overhead.
- 58 - MDA-8086 Manual
EXPERIMENT 3. 8251A INTERFACE
; FILENAME : D8251A.ASM
; PROCESSOR : I8086
MDA-8086 Manual - 59 -
EXPERIMENT 3. 8251A INTERFACE
- 60 - MDA-8086 Manual
EXPERIMENT 3. 8251A INTERFACE
MDA-8086 Manual - 61 -
EXPERIMENT 4. LCD DISPLAY
4-1. LCD
* 16 CHARACTERS × 2 LINE MODULE
1) PHYSICAL DATA
2) Pin Connections
- 62 - MDA-8086 Manual
4-1. LCD
3) INSTRUCTION
Execution
CODE time(max)
Instruction Description
fosc is
RS R/W D7 D6 D5 D4 D3 D2 D1 D0 250 KHz
Clear display 0 0 0 0 0 0 0 0 0 1 Clears entire display 1.64 ㎳
Returns display being
Return
0 0 0 0 0 0 0 0 1 * shifted to original 1.64 ㎳
Home
position
Sets cursor move
Entry
0 0 0 0 0 0 0 1 I/D S direction and specifies 40 ㎲
Mode set
shift of display
Display D : Display ON/OFF
ON/OFF 0 0 0 0 0 0 1 D C B C : Cursor ON/OFF 40 ㎲
Control B : Cursor Blink/Not
Cursor or S /R / Moves cursor and
0 0 0 0 0 1 * * 40 ㎲
Display Shift C L Shifts display
Function Set 0 0 0 0 1 DL N F * * Refer to Remark 40 ㎲
Set CGRAM 0 0 0 1 ACG Sets CG RAM Addr. 40 ㎲
Set DD Sets DD RAM
0 0 1 ADD 40 ㎲
RAM Addr. Address
Read Busy BF : Busy flag
0 1 BF AC 40 ㎲
Flag & Addr Reads AC contents.
Write Data Writes data into DD
1 0 Write data 40 ㎲
CG or DD RAM or CG RAM
Read Data Reads data from DD
from CG 1 1 Read data RAM or CG RAM 40 ㎲
or DD RAM
I/D= 1: Increment 0: Decrement DD RAM : Display data RAM
S= 1: Accompanies display shift CG RAM : Character generator
S/C=1:Display shift. 0:cursor move RAM
Remark R/L=1:Shift right. 0: Shift left. ACG : CG RAM address
DL= 1 : 8bits 0 : 4 bits ADD : DD RAM address
N = 1 : 2 lines 0 : 1 lines Corresponds to cursor
F = 1 : 5×10dots 0 : 5×7dots address
BF = 1: Internally operating AC : Address counter used
0: Can accept instruction for both DD and CG
* NO EFFECT RAM address
MDA-8086 Manual - 63 -
EXPERIMENT 4. LCD DISPLAY
4) INITIALIZATION SEQUENCE
POWER ON
⇓
Wait till VCC is 4.5V min
⇓
RS = 0, WRITE 38H *1 ( Execution time : 40 ㎲ )
⇓
RS = 0, WRITE 0EH ( Execution time : 40 ㎲ )
⇓
RS = 0, WRITE 08H ( Execution time : 40 ㎲ )
⇓
RS = 0, WRITE 02H ( Execution time : 1.64 ㎳ )
⇓
RS = 0, WRITE 01H ( Execution time : 1.64 ㎳ )
⇓
RS = 0, WRITE ADDR. *2 ( Execution time : 40 ㎲ )
⇓
RS = 1, WRITE DATA *3 ( Execution time : 40 ㎲ )
- 64 - MDA-8086 Manual
4-1. LCD
MDA-8086 Manual - 65 -
EXPERIMENT 4. LCD DISPLAY
; FILENAME : LCD_2.ASM
; PROCESSOR : I8086
- 66 - MDA-8086 Manual
4-2. LCD INTERFACE
;
1000 33 C0 XOR AX,AX
1002 8E D0 MOV SS,AX
1004 BC 0540 MOV SP,STACK
;
1007 E8 1031 R CALL ALLCLR
;
100A E8 1036 R CALL ENTMODE
100D E8 103B R L1: CALL CUSOR1
1010 BE 1018 R MOV SI,OFFSET DATA
1013 E8 1054 R CALL STRING
1016 EB F5 JMP L1
;
1018 38 30 38 36 20 54 DATA DB '8086 Training Kit Good !',00H
72 61 69 6E 69 6E
67 20 4B 69 74 20
47 6F 6F 64 20 21
00
;
; LCD instruction
1031 B4 01 ALLCLR: MOV AH,01H
1033 EB 08 90 JMP LNXX
;
1036 ENTMODE:
1036 B4 07 MOV AH,00000111B
1038 EB 03 90 JMP LNXX
;
103B B4 90 CUSOR1: MOV AH,90H
;
103D E8 1045 R LNXX: CALL BUSY
1040 8A C4 MOV AL,AH
1042 E6 00 OUT LCDC,AL
1044 C3 RET
; busy flag check
1045 E4 02 BUSY: IN AL,LCDC_S
1047 24 80 AND AL,10000000B
1049 75 FA JNZ BUSY
104B C3 RET
;
; 1 char. LCD OUT
; AH = out data
104C CHAROUT:
104C E8 1045 R CALL BUSY
MDA-8086 Manual - 67 -
EXPERIMENT 4. LCD DISPLAY
;
104F 8A C4 MOV AL,AH
1051 E6 04 OUT LCDD,AL
1053 C3 RET
;
1054 2E: 8A 24 STRING: MOV AH,BYTE PTR CS:[SI]
1057 80 FC 00 CMP AH,00H
105A 74 0C JE STRING1
; out
105C E8 1045 R CALL BUSY
105F E8 104C R CALL CHAROUT
1062 46 INC SI
1063 E8 1069 R CALL TIMER
1066 EB EC JMP STRING
1068 STRING1:
1068 C3 RET
;
1069 B9 0001 TIMER: MOV CX,1
106C 51 TIMER2: PUSH CX
106D B9 0000 MOV CX,0
1070 90 TIMER1: NOP
1071 90 NOP
1072 90 NOP
1073 90 NOP
1074 E2 FA LOOP TIMER1
1076 59 POP CX
1077 E2 F3 LOOP TIMER2
1079 C3 RET
;
107A CODE ENDS
END
- 68 - MDA-8086 Manual
5-1. KEYBOARD INTERFACE
Key 0 1 2 3 4 5 6 7
Code 00 01 02 03 04 05 06 07
Key 8 9 A B C D E F
Code 08 09 0A 0B 0C 0D 0E 0F
Key : STP GO REG - + DA AD
Code 10 11 12 13 14 15 16 17
START
AL ← ( )
; Read Flag Status
Flag port
NO
Flag ON? ; Check Flag Bit
YES
AL ← ( )
; Data In from keyboard
Keyboard
END
MDA-8086 Manual - 69 -
EXPERIMENT 5. KEYBOARD INTERFACE
SCAN: IN AL,KEY
TEST AL,10000000B
JNZ SCAN
;
- 70 - MDA-8086 Manual
5-1. KEYBOARD INTERFACE
AND AL,00011111B
MOV BX,0
MOV DS,BX
MOV BYTE PTR K_BUF,AL
; KEY CLEAR
OUT KEY,AL
; SPEAKER AND LED ON?
CALL TONE
RET
;
TONE: PUSH CX
PUSH AX
;
MOV AH,50
MOV AL,1
TONE2: MOV CX,200
OUT SPK,AL
TONE1: LOOP TONE1
XOR AL,1
DEC AH
JNZ TONE2
;
XOR AL,AL
OUT SPK,AL
;
POP AX
POP CX
RET
MDA-8086 Manual - 71 -
EXPERIMENT 6. D/A CONVERTER
- 72 - MDA-8086 Manual
6-1. D/A CONVERTER SPECIFICATION
MDA-8086 Manual - 73 -
EXPERIMENT 6. D/A CONVERTER
- 74 - MDA-8086 Manual
6-3. D/A CONVERTER EXPERIMENT
◉ ◉
◉ ◉
◉ ◉ ◉ ◉ ◉
P8 P6
; FILENAME : DAC.ASM
; PROCESSOR : I8086
MDA-8086 Manual - 75 -
EXPERIMENT 6. D/A CONVERTER
;
101C B9 0001 TIMER: MOV CX,1
101F 51 TIMER2: PUSH CX
1020 B9 0000 MOV CX,0
1023 90 TIMER1: NOP
1024 90 NOP
1025 90 NOP
1026 90 NOP
1027 E2 FA LOOP TIMER1
1029 59 POP CX
102A E2 F3 LOOP TIMER2
102C C3 RET
;
102D CODE ENDS
END
- 76 - MDA-8086 Manual
7-1. A/D CONVERTER SPECIFICATION
MDA-8086 Manual - 77 -
EXPERIMENT 7. A/D CONVERTER
- 78 - MDA-8086 Manual
7-3. A/D CONVERTER EXPERIMENT
DIP2
◉ ◉
◉ ◉
◉ ◉
P6
MDA-8086 Manual - 79 -
EXPERIMENT 7. A/D CONVERTER
; FILENAME : ADC.ASM
; PROCESSOR : I8086
- 80 - MDA-8086 Manual
7-3. A/D CONVERTER EXPERIMENT
MDA-8086 Manual - 81 -
EXPERIMENT 7. A/D CONVERTER
;
1080 02 C2 ADD AL,DL
1082 27 DAA
1083 8A D0 MOV DL,AL
;
1085 8A C4 MOV AL,AH
1087 02 C6 ADD AL,DH
1089 27 DAA
108A 8A F0 MOV DH,AL
108C C3 RET
;
108D 00 00 L_TAB: DB 00H,00H
108F 00 20 DB 0,20H
1091 00 40 DB 0,40H
1093 00 60 DB 0,60H
1095 00 80 DB 0,80H
1097 01 00 DB 01H,00H
1099 01 20 DB 01H,20H
109B 01 40 DB 01H,40H
109D 01 60 DB 01H,60H
109F 01 80 DB 01H,80H
10A1 02 00 DB 02H,00H
10A3 02 20 DB 02H,20H
10A5 02 40 DB 02H,40H
10A7 02 60 DB 02H,60H
10A9 02 80 DB 02H,80H
10AB 03 00 DB 03H,00H
;
10AD 00 00 H_TAB: DB 0,0
10AF 03 20 DB 03H,20H ;0.320V
10B1 06 40 DB 06H,40H
10B3 09 60 DB 09H,60H
10B5 12 80 DB 12H,80H
10B7 16 00 DB 16H,00H
10B9 19 20 DB 19H,20H
10BB 22 40 DB 22H,40H
10BD 25 60 DB 25H,60H
10BF 28 80 DB 28H,80H
10C1 32 00 DB 32H,00H
10C3 35 20 DB 35H,20H
10C5 38 40 DB 38H,40H
10C7 41 60 DB 41H,60H
10C9 44 80 DB 44H,80H
- 82 - MDA-8086 Manual
7-3. A/D CONVERTER EXPERIMENT
MDA-8086 Manual - 83 -
EXPERIMENT 7. A/D CONVERTER
- 84 - MDA-8086 Manual
8-1. STEPPING MOTOR SPECIFICATION
The stepping motor is a device which can transfer the incoming pulses to
stepping motion of a predetermined angular displacement. By using suitable
control circuity the angular displacement can be made proportional to the
number of pulses. Using microcomputer, one can have better control of the
angular displacement resolution and angular speed of a stepping motor. In the
past few years the stepping motor has improved in size reduction, speed and
precision. Stepping motor will have wider applications in the future.
Motor type
PM VR Hybrid
Characteristics
Efficiency High Low High
Rotor Inertia High Low Low
Speed High High Low
Torque Fair Low High
Power O/P High Low Low
Damping Good Poor Poor
Typical 1.8° 7.5° 0.18°
Step 15° 15° 0.45°
Angle 30° 30°
MDA-8086 Manual - 85 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
Commercial stepping motor uses multimotor rotor, the rotor features two
bearlike PM cylinders that are turned one-half of tooth spacing. One gear is
south pole, the other gear is north pole. If a 50-tooth rotor gear is used, the
following movement sequences will proceed.
A. single-phase excitation:
The stepping position will be 0°,1.8°, 3.6°, ....... 358.2°, total 200 steps
in one round.
B. two-phase excitation:
The stepping positions will be 0.9°, 2.7°, 4.5°, ..... 359.1°, total 200
steps in one round.
The stepping positions will be 0°, 0.9°, 1.8°, 2.7°, 3.6°, 4.5°, ...............
358.2°, 359.1°, total 400 steps in one round.
- 86 - MDA-8086 Manual
8-1. STEPPING MOTOR SPECIFICATION
A B A_ B_
STEP 1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
5 1 0 0 0
6 0 1 0 0
7 0 0 1 0
8 0 0 0 1
(a) 1-phase excitation
A B A_ B_ A B A_ B_
STEP 1 1 1 0 0 STEP 1 1 0 0 0
2 0 1 1 0 2 1 1 0 0
3 0 0 1 1 3 0 1 0 0
4 1 0 0 1 4 0 1 1 0
5 1 1 0 0 5 0 0 1 0
6 0 1 1 0 6 0 0 1 1
7 0 0 1 1 7 0 0 0 1
8 1 0 0 1 8 1 0 0 1
CCV CV
(b) 2-phase excitation (c) 1-2 phase excitation
MDA-8086 Manual - 87 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
- 88 - MDA-8086 Manual
8-3. STEPPING MOTOR EXPERIMENT
; FILENAME : STEPMO_1.ASM
; PROCESSOR : I8086
MDA-8086 Manual - 89 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
;
100F 33 C0 XOR AX,AX
1011 26: 89 47 02 MOV WORD PTR ES:[BX+2],AX
;
1015 E8 125B R CALL INIT
1018 E8 124B R CALL P_INIT
;
101B B0 80 MOV AL,10000000B
101D E6 1F OUT PPIC_C,AL
;
101F B0 FF MOV AL,11111111B
1021 E6 19 OUT PPIA,AL
1023 B0 00 MOV AL,00000000B
1025 E6 1D OUT PPIC,AL
;
1027 E8 126C R CALL ALLCLR
;
;
102A BE 11C5 R MOV SI,OFFSET DATA
102D E8 128A R CALL STRING
;
1030 E8 1271 R CALL LN21
1033 BE 11D6 R MOV SI,OFFSET DATA1
1036 E8 128A R CALL STRING
; CLEAR
1039 BB 0000 MOV BX,0
103C 89 1E 12B4 R MOV WORD PTR SPD_BUF,BX
1040 88 1E 12B1 R MOV BYTE PTR P_CONT,BL
1044 88 1E 12B2 R MOV BYTE PTR FULS_STR,BL
;
1048 E6 01 MAIN: OUT KEY,AL
104A FB STI
104B E8 129C R CALL SCAN
104E FA CLI
104F A0 12B0 R MOV AL,BYTE PTR K_BUF
;
1052 3C 00 CMP AL,0
1054 75 03 JNE MAIN1
1056 E9 1122 R JMP L_45
;
1059 3C 01 MAIN1: CMP AL,1
105B 74 23 JE R_45
;
- 90 - MDA-8086 Manual
8-3. STEPPING MOTOR EXPERIMENT
MDA-8086 Manual - 91 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
- 92 - MDA-8086 Manual
8-3. STEPPING MOTOR EXPERIMENT
74 69 6F 6E 00
;
;
1122 FA L_45: CLI
1123 B0 19 MOV AL,25
1125 A2 12B1 R MOV BYTE PTR P_CONT,AL
1128 B0 01 MOV AL,1
112A A2 12B3 R MOV BYTE PTR LR_FLAG,AL
;
112D E8 1271 R CALL LN21
1130 BE 113A R MOV SI,OFFSET L_45D
1133 E8 128A R CALL STRING
1136 FB STI
1137 E9 1048 R JMP MAIN
;
113A 4C 65 66 74 20 34 L_45D: DB 'Left 45 degree !',00H
35 20 64 65 67 72
65 65 20 21 00
;
114B FA L_90: CLI
114C B0 32 MOV AL,50
114E A2 12B1 R MOV BYTE PTR P_CONT,AL
1151 B0 01 MOV AL,1
1153 A2 12B3 R MOV BYTE PTR LR_FLAG,AL
;
1156 E8 1271 R CALL LN21
1159 BE 1163 R MOV SI,OFFSET L_90D
115C E8 128A R CALL STRING
115F FB STI
1160 E9 1048 R JMP MAIN
;
1163 4C 65 66 74 20 39 L_90D: DB 'Left 90 degree !',00H
30 20 64 65 67 72
65 65 20 21 00
;
1174 FA L_180: CLI
1175 B0 64 MOV AL,100
1177 A2 12B1 R MOV BYTE PTR P_CONT,AL
117A B0 01 MOV AL,1
117C A2 12B3 R MOV BYTE PTR LR_FLAG,AL
;
117F E8 1271 R CALL LN21
1182 BE 118C R MOV SI,OFFSET L_180D
MDA-8086 Manual - 93 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
- 94 - MDA-8086 Manual
8-3. STEPPING MOTOR EXPERIMENT
MDA-8086 Manual - 95 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
;
1247 PULSE_TBL:
1247 66 DB 01100110B
1248 33 DB 00110011B
1249 99 DB 10011001B
124A CC DB 11001100B
;
124B P_INIT PROC NEAR
124B 50 PUSH AX
124C B0 70 MOV AL,01110000B
124E E6 0F OUT CTCC,AL
;
1250 A1 12B4 R P_INIT1: MOV AX,WORD PTR SPD_BUF
1253 E6 0B OUT CTC1,AL
1255 8A C4 MOV AL,AH
1257 E6 0B OUT CTC1,AL
1259 58 POP AX
125A C3 RET
125B P_INIT ENDP
;
125B INIT PROC NEAR
; ICW1
125B B0 13 MOV AL,00010011B
125D E6 10 OUT INTA,AL
;ICW2 interrupt vector
125F B0 40 MOV AL,40H
1261 E6 12 OUT INTA2,AL
;ICW4
1263 B0 01 MOV AL,00000001B
1265 E6 12 OUT INTA2,AL
;
1267 B0 FE MOV AL,11111110B
1269 E6 12 OUT INTA2,AL
126B C3 RET
126C INIT ENDP
;
126C B4 01 ALLCLR: MOV AH,01H
126E EB 03 90 JMP LNXX
;
1271 B4 C0 LN21: MOV AH,0C0H
;
1273 E8 127B R LNXX: CALL BUSY
1276 8A C4 MOV AL,AH
- 96 - MDA-8086 Manual
8-3. STEPPING MOTOR EXPERIMENT
12A8 24 07 RET
12AA A2 12B0 R
12AD E6 01
12AF C3
;
MDA-8086 Manual - 97 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
SCAN ENDP
12B0 0001 K_BUF DB 1
12B1 0001 P_CONT: DB 1
12B2 0001 FULS_STR: DB 1
12B3 0001 LR_FLAG: DB 1
12B4 0002 SPD_BUF: DW 1
;
12B8 CODE ENDS
END
- 98 - MDA-8086 Manual
EXPERIMENT 9. C LANGUAGE
EXPERIMENT 9. C LANGUAGE
9-1. LED.C
MDA-8086 Manual - 99 -
EXPERIMENT 9, C LANGUAGE
9-2. FND.C
9-3. MATRIX.C
초기화
9-4. DAC.C
9-5. ADC.C
9-6. LCD.C
9-7. D8251A.C
9-8. D8253.C
9-9. I8259.C
9-10. STEPMO.C
Appendix
1. MDA-8086 Memory Circuit.
(a) 8086
(b) 8088
8086
REGISTER MODEL
OPERAND SUMMARY
"reg" fleld bit assignments :
mod Displacement
00 DISP : 0". disp-low and disp-high are absent
01 DISP : disp-low sign-extended to 16-bits. disp-high is absent
10 DISP = disp-high ; disp-low
11 r/w is treated as a "reg" field
00000H~0FFFFH RAM