0% found this document useful (0 votes)
2K views116 pages

Dokumen - Tips 8085 Microprocessor Training Kit Users Manual Wwwkswichitcommtk 85usermanual3pdfpdf

The document is a user manual for the 8085 Microprocessor Training Kit. It provides an overview of the hardware and software features of the kit, including the CPU, memory, I/O ports, and monitor program functionality. It then gives instructions on getting started with the kit, including how to power it on and understand the LED display, keypad, and basic monitor commands. Later sections provide more details on the hardware components and connections, as well as appendices with programming examples and schematics.

Uploaded by

Dexember Snow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views116 pages

Dokumen - Tips 8085 Microprocessor Training Kit Users Manual Wwwkswichitcommtk 85usermanual3pdfpdf

The document is a user manual for the 8085 Microprocessor Training Kit. It provides an overview of the hardware and software features of the kit, including the CPU, memory, I/O ports, and monitor program functionality. It then gives instructions on getting started with the kit, including how to power it on and understand the LED display, keypad, and basic monitor commands. Later sections provide more details on the hardware components and connections, as well as appendices with programming examples and schematics.

Uploaded by

Dexember Snow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 116

8085 Microprocessor Training Kit

User's Manual

Wichit Sirichote, [email protected]


Rev3.0, March 29, 2015
Contents
Overview……………………………………………………..………………….3

Hardware Features – Software Features

Getting Started…..………………………………………………………………4

AC Adapter – LED Display and Keypad – RESET – ADDR – DATA –


INC – DEC – HOME – ALT – GO – STEP – MOD – Program #1 –
Program #2 – Program #3

Connecting Terminal..……………………………………….…………………16

Command ‘A’ – Command ‘C’ – Command ‘D’ – Command ‘E’ –


Command ‘F’ – Command ‘H’ – Command ‘I’ – Command ‘J’ –
Command ‘K’ – Command ‘L’ – Command ‘M’ – Command ‘N’ –
Command ‘Q’ – Command ‘R’ – Command ‘S’ – Command ‘W’ –
Command ‘SPACE BAR’

Hardware……………………………………………………………………….23

CPU – Memory – GPIO – Programmable Port 8255 – Programmable


Counter 8254 – Headers and Connectors – Interrupt Test Button –
Technical Specifications – Monitor Call Number-NVRAM Bootable

Appendix A LCD Driver Routines


Appendix B SCAN Keyboard and Display Subroutines
Appendix C UART Driver Routines
Appendix D Using NVRAM Bootable
Appendix E Machine Code and 8085 Instructions
Appendix F Hardware Schematic
Appendix G Monitor source code listing

2
Overview

The MTK-85 is a low-cost single board computer designed for self-learning the
popular 8085 Microprocessor. The kit enables studying from low level
programming with direct machine code entering to high level programming with
PC tools easily. A nice feature, single-step running, helps students learn the
operation of microprocessor instructions quickly and clearly. The user registers
provide simple means to verify the code execution. Using a PC as the terminal, the
MTK-85 can receive the Intel hex file and disassemble the machine code into 8085
instructions.

Figure 1: Components layout of the MTK-85.

Hardware Features:

• CPU: Mitsubishi M5M80C85AP-2 @4MHz


• Memory: 32kB Monitor ROM and 32kB SRAM

3
• Simple I/O Port: 8-bit GPIO built with 74LS175 D-type F-F and 74LS126
Tri-state buffer
• Programmable Ports: two 8255 chips, system and user ports
• Programmable Counter: 8254
• UART: 16C550 compatible UART chip

Onboard I/O devices:

• 6-digit seven segment super bright LED,


• 28-keypad,
• 4-bit dot LED indicates status of GPIO,
• buzzer,
• Direct BUS interface text LCD,
• Serial Interface: RS232C 9600bit/s 8-data bit no parity one stop bit
• +5V Power Supply: low-dropout voltage regulator with input protection
• 40-pin header for CPU bus
• 40-pin header for user port, 8255 and 8254
• 16-pin header for simple GPIO port
• onboard logic probe power supply
• Test button for single pulse generation to the interrupt pins
• Brown-out Protection
• No jumper settings

Software Features:

• Enter the machine code in hexadecimal


• Single-step execution
• Examine and modify user registers
• Run user code with software break-point
• Insert and Delete byte
• Built-in LCD drivers
• Download Intel Hex file
• Disassemble machine code into 8085 instructions
• Display user registers and disassemble the instruction after single-stepping
• NVRAM Bootable, runs user code when power up the board

4
Getting Started

AC Adapter

The MTK-85 board requires DC power input to operate. The input voltage accepts
from +6V to +12V. You may find any AC-to-DC adapter having DC jack with
polarity as shown in Figure 2. The board has protection diode to prevent wrong
polarity. If your adapter’s jack has different polarity, when plug it to the board, no
power will be supplied.

- +
Figure 2: Polarity of DC jack.

Since the onboard voltage regulator is a low-dropout, so heat dissipation of the


voltage regulator will be (Vin-Vout) x 350mA (current consumption). The
minimum voltage developed across Vout and Vin is 0.2V. So to provide +5VDC
to the logic board, we can have Vin as low as say +6V. With such input, the
dissipation of the voltage regulator will only be less than 350mW!

The common AC adapters mostly provide +12VDC output. You can use it also.
However dissipation at the LM2940 will be higher. For example, the developed
potential will be 12V-5V=7V. So heat dissipation will be 350mA x 7V=2.5W!

When power up the board, the 8085 begins read the instruction from the memory
at location 0000H. The location from 0000H to 7FFFH or 32kB is ROM space. It
contains the monitor program. The monitor program enables us to enter 8085
instruction using HEX digit into the RAM. We can let the 8085 RUN our program
easily using monitor key GO.

When the board was powered up, the cold message running text 8085 will show
on 7-segment LED and the onboard dot LED will turn on and the buzzer will
sound beep. The HOME location is pointed to RAM at address 8100H. The data
LED will display the content at 8100H.

LED Display and Keypad

The MTK-85 has 6 digits 7-segment LED and 28 tact switches keypad.

5
Four digits labeled with text “ADDRESS” is used for displaying the memory
address and user registers contents. Two digits labeled with text “DATA” is for
displaying the 8-bit data byte at address shown in the left-hand. The dot indicator
indicates the current mode of HEX digit entering. Figure 3 shows the memory
location 8100 has an 8-bit data, 1E. The dot indicates the current mode is data
entry. Typing Hex key will insert hex digit into data memory.

Figure 3: The 7-segment display shows ADDRESS and DATA fields.

Keypad has two groups: the left-hand is 16-hex key 0-F and the right-hand is 10-
function key. The hex key also has alternate functions when used with ALT key.

Figure 3: Keyboard layout, HEX and Function Keys.

6
Let’s see the functions key as follows.

RESETis hardware reset. Press reset will force the CPU begins execution the
ROM monitor at address 0000H. (The reset out signal
which is active high also feed to reset pins of the
UART and two 8255 PPI).

ADDR changes current mode to ADDRESS entry mode. The dot indicator will
move to ADDRESS filed.

DATA changes current mode to DATA entry mode. The dot indicator will move
to DATA filed.

Key + increments current address by one. The content of new address will show in
data field LED.

Key - decrements current address by one. The content of new address will show in
data field LED.

HOME brings home address back to current display. The home address is 8100H.

ALT enables alternate functions that used with HEX key. We can press ALT
followed with HEX key. The Alternate functions are
described below.

ALT 0 displays user register AF. The Accumulator and Flag registers. Contents of
accumulator is high byte and Flag is low byte.

ALT 1 displays user register BC.

ALT 2 displays user register DE.

ALT 3 displays user register HL.

ALT 4 displays user register SP.

ALT 5 displays user register PC.

ALT 6 displays CARRY flag.

ALT 7 displays ZERO flag.

ALT 8 displays SIGN flag.

7
ALT 9 displays HALF CARRY flag.

ALT A displays PARITY flag.

ALT B sets break address.

ALT C clears break address.

ALT D deletes one of the current location and shifts the next byte UP.

ALT E inserts one byte and shifts the next byte DOWN.

GO forces CPU to jump from monitor program to user program at current address.

STEP executes one instruction at address shown in current display.

MOD modifies the user registers. It was used together with ALT 0-5.

User registers are the memory space in RAM prepared for saving and loading to the CPU
registers when the CPU jump from monitor program to user program and back to the
monitor program. It is useful for program debugging. We will learn how to use them easily
in the program testing section.

Entering the program into RAM and Run it.

Test Program 1

Let’s learn how to use hex keypad to help enter the computer code to memory and
test run it. Suppose we want to write the program that displays the contents of the
accumulator using onboard 4-bit dot LED. Since the MTK-85 has 4-bit dot LED
tied to the 4-bit output port. Logic ‘1’ presents at a given bit will make the LED
ON. Logic ‘0’ makes the LED OFF. We will write the small program that shows
the low nibble of the accumulator contents.

8
Figure 4: Sending the Accumulator content to the PORT.

Our program is,

main: inr a ; increment accumulator


out 0 ; write to port 00
jmp main ; jump back to main

We see that the program has only three instructions, i.e., inr a, out 0 and jmp main.

The program was written using 8085 instructions. To test our program, we must
translate above program into the machine code. This can be done easily with hand-
code assembly. See Appendix E for machine code of the instructions.

Since we will write the machine code to the memory for testing, so the space must
be RAM. We must know the memory allocation. Figure 5 shows the memory
space allocation. We see that the board provides begin address for user program at
8100H. Some of the locations from 8000H to 803CH are reserved for interrupts
vectors. The RAM locations from F000H to FFFFH are used by monitor program.

9
Figure 5: Memory space allocation.

Thus we can place our machine code started at location 8100. After translation we
get the code for each instruction easily.

8100 3C main: inr a


8101 D300 out 0
8103 C30081 jmp main

The 1st instruction, inr a, increments the accumulator by one. It has one byte
machine code 3C. This byte will be placed at location 8100.

The 2nd instruction, out 0, write accumulator contents to the port at location 00 has
two bytes machine code, D300. D3 is the instruction OUT and 00 is port location.

10
Figure 6: I/O space allocation.

The 3rd instruction, jmp main, jump back to location 8100 has three bytes machine
code, C3,00,81. C3 is the JMP, and 8100 is location to be jump (Intel places low
byte to low address and high byte to high address).

Above program has only 6 bytes. We can enter such code into RAM easily using
HEX key. Here is the byte sequence from address 8100 to 8105.

ADDRESS DATA
8100 3C
8101 D3
8102 00
8103 C3
8104 00
8105 81

Now enter the code into memory address 8100.

Step 1 Press RESET, the address display will show 8100 and the data LED will
show its contents.

11
The current mode will be data entry. We can swap entry mode for hex key
between address and data by pressing key ADDR or DATA. The DOT indicator
will swap between ADDR mode and DATA mode.

To enter a byte to this location, press HEX key 3 and key C.

The 3C byte will enter to address 8100.

Step 2 Press key + to increment address.

The address display will show 8101. Then repeat step1 until 81 byte was entered
to address 8105.

You can use key + or key - to check the hex code, you can modify it easily in
DATA entry mode.

We will begin set the value to user Accumulator beforehand. It will clear the user
register A to zero.

Press key ALT, 0/AF, display will show the content of user Accumulator and Flag
register.

Press key MOD, then key 0,0,0,0. The AF will be 0000.

Press key HOME, this brings current location to 8100.

Press key STEP, the display will show next instruction to be executed at address
8101. We can examine the content of AF by key ALT, 0/AF. We see that now
Accumulator is 01.

Press key STEP again, the 01 will send to LED onboard GPIO. This is the content
of the accumulator after increment instruction.

The next instruction, JMP 8100 will be executed.

We can keep press key STEP, we will see everytime the instruction out 0 was
executed, the value of accumulator will write to the GPIO LED.

It works! This demonstration how STEP key helps running the program single
instruction.

Instead of execution one instruction using single step, we can run the program
without stopping for each instruction. We will try with key GO.

12
Now press HOME to bring current location to 8100, press RUN.

What happen to the LED?

Did you see the LED counting?

Should it be counting up?

There are two methods of program running. First is to use single stepping. This
kind executes only one instruction at a time when we press STEP key. We can
learn the operation easily with user registers. The monitor program loads the
contents of user registers to the CPU registers beforehand, after the instruction has
been executed, the contents of CPU registers will then be saved back to the user
registers. Thus we can examine the result after the instruction has been executed
easily.

But above program, when we try with key GO, the CPU will jump from monitor
program to user program and never get back to monitor program. Since the
instruction JMP 8100 will jump back to 8100 forever. We see that the number
incrementing in the accumulator will be very fast.

How can we make the speed of counting slower? We can just simply add the job
that uses CPU time. Now let’s see below program.

org 8100h ; begin of code


main: inr a ; increment accumulator
out 0 ; write to port 00

; add the simple delay using register pair DE

lxi d,1050h ; load 16-bit constant to DE


delay: dcr e ; decrement E
jnz delay ; jump to delay location if E != 0
dcr d ; decrement D
jnz delay ; jump to delay location if D != 0

jmp main ; done, jump back to main again

I suppose now you can translate the instruction into the machine code. The first
mnemonic, ORG is not 8085 instruction. It is the assembler directive that tells the

13
assembler program to place the hex code begins at location 8100. We will learn
using assembler when using PC tools on later.

The portion of inserted code is bolded letters. We see that the method of time
delay is just to let the CPU counts the value in register D and register E. Counting
is done by instruction DCR E, decrement register by one for register E and D. The
JNZ, jump to specified location when ZERO flag is not set. That means if the
content of register E or D is not ZERO, it will jump back to decrement again. Until
they are ZERO, the CPU will continue execute the next instruction.

Here is my translation from instructions to machine code.

org 8100h ; begin of code


8100 3C main: inr a ; increment accumulator
8101 D300 out 0 ; write to port 00

; add the simple delay using register pair DE

8103 115010 lxi d,1050h ; load 16-bit constant to DE


8106 1D delay: dcr e ; decrement E
8107 C20681 jnz delay ; jump to 81060 if E != 0
810A 15 dcr d ; decrement D
810B C20681 jnz delay ; jump to 8106 if D != 0

810E C30081 jmp main ; jump back to main


again

This program has 17 bytes code. We can enter the code into RAM from 8100 to
8110 easily.

ADDRESS DATA
8100 3C
8101 D3
8102 00
8103 11
8104 50
8105 10
8106 1D
8107 C2
8108 06

14
8109 81
810A 15
810B C2
810C 06
810D 81
810E C3
810F 00
8110 81

After finished entering the code, press HOME to bring current RAM location to
8100. Then press key GO.

What happen to the onboard LED?

Can we change the speed of counting? How?

To stop running, press RESET key. You can modify the initial value of register
DE, 1050 to whatever you want to speed up or slow down.

Test Program #2

This program shows how to use key GO to force CPU jump from monitor program
to user program.

8100 1E02 main: mvi e,2


8102 CF rst 1
8103 C30081 jmp main

This program has only 6 bytes i.e., 1E, 02, CF, C3, 00, 81. Enter the code, and
press key HOME, GO.

We will see the cold message repeat running on the display. RST 1 having
machine code CF is the method that used to call built-in monitor functions.
Register E is monitor call number.

To stop program#2 running, we must press RESET key.

Test Program #3

We can test the program with software breakpoint. The instruction RTS 7 having
machine code FF returns control back to monitor program and saves the contents
of CPU registers to user registers. We can check the result in user registers easily.

15
Here is the program that adds two BCD numbers 19H and 02H. The result will be
21H.

8100 3E19 mvi a,19h ; load accumulator with 19h


8102 0602 mvi b,2 ; load register B with 02
8104 80 add b ; add register B to accumulator
8105 27 daa ; adjust result to BCD
8106 FF rst 7 ; jump back to monitor

After enter the code, you can run it with key GO. Check the result in Accumulator
with ALT 0.

For small program, we can place the RST 7 to the end of the program.

However for long program, sometime we may need to check at a given location,
the board also provides tool that helps inserting the RST 7 instruction to the
specified location. This tool is called set break point. Suppose we want to verify
the result after add b instruction. We can set break point at location 8105 by
setting the address to 8105 with key ADDR 8,1,0,5. Then press ALT B, the
display will show this address was set breakpoint.

Press HOME and GO, check user AF with ALT 0, we see that after addition, the
result in Accumulator is 1B. To clear this break address, press ALT C. The display
will show current address 8105. The code 27 will be restored back to address
8105. We can continue execution, press RUN, and check result in AF again, we
will get 21. This the correct BCD number from the addition of 19+02=21.

16
Connecting Terminal

The kit provides RS232 port for connecting the terminal. The ROM monitor
contains ASCII commands when using UART to connect a terminal. The UART
drivers and serial commands are automatically configured when UART chip was
inserted. Communication format is 9600 bit/sec, 8 data bit, no parity and one stop
bit. We can use PC running VT100 terminal emulation. The CD has teraterm
software for emulating VT100 terminal.

RS232C cable

Figure 7: Connecting PC running teraterm and kit with RS232 cable.

There is no need to switch between standalone mode and terminal mode. Both
commands using keypad or terminal commands are working concurrently.

When press reset the prompt appears on screen.

MTK-85 8085 MICROPROCESSOR TRAINING KIT (? HELP)

8100>

Type ? for help menu listing.

17
MTK-85 8085 MICROPROCESSOR TRAINING KIT (? HELP)

A - ASCII code
C - clear watch variables
D - disassemble
E - edit memory
F - fill constant
H - hex dump
I - i/o address map
J - jump to user program
K - display user STACK
L - load Intel hex file
M - monitor call number
N - new location pointer
Q - quick home location
R - user register display
S - set value to user register
W - watch variables
SPACE BAR - single step
? - help menu

8100>

Command ‘A’ prints the hexadecimal code for printable ASCII characters.

Command ‘C’ clears the 16-byte watch variables.

The monitor provides quick access to a16-byte RAM for program testing. The
watch variables use RAM space from F000-F00F. Command 'W' prints such
memory on screen.

8100>
F000 AD FD FC 15 8E 9C DB 4D 4F 19 5F FD EB 3E 8A F5
8100>

Command ‘D’ disassembles the machine code into 8085 instructions.

8100>disassemble...

8100 3E19 MVI A,19


8102 0602 MVI B,02
8104 80 ADD B

18
8105 27 DAA
8106 FF RST 7
8107 C20681 JNZ 8106
810A 15 DCR D
810B C20681 JNZ 8106
810E C30081 JMP 8100
8111 62 MOV H,D
8112 CDF862 CALL 62F8
8115 80 ADD B
8116 DC1642 CC 4216
8119 A5 ANA L
811A D3C1 OUT C1
811C 68 MOV L,B

811D>

Command ‘E’ examines and modify the data in memory. We can use this
command to enter machine code. To view the content, uses Space key and to enter
byte, press two digits. To quit just press ENTER.

8100>edit memory location = 8100


Enter to quit, SPACE key to view content

ADDR DATA
8100 [3E]
8101 [19] 01
8102 [06]
8103 [02]
8104 [80] d3
8105 [27] 00
8106 [FF]
8107 [C2]
8108 [06]

8108>

Command ‘F’ fills 8-bit constant to memory. The example shows filling byte 00
to address 9010-9020.

9016>Begin address = 9010 End address = 9020 Data = 00


9016>

19
Command ‘H’ dumps memory. The content of memory from current pointer 9010
to 908F will display in hexadecimal. The ASCII code for each byte will be
displayed also. The dot will be displayed for nonprintable ASCII code.

9010>

9010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
9020 4D C2 97 CB DA DF A0 BE 9E 73 1A 34 E3 A6 83 4E M........s.4...N
9030 97 47 81 CE C1 99 98 CB 14 ED 45 DE 35 6A 7C F1 .G........E.5j|.
9040 F0 36 B2 69 CF 1D 90 90 70 F1 73 D8 C1 4F DF 56 .6.i....p.s..O.V
9050 A8 E2 30 84 76 AA C5 18 A7 84 C5 32 81 BF B9 03 ..0.v......2....
9060 8A 13 8C FD 4A 82 B9 99 4E 24 33 9E EB 16 A8 0D ....J...N$3.....
9070 A9 31 CD B7 BB 4E 8D BE FF 5B 3C 8D EA 5E 4F 7F .1...N...[<..^O
9080 41 00 89 F3 54 BF EC BF E0 9F 72 CB 7D E8 34 7A A...T.....r.}.4z

9090>

Command ‘I’ displays onboard I/O address.

9090>
00H-0FH onboard 4-bit GPIO, D0-D3=output port
D4-D7=input port

10H-13H 8255 system PPI, 10H=PORTA, 11H=PORTB, 12H=PORTC,


13H=CONTROL

20H-23H 8254 programmable counter, 20H=counter0, 21H= counter1


22H=counter2, 23H control register

30H-33H 8255 user PPI, 30H=PORTA, 31H=PORTB, 32H=PORTC,


33H=CONTROL

40H-47H C16550 UART registers


9090>

Command ‘J’ jumps from monitor program to user program. The example shows
jump to address 9000. The user register displays results after running the code.
The RST 7 returns control back to monitor program.

9090>jump to address [9006] = 9000

AF=5800 BC=19F4 DE=C256 HL=9504 SP=F098 PC=9007 S=0 Z=0 AC=0 P=0 CY=0
9090>

Command ‘K’ displays user STACK memory. The example below shows
running instruction PUSH H.

20
We first check the user register with command ‘r’. We see that TOP of STACK is
F098. After pressing SPACE BAR for single step, the SP is now F096. We can see
the contents of STACK memory with command k. The contents of HL was saved
in STACK.

9000>press r for user register display

AF=5800 BC=19F4 DE=C256 HL=9504 SP=F098 PC=9000 S=0 Z=0 AC=0 P=0 CY=0
9000>press SPACE bar for single step
9000 E5 PUSH H

AF=5800 BC=19F4 DE=C256 HL=9504 SP=F096 PC=9001 S=0 Z=0 AC=0 P=0 CY=0
9000>press k for STACK display

ADDR DATA
F096 [04]
F097 [95]
F098 [C0]

9000>

Command ‘L’ loads Intel Hex file to memory. The Assembler and C compiler for
8085 CPU produce standard Intel Hex file. The hex file contains machine code
represented by ASCII letters. The example below uses Teraterm to download the
hex file. The hex file is ASCII text file. So with the teraterm, we can go to Send
File. We can let it show only file with .hex extension by typing *.hex. Then double
clicks at the hex file.

The onboard dot LED will indicate downloading is on going. When completed, the
report will show number of byte received and print checksum error. If no error it
will show 0 errors.

9080>load Intel hex file...000005 bytes loaded 0 errors

9080>

Command ‘M’ shows monitor call number. Some of common subroutines can be
called through RST 1 with function number preloaded in register E.

9080>
see input parameters in user manual

1Enn MVI E,function_number


CF RST 1

00 - demo

21
01 - delay
02 - cold_boot
03 - scan
04 - cin
05 - cout
06 - put_str
07 - init_lcd
08 - lcd_ready
09 - clear_lcd
0A - goto_xy
0B - put_str_lcd
0C - put_ch_lcd
0D - demo2

9080>

Command ‘N’ sets new location pointer at prompt. The example sets new pointer
to E000 and press ‘d’ to disassemble.

9080>new location = e000


E000>disassemble...

E000 53 MOV D,E


E001 32DE2A STA 2ADE
E004 62 MOV H,D
E005 25 DCR H
E006 C9 RET
E007 1C INR E
E008 43 MOV B,E
E009 CC4A05 CZ 054A
E00C 2655 MVI H,55
E00E 67 MOV H,A
E00F 04 INR B
E010 F3 DI
E011 0E25 MVI C,25
E013 54 MOV D,H
E014 AF XRA A
E015 C3F0C3 JMP C3F0

E018>

Command ‘Q’ sets location pointer at prompt to 9000 and sets user PC to 9000.

9000>

AF=5800 BC=19F4 DE=C256 HL=9504 SP=F096 PC=9000 S=0 Z=0 AC=0 P=0 CY=0

22
9000>
Command ‘R’ displays user registers contents.
9000>

AF=5800 BC=19F4 DE=C256 HL=9504 SP=F098 PC=9000 S=0 Z=0 AC=0 P=0 CY=0
9000>

Command ‘S’ sets value to user registers.

9013>set value to user register (enter A for AF) ?


AF=0404 ff00
9013>

AF=FF00 BC=19F4 DE=0434 HL=0534 SP=F096 PC=9006 S=0 Z=0 AC=0 P=0 CY=0
9013>

Command ‘W’ prints watch variables.

9013>
F000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Command ‘SPACEBAR’ executes the instruction at address in user PC. The


instruction will show on screen with user registers result after execution.

Suppose we write a program as shown below.

org 9000h
xra a

loop: out 0
mov h,a
inr h
push h
pop d
mov a,d
jmp loop

end

Then translate it to machine code file using the Assembler program. Download
hex file.

9000>load Intel hex file...000011 bytes loaded 0 errors

23
9000>disassemble...

9000 AF XRA A
9001 D300 OUT 00
9003 67 MOV H,A
9004 24 INR H
9005 E5 PUSH H
9006 D1 POP D
9007 7A MOV A,D
9008 C30190 JMP 9001
900B 00 NOP
900C 00 NOP
900D 00 NOP
900E 00 NOP
900F 00 NOP
9010 00 NOP
9011 00 NOP
9012 00 NOP

9013>print user register with command r

AF=5800 BC=19F4 DE=C256 HL=1234 SP=F098 PC=9000 S=0 Z=0 AC=0 P=0 CY=0
9013>press SPACE key to execute instruction at 9000, we see A=00

9000 AF XRA A

AF=0044 BC=19F4 DE=C256 HL=1234 SP=F098 PC=9001 S=0 Z=1 AC=0 P=1 CY=0
9013>press SPACE key, the content of A will send to GPIO

9001 D300 OUT 00

AF=0044 BC=19F4 DE=C256 HL=1234 SP=F098 PC=9003 S=0 Z=1 AC=0 P=1 CY=0
9013>press SPACE key, the content of A will copy to H
9003 67 MOV H,A

AF=0044 BC=19F4 DE=C256 HL=0034 SP=F098 PC=9004 S=0 Z=1 AC=0 P=1 CY=0
9013> press SPACE key, the content of H will increment by 1
9004 24 INR H

AF=0000 BC=19F4 DE=C256 HL=0134 SP=F098 PC=9005 S=0 Z=0 AC=0 P=0 CY=0
9013> press SPACE key, the content SP will decrement by 2
9005 E5 PUSH H

AF=0000 BC=19F4 DE=C256 HL=0134 SP=F096 PC=9006 S=0 Z=0 AC=0 P=0 CY=0
9013> press K, to see the content of STACK memory

ADDR DATA
F096 [34]
F097 [01]
F098 [C0]

9013> press SPACE key, DE will be loaded with top of STACK


9006 D1 POP D

AF=0000 BC=19F4 DE=0134 HL=0134 SP=F098 PC=9007 S=0 Z=0 AC=0 P=0 CY=0
9013> press SPACE key, the content of D will copy to A

24
9007 7A MOV A,D

AF=0100 BC=19F4 DE=0134 HL=0134 SP=F098 PC=9008 S=0 Z=0 AC=0 P=0 CY=0
9013> press SPACE key, PC will be loaded with 9001
9008 C30190 JMP 9001

AF=0100 BC=19F4 DE=0134 HL=0134 SP=F098 PC=9001 S=0 Z=0 AC=0 P=0 CY=0
9013> press SPACE key, the content of A will send to GPIO, see LED!
9001 D300 OUT 00

AF=0100 BC=19F4 DE=0134 HL=0134 SP=F098 PC=9003 S=0 Z=0 AC=0 P=0 CY=0

25
Hardware

A block diagram of the MTK-85 board is shown below. For complete hardware
schematic, see Appendix D.

CPU

The CPU is a CMOS 80C85. The XTAL frequency is 4MHz. The reset signal is
generated by simple RC circuit. The CPU is protected by brownout circuit.
In case of power supply is dipped caused by AC supply voltage dropped. The
brownout circuit detects VCC, if it is below threshold level, it will reset the
CPU.

The brownout condition can be tested by using a variable power supply. To test it,
adjust the board VIN from 0-12V slowly and see the CPU can start running
properly or not.

Memory

The onboard has 64kB memory. The 32kB ROM monitor 27C256 is placed at
address 0000-7FFFH. And the 32kB SRAM 62256, is placed at address 8000H-
FFFFH.

Some of interrupt vectors are relocated to RAM, so user can write the jump
instruction to the location of such interrupt service routine easily. Here is the
location of interrupts.

26
8010H RST 2
8018H RST 3
8020H RST 4
8028H RST 5
802CH RST 5.5
8030H RST 6
8034H RST 6.5
803CH RST 7.5

Note:
1. RST 7 is used for software breakpoint.
2. RST 1 is used for monitor function call.
3. TRAP is used for hardware single-step.
4. RST 7.5 is tied to OUT0 of 8254 programmable counter.
5. Monitor program uses last page of RAM for data storage, STACK area, and
monitor control functions. The space is from F000H to F098H.

GPIO

GPIO provides 4-bit output port using D type F-F, 74LS175 and 4-bit input port
using tri-state buffer, 74LS126. The address is 00 for both ports. The low-nibble
D0-D3 is output port. The higher-nibble D4-D7 is input port. The signal from both
ports appeared at J1, 16-pin header.

27
System Programmable Port 8255

The I/O addresses of system port, 8255 are PORTA=10H, PORTB=11H,


PORTC=12H and Control Port = 13H. Buzzer control pin is PORT C bit 7. To
enable buzzer, write 7FH to PORTC.

User Programmable Port 8255

The board provides a user programmable parallel port, 8255. The 8255’s registers
are mapped to I/O address from 30H to 33H.

30H PORTA
31H PORTB
32H PORTC
33H CONTROL PORT

Programmable Counter 8254

The programmable counter, 8254 was supplied with clock signal from
CLOCKOUT or 2MHz for counter0 and counter1. The internal registers of 8254
are mapped to I/O space from 20H to 23H.

28
20H COUNTER0
21H COUNTER1
22H COUNTER2
23H CONTROL REGISTER

29
Headers and Connectors

CPU Header JP1

User 8255 and 8254 Header JP1

30
Onboard LCD Header JR1

RS232C DB9 male connector VB1

31
Interrupts Test Button

The interrupt test button provides a single positive pulse that tied to CPU hardware
interrupt pins, RST5.5, RST6.5 and INTR. User can select the pulse to be
triggered for each pin by dip switch SW1. The onboard LED, D4 indicates the
pulse is activated when press Test button.

Technical Specifications

CPU: CMOS 80C85 @4MHz


Memory: 64kB, 32kB 27C256, 32kB 62256
I/O port: Programmable Parallel port 8255x2, 8-bit GPIO
Counter: Programmable Counter 8254
UART: 16-byte FIFO TL16C550 compatible
ROM monitor: 8085.asm
Brownout Protection: KIA7045
Board Size: 8.90 x 8.13 inch
Weight: 320g (complete components except LCD)
DC Power Supply: AC-to-DC adapter 6V-12V 400mA
Power consumption: (350mA @12VDC)

Monitor Call Number


00 - demo
Scan 7-segment display with buffer display pointed by HL
Entry: HL
Exit: none

01 - delay
Delay subroutine using register pair DE, D is outer loop delay, E is inner loop.
Entry: DE
Exit: none

02 - cold_boot
Display cold-boot message on 7-segment LED.
Entry: none

03 - scan
Scan keyboard and display one cycle.
Entry: HL points the display buffer
Exit: key = scan code –1 no key pressed

32
04 - cin
Get character from console
Entry: none
Exit: A = character received

05 - cout
Send character to console
Entry: A = character to be sent
Exit: none

06 - put_str
Print string to console, string is terminated by 0.
Entry: HL
Exit: none

07 - init_lcd
Initialize LCD module
Entry: none
Exit: none

08 - lcd_ready
Wait until LCD module is ready.
Entry: none
Exit: none

09 - clear_lcd
Clear LCD display
Entry: none
Exit: none

0A - goto_xy
Set cursor position of LCD
Entry: HL, H = x, L = y
Exit: none

0B - put_str_lcd
Print string to LCD, string is terminated by 0
Entry: HL
Exit: none

0C - put_ch_lcd
Print character to LCD at current cursor position

33
Entry: A
Exit: none

0D - demo2
Running GPIO LED
Entry: none
Exit: none

NVRAM Bootable

