Documente Academic
Documente Profesional
Documente Cultură
MANUAL
An Integrated Development Environment kit
User's Manual
Documentation Version 9.4
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
- 2 - MDA-8086 MANUAL
2-1 FUNCTION OF KEYS
⑧ DOT MATRIX LED : To understand & test the dot matrix structure and
principle of display. It is interfaced to 8255A(PPI).
MDA-8086 MANUAL - 3 -
1. MDA-8086 SYSTEM CONFIGURATION
① Memory map
ADDRESS MEMORY DESCRIPTION
00000H ~ 0FFFFH RAM PROGRAM & DATA MEMORY
F0000H ~ FFFFFH ROM MONITOR ROM
10000H ~ EFFFFH USER'S RANGE
- 4 - MDA-8086 MANUAL
2-1 FUNCTION OF KEYS
2. OPERATION INTRODUCTION
RES
GO STP C D E F
+ REG 8 9 A B
- DA 4 5 6 7
MON : AD 0 1 2 3
MDA-8086 MANUAL - 5 -
2. OPERATION INTRODUCTION
To select the Machine Code and Serial monitor mode with P1 switch.
SELECT SELECT
MODE MODE
G +5 G +5
☞
KIT PC KIT PC
P1 P1
- 6 - MDA-8086 MANUAL
2-2. BASIC OPERATION
KEY LCD
MDA-8086 MANUAL - 7 -
2. OPERATION INTRODUCTION
segment offset
[The contents of memory F000:1000
( It may be different)]
※ AD , + -
,
When the power is on or press the RES key, following message will be
displayed on LCD.
MDA-8086 Kit ! !
Midas 2109-5964
- 8 - MDA-8086 MANUAL
2-2. BASIC OPERATION
KEY LCD
segment +1 increment
[The contents of memory 0001:1000
( It may be different)]
segment +1 increment
[The contents of memory
0002:1000( It may be different)]
segment -1 increment
[The contents of memory 0001:1000
( It may be different)]
※ AD , : ,
HEXA-DIGIT KEY : Update to memory contents.
MDA-8086 MANUAL - 9 -
2. OPERATION INTRODUCTION
KEY LCD
MDA-8086 Kit ! !
RES
Midas 2109-5964
segment offset
[The contents of memory 0000:1000]
segment offset
[The contents of memory 0000:1000
(It may be different)]
+
Seg. 0set data
0000 1001 FF
Offset increment
- 10 - MDA-8086 MANUAL
2-2. BASIC OPERATION
+
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
SP=0540 BP=0000
+
SI=0000 DI=0000
MDA-8086 MANUAL - 11 -
2. OPERATION INTRODUCTION
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
- 12 - MDA-8086 MANUAL
2-2. BASIC OPERATION
3. EXAMPLE PROGRAM
MDA-8086 MANUAL - 13 -
3. EXAMPLE PROGRAM
;
1031 B8 F000 MOV AX, 00F0H
1034 B3 10 MOV BL, 10H
1036 F6 F3 DIV BL
;
1038 BA FFFF MOV DX, -1
103B B8 FFFF MOV AX, -1
103E BB 0100 MOV BX, 1
1041 F7 FB IDIV BX
;
1043 CC INT 3
KEY LCD
MDA-8086 Kit ! !
RES
Midas 2109-5964
segment offset
[The contents of memory 0000:1000]
- 14 - MDA-8086 MANUAL
3. EXAMPLE PROGRAM
1) MOV AX, 0
(Next address)
IP=1003 FL=0100
STP
=...t......
+ AX=0000 BX=0000
CX=0000 DX=0000
MDA-8086 MANUAL - 15 -
3. EXAMPLE PROGRAM
+ AX=DF99 BX=0000
CX=0000 DX=0000
7) SUB AX, 3567H
(Next address)
- 16 - MDA-8086 MANUAL
3. EXAMPLE PROGRAM
Result verify !
AX=2AED BX=0000
+ CX=0000 DX=0000
10) SBB AH, 78H
(Next address)
+ AX=B1FF BX=0000
CX=0000 DX=0000
12) INC AL
(Next address)
MDA-8086 MANUAL - 17 -
3. EXAMPLE PROGRAM
Result verify !
AX=FFFF BX=0000
+ CX=0000 DX=0000
15) NEG AL
(Next address)
+ AX=FFF0 BX=0000
CX=0000 DX=0000
17) MOV BL, 11H
(Next address)
- 18 - MDA-8086 MANUAL
3. EXAMPLE PROGRAM
Result verify !
AX=F000 BX=0011
+ CX=0000 DX=0000
20) MOV BX, 1234H
(Next address)
+ AX=C000 BX=1234
CX=0000 DX=FEDC
22) MOV AX, 00F0H
(Next address)
MDA-8086 MANUAL - 19 -
3. EXAMPLE PROGRAM
Result verify !
AX=000F BX=1210
+ CX=0000 DX=FEDC
25) MOV DX, -1
(Next address)
- 20 - MDA-8086 MANUAL
4-1 How to setup the serial monitor
4. Serial Monitor
Serial monitor is the basic monitor program to do data communicate
between MDA-8086 and your computer.
SELECT
MODE
G +5
KIT PC
P1
Serial monitor
MDA-8086 MANUAL - 21 -
4. SERIAL MONITOR
- 22 - MDA-8086 MANUAL
4-2 How to connect MDA-8086 to your PC
MDA-8086 MANUAL - 23 -
4. SERIAL MONITOR
- 24 - MDA-8086 MANUAL
4-3 Setup the configuration of "WinComm"
③ If "8086>" prompt is not displayed, click the "Set Serial Port" from the
"Option" menu.
MDA-8086 MANUAL - 25 -
4. SERIAL MONITOR
- 26 - MDA-8086 MANUAL
4-3 Setup the configuration of "WinComm"
MDA-8086 MANUAL - 27 -
4. SERIAL MONITOR
- 28 - MDA-8086 MANUAL
4-5 Assembling/Compiling the source
MDA-8086 MANUAL - 29 -
4. SERIAL MONITOR
- 30 - MDA-8086 MANUAL
4-6 Download and execute the source file
③ In the Files of types, select a source type from the drop-down list, as an
"ABS file".
④ Select the file to download.
( ie. c:∖Mda∖8086∖asm8086∖led.abs )
⑤ Click "Open" button.
MDA-8086 MANUAL - 31 -
4. SERIAL MONITOR
⑦ Type 'G' and "Enter" key to execute the program that you downloaded.
- 32 - MDA-8086 MANUAL
5. 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
MDA-8086 MANUAL - 33 -
5. Serial monitor command
0000:1004 FF ? 55
0000:1005 FF ? / (Offset decrement)
0000:1004 55 ? /
Segment Offset
Verify
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
- 34 - MDA-8086 MANUAL
5. Serial monitor command
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
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
MDA-8086 MANUAL - 35 -
5. Serial monitor command
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 = . . . . . . . . .
Result
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 = . . . . . . . . .
- 36 - MDA-8086 MANUAL
5. Serial monitor command
Trace command.
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
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
MDA-8086 MANUAL - 37 -
5. Serial monitor command
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 . . . . .
- 38 - MDA-8086 MANUAL
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:
MDA-8086 MANUAL - 39 -
6. 8086 INTERRUPT SYSTEM
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.
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;
- 40 - MDA-8086 MANUAL
6-1. PREDEFINED INTERRUPTS (0 TO 4)
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.
MDA-8086 MANUAL - 41 -
6. 8086 INTERRUPT SYSTEM
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. Break points 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.
; FILENAME : INT1.ASM
; PROCESSOR : I8086
- 42 - MDA-8086 MANUAL
6-2. INTERRUPT EXPERIMENT
1009 CC INT 3
;
100A CODE ENDS
END
; FILENAME : INT2.ASM
; PROCESSOR : I8086
MDA-8086 MANUAL - 43 -
6. 8086 INTERRUPT SYSTEM
; FILENAME : INT3.ASM
; PROCESSOR : I8086
- 44 - MDA-8086 MANUAL
6-4. 8259A INTERRUPT CONTROL
MDA-8086 MANUAL - 45 -
7. 8253 INTERFACE
7. 8253 INTERFACE
The 8253 is programmable interval timer/counter specifically designed for
use with the Intel Micro-computer systems. Its function is that of a gernal
purpose, multi-timing element that can be treated as an array of I/O ports
in the system software.
- 46 - MDA-8086 MANUAL
7. 8253 INTERFACE
☞ ☞ ☞
MDA-8086 MANUAL - 47 -
7. 8253 INTERFACE
; FILENAME : D8253.ASM
; PROCESSOR : I8086
- 48 - MDA-8086 MANUAL
7. 8253 INTERFACE
MDA-8086 MANUAL - 49 -
7. 8253 INTERFACE
- 50 - MDA-8086 MANUAL
7. 8253 INTERFACE
1074 C3 RET
1075 INIT ENDP
;
1075 CODE ENDS
END
MDA-8086 MANUAL - 51 -
7. 8253 INTERFACE
- 52 - MDA-8086 MANUAL
1-1. LED & 7-SEGMENT
☞ ☞ ☞ ☞
☞ ☞ ☞ ☞
; FILENAME : FND.ASM
; PROCESSOR : I8086
MDA-8086 MANUAL - 53 -
EXPERIMENT 1. 8255A INTERFACE
- 54 - MDA-8086 MANUAL
2-1 Dot-Matrix LED Display
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.
MDA-8086 MANUAL - 55 -
EXPERIMENT 2. DOT-MATRIX LED
- 56 - MDA-8086 MANUAL
2-2. DOT-MATRIX LED INTERFACE
● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯
● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯
● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯
●
●
●
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
☞ ◯
◯
◯
●
●
●
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
☞ ◯
◯
◯
◯
◯
◯
●
●
●
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
☞
● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯
● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯
◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯
◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯
◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
●
●
●
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
☞ ◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
●
●
●
◯
◯
◯
◯
◯
◯
◯
◯
◯
☞ ◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
●
●
●
◯
◯
◯
◯
◯
◯
☞
◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯
◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯
◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ●
◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ●
◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ●
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
●
●
●
◯
◯
◯
☞ ◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
◯
●
●
●
◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ●
◯ ◯ ◯ ◯ ◯ ◯ ● ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯ ●
◉ ◉
◉ ◉
◉ ◉
P6
; FILENAME : MATRIX_1.ASM
; PROCESSOR : I8086
ADDRESS MACHINE CODE MNEMONIC
0000 CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
;
= 001E PPIC_C EQU 1EH ; control register
= 001C PPIC EQU 1CH
MDA-8086 MANUAL - 57 -
EXPERIMENT 2. DOT-MATRIX LED
- 58 - MDA-8086 MANUAL
2-3. SPEAKER INTERFACE
; FILENAME : SPEAKE.ASM
; PROCESSOR : I8086
MDA-8086 MANUAL - 59 -
EXPERIMENT 2. DOT-MATRIX LED
;
= 0017 SPK EQU 17H
= 000C PER EQU 0CH ;0EH
;
1000 ORG 1000H
1000 BE 1023 R L1: MOV SI,OFFSET FREQ_TAB
1003 2E: 8A 34 L2: MOV DH,BYTE PTR CS:[SI]
1006 FE C6 INC DH
1008 74 F6 JZ L1
100A FE CE DEC DH
;
100C B2 0C MOV DL,PER
;
100E B0 FF MOV AL,0FFH
;
1010 E6 17 L3: OUT SPK,AL
1012 8A CE MOV CL,DH
1014 81 E1 00FF AND CX,00FFH
1018 E2 FE LOOP $
101A 34 01 XOR AL,01H
101C FE CA DEC DL
101E 75 F0 JNZ L3
1020 46 INC SI
1021 EB E0 JMP L2
;
1023 FREQ_TAB:
1023 25 DB 25H ;85H
1024 27 DB 27H ;7EH
1025 29 DB 29H ;77H
1026 2C DB 2CH ;70H
1027 2E DB 2EH ;6AH
1028 31 DB 31H ;64H
1029 34 DB 34H ;5EH
102A 37 DB 37H ;59H
102B 3B DB 3BH ;54H
- 60 - MDA-8086 MANUAL
2-3. SPEAKER INTERFACE
MDA-8086 MANUAL - 61 -
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.
- 62 - MDA-8086 MANUAL
EXPERIMENT 3. 8251A INTERFACE
If you type a keyboard of your PC, the key code that you typed will be
echo back.
MDA-8086 MANUAL - 63 -
EXPERIMENT 3. 8251A INTERFACE
; FILENAME : D8251A.ASM
; PROCESSOR : I8086
- 64 - MDA-8086 MANUAL
EXPERIMENT 3. 8251A INTERFACE
MDA-8086 MANUAL - 65 -
EXPERIMENT 3. 8251A INTERFACE
105F 74 FA JZ OUT8251
1061 8A C4 MOV AL,AH
1063 E6 08 OUT SIO_D,AL
1065 C3 RET
1066 E4 0A IN8251: IN AL,SIO_C
1068 24 02 AND AL,02H
106A 74 FA JZ IN8251
106C E4 08 IN AL,SIO_D
106E 24 7F AND AL,7FH
1070 C3 RET
;
1071 CODE ENDS
END
- 66 - MDA-8086 MANUAL
4-1. LCD
4‐1. LCD
* 16 CHARACTERS × 2 LINE MODULE
1) PHYSICAL DATA
2) Pin Connections
MDA-8086 MANUAL - 67 -
EXPERIMENT 4. LCD DISPLAY
3) INSTRUCTION
Execution
CODE time(max)
Instruction Description
fosc is
RS R/WD7 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 Home 0 0 0 0 0 0 0 0 1 * shifted to original 1.64
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 Moves cursor and
0 0 0 0 0 1 S/C R/L * * 40
Display Shift 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 40
RAM or CG RAM
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
R/L=1:Shift right. 0: Shift left. ACG : CG RAM address
DL= 1 : 8bits 0 : 4 bits ADD : DD RAM address
Remark 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 for
0: Can accept instruction both DD and CG RAM
* NO EFFECT address
- 68 - MDA-8086 MANUAL
4-1. LCD
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 ㎲ )
MDA-8086 MANUAL - 69 -
EXPERIMENT 4. LCD DISPLAY
- 70 - MDA-8086 MANUAL
4-2. LCD INTERFACE
; FILENAME : LCD_2.ASM
; PROCESSOR : I8086
MDA-8086 MANUAL - 71 -
EXPERIMENT 4. LCD DISPLAY
- 72 - MDA-8086 MANUAL
4-2. LCD INTERFACE
;
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
;
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
MDA-8086 MANUAL - 73 -
EXPERIMENT 4. LCD DISPLAY
- 74 - 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 ← ( )
Flag port ; Read Flag Status
Flag ON?
; Check Flag Bit
AL ← ( )
Keyboard ; Data In from keyboard
END
MDA-8086 MANUAL - 75 -
EXPERIMENT 5. KEYBOARD INTERFACE
SCAN: IN AL,KEY
TEST AL,10000000B
JNZ SCAN
;
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
;
- 76 - MDA-8086 MANUAL
5-1. KEYBOARD INTERFACE
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 - 77 -
EXPERIMENT 6. D/A CONVERTER
- 78 - MDA-8086 MANUAL
6-1. D/A CONVERTER SPECIFICATION
MDA-8086 MANUAL - 79 -
EXPERIMENT 6. D/A CONVERTER
- 80 - MDA-8086 MANUAL
6-3. D/A CONVERTER EXPERIMENT
◉ ◉
◉ ◉
◉ ◉ ◉ ◉ ◉
P8 P6
; FILENAME : DAC.ASM
; PROCESSOR : I8086
MDA-8086 MANUAL - 81 -
EXPERIMENT 6. D/A CONVERTER
- 82 - MDA-8086 MANUAL
6-3. D/A CONVERTER EXPERIMENT
1029 59 POP CX
102A E2 F3 LOOP TIMER2
102C C3 RET
;
102D CODE ENDS
END
MDA-8086 MANUAL - 83 -
EXPERIMENT 7. A/D Converter
- 84 - MDA-8086 MANUAL
7-1. A/D CONVERTER SPECIFICATION
MDA-8086 MANUAL - 85 -
EXPERIMENT 7. A/D CONVERTER
DIP2
◉ ◉
◉ ◉
◉ ◉
P6
- 86 - MDA-8086 MANUAL
7-3. A/D CONVERTER EXPERIMENT
When you adjust the VR, ADC value will be displayed on the LCD
module.
MDA-8086 MANUAL - 87 -
EXPERIMENT 7. A/D CONVERTER
- 88 - MDA-8086 MANUAL
7-3. A/D CONVERTER EXPERIMENT
;
1059 B1 04 MOV CL,4
105B D2 E8 SHR AL,CL
;
105D 02 C0 ADD AL,AL
105F 80 D4 00 ADC AH,0
1062 03 F8 ADD DI,AX
1064 2E: 8A 35 MOV DH,BYTE PTR CS:[DI]
1067 47 INC DI
1068 2E: 8A 15 MOV DL,BYTE PTR CS:[DI]
;
106B 58 POP AX
106C 25 000F AND AX,000FH
106F BF 108D R MOV DI,OFFSET L_TAB
;
1072 02 C0 ADD AL,AL
1074 80 D4 00 ADC AH,0
1077 03 F8 ADD DI,AX
1079 2E: 8A 25 MOV AH,BYTE PTR CS:[DI]
107C 47 INC DI
107D 2E: 8A 05 MOV AL,BYTE PTR CS:[DI]
;
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
MDA-8086 MANUAL - 89 -
EXPERIMENT 7. A/D CONVERTER
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
10CB 48 00 DB 48H,00H ; 4.8V
;
10CD 20 20 56 6F 6C 74 DATA: DB ' Volt Meter',00H
20 4D 65 74 65 72
00
;
- 90 - MDA-8086 MANUAL
7-3. A/D CONVERTER EXPERIMENT
MDA-8086 MANUAL - 91 -
EXPERIMENT 7. A/D CONVERTER
- 92 - MDA-8086 MANUAL
8-1. STEPPING MOTOR SPECIFICATION
Stepping motors are suitable for translating digital inputs into mechanical
motion. In general, there are three types of stepping motor:
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 - 93 -
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.
- 94 - MDA-8086 MANUAL
8-1. STEPPING MOTOR SPECIFICATION
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.
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 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
MDA-8086 MANUAL - 95 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
- 96 - MDA-8086 MANUAL
8-2. STEPPING MOTOR INTERFACE
; FILENAME : STEPMO_1.ASM
; PROCESSOR : I8086
MDA-8086 MANUAL - 97 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
- 98 - MDA-8086 MANUAL
8-3. STEPPING MOTOR EXPERIMENT
MDA-8086 MANUAL - 99 -
EXPERIMENT 8. STEPPING MOTOR CONTROL
;
1080 FA R_45: CLI
1081 B0 19 MOV AL,25
1083 A2 12B1 R MOV BYTE PTR P_CONT,AL
1086 32 C0 XOR AL,AL
1088 A2 12B3 R MOV BYTE PTR LR_FLAG,AL
;
108B E8 1271 R CALL LN21
108E BE 1097 R MOV SI,OFFSET R_45D
1091 E8 128A R CALL STRING
1094 FB STI
1095 EB B1 JMP MAIN
;
1097 52 69 67 68 74 20 R_45D: DB 'Right 45 degree!',00H
34 35 20 64 65 67
72 65 65 21 00
;
10A8 FA R_90: CLI
10A9 B0 32 MOV AL,50
10AB A2 12B1 R MOV BYTE PTR P_CONT,AL
10AE 32 C0 XOR AL,AL
10B0 A2 12B3 R MOV BYTE PTR LR_FLAG,AL
;
10B3 E8 1271 R CALL LN21
10B6 BE 10BF R MOV SI,OFFSET R_90D
10B9 E8 128A R CALL STRING
10BC FB STI
10BD EB 89 JMP MAIN
;
10BF 52 69 67 68 74 20 R_90D: DB 'Right 90 degree!',00H
39 30 20 64 65 67
72 65 65 21 00
;
10D0 FA R_180: CLI
10D1 B0 64 MOV AL,100
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
1278 E6 00 OUT LCDC,AL
127A C3 RET
;
127B E4 02 BUSY: IN AL,LCDC_S
127D 24 80 AND AL,10000000B
127F 75 FA JNZ BUSY
1281 C3 RET
;
12A8 24 07 RET
12AA A2 12B0 R
12AD E6 01
12AF C3
;
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
EXPERIMENT 9. C LANGUAGE
9‐1. LED.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 7-4 (Example 1) *
;* 8255 Test 1 *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : LED.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
led = 0xf1;
do {
outportb( PPI1_B, led );
led = led << 1;
if( led & 0x10 ) led = 0xf1;
wait( 10000 );
} while( 1);
9‐2. FND.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 7-4 (Example 3) *
;* 8255 Test 3 *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : FND.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
void main(void)
{
int *data1;
do {
data1 = data;
9‐3. MATRIX.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 7-5 (Example 1) *
;* Dot Matrix LED Test 1 *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : MATRIX.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
void main(void)
{
int dot,i;
/* 8255 INITIALIZATION */
outportb( PPI2_CR, 0x80 );
outportb( PPI2_A, 0xff );
outportb( PPI2_C, 0xff );
do{
dot = 0x7f;
for( i = 0; i != 8; i++ ) {
outportb( PPI2_B, dot );
dot >>= 1;
dot = ( dot | 0x80 );
wait(30000);
}
}while(1);
}
9‐4. DAC.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 11-4 (Example 1) *
;* DAC Test 1 *
;* -- Level Meter *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : DAC.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
/* 8255 init */
outportb( PPI1_CR, 0x80 );
outportb( PPI1_A, 0xff );
outportb( PPI1_B, 0xf0 );
da = 0;
do {
outportb( PPI1_C, da ); /* Output DA */
wait( 10000 );
da++;
if( da >= 0x64 ) da = 0;
} while(1);
9‐5. ADC.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 11-4 (Example 3) *
;* AD Test *
;* Volt Meter *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
; FILENAME : ADC.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#define _LCD
#include "mda8086.h"
*/
void LCD_putf( long v, int max, int point )
{
char temp[20];
char temp1[20];
int len, i;
ltoa( v, temp, 10 );
memset( temp1, '0', max );
temp1[max] = 0;
len = strlen( temp );
memmove( temp1+(max-len), temp, len );
/* Output Integer */
for( i = 0; i < max-point; i ++ ) LCD_putch( temp1[i] );
LCD_putch( '.' );
LCD_puts( temp1+i );
LCD_init;
do {
outportb( ADC, 0xff);
wait( 20000 );
v = inportb(ADC)*(500000l/256);
v /= 100;
LCD_Iout( 0xc5 );
LCD_putf( v, 4, 3 );
LCD_puts( " V" );
} while( 1);
}
9‐6. LCD.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 10-4 (Example 1) *
;* LCD TEST 1 *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : LCD.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#define _LCD /* You must define it,
because using LCD Function in the HeaderFile. */
#include "mda8086.h"
do {
LCD_DISPOFF;
wait( 20000 );
LCD_DISPON;
wait( 20000 );
} while(1);
9‐7. D8251A.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 9-6 (Example 1) *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : D8251A.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
outportb( UARTD, v );
}
/* init 8253 */
outportb( PIT_CR, 0x36 );
outportb( PIT_CNT0, 16 );
outportb( PIT_CNT0, 0 );
/* init 8251 */
outportb( UARTC, 0x40 );
for( i = 0; i < 3; i++ ) outportb( UARTC, 0 );
outportb( UARTC, 0x40 );
outportb( UARTC, 0x4e ); /* 8251 mode */
outportb( UARTC, 0x27 ); /* 8251 command */
do {
v = read_8251();
write_8251( v );
} while(1);
}
9‐8. D8253.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 8-4 (Example 1) *
;* 8253 Test 1 *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : D8253.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
void main(void)
{
unsigned long far *intvect_ptr = ( (unsigned long far *)0 );
/* Init 8259 */
outportb( INTA, 0x13 ); /* ICW1 */
outportb( INTA2, 0x40 ); /* ICW2 interrupt Vector */
outportb( INTA2, 0x01 ); /* ICW4 */
outportb( INTA2, 0xfe ); /* interrupt mask */
led = 0x01;
/* 8253 INIT */
outportb( PIT_CR, 0x70 ); /* control word */
asm STI;
while(1);
}
9‐9. I8259.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 7-4 (Example 2) *
;* 8255 Test 2 *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : I8259.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
while( del-- );
}
void init8259(void)
{
outportb( INTA, 0x13 );
outportb( INTA2, 0x40 );
outportb( INTA2, 0x01 );
outportb( INTA2, 0xfb );
}
void main(void)
{
int led = 0xf1;
init8259();
/* INIT 8255 */
outportb( PPI1_CR, 0x80 );
outportb( PPI1_A, 0xff );
outportb( PPI1_C, 0x00 );
outportb( PPI1_B, led );
do{
outportb( INTA, 0x0c );
while( !(inportb(INTA) & 0x80) )
{
outportb( INTA, 0x0c );
}
wait(10000);
led = led << 1;
if( led & 0x10 ) led = 0xf1;
else {
led = led | 0xf0;
}
outportb( PPI1_B, led );
outportb( INTA, 0x20 );
}while(1);
}
9‐10. STEPMO.C
/*
;*************************************************
;* MDA-8086 EXPERIMENT PROGRAM *
;* Chapter 12-4 (Example 1) *
;* Stepping Motor Test 1 *
;* -- 1 Phase Magnetization *
;* PROGRAM BY MiDAS ENGINEERING *
;*************************************************
;
; FILENAME : STEPMO.C
; PROCESSOR : I8086
; VER. : V1.1
;
*/
#include "mda8086.h"
while( del-- );
}
};
step = 0;
do {
outportb( PPI1_B, step_tbl[step++] );
if( step >= 4 ) step = 0;
wait( 100 );
} while( 1);
Appendix
1. MDA-8086 Memory Circuit.
(a) 8086
(b) 8088
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
r/m Operand Address
000 (BX) + (SI) + DISP
011 (BX) + (DI) + DISP
010 (BP) + (SI) + DISP
011 (BP) + (DI) + DISP
100 (SI) + DISP
101 (DI) + DISP
110 (BP) + DISP
111 (BX) + DISP