8086 Usermanual
8086 Usermanual
User's Manual
1
CONTENTS
OVERVIEW 4
HARDWARE LAYOUT 5
KEYBOARD LAYOUT 7
HARDWARE FEATURES 8
PLD DECODER 10
GETTING STARTED 13
GPIO1 LED 19
INTERRUPT EXAMPLE 21
SPEAKER PORT 22
RS232C PORT 24
2
HARDWARE SCHEMATIC, PARTS LIST
3
OVERVIEW
The 8086 Microprocessor Kit is a single board computer designed for self-learning the 16-
bit microprocessor operations. The CPU is 8086 with 16-bit memory interface. The monitor
ROM provides functions for entering 8086 instruction code using onboard hex key, testing
code running, single stepping and display user registers.
Kit has 10ms tick generator for testing external interrupt operation. The kit also has RS232
port for 9600 terminal interface. The hex file generated from assembler can be download
easily.
FUNCTIONAL BLOCK DIAGRAM
Notes
4
HARDWARE LAYOUT
5
Important Notes
1. Insert or remove the LCD module must be done when the kit is powered off!
2. AC adapter should provide approx. +9VDC, higher voltage will cause the voltage
regulator chip becomes hot. (+7.5V is recommended)
3. Under normal operation, the voltage regulator will be HOT on the heatsink.
6
KEYBOARD LAYOUT
HEX keys Hexadecimal number 0 to F with associated user registers, AX, BX, CX, DX,
SP, BP, SI, DI, CS, DS, SS, ES and flag displays
7
HARDWARE FEATURES
Hardware features:
8
MEMORY AND I/O MAPS
The kit provides 256kB RAM from location 00000H-3FFFFH, and Monitor ROM from
E0000H-FFFFFH.
LCD_command_write 500H
LCD_command_read 504H
LCD_data_write 502H
LCD_data_read 506H
9
PLD DECODER
The location of memory and I/O devices are selected by the Programmable Logic Device,
PLD chip.
Left-hand side shows the input logic signals. These signals include address signal, memory
and I/O control signals.
Right-hand side shows the output signals for selecting ROM, RAM and each I/O devices.
For ROM selection only single line is needed. However for RAM with separated two chips,
the byte high and byte low signals will be needed.
The PLD chip accepts those input signals, performs logical operation and produces the
enable signal for each devices.
10
Below PLD file is compiled with WinCupL version 5.30.4.
Name 8086KIT ;
PartNo 22V10 ;
Date 21/4/2561 ;
Revision 01 ;
Designer Engineer ;
Company home ;
Assembly None ;
Location ;
Device P22V10 ;
11
PORT0 = RD # IOM # A10 # A9 # !A8 # A7 # A0;
!PORT1 = WR # IOM # A10 # A9 # !A8 # !A7 # A0;
!PORT2 = WR # IOM # A10 # !A9 # A8 # A7 # A0;
PORT3 = WR # IOM # A10 # !A9 # A8 # !A7 # A0;
UART = IOM # A10 # !A9 # !A8 # A7 # A0;
!LCD_E = (RD & WR) # IOM # !A10 # A9 # !A8 # A7;
We can edit the PLD equation using WinCupL IDE directly. When compile it, the JEDEC
file will be produced, 8086KIT.jed.
12
GETTING STARTED
Kit accepts DC power supply with minimum voltage of +7.5V. It draws DC current approx.
500mA. However we can use +9VDC from any AC adapter. The example of AC adapter is
shown below.
13
If your adapter is adjustable output voltage, try with approx. +9V. Higher voltage will make
higher power loss at the voltage regulator, 7805. Dropping voltage across 7805 is approx.
+2V. To get +5VDC for the kit, we thus need DC input >+7.5V.
When power up, we will see the cold boot message 8086.
8086
Press IP key, the display will show HOME location at 0400. The data field will show its
14
content.
0400 EA.
Key + will increment next address.
0401 FE.
15
HOW TO ENTER PROGRAM USING HEX CODE
Let us try enter 8086 instructions using HEX CODE or machine code.
This instruction has two bytes hex code i.e., B0, and 01. B0 is instruction MOV AL,n and 01
is n.
OUT 0,AL Copy AL register to output port, gpio1 LED at location 00.
The last instruction is INT 3, hex code CC jump back to monitor program at location 000C.
This test program has only 5 bytes, B0, 01, E6, 00, CC.
The first byte will be entered to location 0400. And the following bytes will be entered at
0401, 0402, 0403, and 0404.
Step 1 Press RESET, Then IP the display will show current memory address and its
contents.
0400 2F.
Shown the location 0400 has data 2F. There are small dots at the data field indicating the
active field, ready for modifying the hex contents.
16
Step 2 Press key B and key 0. The new hex code B0 will be entered to the location 0400.
0400 B0.
Step 3 Press key + to increment the location from 0400 to 0401. Then enter hex key 1.
0400 01.
Repeat Step 3 until completed for the last location. We can verify the hex code with key +
or key -.
To change the display location, press key ADDR. The dots will move to Address field. Any
hex key pressed will change the display address.
Before we test the code running, let us see how to examine user registers. User registers are
the memory block in RAM that used to save the contents of CPU registers after completed a
given program running. We can examine the user registers for checking our code running
then.
Press key REG, then press key 0, it will show 16-bit contents of register AX (AH:AL).
AX 0000
Press key Reg, 1, 2, 3, for BX, CX, and DX.
BX 0000
17
TEST CODE EXAMPLES
We can test above code running by pressing key GO. The last instruction INT 3 will return
the CPU to monitor program to save CPU registers to user registers that we can examine the
program operation.
Now let us enter code, when complete, press key IP then GO.
What is happening?
Can you change the display from 0000 0001 to another value? How? Test run again.
Now let us enter code, when complete, press key IP then GO.
18
GPIO1 LED
Kit provides a useful 8-bit binary display. It can be used to debug the program or code
running demonstration. The I/O address is 00. The output port is 8-bit data flip-flop. Logic 1
at the output will make LED lit.
We can use instruction OUT 0,AL that writes 8-bit data in AL to the LED.
The hex code for OUT 0,AL is E6, 00. Only two bytes and easy to remember!
Anytime we need to check the 8-bit contents, we can copy it to register AL then use this
instruction to write it to the gpio1 LED easily.
19
10ms TICK GENERATOR
SW1 is a selector for interrupt source between key INTR key or 10ms tick produced by the
89C2051 microcontroller.
Tick generator is software controlled using timer0 interrupt in the 89C2051 chip. The active
low tick signal is sent to P3.7. D1 LED blinking indicates tick running.
10ms tick
Tick is a 10ms periodic signal for triggering the 8086 INTR pin. When select SW1 to Tick,
the 8086 CPU can be triggered by the external interrupt. The 100Hz tick or 10ms tick can be
used to produce tasks that executed with multiple of tick.
NOTE: Key TEST, will use 10ms tick for making binary counting at 100Hz rate.
20
INTERRUPT EXAMPLE
This example code demos the 8086 maskable interrupt using the 10ms tick.
The optional R1, data bus pull-up provides a simple interrupt type number FF when the
8086 chip acknowledges the INTR triggered.
The kit thus gets the vectors from location 03FC (IP) and 03FE (CS).
; INTERRUPT NUMBER FF
0500 SERVICE_INTERRUPT
0500 FE C4 INC AH
0502 80 FC 64 CMP AH,100
0505 75 06 JNZ SKIP
0507 B4 00 MOV AH,0
0509 FE C0 INC AL
050B E6 00 OUT 0,AL
We see that the interrupt service vectors 0500 are stored at 03FC and 03FD. The code
segment register, CS 0000 are stored at 03FE and 03FF.
Main program, just enable the interrupt with STI instruction. Then JUMP here, waiting for
interrupt.
The service routine uses AH for 100 tick counting. AL is incremented every one second. We
see the counting at GPIO1 LED easily.
Let us enter the hex code and test run. What is happening? Can you change the counting
rate? How?
21
SPEAKER PORT
Kit has small speaker driven by digital output bit 3 of the PORT3. We can produce tone
signal by pulsing this bit, ON and OFF. The small signal PNP transistor then drives the
speaker load producing TONE.
PORT3 is located at I/O space at 280H. We will use OUT DX,AL instruction to control it.
22
0400 ORG 400H
Let us enter the hex code to memory from address 400 to 416.
What is happening? Can you change the frequency higher or lower? How?
23
RS232C PORT
The RS232C port is for serial communication. We can use a cross cable or null MODEM
cable to connect between the kit and terminal. The connector for both sides are DB9 female.
We may build it or buying from computer stores.
24
CONNECTING 8086 KIT TO TERMINAL
We can connect the 8086 kit to a terminal with the RS232C cross cable. You may download
free terminal program, teraterm from this URL, http://ttssh2.sourceforge.jp/index.html.en
VT100 Terminal
8080 Kit
The example shows connecting laptop with COM1 port to the RS232C port of the 8086 kit.
New laptop with no COM port, we may use the USB-RS232 adapter for converting the USB
port to RS232 port.
To download Intel hex file that generated from the assembler or c compiler, set serial port
speed to 9600 bit/s, 8-data bit, no parity, no flow control, one stop bit.
25
Step 2 Click setup>Serial port.
Step 3 Set serial port speed to 9600 and format as shown below.
Step 4 Press ENTER key on terminal. The kit will connect terminal automatically.
26
Press key L for hex file downloading. Key ? For Help menu.
27
EXPANSION BUS HEADER
JP1, 40-pin header provides CPU bus signals for expansion or I/O interfacing. Students may
learn how to make the simple I/O port, interfacing to Analog-to-Digital Converter,
interfacing to stepper motor or AC power circuits. Data bus is 16-bit, D0 to D15.
28
CONNECTING LCD MODULE
JR1 is 16-pin header for connecting the text LCD module. R15 is a current limit resistor for
back-light. R16 is trimmer POT for contrast adjustment. The LCD module is interfaced to
the 8086 bus directly. The command and data registers are located in I/O space having
address from 500H to 506H.
Note: Insert or Remove the LCD module must be done when the kit is powered off.
29
LOGIC PROBE POWER SUPPLY
The kit provides test points TP1(+5V) and TP2(GND) for using the logic probe. Students
may learn digital logic signals with logic probe easily.
+ 5V at TP1
GND at TP2
30
HARDWARE SCHEMATIC, PARTS LIST
31
PARTS LIST C3,C6,C11 100nF
C7 10uF 10V
Semiconductors C12,C13,C14,C17,C18,C19, 0.1uF
C20,C21
U1 AM27C1024, 16-bit 256kB EPROM C15 10uF 16V
U3,U2 HM628128A, 128kB SRAM C16 1000uF25V
U4 74HC14, hex inverter C23,C22 0.1uF
U5 AT89C2051, 8-bit tick generator
U6 8086, 16-bit Microprocessor Additional parts
U7,U9,U10,U14,U15,U18 74HC573, 8-bit
Latch JP1 HEADER 20X2
U8 8284, clock generator JR1 CONN RECT 16
U11 GAL22V10, PLD J1 DC Input
U13,U12 LTC-4727, 7-segment LED
U16 74HC541, 8-bit tristate buffer LS1 SPEAKER
U17 74LS175, 4-bit latch
U19 8250, UART SW1 SW MAG-SPDT
U20 HIN232, RS232 voltage converter SW2 RESET
U22 LM7805/TO_5, +5V voltage regulator S1 INTR
D1,D2,D3,D4,D5,D6,D7,D8, LED
D9 S2,S3,S4,S5,S6,S7,S8,S9, SW
D10 1N5227A PUSHBUTTON
D11 POWER S10,S11,S12,S13,S14,S15,
D13 TVS15V
Q1 KIA7042, S16,S17,S18,S19,S20,S21,
Q2 BC557, PNP transistor S22,S23,S24,S25,S26,S27,
S28,S29,S30,S31
TP1 +5V
Resistors (all resistors are 1/8W +/-5%)
TP2 GND
R1 RESISTOR SIP 9
R2 680 VB1 SUB-D 9, Male (cross cable)
R3,R6,R7,R8,R9,R16 10K Y1 14.7456MHz
R4,R5 510
R10 100
PCB double side plate through hole
R14,R11 10k RESISTOR SIP 9
R12 4.7k LED cover Clear RED color acrylic plastic
R13 20 Keyboard sticker printable SVG file
R15 5
R17 1k
Capacitors
C1,C24,C25 100uF
C2,C4,C5,C8,C9,C10 10uF
32
5 4 3 2 1
A[0..17]
A[0..17]
R1
64kx16 ROM 256kB SRAM D0
JP1
+5V
D0 D1 1 2 RD*
1 2 U1 U2 U3
D1 A1 D0 A1 D0 A1 D8 D2 3 4 WR*
3 21 19 12 13 12 13
D D2 A2 A0 D0 D1 A2 A0 D0 D1 A2 A0 D0 D9 D3 5 6 IO/M* D
4 22 18 11 14 11 14
D3 A3 A1 D1 D2 A3 A1 D1 D2 A3 A1 D1 D10 D4 7 8 INTA + C1
5 23 17 10 15 10 15
D4 A4 A2 D2 D3 A4 A2 D2 D3 A4 A2 D2 D11 D5 9 10 INTR
6 24 16 9 17 9 17
D5 A5 A3 D3 D4 A5 A3 D3 D4 A5 A3 D3 D12 D6 11 12 100uF
7 25 15 8 18 8 18
D6 A6 A4 D4 D5 A6 A4 D4 D5 A6 A4 D4 D13 D7 13 14 ALE
8 26 14 7 19 7 19
D7 A7 A5 D5 D6 A7 A5 D5 D6 A7 A5 D5 D14 D8 15 16 PCLK
9 27 13 6 20 6 20
C A8 A6 D6 D7 A8 A6 D6 D7 A8 A6 D6 D15 D9 17 18 GND
28 12 5 21 5 21
A9 A7 D7 D8 A9 A7 D7 A9 A7 D7 D10 19 20 RESET
RESISTOR SIP 9 29 10 27 27
A10 A8 D8 D9 A10 A8 A10 A8 D11 21 22
31 9 26 26
A11 A9 D9 D10 A11 A9 A11 A9 D12 23 24
32 8 23 23
A12 A10 D10 D11 A12 A10 A12 A10 D13 25 26
33 7 25 25
A13 A11 D11 D12 A13 A11 A13 A11 D14 27 28 A9
34 6 4 4
optional interrupt vector A14 A12 D12 D13 A14 A12 A14 A12 D15 29 30 A8
35 5 28 28
A15 A13 D13 D14 A15 A13 A15 A13 A0 31 32 A7
36 4 3 3
A16 A14 D14 D15 A16 A14 A16 A14 A1 33 34 A6
37 3 31 31
A15 D15 A17 A15 A17 A15 A2 35 36 A5
2 2
ROM_CE A16 A16 A3 37 38 A4
2
RD* CE +5V RAM_LOW22 +5V RAM_HI 39 40
20 22
+5V OE CS1 CS1
39 30 30 HEADER 20X2
+5V PGM RD* CS2 RD* CS2
1 24 24
VPP WR* OE WR* OE
29 29
WE WE
AM27C1024
+ C2 A[8..16] HM628128A HM628128A U4A D0
10uF D1 D0
0x00000-0x3FFFF D2 D1
C +5V VCC 1 2 C
C3 RAM S1 D3 D2
D4 D3
SW1 D4
100nF U5 R2 1 74LS14 D5
INTR D6 D5
+5V U7 680 2 U4B
D7 D6
U6 2 12 INTR 3 D7
+5V D0 A0 P3.0/RXD P1.0/AIN0
33 16 2 19 3 13 3 4
MN AD0 D1 1D 1Q A1 P3.1/TXD P1.1/AIN1
15 3 18 6 14
READY AD1 D2 2D 2Q A2 P3.2/INTO P1.2 D1 VDD
22 14 4 17 7 15
R3 CLK 4MHz READY AD2 D3 3D 3Q A3 P3.3/INT1 P1.3
19 13 5 16 8 16 74LS14
10k RESET CLK AD3 D4 4D 4Q A4 P3.4/T0 P1.4 LED 74LS14 +5V
U4C 21 12 6 15 9 17 U4D
RESET AD4 D5 5D 5Q A5 P3.5/T1 P1.5
11 7 14 18 VCC
INTR AD5 D6 6D 6Q A6 2.4576MHz P1.6
5 6 18 10 8 13 19 9 8
INTR AD6 D7 7D 7Q A7 PCLK P1.7
9 9 12 5
AD7 D8 8D 8Q XTAL1 R4 R5
8 4 VCC
AD8 D9 XTAL2 510 510
74LS14 7 11 U4E
AD9 D10 LE RESET VCC
6 1 1
AD10 D11 +5V OE VCC RST/VPP VSS
5 11 11 10
AD11 D12 P3.7
4 20 20 Y1
AD12 D13 VCC VCC 14.7456MHz
3
AD13 D14 R6 R7 R8
2 74LS14
AD14 D15 74HC573 AT89C2051 10k 10k
39 U8
INTA AD15 A16/S3 U9 10k READY
24 38 17 5
INTA A16/S3 A17/S4 X1 READY CLK OSC/3 4.9152MHz
37 8
A17/S4 A18/S5 D8 A8 CLK RESET
B 36 2 19 10 RESET B
A18/S5 A19/S6 D9 1D 1Q A9 RESET +5V
17 35 3 18 16
NMI A19/S6 D10 2D 2Q A10 X2 PCLK 2.4576MHz
4 17 2
34 BHE/S7 D11 5
3D 3Q
16 A11 4
PCLK CLK/2 UART_CLK
BHE/S7 D12 4D 4Q A12 RDY1
6 15 6 12
DEN* D13 5D 5Q A13 RDY2 OSC R9
26 7 14 3
DEN DT/R* D14 6D 6Q A14 AEN1 10k
27 8 13 7
DT/R IO/M* D15 7D 7Q A15 AEN2 R10
28 9 12 14 SW2
M/IO 8D 8Q EFI
30 1
HLDA RD* CSYNC
31 32 11 15
HOLD RD WR* LE ASYNC 100
29 1 13
WR ALE +5V OE F/C + C4 RESET
23 25 RD
TEST ALE 10uF
20 11
VCC RES
3
WR
80C86MIN 8284 2 KIA7042
74HC573 Q1
U10 U11
1
A16/S3 2 19 A16 A18 2 14 ROM_CE
A17/S4 1D 1Q A17 A19 I I/O/Q RAM_LOW +5V
3 18 3 15
A18/S5 2D 2Q A18 IO/M* I I/O/Q RAM_HI
4 17 4 16
A19/S6 3D 3Q A19 RD* I I/O/Q
5 16 5 17 UART
BHE/S7 4D 4Q BHE WR* I I/O/Q
6 15 6 18 GPIO1
VCC +5V 5D 5Q A7 I I/O/Q
+5V VCC 7 14 7 19 PORT3
6D 6Q A8 I I/O/Q
8 13 8 20 LCD_E
A 7D 7Q A9 I I/O/Q A
9 12 9 21 PORT0
8D 8Q BHE I I/O/Q
VCC 10 22 PORT1
A0 I I/O/Q
11 11 23 PORT2
LE A1 I I/O/Q
1 13
+5V OE I
20 A10 1 Title
VCC I/CLK 8086 MICROPROCESSOR KIT (C) 2018
A0
A2 A1
74HC573 GAL22V10B PLD decoder logic Size Document Number Rev
A2
Designed by Wichit Sirichote, [email protected], (C) 2018 A3 Custom<Doc>
A3
Date: Sunday, May 06, 2018 Sheet 1 of 3
5 4 3 2 1
5 4 3 2 1
D0
D1 D0
D2 D1
D3 D2
D4 D3 U12 U13
U14
D5 D4
D6 D5 D0 A A
2 19 A 14 14
D7 D6 D1 1D 1Q B A B A
3 18 B 16 16
D7 D2 2D 2Q C B C B
4 17 C 13 13
D3 3D 3Q D D C D C
5 16 3 3
D4 4D 4Q E E D E D
6 15 5 5
D5 5D 5Q F F E F E
7 14 11 11
D D6 6D 6Q G G F G F D
8 13 15 15
D7 7D 7Q DP DP G DP G
9 12 7 7
8D 8Q DP DP
11
DIGIT1
DIGIT2
DIGIT3
DIGIT4
DIGIT1
DIGIT2
DIGIT3
DIGIT4
PORT2 LE
1 4 4
VCC OE L1L2L3 L1L2L3
20
VCC
LTC-4727JR LTC-4727JR
C5
8
+
10uF 74HC573
U15
D0 2 19 PC0
D1 1D 1Q PC1
3 18
D2 2D 2Q PC2
4 17
D3 3D 3Q PC3
5 16
D4 4D 4Q PC4
6 15
D5 5D 5Q PC5 10k RESISTOR SIP 9 R11 VCC
7 14
D6 6D 6Q PC6 PC0
8 13 2 1
D7 7D 7Q PC7 PC1
9 12 3
8D 8Q PC2
C 4 C
11 PC3 5
PORT1 LE PC4
RESET 1 6
VCC OE 0x01 PC5 7
20 PC5 PC6 8
VCC PC4 PC7 9
74HC573 PC3 C
PC2
PC1
PC0
1
R12
S2 S3 S4 S5 S6 SPEAKER 2 Q2
BC557
U16 4.7k
3
D0 18 2 PA0
D1 Y1 A1 PA1
17 3 S7 S8 S9 S10 S11
D2 Y2 A2 PA2
16 4 LS1
D3 Y3 A3 PA3
15 5
D4 Y4 A4 PA4
14 6
D5 Y5 A5 PA5
B 13 7 B
D6 Y6 A6 PA6
12 8 S12 S13 S14 S15 S16 SPEAKER
D7 Y7 A7 PA7 +5V
11 9 S17
Y8 A8 R13
1
G1 VCC 20
PORT0 19 S18 S19 S20 S21 S22 S23
G2
20
VCC
74HC541 C6 SW PUSHBUTTON 10k RESISTOR SIP 9 R14 VCC
100nF PA0 2 1
S24 S25 S26 S27 PA1 3
PA2 4
PA3 5
PA4 6
U17 PA5 7
D0 4 2 S28 S29 S30 S31 PA6 8
D1 Q1 PA7
3 9
D1 Q1 C
5 7
D2 Q2
6
D2 Q2
12 10
D3 Q3
11
D3 Q3
13 15
D4 Q4 SPEAKER
14
A Q4 VCC +5V A
PORT3 9
CLK
1
CLR VSS
U4F +5V VCC
74LS175
13 12 Title
RESET
8086 MICROPROCESSOR KIT 2018
VCC
74LS14 Size Document Number Rev
B <Doc> 1
D0
D1 D0
D2 D1
D3 D2
D4 D3
+5V
D5 D4
D6 D5
U18
D7 D6
D7 U19
D0 2 19 12 34
D D1 1D 1Q CS0 OUT1 D
3 18 13 31
D2 2D 2Q CS1 OUT2
4 17 14 30
D3 3D 3Q UART CS2 INT
5 16
D4 4D 4Q
6 15 21
D5 5D 5Q RD RD TXD
7 14 18 11
D6 6D 6Q WR WR TXD RTS
8 13 22 32
D7 7D 7Q RD RTS
9 12 19 33
8D 8Q WR DTR
GPIO1 11 A1 28
LE A0 RXD
RESET 1 A2 27 10
VCC OE A1 RXD DCD
A3 26 38
A2 DCD
20 37
VCC D0 DSR
1 36
D2 D3 D4 D5 D6 D7 D8 D9 D1 D0 CTS
2 39
74HC573 D2 D1 RI
3
D3 D2
4
D4 D3
5
D5 D4
6
D6 D5
7
D10 D7 D6
8
D7
24
1N5227A CSOUT
25 23
ADS DDIS
16x2 text LCD interface 35
RESET NC
29
C C
16
JR1 XTAL1/CLK
17
+5V XTAL2
R15
8-bit Binary display LED x8 RESET
16 5 9 15
16 RCLK BAUDOUT
15 UART_CLK
15 D7
14 8250
14 D6
13
13 D5 +5V
12
12 D4
11
11 D3
10
10 D2 10uF C8
9 10uF 10V
9 D1
+
C7
+
8
8 D0
7
7
6 LCD_E U20
6 R/W
5 A2 2 1
5 RS +5V VB1 V+ C+ 10uF
4 A1 3
4 C1-
3 5 6 4
3 C9 V- C2+
2 9 5
2 + C2-
+
1 4 C10
1 + C25 + C24 10uF
8
100uF 100uF 3 14 11
T1OUT T1IN TXD RTS
CONN RECT 16 +5V 7 7 10
2
T2OUT T2IN
2 13 12 RXD
R1IN R1OUT DCD
B 1 3 6 8 9 B
R2IN R2OUT
1
VCC
C11
C12 C13 C14 100nF
0.1uF 0.1uF 0.1uF
VSS
D11 R17
1k
POWER
+5V
TP1 U22 J1
LM7805/TO_5 +9VDC
A +5V 3 1 1 A
1 VOUT VIN
2
10uF 16V
GND
+ + DC Input
C17 C18 C19 C20 C21
C15 C22 C16 D13
0.1uF 0.1uF 0.1uF 0.1uF 0.1uF
TP2 0.1uF C23 1000uF25V Title
0.1uF TVS15V 8086 MICROPROCESSOR KIT 2018
2
33
MON86.c 1/17/2022 11:41 AM
1 // MON86.C
2 // Monitor program developed with Micro-c for 8086
3 // written by Wichit Sirichote, [email protected]
4 // 13 May 2018
5
6 #include <8086io.h>
7
8 #define port0 0x100 // input port keypad
9 #define port1 0x180 //DIGIT CONTROL
10 #define port2 0x200 //SEGMENT
11 #define port3 0x280 // SPEAKER BIT3
12
13 #define user_io 0x400 // user expansion i/o ports
14
15 #define UART 0x300 // 8250 UART
16
17 #define gpio1 0 // debug LED
18
19
20 #define BUSY 0x80
21
22 #define LCD_command_write 0x500
23 #define LCD_command_read 0x504
24 #define LCD_data_write 0x502
25 #define LCD_data_read 0x506
26
27
28 char convert[16]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
29
30 //char convert[16];
31
32 char buffer[8]; // display buffer
33 char buffer2[128];
34
35 unsigned char n;
36 int j;
37 unsigned char k;
38 char i,u,q,o,key;
39 unsigned int temp,temp2;
40 int x;
41 char hit;
42
43 char auto_key;
44
45 int temp16;
46 int PC, save_PC, display_PC;
47
Page 1 of 25
MON86.c 1/17/2022 11:41 AM
48 int start,end,destination;
49
50 char state;
51
52 char *dptr;
53
54
55 int user_flag, save_stack;
56 int user_ip;
57 int user_cs;
58 int user_ds;
59 int user_es;
60 int user_ss;
61 int user_sp;
62
63
64 int user_ax;
65 int user_bx;
66 int user_cx;
67 int user_dx;
68 int user_bp;
69 int user_si;
70 int user_di;
71
72 int flag_low,flag_high;
73
74
75 //------------------- lcd drivers --------------------------------------
76
77 LcdReady()
78 {
79 while(in(LCD_command_read)&BUSY)
80 continue; // wait until busy flag =0
81 }
82
83 void clr_screen(void)
84 {
85 LcdReady();
86 out(LCD_command_write,0x01);
87 }
88
89
90 // if LCD connected, return 0, else return !=0
91 char check_LCD()
92 {
93 i=0;
94 while((in(LCD_command_read)&BUSY!=0) && ++i<100)
Page 2 of 25
MON86.c 1/17/2022 11:41 AM
95 ;
96 return (in(LCD_command_read)&BUSY);
97 }
98
99 goto_xy(char x,char y)
100 {
101 LcdReady();
102 switch(y){
103 case 0 : out(LCD_command_write,0x80+x); break;
104 case 1 : out(LCD_command_write,0xC0+x); break;
105 case 2 : out(LCD_command_write,0x94+x); break;
106 case 3 : out(LCD_command_write,0xd4+x); break;
107 }
108 }
109 InitLcd()
110 {
111 LcdReady();
112 out(LCD_command_write,0x38);
113 LcdReady();
114 out(LCD_command_write,0x0c);
115 clr_screen();
116 goto_xy(0,0);
117 }
118
119 char *Puts(char *str)
120 {
121 unsigned char i;
122 for (i=0; str[i] != '\0'; i++){
123 LcdReady();
124 out(LCD_data_write,str[i]);
125 }
126 return str;
127 }
128
129 void putch_lcd(char ch)
130 {
131 LcdReady();
132 out(LCD_data_write,ch);
133 }
134
135 void LCDWriteText(char *txt) {
136 while(*txt)
137 putch_lcd(*txt++);
138 }
139
140 void LCDWriteConstText(const char *txt) {
141 while(*txt)
Page 3 of 25
MON86.c 1/17/2022 11:41 AM
142 putch_lcd(*txt++);
143 }
144
145
146 //--------------------------------------------------------------
147
148 dot_address()
149 {
150 buffer[3]=buffer[3]|0x80;
151 buffer[4]=buffer[4]|0x80;
152 buffer[5]=buffer[5]|0x80;
153 buffer[6]=buffer[6]|0x80;
154
155 buffer[7]= 0;
156
157 buffer[0]=buffer[0]&~0x80;
158 buffer[1]=buffer[1]&~0x80;
159 buffer[2]=0; // could be 1MB physical location
160 //buffer[3]=0;
161 }
162
163
164 dot_data()
165 {
166
167 buffer[0]=buffer[0]|0x80;
168 buffer[1]=buffer[1]|0x80;
169 buffer[2]=0;
170 // buffer[3]=0;
171
172 buffer[3]=buffer[3]&~0x80;
173 buffer[4]=buffer[4]&~0x80;
174 buffer[5]=buffer[5]&~0x80;
175 buffer[6]=buffer[6]&~0x80;
176 buffer[7]=0;
177
178 }
179
180
181
182 hex4(int h)
183 {
184 temp16 = h;
185 buffer[3]= convert[temp16&0xf];
186 temp16>>=4;
187 buffer[4]= convert[temp16&0xf];
188 temp16>>=4;
Page 4 of 25
MON86.c 1/17/2022 11:41 AM
189 buffer[5]=convert[temp16&0xf];
190 temp16>>=4;
191 buffer[6]=convert[temp16&0xf];
192
193 buffer[7]=0;
194 }
195
196 hex4low(int h)
197 {
198 temp16=h;
199 buffer[0]= convert[temp16&0xf];
200 temp16>>=4;
201 buffer[1]= convert[temp16&0xf];
202 temp16>>=4;
203 buffer[2]=convert[temp16&0xf];
204 temp16>>=4;
205 buffer[3]=convert[temp16&0xf];
206 }
207
208 address_display()
209 {
210
211 temp16 = PC;
212
213 hex4(temp16);
214
215 }
216
217 data_display()
218 {
219 dptr =PC;
220
221 n = *dptr;
222
223 temp16 = n;
224
225 buffer[0]= convert[temp16&0xf];
226 temp16>>=4;
227 buffer[1]= convert[temp16&0xf];
228
229 buffer[2]=0;
230
231 }
232
233 read_memory()
234 {
235 address_display();
Page 5 of 25
MON86.c 1/17/2022 11:41 AM
236 data_display();
237 }
238
239
240 key_address()
241 {
242 state = 1;
243 read_memory();
244 dot_address();
245 hit=0;
246 }
247
248 key_data()
249 {
250
251 read_memory();
252 dot_data();
253 hit=0;
254 state=2;
255
256 }
257
258
259
260 key_PC()
261 {
262 PC=save_PC;
263 key_data();
264 }
265
266 key_plus()
267 {
268
269 if(state==1 || state==2)
270 {
271 PC++;
272 display_PC=PC;
273 read_memory();
274 key_data();
275 }
276
277 if(state==4)
278 {
279 start = display_PC;
280 state = 5;
281 buffer[0] = 0x5e;
282 hit =0;
Page 6 of 25
MON86.c 1/17/2022 11:41 AM
283
284
285
286 }
287
288 if(state==6)
289 {
290 start = display_PC;
291 state = 7;
292 buffer[0] = 0x5e;
293 hit =0;
294
295
296
297 }
298
299
300
301
302 }
303
304 key_minus()
305 {
306 if(state==1 | state ==2)
307 {
308 PC--;
309 display_PC=PC;
310 read_memory();
311 key_data();
312 }
313 }
314
315 data_hex()
316 {
317
318 dptr = PC;
319 x = *dptr;
320 if(hit==0) x=0;
321 {
322 hit =1;
323 x = x << 4;
324 x = x|key;
325
326 *dptr = x;
327
328 read_memory();
329
Page 7 of 25
MON86.c 1/17/2022 11:41 AM
330 dot_data();
331 }
332 }
333
334 hex_address()
335 {
336 if(hit==0) PC=0;
337 {
338 hit=1;
339
340 PC<<=4;
341 PC |= key;
342 read_memory();
343 dot_address();
344 }
345 }
346
347 /* insert word and shift 512 words down */
348
349 insert()
350 {
351 dptr=PC;
352 for(j=512; j>0; j--)
353 {
354 *(dptr+j)=*(dptr+j-1);
355 }
356 *(dptr+1)=0; /* insert next byte */
357 PC++;
358 read_memory();
359 dot_data();
360 state=2;
361 }
362
363
364 /* delete current word and shift 512 words up */
365
366 cut_byte()
367 {
368 dptr=PC;
369 for(j=0; j<512; j++)
370 {
371 *(dptr+j)=*(dptr+j+1);
372 }
373 read_memory();
374 dot_data();
375 state=2;
376 }
Page 8 of 25
MON86.c 1/17/2022 11:41 AM
377
378
379 reg_ax()
380 {
381
382 temp16 = user_ax;
383
384 hex4low(temp16);
385
386 buffer[4]=0;
387 buffer[5]=0x64;
388 buffer[6]=0x77;
389 buffer[7]=0;
390 }
391
392 reg_bx()
393 {
394
395 temp16 = user_bx;
396
397 hex4low(temp16);
398
399 buffer[4]=0;
400 buffer[5]=0x64;
401 buffer[6]=0x7c;
402 buffer[7]=0;
403 }
404
405 reg_cx()
406 {
407
408 temp16 = user_cx;
409
410 hex4low(temp16);
411
412 buffer[4]=0;
413 buffer[5]=0x64;
414 buffer[6]=0x39;
415 buffer[7]=0;
416 }
417
418 reg_dx()
419 {
420
421 temp16 = user_dx;
422
423 hex4low(temp16);
Page 9 of 25
MON86.c 1/17/2022 11:41 AM
424
425 buffer[4]=0;
426 buffer[5]=0x64;
427 buffer[6]=0x5e;
428 buffer[7]=0;
429 }
430
431
432 reg_sp()
433 {
434
435 temp16 = user_sp;
436
437 hex4low(temp16);
438
439 buffer[4]=0;
440 buffer[5]=0x73;
441 buffer[6]=0x6d;
442 buffer[7]=0;
443 }
444
445 reg_bp()
446 {
447
448 temp16 = user_bp;
449
450 hex4low(temp16);
451
452 buffer[4]=0;
453 buffer[5]=0x73;
454 buffer[6]=0x7c;
455 buffer[7]=0;
456 }
457
458 reg_si()
459 {
460
461 temp16 = user_si;
462
463 hex4low(temp16);
464
465 buffer[4]=0;
466 buffer[5]=0x30;
467 buffer[6]=0x6d;
468 buffer[7]=0;
469 }
470
Page 10 of 25
MON86.c 1/17/2022 11:41 AM
471 reg_di()
472 {
473
474 temp16 = user_di;
475
476 hex4low(temp16);
477
478 buffer[4]=0;
479 buffer[5]=0x30;
480 buffer[6]=0x5e;
481 buffer[7]=0;
482 }
483
484 reg_cs()
485 {
486
487 temp16 = user_cs;
488
489 hex4low(temp16);
490
491 buffer[4]=0;
492 buffer[5]=0x6d;
493 buffer[6]=0x39;
494 buffer[7]=0;
495 }
496
497 reg_ds()
498 {
499
500 temp16 = user_ds;
501
502 hex4low(temp16);
503
504 buffer[4]=0;
505 buffer[5]=0x6d;
506 buffer[6]=0x5e;
507 buffer[7]=0;
508 }
509
510 reg_ss()
511 {
512
513 temp16 = user_ss;
514
515 hex4low(temp16);
516
517 buffer[4]=0;
Page 11 of 25
MON86.c 1/17/2022 11:41 AM
518 buffer[5]=0x6d;
519 buffer[6]=0x6d;
520 buffer[7]=0;
521 }
522
523 reg_es()
524 {
525
526 temp16 = user_es;
527
528 hex4low(temp16);
529
530 buffer[4]=0;
531 buffer[5]=0x6d;
532 buffer[6]=0x79;
533 buffer[7]=0;
534 }
535
536 reg_flag()
537 {
538
539 temp16 = user_flag;
540
541 hex4low(temp16);
542
543 buffer[4]=0;
544 buffer[5]=0x38;
545 buffer[6]=0x71;
546 buffer[7]=0;
547 }
548
549 reg_flag_low()
550 {
551 flag_low=0;
552
553 temp16 = user_flag;
554
555 if(temp16&1) flag_low|=1;
556 if(temp16&4) flag_low|=0x10;
557 if(temp16&0x10) flag_low|=0x100;
558 if(temp16&0x40) flag_low|=0x1000;
559
560 hex4low(flag_low);
561
562 buffer[4]=0;
563 buffer[5]=0x38;
564 buffer[6]=0x71;
Page 12 of 25
MON86.c 1/17/2022 11:41 AM
565 buffer[7]=0;
566 }
567
568 reg_flag_high()
569 {
570 flag_high=0;
571
572 temp16= user_flag;
573
574 if(temp16&0x80) flag_high|=1;
575 if(temp16&0x200) flag_high|=0x10;
576 if(temp16&0x400) flag_high|=0x100;
577 if(temp16&0x800) flag_high|=0x1000;
578
579 hex4low(flag_high);
580
581 buffer[4]=0;
582 buffer[5]=0x76;
583 buffer[6]=0x71;
584 buffer[7]=0;
585 }
586
587
588 reg_display()
589 {
590
591 if(key==0) reg_ax();
592 if(key==1) reg_bx();
593 if(key==2) reg_cx();
594 if(key==3) reg_dx();
595 if(key==4) reg_sp();
596 if(key==5) reg_bp();
597 if(key==6) reg_si();
598 if(key==7) reg_di();
599 if(key==8) reg_cs();
600 if(key==9) reg_ds();
601 if(key==0xa) reg_ss();
602 if(key==0xb) reg_es();
603 if(key==0xc) reg_flag();
604 if(key==0xd) reg_flag_high();
605 if(key==0xe) reg_flag_low();
606
607
608 }
609
610 key_reg()
611 {
Page 13 of 25
MON86.c 1/17/2022 11:41 AM
612 buffer[7]=0;
613 buffer[6]=0x50;
614 buffer[5]=0x79;
615 buffer[4]=0x6f;
616 buffer[3]=0;
617 buffer[2]=0;
618 buffer[1]=0;
619 buffer[0]=0;
620
621 state = 3; /* register display state = 3 with hex key */
622
623 }
624
625
626
627 key_go()
628 {
629
630 if(state==1 || state==2)
631 {
632
633 asm {
634
635 MOV AX,SP
636 MOV save_stack,AX
637
638 MOV AX,user_sp
639 MOV SP,AX ; LOAD SP WITH USER STACK
640
641 MOV AX,user_cs
642 PUSH AX
643 MOV AX,PC ;user_ip
644 PUSH AX
645
646 MOV AX,user_di
647 PUSH AX
648 MOV AX,user_si
649 PUSH AX
650 MOV AX,user_bp
651 PUSH AX
652 MOV AX,user_dx
653 PUSH AX
654 MOV AX,user_cx
655 PUSH AX
656 MOV AX,user_bx
657 PUSH AX
658 MOV AX,user_ax
Page 14 of 25
MON86.c 1/17/2022 11:41 AM
659 PUSH AX
660
661
662
663 POP AX
664 POP BX
665 POP CX
666 POP DX
667 POP BP
668 POP SI
669 POP DI
670 RETF ;JUMP TO USER PROGRAM WITH CS = 0000
671 }
672
673
674 }
675
676
677
678 if(state==5)
679 {
680
681 destination = display_PC;
682 temp = destination-(start+3);
683 hex4(temp);
684 dptr = start+1;
685 *(dptr) = (char)temp&0xff;
686 *(dptr+1)= (char)(temp>>=8);
687 PC = start+1;
688 read_memory();
689
690 state = 1;
691
692
693
694
695 }
696
697 if(state==7)
698 {
699
700 destination = display_PC;
701 temp = destination-(start+2);
702 hex4(temp);
703 dptr = start+1;
704 *(dptr)= (char)(temp&0xff);
705 PC = start+1;
Page 15 of 25
MON86.c 1/17/2022 11:41 AM
706 read_memory();
707
708 state = 1;
709
710
711
712
713 }
714
715
716
717
718 }
719
720
721
722 service_break()
723 {
724 asm{
725
726 MOV user_ax,AX
727 MOV user_bx,BX
728 MOV user_cx,CX
729 MOV user_dx,DX
730 MOV user_bp,BP
731 MOV user_si,SI
732 MOV user_di,DI
733
734 POP AX
735 MOV save_PC,AX
736 MOV PC,AX
737
738 POP AX
739 MOV user_cs,AX
740 POP AX
741 MOV user_flag,AX
742 MOV user_sp,SP
743
744 CALL read_memory
745
746 MOV AX,save_stack
747 INC AX
748 INC AX
749 MOV SP,AX
750
751 RET
752
Page 16 of 25
MON86.c 1/17/2022 11:41 AM
753 }
754
755 }
756
757
758 key_step()
759 {
760
761
762
763 asm {
764
765 MOV AX,SP
766 MOV save_stack,AX
767
768 MOV AX,user_sp
769 MOV SP,AX ; LOAD SP WITH USER STACK
770
771 PUSHF
772 MOV BP,SP
773 OR >[BP],#$0100 ; set trap flag
774
775 MOV AX,user_cs
776 PUSH AX
777 MOV AX,PC ;user_ip
778 PUSH AX
779
780 MOV AX,user_di
781 PUSH AX
782 MOV AX,user_si
783 PUSH AX
784 MOV AX,user_bp
785 PUSH AX
786 MOV AX,user_dx
787 PUSH AX
788 MOV AX,user_cx
789 PUSH AX
790 MOV AX,user_bx
791 PUSH AX
792 MOV AX,user_ax
793 PUSH AX
794
795
796
797 POP AX
798 POP BX
799 POP CX
Page 17 of 25
MON86.c 1/17/2022 11:41 AM
800 POP DX
801 POP BP
802 POP SI
803 POP DI
804 IRET ;JUMP TO USER PROGRAM WITH IRET, TRAP FLAG WAS SET
805 }
806
807
808 }
809
810
811 offset16()
812 {
813 buffer[0]=0x6d;
814 buffer[1]=0;
815 display_PC=PC;
816 state = 4; // enter word address
817 hit=0;
818
819
820 }
821
822 offset8()
823 {
824
825 buffer[0]=0x6d;
826 buffer[1]=0;
827 display_PC=PC;
828 state = 6; // enter word address
829 hit=0;
830
831
832 }
833
834 word_enter()
835 {
836
837 if(hit==0) display_PC=0;
838 {
839 hit=1;
840 display_PC<<=4;
841 display_PC |= key;
842 hex4(display_PC);
843 dot_address();
844 }
845 }
846
Page 18 of 25
MON86.c 1/17/2022 11:41 AM
847 key_test()
848 {
849
850 test_sound();
851
852 enable();
853 for(;;)
854 ;
855
856 }
857
858
859 key_exe()
860 {
861
862 if( key>15)
863 {
864 if(key==0x13) key_address();
865 if(key==0x12) key_data();
866 if(key==0x17) key_plus();
867 if (key==0x16) key_minus();
868 if (key==0x10) key_PC();
869 if (key==0x21) key_go();
870 if (key==0x11) key_reg();
871 if (key==0x18) insert();
872 if (key==0x19) cut_byte();
873 if (key==0x14) offset16();
874 if (key==0x15) offset8();
875 if (key==0x20) key_step();
876 if (key==0x22) key_test();
877
878 }
879
880 else
881 {
882
883 if(state==1) hex_address();
884 if(state==2) data_hex();
885 if(state==3) reg_display();
886 if(state==4 || state ==5 || state ==6 || state==7) word_enter();
887
888
889
890 }
891
892 }
893
Page 19 of 25
MON86.c 1/17/2022 11:41 AM
894
895
896
897 /* return internal code hex keys and function keys */
898
899 char key_code(char n)
900 {
901 if(n == 3) return 0;
902 if(n == 0x22) return 1;
903 if(n == 0x1c) return 2;
904 if(n == 0x16) return 3;
905 if(n == 2) return 4;
906 if(n == 0xf) return 5;
907 if(n == 0x21) return 6;
908 if(n == 0x1b) return 7;
909 if(n == 7) return 8;
910 if(n == 1) return 9;
911 if(n == 0x1a) return 0xa;
912 if(n == 0x14) return 0xb;
913 if(n == 0xc) return 0xc;
914 if(n == 6) return 0xd;
915 if(n == 0) return 0xe;
916 if(n == 0x19) return 0xf;
917
918 if(n == 0x13) return 0x10;
919 if(n == 0xe) return 0x11;
920 if(n == 0x15) return 0x12;
921 if(n == 0x10) return 0x13;
922
923 if(n == 0x23) return 0x14;
924 if(n == 0x1d) return 0x15;
925 if(n == 0x17) return 0x16;
926 if(n == 0x11) return 0x17;
927
928 if(n == 9) return 0x18;
929 if(n == 8) return 0x19;
930 if(n == 0x12) return 0x20;
931 if(n == 0xd) return 0x21;
932
933 if(n == 0x18) return 0x22;
934 if(n == 0x30) return 0x23;
935
936
937 }
938
939 chk_serial()
940 {
Page 20 of 25
MON86.c 1/17/2022 11:41 AM
941
942 if(chkchr()==0x0d)
943 {
944
945 out(port2,0xff);
946 out(port1,0x00);
947
948 asm {
949
950 JMP $c000
951
952 }
953
954
955 // out(gpio1,0xaa);
956
957 }
958
959 }
960
961
962
963
964
965
966
967
968
969
970
971 delay(int d)
972 {
973 for(x=0; x<d; x++)
974 ;
975
976 }
977
978 char scan()
979 {
980 k=1;
981 u=0;
982 key=-1; // if no key pressed key=-1
983 q=0; // key code
984
985 for(i=0; i<8; i++)
986 {
987 out(port1,~k); // write digit
Page 21 of 25
MON86.c 1/17/2022 11:41 AM
988
989 out(port2,buffer[i]); // write segment
990
991 // delay(10);
992
993 if(buffer[i] != 0x06 && buffer[i] != 0x86) delay(10);
994 else delay(1);
995
996 out(port2,0);
997 o= in(port0); // read keypad
998 for(n=0; n<6; n++)
999 {
1000 if((o&1)==0) key=q;
1001 else q++;
1002 o>>=1;
1003 }
1004
1005 k<<=1;
1006
1007 }
1008
1009
1010 return key;
1011 }
1012
1013 // scan1 repeat scan display and keyboard
1014
1015 void scan1()
1016 {
1017 temp2=0;
1018
1019
1020
1021 while((scan()!= -1) && ((in(port0)&0x40) !=0))
1022
1023 {
1024
1025 chk_serial();
1026
1027
1028 }
1029 delay(10);
1030
1031
1032
1033
1034 while(scan()== -1)
Page 22 of 25
MON86.c 1/17/2022 11:41 AM
1035 {
1036 chk_serial();
1037 auto_key=0;
1038 }
1039 delay(10);
1040
1041 key = scan();
1042 // check key in range
1043 if(key>=0 && key <0x31)
1044 {
1045
1046 key= key_code(key);
1047
1048 key_exe();
1049 // out(gpio1,key);
1050
1051 }
1052
1053 }
1054
1055 service_timer()
1056 {
1057
1058 out(gpio1,i++);
1059
1060 asm{
1061 POP BP
1062 IRET
1063 }
1064
1065 }
1066
1067 test_sound()
1068 {
1069
1070 for(j=0; j<2000; j++)
1071 {
1072 out(port3,j);
1073 delay(1);
1074 }
1075 out(port3,0); // turn off
1076
1077 }
1078
1079
1080 insert_vectors()
1081 {
Page 23 of 25
MON86.c 1/17/2022 11:41 AM
1082 asm{
1083
1084 MOV AX,#service_break+3
1085 MOV $000c,AX ; SERVICE ADDRESS FOR INT 3
1086 MOV AX,#$F000 ; CS SEGMENT FOR MONTIOR ROM F000, RAM 0000
1087 MOV $000E,AX
1088
1089 * INSERT VECTOR FOR INT 1 TRAP
1090
1091 MOV AX,#service_break+3
1092 MOV $0004,AX ; SERVICE ADDRESS FOR INT 2
1093 MOV AX,#$F000 ; CS SEGMENT FOR MONTIOR ROM F000, RAM 0000
1094 MOV $0006,AX
1095
1096 * INSERT VECTOR FOR EXTERNAL INTR
1097
1098 MOV AX,#service_timer
1099 MOV $3FC,AX
1100 MOV AX,#$F000 ; CS SEGMENT FOR MONTIOR ROM F000, RAM 0000
1101 MOV $3FE,AX
1102
1103 }
1104 }
1105
1106
1107 init_UART()
1108 {
1109
1110 out(UART+6,0x83);
1111 out(UART+0,16); // 9600 8n1
1112 out(UART+2,0);
1113 out(UART+6,3);
1114 out(UART+2,0);
1115 out(UART+8,3);
1116
1117 }
1118
1119
1120
1121 main()
1122 {
1123 disable(); // disable interrupts
1124
1125 out(port3,0); // turn off speaker
1126
1127
1128 PC = 0x400;
Page 24 of 25
MON86.c 1/17/2022 11:41 AM
Page 25 of 25
NOTE
34