User can replace U3, SRAM with a Nonvolatile RAM for program storage, when
the board is power off. A JMP instruction placed at 8000H will enable NVRAM
bootable. The monitor program checks the location 8000H. If it has C3 (opcode of
JMP instruction), it will jump to address 8000H. The feature allows application
code to run easily. The monitor subroutines are still available for the application
program.

To get back to monitor mode, user can press USER key while press RESET. The
byte C3 at location 8000H will change to 00.

The sample code that demonstrates NVRAM Bootable is shown in Appendix D.

34
Appendix A Onboard LCD Driver Routines

;------------------- onboard LCD registers -----------------


command_write equ 50h
command_read equ 52h
data_write equ 51h
data_read equ 53h
busy equ 80h

;--------------------- LCD driver routines -----------------


lcd_ready: push psw

lcd_ready1: in command_read
ani busy
jnz lcd_ready1 ; wait until lcd ready
pop psw

ret

clear_lcd: call lcd_ready


mvi a,1
out command_write
exit_clear: ret

init_lcd: call lcd_ready


mvi a,38h
out command_write
call lcd_ready
mvi a, 0ch
out command_write
call clear_lcd

ret

; print ASCII text on LCD


; entry: HL pointer with 0 for end of string

put_str_lcd: mov a,m ; get A from [HL]


cpi 0
jnz put_str_lcd1
ret

put_str_lcd1:

call lcd_ready

35
out data_write
inx h
jp put_str_lcd

; goto_xy set cursor location on lcd


; entry: HL: H = x, L = y

goto_xy: call lcd_ready


mov a,l
cpi 0
jnz goto_xy1
mov a,h
adi 80h
out command_write
ret

goto_xy1: cpi 1
jnz goto_xy2
mov a,h
adi 0c0h
out command_write
ret

goto_xy2: cpi 2
jnz goto_xy3
mov a,h
adi 094h
out command_write
ret

goto_xy3: cpi 3
jnz goto_xy4
mov a,h
adi 0d4h
out command_write
ret

goto_xy4: ret

; put_ch_lcd put character to lcd


; entry: A

put_ch_lcd: call lcd_ready


out data_write
ret

36
Appendix B Subroutine Scan keyboard and Display
; subroutine scan keyboard and display
; entry: hl pointer to display buffer
; exit: key = scan code
; -1 no key pressed
;

scan: push h
push b
push d

mvi c,6 ; for 6-digit LED


mvi e,0 ; digit scan code appears at 4-to-10
decoder
mvi d,0 ; key position
mvi a,0ffh ; put -1 to key
sta key ; key = -1

scan1: mov a,e


ori 0f0h ; high nibble must be 1111
out system_port_c ; active digit first
mov a,m ; load a with [hl]
out system_port_b ; then turn segment on

mvi b,0 ; delay for electron transition process


wait1: dcr b
jnz wait1

in system_port_a ; read input port

mvi b,8 ; check all 8-row


shift_key: rar ; rotate right through carry
jc next_key ; if carry = 1 then no key
pressed

push psw
mov a,d
sta key ; save key position
pop psw

next_key:
inr d ; next key position

dcr b ; until 8-bit was shifted


jnz shift_key

37
mvi a,0 ; clear a
out system_port_b ; turn off led

inr e ; next digit scan code


inx h ; next location

dcr c ; next column


jnz scan1

pop d
pop b
pop h
ret

;---------- 8255 PPI system port I/O address ---------------


system_port_a: equ 10h
system_port_b: equ 11h
system_port_c: equ 12h
system_port_control: equ 13h

38
Appendix C UART Driver Routines
;---------- 16C550 compatible UART I/O address ------------
; e.g. UM8250B, 16C450, 16C550

uart_buffer: equ 40h


uart_line_status: equ 45h
uart_fifo: equ 42h
uart_lcr: equ 43h
uart_divisor_lsb: equ 40h
uart_divisor_msb: equ 41h
uart_scr: equ 47h

; initialize 16C550 uart to 9600 8n1 with 2MHz clock


; 2MHz/13 = 153846Hz

init_uart:

mvi a,83h
out uart_lcr ; set DLAB bit to access divider

mvi a,13
out uart_divisor_lsb
mvi a,0
out uart_divisor_msb ; 2MHz/13 = 153846 Hz
; 153846Hz/16 = 9615Hz
mvi a,7
out uart_fifo ; init fifo and clear all buffers
mvi a,03h
out uart_lcr ; clar DLAB

; check uart line status, if the byte is FF then no uart


;
;
xra a
out uart_scr ; check if there is uart
in uart_scr
cpi 0
jz found
xra a
sta uart_found
ret

found mvi a,1


sta uart_found
ret

39
cout: mov b,a ; save a

cout1: in uart_line_status
ani 20h ; transmitter ready?
jz cout1

mov a,b ; restore a


out uart_buffer
ret

cin: in uart_line_status
ani 1 ; data available?
jz cin
in uart_buffer
ret

; print string terminated by 0


; input: HL

put_str: mov a,m ; get A from [HL]


cpi 0
jnz put_str1
ret

put_str1: call cout


inx h
jp put_str

40
41
Appendix D Using NVRAM Bootable
; MTK-85 8085 Microprocessor Training Kit
; exp1.asm
;
; Using 8254 to produce 30.52Hz interrupt signal at RST7.5
;
; The 8254 counter0 was loaded with 0000 by system monitor.
; The input clock to the 8254 is 2MHz, the OUT0 then
produces
; 2MHz/65536 = 30.52Hz interrupt at RST7.5!
;
CPU "8085.TBL" ;CPU TABLE
HOF "INT8" ;HEX FORMAT
gpio equ 0

; enable NVRAM boot running

org 8000h
jmp start ; put instruction JMP to boot from
RAM

org 803ch ; interrupt vector of RST7.5


(relocated from 003CH)
jmp service_rst7.5

org 8100h

start: mvi a,11111011b ; enable rst7.5


sim ; set interrupt mask register
ei ; enable interrupt

jmp $ ; jump here

service_rst7.5:

lda count ; increment count


inr a
sta count
out gpio ; write to onboard LED
ei
ret

org 0e000h

42
count dfs 1 ; use RAM one byte for count
variable
end

43
Appendix E Machine code and 8085 Instructions

44
!""#$%&'()(*+,-&$#(./%#(+$%(*$#0/$&,(/1(2324(5$6789,7&/$6

MOVE, LOAD and STORE 6E MOV L,M


6F MOV L,A
40 MOV B,B 70 MOV M,B
41 MOV B,C 71 MOV M,C
42 MOV B,D 72 MOV M,D
43 MOV B,E 73 MOV M,E
44 MOV B,H 74 MOV M,H
45 MOV B,L 75 MOV M,L
46 MOV B,M 77 MOV M,A
47 MOV B,A 78 MOV A,B
48 MOV C,B 79 MOV A,C
49 MOV C,C 7A MOV A,D
4A MOV C,D 7B MOV A,E
4B MOV C,E 7C MOV A,H
4C MOV C,H 7D MOV A,L
4D MOV C,L 7E MOV A,M
4E MOV C,M 7F MOV A,A
4F MOV C,A
50 MOV D,B 3E nn MVI A,byte
51 MOV D,C 06 nn MVI B,byte
52 MOV D,D 0E nn MVI C,byte
53 MOV D,E 16 nn MVI D,byte
54 MOV D,H 1E nn MVI E,byte
55 MOV D,L 26 nn MVI H,byte
56 MOV D,M 2E nn MVI L,byte
57 MOV D,A 36 nn MVI M,byte
58 MOV E,B
59 MOV E,C 01 nnnn LXI B,dble
5A MOV E,D 11 nnnn LXI D,dble
5B MOV E,E 21 nnnn LXI H,dble
5C MOV E,H 31 nnnn LXI SP,dble
5D MOV E,L
5E MOV E,M 02 STAX B
5F MOV E,A 12 STAX D
60 MOV H,B 0A LDAX B
61 MOV H,C 1A LDAX D
62 MOV H,D 32 nnnn STA adr
63 MOV H,E 3A nnnn LDA adr
64 MOV H,H 22 nnnn SHLD adr
65 MOV H,L 2A nnnn LHLD adr
66 MOV H,M EB XCHG
67 MOV H,A
68 MOV L,B STACK
69 MOV L,C
6A MOV L,D C5 PUSH B
6B MOV L,E D5 PUSH D
6C MOV L,H E5 PUSH H
6D MOV L,L F5 PUSH PSW
C1 POP B 09 DAD B
D1 POP D 19 DAD D
E1 POP H 29 DAD H
F1 POP PSW 39 DAD SP
E3 XTHL
F9 SPHL LOGICAL
33 INX SP
3B DCX SP E6 nn ANI byte
EE nn XRI byte
ARITHEMATICS F6 nn ORI byte
A0 ANA B
C6 nn ADI byte A1 ANA C
CE nn ACI byte A2 ANA D
A3 ANA E
80 ADD B A4 ANA H
81 ADD C A5 ANA L
82 ADD D A6 ANA M
83 ADD E A7 ANA A
84 ADD H A8 XRA B
85 ADD L A9 XRA C
86 ADD M AA XRA D
87 ADD A AB XRA E
88 ADC B AC XRA H
89 ADC C AD XRA L
8A ADC D AE XRA M
8B ADC E AF XRA A
8C ADC H B0 ORA B
8D ADC L B1 ORA C
8E ADC M B2 ORA D
8F ADC A B3 ORA E
B4 ORA H
D6 nn SUI byte B5 ORA L
DE nn SBI byte B6 ORA M
B7 ORA A
90 SUB B
91 SUB C COMPARE
92 SUB D
93 SUB E FE nn CPI byte
94 SUB H B8 CMP B
95 SUB L B9 CMP C
96 SUB M BA CMP D
97 SUB A BB CMP E
98 SBB B BC CMP H
99 SBB C BD CMP L
9A SBB D BE CMP M
9B SBB E BF CMP A
9C SBB H
9D SBB L ROTATE
9E SBB M
9F SBB A
07! RLC F7 RST 6
17 RAL FF RST 7
0F RRC
1F RAR INPUT/OUTPUT
JUMP DB nn IN byte
D3 nn OUT byte
C3 nnnn JMP adr
DA nnnn JC adr INCREMENT/DECREMENT
D2 nnnn JNC adr
CA nnnn JZ adr
04 INR B
C2 nnnn JNZ adr
0C INR C
F2 nnnn JP adr
14 INR D
FA nnnn JM adr
1C INR E
EA nnnn JPE adr
24 INR H
E2 nnnn JPO adr
2C INR L
E9 PCHL
34 INR M
3C INR A
CALL 03 INX B
13 INX D
CD nnnn CALL adr 23 INX H
DC nnnn CC adr 05 DCR B
D4 nnnn CNC adr 0D DCR C
CC nnnn CZ adr 15 DCR D
C4 nnnn CNZ adr 1D DCR E
F4 nnnn CP adr 25 DCR H
FC nnnn CM adr 2D DCR L
EC nnnn CPE adr 35 DCR M
E4 nnnn CPO adr 3D DCR A
0B DCX B
RETURN 1B DCX D
2B DCX H
C9 RET
D8 RC
D0 RNC SPECIALS
C8 RZ
C0 RNZ 2F CMA
F0 RP 37 STC
F8 RM 3F CMC
E8 RPE 27 DAA
E0 RPO
CONTROL
RESTART
00! NOP
C7 RST 0 F3 DI
CF RST 1 FB EI
D7 RST 2 76 HLT
DF RST 3 20 RIM
E7 RST 4 30 SIM
EF RST 5
Appendix F Hardware schematic

45
5 4 3 2 1
D[0..7] J1 +5V
A[0..7] D[0..7]
A[0..7]
U1
0x0000-0x7FFF 0x8000-0xFFFF 32kB D0 4 2 1 2
D1 Q1 GPIO_LED1 3 + +
JP1 3 4
Monitor Program SRAM, NVRAM D0 A0 D1 5
Q1
7 5
+ +
6
D1 1 2 A1 D2 Q2 GPIO_LED2 7 + +
U2 U3 6 8
U4 A0 D0 A0 D0 D2 3 4 A2 D2 Q2 + +
10 A0 O0 11 10 A0 D0 11 5 6 12 D3 Q3 10 9 + + 10
A1 9 12 D1 A1 9 12 D1 D3 A3 11 GPIO_LED3 11 12
D0 A0 A2 A1 O1 D2 A2 A1 D1 D2 D4 7 8 A4 D3 Q3 + +
2 1D 1Q 19 8 A2 O2 13 8 A2 D2 13 9 10 13 D4 Q4 15 13 + + 14
D D1 A1 A3 D3 A3 D3 D5 A5 GPIO_LED4 15 D
3 2D 2Q 18 7 A3 O3 15 7 A3 D3 15 11 12 Q4 14 + + 16
D2 4 17 A2 A4 6 16 D4 A4 6 16 D4 D6 A6
D3 3D 3Q A3 A5 A4 O4 D5 A5 A4 D4 D5 D7 13 14 A7
5 4D 4Q 16 5 A5 O5 17 5 A5 D5 17 15 16 9 CLK
D4 6 15 A4 A6 4 18 D6 A6 4 18 D6 /RD RESET_IN 1
D5 5D 5Q A5 A7 A6 O6 D7 A7 A6 D6 D7 /WR 17 18 CLR
7 6D 6Q 14 3 A7 O7 19 3 A7 D7 19 19 20
D6 8 13 A6 A8 25 A8 25 IO/M *RST5.5 74LS175
D7 7D 7Q A7 A9 A8 A9 A8 SID 21 22 *RST6.5
9 8D 8Q 12 24 A9 24 A9 23 24
A10 21 A10 21 ALE *RST7.5
ALE A11 A10 A11 A10 SOD 25 26 *INTR U5
11 LE 23 A11 23 A11 27 28
1 A12 2 A12 2 S0 INTA
OE A13 A12 A13 A12 S1 29 30 D4
26 A13 26 A13 31 32 3 1Y 1A 2
20 A14 27 A14 1 CLKOUT D5 6 5
VCC A14 A14 READY 33 34 HOLD D6 2Y 2A
35 36 8 3Y 3A 9
ROM_CE 20 RAM_CE 20 RESET_OUT HLDA +5V D7 11 12
74HC573 /RD CE /RD CE 37 38 4Y 4A
22 OE 22 OE 39 40
+5V 1 /WR 27 1
+5V VPP WE 1OE
HEADER 20X2 4
2OE
27C256 HM62256B U6A 10
A[8..14] GPIO 3OE
1 4OE 13
3
/WR 2
74LS126
4001 U6B
C memory & i/o decoder 5 C
4
U8 /RD 6
U7
RESET_IN 36 12 D0 S0 2 12 RAM_CE 4001
+5V 47pF C1 RST-IN AD0 D1 S1 I I/O/Q ROM_CE
AD1 13 3 I I/O/Q 13
1 14 D2 A4 4 14
X1 AD2 D3 I I/O/Q SYSTEM_PPI
15 A5 5 15
AD3 D4 I I/O/Q GPIO +5V
4MHz 16 A6 6 16
C2 AD4 D5 I I/O/Q CTC
D1 Q1 2 17 A7 7 17
X2 AD5 D6 IO/M I I/O/Q USER_PPI VCC
1N4148 R1 18 8 18
SID AD6 D7 A15 I I/O/Q UART
100k 47pF 5 19 9 19
TRAP SID AD7 A8 I I/O/Q LCD_E
6 TRAP A8 21 VCC
S1 22 A9 /RD 1
RST5.5 A9 A10 /WR I/CLK
9 RST 5.5 A10 23 11 I/OE
RST6.5 8 24 A11 VSS
RST7.5 RST 6.5 A11 A12
KIA7045 7 RST 7.5 A12 25
RESET 26 A13 GAL16V8D
INTR A13 A14
10 INTR A14 27
R2 + C3 3 28 A15
1k 1uF OUT INTA A15
2 GND 11 INTA
1 30 ALE U9A
VCC S0 ALE
29 31 WR SW1
S0 WR *RST5.5 RST5.5
U25 RD 32 RD 1 8 1 2
B S1 33 34 2 7 B
S1 IO/M RESET_OUT
RST-OT 3 reset 3 6
+5V HOLD 39 37 CLKOUT 4 5 74LS04
HOLD CLKO SOD CLKOUT
+5V 4 +5V U9B
READY SOD HLDA
35 38 SW DIP-4/SM
READY HLDA *RST6.5 RST6.5
3 4
R3 MSM80C85A R4
+5V 4.7k 4.7k
R15 74LS04
4.7k +5V U6C U9C
R5 8 +5V
4.7k 10 5 6 RST7.5
R6 330 D2 9
SID GPIO_LED1 R7
U10 SW2 4001 330 74LS04
1 3 LED NO 1 U9D
A QA R8 330
2 4 D3 2
B QB GPIO_LED2 *INTR INTR
QC 5 3 9 8
6 NC D4
QD +5V PS2273
10 LED
ALE QE R9 330 LED
8 11 D5 U6D 74LS04
CLK QF GPIO_LED3 +5V
QG 12 12
TRAP R21 R10
9 CLR QH 13 11
4.7k LED 13
R11 *RST7.5
A 74LS164 330 D6 A
U9E GPIO_LED4 4.7k 4001
10 11 TRACE LED U9F
13 12 Title
74LS04 8085 Microprocesssor Training Kit
74LS04 Size Document Number Rev
B <Doc> 2
Date: Saturday, July 30, 2005 Sheet 1 of 4
5 4 3 2 1
5 4 3 2 1
U11 R12
PB0 2 18 1 16
PB1 1A1 1Y1
4 1A2 1Y2 16 2 15
PB2 6 14 3 14
PB3 1A3 1Y3
8 1A4 1Y4 12 4 13
PB4 11 9 5 12
PB5 2A1 2Y1
13 2A2 2Y2 7 6 11
PB6 15 5 7 10 +5V
PB7 2A3 2Y3
17 2A4 2Y4 3 8 9 VCC
1 R-PACK
D 1G D
19 2G VCC
74LS244
10

10

10

10

10

10
7
6
4
2
1
9

7
6
4
2
1
9

7
6
4
2
1
9

7
6
4
2
1
9

7
6
4
2
1
9

7
6
4
2
1
9

5
U12 U13 U14 U15 U16 U17 VSS
a
b

d
e

g
dp

a
b

d
e

g
dp

a
b

d
e

g
dp

a
b

d
e

g
dp

a
b

d
e

g
dp

a
b

d
e

g
dp
c

c
f

f
A[0..7]
COMMON CATHODE 6-DIGIT
A0 7-SEGMENT LED
A1
A2
A3
A4
com1
com2

com1
com2

com1
com2

com1
com2

com1
com2

com1
com2
A5
A6
A7 TOS-5161AE TOS-5161AE TOS-5161AE TOS-5161AE TOS-5161AE TOS-5161AE
3
8

3
8

3
8

3
8

3
8

3
8
U18
0 1

1
1 2
3 SPEAKER 2 Q2
PC0 2 BC327
15 A 3 4
PC1 14 5
PC2 B 4

3
C 13 C 5 6 C
PC3 12 7
D 6
7 9
10 R13
8 100
9 11
74LS145
SU1
SYSTEM_PPI
SW29
0x10-0x13
8255 SPEAKER SW PUSHBUTTON
25 PB7 SPEAKER
PB7 PB6
PB6 24
23 PB5
PB5 PB4
PB4 22 TRACE
21 PB3 SW3
PB3
PB2 20 PB2
PB1 SW4 SW5 SW6 SW7
PA6 user_key1 +5V
PB1 19
18 PB0
PB0
10 SW8
PC7 PA7
11
B 6 CS
PC6
PC5 12 PC5
PC4 SW9 SW10 SW11 SW12
user_key2 B
reset 35 RESET PC4 13
A1 8 17 PC3
A0 A1 PC3 PC2
9 A0 PC2 16
36 15 PC1
WR WR PC1 PC0
RD 5 RD PC0 14
SW13 SW14 SW15
D7 PA7 SW16 +5V
27 D7 PA7 37
D6 28 38 PA6
D5 D6 PA6 PA5 R14
29 D5 PA5 39
D4 30 40 PA4 PA0 2 1
D3 D4 PA4 PA3 PA1
31 D3 PA3 1 3
D2 32 2 PA2 PA2 4
D1 D2 PA2 PA1 SW17 SW18 SW19 PA3
33 D1 PA1 3 5
D0 PA0 SW20 PA4
34 D0 PA0 4 6
PA5 7
U19 PA6 8
PA7 9
C
4.7k
SW21 SW22 SW23 SW24
A A
D[0..7]
SW25 SW26 SW27 SW28 Title
8085 Microprocessor Training Kit
Size Document Number Rev
B <Doc> 2
Date: Saturday, July 30, 2005 Sheet 2 of 4
5 4 3 2 1
5 4 3 2 1
D[0..7] 0x40-0x47
+5V UART
CLKOUT U20
0x20-0x23
U21 D0 1 10 RxD
D D0 D1 D0 SDI D
8 D0 2 D1
D1 7 D2 3 18
D2 D1 D3 D2 WR1 WR
6 D2 CLK0 9 4 D3 WR2 19
D3 5 11 D4 5 21
D4 D3 G0 D5 D4 RD1 RD
4 D4 OUT0 10 *RST7.5 6 D5 RD2 22
D5 3 D6 7 25
D6 D5 D7 D6 ADS
2 D6 CLK1 15 8 D7 MR 35 reset
D7 1 14 36
D7 G1 TxD CTS
OUT1 13 11 SDO DSR 37
22 38 DCD
RD RD DCD
WR 23 WR CLK2 18 34 OUT1 RI 39
A0 19 16 31
A1 A0 G2 OUT2 2MHz
A[0..7] 20 A1 OUT2 17 XIN 16
23 DDIS XOUT 17
21 +5V 24
CTC CS TXRDY A0
29 RXRDY A0 28
A0 8254 30 27 A1
A1 R17 R18 RTS INTRPT A1 A2
counter/timer 32 RTS A2 26
A2 4.7k 4.7k 33 +5V
A3 DTR
CS0 12
A4 9 13
A5 RCLK CS1
15 BAUDOUT CS2 14
A6
A7 User PPI
C C
TL16C550A +5V
0x30-0x33 VCC
U22
D0 34 4 USER_PA0
D1 D0 PA0 USER_PA1
33 D1 PA1 3 UART VCC
D2 32 2 USER_PA2
D3 D2 PA2 USER_PA3
31 D3 PA3 1
D4 30 40 USER_PA4 VSS
D5 D4 PA4 USER_PA5
29 D5 PA5 39
D6 28 38 USER_PA6 +5V
D7 D6 PA6 USER_PA7 JP2
27 D7 PA7 37
5 18 JR1 SW30
RD RD PB0 1 2
WR 36 WR PB1 19 3 4 1
A0 9 20 16 2
A1 A0 PB2 5 6 16
8 A1 PB3 21 7 8 15 15 3
35 22 14 D7 0x50-0x53
reset RESET PB4 9 10 14 D6
6 23 13 backlight
USER_PPI CS PB5 11 12 13 D5
PB6 24 13 14 12 12
25 text LCD 11 D4
PB7 15 16 11 D3
17 18 10 10
14 9 D2
PC0 19 20 9 D1
PC1 15 21 22 8 8
B 16 7 D0 B
PC2 23 24 USER_PA0 7 LCD_E
PC3 17 25 26 6 6 LCD_E
13 USER_PA1 5 R/W A1
PC4 27 28 USER_PA2 5 RS A0
PC5 12 29 30 4 4
11 USER_PA3 3
PC6 31 32 USER_PA4 3
PC7 10 33 34 2 2
USER_PA5 1
35 36 USER_PA6 1
8255
37 38 USER_PA7
39 40 CONN RECT 16 +5V

2
+5V HEADER 20X2
1 3
10uF 10V 10uF C7
R19
+
C6

+
10K
U23
VB1 2 1
V+ C+ 10uF
5 C1- 3
9 6 V- C2+ 4
4 C8 5
C2-

+
+
8 C9
3 10uF
7 14 11 TxD
A T1OUT T1IN RTS A
2 7 T2OUT T2IN 10
6 13 12 RxD
R1IN R1OUT DCD
1 8 R2IN R2OUT 9
SUB-D 9, (male) use straight cable
MAX232A Title
RS232 level converter 8085 Microprocessor Training Kit
Size Document Number Rev
B <Doc> 2
Date: Saturday, July 30, 2005 Sheet 3 of 4
5 4 3 2 1
5 4 3 2 1
J5
1
2
3
CON3
D7 R20 2k
D D
POWER LED (red)
+5V
TP1 U24 J6
LM2490-5.0 D8
+5V 3 1 2 1 1
1 VOUT VIN
2
C13 10uF 16V
GND

+ + 1N4007 DC Input
C12 C14 C15 C16 C17
C10 C18 C19 C11
0.1uF 0.1uF 0.1uF 0.1uF 0.1uF
TP2 0.1uF 0.1uF 1000uF25V
2

GND 1
0.1uF
+5V
C C
+5V
VCC
C20 C21 C22 C23
0.1uF 0.1uF 0.1uF 0.1uF
VCC
VSS
B B
+5V
+ C24 + C25 + C26 + C27
10uF 10uF 10uF 10uF
A A
Title
8085 Microprocessor Training Kit
Size Document Number Rev
B <Doc>
Date: Saturday, July 30, 2005 Sheet 4 of 4
5 4 3 2 1
Appendix G Monitor source code listing

46
A8085.LST 29/3/2558 15:27

1 ;-----------------------------------------------------------------
2 ; A8085.ASM
3 ; monitor program for MTK-85 8085 MICROPROCESSOT TRAINING KIT
4 ; COPYRIGHT (C) 2007-2015 BY WICHIT SIRICHOTE, [email protected]
5 ;
6 ; source file was assembled with C32 Cross Assembler V3.0
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 ;
15 ;-----------------------------------------------------------------
16
17 0000 CPU "8085.TBL" ;CPU TABLE
18 0000 HOF "INT8" ;HEX FORMAT
19
20
21 ; ---------- onboard GPIO --------------------------------------
22
23 0000 = gpio equ 0 ; D0-D3 is 4-bit output port, D4-D7 is 4-bit input port
24
25
26 ;---------- 8255 PPI system port I/O address ----------------------
27
28 0010 = system_port_a: equ 10h
29 0011 = system_port_b: equ 11h
30 0012 = system_port_c: equ 12h
31 0013 = system_port_control: equ 13h
32
33 ;-------------------- 8254 counter/timer --------------------------
34
35 0020 = counter0_8254 equ 20h
36 0021 = counter1_8254 equ 21h
37 0022 = counter2_8254 equ 22h
38 0023 = control_8254 equ 23h
39
40 0034 = control_word_8254 equ 00110100B ; mode 0, counter0
41
42 ;---------- 8255 PPI user port I/O address ------------------------
43
44 0030 = user_port_a: equ 30h
45 0031 = user_port_b: equ 31h
46 0032 = user_port_c: equ 32h
47 0033 = user_port_control: equ 33h
48
49
50 ;---------- 16C550 compatible UART I/O address --------------------
51 ; e.g., UM8250B, 16C450, 16C550
52
53 0040 = uart_buffer: equ 40h
54 0045 = uart_line_status: equ 45h
55 0042 = uart_fifo: equ 42h
56 0043 = uart_lcr: equ 43h
57 0040 = uart_divisor_lsb: equ 40h
58 0041 = uart_divisor_msb: equ 41h
59 0047 = uart_scr: equ 47h
60
61
62 ;------------------- onboard LCD registers ------------------------
63
64 0050 = command_write equ 50h
65 0052 = command_read equ 52h
66 0051 = data_write equ 51h
67 0053 = data_read equ 53h
68 0080 = busy equ 80h
69
70 0009 = TAB EQU 9 ; ASCII TAB
71 0000 = RS EQU 0 ; terminator
72
73 000D = cr: equ 0dh
74 000A = lf: equ 0ah
75 0020 = sp: equ 20h
76

Page 1 of 63
A8085.LST 29/3/2558 15:27

77
78 F000 = system_ram equ 0f000h
79
80 ;system_stack equ 0ffffh
81
82 8100 = home_address equ 8100h
83
84 0000 = rom equ 0000h ; change to 8000 for testing under RAM
85 ; chnage to 0000 for rom programming
86
87 8000 = my_rom equ 8000h
88
89 0000 ORG rom
90 0000 C30001 JMP START ; reset vector
91
92 0008 ORG rom+8 ; RST 1 opcode is CF
93 0008 C35C02 jmp monitor_call
94
95 0010 ORG rom+10h ; RST 2 used for testing RST 7
96 ; jmp service_rst2
97
98 0010 C31080 jmp my_rom+10h
99
100 0018 ORG rom+18h ; DF RST 3 for testing monitor call function in RAM
101 0018 C31880 jmp my_rom+18h
102
103 ; jmp monitor_call
104
105 0020 ORG rom+20h ; RST 4
106 0020 C32080 jmp my_rom+20h
107
108 0024 ORG rom+24h
109 ; jmp my_rom+24h
110 0024 C3D802 jmp service_trap ; sing step running service routine
111
112 0028 ORG rom+28h ; RST 5
113 0028 C32880 jmp my_rom+28h
114
115 002C ORG rom+2ch ; relocate RST5.5 to external ram
116 002C C32C80 jmp my_rom+2ch
117
118 0030 ORG rom+30h ; relocate RST 6
119 0030 C33080 jmp my_rom+30h
120
121 0034 ORG rom+34h ; relocate RST6.5 to external ram
122 0034 C33480 jmp my_rom+34h
123
124 0038 ORG ROM+38H
125 0038 C38E02 jmp service_rst7 ; RST 7 service jump back to monitor
126
127 003C ORG rom+3ch ; relocate RST7.5 to external ram
128 003C C33C80 jmp my_rom+3ch
129
130
131 0100 ORG rom+100h
132
133
134 0100 F3 START di
135 0101 3178F0 lxi sp,system_stack+32 ; point to top of system stack
136 0104 2198F0 lxi h,user_stack+32 ; point to top of user stack
137 0107 2233F0 shld user_SP
138
139
140 010A 3E90 MVI A,90H
141 010C D313 OUT system_port_control
142
143 010E 3EF0 mvi a,0f0h ; disable trap
144 0110 D312 out system_port_c
145
146 0112 CDED11 call init_uart
147
148 0115 CD0302 call init_lcd
149 0118 218B1D lxi h,prompt2
150 011B CD1502 call put_str_lcd
151 011E 210100 lxi h,01
152 0121 CD2502 call goto_xy

Page 2 of 63
A8085.LST 29/3/2558 15:27

153 0124 21A01D lxi h,text3


154 0127 CD1502 call put_str_lcd
155
156 012A CD8A01 call init_8254
157
158 ; NVRAM booting
159 ; if location 8000H has C3 opcode then jump to 8000H
160 ; if user press USER1 with RESET put 00 to 8000H
161 ; ans skip booting
162
163 012D DB10 in system_port_a
164 012F E680 ani 80h
165 0131 CA4101 jz skip_boot
166
167 0134 3A0080 lda 8000H
168 0137 FEC3 cpi 0c3h
169 0139 C24101 jnz skip_boot
170 013C 210080 lxi h,8000h
171 013F E5 push h
172 0140 C9 ret ; jump to NVRAM
173
174
175 0141 AF skip_boot: xra a ; write 00 to 8000H
176 0142 320080 sta 8000H
177 0145 3226F0 sta counter1 ; clear counter1
178
179 0148 3A28F0 lda warm_code
180 014B FE24 cpi "$"
181 014D CA5F01 jz skip_cold_boot
182 0150 3E24 mvi a,"$"
183 0152 3228F0 sta warm_code
184
185 0155 CD2806 call test_buzzer
186
187 0158 3EFF mvi a,0ffh
188 015A D300 out gpio ; make GPIO LED on
189
190 015C CD5C0B call cold_boot
191
192
193 015F skip_cold_boot:
194
195
196 015F 210081 lxi h,home_address
197 0162 2229F0 shld user_PC
198 0165 223BF0 shld pointer
199
200 0168 3A24F0 lda uart_found
201 016B FE00 cpi 0
202 016D CA7601 jz skip_send_prompt
203
204 0170 CD9A12 call send_prompt3
205
206 0173 CD210D call send_prompt
207
208
209 0176 skip_send_prompt:
210
211 0176 AF xra a
212 0177 D300 out gpio ; turn LED off
213
214 0179 3E00 mvi a,0
215 017B 3225F0 sta entry_mode ; set data entry mode
216 017E CDA40A call read_memory
217
218 0181 CD640C main: call scan_key
219 0184 CD7C05 call key_execute
220 0187 F28101 jp main
221
222
223 ;---------------- initialize counter0 for RST7.5 interrupt ----------------
224
225 018A 3E34 init_8254: mvi a, control_word_8254
226 018C D323 out control_8254
227 018E AF xra a
228 018F D320 out counter0_8254

