8080 User Manual
8080 User Manual
User's Manual
CONTENTS
OVERVIEW...........................................................................................4
HARDWARE LAYOUT...........................................................................5
KEYBOARD LAYOUT............................................................................7
HARDWARE FEATURES......................................................................9
GETTING STARTED..............................................................................11
GPIO1 LED............................................................................................16
RS232C PORT......................................................................................17
The 8080 Microprocessor kit is the educational kit designed for self learning the Intel
8080 microprocessor coding. The microcomputer is built with three chips system,
8080 CPU, 8288 bus controller and 8284 clock generator. The kit has 32kB user
RAM and 32kB monitor ROM. The kit provides hex display and hex keys. It can
display memory contents with 64kB logical locations. The hex key can use for
entering the 8080 instructions. The kit also has serial port for Intel hex file
downloading. The 10ms tick generator is for time triggering experiment.
Notes
5
Important Notes
1. Plugging or removing 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.
3. The kit has diode protection for wrong polarity of adapter jack. If the center pin is
not the positive (+), the diode will be reverse bias, preventing wrong polarity feeding
to voltage regulator.
6
KEYBOARD LAYOUT
HEX keys Hexadecimal number 0 to F with associated user registers, AF, BC, DE,
HL, SP, PC, flag display and alternate functions (use with ALT key).
RESET Reset the CPU, the 8080 will JUMP to location 0000.
INTR Make INTR pin to logic low, used for experimenting with interrupt
process
MOD Modify user registers, after a given user register was selected.
7
ALT Alternate functions, used with HEX key.
TEST Write the text to LCD if connected and test gpio1 LED
8
HARDWARE FEATURES
Hardware features:
9
MEMORY AND I/O MAPS
The kit provides two spaces of memory, i.e. 1) RAM, 2) monitor ROM and space for
I/O ports.
Monitor ROM is placed from location 0000H to 7FFFH. RAM starts at 8000H to
FFFFH
GPIO1 LED is located at 0. User can use instruction that write 8-bit data with 8-bit
address easily, e.g.
3E 01 MVI A,1
D3 00 OUT 0
DF RST 3
FFH
10
GETTING STARTED
The kit accepts DC power supply with minimum voltage of +7.5V. It draws DC
current approx. 250mA. However we can use +9VDC from any AC adapter. The
example of AC adapter is shown below.
11
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 8080 running.
8080
Then the display will show HOME location at 8100. The data field will show its content.
8100 30. 12
HOW TO ENTER PROGRAM USING HEX CODE
Let us try enter HEX CODE of the example program to the memory and test it. We
write the program with 8080 instuction.
This instruction has two bytes hex code i.e., 3E, and 01. 3E is instruction MVI A,n and 01 is
n.
The last instruction is RST 3, hex code DF jump back to monitor program at 0018H.
This test code has only 5 bytes, 3E, 01, D3, 00, DF.
The first byte will be entered to location 8100. And the following bytes will be entered at
8101, 8102, 8103, 8104.
Step 1 Press RESET the display will show current memory address and its contents.
8100 00.
Shown the location 8100 has data 00. There are small dots at the data field indicating the
active field, ready for modifying the hex contents.
13
Step 2 Press key 3 and key E. The new hex code 3E will be entered to the location
8100.
8100 3E.
Step 3 Press key + to increment the location from 8100 to 8101. Then enter hex key
1.
8101 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 ALT, then press key 0, it will show 16-bit contents of register AF.
0397 AF
Press key Reg, 1, 2, 3, for BC, DE, HL register.
Fe00 BC
14
TEST CODE RUNNING
We can test above code running by pressing key GO. The last instruction RST 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 completed, press key HOME then GO.
What is happening?
Can you change the display from 0000 0001 to another value? How?
Now let us enter code, when completed, press key HOME then GO.
15
GPIO1 LED
The 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.
This debug LED is memory location at 00. We can use instruction OUT 0 that writes
8-bit data to it. The LED will be turned on for bit ‘1’ and turned off for bit ‘0’.
The hex code for OUT 0 is D3, 00. Only two bytes and easy to remember!
Anytime we need to check the 8-bit contents, we can copy it to register A then use
this instruction to write it to the gpio1 LED easily.
16
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.
Since bit period is provided by machine cycle delay. Thus to send/receive serial data
correctly, all interrupts must be disabled.
17
CONNECTING 8080 KIT TO TERMINAL
We can connect the 8080 kit to a terminal by 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
8080 kit. New laptop that has 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 2400 bit/s, 8-data bit, no parity, no flow control, one stop bit.
18
Step 2 Click setup>Serial port.
Step 3 Set serial port speed to 2400 and format as shown below.
19
Step 4 Press ENTER key on terminal. The kit will connect terminal automatically.
Press key ? For help commands list.
20
The kit will read the hex file, write to memory, when completed if no checksum error, the
display will show no errors.
Press key J then ENTER, the CPU to jump to location 8100, running the code. More
terminal commands are compatible with 8085 kit.
21
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.
22
10ms TICK GENERATOR
SW1 is a selector for interrupt source between key INTR or 10ms tick produced by
89C2051 microcontroller. Tick generator is software controlled using timer0 interrupt
in the 89C2051 chip. The active low tick signal is sent to P3.7. For tick running
indicator, P1.7 drives D2 LED.
10ms tick
Tick is a 10ms periodic signal for triggering the 8080 INTR pin. When select SW1 to
Tick, the 8080 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.
23
RST 7 STROBING by 8228 BUS CONTROLLER
The 8228 bus controller provides RST 7 instruction code (FF) on the data bus when it
get interrupt recognition from CPU. Sample code for testing interrupt with RST 7
strobing by 8228 bus controller.
0002 8038 .ORG 8038H
0003 8038 C3 04 81 JMP SERVICE_RST7
0004 803B
0005 8100 .ORG 8100H
0006 8100
0007 8100 FB MAIN EI
0008 8101 C3 01 81 JMP $
0009 8104
0010 8104
0011 8104 SERVICE_RST7
0012 8104
0013 8104 3C INR A
0014 8105 D3 00 OUT 0
0015 8107 FB EI
0016 8108 C9 RET
0017 8109
0018 8109 .END
0019 8109
0020 8109
tasm: Number of errors = 0
The interrupt vector for RST 7 instruction is located at 0038H in ROM, the kit has
relocated it to 8038 in RAM. User can enter the service routine for RST 7 then.
To test this code, enter the instruction hex code to memory 8100 to 8108 and the code
for jump instruction at 8038.
Set SW1 to INTR. Press key HOME, then GO. The INTE led will be lit waiting for
INTR signal. Try pressing the INTR key. What is happening at the GPIO1 LED?
Now if we set SW1 to 10ms tick signal, try run it again. We will see the binary
counting with 100Hz rate.
24
CONNECTING LCD MODULE
JR1 is 16-pin header for connecting the LCD module. The example shows connecting
the 20x2 line text LCD module. R6 is a current limit resistor for back-light. R10 is
trimmer POT for contrast adjustment. The LCD module is interfaced to the 8080 bus
directly. The command and data registers are located in I/O space having address
from 80H to 83H.
Be advised that plugging or removing the LCD module must be done when the
kit is powered off.
Text LCD module accepts ASCII codes for displaying the message on screen.
Without settings the LCD by software, no characters will be displayed. The first line
will be black line by adjusting the R10 for contrast adjustment.
If the LCD module is connected, key TEST will write text to the LCD for testing.
25
+12V, -5V POWER SUPPLY
The 8080 CPU requires +12V, -5V, +5V power supply. +5V is produced by 7805
voltage regulator. +12V is produced by DC-to-DC converter circuit using the
MC34063 chip. R5 and R8 must be carefully selected for +12V output.
Importance note: use digital multimeter for checking +12V and -5V before insert the
CPU!
26
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. Tick signal is
indicated by D2 LED blinking. Red clip is for +5V and Black clip for GND.
+ 5V at TP1
GND at TP2
27
HARDWARE SCHEMATIC, PARTS LIST
5 4 3 2 1
28
U1 7 8
2
HM62256B 27C256 D4 + C1
-5V D5 9 10
U2 U3
VDD
GND
A0 A0 10 D0 A0 D0 D6 11 12 22uF
11 25 11 10 11
+5V VBB A0 A1 A1 9 A0 D0 D1 A1 A0 O0 D1 D7 13 14
26 12 9 12
D C2 A1 A2 A2 8 A1 D1 D2 A2 A1 O1 D2 A0 15 16 D
27 13 8 13
100nF ICCmax 80mA20 A2 A3 A3 7 A2 D2 D3 A3 A2 O2 D3 A1 17 18
29 15 7 15
VCC A3 A4 A4 6 A3 D3 D4 A4 A3 O3 D4 A2 19 20
30 16 6 16
+ C3 A4 A5 A5 5 A4 D4 D5 A5 A4 O4 D5 A3 21 22
31 17 5 17
10uF A5 A6 A6 4 A5 D5 D6 A6 A5 O5 D6 A4 23 24 INTR
32 18 4 18
A6 A7 A7 3 A6 D6 D7 A7 A6 O6 D7 A5 25 26 RESET_HI
33 19 3 19
A7 A8 A7 D7 A8 A7 O7 A6 27 28 IOWR
24 34 25 25
WAIT A8 A9 A8 A9 A8 A7 29 30 IORD
35 24 24
A9 A10 A9 A10 A9 31 32 CLK
23 1 21 21
READY A10 A11 A10 A11 A10 33 34
40 23 23
A11 A12 A11 A12 A11 35 36
37 2 2
A12 A13 A12 A13 A12 U4 37 38
38 26 26
A13 A14 A13 A14 A13 39 40
12 39 1 27
RESET A14 A15 A14 A14 D0
36 2 19
A15 U5 RAMCE ROMCE D1 1D 1Q
20 20 3 18
ICCmax 190mA MRD CE MRD CE D2 2D 2Q
22 22 4 17
D0 MWR OE +5V OE D3 3D 3Q
13 10 15 13 27 1 5 16
HOLD D0 D0 DB0 D1 WE VPP D4 4D 4Q
9 17 16 6 15
SYNC D1 D1 DB1 D2 0x1000-0x8FFF 0x0000-0x0FFF D5 5D 5Q
19 8 12 11 7 14
SYNC D2 D3_HALT D2 DB2 D3 +12V D6 6D 6Q
7 10 9 User RAM monitor ROM 8 13
D3 D3 DB3 D4 D7 7D 7Q
3 6 5 9 12
INT D4 D4 DB4 D5 8D 8Q
14 4 19 18
INT D5 D5 DB5 D6 R17 RST7 opcode strobing GPIO1
5 21 20 11
INTE D6 D6 DB6 D7 1k U6 LE
C 16 6 8 7 1 C
INTE D7 D7 DB7 VCC OE
22 23 INTA A15 2 12 RAMCE 20
BUSEN INTA IORD INTR I I/O/Q ROMCE VCC D1 D2 D3 D4 D5 D6 D7 D8
17 4 25 3 13
DBIN DBIN I/OR IOWR A14 I I/O/Q INT
21 2 27 4 14
HDLA HLDA I/OW MWR A5 I I/O/Q GPIO1 74HC573
1 26 5 15
SSTB MEMW MRD A6 I I/O/Q +5V
18 3 24 6 16 LCD_E
WR +5V WR MEMR A7 I I/O/Q VLED
CLK1
CLK2
7 17 PORT0
IORD I I/O/Q ESP switch
28 8 18 PORT1
VCC IOWR I I/O/Q R2 10ms Tick D9
9 19 PORT2
+ C4 I I/O/Q 10kSW1 LED 3mm
8080 1N5236A
22
15
4
4.7k U7 R3 D14 D4
10pF ICC115mA R4 D5 D4
S1 RESET 10K D3_HALT 2 5 0.5 +5V +12V
PR
1N4148 D Q D6 D5
15
XTAL1 ø1
11
RESET
16x2 text LCD interface D7 D6
14 10 3 D7
XTAL2 ø2 CLK C5
6
RDYIN ø2TTL 10uF 10V 220pF R5 JR1
3 6
CL
RESET RDYIN + C6 STSTB Q 20k +5V
B 2
RESIN OSC
12 R2 B
6
1 4 74HC74 U8 16 R6 10
RST RDY 16
1
5 3 5 15
VCC
3
GND
IDD 12mA VDD +5V L1 ISWC 11 D3
1
2 10
+5V STSTB 100uH ISWE 10 D2
9
AM8224 +5V +12V D10 MC34063A 9 D1
8
8 D0
4
7
7
6
10
U27B 6 LCD_E
D19 U9 C7 + 1N4148 5 R/W A1
8
D Q C8 100uF35V 4
2 5 3
VCC
Q LV
74HC74 7 CONN RECT 16 +5V
OSC
13
2
+5V POWER 4.7k
+5V 1 3
TP1 ICL7660 U10 J1
VCC LM2940/TO D12 DC input
A +5V 3 1 VH 2 1 1 R10 A
1 VOUT VIN 10K
C13 10uF 16V
GND
+ + 1N4007 D15
2
C14 C15 C16 C17
C11 C18 C19 C12
0.1uF 0.1uF 0.1uF 0.1uF TVS15V DO-214AC
TP2 0.1uF 0.1uF 1000uF 16V Title
8080 Microprocessor Kit
2
DC2
GND 1 Size Document Number Rev
0.1uF B <Doc> 2
Designed by Wichit Sirichote, (C) 2016
Date: Friday, May 06, 2016 Sheet 1 of 3
5 4 3 2 1
5 4 3 2 1
D0 2 19 E A 14 A 14
D1 1D 1Q G B A B A
3 18 16 16
D2 2D 2Q F C B C B
4 17 13 13
D3 3D 3Q A D C D C
5 16 3 3
D4 4D 4Q B E D E D
6 15 5 5
D5 5D 5Q C F E F E
7 14 11 11
D6 6D 6Q DP G F G F
8 13 15 15
D D7 7D 7Q D DP G DP G D
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
J2
8
D0 74HC573
D1 D0 1
D2 D1 7-segment test 2
D3 D2 3
D4 D3
U14 CON3
D5 D4
D6 D5 D0 PC0
D6 2 19
D7 D1 1D 1Q PC1
D7 3 18
D2 2D 2Q PC2
4 17
D3 3D 3Q PC3 10k RESISTOR SIP 9 R11 VCC
5 16
D4 4D 4Q PC4 PC0
6 15 2 1
D5 5D 5Q PC5 PC1
7 14 3
D6 6D 6Q PC2
8 13 TXD 4
D7 7D 7Q PC7 SPEAKER PC3
9 12 5
8D 8Q PC4
+5V VCC 6
11 PC5 7
C PORT1 LE C
RESET_HI 1 8
VCC OE 0x01
VCC 9
20 PC5 C
VCC PC4
74HC573 PC3
PC2
PC1
PC0
1
R12
S2 S3 S4 S5 S6 S24 SPEAKER 2 Q2
BC557
U15 4.7k
RESET
3
D0 18 2 PA0
D1 Y1 A1 PA1
17 3 S7 S8 S9 S10 S11 S25
D2 Y2 A2 PA2
16 4 LS1
D3 Y3 A3 PA3
15 5
D4 Y4 A4 PA4 INTR
14 6
D5 Y5 A5 PA5
13 7 RXD
D6 Y6 A6 PA6
B 12 8 S12 S13 S14 S15 S16 S26 SPEAKER B
D7 Y7 A7 PA7 +5V
11 9 S27
Y8 A8 R13
USER
1
G1 VCC 10
PORT0 19 S17 S18 S19 S20 S21 S22
G2 S23
20
VCC
74HC541 REP
+
R15 PA5 7
2 12 TICK/2 680 U17 PA6 8
P3.0/RXD P1.0/AIN0 1 PA7
3 13 2 1 9
P3.1/TXD P1.1/AIN1 VB1 V+ C+ 10uF C
6 14 3
P3.2/INTO P1.2 TEST POINT D13 C1-
7 15 5 6 4
P3.3/INT1 P1.3 C22 V- C2+
8 16 LED 9 5
P3.4/T0 P1.4 + C2-
+
9 17 4 C23
A P3.5/T1 P1.5 10uF A
18 8
P1.6
19 3 14 11 TXD
P1.7 T1OUT T1IN
CLK 5 7 7 10
XTAL1 T2OUT T2IN
4 2 13 12 RXD
XTAL2 R1IN R1OUT
6 8 9
TICK R2IN R2OUT Title
RESET_HI 1 11 TICK 1
+5V RST/VPP P3.7 8080 Microprocessor Kit
20 SUB-D 9, Male (cross cable) MAX232A
VCC Size Document Number Rev
B <Doc> 1
AT89C2051
Date: Friday, May 06, 2016 Sheet 2 of 3
5 4 3 2 1
PARTS LIST R15 680
R17 1k
Semiconductors
Capacitors
U1 8080AP, 8-bit Microprocessor
U2 HM62256B, 32kB SRAM C1 22uF
U3 27C256, 32kB EPROM C7,C2 100nF
U5 AM8228, BUS controller C3,C4,C9,C10,C21,C22,C23 10uF
U4,U13,U14 74HC573, 8-bit data latch C5 220pF
U6 GAL16V8B, PLD C20,C6 10uF 10V
U7 AM8224, oscillator C8 100uF35V
U8 MC34063A, DC-to-DC converter for C11 10uF 16V
+12V generation C12 1000uF 16V
U9 ICL7660, voltage converter for -5V C13,C14,C15,C16,C17 0.1uF
generation C18,C19 0.1uF
U10 LM7805 C24 10pF
U12,U11 LTC-4727JF, 7-segment LED
U15 74HC541, 8-bit tri-state buffer Additional parts
U16 AT89C2051, microcontroller
U17 MAX232A, rs232 converter JP1 HEADER 20X2
U27 74HC74, dual data latch for HALT JR1 CONN RECT 16
and INTE indicators. J1 DC input
D1,D2,D4,D5,D6,D7,D8,D13 LED J2 CON3
D3 LED 3mm LS1 SPEAKER
D9 1N5236A L1 100uH
D10,D14 1N4148
D11 POWER SW1 ESP switch
D12 1N4007
D15 TVS15V DO-214AC SW2 INT
D18 HALT LED (RED) S1 RESET
D19 INTE LED (Yellow) S2,S3,S4,S5,S6,S7,S8,S9, SW PUSH
Q1 KIA7042, voltage detector BUTTON
Q2 BC557, PNP transistor S10,S11,S12,S13,S14,S15,
Resistors (all resistors are 1/8W +/-5%) S16,S17,S18,S19,S20,S21,
S22,S23,S24,S25,S26,S27
R1,R9,R12 4.7k TP1 +5V
R2,R3,R10 10K TP2 GND
R4 0.5 TP3 TEST POINT
R5 20k
R13,R6 10
R7 220 VB1 SUB-D 9, Male (cross cable)
R8 2.2k Y1 XTAL 18.432MHz
R14,R11 10k RESISTOR SIP 9
PCB double side plate through hole
LED cover Clear RED color acrylic
plastic
Keyboard sticker printable SVG file
MONITOR PROGRAM LISTINGS
B8080.LST 3/12/2560 20:42
1 ;------------------------------------------------------------
2 ; B8080.ASM
3 ; monitor program for 8080 MICROPROCESSOT TRAINING KIT
4 ; COPYTIGHT (C) 2016 BY WICHIT SIRICHOTE, wichit.sirichote
5 ;
6 ; source file was assembled with C32 Cross Assembler V3.
7 ;
8 ; 18 May 2007 add insert byte, ALT E
9 ; delete byte, ALT D
10 ; click sound when key pressed
11 ;
12 ; 8 March 2015 remove repeat key
13 ; modified address and data entry mode
14 ; 3 April 2016 replace buzzer with small speaker for tone
15 ; add beep/no beep with ALT F press
16 ; 16 April 2016 add delay after no beep
17
18 ; 24 April 2016 modify the source code for 8080 kit
19 ; 27 April 2016 test 1200 bit/s software UART
20 ; 30 April 2016 change Xtal to 18.432MHz
21 ; 2 May 2016 test serial commands via 2400 bit/s terminal
22 ; 8 May 2016 add test key for LCD, GPIO led, beep and 10
23 ; USER key press will jump to 8050h
24 ; put 76 code on cold boot
25 ; 15 Jan 2017 adjust brightness for Amber LED LTC4727JF
26 ;
27 ;------------------------------------------------------------
28
29 0000 CPU "8085.TBL" ;CPU TABLE
30 0000 HOF "INT8" ;HEX FORMAT
31
32
33 ; ---------- onboard GPIO -----------------------------------
34
35 0000 = gpio equ 0 ; D0-D3 is 4-bit output port, D4-D7 is 4-bit
36
37
38 ;---------- 8255 PPI system port I/O address ----------------
39
40 0020 = port0: equ 20h
41 0060 = port2: equ 60h
42 0040 = port1: equ 40h
43
44 0060 = segment: equ 60h
45 0040 = digit: equ 40h
46 0020 = port0: equ 20h
47
48
49
50 ;-------------------- 8254 counter/timer --------------------
51
52 0020 = counter0_8254 equ 20h
53 0021 = counter1_8254 equ 21h
54 0022 = counter2_8254 equ 22h
55 0023 = control_8254 equ 23h
56
57 0034 = control_word_8254 equ 00110100B ; mode 0, counter0
58
59 ;---------- 8255 PPI user port I/O address ------------------
60
Page 1 of 86
B8080.LST 3/12/2560 20:42
Page 2 of 86
B8080.LST 3/12/2560 20:42
Page 3 of 86
B8080.LST 3/12/2560 20:42
181
182 0122 AF skip_boot: xra a ; write 00 to 8000H
183 0123 320080 sta 8000H
184 ; sta counter1 ; clear counter1
185
186 0126 3A29F0 lda warm_code
187 0129 FE24 cpi "$"
188 012B CA4701 jz skip_cold_boot
189
190 012E 3E24 mvi a,"$"
191 0130 3229F0 sta warm_code
192
193 0133 CD2306 call test_buzzer
194
195 0136 3EFF mvi a,0ffh
196 0138 D300 out gpio ; make GPIO LED on
197
198 013A CD6C0B call cold_boot
199
200 013D 3E00 mvi a, 0
201 013F 3224F0 sta beep_flag
202
203 0142 3E76 mvi a,76h
204 0144 325080 sta 8050h ; put HALT to location 8050h,
205
206
207
208 0147 skip_cold_boot:
209
210
211 0147 210081 lxi h,home_address
212 014A 222AF0 shld user_PC
213 014D 223CF0 shld pointer
214
215 0150 3A25F0 lda uart_found
216 0153 FE00 cpi 0
217 0155 CA5E01 jz skip_send_prompt
218
219 0158 CDFD12 call send_prompt3
220
221 015B CD920D call send_prompt
222
223
224 015E skip_send_prompt:
225
226 015E AF xra a
227 015F D300 out gpio ; turn LED off
228
229 0161 3E00 mvi a,0
230 0163 3226F0 sta entry_mode ; set data entry mode
231 0166 CDB40A call read_memory
232
233 0169 CD7C0C main: call scan_key
234 016C CD6105 call key_execute
235 016F F26901 jp main
236
237
238 ;---------------- initialize counter0 for RST7.5 interrupt
239
240 0172 3E34 init_8254: mvi a, control_word_8254
Page 4 of 86
B8080.LST 3/12/2560 20:42
Page 5 of 86
B8080.LST 3/12/2560 20:42
Page 6 of 86
B8080.LST 3/12/2560 20:42
Page 7 of 86
B8080.LST 3/12/2560 20:42
Page 8 of 86
B8080.LST 3/12/2560 20:42
481
482 0297 C9 ret
483
484
485 ; test diplay register after break
486 ; RST 2 opcode is D7
487 ; later will be changed to RST 7
488
489 0298 service_rst2:
490 0298 F5 push psw
491 0299 C5 push b
492 029A D5 push d
493
494 029B E1 pop h
495 029C 2230F0 shld user_DE
496 029F E1 pop h
497 02A0 222EF0 shld user_BC
498 02A3 E1 pop h
499 02A4 222CF0 shld user_AF
500 02A7 E1 pop h
501
502 02A8 222AF0 shld user_PC ; store next PC
503
504 02AB 210000 lxi h,0000h
505 02AE 39 dad sp ; get content of SP
506
507 02AF 2234F0 shld user_SP ; save user SP
508
509 02B2 CDB40A call read_memory
510 02B5 CDAC0F call register_display1
511
512 02B8 2A57F0 lhld save_stack
513
514 02BB F9 sphl ; restore system stack
515
516
517 02BC C9 ret
518
519
520 ; service trap for single step running
521 ; disable trap input by setting system port c.6
522 ; save CPU registers to user registers
523
524 02BD service_trap:
525 02BD F5 push psw ; save A and Flag
526
527 02BE 3EFF mvi a,0ffh
528 02C0 D340 out port1 ; turn trap off by clearing shift
529
530 02C2 C5 push b
531 02C3 D5 push d
532 02C4 E5 push h
533
534 02C5 E1 pop h
535 02C6 2232F0 shld user_HL ; save HL
536 02C9 E1 pop h
537 02CA 2230F0 shld user_DE
538 02CD E1 pop h
539 02CE 222EF0 shld user_BC
540 02D1 E1 pop h
Page 9 of 86
B8080.LST 3/12/2560 20:42
Page 10 of 86
B8080.LST 3/12/2560 20:42
Page 11 of 86
B8080.LST 3/12/2560 20:42
661
662 0363 CD0604 call get_number_of_byte
663 0366 FE01 cpi 1
664 0368 C27003 jnz disassem1
665 036B 23 inx h
666 036C 222AF0 shld user_PC
667 036F C9 ret
668
669 0370 FE02 disassem1: cpi 2
670 0372 C27F03 jnz disassem2
671 0375 23 inx h
672 0376 7E mov a,m
673 0377 CD1513 call out2x
674 037A 23 inx h
675 037B 222AF0 shld user_PC
676 037E C9 ret
677
678 037F 23 disassem2: inx h
679 0380 23 inx h
680 0381 7E mov a,m
681 0382 CD1513 call out2x
682 0385 2B dcx h
683 0386 7E mov a,m
684 0387 CD1513 call out2x
685 038A 23 inx h
686 038B 23 inx h
687 038C 222AF0 shld user_PC
688 038F C9 ret
689
690 ; disassemble opcode to mnemonic with command 'd'
691 ; entry: pointer
692 ; exit: pointer = next address
693
694 0390 2A3CF0 d_disassemble: lhld pointer
695
696 0393 E5 push h
697
698 0394 7C mov a,h
699 0395 CD1513 call out2x
700 0398 7D mov a,l
701 0399 CD1513 call out2x
702 039C CD2F13 call space
703
704 039F 7E mov a,m ; get opcode
705 03A0 CD0604 call get_number_of_byte
706 03A3 4F mov c,a
707
708 03A4 7E d_disassem3: mov a,m
709 03A5 CD1513 call out2x
710 03A8 23 inx h
711 03A9 0D dcr c
712 03AA C2A403 jnz d_disassem3
713
714 03AD E1 pop h
715
716 03AE 7E mov a,m
717 03AF CD0604 call get_number_of_byte
718 03B2 FE01 cpi 1
719 03B4 C2BC03 jnz d_one_tab
720
Page 12 of 86
B8080.LST 3/12/2560 20:42
721 03B7 3E09 mvi a,tab ; print two tabs for one
722 03B9 CD8712 call cout
723
724 03BC 3E09 d_one_tab: mvi a,tab ; else only one tab
725 03BE CD8712 call cout
726
727 03C1 E5 push h
728
729 03C2 7E mov a,m ; get opcode
730
731 03C3 F5 push psw
732
733 03C4 210000 lxi h,0000h ; clear HL
734 03C7 6F mov l,a
735
736 03C8 29 dad h ; HL = HLx2
737
738 03C9 5D mov e,l
739 03CA 54 mov d,h
740
741 03CB 212B16 lxi h,ins_table
742 03CE 19 dad d ; ADD HL,DE
743 03CF 5E mov e,m
744 03D0 23 inx h
745 03D1 56 mov d,m
746
747 03D2 6B mov l,e
748 03D3 62 mov h,d
749
750 03D4 CDAD12 call put_str
751
752 03D7 F1 pop psw
753 03D8 E1 pop h
754
755 03D9 CD0604 call get_number_of_byte
756 03DC FE01 cpi 1
757 03DE C2E603 jnz d_disassem1
758 03E1 23 inx h
759 03E2 223CF0 shld pointer
760 03E5 C9 ret
761
762 03E6 FE02 d_disassem1: cpi 2
763 03E8 C2F503 jnz d_disassem2
764 03EB 23 inx h
765 03EC 7E mov a,m
766 03ED CD1513 call out2x
767 03F0 23 inx h
768 03F1 223CF0 shld pointer
769 03F4 C9 ret
770
771 03F5 23 d_disassem2: inx h
772 03F6 23 inx h
773 03F7 7E mov a,m
774 03F8 CD1513 call out2x
775 03FB 2B dcx h
776 03FC 7E mov a,m
777 03FD CD1513 call out2x
778 0400 23 inx h
779 0401 23 inx h
780 0402 223CF0 shld pointer
Page 13 of 86
B8080.LST 3/12/2560 20:42
Page 14 of 86
B8080.LST 3/12/2560 20:42
Page 15 of 86
B8080.LST 3/12/2560 20:42
Page 16 of 86
B8080.LST 3/12/2560 20:42
Page 17 of 86
B8080.LST 3/12/2560 20:42
Page 18 of 86
B8080.LST 3/12/2560 20:42
Page 19 of 86
B8080.LST 3/12/2560 20:42
Page 20 of 86
B8080.LST 3/12/2560 20:42
Page 21 of 86
B8080.LST 3/12/2560 20:42
Page 22 of 86
B8080.LST 3/12/2560 20:42
Page 23 of 86
B8080.LST 3/12/2560 20:42
1381
1382 ;****************** ALT register display ********************
1383
1384 0739 5A select_register: mov e,d ; save key for selecting user
1385
1386 073A 7A mov a,d
1387 073B FE00 cpi 0
1388 073D C25707 jnz register1
1389
1390 0740 3E3F mvi a,3fh ; AF register pair
1391 0742 3214F0 sta buffer+4
1392 0745 3E0F mvi a,0fh
1393 0747 3215F0 sta buffer+5
1394
1395 074A 212CF0 lxi h,user_AF
1396 074D 2238F0 shld current_register
1397
1398
1399 0750 2A2CF0 lhld user_AF
1400 0753 CD890A call read_register
1401 0756 C9 ret
1402
1403 0757 register1:
1404 0757 FE01 cpi 1
1405 0759 C27307 jnz register2
1406
1407 075C 3EA7 mvi a,0a7h ; BC register pair
1408 075E 3214F0 sta buffer+4
1409 0761 3E8D mvi a,8dh
1410 0763 3215F0 sta buffer+5
1411
1412 0766 212EF0 lxi h,user_BC
1413 0769 2238F0 shld current_register
1414
1415 076C 2A2EF0 lhld user_BC
1416 076F CD890A call read_register
1417
1418 0772 C9 ret
1419
1420 0773 register2:
1421 0773 FE02 cpi 2
1422 0775 C28F07 jnz register3
1423
1424 0778 3EB3 mvi a,0b3h ; DE register pair
1425 077A 3214F0 sta buffer+4
1426 077D 3E8F mvi a,8fh
1427 077F 3215F0 sta buffer+5
1428
1429 0782 2130F0 lxi h,user_DE
1430 0785 2238F0 shld current_register
1431
1432 0788 2A30F0 lhld user_DE
1433 078B CD890A call read_register
1434
1435 078E C9 ret
1436
1437 078F register3:
1438 078F FE03 cpi 3
1439 0791 C2AB07 jnz register4
1440
Page 24 of 86
B8080.LST 3/12/2560 20:42
Page 25 of 86
B8080.LST 3/12/2560 20:42
1501
1502 07F3 3E8D mvi a,8dh ; carry flag
1503 07F5 3210F0 sta buffer
1504 07F8 3EB6 mvi a,0b6h
1505 07FA 3211F0 sta buffer+1
1506 07FD 3E00 mvi a,00h
1507 07FF 3212F0 sta buffer+2
1508
1509 0802 2A2CF0 lhld user_AF
1510 0805 7D mov a,l
1511
1512 0806 E601 ani 1
1513 0808 CDE307 call put_flag
1514 080B 3213F0 sta buffer+3
1515
1516 080E AF xra a
1517 080F 3214F0 sta buffer+4
1518 0812 3215F0 sta buffer+5
1519
1520 0815 C9 ret
1521
1522 0816 register7:
1523 0816 FE07 cpi 7
1524 0818 C24108 jnz register8
1525
1526 081B 3E8A mvi a,8ah ; zero flag
1527 081D 3210F0 sta buffer
1528 0820 3E8F mvi a,8fh
1529 0822 3211F0 sta buffer+1
1530 0825 3E03 mvi a,03h
1531 0827 3212F0 sta buffer+2
1532 082A 3EA3 mvi a,0a3h
1533 082C 3213F0 sta buffer+3
1534 082F 3E00 mvi a,00h
1535 0831 3214F0 sta buffer+4
1536
1537
1538 0834 2A2CF0 lhld user_AF
1539 0837 7D mov a,l
1540
1541 0838 E640 ani 40h
1542 083A CDE307 call put_flag
1543 083D 3215F0 sta buffer+5
1544
1545 0840 C9 ret
1546
1547
1548 0841 register8:
1549 0841 FE08 cpi 8
1550 0843 C27208 jnz register9
1551
1552 0846 3EAE mvi a,0aeh ; sign flag
1553 0848 3210F0 sta buffer
1554 084B 3E89 mvi a,89h
1555 084D 3211F0 sta buffer+1
1556 0850 3EAD mvi a,0adh
1557 0852 3212F0 sta buffer+2
1558 0855 3E23 mvi a,23h
1559 0857 3213F0 sta buffer+3
1560 085A 3E00 mvi a,00h
Page 26 of 86
B8080.LST 3/12/2560 20:42
Page 27 of 86
B8080.LST 3/12/2560 20:42
Page 28 of 86
B8080.LST 3/12/2560 20:42
1681
1682 0915 FE0E insert_byte: cpi 14 ; test with key E
1683 0917 C24009 jnz delete_byte
1684
1685 091A 2A2AF0 lhld user_PC
1686 091D E5 push h ; save PC to stack
1687
1688 091E 110002 lxi d,512
1689 0921 19 dad d
1690 0922 E5 push h
1691 0923 C1 pop b ; copy HL to BC
1692 0924 0B dcx b
1693
1694 0925 110002 lxi d,512 ; load counter with 512 bytes
1695
1696 0928 insert_byte1:
1697 0928 0A ldax b
1698 0929 77 mov m,a
1699 092A 2B dcx h
1700 092B 0B dcx b
1701 092C 1B dcx d
1702 092D 7B mov a,e
1703 092E B2 ora d ; check DE ==0
1704 092F C22809 jnz insert_byte1
1705
1706 0932 E1 pop h ; restore user PC
1707 0933 AF xra a
1708 0934 77 mov m,a ; store 00 at insert byte
1709 0935 CDB40A call read_memory
1710 0938 AF xra a
1711 0939 3226F0 sta entry_mode
1712 093C CDF80A call mode_indicator
1713
1714 093F C9 ret
1715
1716
1717 ;--------------- ALT D delete byte --------------------------
1718 ; delete byte within 512 bytes
1719
1720 0940 FE0D delete_byte: cpi 13
1721 0942 C26509 jnz beep_chk
1722
1723 0945 2A2AF0 lhld user_PC
1724 0948 E5 push h
1725 0949 E5 push h
1726 094A C1 pop b
1727
1728 094B 03 inx b
1729 094C 110002 lxi d,512
1730
1731 094F delete_byte1:
1732 094F 0A ldax b
1733 0950 77 mov m,a
1734 0951 23 inx h
1735 0952 03 inx b
1736 0953 1B dcx d
1737 0954 7B mov a,e
1738 0955 B2 ora d ; check if DE ==0
1739 0956 C24F09 jnz delete_byte1
1740
Page 29 of 86
B8080.LST 3/12/2560 20:42
Page 30 of 86
B8080.LST 3/12/2560 20:42
Page 31 of 86
B8080.LST 3/12/2560 20:42
Page 32 of 86
B8080.LST 3/12/2560 20:42
Page 33 of 86
B8080.LST 3/12/2560 20:42
Page 34 of 86
B8080.LST 3/12/2560 20:42
Page 35 of 86
B8080.LST 3/12/2560 20:42
2101
2102
2103
2104
2105
2106 0B31 F1 pop psw
2107 0B32 C9 ret
2108
2109 0B33 FE01 mode1: cpi 1
2110 0B35 C26A0B jnz mode2
2111
2112 0B38 3A15F0 lda buffer+5 ; mode 1 indicator
2113 0B3B E6BF ani 0bfh
2114 0B3D 3215F0 sta buffer+5
2115
2116 0B40 3A14F0 lda buffer+4
2117 0B43 E6BF ani 0bfh
2118 0B45 3214F0 sta buffer+4
2119
2120 0B48 3A13F0 lda buffer+3
2121 0B4B F640 ori 40h
2122 0B4D 3213F0 sta buffer+3
2123
2124 0B50 3A12F0 lda buffer+2
2125 0B53 F640 ori 40h
2126 0B55 3212F0 sta buffer+2
2127
2128 0B58 3A11F0 lda buffer+1
2129 0B5B F640 ori 40h
2130 0B5D 3211F0 sta buffer+1
2131
2132 0B60 3A10F0 lda buffer
2133 0B63 F640 ori 40h
2134 0B65 3210F0 sta buffer
2135
2136
2137
2138
2139 0B68 F1 pop psw
2140 0B69 C9 ret
2141
2142 0B6A F1 mode2: pop psw
2143 0B6B C9 ret
2144
2145 0B6C 0E07 cold_boot: mvi c,7
2146 0B6E 218A0B lxi h,title
2147
2148
2149 0B71 1650 cold2: mvi d,50h
2150
2151 0B73 CDAC0C cold1: call scan
2152 0B76 15 dcr d
2153 0B77 C2730B jnz cold1
2154
2155 0B7A 23 inx h
2156 0B7B 0D dcr c
2157 0B7C C2710B jnz cold2
2158
2159 0B7F 2B dcx h
2160
Page 36 of 86
B8080.LST 3/12/2560 20:42
Page 37 of 86
B8080.LST 3/12/2560 20:42
2221
2222 0BD1 FE13 code6: cpi 13h
2223 0BD3 C2D90B jnz code7
2224 0BD6 3E10 mvi a,10h ; addr
2225 0BD8 C9 ret
2226
2227 0BD9 FE0E code7: cpi 0eh
2228 0BDB C2E10B jnz code8
2229 0BDE 3E07 mvi a,7
2230 0BE0 C9 ret
2231
2232 0BE1 FE04 code8: cpi 4
2233 0BE3 C2E90B jnz code9
2234 0BE6 3E0D mvi a,0dh
2235 0BE8 C9 ret
2236
2237 0BE9 FE0C code9: cpi 0ch
2238 0BEB C2F10B jnz code10
2239 0BEE 3E0F mvi a,0fh
2240 0BF0 C9 ret
2241
2242 0BF1 FE14 code10: cpi 14h
2243 0BF3 C2F90B jnz code11
2244 0BF6 3E19 mvi a,19h ; user
2245 0BF8 C9 ret
2246
2247 0BF9 FE0F code11: cpi 0fh
2248 0BFB C2010C jnz code12
2249 0BFE 3E03 mvi a,3
2250 0C00 C9 ret
2251
2252 0C01 FE05 code12: cpi 5
2253 0C03 C2090C jnz code13
2254 0C06 3E09 mvi a,9
2255 0C08 C9 ret
2256
2257 0C09 FE0D code13: cpi 0dh
2258 0C0B C2110C jnz code14
2259 0C0E 3E0B mvi a,0bh
2260 0C10 C9 ret
2261
2262 0C11 FE15 code14: cpi 15h
2263 0C13 C2190C jnz code15
2264 0C16 3E17 mvi a,17h ; home
2265 0C18 C9 ret
2266
2267 0C19 FE17 code15: cpi 17h
2268 0C1B C2210C jnz code16
2269 0C1E 3E11 mvi a,11h ; data
2270 0C20 C9 ret
2271
2272 0C21 FE10 code16: cpi 10h
2273 0C23 C2290C jnz code17
2274 0C26 3E18 mvi a,18h ; modify
2275 0C28 C9 ret
2276
2277 0C29 FE18 code17: cpi 18h
2278 0C2B C2310C jnz code18
2279 0C2E 3E15 mvi a,15h ; dec
2280 0C30 C9 ret
Page 38 of 86
B8080.LST 3/12/2560 20:42
2281
2282 0C31 FE01 code18: cpi 1
2283 0C33 C2390C jnz code19
2284 0C36 3E08 mvi a,8
2285 0C38 C9 ret
2286
2287 0C39 FE00 code19: cpi 0
2288 0C3B C2410C jnz code20
2289 0C3E 3E0C mvi a,0ch
2290 0C40 C9 ret
2291
2292 0C41 FE08 code20: cpi 8
2293 0C43 C2490C jnz code21
2294 0C46 3E0E mvi a,0eh
2295 0C48 C9 ret
2296
2297 0C49 FE09 code21: cpi 9
2298 0C4B C2510C jnz code22
2299 0C4E 3E0A mvi a,0ah
2300 0C50 C9 ret
2301
2302 0C51 FE11 code22: cpi 11h
2303 0C53 C2590C jnz code23
2304 0C56 3E16 mvi a,16h ; step
2305 0C58 C9 ret
2306
2307 0C59 FE19 code23: cpi 19h
2308 0C5B C2610C jnz code24
2309 0C5E 3E12 mvi a,12h ; inc
2310 0C60 C9 ret
2311
2312 0C61 FE16 code24: cpi 16h
2313 0C63 C2690C jnz code25
2314 0C66 3E14 mvi a,14h ;ALT
2315 0C68 C9 ret
2316
2317 0C69 FE12 code25: cpi 12h
2318 0C6B C2710C jnz code26
2319 0C6E 3E13 mvi a,13h ; GO
2320 0C70 C9 ret
2321
2322 0C71 FE20 code26: cpi 20h
2323 0C73 C2790C jnz code27
2324 0C76 3E20 mvi a,20h ; RXD
2325 0C78 C9 ret
2326
2327 0C79 code27
2328
2329
2330 0C79 3EFF mvi a,0ffh
2331 0C7B C9 ret
2332
2333 ; scan display and keyboard unitl key was pressed
2334
2335 0C7C scan_key: ; mvi d,50 ; number of loop for timeout
2336
2337 0C7C scan_key4: ;push d ; save d
2338
2339 0C7C 2110F0 lxi h,buffer
2340 0C7F CDAC0C call scan
Page 39 of 86
B8080.LST 3/12/2560 20:42
Page 40 of 86
B8080.LST 3/12/2560 20:42
2401
2402 0CC0 7E mov a,m ; load a with [hl]
2403 0CC1 D360 out port2 ; then turn segment on
2404
2405 0CC3 FE30 cpi 30h ; check for 1
2406 0CC5 C2CD0C jnz checkmore
2407 0CC8 00 nop
2408 0CC9 00 nop
2409 0CCA C3DE0C jmp skip23
2410 0CCD checkmore ; check for 1.
2411 0CCD FE70 cpi 70h
2412 0CCF C2D80C jnz long_delay
2413 0CD2 00 nop
2414 0CD3 00 nop
2415 0CD4 00 nop
2416 0CD5 C3DE0C jmp skip23
2417
2418 0CD8 long_delay
2419
2420 0CD8 0603 mvi b,3 ; time ON
2421 0CDA 05 wait1: dcr b
2422 0CDB C2DA0C jnz wait1
2423
2424 0CDE AF skip23 xra a
2425 0CDF D360 out port2 ; turn off segment
2426
2427 0CE1 0605 mvi b,5 ; time OFF
2428 0CE3 05 wait2: dcr b
2429 0CE4 C2E30C jnz wait2
2430
2431
2432
2433 0CE7 DB20 in port0 ; read input port
2434
2435 0CE9 0604 mvi b,4 ; check all 8-row
2436 0CEB 1F shift_key: rar ; rotate right through carry
2437 0CEC DAF50C jc next_key ; if carry = 1 then no key presse
2438
2439 0CEF F5 push psw
2440 0CF0 7A mov a,d
2441 0CF1 3221F0 sta key ; save key position
2442 0CF4 F1 pop psw
2443
2444 0CF5 next_key:
2445 0CF5 14 inr d ; next key position
2446
2447 0CF6 05 dcr b ; until 8-bit was shifted
2448 0CF7 C2EB0C jnz shift_key
2449
2450
2451 0CFA 7B mov a,e ; next digit
2452 0CFB 0F rrc
2453 0CFC 5F mov e,a
2454
2455 0CFD 23 inx h ; next location
2456
2457 0CFE 0D dcr c ; next column
2458 0CFF C2BA0C jnz scan1
2459
2460 ; call serial_command
Page 41 of 86
B8080.LST 3/12/2560 20:42
2461
2462 ; check the rest keys at PA6 and PA7
2463
2464 0D02 DB20 in port0
2465 0D04 E680 ani 80h ; check S17
2466 0D06 C2110D jnz check_S27
2467
2468
2469 0D09 3E18 mvi a,18h ; if pressed next key code will be
2470 0D0B 3221F0 sta key
2471 0D0E C3290D jmp skip_check_S27
2472
2473 0D11 check_S27:
2474
2475 0D11 DB20 in port0
2476 0D13 E640 ani 40h
2477 0D15 C21D0D jnz check_RXD
2478
2479 0D18 3E19 mvi a,19h
2480 0D1A 3221F0 sta key
2481
2482 0D1D DB20 check_RXD in port0
2483 0D1F E620 ani 20h ; test RXD pin
2484 0D21 C2290D jnz skip_check_s27
2485
2486 0D24 3E20 mvi a,20h
2487 0D26 3221F0 sta key
2488
2489 0D29 skip_check_S27:
2490
2491 ; check range of scan code, must be 00-20h
2492
2493 0D29 3A21F0 lda key
2494 0D2C FEFF cpi 0ffh
2495 0D2E CA490D jz no_key_pressed
2496
2497 ; check accept only 00 to 20H
2498
2499 0D31 FE21 cpi 21h
2500 0D33 FA3E0D jm check_lowest
2501
2502 0D36 3EFF mvi a,0ffh
2503 0D38 3221F0 sta key
2504 0D3B C3490D jmp no_key_pressed
2505
2506 0D3E check_lowest
2507 0D3E FE00 cpi 0
2508 0D40 F2480D jp valid_key
2509
2510 0D43 3EFF mvi a,0ffh
2511 0D45 3221F0 sta key
2512
2513 0D48 00 valid_key: nop
2514
2515 0D49 no_key_pressed:
2516
2517 0D49 D1 pop d
2518 0D4A C1 pop b
2519 0D4B E1 pop h
2520 0D4C C9 ret
Page 42 of 86
B8080.LST 3/12/2560 20:42
2521
2522
2523
2524 ;----------- serial commands with 9600 8n1 terminal ---------
2525 ; check if serial buffer has command
2526 ;
2527 0D4D connect_terminal:
2528
2529 0D4D F1 pop psw ; dummy pop remove return address
2530
2531 0D4E serial_command:
2532 ;lda uart_found
2533 ;cpi 0
2534 ;jz skip_serial
2535
2536 0D4E CD9312 call get_command
2537 0D51 CDA80D call download
2538 0D54 CD8A0D call prompting
2539 0D57 CD3B13 call hex_dump
2540 0D5A CD4612 call help
2541 0D5D CD1F12 call quick_home
2542 0D60 CD3412 call io_address
2543 0D63 CD0212 call new_location
2544 0D66 CD7F11 call edit_location
2545 0D69 CD3511 call jump_to_user_pgm
2546 0D6C CD1C11 call monitor_function
2547 0D6F CDCA0D call ascii_print
2548 0D72 CDD810 call fill_memory
2549 0D75 CDA40F call register_display
2550 0D78 CD640F call stack_display
2551 0D7B CDF302 call disassemble1
2552
2553 ; call single_step_ ; 8080 kit has no single step
2554 ; 8085 kit use trap pin for
2555
2556 0D7E CD490F call print_watch
2557 0D81 CD2E0F call clear_watch
2558 0D84 CDFC0D call set_user_register
2559
2560
2561
2562 0D87 skip_serial:
2563
2564
2565
2566 0D87 C34E0D jmp serial_command ; now repeat until RESET
2567
2568 0D8A 3A22F0 prompting: lda command
2569 0D8D FE0D cpi cr
2570 0D8F C2A70D jnz exit_prompting
2571
2572 0D92 send_prompt:
2573
2574 0D92 CD2413 call new_line
2575 0D95 2A3CF0 lhld pointer ; user_PC
2576 0D98 7C mov a,h
2577 0D99 CD1513 call out2x
2578 0D9C 7D mov a,l
2579 0D9D CD1513 call out2x
2580 0DA0 21F31E lxi h,prompt_text
Page 43 of 86
B8080.LST 3/12/2560 20:42
Page 44 of 86
B8080.LST 3/12/2560 20:42
Page 45 of 86
B8080.LST 3/12/2560 20:42
Page 46 of 86
B8080.LST 3/12/2560 20:42
Page 47 of 86
B8080.LST 3/12/2560 20:42
Page 48 of 86
B8080.LST 3/12/2560 20:42
2881
2882 ; lxi h,stack_text
2883 ; call put_str
2884
2885 0F6C 21481F lxi h,edit_text2
2886 0F6F CDAD12 call put_str
2887 0F72 CD2413 call new_line
2888
2889 0F75 2A34F0 lhld user_SP
2890
2891 0F78 stack_display1:
2892
2893 0F78 7C mov a,h
2894 0F79 CD1513 call out2x
2895 0F7C 7D mov a,l
2896 0F7D CD1513 call out2x
2897
2898 0F80 CD2F13 call space
2899 0F83 CD2F13 call space
2900 0F86 3E5B mvi a,"["
2901 0F88 CD8712 call cout
2902
2903 0F8B 7E mov a,m
2904 0F8C CD1513 call out2x
2905
2906 0F8F 3E5D mvi a,"]"
2907 0F91 CD8712 call cout
2908
2909 0F94 CD2413 call new_line
2910
2911 0F97 23 inx h
2912
2913 0F98 119AF0 lxi d, user_stack+32+1 ; load base of user stack
2914
2915 0F9B 7D mov a,l
2916 0F9C AB xra e
2917 0F9D C2780F jnz stack_display1
2918
2919 0FA0 CD920D call send_prompt
2920
2921 0FA3 exit_stack:
2922 0FA3 C9 ret
2923
2924
2925
2926 ;---------------- registers display -------------------------
2927
2928 0FA4 register_display:
2929
2930 0FA4 3A22F0 lda command
2931 0FA7 FE72 cpi "r"
2932 0FA9 C2C910 jnz exit_register
2933
2934 0FAC register_display1:
2935
2936 ; lda uart_found
2937 ; cpi 0
2938 ; jz exit_register ; exit of no uart
2939
2940
Page 49 of 86
B8080.LST 3/12/2560 20:42
Page 50 of 86
B8080.LST 3/12/2560 20:42
Page 51 of 86
B8080.LST 3/12/2560 20:42
Page 52 of 86
B8080.LST 3/12/2560 20:42
Page 53 of 86
B8080.LST 3/12/2560 20:42
Page 54 of 86
B8080.LST 3/12/2560 20:42
Page 55 of 86
B8080.LST 3/12/2560 20:42
3301
3302 11F3 3A23F0 lda flag1
3303 11F6 E6FE ani 0feh
3304 11F8 3223F0 sta flag1
3305
3306 11FB CD2413 call new_line
3307 11FE CD920D call send_prompt
3308
3309 1201 C9 exit_edit: ret
3310
3311
3312 1202 3A22F0 new_location: lda command
3313 1205 FE6E cpi "n"
3314 1207 C21E12 jnz exit_new_location
3315 120A 21F51E lxi h,new_text
3316 120D CDAD12 call put_str
3317 1210 CDCF13 call get_hex1
3318 1213 67 mov h,a
3319 1214 CDCF13 call get_hex1
3320 1217 6F mov l,a
3321 1218 223CF0 shld pointer ; user_PC
3322 121B CD920D call send_prompt
3323
3324 121E exit_new_location:
3325
3326 121E C9 ret
3327
3328
3329
3330
3331 121F quick_home:
3332 121F 3A22F0 lda command
3333 1222 FE71 cpi "q"
3334 1224 C23312 jnz exit_quick_home
3335
3336 1227 210081 lxi h,home_address
3337 122A 222AF0 shld user_PC
3338 122D 223CF0 shld pointer
3339 1230 CD920D call send_prompt
3340
3341 1233 exit_quick_home:
3342 1233 C9 ret
3343
3344 ; i/o address map
3345
3346 1234 3A22F0 io_address: lda command
3347 1237 FE69 cpi "i"
3348 1239 C24512 jnz exit_io
3349
3350 123C 21F921 lxi h,io_text
3351 123F CDAD12 call put_str
3352 1242 CD920D call send_prompt
3353
3354 1245 C9 exit_io: ret
3355
3356
3357 ; help listing
3358
3359 1246 3A22F0 help: lda command
3360 1249 FE3F cpi "?"
Page 56 of 86
B8080.LST 3/12/2560 20:42
Page 57 of 86
B8080.LST 3/12/2560 20:42
Page 58 of 86
B8080.LST 3/12/2560 20:42
Page 59 of 86
B8080.LST 3/12/2560 20:42
3541
3542 135C CD2F13 hex_dump1: call space
3543 135F 7E mov a,m
3544 1360 CD1513 call out2x
3545 1363 23 inx h
3546 1364 0D dcr c
3547 1365 C25C13 jnz hex_dump1
3548
3549 1368 CD2F13 call space
3550 136B CD2F13 call space
3551 136E CD2F13 call space
3552
3553 ; print ASCII representation 20H-7FH
3554 ; outside such range, print . instead
3555
3556 1371 11F0FF lxi d,0FFF0h ; load DE with -16
3557 1374 19 dad d ; ADD HL,DE
3558
3559 1375 0E10 mvi c,16
3560
3561 1377 7E hex_dump5: mov a,m
3562
3563 1378 FE20 cpi 20h ; <20H?
3564 137A DA8213 jc hex_dump3
3565 137D FE80 cpi 80h
3566 137F DA8413 jc hex_dump4
3567 1382 3E2E hex_dump3: mvi a,"."
3568 1384 CD8712 hex_dump4: call cout
3569
3570 1387 23 inx h
3571 1388 0D dcr c
3572 1389 C27713 jnz hex_dump5
3573
3574 138C 223CF0 shld pointer ;user_PC
3575
3576 138F C1 pop b
3577 1390 0D dcr c
3578 1391 C24813 jnz hex_dump2
3579
3580 1394 CD2413 call new_line
3581 1397 CD920D call send_prompt
3582
3583 139A C9 exit_hex_dump: ret
3584
3585
3586 139B 210081 dump_memory: lxi h,8100h
3587 139E 0E64 mvi c,100 ; 100 bytes display
3588
3589 13A0 CD2413 call new_line
3590 13A3 7E dump1: mov a,m
3591 13A4 CD1513 call out2x
3592 13A7 CD2F13 call space
3593 13AA 23 inx h
3594 13AB 0D dcr c
3595 13AC C2A313 jnz dump1
3596 13AF C9 ret
3597
3598 ; convert ASCII letter to one nibble 0-F
3599 ; 0-9 -> al-30
3600 ; A-F -> al-7
Page 60 of 86
B8080.LST 3/12/2560 20:42
3601 ; entry: A
3602 ; exit: A
3603
3604 13B0 D630 to_hex: sui "0"
3605 13B2 FE0A cpi 10
3606 13B4 DABB13 jc zero_nine
3607 13B7 E6DF ani 11011111b
3608 13B9 D607 sui 7 ; convert to A-F
3609 13BB zero_nine:
3610
3611 13BB C9 ret
3612
3613 ; read two ASCII bytes and convert them to one bye 8-bit
3614 ; exit: A
3615 ; used: A, E
3616
3617 13BC CD8F12 get_hex: call cin
3618 13BF CDB013 call to_hex
3619 13C2 0F rrc
3620 13C3 0F rrc
3621 13C4 0F rrc
3622 13C5 0F rrc
3623 13C6 5F mov e,a
3624 13C7 CD8F12 call cin
3625 13CA CDB013 call to_hex
3626 13CD 83 add e
3627 13CE C9 ret
3628
3629 ; read two ASCII bytes echo to screen and convert them to
3630 ; exit: A
3631
3632 13CF CD8F12 get_hex1: call cin
3633 13D2 CD8712 call cout
3634 13D5 CDB013 call to_hex
3635 13D8 0F rrc
3636 13D9 0F rrc
3637 13DA 0F rrc
3638 13DB 0F rrc
3639 13DC 5F mov e,a
3640 13DD CD8F12 call cin
3641 13E0 CD8712 call cout
3642 13E3 CDB013 call to_hex
3643 13E6 83 add e
3644 13E7 C9 ret
3645
3646 ; read two ASCII bytes echo to screen and convert them to
3647 ; exit: A
3648
3649 13E8 3A23F0 get_hex2: lda flag1
3650 13EB E6FC ani 0fch ; clear flag1.1 and flag1.0
3651 13ED 3223F0 sta flag1
3652
3653 13F0 CD8F12 call cin
3654 13F3 FE0D cpi cr
3655 13F5 CA3B14 jz exit_get_hex2
3656
3657 13F8 FE20 cpi " "
3658 13FA CA4414 jz exit_get_hex3
3659
3660 13FD FE30 cpi 30h ; hex must be 0-9 and A-F
Page 61 of 86
B8080.LST 3/12/2560 20:42
Page 62 of 86
B8080.LST 3/12/2560 20:43
3721
3722 ; get record, write to SRAM and jump to 8000h
3723 ; entry: A= byte received, B= byte check sum
3724
3725 add_bcs: macro ; add accumulator with byte check sum
3726 push psw
3727 add b
3728 mov b,a
3729 pop psw
3730 endm
3731
3732 001B = esc equ 1bh
3733
3734 144D CD8F12 get_record: call cin
3735 1450 FE1B cpi 27
3736 1452 CA9814 jz esc_quit
3737
3738 1455 FE3A cpi ":"
3739 1457 C24D14 jnz get_record ; wait until begin of record
3740
3741 145A 0600 mvi b,0 ; byte check sum
3742
3743 145C CDBC13 call get_hex ; get number of byte
3744 145F 4F mov c,a ; put to c
3745
3746 1460 add_bcs
3747 1460 F5 push psw
3748 1461 80 add b
3749 1462 47 mov b,a
3750 1463 F1 pop psw
3751 1464 endm
3752
3753 1464 CDBC13 call get_hex ; get destination address, put to bx
3754 1467 67 mov h,a ; save high byte
3755
3756 1468 add_bcs
3757 1468 F5 push psw
3758 1469 80 add b
3759 146A 47 mov b,a
3760 146B F1 pop psw
3761 146C endm
3762
3763 146C CDBC13 call get_hex
3764 146F 6F mov l,a ; and low byte
3765
3766 1470 add_bcs
3767 1470 F5 push psw
3768 1471 80 add b
3769 1472 47 mov b,a
3770 1473 F1 pop psw
3771 1474 endm
3772
3773 1474 CDBC13 call get_hex
3774
3775 1477 add_bcs
3776 1477 F5 push psw
3777 1478 80 add b
3778 1479 47 mov b,a
3779 147A F1 pop psw
3780 147B endm
Page 63 of 86
B8080.LST 3/12/2560 20:43
3781
3782 147B FE01 cpi 1 ; end of record type is
3783 147D C29914 jnz data_record ; jump if not 01
3784
3785 1480 CD8F12 wait_cr: call cin
3786 1483 FE0D cpi cr
3787 1485 C28014 jnz wait_cr ; until end of record sending
3788
3789 1488 3EFF mvi a, 0ffh ; turn speaker off
3790 148A D340 out port1
3791 148C AF xra a
3792 148D D300 out 0 ; turn off GPIO
3793
3794 148F CD6915 call print_bcd1
3795 1492 CD2F13 call space
3796 ; lda bcs
3797 ; call pint8u
3798 ; lxi h,error_text
3799 ; call put_str
3800 1495 CD2413 call new_line
3801
3802 1498 C9 esc_quit: ret
3803
3804
3805 1499 CDBC13 data_record: call get_hex ; get data byte
3806 149C 77 mov m,a ; save to SRAM at [HL]
3807
3808 149D add_bcs
3809 149D F5 push psw
3810 149E 80 add b
3811 149F 47 mov b,a
3812 14A0 F1 pop psw
3813 14A1 endm
3814
3815 14A1 CD3915 call inc_bcd1
3816
3817 ; ori 7fh
3818 ; out port1 ; make buzzer sound
3819
3820
3821 14A4 23 inx h ; next location
3822
3823 14A5 0D dcr c
3824 14A6 C29914 jnz data_record ; until c = 0
3825
3826 14A9 78 mov a,b
3827 14AA 2F cma
3828 14AB 47 mov b,a
3829 14AC 04 inr b ; compute two's complement
3830
3831 14AD CDBC13 call get_hex ; get check sum
3832
3833 14B0 B8 cmp b
3834 14B1 CABB14 jz skip_error
3835
3836 14B4 3A20F0 lda bcs
3837 14B7 3C inr a
3838 14B8 3220F0 sta bcs
3839
3840 14BB skip_error:
Page 64 of 86
B8080.LST 3/12/2560 20:43
Page 65 of 86
B8080.LST 3/12/2560 20:43
Page 66 of 86
B8080.LST 3/12/2560 20:43
Page 67 of 86
B8080.LST 3/12/2560 20:43
Page 68 of 86
B8080.LST 3/12/2560 20:43
Page 69 of 86
B8080.LST 3/12/2560 20:43
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150 ; constants
4151
4152 162B INS_TABLE:
4153
4154 162B 2B18 DWL C0 ; "NOP",TAB,RS ; 00
4155 162D 3018 DWL C1 ; "LXI",TAB,"B,",RS ; 01
4156 162F 3718 DWL C2 ; "STAX",TAB,"B",RS ; 02
4157 1631 3E18 DWL C3 ; "INX",TAB,"B",RS ; 03
4158 1633 4418 DWL C4 ; "INR",TAB,"B",RS ; 04
4159 1635 4A18 DWL C5 ; "DCR",TAB,"B",RS ; 05
4160 1637 5018 DWL C6 ; "MVI",TAB,"B,",RS ; 06
4161 1639 5718 DWL C7 ; "RLC",TAB,RS ; 07
4162 163B 5C18 DWL C8 ; "DFB",TAB,RS ; 08
4163 163D 6118 DWL C9 ; "DAD",TAB,"B",RS ; 09
4164 163F 6718 DWL CA ; "LDAX",TAB,"B",RS ; 0A
4165 1641 6E18 DWL CB ; "DCX",TAB,"B",RS ; 0B
4166 1643 7418 DWL CC ; "INR",TAB,"C",RS ; 0C
4167 1645 7A18 DWL CD ; "DCR",TAB,"C",RS ; 0D
4168 1647 8018 DWL CE ; "MVI",TAB,"C,",RS ; 0E
4169 1649 8718 DWL CF ; "RRC",TAB,RS ; 0F
4170 164B 8C18 DWL C10 ; "DFB",TAB,RS ; 10
4171 164D 9118 DWL C11 ; "LXI",TAB,"D,",RS ; 11
4172 164F 9818 DWL C12 ; "STAX",TAB,"D",RS ; 12
4173 1651 9F18 DWL C13 ; "INX",TAB,"D",RS ; 13
4174 1653 A518 DWL C14 ; "INR",TAB,"D",RS ; 14
4175 1655 AB18 DWL C15 ; "DCR",TAB,"D",RS ; 15
4176 1657 B118 DWL C16 ; "MVI",TAB,"D,",RS ; 16
4177 1659 B818 DWL C17 ; "RAL",TAB,RS ; 17
4178 165B BD18 DWL C18 ; "DFB",TAB,RS ; 18
4179 165D C218 DWL C19 ; "DAD",TAB,"D",RS ; 19
4180 165F C818 DWL C1A ; "LDAX",TAB,"D",RS ; 1A
4181 1661 CF18 DWL C1B ; "DCX",TAB,"D",RS ; 1B
4182 1663 D518 DWL C1C ; "INR",TAB,"E",RS ; 1C
4183 1665 DB18 DWL C1D ; "DCR",TAB,"E",RS ; 1D
4184 1667 E118 DWL C1E ; "MVI",TAB,"E,",RS ; 1E
4185 1669 E818 DWL C1F ; "RAR",TAB,RS ; 1F
4186 166B ED18 DWL C20 ; "RIM",TAB,RS ; 20
4187 166D F218 DWL C21 ; "LXI",TAB,"H,",RS ; 21
4188 166F F918 DWL C22 ; "SHLD",TAB,RS ; 22
4189 1671 FF18 DWL C23 ; "INX",TAB,"H",RS ; 23
4190 1673 0519 DWL C24 ; "INR",TAB,"H",RS ; 24
4191 1675 0B19 DWL C25 ; "DCR",TAB,"H",RS ; 25
4192 1677 1119 DWL C26 ; "MVI",TAB,"H,",RS ; 26
4193 1679 1819 DWL C27 ; "DAA",TAB,RS ; 27
4194 167B 1D19 DWL C28 ; "DFB",TAB,RS ; 28
4195 167D 2219 DWL C29 ; "DAD",TAB,"H",RS ; 29
4196 167F 2819 DWL C2A ; "LHLD",TAB,RS ; 2A
4197 1681 2E19 DWL C2B ; "DCX",TAB,"H",RS ; 2B
4198 1683 3419 DWL C2C ; "INR",TAB,"L",RS ; 2C
4199 1685 3A19 DWL C2D ; "DCR",TAB,"L",RS ; 2D
4200 1687 4019 DWL C2E ; "MVI",TAB,"L,",RS ; 2E
Page 70 of 86
B8080.LST 3/12/2560 20:43
Page 71 of 86
B8080.LST 3/12/2560 20:43
Page 72 of 86
B8080.LST 3/12/2560 20:43
Page 73 of 86
B8080.LST 3/12/2560 20:43
Page 74 of 86
B8080.LST 3/12/2560 20:43
Page 75 of 86
B8080.LST 3/12/2560 20:43
Page 76 of 86
B8080.LST 3/12/2560 20:43
Page 77 of 86
B8080.LST 3/12/2560 20:43
Page 78 of 86
B8080.LST 3/12/2560 20:43
Page 79 of 86
B8080.LST 3/12/2560 20:43
Page 80 of 86
B8080.LST 3/12/2560 20:43
Page 81 of 86
B8080.LST 3/12/2560 20:43
4840
4840 10CD AC_TEXT 09F7 ADDRESS_MODE 1FBF AF_TEXT
4841 12BB ALT_PUT_STR 1411 ASCII_0_9 0DCA ASCII_PRINT
4842 0DE2 ASCII_PRINT1 1F6D ASCII_TEXT F041 BCD_COUNTER1
4843 F044 BCD_COUNTER2 F020 BCS 1FC3 BC_TEXT
4844 0965 BEEP_CHK F024 BEEP_FLAG 0636 BEEP_ON
4845 017E BIN1 0189 BIN2 017C BIN2ASCII
4846 0193 BIN3 019E BIN4 14F7 BIT_DELAY
4847 1522 BIT_IS_ONE 08C0 BREAK F03E BREAK_ADDRESS
4848 F040 BREAK_OPCODE F010 BUFFER 0080 BUSY
4849 0627 BUZZER 0638 BUZZER1 1FF5 BYTE_TEXT
4850 182B C0 1830 C1 188C C10
4851 1891 C11 1898 C12 189F C13
4852 18A5 C14 18AB C15 18B1 C16
4853 18B8 C17 18BD C18 18C2 C19
4854 18C8 C1A 18CF C1B 18D5 C1C
4855 18DB C1D 18E1 C1E 18E8 C1F
4856 1837 C2 18ED C20 18F2 C21
4857 18F9 C22 18FF C23 1905 C24
4858 190B C25 1911 C26 1918 C27
4859 191D C28 1922 C29 1928 C2A
4860 192E C2B 1934 C2C 193A C2D
4861 1940 C2E 1947 C2F 183E C3
4862 194C C30 1951 C31 1959 C32
4863 195E C33 1965 C34 196B C35
4864 1971 C36 1978 C37 197D C38
4865 1982 C39 1989 C3A 198E C3B
4866 1995 C3C 199B C3D 19A1 C3E
4867 19A8 C3F 1844 C4 19AD C40
4868 19B5 C41 19BD C42 19C5 C43
4869 19CD C44 19D5 C45 19DD C46
4870 19E5 C47 19ED C48 19F5 C49
4871 19FD C4A 1A05 C4B 1A0D C4C
4872 1A15 C4D 1A1D C4E 1A25 C4F
4873 184A C5 1A2D C50 1A35 C51
4874 1A3D C52 1A45 C53 1A4D C54
4875 1A55 C55 1A5D C56 1A65 C57
4876 1A6D C58 1A75 C59 1A7D C5A
4877 1A85 C5B 1A8D C5C 1A95 C5D
4878 1A9D C5E 1AA5 C5F 1850 C6
4879 1AAD C60 1AB5 C61 1ABD C62
4880 1AC5 C63 1ACD C64 1AD5 C65
4881 1ADD C66 1AE5 C67 1AED C68
4882 1AF5 C69 1AFD C6A 1B05 C6B
4883 1B0D C6C 1B15 C6D 1B1D C6E
4884 1B25 C6F 1857 C7 1B2D C70
4885 1B35 C71 1B3D C72 1B45 C73
4886 1B4D C74 1B55 C75 1B5D C76
4887 1B62 C77 1B6A C78 1B72 C79
4888 1B7A C7A 1B82 C7B 1B8A C7C
4889 1B92 C7D 1B9A C7E 1BA2 C7F
4890 185C C8 1BAA C80 1BB0 C81
4891 1BB6 C82 1BBC C83 1BC2 C84
4892 1BC8 C85 1BCE C86 1BD4 C87
4893 1BDA C88 1BE0 C89 1BE6 C8A
4894 1BEC C8B 1BF2 C8C 1BF8 C8D
4895 1BFE C8E 1C04 C8F 1861 C9
4896 1C0A C90 1C10 C91 1C16 C92
4897 1C1C C93 1C22 C94 1C28 C95
4898 1C2E C96 1C34 C97 1C3A C98
Page 82 of 86
B8080.LST 3/12/2560 20:43
Page 83 of 86
B8080.LST 3/12/2560 20:43
Page 84 of 86
B8080.LST 3/12/2560 20:43
Page 85 of 86
B8080.LST 3/12/2560 20:43
Page 86 of 86
NOTE