Page 3 of 63
A8085.LST 29/3/2558 15:27

229 0191 D320 out counter0_8254


230 0193 C9 ret
231
232 ; convert 8-bit unsigned in A to ASCII string in line_buffer
233 ; entry: A
234
235 0194 bin2ascii:
236 0194 1E00 mvi e,0
237
238 0196 FE64 bin1 cpi 100
239 0198 DAA101 jc bin2
240 019B D664 sui 100
241 019D 1C inr e
242 019E C39601 jmp bin1
243
244 01A1 57 bin2: mov d,a
245 01A2 7B mov a,e
246 01A3 C630 adi "0"
247 01A5 3246F0 sta line_buffer
248 01A8 7A mov a,d
249 01A9 1E00 mvi e,0
250
251 01AB FE0A bin3: cpi 10
252 01AD DAB601 jc bin4
253 01B0 D60A sui 10
254 01B2 1C inr e
255 01B3 C3AB01 jmp bin3
256
257 01B6 57 bin4: mov d,a
258 01B7 7B mov a,e
259 01B8 C630 adi "0"
260 01BA 3247F0 sta line_buffer+1
261 01BD 7A mov a,d
262 01BE C630 adi "0"
263 01C0 3248F0 sta line_buffer+2
264 01C3 C9 ret
265
266
267 ; print 8-bit unsigned decimal to terminal
268 ; entry: A
269
270 01C4 CD9401 pint8u: call bin2ascii
271 01C7 3A46F0 lda line_buffer
272 01CA FE30 cpi "0"
273 01CC CADF01 jz pint1
274 01CF CD1612 call cout
275 01D2 3A47F0 lda line_buffer+1
276 01D5 CD1612 call cout
277 01D8 3A48F0 lda line_buffer+2
278 01DB CD1612 call cout
279 01DE C9 ret
280
281 01DF 3A47F0 pint1: lda line_buffer+1
282 01E2 FE30 cpi "0"
283 01E4 CAEA01 jz pint2
284 01E7 CD1612 call cout
285
286 01EA 3A48F0 pint2: lda line_buffer+2
287 01ED CD1612 call cout
288 01F0 C9 ret
289
290
291 ; convert 16-bit unsigned integer to ASCII code stored in line_buffer
292 ; entry: HL
293
294
295
296
297
298
299
300
301
302
303 ;--------------------- LCD driver routines --------------------------------
304

Page 4 of 63
A8085.LST 29/3/2558 15:27

305 01F1 F5 lcd_ready: push psw


306
307 01F2 DB52 lcd_ready1: in command_read
308 01F4 E680 ani 80h
309 01F6 C2F201 jnz lcd_ready1 ; wait until lcd ready
310 01F9 F1 pop psw
311
312 01FA C9 ret
313
314 01FB CDF101 clear_lcd: call lcd_ready
315 01FE 3E01 mvi a,1
316 0200 D350 out command_write
317 0202 C9 exit_clear: ret
318
319 0203 CDF101 init_lcd: call lcd_ready
320 0206 3E38 mvi a,38h
321 0208 D350 out command_write
322 020A CDF101 call lcd_ready
323 020D 3E0C mvi a, 0ch
324 020F D350 out command_write
325 0211 CDFB01 call clear_lcd
326
327 0214 C9 ret
328
329 ; print ASCII text on LCD
330 ; entry: HL pointer with 0 for end of string
331
332 0215 7E put_str_lcd: mov a,m ; get A from [HL]
333 0216 FE00 cpi 0
334 0218 C21C02 jnz put_str_lcd1
335 021B C9 ret
336
337 021C put_str_lcd1:
338
339 021C CDF101 call lcd_ready
340 021F D351 out data_write
341 0221 23 inx h
342 0222 F21502 jp put_str_lcd
343
344 ; goto_xy set cursor location on lcd
345 ; entry: HL: H = x, L = y
346
347 0225 CDF101 goto_xy: call lcd_ready
348 0228 7D mov a,l
349 0229 FE00 cpi 0
350 022B C23402 jnz goto_xy1
351 022E 7C mov a,h
352 022F C680 adi 80h
353 0231 D350 out command_write
354 0233 C9 ret
355
356 0234 FE01 goto_xy1: cpi 1
357 0236 C23F02 jnz goto_xy2
358 0239 7C mov a,h
359 023A C6C0 adi 0c0h
360 023C D350 out command_write
361 023E C9 ret
362
363 023F FE02 goto_xy2: cpi 2
364 0241 C24A02 jnz goto_xy3
365 0244 7C mov a,h
366 0245 C694 adi 094h
367 0247 D350 out command_write
368 0249 C9 ret
369
370 024A FE03 goto_xy3: cpi 3
371 024C C25502 jnz goto_xy4
372 024F 7C mov a,h
373 0250 C6D4 adi 0d4h
374 0252 D350 out command_write
375 0254 C9 ret
376
377 0255 C9 goto_xy4: ret
378
379 ; put_ch_lcd put character to lcd
380 ; entry: A

Page 5 of 63
A8085.LST 29/3/2558 15:27

381
382 0256 CDF101 put_ch_lcd: call lcd_ready
383 0259 D351 out data_write
384 025B C9 ret
385
386 ;--------------------------------------------------------------------
387
388 ; monitor call entry
389 ; entry: E = monitor call number 0-255
390 ; calling monitor function is made with RST 1 command after loading the
391 ; regsiter E with call number
392 ; destroy: BC user must save it in stack memory
393
394 025C E5 monitor_call: push h
395 025D F5 push psw
396 025E D5 push d
397
398 025F 7B mov a,e ; get call number
399 0260 07 rlc ; x2
400 0261 5F mov e,a ; put it back
401
402 0262 217002 lxi h,vector_table
403 0265 1600 mvi d,0
404 0267 19 dad d ; get location in jump table
405 0268 4E mov c,m
406 0269 23 inx h
407 026A 46 mov b,m
408
409 026B D1 pop d
410 026C F1 pop psw
411 026D E1 pop h
412
413 026E C5 push b ; push address into top of stack
414
415 026F C9 ret ; jump to monitor call function
416
417 0270 vector_table:
418 0270 860B dwl demo ; #0 running LED with HL pointer
419 0272 FB05 dwl delay ; #1 simple delay routine
420 0274 5C0B dwl cold_boot ; #2 show 8085 running
421 0276 940C dwl scan ; #3 scan display one cycle
422 0278 2212 dwl cin ; #4 get byte from console
423 027A 1612 dwl cout ; #5 print byte to console
424 027C 3F12 dwl put_str ; #6 print string with 0 terminator to console
425 027E 0302 dwl init_lcd ; #7 initialize lcd
426 0280 F101 dwl lcd_ready ; #8 wait until lcd is ready
427 0282 FB01 dwl clear_lcd ; #9 clear lcd display
428 0284 2502 dwl goto_xy ; #10 set lcd cursor position
429 0286 1502 dwl put_str_lcd ; #11 print ASCII string on lcd
430 0288 5602 dwl put_ch_lcd ; #12 print ASCII letter on lcd
431 028A ED05 dwl test_led ; #13 run LED onboard
432 028C C401 dwl pint8u ; #14 print 8-bit unsigned to terminal
433
434
435
436 ; save CPU registers to stack and write them to user registers
437 ;
438
439 028E service_rst7:
440 028E F5 push psw
441 028F C5 push b
442 0290 D5 push d
443
444 0291 E1 pop h
445 0292 222FF0 shld user_DE
446 0295 E1 pop h
447 0296 222DF0 shld user_BC
448 0299 E1 pop h
449 029A 222BF0 shld user_AF
450 029D E1 pop h
451
452 029E 2229F0 shld user_PC ; store next PC
453
454 02A1 210000 lxi h,0000h
455 02A4 39 dad sp ; get SP
456 02A5 2233F0 shld user_SP ; save user SP

Page 6 of 63
A8085.LST 29/3/2558 15:27

457
458 02A8 CDA40A call read_memory
459 02AB CD3B0F call register_display1
460
461 02AE 2A56F0 lhld save_stack
462
463 02B1 F9 sphl ; restore system stack
464
465
466 02B2 C9 ret
467
468
469 ; test diplay register after break
470 ; RST 2 opcode is D7
471 ; later will be changed to RST 7
472
473 02B3 service_rst2:
474 02B3 F5 push psw
475 02B4 C5 push b
476 02B5 D5 push d
477
478 02B6 E1 pop h
479 02B7 222FF0 shld user_DE
480 02BA E1 pop h
481 02BB 222DF0 shld user_BC
482 02BE E1 pop h
483 02BF 222BF0 shld user_AF
484 02C2 E1 pop h
485
486 02C3 2229F0 shld user_PC ; store next PC
487
488 02C6 210000 lxi h,0000h
489 02C9 39 dad sp ; get content of SP
490
491 02CA 2233F0 shld user_SP ; save user SP
492
493 02CD CDA40A call read_memory
494 02D0 CD3B0F call register_display1
495
496 02D3 2A56F0 lhld save_stack
497
498 02D6 F9 sphl ; restore system stack
499
500
501 02D7 C9 ret
502
503
504 ; service trap for single step running
505 ; disable trap input by setting system port c.6
506 ; save CPU registers to user registers
507
508 02D8 service_trap:
509 02D8 F5 push psw ; save A and Flag
510
511 02D9 3EFF mvi a,0ffh
512 02DB D312 out system_port_c ; turn trap off by clearing shift register
513
514 02DD C5 push b
515 02DE D5 push d
516 02DF E5 push h
517
518 02E0 E1 pop h
519 02E1 2231F0 shld user_HL ; save HL
520 02E4 E1 pop h
521 02E5 222FF0 shld user_DE
522 02E8 E1 pop h
523 02E9 222DF0 shld user_BC
524 02EC E1 pop h
525 02ED 222BF0 shld user_AF
526
527 02F0 E1 pop h ; store next PC
528 02F1 2229F0 shld user_PC
529
530 02F4 210000 lxi h,0
531 02F7 39 dad sp
532 02F8 2233F0 shld user_SP ; save user SP

Page 7 of 63
A8085.LST 29/3/2558 15:27

533
534 02FB CDA40A call read_memory
535
536 02FE 3A24F0 lda uart_found
537 0301 FE00 cpi 0
538 0303 CA0903 jz skip1
539 0306 CD3B0F call register_display1
540
541 0309 skip1:
542 0309 2A56F0 lhld save_stack
543
544 030C F9 sphl ; restore system stack
545
546 030D C9 ret ; jump back to main body
547
548
549 ; disassemble machine code into mnemonic
550
551 030E disassemble1:
552 030E 3A22F0 lda command
553 0311 FE64 cpi "d"
554 0313 C23403 jnz exit_disassemble
555
556 0316 21881E lxi h,disassemble_text
557 0319 CD3F12 call put_str
558
559 031C CDC112 call new_line
560 031F 0E10 mvi c,16 ; 16 lines
561
562
563 0321 C5 dis2: push b
564
565 0322 CDC112 call new_line
566
567 0325 CDAB03 call d_disassemble
568
569 0328 C1 pop b
570 0329 0D dcr c
571 032A C22103 jnz dis2
572
573 032D CDC112 call new_Line
574 0330 CD210D call send_prompt
575 0333 C9 ret
576
577
578 0334 C9 exit_disassemble: ret
579
580
581 ; disassemble opcode to mnemonic
582 ; entry: user_PC
583 ; exit: user_PC = next address
584
585 0335 2A29F0 disassemble: lhld user_PC
586
587 0338 E5 push h
588
589 0339 7C mov a,h
590 033A CDB212 call out2x
591 033D 7D mov a,l
592 033E CDB212 call out2x
593 0341 CDCC12 call space
594
595 0344 7E mov a,m ; get opcode
596 0345 CD2104 call get_number_of_byte
597 0348 4F mov c,a
598
599 0349 7E disassem3: mov a,m
600 034A CDB212 call out2x
601 034D 23 inx h
602 034E 0D dcr c
603 034F C24903 jnz disassem3
604
605 0352 E1 pop h
606
607 0353 7E mov a,m
608 0354 CD2104 call get_number_of_byte

Page 8 of 63
A8085.LST 29/3/2558 15:27

609 0357 FE01 cpi 1


610 0359 C26103 jnz one_tab
611
612 035C 3E09 mvi a,tab ; print two tabs for one byte opcode
613 035E CD1612 call cout
614
615 0361 3E09 one_tab: mvi a,tab ; else only one tab
616 0363 CD1612 call cout
617
618 0366 E5 push h
619
620 0367 7E mov a,m ; get opcode
621
622 0368 F5 push psw
623
624 0369 210000 lxi h,0000h ; clear HL
625 036C 6F mov l,a
626
627 036D 29 dad h ; HL = HLx2
628
629 036E 5D mov e,l
630 036F 54 mov d,h
631
632 0370 21F214 lxi h,ins_table
633 0373 19 dad d ; ADD HL,DE
634 0374 5E mov e,m
635 0375 23 inx h
636 0376 56 mov d,m
637
638 0377 6B mov l,e
639 0378 62 mov h,d
640
641 0379 CD3F12 call put_str
642
643 037C F1 pop psw
644 037D E1 pop h
645
646 037E CD2104 call get_number_of_byte
647 0381 FE01 cpi 1
648 0383 C28B03 jnz disassem1
649 0386 23 inx h
650 0387 2229F0 shld user_PC
651 038A C9 ret
652
653 038B FE02 disassem1: cpi 2
654 038D C29A03 jnz disassem2
655 0390 23 inx h
656 0391 7E mov a,m
657 0392 CDB212 call out2x
658 0395 23 inx h
659 0396 2229F0 shld user_PC
660 0399 C9 ret
661
662 039A 23 disassem2: inx h
663 039B 23 inx h
664 039C 7E mov a,m
665 039D CDB212 call out2x
666 03A0 2B dcx h
667 03A1 7E mov a,m
668 03A2 CDB212 call out2x
669 03A5 23 inx h
670 03A6 23 inx h
671 03A7 2229F0 shld user_PC
672 03AA C9 ret
673
674 ; disassemble opcode to mnemonic with command 'd'
675 ; entry: pointer
676 ; exit: pointer = next address
677
678 03AB 2A3BF0 d_disassemble: lhld pointer
679
680 03AE E5 push h
681
682 03AF 7C mov a,h
683 03B0 CDB212 call out2x
684 03B3 7D mov a,l

Page 9 of 63
A8085.LST 29/3/2558 15:27

685 03B4 CDB212 call out2x


686 03B7 CDCC12 call space
687
688 03BA 7E mov a,m ; get opcode
689 03BB CD2104 call get_number_of_byte
690 03BE 4F mov c,a
691
692 03BF 7E d_disassem3: mov a,m
693 03C0 CDB212 call out2x
694 03C3 23 inx h
695 03C4 0D dcr c
696 03C5 C2BF03 jnz d_disassem3
697
698 03C8 E1 pop h
699
700 03C9 7E mov a,m
701 03CA CD2104 call get_number_of_byte
702 03CD FE01 cpi 1
703 03CF C2D703 jnz d_one_tab
704
705 03D2 3E09 mvi a,tab ; print two tabs for one byte opcode
706 03D4 CD1612 call cout
707
708 03D7 3E09 d_one_tab: mvi a,tab ; else only one tab
709 03D9 CD1612 call cout
710
711 03DC E5 push h
712
713 03DD 7E mov a,m ; get opcode
714
715 03DE F5 push psw
716
717 03DF 210000 lxi h,0000h ; clear HL
718 03E2 6F mov l,a
719
720 03E3 29 dad h ; HL = HLx2
721
722 03E4 5D mov e,l
723 03E5 54 mov d,h
724
725 03E6 21F214 lxi h,ins_table
726 03E9 19 dad d ; ADD HL,DE
727 03EA 5E mov e,m
728 03EB 23 inx h
729 03EC 56 mov d,m
730
731 03ED 6B mov l,e
732 03EE 62 mov h,d
733
734 03EF CD3F12 call put_str
735
736 03F2 F1 pop psw
737 03F3 E1 pop h
738
739 03F4 CD2104 call get_number_of_byte
740 03F7 FE01 cpi 1
741 03F9 C20104 jnz d_disassem1
742 03FC 23 inx h
743 03FD 223BF0 shld pointer
744 0400 C9 ret
745
746 0401 FE02 d_disassem1: cpi 2
747 0403 C21004 jnz d_disassem2
748 0406 23 inx h
749 0407 7E mov a,m
750 0408 CDB212 call out2x
751 040B 23 inx h
752 040C 223BF0 shld pointer
753 040F C9 ret
754
755 0410 23 d_disassem2: inx h
756 0411 23 inx h
757 0412 7E mov a,m
758 0413 CDB212 call out2x
759 0416 2B dcx h
760 0417 7E mov a,m

Page 10 of 63
A8085.LST 29/3/2558 15:27

761 0418 CDB212 call out2x


762 041B 23 inx h
763 041C 23 inx h
764 041D 223BF0 shld pointer
765 0420 C9 ret
766
767
768 ; get number of byte
769 ; entry: A = OPCODE
770 ; exit: A = number of byte, 1,2,3
771 ; 0 = undefined opcode
772
773 0421 get_number_of_byte:
774
775 0421 FE01 cpi 01
776 0423 C22904 jnz number1
777 0426 3E03 mvi a,3
778 0428 C9 ret
779
780 0429 FE06 number1: cpi 6
781 042B C23104 jnz number2
782 042E 3E02 mvi a,2
783 0430 C9 ret
784
785 0431 FE0E number2: cpi 0eh
786 0433 C23904 jnz number3
787 0436 3E02 mvi a,2
788 0438 C9 ret
789
790 0439 FE11 number3: cpi 11h
791 043B C24104 jnz number4
792 043E 3E03 mvi a,3
793 0440 C9 ret
794
795 0441 FE16 number4: cpi 16h
796 0443 C24904 jnz number5
797 0446 3E02 mvi a,2
798 0448 C9 ret
799
800 0449 FE1E number5: cpi 1eh
801 044B C25104 jnz number6
802 044E 3E02 mvi a,2
803 0450 C9 ret
804
805 0451 FE21 number6: cpi 21h
806 0453 C25904 jnz number7
807 0456 3E03 mvi a,3
808 0458 C9 ret
809
810 0459 FE22 number7: cpi 22h
811 045B C26104 jnz number8
812 045E 3E03 mvi a,3
813 0460 C9 ret
814
815 0461 FE26 number8: cpi 26h
816 0463 C26904 jnz number9
817 0466 3E02 mvi a,2
818 0468 C9 ret
819
820 0469 FE2A number9: cpi 2ah
821 046B C27104 jnz number10
822 046E 3E03 mvi a,3
823 0470 C9 ret
824
825 0471 FE2E number10: cpi 2eh
826 0473 C27904 jnz number11
827 0476 3E02 mvi a,2
828 0478 C9 ret
829
830 0479 FE31 number11: cpi 31h
831 047B C28104 jnz number12
832 047E 3E03 mvi a,3
833 0480 C9 ret
834
835 0481 FE32 number12: cpi 32h
836 0483 C28904 jnz number13

Page 11 of 63
A8085.LST 29/3/2558 15:27

837 0486 3E03 mvi a,3


838 0488 C9 ret
839
840 0489 FE36 number13: cpi 36h
841 048B C29104 jnz number14
842 048E 3E03 mvi a,3
843 0490 C9 ret
844
845 0491 FE3A number14: cpi 3ah
846 0493 C29904 jnz number15
847 0496 3E03 mvi a,3
848 0498 C9 ret
849
850 0499 FE3E number15: cpi 3eh
851 049B C2A104 jnz number16
852 049E 3E02 mvi a,2
853 04A0 C9 ret
854
855 04A1 FEC2 number16: cpi 0c2h
856 04A3 C2A904 jnz number17
857 04A6 3E03 mvi a,3
858 04A8 C9 ret
859
860 04A9 FEC3 number17: cpi 0c3h
861 04AB C2B104 jnz number18
862 04AE 3E03 mvi a,3
863 04B0 C9 ret
864
865 04B1 FEC4 number18: cpi 0c4h
866 04B3 C2B904 jnz number19
867 04B6 3E03 mvi a,3
868 04B8 C9 ret
869
870 04B9 FEC6 number19: cpi 0c6h
871 04BB C2C104 jnz number20
872 04BE 3E02 mvi a,2
873 04C0 C9 ret
874
875 04C1 FECA number20: cpi 0cah
876 04C3 C2C904 jnz number21
877 04C6 3E03 mvi a,3
878 04C8 C9 ret
879
880 04C9 FECC number21: cpi 0cch
881 04CB C2D104 jnz number22
882 04CE 3E03 mvi a,3
883 04D0 C9 ret
884
885 04D1 FECD number22: cpi 0cdh
886 04D3 C2D904 jnz number23
887 04D6 3E03 mvi a,3
888 04D8 C9 ret
889
890 04D9 FECE number23: cpi 0ceh
891 04DB C2E104 jnz number24
892 04DE 3E02 mvi a,2
893 04E0 C9 ret
894
895 04E1 FED2 number24: cpi 0d2h
896 04E3 C2E904 jnz number25
897 04E6 3E03 mvi a,3
898 04E8 C9 ret
899
900 04E9 FED3 number25: cpi 0d3h
901 04EB C2F104 jnz number26
902 04EE 3E02 mvi a,2
903 04F0 C9 ret
904
905 04F1 FED4 number26: cpi 0d4h
906 04F3 C2F904 jnz number27
907 04F6 3E03 mvi a,3
908 04F8 C9 ret
909
910 04F9 FED6 number27: cpi 0d6h
911 04FB C20105 jnz number28
912 04FE 3E02 mvi a,2

Page 12 of 63
A8085.LST 29/3/2558 15:27

913 0500 C9 ret


914
915 0501 FEDA number28: cpi 0dah
916 0503 C20905 jnz number29
917 0506 3E03 mvi a,3
918 0508 C9 ret
919
920 0509 FEDB number29: cpi 0dbh
921 050B C21105 jnz number30
922 050E 3E02 mvi a,2
923 0510 C9 ret
924
925 0511 FEDC number30: cpi 0dch
926 0513 C21905 jnz number31
927 0516 3E03 mvi a,3
928 0518 C9 ret
929
930 0519 FEE2 number31: cpi 0e2h
931 051B C22105 jnz number32
932 051E 3E03 mvi a,3
933 0520 C9 ret
934
935 0521 FEE4 number32: cpi 0e4h
936 0523 C22905 jnz number33
937 0526 3E03 mvi a,3
938 0528 C9 ret
939
940 0529 FEE6 number33: cpi 0e6h
941 052B C23105 jnz number34
942 052E 3E02 mvi a,2
943 0530 C9 ret
944
945 0531 FEEA number34: cpi 0eah
946 0533 C23905 jnz number35
947 0536 3E03 mvi a,3
948 0538 C9 ret
949
950 0539 FEEC number35: cpi 0ech
951 053B C24105 jnz number36
952 053E 3E03 mvi a,3
953 0540 C9 ret
954
955 0541 FEEE number36: cpi 0eeh
956 0543 C24905 jnz number37
957 0546 3E02 mvi a,2
958 0548 C9 ret
959
960 0549 FEF2 number37: cpi 0f2h
961 054B C25105 jnz number38
962 054E 3E03 mvi a,3
963 0550 C9 ret
964
965 0551 FEF4 number38: cpi 0f4h
966 0553 C25905 jnz number39
967 0556 3E03 mvi a,3
968 0558 C9 ret
969
970 0559 FEF6 number39: cpi 0f6h
971 055B C26105 jnz number40
972 055E 3E02 mvi a,2
973 0560 C9 ret
974
975 0561 FEFA number40: cpi 0fah
976 0563 C26905 jnz number41
977 0566 3E03 mvi a,3
978 0568 C9 ret
979
980 0569 FEFC number41: cpi 0fch
981 056B C27105 jnz number42
982 056E 3E03 mvi a,3
983 0570 C9 ret
984
985 0571 FEFE number42: cpi 0feh
986 0573 C27905 jnz number43
987 0576 3E02 mvi a,2
988 0578 C9 ret

Page 13 of 63
A8085.LST 29/3/2558 15:27

989
990 0579 3E01 number43: mvi a,1
991 057B C9 ret
992
993
994
995
996
997
998
999
1000 ; execute key 0-F or 10H-19H
1001
1002 057C FE10 key_execute: cpi 10h
1003 057E D28805 jnc function_key ; 0-9 jump to data key
1004 0581 57 mov d,a
1005 0582 CD3706 call buzzer
1006 0585 F20406 jp data_key
1007
1008 0588 FE12 function_key: cpi 12h
1009 058A C29305 jnz function1
1010 058D CD3706 call buzzer
1011 0590 F24B0A jp increment
1012
1013 0593 FE15 function1: cpi 15h
1014 0595 C29E05 jnz function2
1015 0598 CD3706 call buzzer
1016 059B F25E0A jp decrement
1017
1018 059E FE10 function2: cpi 10h
1019 05A0 C2A905 jnz function3
1020 05A3 CD3706 call buzzer
1021 05A6 F2E709 jp address_mode
1022
1023 05A9 FE11 function3: cpi 11h
1024 05AB C2B405 jnz function4
1025 05AE CD3706 call buzzer
1026 05B1 F2F409 jp data_mode
1027
1028 05B4 FE13 function4: cpi 13h
1029 05B6 C2C005 jnz function5
1030 05B9 CD3706 call buzzer
1031 05BC F28109 jp go
1032 05BF C9 ret
1033
1034 05C0 FE14 function5: cpi 14h
1035 05C2 C2CB05 jnz function6
1036 05C5 CD3706 call buzzer
1037 05C8 F2FF09 jp function_2nd
1038
1039
1040 05CB FE16 function6: cpi 16h
1041 05CD C2D605 jnz function7
1042 05D0 CD3706 call buzzer
1043 05D3 F2A509 jp single_step
1044
1045 05D6 FE17 function7: cpi 17h
1046 05D8 C2E105 jnz function8
1047 05DB CD3706 call buzzer
1048 05DE F26709 jp home
1049
1050 05E1 FE18 function8: cpi 18h
1051 05E3 C2EC05 jnz function9
1052 05E6 CD3706 call buzzer
1053 05E9 F2230A jp modify_register
1054
1055 05EC C9 function9: ret
1056
1057 ; test running onboard led
1058
1059 05ED 3E01 test_led: mvi a,1
1060
1061 05EF D300 test_led1: out gpio
1062 05F1 115010 lxi d,1050h
1063 05F4 CDFB05 call delay
1064 05F7 07 rlc

Page 14 of 63
A8085.LST 29/3/2558 15:27

1065 05F8 C3EF05 jmp test_led1


1066
1067
1068 ; delay subroutine
1069 ; entry: D= outer loop E=inner loop (should be 0 for long delay)
1070 ; exit: none
1071
1072 05FB 1D delay: dcr e
1073 05FC C2FB05 jnz delay
1074 05FF 15 dcr d
1075 0600 C2FB05 jnz delay
1076 0603 C9 ret
1077
1078
1079 0604 3A25F0 data_key: lda entry_mode
1080 0607 FE00 cpi 0
1081 0609 C20F06 jnz data_key1
1082 060C F2C306 jp enter_data
1083
1084 060F FE01 data_key1: cpi 1
1085 0611 C21706 jnz data_key2
1086 0614 F2FD06 jp enter_address
1087
1088 0617 FE02 data_key2: cpi 2
1089 0619 C21F06 jnz data_key3
1090 061C F23707 jp select_register
1091
1092 061F FE03 data_key3: cpi 3
1093 0621 C22706 jnz data_key4
1094 0624 F26306 jp enter_register
1095
1096 0627 data_key4:
1097
1098 0627 C9 ret
1099
1100
1101 0628 3E7F test_buzzer: mvi a,7fh
1102 062A D312 out system_port_c
1103 062C 110010 lxi d,1000h
1104 062F CDFB05 call delay
1105 0632 3EFF mvi a,0ffh
1106 0634 D312 out system_port_c
1107 0636 C9 ret
1108
1109
1110 ; produce beep output at system port c.7
1111 ; click when key pressed
1112
1113 0637 0E01 buzzer: mvi c,1
1114
1115 0639 3E7F buzzer1: mvi a,7fh
1116 063B D312 out system_port_c ;nop ;out system_port_c
1117 063D CD4D06 call delay_us
1118 0640 3EFF mvi a,0ffh
1119 0642 D312 out system_port_c ;nop ;out system_port_c
1120
1121 0644 0D dcr c
1122 0645 C23906 jnz buzzer1
1123
1124 0648 3EFF mvi a,0ffh
1125 064A D312 out system_port_c
1126
1127 064C C9 ret
1128
1129 064D 06B0 delay_us: mvi b,0b0h
1130 064F 05 delay_us1: dcr b
1131 0650 C24F06 jnz delay_us1
1132 0653 C9 ret
1133
1134
1135 ;----- turn display off while key has been pressing ------------------
1136 ; useful for no function accepted
1137
1138 0654 21851D display_off: lxi h,off_display
1139 0657 CD940C off_display1: call scan
1140 065A 3A21F0 lda key

Page 15 of 63
A8085.LST 29/3/2558 15:27

1141 065D FEFF cpi 0ffh


1142 065F C25706 jnz off_display1 ; loop if key still pressed
1143 0662 C9 ret
1144
1145 ;************* modify current displayed register **********************
1146 ; entry: current user register displayed
1147 ;
1148
1149
1150 0663 enter_register:
1151
1152 0663 2A37F0 lhld current_register
1153
1154 0666 4E mov c,m
1155 0667 23 inx h
1156 0668 46 mov b,m
1157 0669 210000 lxi h,0
1158
1159 066C 09 dad b ; MOV HL,BC
1160
1161 066D 5A mov e,d ; save key code to E
1162
1163 066E shift_register:
1164 066E 7D mov a,l
1165 066F 07 rlc
1166 0670 6F mov l,a
1167 0671 7C mov a,h
1168 0672 17 ral
1169 0673 67 mov h,a
1170
1171 0674 7D mov a,l
1172 0675 07 rlc
1173 0676 6F mov l,a
1174 0677 7C mov a,h
1175 0678 17 ral
1176 0679 67 mov h,a
1177
1178 067A 7D mov a,l
1179 067B 07 rlc
1180 067C 6F mov l,a
1181 067D 7C mov a,h
1182 067E 17 ral
1183 067F 67 mov h,a
1184
1185 0680 7D mov a,l
1186 0681 07 rlc
1187 0682 6F mov l,a
1188 0683 7C mov a,h
1189 0684 17 ral
1190 0685 67 mov h,a
1191
1192 0686 7D mov a,l
1193
1194 0687 E6F0 ani 0f0h
1195 0689 82 add d
1196 068A 6F mov l,a
1197
1198 068B 44 mov b,h
1199 068C 4D mov c,l
1200
1201 068D 2A37F0 lhld current_register
1202 0690 71 mov m,c
1203 0691 23 inx h
1204 0692 70 mov m,b
1205
1206 0693 2A37F0 lhld current_register
1207
1208 0696 4E mov c,m
1209 0697 23 inx h
1210 0698 46 mov b,m
1211 0699 210000 lxi h,0
1212
1213 069C 09 dad b ; MOV HL,BC
1214
1215 069D CD790A call read_register
1216

Page 16 of 63
A8085.LST 29/3/2558 15:27

1217 06A0 F5 push psw


1218
1219 06A1 3A13F0 lda buffer+3
1220 06A4 F680 ori 80h
1221 06A6 3213F0 sta buffer+3
1222
1223 06A9 3A12F0 lda buffer+2
1224 06AC F680 ori 80h
1225 06AE 3212F0 sta buffer+2
1226
1227 06B1 3A11F0 lda buffer+1
1228 06B4 F680 ori 80h
1229 06B6 3211F0 sta buffer+1
1230
1231 06B9 3A10F0 lda buffer
1232 06BC F680 ori 80h
1233 06BE 3210F0 sta buffer
1234
1235
1236
1237
1238
1239 06C1 F1 pop psw
1240
1241 06C2 C9 ret
1242
1243 ; enter nibble into current location
1244
1245 06C3 2A29F0 enter_data: lhld user_PC
1246
1247 06C6 5A mov e,d ; save key code to E
1248
1249 06C7 3A26F0 lda counter1
1250 06CA FE00 cpi 0
1251 06CC C2D606 jnz shift_data
1252 06CF 3C inr a
1253 06D0 3226F0 sta counter1
1254 06D3 3E00 mvi a,0
1255 06D5 77 mov m,a
1256
1257 06D6 7E shift_data: mov a,m
1258
1259 06D7 07 rlc
1260 06D8 07 rlc
1261 06D9 07 rlc
1262 06DA 07 rlc
1263 06DB E6F0 ani 0f0h ; make low nibble to 0 before insert
1264 06DD 83 add e ; insert low nibble to A
1265 06DE 77 mov m,a
1266 06DF 57 mov d,a
1267 06E0 7E mov a,m ; check if the space is ram or rom
1268 06E1 BA cmp d
1269 06E2 CAF906 jz it_is_ram
1270
1271 ; if it was rom them turn of led while key has been pressed
1272
1273 06E5 21851D lxi h,off_display
1274 06E8 CD940C enter_data1: call scan
1275 06EB 3A21F0 lda key
1276 06EE FEFF cpi 0ffh
1277 06F0 C2E806 jnz enter_data1 ; loop if key still pressed
1278
1279 06F3 CD8D0C call debounce ; debounce after key was released
1280
1281 06F6 2110F0 lxi h,buffer ; back to show display again
1282
1283 06F9 it_is_ram:
1284 06F9 CDA40A call read_memory
1285 06FC C9 ret
1286
1287 ; enter nibble into current pointer
1288
1289 06FD 2A29F0 enter_address: lhld user_PC
1290 0700 5A mov e,d ; save key code to E
1291
1292 0701 3A27F0 lda counter2

Page 17 of 63
A8085.LST 29/3/2558 15:27

1293 0704 FE00 cpi 0


1294 0706 C21307 jnz shift_address
1295 0709 3C inr a
1296 070A 3227F0 sta counter2
1297 070D 210000 lxi h,0
1298 0710 2229F0 shld user_PC
1299
1300 0713 shift_address:
1301 0713 7D mov a,l
1302 0714 07 rlc
1303 0715 6F mov l,a
1304 0716 7C mov a,h
1305 0717 17 ral
1306 0718 67 mov h,a
1307
1308 0719 7D mov a,l
1309 071A 07 rlc
1310 071B 6F mov l,a
1311 071C 7C mov a,h
1312 071D 17 ral
1313 071E 67 mov h,a
1314
1315 071F 7D mov a,l
1316 0720 07 rlc
1317 0721 6F mov l,a
1318 0722 7C mov a,h
1319 0723 17 ral
1320 0724 67 mov h,a
1321
1322 0725 7D mov a,l
1323 0726 07 rlc
1324 0727 6F mov l,a
1325 0728 7C mov a,h
1326 0729 17 ral
1327 072A 67 mov h,a
1328
1329 072B 7D mov a,l
1330
1331 072C E6F0 ani 0f0h
1332 072E 82 add d
1333 072F 6F mov l,a
1334
1335 0730 2229F0 shld user_PC ; store new pointer
1336
1337 0733 CDA40A call read_memory
1338
1339 0736 C9 ret
1340
1341
1342 ;****************** ALT register display ******************************
1343
1344 0737 5A select_register: mov e,d ; save key for selecting user register
1345
1346 0738 7A mov a,d
1347 0739 FE00 cpi 0
1348 073B C25507 jnz register1
1349
1350 073E 3E77 mvi a,77h ; AF register pair
1351 0740 3214F0 sta buffer+4
1352 0743 3E71 mvi a,71h
1353 0745 3215F0 sta buffer+5
1354
1355 0748 212BF0 lxi h,user_AF
1356 074B 2237F0 shld current_register
1357
1358
1359 074E 2A2BF0 lhld user_AF
1360 0751 CD790A call read_register
1361 0754 C9 ret
1362
1363 0755 register1:
1364 0755 FE01 cpi 1
1365 0757 C27107 jnz register2
1366
1367 075A 3E7C mvi a,7ch ; BC register pair
1368 075C 3214F0 sta buffer+4

Page 18 of 63
A8085.LST 29/3/2558 15:27

1369 075F 3E39 mvi a,39h


1370 0761 3215F0 sta buffer+5
1371
1372 0764 212DF0 lxi h,user_BC
1373 0767 2237F0 shld current_register
1374
1375 076A 2A2DF0 lhld user_BC
1376 076D CD790A call read_register
1377
1378 0770 C9 ret
1379
1380 0771 register2:
1381 0771 FE02 cpi 2
1382 0773 C28D07 jnz register3
1383
1384 0776 3E5E mvi a,5eh ; DE register pair
1385 0778 3214F0 sta buffer+4
1386 077B 3E79 mvi a,79h
1387 077D 3215F0 sta buffer+5
1388
1389 0780 212FF0 lxi h,user_DE
1390 0783 2237F0 shld current_register
1391
1392 0786 2A2FF0 lhld user_DE
1393 0789 CD790A call read_register
1394
1395 078C C9 ret
1396
1397 078D register3:
1398 078D FE03 cpi 3
1399 078F C2A907 jnz register4
1400
1401 0792 3E76 mvi a,76h ; HL register pair
1402 0794 3214F0 sta buffer+4
1403 0797 3E38 mvi a,38h
1404 0799 3215F0 sta buffer+5
1405
1406 079C 2131F0 lxi h,user_HL
1407 079F 2237F0 shld current_register
1408
1409 07A2 2A31F0 lhld user_HL
1410 07A5 CD790A call read_register
1411
1412 07A8 C9 ret
1413 07A9 register4:
1414 07A9 FE04 cpi 4
1415 07AB C2C507 jnz register5
1416
1417 07AE 3E6D mvi a,6dh ; user SP
1418 07B0 3214F0 sta buffer+4
1419 07B3 3E73 mvi a,73h
1420 07B5 3215F0 sta buffer+5
1421
1422 07B8 2133F0 lxi h,user_SP
1423 07BB 2237F0 shld current_register
1424
1425 07BE 2A33F0 lhld user_SP
1426 07C1 CD790A call read_register
1427
1428 07C4 C9 ret
1429
1430 07C5 register5:
1431 07C5 FE05 cpi 5
1432 07C7 C2EC07 jnz register6
1433
1434 07CA 3E73 mvi a,73h ; user PC
1435 07CC 3214F0 sta buffer+4
1436 07CF 3E39 mvi a,39h
1437 07D1 3215F0 sta buffer+5
1438
1439 07D4 2129F0 lxi h,user_PC
1440 07D7 2237F0 shld current_register
1441
1442 07DA 2A29F0 lhld user_PC
1443 07DD CD790A call read_register
1444

Page 19 of 63
A8085.LST 29/3/2558 15:27

1445 07E0 C9 ret


1446
1447 ;---- display carry flag -------------------------------------------------
1448
1449 07E1 C2E907 put_flag: jnz put_high1
1450 07E4 3E3F mvi a,3fh
1451 07E6 C3EB07 jmp skip_put_high1
1452
1453 07E9 3E06 put_high1: mvi a,06h
1454
1455 07EB skip_put_high1:
1456 07EB C9 ret
1457
1458 07EC register6:
1459 07EC FE06 cpi 6
1460 07EE C21408 jnz register7
1461
1462 07F1 3E39 mvi a,39h ; carry flag
1463 07F3 3210F0 sta buffer
1464 07F6 3E6E mvi a,6eh
1465 07F8 3211F0 sta buffer+1
1466 07FB 3E48 mvi a,48h
1467 07FD 3212F0 sta buffer+2
1468
1469 0800 2A2BF0 lhld user_AF
1470 0803 7D mov a,l
1471
1472 0804 E601 ani 1
1473 0806 CDE107 call put_flag
1474 0809 3213F0 sta buffer+3
1475
1476 080C AF xra a
1477 080D 3214F0 sta buffer+4
1478 0810 3215F0 sta buffer+5
1479
1480 0813 C9 ret
1481
1482 0814 register7:
1483 0814 FE07 cpi 7
1484 0816 C23F08 jnz register8
1485
1486 0819 3E49 mvi a,49h ; zero flag
1487 081B 3210F0 sta buffer
1488 081E 3E79 mvi a,79h
1489 0820 3211F0 sta buffer+1
1490 0823 3E50 mvi a,50h
1491 0825 3212F0 sta buffer+2
1492 0828 3E5C mvi a,5ch
1493 082A 3213F0 sta buffer+3
1494 082D 3E48 mvi a,48h
1495 082F 3214F0 sta buffer+4
1496
1497
1498 0832 2A2BF0 lhld user_AF
1499 0835 7D mov a,l
1500
1501 0836 E640 ani 40h
1502 0838 CDE107 call put_flag
1503 083B 3215F0 sta buffer+5
1504
1505 083E C9 ret
1506
1507
1508 083F register8:
1509 083F FE08 cpi 8
1510 0841 C27008 jnz register9
1511
1512 0844 3E6D mvi a,6dh ; sign flag
1513 0846 3210F0 sta buffer
1514 0849 3E11 mvi a,11h
1515 084B 3211F0 sta buffer+1
1516 084E 3E6F mvi a,6fh
1517 0850 3212F0 sta buffer+2
1518 0853 3E54 mvi a,54h
1519 0855 3213F0 sta buffer+3
1520 0858 3E48 mvi a,48h

Page 20 of 63
A8085.LST 29/3/2558 15:27

1521 085A 3214F0 sta buffer+4


1522
1523
1524 085D 2A2BF0 lhld user_AF
1525 0860 7D mov a,l
1526
1527 0861 17 ral
1528 0862 DA6A08 jc put_high2
1529 0865 3E3F mvi a,3fh
1530 0867 C36C08 jmp skip_put_high2
1531
1532 086A 3E06 put_high2: mvi a,06h
1533 086C skip_put_high2:
1534 086C 3215F0 sta buffer+5
1535
1536 086F C9 ret
1537
1538
1539 0870 register9:
1540 0870 FE09 cpi 9
1541 0872 C29808 jnz register10
1542
1543 0875 3E77 mvi a,77h ; AC flag
1544 0877 3210F0 sta buffer
1545 087A 3E39 mvi a,39h
1546 087C 3211F0 sta buffer+1
1547 087F 3E48 mvi a,48h
1548 0881 3212F0 sta buffer+2
1549
1550 0884 2A2BF0 lhld user_AF
1551 0887 7D mov a,l
1552
1553 0888 E610 ani 10h
1554 088A CDE107 call put_flag
1555 088D 3213F0 sta buffer+3
1556 0890 AF xra a
1557 0891 3214F0 sta buffer+4
1558 0894 3215F0 sta buffer+5
1559
1560 0897 C9 ret
1561
1562 0898 register10:
1563 0898 FE0A cpi 10
1564 089A C2BE08 jnz break
1565
1566 089D 3E73 mvi a,73h ; Parity flag
1567 089F 3210F0 sta buffer
1568 08A2 3E48 mvi a,48h
1569 08A4 3211F0 sta buffer+1
1570
1571 08A7 2A2BF0 lhld user_AF
1572 08AA 7D mov a,l
1573
1574 08AB E604 ani 4
1575 08AD CDE107 call put_flag
1576 08B0 3212F0 sta buffer+2
1577 08B3 AF xra a
1578 08B4 3213F0 sta buffer+3
1579 08B7 3214F0 sta buffer+4
1580 08BA 3215F0 sta buffer+5
1581 08BD C9 ret
1582
1583
1584 ; ------------------ ALT B SET BREAK POINT ---------------------------
1585 08BE FE0B break: cpi 11
1586 08C0 C2F808 jnz clear_break
1587
1588 08C3 2A29F0 lhld user_PC ; save user PC
1589 08C6 223DF0 shld break_address
1590
1591 08C9 7E mov a,m ; get user code
1592 08CA 323FF0 sta break_opcode ; save it
1593
1594 08CD E5 push h
1595 08CE CDA40A call read_memory
1596 08D1 E1 pop h

Page 21 of 63
A8085.LST 29/3/2558 15:27

1597 08D2 3EFF mvi a,0FFh ; RST 7 opcode


1598 08D4 77 mov m,a ; replace user code with RST 7
1599
1600 08D5 F5 push psw
1601
1602 08D6 3A10F0 lda buffer
1603 08D9 F680 ori 80h
1604 08DB 3210F0 sta buffer
1605
1606 08DE 3A11F0 lda buffer+1
1607 08E1 F680 ori 80h
1608 08E3 3211F0 sta buffer+1
1609
1610 08E6 3A12F0 lda buffer+2
1611 08E9 F680 ori 80h
1612 08EB 3212F0 sta buffer+2
1613
1614 08EE 3A13F0 lda buffer+3
1615 08F1 F680 ori 80h
1616 08F3 3213F0 sta buffer+3
1617 08F6 F1 pop psw
1618
1619 08F7 C9 ret
1620
1621 ;----------------- ALT C CLEAR BREAK POINT ---------------------------
1622
1623 08F8 FE0C clear_break: cpi 12
1624 08FA C21309 jnz insert_byte
1625
1626 08FD 213FF0 lxi h,break_opcode ; restore user code
1627 0900 7E mov a,m
1628
1629 0901 2A3DF0 lhld break_address
1630 0904 77 mov m,a
1631 0905 2229F0 shld user_PC
1632 0908 CDA40A call read_memory
1633 090B AF xra a
1634 090C 3225F0 sta entry_mode
1635 090F CDE80A call mode_indicator
1636
1637 0912 C9 ret
1638
1639 ;--------------- ALT E insert byte ---------------------------------
1640 ; insert byte within 512 bytes from current location
1641
1642 0913 FE0E insert_byte: cpi 14 ; test with key E
1643 0915 C23E09 jnz delete_byte
1644
1645 0918 2A29F0 lhld user_PC
1646 091B E5 push h ; save PC to stack
1647
1648 091C 110002 lxi d,512
1649 091F 19 dad d
1650 0920 E5 push h
1651 0921 C1 pop b ; copy HL to BC
1652 0922 0B dcx b
1653
1654 0923 110002 lxi d,512 ; load counter with 512 bytes
1655
1656 0926 insert_byte1:
1657 0926 0A ldax b
1658 0927 77 mov m,a
1659 0928 2B dcx h
1660 0929 0B dcx b
1661 092A 1B dcx d
1662 092B 7B mov a,e
1663 092C B2 ora d ; check DE ==0
1664 092D C22609 jnz insert_byte1
1665
1666 0930 E1 pop h ; restore user PC
1667 0931 AF xra a
1668 0932 77 mov m,a ; store 00 at insert byte
1669 0933 CDA40A call read_memory
1670 0936 AF xra a
1671 0937 3225F0 sta entry_mode
1672 093A CDE80A call mode_indicator

Page 22 of 63
A8085.LST 29/3/2558 15:27

1673
1674 093D C9 ret
1675
1676
1677 ;--------------- ALT D delete byte ---------------------------------
1678 ; delete byte within 512 bytes
1679
1680 093E FE0D delete_byte: cpi 13
1681 0940 C26309 jnz option1
1682
1683 0943 2A29F0 lhld user_PC
1684 0946 E5 push h
1685 0947 E5 push h
1686 0948 C1 pop b
1687
1688 0949 03 inx b
1689 094A 110002 lxi d,512
1690
1691 094D delete_byte1:
1692 094D 0A ldax b
1693 094E 77 mov m,a
1694 094F 23 inx h
1695 0950 03 inx b
1696 0951 1B dcx d
1697 0952 7B mov a,e
1698 0953 B2 ora d ; check if DE ==0
1699 0954 C24D09 jnz delete_byte1
1700
1701 0957 E1 pop h
1702 0958 CDA40A call read_memory
1703 095B AF xra a
1704 095C 3225F0 sta entry_mode
1705 095F CDE80A call mode_indicator
1706
1707 0962 C9 ret
1708
1709
1710
1711
1712
1713
1714 0963 option1:
1715 0963 CD5406 call display_off ; no service key
1716 0966 C9 ret
1717
1718
1719
1720 0967 210081 home: lxi h,home_address
1721 096A 2229F0 shld user_PC
1722 096D 2110F0 lxi h,buffer
1723 0970 CDA40A call read_memory
1724 0973 AF xra a
1725 0974 3225F0 sta entry_mode
1726 0977 CDE80A call mode_indicator
1727 097A C9 ret
1728
1729
1730 097B 3E2A debug: mvi a,"*"
1731 097D CD1612 call cout
1732 0980 C9 ret
1733
1734 ; go function, jump from monitor program to user program
1735 ; save system stack and load user stack
1736 ; load CPU registers with user registers before jump
1737
1738 0981 go:
1739 0981 210000 lxi h,0
1740
1741 0984 39 dad sp ; save system stack
1742 0985 2256F0 shld save_stack
1743
1744 0988 2A33F0 lhld user_SP ; get user stack
1745 098B F9 sphl ; load user stack
1746
1747 098C 2A29F0 lhld user_PC
1748 098F E5 push h

Page 23 of 63
A8085.LST 29/3/2558 15:27

1749 0990 2A2BF0 lhld user_AF


1750 0993 E5 push h
1751 0994 2A2DF0 lhld user_BC
1752 0997 E5 push h
1753 0998 2A2FF0 lhld user_DE
1754 099B E5 push h
1755 099C 2A31F0 lhld user_HL
1756 099F E5 push h
1757
1758 09A0 E1 pop h
1759 09A1 D1 pop d
1760 09A2 C1 pop b
1761 09A3 F1 pop psw
1762
1763 09A4 C9 ret ; jump to user program
1764
1765
1766 ; single step
1767 ; load CPU registers with user registers, enable trap signal then jump to user
1768 ; program
1769 ; disassemble line to be executed
1770
1771 09A5 single_step:
1772 09A5 210000 lxi h,0
1773
1774 09A8 39 dad sp ; save system stack
1775 09A9 2256F0 shld save_stack
1776
1777 09AC 2A33F0 lhld user_SP
1778 09AF F9 sphl ; load user stack
1779
1780
1781 09B0 2A29F0 lhld user_PC ; get address to be executed
1782 09B3 E5 push h ; save to stack
1783
1784 09B4 3A24F0 lda uart_found
1785 09B7 FE00 cpi 0
1786 09B9 CAC509 jz skip2 ; if no uart, skip disassemble
1787
1788 09BC CDC112 call new_line
1789 09BF CDD212 call send_tab
1790 09C2 CD3503 call disassemble
1791
1792 09C5 skip2:
1793
1794 09C5 E1 pop h
1795 09C6 2229F0 shld user_PC
1796
1797 09C9 2A29F0 lhld user_PC
1798 09CC E5 push h
1799 09CD 2A2BF0 lhld user_AF
1800 09D0 E5 push h
1801 09D1 2A2DF0 lhld user_BC
1802 09D4 E5 push h
1803 09D5 2A2FF0 lhld user_DE
1804 09D8 E5 push h
1805 09D9 2A31F0 lhld user_HL
1806 09DC E5 push h
1807
1808 09DD E1 pop h
1809 09DE D1 pop d
1810 09DF C1 pop b
1811
1812 09E0 3EBF mvi a,0bfh ; make port_c.6 low to enable trap
1813 09E2 D312 out system_port_c ;
1814
1815 ; now the shift register 74LS164 is running
1816 ; within 8 ALE, trap will be high, trap will be recorgnized after instruction
1817 ; followed RET was executed
1818
1819 09E4 00 nop ; 1 cycles
1820 09E5 F1 pop psw ; 5 cycles
1821 09E6 C9 ret ; 3 cycles
1822
1823
1824 ; set mode to 1

Page 24 of 63
A8085.LST 29/3/2558 15:27

1825
1826 09E7 3E01 address_mode: mvi a,1
1827 09E9 3225F0 sta entry_mode
1828 09EC CDA40A call read_memory
1829 09EF AF xra a
1830 09F0 3227F0 sta counter2
1831 09F3 C9 ret
1832
1833 09F4 AF data_mode: xra a
1834 09F5 3225F0 sta entry_mode
1835 09F8 3226F0 sta counter1
1836 09FB CDA40A call read_memory
1837 09FE C9 ret
1838
1839 09FF 3E02 function_2nd: mvi a,2
1840 0A01 3225F0 sta entry_mode
1841 0A04 3E77 mvi a,77h
1842 0A06 3210F0 sta buffer
1843 0A09 3E38 mvi a,38h
1844 0A0B 3211F0 sta buffer+1
1845 0A0E 3E78 mvi a,78h
1846 0A10 3212F0 sta buffer+2
1847 0A13 3E00 mvi a,0
1848 0A15 3213F0 sta buffer+3
1849 0A18 3E00 mvi a,0
1850 0A1A 3214F0 sta buffer+4
1851 0A1D 3E00 mvi a,0
1852 0A1F 3215F0 sta buffer+5
1853 0A22 C9 ret
1854
1855
1856 ; set entry mode to 3
1857 ; hex data will be used for register modifying
1858
1859 0A23 modify_register:
1860
1861 0A23 F5 push psw
1862
1863 0A24 3E03 mvi a,3
1864 0A26 3225F0 sta entry_mode
1865
1866 0A29 3A13F0 lda buffer+3
1867 0A2C F680 ori 80h
1868 0A2E 3213F0 sta buffer+3
1869
1870 0A31 3A12F0 lda buffer+2
1871 0A34 F680 ori 80h
1872 0A36 3212F0 sta buffer+2
1873
1874 0A39 3A11F0 lda buffer+1
1875 0A3C F680 ori 80h
1876 0A3E 3211F0 sta buffer+1
1877
1878 0A41 3A10F0 lda buffer
1879 0A44 F680 ori 80h
1880 0A46 3210F0 sta buffer
1881
1882 0A49 F1 pop psw
1883
1884 0A4A C9 ret
1885
1886
1887
1888
1889
1890
1891
1892
1893 ; increment key works with mode0 or mode1 display
1894
1895 0A4B 3E00 increment: mvi a,0
1896 0A4D 3225F0 sta entry_mode ; switch to data mode
1897 0A50 3226F0 sta counter1 ; clear event counter1
1898
1899 0A53 2A29F0 lhld user_PC
1900 0A56 23 inx h

Page 25 of 63
A8085.LST 29/3/2558 15:27

1901 0A57 2229F0 shld user_PC


1902 0A5A CDA40A call read_memory
1903 0A5D C9 ret
1904
1905 ; decrement key works with mode0 or mode1 display
1906
1907 0A5E 3E00 decrement: mvi a,0
1908 0A60 3225F0 sta entry_mode ; switch to data mode
1909 0A63 2A29F0 lhld user_PC
1910 0A66 2B dcx h
1911 0A67 2229F0 shld user_PC
1912 0A6A CDA40A call read_memory
1913 0A6D C9 ret
1914
1915
1916 ; convert nibble 0-F to 8-bit seven segment code
1917 ; entry: A
1918 ; exit: A
1919
1920 0A6E to_seven_segment:
1921
1922 0A6E E60F ani 0fh ; get only low nibble as the index
1923 0A70 21751D lxi h,convert
1924 0A73 5F mov e,a
1925 0A74 1600 mvi d,0
1926 0A76 19 dad d
1927 0A77 7E mov a,m ; get code
1928 0A78 C9 ret
1929
1930 ; convert [HL] to display buffer 0-3
1931 ; for register display
1932 ; entry: HL
1933
1934 0A79 read_register:
1935 0A79 E5 push h
1936 0A7A 7C mov a,h
1937 0A7B F5 push psw
1938 0A7C 0F rrc
1939 0A7D 0F rrc
1940 0A7E 0F rrc
1941 0A7F 0F rrc
1942 0A80 CD6E0A call to_seven_segment
1943 0A83 3210F0 sta buffer
1944
1945 0A86 F1 pop psw
1946 0A87 CD6E0A call to_seven_segment
1947 0A8A 3211F0 sta buffer+1
1948
1949 0A8D E1 pop h
1950
1951 0A8E E5 push h
1952
1953 0A8F 7D mov a,l
1954 0A90 F5 push psw
1955 0A91 0F rrc
1956 0A92 0F rrc
1957 0A93 0F rrc
1958 0A94 0F rrc
1959 0A95 CD6E0A call to_seven_segment
1960 0A98 3212F0 sta buffer+2
1961 0A9B F1 pop psw
1962 0A9C CD6E0A call to_seven_segment
1963 0A9F 3213F0 sta buffer+3
1964
1965 0AA2 E1 pop h
1966 0AA3 C9 ret
1967
1968
1969
1970 ; convert current address and data to display buffer
1971 ;
1972
1973 0AA4 2A29F0 read_memory: lhld user_PC
1974 0AA7 E5 push h
1975 0AA8 7C mov a,h
1976 0AA9 F5 push psw

Page 26 of 63
A8085.LST 29/3/2558 15:27

1977 0AAA 0F rrc


1978 0AAB 0F rrc
1979 0AAC 0F rrc
1980 0AAD 0F rrc
1981 0AAE CD6E0A call to_seven_segment
1982 0AB1 3210F0 sta buffer
1983
1984 0AB4 F1 pop psw
1985 0AB5 CD6E0A call to_seven_segment
1986 0AB8 3211F0 sta buffer+1
1987
1988 0ABB E1 pop h
1989
1990 0ABC E5 push h
1991
1992 0ABD 7D mov a,l
1993 0ABE F5 push psw
1994 0ABF 0F rrc
1995 0AC0 0F rrc
1996 0AC1 0F rrc
1997 0AC2 0F rrc
1998 0AC3 CD6E0A call to_seven_segment
1999 0AC6 3212F0 sta buffer+2
2000 0AC9 F1 pop psw
2001 0ACA CD6E0A call to_seven_segment
2002 0ACD 3213F0 sta buffer+3
2003
2004 0AD0 E1 pop h
2005 0AD1 7E mov a,m ; read from memory
2006
2007 0AD2 F5 push psw
2008 0AD3 0F rrc
2009 0AD4 0F rrc
2010 0AD5 0F rrc
2011 0AD6 0F rrc
2012 0AD7 CD6E0A call to_seven_segment
2013 0ADA 3214F0 sta buffer+4
2014 0ADD F1 pop psw
2015
2016
2017 0ADE CD6E0A call to_seven_segment
2018 0AE1 3215F0 sta buffer+5
2019
2020 0AE4 CDE80A call mode_indicator
2021
2022 0AE7 C9 ret
2023
2024 0AE8 mode_indicator:
2025
2026 0AE8 F5 push psw
2027
2028 0AE9 3A25F0 lda entry_mode
2029 0AEC FE00 cpi 0
2030 0AEE C2230B jnz mode1
2031
2032 0AF1 3A15F0 lda buffer+5 ; mode 0 indicator
2033 0AF4 F680 ori 80h
2034 0AF6 3215F0 sta buffer+5
2035
2036 0AF9 3A14F0 lda buffer+4
2037 0AFC F680 ori 80h
2038 0AFE 3214F0 sta buffer+4
2039
2040
2041 0B01 3A13F0 lda buffer+3
2042 0B04 E67F ani 7fh
2043 0B06 3213F0 sta buffer+3
2044
2045 0B09 3A12F0 lda buffer+2
2046 0B0C E67F ani 7fh
2047 0B0E 3212F0 sta buffer+2
2048
2049 0B11 3A11F0 lda buffer+1
2050 0B14 E67F ani 7fh
2051 0B16 3211F0 sta buffer+1
2052

Page 27 of 63
A8085.LST 29/3/2558 15:27

2053 0B19 3A10F0 lda buffer


2054 0B1C E67F ani 7fh
2055 0B1E 3210F0 sta buffer
2056
2057
2058
2059
2060
2061 0B21 F1 pop psw
2062 0B22 C9 ret
2063
2064 0B23 FE01 mode1: cpi 1
2065 0B25 C25A0B jnz mode2
2066
2067 0B28 3A15F0 lda buffer+5 ; mode 1 indicator
2068 0B2B E67F ani 7fh
2069 0B2D 3215F0 sta buffer+5
2070
2071 0B30 3A14F0 lda buffer+4
2072 0B33 E67F ani 7fh
2073 0B35 3214F0 sta buffer+4
2074
2075 0B38 3A13F0 lda buffer+3
2076 0B3B F680 ori 80h
2077 0B3D 3213F0 sta buffer+3
2078
2079 0B40 3A12F0 lda buffer+2
2080 0B43 F680 ori 80h
2081 0B45 3212F0 sta buffer+2
2082
2083 0B48 3A11F0 lda buffer+1
2084 0B4B F680 ori 80h
2085 0B4D 3211F0 sta buffer+1
2086
2087 0B50 3A10F0 lda buffer
2088 0B53 F680 ori 80h
2089 0B55 3210F0 sta buffer
2090
2091
2092
2093
2094 0B58 F1 pop psw
2095 0B59 C9 ret
2096
2097 0B5A F1 mode2: pop psw
2098 0B5B C9 ret
2099
2100 0B5C 0E07 cold_boot: mvi c,7
2101 0B5E 217A0B lxi h,title
2102
2103
2104 0B61 1605 cold2: mvi d,5
2105
2106 0B63 CD940C cold1: call scan
2107 0B66 15 dcr d
2108 0B67 C2630B jnz cold1
2109
2110 0B6A 23 inx h
2111 0B6B 0D dcr c
2112 0B6C C2610B jnz cold2
2113
2114 0B6F 2B dcx h
2115 0B70 0E50 mvi c,80
2116 0B72 CD940C cold3: call scan
2117 0B75 0D dcr c
2118 0B76 C2720B jnz cold3
2119
2120 0B79 C9 ret
2121
2122 0B7A 0000000000title: dfb 0,0,0,0,0,0,7fh,3fh,7fh,6dh,0,0
2123
2124
2125 ; display data read from memory pointed to by HL on LED
2126 ; entry: HL
2127 ;
2128

Page 28 of 63
A8085.LST 29/3/2558 15:27

2129 0B86 1605 demo: mvi d,5


2130
2131 0B88 CD940C demo1_2: call scan
2132 0B8B 15 dcr d
2133 0B8C C2880B jnz demo1_2
2134 0B8F 23 inx h
2135 0B90 C9 ret
2136
2137
2138 ; convert position key to internal key code 0-F for data entry and 10-19H for
2139 ; function keys
2140 ; entry: A = scan code
2141 ; exit: A = internal code
2142
2143 0B91 FE02 get_key_code: cpi 2
2144 0B93 C2990B jnz code1
2145 0B96 3E00 mvi a,0
2146 0B98 C9 ret
2147
2148 0B99 FE0A code1: cpi 0ah
2149 0B9B C2A10B jnz code2
2150 0B9E 3E01 mvi a,1
2151 0BA0 C9 ret
2152
2153 0BA1 FE12 code2: cpi 12h
2154 0BA3 C2A90B jnz code3
2155 0BA6 3E02 mvi a,2
2156 0BA8 C9 ret
2157
2158 0BA9 FE1A code3: cpi 1ah
2159 0BAB C2B10B jnz code4
2160 0BAE 3E03 mvi a,3
2161 0BB0 C9 ret
2162
2163 0BB1 FE03 code4: cpi 3
2164 0BB3 C2B90B jnz code5
2165 0BB6 3E04 mvi a,4
2166 0BB8 C9 ret
2167
2168 0BB9 FE0B code5: cpi 0bh
2169 0BBB C2C10B jnz code6
2170 0BBE 3E05 mvi a,5
2171 0BC0 C9 ret
2172
2173 0BC1 FE13 code6: cpi 13h
2174 0BC3 C2C90B jnz code7
2175 0BC6 3E06 mvi a,6
2176 0BC8 C9 ret
2177
2178 0BC9 FE1B code7: cpi 1bh
2179 0BCB C2D10B jnz code8
2180 0BCE 3E07 mvi a,7
2181 0BD0 C9 ret
2182
2183 0BD1 FE04 code8: cpi 4
2184 0BD3 C2D90B jnz code9
2185 0BD6 3E08 mvi a,8
2186 0BD8 C9 ret
2187
2188 0BD9 FE0C code9: cpi 0ch
2189 0BDB C2E10B jnz code10
2190 0BDE 3E09 mvi a,9
2191 0BE0 C9 ret
2192
2193 0BE1 FE14 code10: cpi 14h
2194 0BE3 C2E90B jnz code11
2195 0BE6 3E0A mvi a,0ah
2196 0BE8 C9 ret
2197
2198 0BE9 FE1C code11: cpi 1ch
2199 0BEB C2F10B jnz code12
2200 0BEE 3E0B mvi a,0bh
2201 0BF0 C9 ret
2202
2203 0BF1 FE05 code12: cpi 5
2204 0BF3 C2F90B jnz code13

Page 29 of 63
A8085.LST 29/3/2558 15:27

2205 0BF6 3E0C mvi a,0ch


2206 0BF8 C9 ret
2207
2208 0BF9 FE0D code13: cpi 0dh
2209 0BFB C2010C jnz code14
2210 0BFE 3E0D mvi a,0dh
2211 0C00 C9 ret
2212
2213 0C01 FE15 code14: cpi 15h
2214 0C03 C2090C jnz code15
2215 0C06 3E0E mvi a,0eh
2216 0C08 C9 ret
2217
2218 0C09 FE1D code15: cpi 1dh
2219 0C0B C2110C jnz code16
2220 0C0E 3E0F mvi a,0fh
2221 0C10 C9 ret
2222
2223 0C11 FE10 code16: cpi 10h
2224 0C13 C2190C jnz code17
2225 0C16 3E10 mvi a,10h
2226 0C18 C9 ret
2227
2228 0C19 FE18 code17: cpi 18h
2229 0C1B C2210C jnz code18
2230 0C1E 3E11 mvi a,11h
2231 0C20 C9 ret
2232
2233 0C21 FE01 code18: cpi 1
2234 0C23 C2290C jnz code19
2235 0C26 3E12 mvi a,12h
2236 0C28 C9 ret
2237
2238 0C29 FE00 code19: cpi 0
2239 0C2B C2310C jnz code20
2240 0C2E 3E13 mvi a,13h
2241 0C30 C9 ret
2242
2243 0C31 FE08 code20: cpi 8
2244 0C33 C2390C jnz code21
2245 0C36 3E14 mvi a,14h
2246 0C38 C9 ret
2247
2248 0C39 FE09 code21: cpi 9
2249 0C3B C2410C jnz code22
2250 0C3E 3E15 mvi a,15h
2251 0C40 C9 ret
2252
2253 0C41 FE11 code22: cpi 11h
2254 0C43 C2490C jnz code23
2255 0C46 3E16 mvi a,16h
2256 0C48 C9 ret
2257
2258 0C49 FE19 code23: cpi 19h
2259 0C4B C2510C jnz code24
2260 0C4E 3E17 mvi a,17h
2261 0C50 C9 ret
2262
2263 0C51 FE2E code24: cpi 2eh
2264 0C53 C2590C jnz code25
2265 0C56 3E18 mvi a,18h
2266 0C58 C9 ret
2267
2268 0C59 FE2F code25: cpi 2fh
2269 0C5B C2610C jnz code26
2270 0C5E 3E19 mvi a,19h
2271 0C60 C9 ret
2272
2273 0C61 3EFF code26: mvi a,0ffh
2274 0C63 C9 ret
2275
2276 ; scan display and keyboard unitl key was pressed
2277
2278 0C64 scan_key: ; mvi d,25 ; number of loop for timeout if key still pressed
2279
2280 0C64 scan_key4: ;push d ; save d

Page 30 of 63
A8085.LST 29/3/2558 15:27

2281
2282 0C64 2110F0 lxi h,buffer
2283 0C67 CD940C call scan
2284 0C6A 3A21F0 lda key
2285 0C6D FEFF cpi 0ffh
2286 0C6F C2640C jnz scan_key4 ; loop if key still pressed
2287 ;pop d
2288 0C72 F2750C jp scan_key3
2289
2290 0C75 scan_key2: ;pop d
2291
2292 ;dcr d
2293
2294 ;jp scan_key4 ; no repeat function
2295
2296 ; repeat if still pressed when timeout
2297
2298
2299 0C75 CD8D0C scan_key3: call debounce ; debounce after released
2300
2301 0C78 2110F0 lxi h,buffer
2302 0C7B CD940C scan_key1: call scan
2303 0C7E 3A21F0 lda key
2304 0C81 FEFF cpi 0ffh
2305 0C83 CA7B0C jz scan_key1 ; loop until key will be pressed
2306
2307 0C86 CD8D0C call debounce
2308
2309
2310 0C89 CD910B call get_key_code
2311
2312 ; call out2x
2313 0C8C C9 ret
2314
2315
2316 0C8D 060A debounce: mvi b,10
2317 0C8F 05 debounce1: dcr b
2318 0C90 C28F0C jnz debounce1
2319 0C93 C9 ret
2320
2321
2322 ; subroutine scan keyboard and display
2323 ; input: hl pointer to buffer
2324 ; exit: key = scan code
2325 ; -1 no key pressed
2326 ;
2327
2328 0C94 E5 scan: push h
2329 0C95 C5 push b
2330 0C96 D5 push d
2331
2332 0C97 0E06 mvi c,6 ; for 6-digit LED
2333 0C99 1E00 mvi e,0 ; digit scan code appears at 4-to-10 decoder
2334 0C9B 1600 mvi d,0 ; key position
2335 0C9D 3EFF mvi a,0ffh ; put -1 to key
2336 0C9F 3221F0 sta key ; key = -1
2337
2338
2339 0CA2 7B scan1: mov a,e
2340 0CA3 F6F0 ori 0f0h ; high nibble must be 1111
2341 0CA5 D312 out system_port_c ; active digit first
2342 0CA7 7E mov a,m ; load a with [hl]
2343 0CA8 D311 out system_port_b ; then turn segment on
2344
2345 0CAA 0600 mvi b,0 ; delay for transition process
2346 0CAC 05 wait1: dcr b
2347 0CAD C2AC0C jnz wait1
2348
2349 0CB0 DB10 in system_port_a ; read input port
2350
2351 0CB2 0608 mvi b,8 ; check all 8-row
2352 0CB4 1F shift_key: rar ; rotate right through carry
2353 0CB5 DABE0C jc next_key ; if carry = 1 then no key pressed
2354
2355 0CB8 F5 push psw
2356 0CB9 7A mov a,d

Page 31 of 63
A8085.LST 29/3/2558 15:27

2357 0CBA 3221F0 sta key ; save key position


2358 0CBD F1 pop psw
2359
2360 0CBE next_key:
2361 0CBE 14 inr d ; next key position
2362
2363 0CBF 05 dcr b ; until 8-bit was shifted
2364 0CC0 C2B40C jnz shift_key
2365
2366 0CC3 3E00 mvi a,0 ; clear a
2367 0CC5 D311 out system_port_b ; turn off led
2368
2369 0CC7 1C inr e ; next digit scan code
2370 0CC8 23 inx h ; next location
2371
2372 0CC9 0D dcr c ; next column
2373 0CCA C2A20C jnz scan1
2374
2375 0CCD CDD40C call serial_command
2376
2377 0CD0 D1 pop d
2378 0CD1 C1 pop b
2379 0CD2 E1 pop h
2380 0CD3 C9 ret
2381
2382
2383
2384 ;----------- serial commands with 9600 8n1 terminal --------------------
2385 ; check if serial buffer has command
2386 ;
2387
2388 0CD4 serial_command:
2389 0CD4 3A24F0 lda uart_found
2390 0CD7 FE00 cpi 0
2391 0CD9 CA180D jz skip_serial
2392
2393 0CDC CD2C12 call get_command
2394 0CDF CD370D call download
2395 0CE2 CD190D call prompting
2396 0CE5 CDD812 call hex_dump
2397 0CE8 CDD511 call help
2398 0CEB CDAE11 call quick_home
2399 0CEE CDC311 call io_address
2400 0CF1 CD9111 call new_location
2401 0CF4 CD0E11 call edit_location
2402 0CF7 CDC410 call jump_to_user_pgm
2403 0CFA CDAB10 call monitor_function
2404 0CFD CD590D call ascii_print
2405 0D00 CD6710 call fill_memory
2406 0D03 CD330F call register_display
2407 0D06 CDF30E call stack_display
2408 0D09 CD0E03 call disassemble1
2409 0D0C CDE70E call single_step_
2410 0D0F CDD80E call print_watch
2411 0D12 CDBD0E call clear_watch
2412 0D15 CD8B0D call set_user_register
2413
2414
2415
2416 0D18 skip_serial:
2417
2418 0D18 C9 ret
2419
2420 0D19 3A22F0 prompting: lda command
2421 0D1C FE0D cpi cr
2422 0D1E C2360D jnz exit_prompting
2423
2424 0D21 send_prompt:
2425
2426 0D21 CDC112 call new_line
2427 0D24 2A3BF0 lhld pointer ; user_PC
2428 0D27 7C mov a,h
2429 0D28 CDB212 call out2x
2430 0D2B 7D mov a,l
2431 0D2C CDB212 call out2x
2432 0D2F 21CB1D lxi h,prompt_text

Page 32 of 63
A8085.LST 29/3/2558 15:27

2433 0D32 CD3F12 call put_str


2434 0D35 C9 ret
2435
2436 0D36 C9 exit_prompting: ret
2437
2438
2439
2440 ; command execute
2441 ; get command from serial port
2442
2443 0D37 3A22F0 download: lda command
2444 0D3A FE6C cpi "l"
2445 0D3C C2580D jnz exit_download
2446
2447 0D3F CDBC14 call clear_bcd1 ; reset bcd counter1
2448 0D42 3E01 mvi a,1
2449 0D44 3239F0 sta temp
2450
2451 0D47 AF xra a
2452 0D48 3220F0 sta bcs ; clear byte chekc sum error
2453
2454 0D4B 21B41D lxi h,download_text
2455 0D4E CD3F12 call put_str
2456 0D51 CDEA13 call get_record
2457 0D54 CD210D call send_prompt
2458 0D57 C9 ret
2459
2460 0D58 C9 exit_download ret
2461
2462 ; display printable ASCII code, 20H-7FH
2463
2464 0D59 3A22F0 ascii_print: lda command
2465 0D5C FE61 cpi "a"
2466 0D5E C28A0D jnz exit_ascii_print
2467
2468
2469 0D61 21451E lxi h, ascii_text
2470 0D64 CD3F12 call put_str
2471
2472 0D67 CDC112 call new_line
2473 0D6A CDC112 call new_line
2474
2475 0D6D 2E20 mvi l,20h
2476 0D6F 0E60 mvi c,96
2477
2478 0D71 ascii_print1:
2479
2480 0D71 7D mov a,l
2481 0D72 CD1612 call cout
2482
2483 0D75 3E3D mvi a,"="
2484 0D77 CD1612 call cout
2485 0D7A 7D mov a,l
2486 0D7B CDB212 call out2x
2487 0D7E CDCC12 call space
2488 0D81 2C inr l
2489 0D82 0D dcr c
2490 0D83 C2710D jnz ascii_print1
2491
2492 0D86 CD210D call send_prompt
2493 0D89 C9 ret
2494
2495 0D8A exit_ascii_print:
2496
2497 0D8A C9 ret
2498
2499 ;------------------- set value to user registers ---------------------
2500 ; set value to user register AF, BC, DE, HL, SP, PC
2501
2502 0D8B set_user_register:
2503
2504 0D8B 3A22F0 lda command
2505 0D8E FE73 cpi "s"
2506 0D90 C29F0E jnz exit_set_user
2507
2508 0D93 21F31E lxi h, set_register_text

Page 33 of 63
A8085.LST 29/3/2558 15:27

2509 0D96 CD3F12 call put_str


2510
2511 0D99 CD2212 call cin
2512 0D9C FE61 cpi "a"
2513 0D9E C2C70D jnz set_user1
2514
2515 0DA1 CDC112 call new_line
2516 0DA4 21971E lxi h,af_text
2517 0DA7 CD3F12 call put_str
2518 0DAA 2A2BF0 lhld user_AF
2519 0DAD 7C mov a,h
2520 0DAE CDB212 call out2x
2521 0DB1 7D mov a,l
2522 0DB2 CDB212 call out2x
2523 0DB5 CDD212 call send_tab
2524 0DB8 CD8513 call get_hex2
2525 0DBB 67 mov h,a
2526 0DBC CD8513 call get_hex2
2527 0DBF 6F mov l,a
2528 0DC0 222BF0 shld user_AF
2529
2530 0DC3 CD210D call send_prompt
2531 0DC6 C9 ret
2532
2533 0DC7 set_user1:
2534 0DC7 FE62 cpi "b"
2535 0DC9 C2F20D jnz set_user2
2536
2537 0DCC CDC112 call new_line
2538 0DCF 219B1E lxi h,bc_text
2539 0DD2 CD3F12 call put_str
2540 0DD5 2A2DF0 lhld user_BC
2541 0DD8 7C mov a,h
2542 0DD9 CDB212 call out2x
2543 0DDC 7D mov a,l
2544 0DDD CDB212 call out2x
2545 0DE0 CDD212 call send_tab
2546 0DE3 CD8513 call get_hex2
2547 0DE6 67 mov h,a
2548 0DE7 CD8513 call get_hex2
2549 0DEA 6F mov l,a
2550 0DEB 222DF0 shld user_BC
2551
2552 0DEE CD210D call send_prompt
2553 0DF1 C9 ret
2554
2555 0DF2 set_user2:
2556 0DF2 FE64 cpi "d"
2557 0DF4 C21D0E jnz set_user3
2558
2559 0DF7 CDC112 call new_line
2560 0DFA 219F1E lxi h,de_text
2561 0DFD CD3F12 call put_str
2562 0E00 2A2FF0 lhld user_DE
2563 0E03 7C mov a,h
2564 0E04 CDB212 call out2x
2565 0E07 7D mov a,l
2566 0E08 CDB212 call out2x
2567 0E0B CDD212 call send_tab
2568 0E0E CD8513 call get_hex2
2569 0E11 67 mov h,a
2570 0E12 CD8513 call get_hex2
2571 0E15 6F mov l,a
2572 0E16 222FF0 shld user_DE
2573
2574 0E19 CD210D call send_prompt
2575 0E1C C9 ret
2576
2577 0E1D set_user3:
2578 0E1D FE68 cpi "h"
2579 0E1F C2480E jnz set_user4
2580
2581 0E22 CDC112 call new_line
2582 0E25 21A31E lxi h,hl_text
2583 0E28 CD3F12 call put_str
2584 0E2B 2A31F0 lhld user_HL

Page 34 of 63
A8085.LST 29/3/2558 15:27

2585 0E2E 7C mov a,h


2586 0E2F CDB212 call out2x
2587 0E32 7D mov a,l
2588 0E33 CDB212 call out2x
2589 0E36 CDD212 call send_tab
2590 0E39 CD8513 call get_hex2
2591 0E3C 67 mov h,a
2592 0E3D CD8513 call get_hex2
2593 0E40 6F mov l,a
2594 0E41 2231F0 shld user_HL
2595
2596 0E44 CD210D call send_prompt
2597 0E47 C9 ret
2598
2599 0E48 set_user4:
2600 0E48 FE73 cpi "s"
2601 0E4A C2730E jnz set_user5
2602
2603 0E4D CDC112 call new_line
2604 0E50 21A71E lxi h,sp_text
2605 0E53 CD3F12 call put_str
2606 0E56 2A33F0 lhld user_SP
2607 0E59 7C mov a,h
2608 0E5A CDB212 call out2x
2609 0E5D 7D mov a,l
2610 0E5E CDB212 call out2x
2611 0E61 CDD212 call send_tab
2612 0E64 CD8513 call get_hex2
2613 0E67 67 mov h,a
2614 0E68 CD8513 call get_hex2
2615 0E6B 6F mov l,a
2616 0E6C 2233F0 shld user_SP
2617
2618 0E6F CD210D call send_prompt
2619 0E72 C9 ret
2620
2621 0E73 set_user5:
2622 0E73 FE70 cpi "p"
2623 0E75 C29E0E jnz set_user6
2624
2625 0E78 CDC112 call new_line
2626 0E7B 21B01E lxi h,pc_text
2627 0E7E CD3F12 call put_str
2628 0E81 2A29F0 lhld user_PC
2629 0E84 7C mov a,h
2630 0E85 CDB212 call out2x
2631 0E88 7D mov a,l
2632 0E89 CDB212 call out2x
2633 0E8C CDD212 call send_tab
2634 0E8F CD8513 call get_hex2
2635 0E92 67 mov h,a
2636 0E93 CD8513 call get_hex2
2637 0E96 6F mov l,a
2638 0E97 2229F0 shld user_PC
2639
2640 0E9A CD210D call send_prompt
2641 0E9D C9 ret
2642
2643 0E9E C9 set_user6: ret
2644
2645 0E9F exit_set_user:
2646
2647 0E9F C9 ret
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658 0EA0 print_watch_ram:
2659
2660 0EA0 CDC112 call new_line

Page 35 of 63
A8085.LST 29/3/2558 15:27

2661 0EA3 2100F0 lxi h, watch_ram


2662 0EA6 0E10 mvi c,16
2663 0EA8 7C mov a,h
2664 0EA9 CDB212 call out2x
2665 0EAC 7D mov a,l
2666 0EAD CDB212 call out2x
2667 0EB0 watch1:
2668 0EB0 CDCC12 call space
2669 0EB3 7E mov a,m
2670 0EB4 CDB212 call out2x
2671 0EB7 23 inx h
2672 0EB8 0D dcr c
2673 0EB9 C2B00E jnz watch1
2674 0EBC C9 ret
2675
2676
2677
2678 ;----------- clear watch variables------------------------------------
2679
2680 0EBD 3A22F0 clear_watch: lda command
2681 0EC0 FE63 cpi "c"
2682 0EC2 C2D70E jnz exit_clear_watch
2683 0EC5 2100F0 lxi h, watch_ram
2684 0EC8 0E10 mvi c,16
2685
2686 0ECA AF clear1: xra a
2687 0ECB 77 mov m,a
2688 0ECC 23 inx h
2689 0ECD 0D dcr c
2690 0ECE C2CA0E jnz clear1
2691
2692 0ED1 CDA00E call print_watch_ram
2693 0ED4 CD210D call send_prompt
2694
2695 0ED7 C9 exit_clear_watch: ret
2696
2697
2698
2699
2700
2701
2702 ;----------- print watch variables ------------------------------------
2703
2704 0ED8 print_watch:
2705
2706 0ED8 3A22F0 lda command
2707 0EDB FE77 cpi "w"
2708 0EDD C2E60E jnz exit_watch
2709
2710 0EE0 CDA00E call print_watch_ram
2711 0EE3 CD210D call send_prompt
2712
2713 0EE6 C9 exit_watch: ret
2714
2715
2716 ;---------- single step running with key space -----------------------
2717 0EE7 single_step_:
2718
2719 0EE7 3A22F0 lda command
2720 0EEA FE20 cpi " "
2721 0EEC C2F20E jnz exit_step
2722 0EEF CDA509 call single_step
2723
2724 0EF2 exit_step:
2725 0EF2 C9 ret
2726
2727 ;------- display stack area from top of stack to initial -------------
2728
2729 0EF3 stack_display:
2730 0EF3 3A22F0 lda command
2731 0EF6 FE6B cpi "k"
2732 0EF8 C2320F jnz exit_stack
2733
2734 ; lxi h,stack_text
2735 ; call put_str
2736

Page 36 of 63
A8085.LST 29/3/2558 15:27

2737 0EFB 21201E lxi h,edit_text2


2738 0EFE CD3F12 call put_str
2739 0F01 CDC112 call new_line
2740
2741 0F04 2A33F0 lhld user_SP
2742
2743 0F07 stack_display1:
2744
2745 0F07 7C mov a,h
2746 0F08 CDB212 call out2x
2747 0F0B 7D mov a,l
2748 0F0C CDB212 call out2x
2749
2750 0F0F CDCC12 call space
2751 0F12 CDCC12 call space
2752 0F15 3E5B mvi a,"["
2753 0F17 CD1612 call cout
2754
2755 0F1A 7E mov a,m
2756 0F1B CDB212 call out2x
2757
2758 0F1E 3E5D mvi a,"]"
2759 0F20 CD1612 call cout
2760
2761 0F23 CDC112 call new_line
2762
2763 0F26 23 inx h
2764
2765 0F27 1199F0 lxi d, user_stack+32+1 ; load base of user stack
2766
2767 0F2A 7D mov a,l
2768 0F2B AB xra e
2769 0F2C C2070F jnz stack_display1
2770
2771 0F2F CD210D call send_prompt
2772
2773 0F32 exit_stack:
2774 0F32 C9 ret
2775
2776
2777
2778 ;---------------- registers display ----------------------------------
2779
2780 0F33 register_display:
2781
2782 0F33 3A22F0 lda command
2783 0F36 FE72 cpi "r"
2784 0F38 C25810 jnz exit_register
2785
2786 0F3B register_display1:
2787
2788 ; lda uart_found
2789 ; cpi 0
2790 ; jz exit_register ; exit of no uart
2791
2792
2793 0F3B CDC112 call new_line
2794
2795 0F3E register_display2:
2796 0F3E CDC112 call new_line
2797
2798 0F41 21971E lxi h,af_text
2799 0F44 CD3F12 call put_str
2800 0F47 2A2BF0 lhld user_AF
2801 0F4A 7C mov a,h
2802 0F4B CDB212 call out2x
2803 0F4E 7D mov a,l
2804 0F4F CDB212 call out2x
2805 0F52 CDCC12 call space
2806
2807 0F55 219B1E lxi h,bc_text
2808 0F58 CD3F12 call put_str
2809 0F5B 2A2DF0 lhld user_BC
2810 0F5E 7C mov a,h
2811 0F5F CDB212 call out2x
2812 0F62 7D mov a,l

Page 37 of 63
A8085.LST 29/3/2558 15:27

2813 0F63 CDB212 call out2x


2814
2815 0F66 CDCC12 call space
2816
2817 0F69 219F1E lxi h,de_text
2818 0F6C CD3F12 call put_str
2819 0F6F 2A2FF0 lhld user_DE
2820 0F72 7C mov a,h
2821 0F73 CDB212 call out2x
2822 0F76 7D mov a,l
2823 0F77 CDB212 call out2x
2824 0F7A CDCC12 call space
2825
2826 0F7D 21A31E lxi h,hl_text
2827 0F80 CD3F12 call put_str
2828 0F83 2A31F0 lhld user_HL
2829 0F86 7C mov a,h
2830 0F87 CDB212 call out2x
2831 0F8A 7D mov a,l
2832 0F8B CDB212 call out2x
2833
2834 0F8E CDCC12 call space
2835
2836 0F91 21A71E lxi h,sp_text
2837 0F94 CD3F12 call put_str
2838 0F97 2A33F0 lhld user_SP
2839 0F9A 7C mov a,h
2840 0F9B CDB212 call out2x
2841 0F9E 7D mov a,l
2842 0F9F CDB212 call out2x
2843
2844 0FA2 CDCC12 call space
2845
2846 ; lxi h,tos_text
2847 ; call put_str
2848 ; lhld tos
2849 ; mov a,h
2850 ; call out2x
2851 ; mov a,l
2852 ; call out2x
2853 ; call space
2854
2855 0FA5 21B01E lxi h,pc_text
2856 0FA8 CD3F12 call put_str
2857 0FAB 2A29F0 lhld user_PC
2858 0FAE 7C mov a,h
2859 0FAF CDB212 call out2x
2860 0FB2 7D mov a,l
2861 0FB3 CDB212 call out2x
2862
2863 0FB6 CDCC12 call space
2864
2865 0FB9 21CA1E lxi h,sign_text
2866 0FBC CD3F12 call put_str
2867 0FBF 2A2BF0 lhld user_AF
2868 0FC2 7D mov a,l
2869 0FC3 E680 ani 80h
2870 0FC5 C2D00F jnz register_flag1
2871 0FC8 3E30 mvi a,"0"
2872 0FCA CD1612 call cout
2873 0FCD C3D50F jmp register_flag2
2874
2875 0FD0 register_flag1:
2876 0FD0 3E31 mvi a,"1"
2877 0FD2 CD1612 call cout
2878
2879 0FD5 register_flag2:
2880 0FD5 CDCC12 call space
2881
2882 0FD8 215910 lxi h,zero_text
2883 0FDB CD3F12 call put_str
2884 0FDE 2A2BF0 lhld user_AF
2885 0FE1 7D mov a,l
2886 0FE2 E640 ani 40h
2887 0FE4 C2EF0F jnz register_flag3
2888 0FE7 3E30 mvi a,"0"

Page 38 of 63
A8085.LST 29/3/2558 15:27

2889 0FE9 CD1612 call cout


2890 0FEC C3F40F jmp register_flag4
2891
2892 0FEF register_flag3:
2893 0FEF 3E31 mvi a,"1"
2894 0FF1 CD1612 call cout
2895
2896 0FF4 register_flag4:
2897 0FF4 CDCC12 call space
2898
2899 0FF7 215C10 lxi h,AC_text
2900 0FFA CD3F12 call put_str
2901 0FFD 2A2BF0 lhld user_AF
2902 1000 7D mov a,l
2903 1001 E610 ani 10h
2904 1003 C20E10 jnz register_flag5
2905 1006 3E30 mvi a,"0"
2906 1008 CD1612 call cout
2907 100B C31310 jmp register_flag6
2908
2909 100E register_flag5:
2910 100E 3E31 mvi a,"1"
2911 1010 CD1612 call cout
2912
2913 1013 register_flag6:
2914 1013 CDCC12 call space
2915
2916 1016 216010 lxi h,P_text
2917 1019 CD3F12 call put_str
2918 101C 2A2BF0 lhld user_AF
2919 101F 7D mov a,l
2920 1020 E604 ani 4
2921 1022 C22D10 jnz register_flag7
2922 1025 3E30 mvi a,"0"
2923 1027 CD1612 call cout
2924 102A C33210 jmp register_flag8
2925
2926 102D register_flag7:
2927 102D 3E31 mvi a,"1"
2928 102F CD1612 call cout
2929
2930 1032 register_flag8:
2931 1032 CDCC12 call space
2932
2933 1035 216310 lxi h,CY_text
2934 1038 CD3F12 call put_str
2935 103B 2A2BF0 lhld user_AF
2936 103E 7D mov a,l
2937 103F E601 ani 1
2938 1041 C24C10 jnz register_flag9
2939 1044 3E30 mvi a,"0"
2940 1046 CD1612 call cout
2941 1049 C35110 jmp register_flag10
2942
2943 104C register_flag9:
2944 104C 3E31 mvi a,"1"
2945 104E CD1612 call cout
2946
2947 1051 register_flag10:
2948 1051 CDCC12 call space
2949
2950 1054 CD210D call send_prompt
2951 1057 C9 ret
2952
2953 1058 exit_register:
2954 1058 C9 ret
2955
2956 1059 5A3D00 zero_text dfb "Z=",0
2957 105C 41433D00 AC_text dfb "AC=",0
2958 1060 503D00 P_text dfb "P=",0
2959 1063 43593D00 CY_text dfb "CY=",0
2960
2961
2962 ;----------------- fill constant to memory ---------------------------
2963
2964 1067 fill_memory:

Page 39 of 63
A8085.LST 29/3/2558 15:27

2965
2966 1067 3A22F0 lda command
2967 106A FE66 cpi "f"
2968 106C C2AA10 jnz exit_fill
2969 106F 21561E lxi h,fill_text1
2970 1072 CD3F12 call put_str
2971
2972 1075 CD6C13 call get_hex1
2973 1078 67 mov h,a
2974 1079 CD6C13 call get_hex1
2975 107C 6F mov l,a
2976 107D E5 push h ; save begin address to stack
2977
2978 107E 21671E lxi h,fill_text2
2979 1081 CD3F12 call put_str
2980
2981 1084 CD6C13 call get_hex1
2982 1087 67 mov h,a
2983 1088 CD6C13 call get_hex1
2984 108B 6F mov l,a
2985 108C E5 push h ; save end address to stack
2986
2987 108D 21771E lxi h,fill_text3
2988 1090 CD3F12 call put_str
2989 1093 CD6C13 call get_hex1
2990
2991 1096 47 mov b,a ; byte save to B
2992
2993 1097 D1 pop d ; end address in DE
2994
2995 1098 E1 pop h ; begin address in HL
2996
2997 1099 fill_memory1:
2998
2999 1099 78 mov a,b
3000 109A 77 mov m,a
3001 109B 23 inx h
3002
3003 109C 7D mov a,l
3004 109D BB cmp e
3005 109E C29910 jnz fill_memory1
3006
3007 10A1 7C mov a,h
3008 10A2 BA cmp d
3009 10A3 C29910 jnz fill_memory1
3010
3011
3012 10A6 CD210D call send_prompt
3013 10A9 C9 ret
3014
3015 10AA exit_fill:
3016
3017 10AA C9 ret
3018
3019
3020
3021
3022 ;---------------- monitor function list -------------------------------
3023
3024 10AB monitor_function:
3025
3026 10AB 3A22F0 lda command
3027 10AE FE6D cpi "m"
3028 10B0 C2C310 jnz exit_monitor
3029
3030 10B3 CDC112 call new_line
3031 10B6 215322 lxi h,monitor_text
3032 10B9 CD3F12 call put_str
3033 10BC CDC112 call new_line
3034 10BF CD210D call send_prompt
3035 10C2 C9 ret
3036
3037 10C3 exit_monitor:
3038 10C3 C9 ret
3039
3040 ;----------------------- jump to user program --------------------

Page 40 of 63
A8085.LST 29/3/2558 15:27

3041
3042 10C4 3A22F0 jump_to_user_pgm: lda command
3043 10C7 FE6A cpi "j"
3044 10C9 C20D11 jnz exit_jump
3045
3046 10CC 212E1E lxi h, jump_text1
3047 10CF CD3F12 call put_str
3048
3049 10D2 2A29F0 lhld user_PC
3050 10D5 7C mov a,h
3051 10D6 CDB212 call out2x
3052 10D9 7D mov a,l
3053 10DA CDB212 call out2x
3054
3055 10DD 21401E lxi h,jump_text2
3056 10E0 CD3F12 call put_str
3057
3058 10E3 CD8513 call get_hex2
3059
3060 10E6 F5 push psw
3061
3062 10E7 3A23F0 lda flag1
3063 10EA E601 ani 1
3064 10EC C2FE10 jnz skip_load_PC
3065
3066 10EF F1 pop psw
3067
3068 10F0 67 mov h,a
3069 10F1 CD8513 call get_hex2
3070 10F4 6F mov l,a
3071 10F5 2229F0 shld user_PC
3072 10F8 CDC112 call new_line
3073 10FB C38109 jmp go
3074
3075 10FE skip_load_PC:
3076 10FE F1 pop psw
3077 10FF 3A23F0 lda flag1
3078 1102 E6FE ani 0feh
3079 1104 3223F0 sta flag1
3080 1107 CDC112 call new_line
3081 110A C38109 jmp go
3082
3083 110D C9 exit_jump: ret
3084
3085 ;------------ edit memory -----------------------------------------
3086
3087
3088 110E 3A22F0 edit_location: lda command
3089 1111 FE65 cpi "e"
3090 1113 C29011 jnz exit_edit
3091
3092 1116 21DD1D lxi h, edit_text
3093 1119 CD3F12 call put_str
3094 111C CD6C13 call get_hex1
3095 111F 67 mov h,a
3096 1120 CD6C13 call get_hex1
3097 1123 6F mov l,a
3098 1124 223BF0 shld pointer ;user_PC
3099
3100 1127 21F51D lxi h, edit_text1
3101 112A CD3F12 call put_str
3102
3103 112D 21201E lxi h, edit_text2
3104 1130 CD3F12 call put_str
3105
3106 1133 CDC112 edit1: call new_line
3107
3108 1136 2A3BF0 lhld pointer ;user_PC
3109 1139 7C mov a,h
3110 113A CDB212 call out2x
3111 113D 7D mov a,l
3112 113E CDB212 call out2x
3113 1141 CDCC12 call space
3114 1144 CDCC12 call space
3115 1147 3E5B mvi a,"["
3116 1149 CD1612 call cout

Page 41 of 63
A8085.LST 29/3/2558 15:27

3117 114C 7E mov a,m


3118 114D CDB212 call out2x
3119 1150 3E5D mvi a,"]"
3120 1152 CD1612 call cout
3121
3122 1155 CDCC12 call space
3123
3124 1158 CD8513 call get_hex2
3125
3126 115B F5 push psw
3127
3128 115C 3A23F0 lda flag1
3129 115F E601 ani 1
3130 1161 C28111 jnz exit_edit1 ; Enter key?
3131
3132 1164 3A23F0 lda flag1
3133 1167 E602 ani 2
3134 1169 C27111 jnz skip_edit1 ; SPACE key?
3135
3136 116C F1 pop psw
3137
3138 116D 77 mov m,a
3139 116E C37A11 jmp skip_edit2
3140
3141 1171 F1 skip_edit1: pop psw
3142
3143 1172 3A23F0 lda flag1
3144 1175 E6FD ani 0fdh
3145 1177 3223F0 sta flag1
3146
3147 117A skip_edit2:
3148 117A 23 inx h
3149 117B 223BF0 shld pointer ;user_PC
3150 117E C33311 jmp edit1
3151
3152 1181 F1 exit_edit1: pop psw
3153
3154 1182 3A23F0 lda flag1
3155 1185 E6FE ani 0feh
3156 1187 3223F0 sta flag1
3157
3158 118A CDC112 call new_line
3159 118D CD210D call send_prompt
3160
3161 1190 C9 exit_edit: ret
3162
3163
3164 1191 3A22F0 new_location: lda command
3165 1194 FE6E cpi "n"
3166 1196 C2AD11 jnz exit_new_location
3167 1199 21CD1D lxi h,new_text
3168 119C CD3F12 call put_str
3169 119F CD6C13 call get_hex1
3170 11A2 67 mov h,a
3171 11A3 CD6C13 call get_hex1
3172 11A6 6F mov l,a
3173 11A7 223BF0 shld pointer ; user_PC
3174 11AA CD210D call send_prompt
3175
3176 11AD exit_new_location:
3177
3178 11AD C9 ret
3179
3180
3181
3182
3183 11AE quick_home:
3184 11AE 3A22F0 lda command
3185 11B1 FE71 cpi "q"
3186 11B3 C2C211 jnz exit_quick_home
3187
3188 11B6 210081 lxi h,home_address
3189 11B9 2229F0 shld user_PC
3190 11BC 223BF0 shld pointer
3191 11BF CD210D call send_prompt
3192

Page 42 of 63
A8085.LST 29/3/2558 15:27

3193 11C2 exit_quick_home:


3194 11C2 C9 ret
3195
3196 ; i/o address map
3197
3198 11C3 3A22F0 io_address: lda command
3199 11C6 FE69 cpi "i"
3200 11C8 C2D411 jnz exit_io
3201
3202 11CB 21EA20 lxi h,io_text
3203 11CE CD3F12 call put_str
3204 11D1 CD210D call send_prompt
3205
3206 11D4 C9 exit_io: ret
3207
3208
3209 ; help listing
3210
3211 11D5 3A22F0 help: lda command
3212 11D8 FE3F cpi "?"
3213 11DA C2EC11 jnz exit_help
3214
3215 11DD 215612 lxi h,prompt3
3216 11E0 CD4D12 call alt_put_str
3217 11E3 21551F lxi h,help_text1
3218 11E6 CD3F12 call put_str
3219 11E9 CD210D call send_prompt
3220
3221 11EC C9 exit_help: ret
3222
3223
3224 ; initialize 16C550 uart to 9600 8n1 with 2MHz clock
3225 ; 2MHz/13 = 153846Hz
3226
3227 11ED init_uart:
3228
3229 11ED 3E83 mvi a,83h
3230 11EF D343 out uart_lcr ; set DLAB bit to access divider
3231
3232 11F1 3E0D mvi a,13
3233 11F3 D340 out uart_divisor_lsb
3234 11F5 3E00 mvi a,0
3235 11F7 D341 out uart_divisor_msb ; 2MHz/13 = 153846 Hz
3236 ; 153846Hz/16 = 9615Hz
3237 11F9 3E07 mvi a,7
3238 11FB D342 out uart_fifo ; init fifo and clear all buffers
3239 11FD 3E03 mvi a,03h
3240 11FF D343 out uart_lcr ; clar DLAB
3241
3242 ; check uart line status, if the byte is FF then no uart
3243 ;
3244 ;
3245 1201 AF xra a
3246 1202 D347 out uart_scr ; check if there is uart
3247 1204 DB47 in uart_scr
3248 1206 FE00 cpi 0
3249 1208 CA1012 jz found
3250 120B AF xra a
3251 120C 3224F0 sta uart_found
3252 120F C9 ret
3253
3254 1210 3E01 found mvi a,1
3255 1212 3224F0 sta uart_found
3256 1215 C9 ret
3257
3258 1216 47 cout: mov b,a ; save a
3259
3260 1217 DB45 cout1: in uart_line_status
3261 1219 E620 ani 20h ; transmitter ready?
3262 121B CA1712 jz cout1
3263
3264 121E 78 mov a,b ; restore a
3265 121F D340 out uart_buffer
3266 1221 C9 ret
3267
3268 1222 DB45 cin: in uart_line_status

Page 43 of 63
A8085.LST 29/3/2558 15:27

3269 1224 E601 ani 1 ; data available?


3270 1226 CA2212 jz cin
3271 1229 DB40 in uart_buffer
3272 122B C9 ret
3273
3274
3275 122C DB45 get_command: in uart_line_status
3276 122E E601 ani 1
3277 1230 CA3912 jz no_data
3278 1233 DB40 in uart_buffer
3279 1235 3222F0 sta command ; command = ASCII code
3280 1238 C9 ret
3281
3282 1239 3EFF no_data: mvi a,0ffh ; command == -1
3283 123B 3222F0 sta command
3284 123E C9 ret
3285
3286
3287 ; print string terminated by 0
3288 ; input: HL
3289
3290 123F 7E put_str: mov a,m ; get A from [HL]
3291 1240 FE00 cpi 0
3292 1242 C24612 jnz put_str1
3293 1245 C9 ret
3294
3295 1246 CD1612 put_str1: call cout
3296 1249 23 inx h
3297 124A F23F12 jp put_str
3298
3299 124D 7E alt_put_str: mov a,m ; get A from [HL]
3300 124E EEAA xri 0aah
3301 1250 FE00 cpi 0
3302 1252 C28C12 jnz put_str2
3303 1255 C9 ret
3304
3305 1256 A7A0A0E7FEprompt3: dfb 0A7h,0A0h,0A0h,0E7h,0FEh,0E1h,087h,092h,09Fh,08Ah,092h,09Ah,092h
3306 1266 E3E9F8E5FA dfb 0E3h,0E9h,0F8h,0E5h,0FAh,0F8h,0E5h,0E9h,0EFh,0F9h,0F9h,0E5h,0F8h
3307 1276 EBE3E4E3E4 dfb 0EBh,0E3h,0E4h,0E3h,0E4h,0EDh,08Ah,0E1h,0E3h,0FEh,08Ah,082h,095h
3308 1286 E6FA83A7A0 dfb 0E6h,0FAh,083h,0A7h,0a0h,0aah
3309
3310 128C CD1612 put_str2: call cout
3311 128F 23 inx h
3312 1290 F24D12 jp alt_put_str
3313
3314
3315
3316 1293 213F1D send_prompt1: lxi h,prompt1
3317 1296 CD3F12 call put_str
3318 1299 C9 ret
3319
3320 129A 215612 send_prompt3: lxi h,prompt3
3321 129D CD4D12 call alt_put_str
3322 12A0 C9 ret
3323
3324
3325
3326 12A1 F5 out1x: push psw
3327 12A2 E60F ani 0fh
3328 12A4 C630 adi "0"
3329 12A6 FE3A cpi 3Ah
3330 12A8 DAAD12 jc out1x1
3331 12AB C607 adi 7
3332
3333 12AD CD1612 out1x1: call cout
3334 12B0 F1 pop psw
3335 12B1 C9 ret
3336
3337 12B2 out2x:
3338 12B2 0F rrc
3339 12B3 0F rrc
3340 12B4 0F rrc
3341 12B5 0F rrc
3342 12B6 CDA112 call out1x
3343 12B9 07 rlc
3344 12BA 07 rlc

Page 44 of 63
A8085.LST 29/3/2558 15:27

3345 12BB 07 rlc


3346 12BC 07 rlc
3347 12BD CDA112 call out1x
3348 12C0 C9 ret
3349
3350 ; new_line
3351
3352 12C1 3E0D new_line: mvi a,cr
3353 12C3 CD1612 call cout
3354 12C6 3E0A mvi a,lf
3355 12C8 CD1612 call cout
3356 12CB C9 ret
3357
3358 12CC 3E20 space: mvi a," "
3359 12CE CD1612 call cout
3360 12D1 C9 ret
3361
3362 12D2 3E09 send_tab: mvi a,9
3363 12D4 CD1612 call cout
3364 12D7 C9 ret
3365
3366
3367
3368 12D8 3A22F0 hex_dump: lda command
3369 12DB FE68 cpi "h"
3370 12DD C23713 jnz exit_hex_dump
3371
3372 12E0 CDC112 call new_line
3373
3374 12E3 0E08 mvi c,8 ; 8 lines
3375
3376 12E5 C5 hex_dump2: push b
3377 12E6 CDC112 call new_line
3378 12E9 2A3BF0 lhld pointer ;user_PC
3379 12EC 7C mov a,h
3380 12ED CDB212 call out2x
3381 12F0 7D mov a,l
3382 12F1 CDB212 call out2x
3383 12F4 CDCC12 call space
3384
3385 12F7 0E10 mvi c,16
3386
3387 12F9 CDCC12 hex_dump1: call space
3388 12FC 7E mov a,m
3389 12FD CDB212 call out2x
3390 1300 23 inx h
3391 1301 0D dcr c
3392 1302 C2F912 jnz hex_dump1
3393
3394 1305 CDCC12 call space
3395 1308 CDCC12 call space
3396 130B CDCC12 call space
3397
3398 ; print ASCII representation 20H-7FH
3399 ; outside such range, print . instead
3400
3401 130E 11F0FF lxi d,0FFF0h ; load DE with -16
3402 1311 19 dad d ; ADD HL,DE
3403
3404 1312 0E10 mvi c,16
3405
3406 1314 7E hex_dump5: mov a,m
3407
3408 1315 FE20 cpi 20h ; <20H?
3409 1317 DA1F13 jc hex_dump3
3410 131A FE80 cpi 80h
3411 131C DA2113 jc hex_dump4
3412 131F 3E2E hex_dump3: mvi a,"."
3413 1321 CD1612 hex_dump4: call cout
3414
3415 1324 23 inx h
3416 1325 0D dcr c
3417 1326 C21413 jnz hex_dump5
3418
3419 1329 223BF0 shld pointer ;user_PC
3420

Page 45 of 63
A8085.LST 29/3/2558 15:27

3421 132C C1 pop b


3422 132D 0D dcr c
3423 132E C2E512 jnz hex_dump2
3424
3425 1331 CDC112 call new_line
3426 1334 CD210D call send_prompt
3427
3428 1337 C9 exit_hex_dump: ret
3429
3430
3431 1338 210081 dump_memory: lxi h,8100h
3432 133B 0E64 mvi c,100 ; 100 bytes display
3433
3434 133D CDC112 call new_line
3435 1340 7E dump1: mov a,m
3436 1341 CDB212 call out2x
3437 1344 CDCC12 call space
3438 1347 23 inx h
3439 1348 0D dcr c
3440 1349 C24013 jnz dump1
3441 134C C9 ret
3442
3443 ; convert ASCII letter to one nibble 0-F
3444 ; 0-9 -> al-30
3445 ; A-F -> al-7
3446 ; entry: A
3447 ; exit: A
3448
3449 134D D630 to_hex: sui "0"
3450 134F FE0A cpi 10
3451 1351 DA5813 jc zero_nine
3452 1354 E6DF ani 11011111b
3453 1356 D607 sui 7 ; convert to A-F
3454 1358 zero_nine:
3455
3456 1358 C9 ret
3457
3458 ; read two ASCII bytes and convert them to one bye 8-bit data
3459 ; exit: A
3460 ; used: A, E
3461
3462 1359 CD2212 get_hex: call cin
3463 135C CD4D13 call to_hex
3464 135F 0F rrc
3465 1360 0F rrc
3466 1361 0F rrc
3467 1362 0F rrc
3468 1363 5F mov e,a
3469 1364 CD2212 call cin
3470 1367 CD4D13 call to_hex
3471 136A 83 add e
3472 136B C9 ret
3473
3474 ; read two ASCII bytes echo to screen and convert them to one bye 8-bit data
3475 ; exit: A
3476
3477 136C CD2212 get_hex1: call cin
3478 136F CD1612 call cout
3479 1372 CD4D13 call to_hex
3480 1375 0F rrc
3481 1376 0F rrc
3482 1377 0F rrc
3483 1378 0F rrc
3484 1379 5F mov e,a
3485 137A CD2212 call cin
3486 137D CD1612 call cout
3487 1380 CD4D13 call to_hex
3488 1383 83 add e
3489 1384 C9 ret
3490
3491 ; read two ASCII bytes echo to screen and convert them to one bye 8-bit data
3492 ; exit: A
3493
3494 1385 3A23F0 get_hex2: lda flag1
3495 1388 E6FC ani 0fch ; clear flag1.1 and flag1.0
3496 138A 3223F0 sta flag1

Page 46 of 63
A8085.LST 29/3/2558 15:27

3497
3498 138D CD2212 call cin
3499 1390 FE0D cpi cr
3500 1392 CAD813 jz exit_get_hex2
3501
3502 1395 FE20 cpi " "
3503 1397 CAE113 jz exit_get_hex3
3504
3505 139A FE30 cpi 30h ; hex must be 0-9 and A-F
3506 139C DA8513 jc get_hex2
3507
3508 139F FE40 cpi 40h
3509 13A1 DAAE13 jc ascii_0_9
3510
3511 13A4 FE61 cpi 97 ; < 97?
3512 13A6 DA8513 jc get_hex2
3513
3514 13A9 FE67 cpi 103 ; >= 103?
3515 13AB D28513 jnc get_hex2
3516
3517 13AE ascii_0_9:
3518
3519 13AE CD1612 call cout
3520 13B1 CD4D13 call to_hex
3521 13B4 0F rrc
3522 13B5 0F rrc
3523 13B6 0F rrc
3524 13B7 0F rrc
3525 13B8 5F mov e,a
3526
3527 13B9 get_2nd_hex:
3528
3529 13B9 CD2212 call cin
3530
3531 13BC FE30 cpi 30h ; hex must be 0-9 and A-F
3532 13BE DAB913 jc get_2nd_hex
3533
3534 13C1 FE40 cpi 40h
3535 13C3 DAD013 jc ok_0_9
3536
3537 13C6 FE61 cpi 97 ; < 97?
3538 13C8 DAB913 jc get_2nd_hex
3539
3540 13CB FE67 cpi 103 ; >= 103?
3541 13CD D2B913 jnc get_2nd_hex
3542
3543 13D0 ok_0_9:
3544 13D0 CD1612 call cout
3545 13D3 CD4D13 call to_hex
3546 13D6 83 add e
3547 13D7 C9 ret
3548
3549 13D8 exit_get_hex2:
3550
3551 13D8 3A23F0 lda flag1
3552 13DB F601 ori 1
3553 13DD 3223F0 sta flag1 ; Q key has been pressed
3554 13E0 C9 ret
3555
3556 13E1 exit_get_hex3:
3557
3558 13E1 3A23F0 lda flag1
3559 13E4 F602 ori 2
3560 13E6 3223F0 sta flag1 ; SPACE key has been pressed
3561 13E9 C9 ret
3562
3563
3564 ; add check sum
3565
3566
3567 ; get record, write to SRAM and jump to 8000h
3568 ; entry: A= byte received, B= byte check sum
3569
3570 add_bcs: macro ; add accumulator with byte check sum stored in B
3571 push psw
3572 add b

Page 47 of 63
A8085.LST 29/3/2558 15:27

3573 mov b,a


3574 pop psw
3575 endm
3576
3577 001B = esc equ 1bh
3578
3579 13EA CD2212 get_record: call cin
3580 13ED FE1B cpi 27
3581 13EF CA4114 jz esc_quit
3582
3583 13F2 FE3A cpi ":"
3584 13F4 C2EA13 jnz get_record ; wait until begin of record found
3585
3586 13F7 0600 mvi b,0 ; byte check sum
3587
3588 13F9 CD5913 call get_hex ; get number of byte
3589 13FC 4F mov c,a ; put to c
3590
3591 13FD add_bcs
3592 13FD F5 push psw
3593 13FE 80 add b
3594 13FF 47 mov b,a
3595 1400 F1 pop psw
3596 1401 endm
3597
3598 1401 CD5913 call get_hex ; get destination address, put to bx register
3599 1404 67 mov h,a ; save high byte
3600
3601 1405 add_bcs
3602 1405 F5 push psw
3603 1406 80 add b
3604 1407 47 mov b,a
3605 1408 F1 pop psw
3606 1409 endm
3607
3608 1409 CD5913 call get_hex
3609 140C 6F mov l,a ; and low byte
3610
3611 140D add_bcs
3612 140D F5 push psw
3613 140E 80 add b
3614 140F 47 mov b,a
3615 1410 F1 pop psw
3616 1411 endm
3617
3618 1411 CD5913 call get_hex
3619
3620 1414 add_bcs
3621 1414 F5 push psw
3622 1415 80 add b
3623 1416 47 mov b,a
3624 1417 F1 pop psw
3625 1418 endm
3626
3627 1418 FE01 cpi 1 ; end of record type is 01 ?
3628 141A C24214 jnz data_record ; jump if not 01
3629
3630 141D CD2212 wait_cr: call cin
3631 1420 FE0D cpi cr
3632 1422 C21D14 jnz wait_cr ; until end of record sending! with cr detection
3633
3634 1425 3EFF mvi a, 0ffh ; turn speaker off
3635 1427 D312 out system_port_c
3636 1429 AF xra a
3637 142A D300 out 0 ; turn off GPIO
3638
3639 142C CDA014 call print_bcd1
3640 142F CDCC12 call space
3641 1432 3A20F0 lda bcs
3642 1435 CDC401 call pint8u
3643 1438 21801E lxi h,error_text
3644 143B CD3F12 call put_str
3645 143E CDC112 call new_line
3646
3647 1441 C9 esc_quit: ret
3648

Page 48 of 63
A8085.LST 29/3/2558 15:27

3649
3650 1442 CD5913 data_record: call get_hex ; get data byte
3651 1445 77 mov m,a ; save to SRAM at [HL]
3652
3653 1446 add_bcs
3654 1446 F5 push psw
3655 1447 80 add b
3656 1448 47 mov b,a
3657 1449 F1 pop psw
3658 144A endm
3659
3660 144A CD7014 call inc_bcd1
3661
3662 ; ori 7fh
3663 ; out system_port_c ; make buzzer sound
3664
3665
3666 144D 23 inx h ; next location
3667
3668 144E 0D dcr c
3669 144F C24214 jnz data_record ; until c = 0
3670
3671 1452 78 mov a,b
3672 1453 2F cma
3673 1454 47 mov b,a
3674 1455 04 inr b ; compute two's complement
3675
3676 1456 CD5913 call get_hex ; get check sum
3677
3678 1459 B8 cmp b
3679 145A CA6414 jz skip_error
3680
3681 145D 3A20F0 lda bcs
3682 1460 3C inr a
3683 1461 3220F0 sta bcs
3684
3685 1464 skip_error:
3686 1464 3A39F0 lda temp ; then shift into temp8
3687 1467 07 rlc
3688 1468 3239F0 sta temp
3689 146B D300 out 0 ; send to GPIO
3690
3691 146D C3EA13 jmp get_record ; back to next record
3692
3693
3694 ;---------------- increment BCD counter1 -------------------------
3695
3696 1470 E5 inc_bcd1: push h
3697
3698 1471 2140F0 lxi h,bcd_counter1
3699 1474 AF xra a
3700
3701 1475 7E mov a,m
3702 1476 C601 adi 1
3703 1478 27 daa
3704 1479 77 mov m,a
3705 147A 23 inx h
3706
3707 147B 7E mov a,m
3708 147C CE00 aci 0
3709 147E 27 daa
3710 147F 77 mov m,a
3711 1480 23 inx h
3712 1481 7E mov a,m
3713 1482 CE00 aci 0
3714 1484 27 daa
3715 1485 77 mov m,a
3716
3717 1486 E1 pop h
3718
3719 1487 C9 ret
3720
3721 1488 E5 inc_bcd2: push h
3722
3723 1489 2143F0 lxi h,bcd_counter2
3724 148C AF xra a

Page 49 of 63
A8085.LST 29/3/2558 15:27

3725
3726 148D 7E mov a,m
3727 148E C601 adi 1
3728 1490 27 daa
3729 1491 77 mov m,a
3730 1492 23 inx h
3731
3732 1493 7E mov a,m
3733 1494 CE00 aci 0
3734 1496 27 daa
3735 1497 77 mov m,a
3736 1498 23 inx h
3737 1499 7E mov a,m
3738 149A CE00 aci 0
3739 149C 27 daa
3740 149D 77 mov m,a
3741
3742 149E E1 pop h
3743
3744 149F C9 ret
3745
3746
3747 14A0 print_bcd1:
3748 14A0 2142F0 lxi h,bcd_counter1+2
3749 14A3 7E mov a,m
3750 14A4 CDB212 call out2x
3751 14A7 2141F0 lxi h,bcd_counter1+1
3752 14AA 7E mov a,m
3753 14AB CDB212 call out2x
3754 14AE 2140F0 lxi h,bcd_counter1
3755 14B1 7E mov a,m
3756 14B2 CDB212 call out2x
3757 14B5 21CD1E lxi h,byte_text
3758 14B8 CD3F12 call put_str
3759 14BB C9 ret
3760
3761 14BC 210000 clear_bcd1: lxi h,0
3762 14BF 2240F0 shld bcd_counter1
3763 14C2 2241F0 shld bcd_counter1+1
3764 14C5 2242F0 shld bcd_counter1+2
3765 14C8 C9 ret
3766
3767 14C9 print_bcd2:
3768 14C9 2145F0 lxi h,bcd_counter2+2
3769 14CC 7E mov a,m
3770 14CD CDB212 call out2x
3771 14D0 2144F0 lxi h,bcd_counter2+1
3772 14D3 7E mov a,m
3773 14D4 CDB212 call out2x
3774 14D7 2143F0 lxi h,bcd_counter2
3775 14DA 7E mov a,m
3776 14DB CDB212 call out2x
3777 14DE 21CD1E lxi h,byte_text
3778 14E1 CD3F12 call put_str
3779 14E4 C9 ret
3780
3781 14E5 210000 clear_bcd2: lxi h,0
3782 14E8 2243F0 shld bcd_counter2
3783 14EB 2244F0 shld bcd_counter2+1
3784 14EE 2245F0 shld bcd_counter2+2
3785 14F1 C9 ret
3786
3787 ; constants
3788
3789 14F2 INS_TABLE:
3790
3791 14F2 F216 DWL C0 ; "NOP",TAB,RS ; 00
3792 14F4 F716 DWL C1 ; "LXI",TAB,"B,",RS ; 01
3793 14F6 FE16 DWL C2 ; "STAX",TAB,"B",RS ; 02
3794 14F8 0517 DWL C3 ; "INX",TAB,"B",RS ; 03
3795 14FA 0B17 DWL C4 ; "INR",TAB,"B",RS ; 04
3796 14FC 1117 DWL C5 ; "DCR",TAB,"B",RS ; 05
3797 14FE 1717 DWL C6 ; "MVI",TAB,"B,",RS ; 06
3798 1500 1E17 DWL C7 ; "RLC",TAB,RS ; 07
3799 1502 2317 DWL C8 ; "DFB",TAB,RS ; 08
3800 1504 2817 DWL C9 ; "DAD",TAB,"B",RS ; 09

Page 50 of 63
A8085.LST 29/3/2558 15:27

3801 1506 2E17 DWL CA ; "LDAX",TAB,"B",RS ; 0A


3802 1508 3517 DWL CB ; "DCX",TAB,"B",RS ; 0B
3803 150A 3B17 DWL CC ; "INR",TAB,"C",RS ; 0C
3804 150C 4117 DWL CD ; "DCR",TAB,"C",RS ; 0D
3805 150E 4717 DWL CE ; "MVI",TAB,"C,",RS ; 0E
3806 1510 4E17 DWL CF ; "RRC",TAB,RS ; 0F
3807 1512 5317 DWL C10 ; "DFB",TAB,RS ; 10
3808 1514 5817 DWL C11 ; "LXI",TAB,"D,",RS ; 11
3809 1516 5F17 DWL C12 ; "STAX",TAB,"D",RS ; 12
3810 1518 6617 DWL C13 ; "INX",TAB,"D",RS ; 13
3811 151A 6C17 DWL C14 ; "INR",TAB,"D",RS ; 14
3812 151C 7217 DWL C15 ; "DCR",TAB,"D",RS ; 15
3813 151E 7817 DWL C16 ; "MVI",TAB,"D,",RS ; 16
3814 1520 7F17 DWL C17 ; "RAL",TAB,RS ; 17
3815 1522 8417 DWL C18 ; "DFB",TAB,RS ; 18
3816 1524 8917 DWL C19 ; "DAD",TAB,"D",RS ; 19
3817 1526 8F17 DWL C1A ; "LDAX",TAB,"D",RS ; 1A
3818 1528 9617 DWL C1B ; "DCX",TAB,"D",RS ; 1B
3819 152A 9C17 DWL C1C ; "INR",TAB,"E",RS ; 1C
3820 152C A217 DWL C1D ; "DCR",TAB,"E",RS ; 1D
3821 152E A817 DWL C1E ; "MVI",TAB,"E,",RS ; 1E
3822 1530 AF17 DWL C1F ; "RAR",TAB,RS ; 1F
3823 1532 B417 DWL C20 ; "RIM",TAB,RS ; 20
3824 1534 B917 DWL C21 ; "LXI",TAB,"H,",RS ; 21
3825 1536 C017 DWL C22 ; "SHLD",TAB,RS ; 22
3826 1538 C617 DWL C23 ; "INX",TAB,"H",RS ; 23
3827 153A CC17 DWL C24 ; "INR",TAB,"H",RS ; 24
3828 153C D217 DWL C25 ; "DCR",TAB,"H",RS ; 25
3829 153E D817 DWL C26 ; "MVI",TAB,"H,",RS ; 26
3830 1540 DF17 DWL C27 ; "DAA",TAB,RS ; 27
3831 1542 E417 DWL C28 ; "DFB",TAB,RS ; 28
3832 1544 E917 DWL C29 ; "DAD",TAB,"H",RS ; 29
3833 1546 EF17 DWL C2A ; "LHLD",TAB,RS ; 2A
3834 1548 F517 DWL C2B ; "DCX",TAB,"H",RS ; 2B
3835 154A FB17 DWL C2C ; "INR",TAB,"L",RS ; 2C
3836 154C 0118 DWL C2D ; "DCR",TAB,"L",RS ; 2D
3837 154E 0718 DWL C2E ; "MVI",TAB,"L,",RS ; 2E
3838 1550 0E18 DWL C2F ; "CMA",TAB,RS ; 2F
3839 1552 1318 DWL C30 ; "SIM",TAB,RS ; 30
3840 1554 1818 DWL C31 ; "LXI",TAB,"SP,",RS ; 31
3841 1556 2018 DWL C32 ; "STA",TAB,RS ; 32
3842 1558 2518 DWL C33 ; "INX",TAB,"SP",RS ; 33
3843 155A 2C18 DWL C34 ; "INR",TAB,"M",RS ; 34
3844 155C 3218 DWL C35 ; "DCR",TAB,"M",RS ; 35
3845 155E 3818 DWL C36 ; "MVI",TAB,"M,",RS ; 36
3846 1560 3F18 DWL C37 ; "STC",TAB,RS ; 37
3847 1562 4418 DWL C38 ; "DFB",TAB,RS ; 38
3848 1564 4918 DWL C39 ; "DAD",TAB,"SP",RS ; 39
3849 1566 5018 DWL C3A ; "LDA",TAB,RS ; 3A
3850 1568 5518 DWL C3B ; "DCX",TAB,"SP",RS ; 3B
3851 156A 5C18 DWL C3C ; "INR",TAB,"A",RS ; 3C
3852 156C 6218 DWL C3D ; "DCR",TAB,"A",RS ; 3D
3853 156E 6818 DWL C3E ; "MVI",TAB,"A,",RS ; 3E
3854 1570 6F18 DWL C3F ; "CMC",TAB,RS ; 3F
3855 1572 7418 DWL C40 ; "MOV",TAB,"B,B",RS ; 40
3856 1574 7C18 DWL C41 ; "MOV",TAB,"B,C",RS ; 41
3857 1576 8418 DWL C42 ; "MOV",TAB,"B,D",RS ; 42
3858 1578 8C18 DWL C43 ; "MOV",TAB,"B,E",RS ; 43
3859 157A 9418 DWL C44 ; "MOV",TAB,"B,H",RS ; 44
3860 157C 9C18 DWL C45 ; "MOV",TAB,"B,L",RS ; 45
3861 157E A418 DWL C46 ; "MOV",TAB,"B,M",RS ; 46
3862 1580 AC18 DWL C47 ; "MOV",TAB,"B,A",RS ; 47
3863 1582 B418 DWL C48 ; "MOV",TAB,"C,B",RS ; 48
3864 1584 BC18 DWL C49 ; "MOV",TAB,"C,C",RS ; 49
3865 1586 C418 DWL C4A ; "MOV",TAB,"C,D",RS ; 4A
3866 1588 CC18 DWL C4B ; "MOV",TAB,"C,E",RS ; 4B
3867 158A D418 DWL C4C ; "MOV",TAB,"C,H",RS ; 4C
3868 158C DC18 DWL C4D ; "MOV",TAB,"C,L",RS ; 4D
3869 158E E418 DWL C4E ; "MOV",TAB,"C,M",RS ; 4E
3870 1590 EC18 DWL C4F ; "MOV",TAB,"C,A",RS ; 4F
3871 1592 F418 DWL C50 ; "MOV",TAB,"D,B",RS ; 50
3872 1594 FC18 DWL C51 ; "MOV",TAB,"D,C",RS ; 51
3873 1596 0419 DWL C52 ; "MOV",TAB,"D,D",RS ; 52
3874 1598 0C19 DWL C53 ; "MOV",TAB,"D,E",RS ; 53
3875 159A 1419 DWL C54 ; "MOV",TAB,"D,H",RS ; 54
3876 159C 1C19 DWL C55 ; "MOV",TAB,"D,L",RS ; 55

Page 51 of 63
A8085.LST 29/3/2558 15:27

3877 159E 2419 DWL C56 ; "MOV",TAB,"D,M",RS ; 56


3878 15A0 2C19 DWL C57 ; "MOV",TAB,"D,A",RS ; 57
3879 15A2 3419 DWL C58 ; "MOV",TAB,"E,B",RS ; 58
3880 15A4 3C19 DWL C59 ; "MOV",TAB,"E,C",RS ; 59
3881 15A6 4419 DWL C5A ; "MOV",TAB,"E,D",RS ; 5A
3882 15A8 4C19 DWL C5B ; "MOV",TAB,"E,E",RS ; 5B
3883 15AA 5419 DWL C5C ; "MOV",TAB,"E,H",RS ; 5C
3884 15AC 5C19 DWL C5D ; "MOV",TAB,"E,L",RS ; 5D
3885 15AE 6419 DWL C5E ; "MOV",TAB,"E,M",RS ; 5E
3886 15B0 6C19 DWL C5F ; "MOV",TAB,"E,A",RS ; 5F
3887 15B2 7419 DWL C60 ; "MOV",TAB,"H,B",RS ; 60
3888 15B4 7C19 DWL C61 ; "MOV",TAB,"H,C",RS ; 61
3889 15B6 8419 DWL C62 ; "MOV",TAB,"H,D",RS ; 62
3890 15B8 8C19 DWL C63 ; "MOV",TAB,"H,E",RS ; 63
3891 15BA 9419 DWL C64 ; "MOV",TAB,"H,H",RS ; 64
3892 15BC 9C19 DWL C65 ; "MOV",TAB,"H,L",RS ; 65
3893 15BE A419 DWL C66 ; "MOV",TAB,"H,M",RS ; 66
3894 15C0 AC19 DWL C67 ; "MOV",TAB,"H,A",RS ; 67
3895 15C2 B419 DWL C68 ; "MOV",TAB,"L,B",RS ; 68
3896 15C4 BC19 DWL C69 ; "MOV",TAB,"L,C",RS ; 69
3897 15C6 C419 DWL C6A ; "MOV",TAB,"L,D",RS ; 6A
3898 15C8 CC19 DWL C6B ; "MOV",TAB,"L,E",RS ; 6B
3899 15CA D419 DWL C6C ; "MOV",TAB,"L,H",RS ; 6C
3900 15CC DC19 DWL C6D ; "MOV",TAB,"L,L",RS ; 6D
3901 15CE E419 DWL C6E ; "MOV",TAB,"L,M",RS ; 6E
3902 15D0 EC19 DWL C6F ; "MOV",TAB,"L,A",RS ; 6F
3903 15D2 F419 DWL C70 ; "MOV",TAB,"M,B",RS ; 70
3904 15D4 FC19 DWL C71 ; "MOV",TAB,"M,C",RS ; 71
3905 15D6 041A DWL C72 ; "MOV",TAB,"M,D",RS ; 72
3906 15D8 0C1A DWL C73 ; "MOV",TAB,"M,E",RS ; 73
3907 15DA 141A DWL C74 ; "MOV",TAB,"M,H",RS ; 74
3908 15DC 1C1A DWL C75 ; "MOV",TAB,"M,L",RS ; 75
3909 15DE 241A DWL C76 ; "HLT",TAB,RS ; 76
3910 15E0 291A DWL C77 ; "MOV",TAB,"M,A",RS ; 77
3911 15E2 311A DWL C78 ; "MOV",TAB,"A,B",RS ; 78
3912 15E4 391A DWL C79 ; "MOV",TAB,"A,C",RS ; 79
3913 15E6 411A DWL C7A ; "MOV",TAB,"A,D",RS ; 7A
3914 15E8 491A DWL C7B ; "MOV",TAB,"A,E",RS ; 7B
3915 15EA 511A DWL C7C ; "MOV",TAB,"A,H",RS ; 7C
3916 15EC 591A DWL C7D ; "MOV",TAB,"A,L",RS ; 7D
3917 15EE 611A DWL C7E ; "MOV",TAB,"A,M",RS ; 7E
3918 15F0 691A DWL C7F ; "MOV",TAB,"A,A",RS ; 7F
3919 15F2 711A DWL C80 ; "ADD",TAB,"B",RS ; 80
3920 15F4 771A DWL C81 ; "ADD",TAB,"C",RS ; 81
3921 15F6 7D1A DWL C82 ; "ADD",TAB,"D",RS ; 82
3922 15F8 831A DWL C83 ; "ADD",TAB,"E",RS ; 83
3923 15FA 891A DWL C84 ; "ADD",TAB,"H",RS ; 84
3924 15FC 8F1A DWL C85 ; "ADD",TAB,"L",RS ; 85
3925 15FE 951A DWL C86 ; "ADD",TAB,"M",RS ; 86
3926 1600 9B1A DWL C87 ; "ADD",TAB,"A",RS ; 87
3927 1602 A11A DWL C88 ; "ADC",TAB,"B",RS ; 88
3928 1604 A71A DWL C89 ; "ADC",TAB,"C",RS ; 89
3929 1606 AD1A DWL C8A ; "ADC",TAB,"D",RS ; 8A
3930 1608 B31A DWL C8B ; "ADC",TAB,"E",RS ; 8B
3931 160A B91A DWL C8C ; "ADC",TAB,"H",RS ; 8C
3932 160C BF1A DWL C8D ; "ADC",TAB,"L",RS ; 8D
3933 160E C51A DWL C8E ; "ADC",TAB,"M",RS ; 8E
3934 1610 CB1A DWL C8F ; "ADC",TAB,"A",RS ; 8F
3935 1612 D11A DWL C90 ; "SUB",TAB,"B",RS ; 90
3936 1614 D71A DWL C91 ; "SUB",TAB,"C",RS ; 91
3937 1616 DD1A DWL C92 ; "SUB",TAB,"D",RS ; 92
3938 1618 E31A DWL C93 ; "SUB",TAB,"E",RS ; 93
3939 161A E91A DWL C94 ; "SUB",TAB,"H",RS ; 94
3940 161C EF1A DWL C95 ; "SUB",TAB,"L",RS ; 95
3941 161E F51A DWL C96 ; "SUB",TAB,"M",RS ; 96
3942 1620 FB1A DWL C97 ; "SUB",TAB,"A",RS ; 97
3943 1622 011B DWL C98 ; "SBB",TAB,"B",RS ; 98
3944 1624 071B DWL C99 ; "SBB",TAB,"C",RS ; 99
3945 1626 0D1B DWL C9A ; "SBB",TAB,"D",RS ; 9A
3946 1628 131B DWL C9B ; "SBB",TAB,"E",RS ; 9B
3947 162A 191B DWL C9C ; "SBB",TAB,"H",RS ; 9C
3948 162C 1F1B DWL C9D ; "SBB",TAB,"L",RS ; 9D
3949 162E 251B DWL C9E ; "SBB",TAB,"M",RS ; 9E
3950 1630 2B1B DWL C9F ; "SBB",TAB,"A",RS ; 9F
3951 1632 311B DWL CA0 ; "ANA",TAB,"B",RS ; A0
3952 1634 371B DWL CA1 ; "ANA",TAB,"C",RS ; A1

Page 52 of 63
A8085.LST 29/3/2558 15:27

3953 1636 3D1B DWL CA2 ; "ANA",TAB,"D",RS ; A2


3954 1638 431B DWL CA3 ; "ANA",TAB,"E",RS ; A3
3955 163A 491B DWL CA4 ; "ANA",TAB,"H",RS ; A4
3956 163C 4F1B DWL CA5 ; "ANA",TAB,"L",RS ; A5
3957 163E 551B DWL CA6 ; "ANA",TAB,"M",RS ; A6
3958 1640 5B1B DWL CA7 ; "ANA",TAB,"A",RS ; A7
3959 1642 611B DWL CA8 ; "XRA",TAB,"B",RS ; A8
3960 1644 671B DWL CA9 ; "XRA",TAB,"C",RS ; A9
3961 1646 6D1B DWL CAA ; "XRA",TAB,"D",RS ; AA
3962 1648 731B DWL CAB ; "XRA",TAB,"E",RS ; AB
3963 164A 791B DWL CAC ; "XRA",TAB,"H",RS ; AC
3964 164C 7F1B DWL CAD ; "XRA",TAB,"L",RS ; AD
3965 164E 851B DWL CAE ; "XRA",TAB,"M",RS ; AE
3966 1650 8B1B DWL CAF ; "XRA",TAB,"A",RS ; AF
3967 1652 911B DWL CB0 ; "ORA",TAB,"B",RS ; B0
3968 1654 971B DWL CB1 ; "ORA",TAB,"C",RS ; B1
3969 1656 9D1B DWL CB2 ; "ORA",TAB,"D",RS ; B2
3970 1658 A31B DWL CB3 ; "ORA",TAB,"E",RS ; B3
3971 165A A91B DWL CB4 ; "ORA",TAB,"H",RS ; B4
3972 165C AF1B DWL CB5 ; "ORA",TAB,"L",RS ; B5
3973 165E B51B DWL CB6 ; "ORA",TAB,"M",RS ; B6
3974 1660 BB1B DWL CB7 ; "ORA",TAB,"A",RS ; B7
3975 1662 C11B DWL CB8 ; "CMP",TAB,"B",RS ; B8
3976 1664 C71B DWL CB9 ; "CMP",TAB,"C",RS ; B9
3977 1666 CD1B DWL CBA ; "CMP",TAB,"D",RS ; BA
3978 1668 D31B DWL CBB ; "CMP",TAB,"E",RS ; BB
3979 166A D91B DWL CBC ; "CMP",TAB,"H",RS ; BC
3980 166C DF1B DWL CBD ; "CMP",TAB,"L",RS ; BD
3981 166E E51B DWL CBE ; "CMP",TAB,"M",RS ; BE
3982 1670 EB1B DWL CBF ; "CMP",TAB,"A",RS ; BF
3983 1672 F11B DWL CC0 ; "RNZ",TAB,RS ; C0
3984 1674 F61B DWL CC1 ; "POP",TAB,"B",RS ; C1
3985 1676 FC1B DWL CC2 ; "JNZ",TAB,RS ; C2
3986 1678 011C DWL CC3 ; "JMP",TAB,RS ; C3
3987 167A 061C DWL CC4 ; "CNZ",TAB,RS ; C4
3988 167C 0B1C DWL CC5 ; "PUSH",TAB,"B",RS ; C5
3989 167E 121C DWL CC6 ; "ADI",TAB,RS ; C6
3990 1680 171C DWL CC7 ; "RST",TAB,"0",RS ; C7
3991 1682 1D1C DWL CC8 ; "RZ",TAB,RS ; C8
3992 1684 211C DWL CC9 ; "RET",TAB,RS ; C9
3993 1686 261C DWL CCA ; "JZ",TAB,RS ; CA
3994 1688 2A1C DWL CCB ; "DFB",TAB,RS ; CB
3995 168A 2F1C DWL CCC ; "CZ",TAB,RS ; CC
3996 168C 331C DWL CCD ; "CALL",TAB,RS ; CD
3997 168E 391C DWL CCE ; "ACI",TAB,RS ; CE
3998 1690 3E1C DWL CCF ; "RST",TAB,"1",RS ; CF
3999 1692 441C DWL CD0 ; "RNC",TAB,RS ; D0
4000 1694 491C DWL CD1 ; "POP",TAB,"D",RS ; D1
4001 1696 4F1C DWL CD2 ; "JNC",TAB,RS ; D2
4002 1698 541C DWL CD3 ; "OUT",TAB,RS ; D3
4003 169A 591C DWL CD4 ; "CNC",TAB,RS ; D4
4004 169C 5E1C DWL CD5 ; "PUSH",TAB,"D",RS ; D5
4005 169E 651C DWL CD6 ; "SUI",TAB,RS ; D6
4006 16A0 6A1C DWL CD7 ; "RST",TAB,"2",RS ; D7
4007 16A2 701C DWL CD8 ; "RC",TAB,RS ; D8
4008 16A4 741C DWL CD9 ; "DFB",TAB,RS ; D9
4009 16A6 791C DWL CDA ; "JC",TAB,RS ; DA
4010 16A8 7D1C DWL CDB ; "IN",TAB,RS ; DFB
4011 16AA 811C DWL CDC ; "CC",TAB,RS ; DC
4012 16AC 851C DWL CDD ; "DFB",TAB,RS ; DD
4013 16AE 8A1C DWL CDE ; "SBI",TAB,RS ; DE
4014 16B0 8F1C DWL CDF ; "RST",TAB,"3",RS ; DF
4015 16B2 951C DWL CE0 ; "RPO",TAB,RS ; E0
4016 16B4 9A1C DWL CE1 ; "POP",TAB,"H",RS ; E1
4017 16B6 A01C DWL CE2 ; "JPO",TAB,RS ; E2
4018 16B8 A51C DWL CE3 ; "XTHL",TAB,RS ; E3
4019 16BA AB1C DWL CE4 ; "CPO",TAB,RS ; E4
4020 16BC B01C DWL CE5 ; "PUSH",TAB,"H",RS ; E5
4021 16BE B71C DWL CE6 ; "ANI",TAB,RS ; E6
4022 16C0 BC1C DWL CE7 ; "RST",TAB,"4",RS ; E7
4023 16C2 C21C DWL CE8 ; "RPE",TAB,RS ; E8
4024 16C4 C71C DWL CE9 ; "PCHL",TAB,RS ; E9
4025 16C6 CD1C DWL CEA ; "JPE",TAB,RS ; EA
4026 16C8 D21C DWL CEB ; "XCHG",TAB,RS ; EB
4027 16CA D81C DWL CEC ; "CPE",TAB,RS ; EC
4028 16CC DD1C DWL CED ; "DFB",TAB,RS ; ED

Page 53 of 63
A8085.LST 29/3/2558 15:27

4029 16CE E21C DWL CEE ; "XRI",TAB,RS ;


EE
4030 16D0 E71C DWL CEF ; "RST",TAB,"5",RS ;
EF
4031 16D2 ED1C DWL CF0 ; "RP",TAB,RS ;
F0
4032 16D4 F11C DWL CF1 ; "POP",TAB,"PSW",RS ;
F1
4033 16D6 F91C DWL CF2 ; "JP",TAB,RS ;
F2
4034 16D8 FD1C DWL CF3 ; "DI",TAB,RS ;
F3
4035 16DA 011D DWL CF4 ; "CP",TAB,RS ;
F4
4036 16DC 051D DWL CF5 ; "PUSH",TAB,"PSW",RS ;
F5
4037 16DE 0E1D DWL CF6 ; "ORI",TAB,RS ;
F6
4038 16E0 131D DWL CF7 ; "RST",TAB,"6",RS ;
F7
4039 16E2 191D DWL CF8 ; "RM",TAB,RS ;
F8
4040 16E4 1D1D DWL CF9 ; "SPHL",TAB,RS ;
F9
4041 16E6 231D DWL CFA ; "JM",TAB,RS ;
FA
4042 16E8 271D DWL CFB ; "EI",TAB,RS ;
FB
4043 16EA 2B1D DWL CFC ; "CM",TAB,RS ;
FC
4044 16EC 2F1D DWL CFD ; "DFB",TAB,RS ; FD
4045 16EE 341D DWL CFE ; "CPI",TAB,RS ; FE
4046 16F0 391D DWL CFF ; "RST",TAB,"7",RS, ; FF
4047
4048 ; --------- mnemonic table ---------------------------------------
4049
4050
4051 16F2 MNEM
4052 16F2 4E4F500900C0 DFB "NOP",TAB,RS ; 00
4053 16F7 4C58490942C1 DFB "LXI",TAB,"B,",RS ; 01
4054 16FE 5354415809C2 DFB "STAX",TAB,"B",RS ; 02
4055 1705 494E580942C3 DFB "INX",TAB,"B",RS ; 03
4056 170B 494E520942C4 DFB "INR",TAB,"B",RS ; 04
4057 1711 4443520942C5 DFB "DCR",TAB,"B",RS ; 05
4058 1717 4D56490942C6 DFB "MVI",TAB,"B,",RS ; 06
4059 171E 524C430900C7 DFB "RLC",TAB,RS ; 07
4060 1723 4446420900C8 DFB "DFB",TAB,RS ; 08
4061 1728 4441440942C9 DFB "DAD",TAB,"B",RS ; 09
4062 172E 4C44415809CA DFB "LDAX",TAB,"B",RS ; 0A
4063 1735 4443580942CB DFB "DCX",TAB,"B",RS ; 0B
4064 173B 494E520943CC DFB "INR",TAB,"C",RS ; 0C
4065 1741 4443520943CD DFB "DCR",TAB,"C",RS ; 0D
4066 1747 4D56490943CE DFB "MVI",TAB,"C,",RS ; 0E
4067 174E 5252430900CF DFB "RRC",TAB,RS ; 0F
4068 1753 4446420900C10 DFB "DFB",TAB,RS ; 10
4069 1758 4C58490944C11 DFB "LXI",TAB,"D,",RS ; 11
4070 175F 5354415809C12 DFB "STAX",TAB,"D",RS ; 12
4071 1766 494E580944C13 DFB "INX",TAB,"D",RS ; 13
4072 176C 494E520944C14 DFB "INR",TAB,"D",RS ; 14
4073 1772 4443520944C15 DFB "DCR",TAB,"D",RS ; 15
4074 1778 4D56490944C16 DFB "MVI",TAB,"D,",RS ; 16
4075 177F 52414C0900C17 DFB "RAL",TAB,RS ; 17
4076 1784 4446420900C18 DFB "DFB",TAB,RS ; 18
4077 1789 4441440944C19 DFB "DAD",TAB,"D",RS ; 19
4078 178F 4C44415809C1A DFB "LDAX",TAB,"D",RS ; 1A
4079 1796 4443580944C1B DFB "DCX",TAB,"D",RS ; 1B
4080 179C 494E520945C1C DFB "INR",TAB,"E",RS ; 1C
4081 17A2 4443520945C1D DFB "DCR",TAB,"E",RS ; 1D
4082 17A8 4D56490945C1E DFB "MVI",TAB,"E,",RS ; 1E
4083 17AF 5241520900C1F DFB "RAR",TAB,RS ; 1F
4084 17B4 52494D0900C20 DFB "RIM",TAB,RS ; 20
4085 17B9 4C58490948C21 DFB "LXI",TAB,"H,",RS ; 21
4086 17C0 53484C4409C22 DFB "SHLD",TAB,RS ; 22
4087 17C6 494E580948C23 DFB "INX",TAB,"H",RS ; 23
4088 17CC 494E520948C24 DFB "INR",TAB,"H",RS ; 24
4089 17D2 4443520948C25 DFB "DCR",TAB,"H",RS ; 25
4090 17D8 4D56490948C26 DFB "MVI",TAB,"H,",RS ; 26
4091 17DF 4441410900C27 DFB "DAA",TAB,RS ; 27
4092 17E4 4446420900C28 DFB "DFB",TAB,RS ; 28
4093 17E9 4441440948C29 DFB "DAD",TAB,"H",RS ; 29
4094 17EF 4C484C4409C2A DFB "LHLD",TAB,RS ; 2A
4095 17F5 4443580948C2B DFB "DCX",TAB,"H",RS ; 2B
4096 17FB 494E52094CC2C DFB "INR",TAB,"L",RS ; 2C
4097 1801 444352094CC2D DFB "DCR",TAB,"L",RS ; 2D
4098 1807 4D5649094CC2E DFB "MVI",TAB,"L,",RS ; 2E
4099 180E 434D410900C2F DFB "CMA",TAB,RS ; 2F
4100 1813 53494D0900C30 DFB "SIM",TAB,RS ; 30
4101 1818 4C58490953C31 DFB "LXI",TAB,"SP,",RS ; 31
4102 1820 5354410900C32 DFB "STA",TAB,RS ; 32
4103 1825 494E580953C33 DFB "INX",TAB,"SP",RS ; 33
4104 182C 494E52094DC34 DFB "INR",TAB,"M",RS ; 34

Page 54 of 63
A8085.LST 29/3/2558 15:27

4105 1832 444352094DC35 DFB "DCR",TAB,"M",RS ; 35


4106 1838 4D5649094DC36 DFB "MVI",TAB,"M,",RS ; 36
4107 183F 5354430900C37 DFB "STC",TAB,RS ; 37
4108 1844 4446420900C38 DFB "DFB",TAB,RS ; 38
4109 1849 4441440953C39 DFB "DAD",TAB,"SP",RS ; 39
4110 1850 4C44410900C3A DFB "LDA",TAB,RS ; 3A
4111 1855 4443580953C3B DFB "DCX",TAB,"SP",RS ; 3B
4112 185C 494E520941C3C DFB "INR",TAB,"A",RS ; 3C
4113 1862 4443520941C3D DFB "DCR",TAB,"A",RS ; 3D
4114 1868 4D56490941C3E DFB "MVI",TAB,"A,",RS ; 3E
4115 186F 434D430900C3F DFB "CMC",TAB,RS ; 3F
4116 1874 4D4F560942C40 DFB "MOV",TAB,"B,B",RS ; 40
4117 187C 4D4F560942C41 DFB "MOV",TAB,"B,C",RS ; 41
4118 1884 4D4F560942C42 DFB "MOV",TAB,"B,D",RS ; 42
4119 188C 4D4F560942C43 DFB "MOV",TAB,"B,E",RS ; 43
4120 1894 4D4F560942C44 DFB "MOV",TAB,"B,H",RS ; 44
4121 189C 4D4F560942C45 DFB "MOV",TAB,"B,L",RS ; 45
4122 18A4 4D4F560942C46 DFB "MOV",TAB,"B,M",RS ; 46
4123 18AC 4D4F560942C47 DFB "MOV",TAB,"B,A",RS ; 47
4124 18B4 4D4F560943C48 DFB "MOV",TAB,"C,B",RS ; 48
4125 18BC 4D4F560943C49 DFB "MOV",TAB,"C,C",RS ; 49
4126 18C4 4D4F560943C4A DFB "MOV",TAB,"C,D",RS ; 4A
4127 18CC 4D4F560943C4B DFB "MOV",TAB,"C,E",RS ; 4B
4128 18D4 4D4F560943C4C DFB "MOV",TAB,"C,H",RS ; 4C
4129 18DC 4D4F560943C4D DFB "MOV",TAB,"C,L",RS ; 4D
4130 18E4 4D4F560943C4E DFB "MOV",TAB,"C,M",RS ; 4E
4131 18EC 4D4F560943C4F DFB "MOV",TAB,"C,A",RS ; 4F
4132 18F4 4D4F560944C50 DFB "MOV",TAB,"D,B",RS ; 50
4133 18FC 4D4F560944C51 DFB "MOV",TAB,"D,C",RS ; 51
4134 1904 4D4F560944C52 DFB "MOV",TAB,"D,D",RS ; 52
4135 190C 4D4F560944C53 DFB "MOV",TAB,"D,E",RS ; 53
4136 1914 4D4F560944C54 DFB "MOV",TAB,"D,H",RS ; 54
4137 191C 4D4F560944C55 DFB "MOV",TAB,"D,L",RS ; 55
4138 1924 4D4F560944C56 DFB "MOV",TAB,"D,M",RS ; 56
4139 192C 4D4F560944C57 DFB "MOV",TAB,"D,A",RS ; 57
4140 1934 4D4F560945C58 DFB "MOV",TAB,"E,B",RS ; 58
4141 193C 4D4F560945C59 DFB "MOV",TAB,"E,C",RS ; 59
4142 1944 4D4F560945C5A DFB "MOV",TAB,"E,D",RS ; 5A
4143 194C 4D4F560945C5B DFB "MOV",TAB,"E,E",RS ; 5B
4144 1954 4D4F560945C5C DFB "MOV",TAB,"E,H",RS ; 5C
4145 195C 4D4F560945C5D DFB "MOV",TAB,"E,L",RS ; 5D
4146 1964 4D4F560945C5E DFB "MOV",TAB,"E,M",RS ; 5E
4147 196C 4D4F560945C5F DFB "MOV",TAB,"E,A",RS ; 5F
4148 1974 4D4F560948C60 DFB "MOV",TAB,"H,B",RS ; 60
4149 197C 4D4F560948C61 DFB "MOV",TAB,"H,C",RS ; 61
4150 1984 4D4F560948C62 DFB "MOV",TAB,"H,D",RS ; 62
4151 198C 4D4F560948C63 DFB "MOV",TAB,"H,E",RS ; 63
4152 1994 4D4F560948C64 DFB "MOV",TAB,"H,H",RS ; 64
4153 199C 4D4F560948C65 DFB "MOV",TAB,"H,L",RS ; 65
4154 19A4 4D4F560948C66 DFB "MOV",TAB,"H,M",RS ; 66
4155 19AC 4D4F560948C67 DFB "MOV",TAB,"H,A",RS ; 67
4156 19B4 4D4F56094CC68 DFB "MOV",TAB,"L,B",RS ; 68
4157 19BC 4D4F56094CC69 DFB "MOV",TAB,"L,C",RS ; 69
4158 19C4 4D4F56094CC6A DFB "MOV",TAB,"L,D",RS ; 6A
4159 19CC 4D4F56094CC6B DFB "MOV",TAB,"L,E",RS ; 6B
4160 19D4 4D4F56094CC6C DFB "MOV",TAB,"L,H",RS ; 6C
4161 19DC 4D4F56094CC6D DFB "MOV",TAB,"L,L",RS ; 6D
4162 19E4 4D4F56094CC6E DFB "MOV",TAB,"L,M",RS ; 6E
4163 19EC 4D4F56094CC6F DFB "MOV",TAB,"L,A",RS ; 6F
4164 19F4 4D4F56094DC70 DFB "MOV",TAB,"M,B",RS ; 70
4165 19FC 4D4F56094DC71 DFB "MOV",TAB,"M,C",RS ; 71
4166 1A04 4D4F56094DC72 DFB "MOV",TAB,"M,D",RS ; 72
4167 1A0C 4D4F56094DC73 DFB "MOV",TAB,"M,E",RS ; 73
4168 1A14 4D4F56094DC74 DFB "MOV",TAB,"M,H",RS ; 74
4169 1A1C 4D4F56094DC75 DFB "MOV",TAB,"M,L",RS ; 75
4170 1A24 484C540900C76 DFB "HLT",TAB,RS ; 76
4171 1A29 4D4F56094DC77 DFB "MOV",TAB,"M,A",RS ; 77
4172 1A31 4D4F560941C78 DFB "MOV",TAB,"A,B",RS ; 78
4173 1A39 4D4F560941C79 DFB "MOV",TAB,"A,C",RS ; 79
4174 1A41 4D4F560941C7A DFB "MOV",TAB,"A,D",RS ; 7A
4175 1A49 4D4F560941C7B DFB "MOV",TAB,"A,E",RS ; 7B
4176 1A51 4D4F560941C7C DFB "MOV",TAB,"A,H",RS ; 7C
4177 1A59 4D4F560941C7D DFB "MOV",TAB,"A,L",RS ; 7D
4178 1A61 4D4F560941C7E DFB "MOV",TAB,"A,M",RS ; 7E
4179 1A69 4D4F560941C7F DFB "MOV",TAB,"A,A",RS ; 7F
4180 1A71 4144440942C80 DFB "ADD",TAB,"B",RS ; 80

Page 55 of 63
A8085.LST 29/3/2558 15:27

4181 1A77 4144440943C81 DFB "ADD",TAB,"C",RS ; 81


4182 1A7D 4144440944C82 DFB "ADD",TAB,"D",RS ; 82
4183 1A83 4144440945C83 DFB "ADD",TAB,"E",RS ; 83
4184 1A89 4144440948C84 DFB "ADD",TAB,"H",RS ; 84
4185 1A8F 414444094CC85 DFB "ADD",TAB,"L",RS ; 85
4186 1A95 414444094DC86 DFB "ADD",TAB,"M",RS ; 86
4187 1A9B 4144440941C87 DFB "ADD",TAB,"A",RS ; 87
4188 1AA1 4144430942C88 DFB "ADC",TAB,"B",RS ; 88
4189 1AA7 4144430943C89 DFB "ADC",TAB,"C",RS ; 89
4190 1AAD 4144430944C8A DFB "ADC",TAB,"D",RS ; 8A
4191 1AB3 4144430945C8B DFB "ADC",TAB,"E",RS ; 8B
4192 1AB9 4144430948C8C DFB "ADC",TAB,"H",RS ; 8C
4193 1ABF 414443094CC8D DFB "ADC",TAB,"L",RS ; 8D
4194 1AC5 414443094DC8E DFB "ADC",TAB,"M",RS ; 8E
4195 1ACB 4144430941C8F DFB "ADC",TAB,"A",RS ; 8F
4196 1AD1 5355420942C90 DFB "SUB",TAB,"B",RS ; 90
4197 1AD7 5355420943C91 DFB "SUB",TAB,"C",RS ; 91
4198 1ADD 5355420944C92 DFB "SUB",TAB,"D",RS ; 92
4199 1AE3 5355420945C93 DFB "SUB",TAB,"E",RS ; 93
4200 1AE9 5355420948C94 DFB "SUB",TAB,"H",RS ; 94
4201 1AEF 535542094CC95 DFB "SUB",TAB,"L",RS ; 95
4202 1AF5 535542094DC96 DFB "SUB",TAB,"M",RS ; 96
4203 1AFB 5355420941C97 DFB "SUB",TAB,"A",RS ; 97
4204 1B01 5342420942C98 DFB "SBB",TAB,"B",RS ; 98
4205 1B07 5342420943C99 DFB "SBB",TAB,"C",RS ; 99
4206 1B0D 5342420944C9A DFB "SBB",TAB,"D",RS ; 9A
4207 1B13 5342420945C9B DFB "SBB",TAB,"E",RS ; 9B
4208 1B19 5342420948C9C DFB "SBB",TAB,"H",RS ; 9C
4209 1B1F 534242094CC9D DFB "SBB",TAB,"L",RS ; 9D
4210 1B25 534242094DC9E DFB "SBB",TAB,"M",RS ; 9E
4211 1B2B 5342420941C9F DFB "SBB",TAB,"A",RS ; 9F
4212 1B31 414E410942CA0 DFB "ANA",TAB,"B",RS ; A0
4213 1B37 414E410943CA1 DFB "ANA",TAB,"C",RS ; A1
4214 1B3D 414E410944CA2 DFB "ANA",TAB,"D",RS ; A2
4215 1B43 414E410945CA3 DFB "ANA",TAB,"E",RS ; A3
4216 1B49 414E410948CA4 DFB "ANA",TAB,"H",RS ; A4
4217 1B4F 414E41094CCA5 DFB "ANA",TAB,"L",RS ; A5
4218 1B55 414E41094DCA6 DFB "ANA",TAB,"M",RS ; A6
4219 1B5B 414E410941CA7 DFB "ANA",TAB,"A",RS ; A7
4220 1B61 5852410942CA8 DFB "XRA",TAB,"B",RS ; A8
4221 1B67 5852410943CA9 DFB "XRA",TAB,"C",RS ; A9
4222 1B6D 5852410944CAA DFB "XRA",TAB,"D",RS ; AA
4223 1B73 5852410945CAB DFB "XRA",TAB,"E",RS ; AB
4224 1B79 5852410948CAC DFB "XRA",TAB,"H",RS ; AC
4225 1B7F 585241094CCAD DFB "XRA",TAB,"L",RS ; AD
4226 1B85 585241094DCAE DFB "XRA",TAB,"M",RS ; AE
4227 1B8B 5852410941CAF DFB "XRA",TAB,"A",RS ; AF
4228 1B91 4F52410942CB0 DFB "ORA",TAB,"B",RS ; B0
4229 1B97 4F52410943CB1 DFB "ORA",TAB,"C",RS ; B1
4230 1B9D 4F52410944CB2 DFB "ORA",TAB,"D",RS ; B2
4231 1BA3 4F52410945CB3 DFB "ORA",TAB,"E",RS ; B3
4232 1BA9 4F52410948CB4 DFB "ORA",TAB,"H",RS ; B4
4233 1BAF 4F5241094CCB5 DFB "ORA",TAB,"L",RS ; B5
4234 1BB5 4F5241094DCB6 DFB "ORA",TAB,"M",RS ; B6
4235 1BBB 4F52410941CB7 DFB "ORA",TAB,"A",RS ; B7
4236 1BC1 434D500942CB8 DFB "CMP",TAB,"B",RS ; B8
4237 1BC7 434D500943CB9 DFB "CMP",TAB,"C",RS ; B9
4238 1BCD 434D500944CBA DFB "CMP",TAB,"D",RS ; BA
4239 1BD3 434D500945CBB DFB "CMP",TAB,"E",RS ; BB
4240 1BD9 434D500948CBC DFB "CMP",TAB,"H",RS ; BC
4241 1BDF 434D50094CCBD DFB "CMP",TAB,"L",RS ; BD
4242 1BE5 434D50094DCBE DFB "CMP",TAB,"M",RS ; BE
4243 1BEB 434D500941CBF DFB "CMP",TAB,"A",RS ; BF
4244 1BF1 524E5A0900CC0 DFB "RNZ",TAB,RS ; C0
4245 1BF6 504F500942CC1 DFB "POP",TAB,"B",RS ; C1
4246 1BFC 4A4E5A0900CC2 DFB "JNZ",TAB,RS ; C2
4247 1C01 4A4D500900CC3 DFB "JMP",TAB,RS ; C3
4248 1C06 434E5A0900CC4 DFB "CNZ",TAB,RS ; C4
4249 1C0B 5055534809CC5 DFB "PUSH",TAB,"B",RS ; C5
4250 1C12 4144490900CC6 DFB "ADI",TAB,RS ; C6
4251 1C17 5253540930CC7 DFB "RST",TAB,"0",RS ; C7
4252 1C1D 525A0900 CC8 DFB "RZ",TAB,RS ; C8
4253 1C21 5245540900CC9 DFB "RET",TAB,RS ; C9
4254 1C26 4A5A0900 CCA DFB "JZ",TAB,RS ; CA
4255 1C2A 4446420900CCB DFB "DFB",TAB,RS ; CB
4256 1C2F 435A0900 CCC DFB "CZ",TAB,RS ; CC

Page 56 of 63
A8085.LST 29/3/2558 15:27

4257 1C33 43414C4C09CCD DFB "CALL",TAB,RS ; CD


4258 1C39 4143490900CCE DFB "ACI",TAB,RS ; CE
4259 1C3E 5253540931CCF DFB "RST",TAB,"1",RS ; CF
4260 1C44 524E430900CD0 DFB "RNC",TAB,RS ; D0
4261 1C49 504F500944CD1 DFB "POP",TAB,"D",RS ; D1
4262 1C4F 4A4E430900CD2 DFB "JNC",TAB,RS ; D2
4263 1C54 4F55540900CD3 DFB "OUT",TAB,RS ; D3
4264 1C59 434E430900CD4 DFB "CNC",TAB,RS ; D4
4265 1C5E 5055534809CD5 DFB "PUSH",TAB,"D",RS ; D5
4266 1C65 5355490900CD6 DFB "SUI",TAB,RS ; D6
4267 1C6A 5253540932CD7 DFB "RST",TAB,"2",RS ; D7
4268 1C70 52430900 CD8 DFB "RC",TAB,RS ; D8
4269 1C74 4446420900CD9 DFB "DFB",TAB,RS ; D9
4270 1C79 4A430900 CDA DFB "JC",TAB,RS ; DA
4271 1C7D 494E0900 CDB DFB "IN",TAB,RS ; DFB
4272 1C81 43430900 CDC DFB "CC",TAB,RS ; DC
4273 1C85 4446420900CDD DFB "DFB",TAB,RS ; DD
4274 1C8A 5342490900CDE DFB "SBI",TAB,RS ; DE
4275 1C8F 5253540933CDF DFB "RST",TAB,"3",RS ; DF
4276 1C95 52504F0900CE0 DFB "RPO",TAB,RS ; E0
4277 1C9A 504F500948CE1 DFB "POP",TAB,"H",RS ; E1
4278 1CA0 4A504F0900CE2 DFB "JPO",TAB,RS ; E2
4279 1CA5 5854484C09CE3 DFB "XTHL",TAB,RS ; E3
4280 1CAB 43504F0900CE4 DFB "CPO",TAB,RS ; E4
4281 1CB0 5055534809CE5 DFB "PUSH",TAB,"H",RS ; E5
4282 1CB7 414E490900CE6 DFB "ANI",TAB,RS ; E6
4283 1CBC 5253540934CE7 DFB "RST",TAB,"4",RS ; E7
4284 1CC2 5250450900CE8 DFB "RPE",TAB,RS ; E8
4285 1CC7 5043484C09CE9 DFB "PCHL",TAB,RS ; E9
4286 1CCD 4A50450900CEA DFB "JPE",TAB,RS ; EA
4287 1CD2 5843484709CEB DFB "XCHG",TAB,RS ; EB
4288 1CD8 4350450900CEC DFB "CPE",TAB,RS ; EC
4289 1CDD 4446420900CED DFB "DFB",TAB,RS ; ED
4290 1CE2 5852490900CEE DFB "XRI",TAB,RS ; EE
4291 1CE7 5253540935CEF DFB "RST",TAB,"5",RS ; EF
4292 1CED 52500900 CF0 DFB "RP",TAB,RS ; F0
4293 1CF1 504F500950CF1 DFB "POP",TAB,"PSW",RS ; F1
4294 1CF9 4A500900 CF2 DFB "JP",TAB,RS ; F2
4295 1CFD 44490900 CF3 DFB "DI",TAB,RS ; F3
4296 1D01 43500900 CF4 DFB "CP",TAB,RS ; F4
4297 1D05 5055534809CF5 DFB "PUSH",TAB,"PSW",RS ; F5
4298 1D0E 4F52490900CF6 DFB "ORI",TAB,RS ; F6
4299 1D13 5253540936CF7 DFB "RST",TAB,"6",RS ; F7
4300 1D19 524D0900 CF8 DFB "RM",TAB,RS ; F8
4301 1D1D 5350484C09CF9 DFB "SPHL",TAB,RS ; F9
4302 1D23 4A4D0900 CFA DFB "JM",TAB,RS ; FA
4303 1D27 45490900 CFB DFB "EI",TAB,RS ; FB
4304 1D2B 434D0900 CFC DFB "CM",TAB,RS ; FC
4305 1D2F 4446420900CFD DFB "DFB",TAB,RS ; FD
4306 1D34 4350490900CFE DFB "CPI",TAB,RS ; FE
4307 1D39 5253540937CFF DFB "RST",TAB,"7",RS, ; FF
4308
4309
4310
4311 1D3F 0D0A0A4D54prompt1: dfb cr,lf,lf,"MTK-85 8085 MICROPROCESSOR TRAINING KIT (? HELP)",CR,L
4312
4313 1D75 3F065B4F66convert dfb 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71h
4314
4315 1D85 0000000000off_display: dfb 0,0,0,0,0,0
4316
4317 ; lcd message |--- 20 letters ---|
4318 1D8B 4D544B2D38prompt2: dfb "MTK-85 8085 MICROPRO",0
4319 1DA0 434553534Ftext3: dfb "CESSOR TRAINING KIT",0
4320
4321
4322 1DB4 6C6F616420download_text: dfb "load Intel hex file...",0
4323 1DCB 3E00 prompt_text: dfb ">",0
4324 1DCD 6E6577206Cnew_text: dfb "new location = ",0
4325 1DDD 6564697420edit_text: dfb "edit memory location = ",0
4326 1DF5 0D0A456E74edit_text1: dfb cr,lf,"Enter to quit, SPACE key to view content",0
4327 1E20 0D0A0A4144edit_text2: dfb cr,lf,lf,"ADDR DATA",0
4328
4329 1E2E 6A756D7020jump_text1: dfb "jump to address [",0
4330 1E40 5D203D2000jump_text2: dfb "] = ",0
4331 1E45 7072696E74ascii_text: dfb "print ASCII code",0
4332

Page 57 of 63
A8085.LST 29/3/2558 15:27

4333 1E56 426567696Efill_text1: dfb "Begin address = ",0


4334 1E67 20456E6420fill_text2: dfb " End address = ",0
4335 1E77 2044617461fill_text3: dfb " Data = ",0
4336
4337 1E80 206572726Ferror_text: dfb " errors",0
4338
4339 1E88 6469736173disassemble_text: dfb "disassemble...",0
4340
4341 0000 = eos equ 0
4342
4343 1E97 41463D00 af_text: dfb "AF=",eos
4344 1E9B 42433D00 bc_text: dfb "BC=",eos
4345 1E9F 44453D00 de_text: dfb "DE=",eos
4346 1EA3 484C3D00 hl_text: dfb "HL=",eos
4347 1EA7 53503D00 sp_text: dfb "SP=",eos
4348 1EAB 544F533D00tos_text: dfb "TOS=",eos
4349
4350 1EB0 50433D00 pc_text: dfb "PC=",eos
4351 1EB4 5B53205A20flag_text: dfb "[S Z - AC - P - CY]=",eos
4352
4353 1ECA 533D00 sign_text: dfb "S=",0
4354
4355 1ECD 2062797465byte_text: dfb " bytes loaded",0
4356
4357 1EDB 535441434Bstack_text: dfb "STACK Memory Contents..",0
4358
4359 1EF3 7365742076set_register_text: dfb "set value to user register (enter A for AF) ? ",0
4360
4361
4362 1F22 0D0A0A4D54help_text: dfb cr,lf,lf,"MTK-85 8085 MICROPROCESSOR TRAINING KIT (? HELP)"
4363 1F55 0D0A41202Dhelp_text1: dfb cr,lf, "A - ASCII code"
4364 1F65 0D0A43202D dfb cr,lf, "C - clear watch variables"
4365 1F80 0D0A44202D dfb cr,lf, "D - disassemble"
4366 1F91 0D0A45202D dfb cr,lf, "E - edit memory"
4367 1FA2 0D0A46202D dfb cr,lf, "F - fill constant"
4368 1FB5 0D0A48202D dfb cr,lf, "H - hex dump"
4369 1FC3 0D0A49202D dfb cr,lf, "I - i/o address map"
4370 1FD8 0D0A4A202D dfb cr,lf, "J - jump to user program"
4371 1FF2 0D0A4B202D dfb cr,lf, "K - display user STACK"
4372 200A 0D0A4C202D dfb cr,lf, "L - load Intel hex file"
4373 2023 0D0A4D202D dfb cr,lf, "M - monitor call number"
4374 203C 0D0A4E202D dfb cr,lf, "N - new location pointer"
4375 2056 0D0A51202D dfb cr,lf, "Q - quick home location"
4376 206F 0D0A52202D dfb cr,lf, "R - user register display"
4377 208A 0D0A53202D dfb cr,lf, "S - set value to user register"
4378 20AA 0D0A57202D dfb cr,lf, "W - watch variables"
4379 20BF 0D0A535041 dfb cr,lf, "SPACE BAR - single step"
4380 20D8 0D0A3F202D dfb cr,lf, "? - help menu",cr,lf,0
4381
4382
4383 20EA 0D0A303048io_text dfb cr,lf,"00H-0FH onboard 4-bit GPIO, D0-D3=output port"
4384 2119 0D0A202020 dfb cr,lf," D4-D7=input port"
4385 2133 0D0A dfb cr,lf
4386 2135 0D0A313048 dfb cr,lf,"10H-13H 8255 system PPI, 10H=PORTA, 11H=PORTB, 12H=PORTC,
4387 217C 0D0A dfb cr,lf
4388 217E 0D0A323048 dfb cr,lf,"20H-23H 8254 programmable counter, 20H=counter0, 21H= cou
4389 21BE 0D0A202020 dfb cr,lf," 22H=counter2, 23H control register"
4390 21EA 0D0A dfb cr,lf
4391 21EC 0D0A333048 dfb cr,lf,"30H-33H 8255 user PPI, 30H=PORTA, 31H=PORTB, 32H=PORTC, 3
4392 2231 0D0A dfb cr,lf
4393 2233 0D0A343048 dfb cr,lf,"40H-47H C16550 UART registers",0
4394
4395
4396 2253 monitor_text:
4397
4398 2253 7365652069 dfb "see input parameters in user manual",cr,lf
4399 2278 0D0A31456E dfb cr,lf,"1Enn MVI E,function_number"
4400 2294 0D0A434620 dfb cr,lf,"CF RST 1"
4401 22A0 0D0A dfb cr,lf
4402 22A2 0D0A303020 dfb cr,lf,"00 - demo" ; #0 running LED with HL pointer
4403 22AD 0D0A303120 dfb cr,lf,"01 - delay" ; #1 simple delay routine
4404 22B9 0D0A303220 dfb cr,lf,"02 - cold_boot" ; #2 show 8085 running
4405 22C9 0D0A303320 dfb cr,lf,"03 - scan" ; #3 scan display one cycle
4406 22D4 0D0A303420 dfb cr,lf,"04 - cin" ; #4 get byte from console
4407 22DE 0D0A303520 dfb cr,lf,"05 - cout" ; #5 print byte to console
4408 22E9 0D0A303620 dfb cr,lf,"06 - put_str" ; #6 print string with 0 terminator to co

Page 58 of 63
A8085.LST 29/3/2558 15:27

4409 22F7 0D0A303720 dfb cr,lf,"07 - init_lcd" ; #7 initialize lcd


4410 2306 0D0A303820 dfb cr,lf,"08 - lcd_ready" ; #8 wait until lcd is ready
4411 2316 0D0A303920 dfb cr,lf,"09 - clear_lcd" ; #9 clear lcd display
4412 2326 0D0A304120 dfb cr,lf,"0A - goto_xy" ; #10 set lcd cursor position
4413 2334 0D0A304220 dfb cr,lf,"0B - put_str_lcd" ; #11 print ASCII string on lcd
4414 2346 0D0A304320 dfb cr,lf,"0C - put_ch_lcd" ; #12 print ASCII letter on lcd
4415 2357 0D0A304420 dfb cr,lf,"0D - demo2",0 ; #13 run GPIO LED
4416 2364 0D0A304520 dfb cr,lf,"0E - pint16u",0 ;#14 print 16-bit unsigned
4417
4418
4419
4420 ; data segment
4421
4422 F000 org system_ram
4423
4424 F000 watch_ram dfs 16 ; watch variable F000-F00F
4425 F010 buffer dfs 16 ; buffer display
4426 F020 bcs dfs 1 ; byte checksum
4427 F021 key dfs 1 ; key position
4428 F022 command dfs 1 ; serial command
4429 F023 flag1 dfs 1 ; user flag
4430 ; flag.0 Space key was pressed
4431 ; flag.1 Enter key was pressed
4432
4433 F024 uart_found dfs 1 ; 0 = no uart, 1 uart found
4434
4435 F025 entry_mode dfs 1 ; 0 for data mode
4436 ; 1 for address mode
4437 ; 2 register display
4438 F026 counter1 dfs 1 ; event counter1 for data entry
4439 F027 counter2 dfs 1 ; event counter2 for address entry
4440 F028 warm_code dfs 1 ; warm boot code
4441
4442 F029 user_PC dfs 2 ; user PC
4443 F02B user_AF dfs 2 ; user AF
4444 F02D user_BC dfs 2 ; user BC
4445 F02F user_DE dfs 2 ; user DE
4446 F031 user_HL dfs 2 ; user HL
4447 F033 user_SP dfs 2 ; user SP
4448 F035 tos dfs 2 ; Top of STACK
4449 F037 current_register dfs 2 ; stores current displayed register
4450
4451 F039 temp dfs 2 ; temporary 16-bit storage
4452
4453 F03B pointer dfs 2 ; for hex dump
4454
4455
4456 F03D break_address dfs 2 ; break address
4457 F03F break_opcode dfs 1 ; opcode that saved
4458
4459 F040 bcd_counter1 dfs 3 ; 6-digit BCD counter1
4460 F043 bcd_counter2 dfs 3 ; 6-digit BCD counter2
4461
4462 F046 line_buffer dfs 16 ; reserved for terminal printing
4463
4464
4465 F056 save_stack dfs 2 ; for saving system stack
4466 F058 system_stack dfs 32
4467 F078 user_stack dfs 32
4468
4469 0000 END
4470
4470
4470
4470
4470
4470
4470
4470
4470
4470
4470
4470
4470
4470
4470

Page 59 of 63
A8085.LST 29/3/2558 15:27

4470 105C AC_TEXT 09E7 ADDRESS_MODE 1E97 AF_TEXT


4471 124D ALT_PUT_STR 13AE ASCII_0_9 0D59 ASCII_PRINT
4472 0D71 ASCII_PRINT1 1E45 ASCII_TEXT F040 BCD_COUNTER1
4473 F043 BCD_COUNTER2 F020 BCS 1E9B BC_TEXT
4474 0196 BIN1 01A1 BIN2 0194 BIN2ASCII
4475 01AB BIN3 01B6 BIN4 08BE BREAK
4476 F03D BREAK_ADDRESS F03F BREAK_OPCODE F010 BUFFER
4477 0080 BUSY 0637 BUZZER 0639 BUZZER1
4478 1ECD BYTE_TEXT 16F2 C0 16F7 C1
4479 1753 C10 1758 C11 175F C12
4480 1766 C13 176C C14 1772 C15
4481 1778 C16 177F C17 1784 C18
4482 1789 C19 178F C1A 1796 C1B
4483 179C C1C 17A2 C1D 17A8 C1E
4484 17AF C1F 16FE C2 17B4 C20
4485 17B9 C21 17C0 C22 17C6 C23
4486 17CC C24 17D2 C25 17D8 C26
4487 17DF C27 17E4 C28 17E9 C29
4488 17EF C2A 17F5 C2B 17FB C2C
4489 1801 C2D 1807 C2E 180E C2F
4490 1705 C3 1813 C30 1818 C31
4491 1820 C32 1825 C33 182C C34
4492 1832 C35 1838 C36 183F C37
4493 1844 C38 1849 C39 1850 C3A
4494 1855 C3B 185C C3C 1862 C3D
4495 1868 C3E 186F C3F 170B C4
4496 1874 C40 187C C41 1884 C42
4497 188C C43 1894 C44 189C C45
4498 18A4 C46 18AC C47 18B4 C48
4499 18BC C49 18C4 C4A 18CC C4B
4500 18D4 C4C 18DC C4D 18E4 C4E
4501 18EC C4F 1711 C5 18F4 C50
4502 18FC C51 1904 C52 190C C53
4503 1914 C54 191C C55 1924 C56
4504 192C C57 1934 C58 193C C59
4505 1944 C5A 194C C5B 1954 C5C
4506 195C C5D 1964 C5E 196C C5F
4507 1717 C6 1974 C60 197C C61
4508 1984 C62 198C C63 1994 C64
4509 199C C65 19A4 C66 19AC C67
4510 19B4 C68 19BC C69 19C4 C6A
4511 19CC C6B 19D4 C6C 19DC C6D
4512 19E4 C6E 19EC C6F 171E C7
4513 19F4 C70 19FC C71 1A04 C72
4514 1A0C C73 1A14 C74 1A1C C75
4515 1A24 C76 1A29 C77 1A31 C78
4516 1A39 C79 1A41 C7A 1A49 C7B
4517 1A51 C7C 1A59 C7D 1A61 C7E
4518 1A69 C7F 1723 C8 1A71 C80
4519 1A77 C81 1A7D C82 1A83 C83
4520 1A89 C84 1A8F C85 1A95 C86
4521 1A9B C87 1AA1 C88 1AA7 C89
4522 1AAD C8A 1AB3 C8B 1AB9 C8C
4523 1ABF C8D 1AC5 C8E 1ACB C8F
4524 1728 C9 1AD1 C90 1AD7 C91
4525 1ADD C92 1AE3 C93 1AE9 C94
4526 1AEF C95 1AF5 C96 1AFB C97
4527 1B01 C98 1B07 C99 1B0D C9A
4528 1B13 C9B 1B19 C9C 1B1F C9D
4529 1B25 C9E 1B2B C9F 172E CA
4530 1B31 CA0 1B37 CA1 1B3D CA2
4531 1B43 CA3 1B49 CA4 1B4F CA5
4532 1B55 CA6 1B5B CA7 1B61 CA8
4533 1B67 CA9 1B6D CAA 1B73 CAB
4534 1B79 CAC 1B7F CAD 1B85 CAE
4535 1B8B CAF 1735 CB 1B91 CB0
4536 1B97 CB1 1B9D CB2 1BA3 CB3
4537 1BA9 CB4 1BAF CB5 1BB5 CB6
4538 1BBB CB7 1BC1 CB8 1BC7 CB9
4539 1BCD CBA 1BD3 CBB 1BD9 CBC
4540 1BDF CBD 1BE5 CBE 1BEB CBF
4541 173B CC 1BF1 CC0 1BF6 CC1
4542 1BFC CC2 1C01 CC3 1C06 CC4
4543 1C0B CC5 1C12 CC6 1C17 CC7
4544 1C1D CC8 1C21 CC9 1C26 CCA
4545 1C2A CCB 1C2F CCC 1C33 CCD

Page 60 of 63
A8085.LST 29/3/2558 15:27

4546 1C39 CCE 1C3E CCF 1741 CD


4547 1C44 CD0 1C49 CD1 1C4F CD2
4548 1C54 CD3 1C59 CD4 1C5E CD5
4549 1C65 CD6 1C6A CD7 1C70 CD8
4550 1C74 CD9 1C79 CDA 1C7D CDB
4551 1C81 CDC 1C85 CDD 1C8A CDE
4552 1C8F CDF 1747 CE 1C95 CE0
4553 1C9A CE1 1CA0 CE2 1CA5 CE3
4554 1CAB CE4 1CB0 CE5 1CB7 CE6
4555 1CBC CE7 1CC2 CE8 1CC7 CE9
4556 1CCD CEA 1CD2 CEB 1CD8 CEC
4557 1CDD CED 1CE2 CEE 1CE7 CEF
4558 174E CF 1CED CF0 1CF1 CF1
4559 1CF9 CF2 1CFD CF3 1D01 CF4
4560 1D05 CF5 1D0E CF6 1D13 CF7
4561 1D19 CF8 1D1D CF9 1D23 CFA
4562 1D27 CFB 1D2B CFC 1D2F CFD
4563 1D34 CFE 1D39 CFF 1222 CIN
4564 0ECA CLEAR1 14BC CLEAR_BCD1 14E5 CLEAR_BCD2
4565 08F8 CLEAR_BREAK 01FB CLEAR_LCD 0EBD CLEAR_WATCH
4566 0B99 CODE1 0BE1 CODE10 0BE9 CODE11
4567 0BF1 CODE12 0BF9 CODE13 0C01 CODE14
4568 0C09 CODE15 0C11 CODE16 0C19 CODE17
4569 0C21 CODE18 0C29 CODE19 0BA1 CODE2
4570 0C31 CODE20 0C39 CODE21 0C41 CODE22
4571 0C49 CODE23 0C51 CODE24 0C59 CODE25
4572 0C61 CODE26 0BA9 CODE3 0BB1 CODE4
4573 0BB9 CODE5 0BC1 CODE6 0BC9 CODE7
4574 0BD1 CODE8 0BD9 CODE9 0B63 COLD1
4575 0B61 COLD2 0B72 COLD3 0B5C COLD_BOOT
4576 F022 COMMAND 0052 COMMAND_READ 0050 COMMAND_WRITE
4577 0023 CONTROL_8254 0034 CONTROL_WORD_8254 1D75 CONVERT
4578 0020 COUNTER0_8254 F026 COUNTER1 0021 COUNTER1_8254
4579 F027 COUNTER2 0022 COUNTER2_8254 1216 COUT
4580 1217 COUT1 000D CR F037 CURRENT_REGISTER
4581 1063 CY_TEXT 0604 DATA_KEY 060F DATA_KEY1
4582 0617 DATA_KEY2 061F DATA_KEY3 0627 DATA_KEY4
4583 09F4 DATA_MODE 0053 DATA_READ 1442 DATA_RECORD
4584 0051 DATA_WRITE 0C8D DEBOUNCE 0C8F DEBOUNCE1
4585 097B DEBUG 0A5E DECREMENT 05FB DELAY
4586 064D DELAY_US 064F DELAY_US1 093E DELETE_BYTE
4587 094D DELETE_BYTE1 0B86 DEMO 0B88 DEMO1_2
4588 1E9F DE_TEXT 0321 DIS2 038B DISASSEM1
4589 039A DISASSEM2 0349 DISASSEM3 0335 DISASSEMBLE
4590 030E DISASSEMBLE1 1E88 DISASSEMBLE_TEXT 0654 DISPLAY_OFF
4591 0D37 DOWNLOAD 1DB4 DOWNLOAD_TEXT 1340 DUMP1
4592 1338 DUMP_MEMORY 0401 D_DISASSEM1 0410 D_DISASSEM2
4593 03BF D_DISASSEM3 03AB D_DISASSEMBLE 03D7 D_ONE_TAB
4594 1133 EDIT1 110E EDIT_LOCATION 1DDD EDIT_TEXT
4595 1DF5 EDIT_TEXT1 1E20 EDIT_TEXT2 06FD ENTER_ADDRESS
4596 06C3 ENTER_DATA 06E8 ENTER_DATA1 0663 ENTER_REGISTER
4597 F025 ENTRY_MODE 0000 EOS 1E80 ERROR_TEXT
4598 001B ESC 1441 ESC_QUIT 0D8A EXIT_ASCII_PRINT
4599 0202 EXIT_CLEAR 0ED7 EXIT_CLEAR_WATCH 0334 EXIT_DISASSEMBLE
4600 0D58 EXIT_DOWNLOAD 1190 EXIT_EDIT 1181 EXIT_EDIT1
4601 10AA EXIT_FILL 13D8 EXIT_GET_HEX2 13E1 EXIT_GET_HEX3
4602 11EC EXIT_HELP 1337 EXIT_HEX_DUMP 11D4 EXIT_IO
4603 110D EXIT_JUMP 10C3 EXIT_MONITOR 11AD EXIT_NEW_LOCATION
4604 0D36 EXIT_PROMPTING 11C2 EXIT_QUICK_HOME 1058 EXIT_REGISTER
4605 0E9F EXIT_SET_USER 0F32 EXIT_STACK 0EF2 EXIT_STEP
4606 0EE6 EXIT_WATCH 1067 FILL_MEMORY 1099 FILL_MEMORY1
4607 1E56 FILL_TEXT1 1E67 FILL_TEXT2 1E77 FILL_TEXT3
4608 F023 FLAG1 1EB4 FLAG_TEXT 1210 FOUND
4609 0593 FUNCTION1 059E FUNCTION2 05A9 FUNCTION3
4610 05B4 FUNCTION4 05C0 FUNCTION5 05CB FUNCTION6
4611 05D6 FUNCTION7 05E1 FUNCTION8 05EC FUNCTION9
4612 09FF FUNCTION_2ND 0588 FUNCTION_KEY 13B9 GET_2ND_HEX
4613 122C GET_COMMAND 1359 GET_HEX 136C GET_HEX1
4614 1385 GET_HEX2 0B91 GET_KEY_CODE 0421 GET_NUMBER_OF_BYTE
4615 13EA GET_RECORD 0981 GO 0225 GOTO_XY
4616 0234 GOTO_XY1 023F GOTO_XY2 024A GOTO_XY3
4617 0255 GOTO_XY4 0000 GPIO 11D5 HELP
4618 1F22 HELP_TEXT 1F55 HELP_TEXT1 12D8 HEX_DUMP
4619 12F9 HEX_DUMP1 12E5 HEX_DUMP2 131F HEX_DUMP3
4620 1321 HEX_DUMP4 1314 HEX_DUMP5 1EA3 HL_TEXT
4621 0967 HOME 8100 HOME_ADDRESS 0A4B INCREMENT

Page 61 of 63
A8085.LST 29/3/2558 15:27

4622 1470 INC_BCD1 1488 INC_BCD2 018A INIT_8254


4623 0203 INIT_LCD 11ED INIT_UART 0913 INSERT_BYTE
4624 0926 INSERT_BYTE1 14F2 INS_TABLE 11C3 IO_ADDRESS
4625 20EA IO_TEXT 06F9 IT_IS_RAM 1E2E JUMP_TEXT1
4626 1E40 JUMP_TEXT2 10C4 JUMP_TO_USER_PGM F021 KEY
4627 057C KEY_EXECUTE 01F1 LCD_READY 01F2 LCD_READY1
4628 000A LF F046 LINE_BUFFER 0181 MAIN
4629 16F2 MNEM 0B23 MODE1 0B5A MODE2
4630 0AE8 MODE_INDICATOR 0A23 MODIFY_REGISTER 025C MONITOR_CALL
4631 10AB MONITOR_FUNCTION 2253 MONITOR_TEXT 8000 MY_ROM
4632 12C1 NEW_LINE 1191 NEW_LOCATION 1DCD NEW_TEXT
4633 0CBE NEXT_KEY 1239 NO_DATA 0429 NUMBER1
4634 0471 NUMBER10 0479 NUMBER11 0481 NUMBER12
4635 0489 NUMBER13 0491 NUMBER14 0499 NUMBER15
4636 04A1 NUMBER16 04A9 NUMBER17 04B1 NUMBER18
4637 04B9 NUMBER19 0431 NUMBER2 04C1 NUMBER20
4638 04C9 NUMBER21 04D1 NUMBER22 04D9 NUMBER23
4639 04E1 NUMBER24 04E9 NUMBER25 04F1 NUMBER26
4640 04F9 NUMBER27 0501 NUMBER28 0509 NUMBER29
4641 0439 NUMBER3 0511 NUMBER30 0519 NUMBER31
4642 0521 NUMBER32 0529 NUMBER33 0531 NUMBER34
4643 0539 NUMBER35 0541 NUMBER36 0549 NUMBER37
4644 0551 NUMBER38 0559 NUMBER39 0441 NUMBER4
4645 0561 NUMBER40 0569 NUMBER41 0571 NUMBER42
4646 0579 NUMBER43 0449 NUMBER5 0451 NUMBER6
4647 0459 NUMBER7 0461 NUMBER8 0469 NUMBER9
4648 1D85 OFF_DISPLAY 0657 OFF_DISPLAY1 13D0 OK_0_9
4649 0361 ONE_TAB 0963 OPTION1 12A1 OUT1X
4650 12AD OUT1X1 12B2 OUT2X 1EB0 PC_TEXT
4651 01DF PINT1 01EA PINT2 01C4 PINT8U
4652 F03B POINTER 14A0 PRINT_BCD1 14C9 PRINT_BCD2
4653 0ED8 PRINT_WATCH 0EA0 PRINT_WATCH_RAM 1D3F PROMPT1
4654 1D8B PROMPT2 1256 PROMPT3 0D19 PROMPTING
4655 1DCB PROMPT_TEXT 0256 PUT_CH_LCD 07E1 PUT_FLAG
4656 07E9 PUT_HIGH1 086A PUT_HIGH2 123F PUT_STR
4657 1246 PUT_STR1 128C PUT_STR2 0215 PUT_STR_LCD
4658 021C PUT_STR_LCD1 1060 P_TEXT 11AE QUICK_HOME
4659 0AA4 READ_MEMORY 0A79 READ_REGISTER 0755 REGISTER1
4660 0898 REGISTER10 0771 REGISTER2 078D REGISTER3
4661 07A9 REGISTER4 07C5 REGISTER5 07EC REGISTER6
4662 0814 REGISTER7 083F REGISTER8 0870 REGISTER9
4663 0F33 REGISTER_DISPLAY 0F3B REGISTER_DISPLAY1 0F3E REGISTER_DISPLAY2
4664 0FD0 REGISTER_FLAG1 1051 REGISTER_FLAG10 0FD5 REGISTER_FLAG2
4665 0FEF REGISTER_FLAG3 0FF4 REGISTER_FLAG4 100E REGISTER_FLAG5
4666 1013 REGISTER_FLAG6 102D REGISTER_FLAG7 1032 REGISTER_FLAG8
4667 104C REGISTER_FLAG9 0000 ROM 0000 RS
4668 F056 SAVE_STACK 0C94 SCAN 0CA2 SCAN1
4669 0C64 SCAN_KEY 0C7B SCAN_KEY1 0C75 SCAN_KEY2
4670 0C75 SCAN_KEY3 0C64 SCAN_KEY4 0737 SELECT_REGISTER
4671 0D21 SEND_PROMPT 1293 SEND_PROMPT1 129A SEND_PROMPT3
4672 12D2 SEND_TAB 0CD4 SERIAL_COMMAND 02B3 SERVICE_RST2
4673 028E SERVICE_RST7 02D8 SERVICE_TRAP 1EF3 SET_REGISTER_TEXT
4674 0DC7 SET_USER1 0DF2 SET_USER2 0E1D SET_USER3
4675 0E48 SET_USER4 0E73 SET_USER5 0E9E SET_USER6
4676 0D8B SET_USER_REGISTER 0713 SHIFT_ADDRESS 06D6 SHIFT_DATA
4677 0CB4 SHIFT_KEY 066E SHIFT_REGISTER 1ECA SIGN_TEXT
4678 09A5 SINGLE_STEP 0EE7 SINGLE_STEP_ 0309 SKIP1
4679 09C5 SKIP2 0141 SKIP_BOOT 015F SKIP_COLD_BOOT
4680 1171 SKIP_EDIT1 117A SKIP_EDIT2 1464 SKIP_ERROR
4681 10FE SKIP_LOAD_PC 07EB SKIP_PUT_HIGH1 086C SKIP_PUT_HIGH2
4682 0176 SKIP_SEND_PROMPT 0D18 SKIP_SERIAL 0020 SP
4683 12CC SPACE 1EA7 SP_TEXT 0EF3 STACK_DISPLAY
4684 0F07 STACK_DISPLAY1 1EDB STACK_TEXT 0100 START
4685 0010 SYSTEM_PORT_A 0011 SYSTEM_PORT_B 0012 SYSTEM_PORT_C
4686 0013 SYSTEM_PORT_CONTROL F000 SYSTEM_RAM F058 SYSTEM_STACK
4687 0009 TAB F039 TEMP 0628 TEST_BUZZER
4688 05ED TEST_LED 05EF TEST_LED1 1DA0 TEXT3
4689 0B7A TITLE F035 TOS 1EAB TOS_TEXT
4690 134D TO_HEX 0A6E TO_SEVEN_SEGMENT 0040 UART_BUFFER
4691 0040 UART_DIVISOR_LSB 0041 UART_DIVISOR_MSB 0042 UART_FIFO
4692 F024 UART_FOUND 0043 UART_LCR 0045 UART_LINE_STATUS
4693 0047 UART_SCR F02B USER_AF F02D USER_BC
4694 F02F USER_DE F031 USER_HL F029 USER_PC
4695 0030 USER_PORT_A 0031 USER_PORT_B 0032 USER_PORT_C
4696 0033 USER_PORT_CONTROL F033 USER_SP F078 USER_STACK
4697 0270 VECTOR_TABLE 0CAC WAIT1 141D WAIT_CR

Page 62 of 63
A8085.LST 29/3/2558 15:27

4698 F028 WARM_CODE 0EB0 WATCH1 F000 WATCH_RAM


4699 1358 ZERO_NINE 1059 ZERO_TEXT
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700
4700

Page 63 of 63

You might also like