8085 Kit Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 117 [warning: Documents this large are best viewed by clicking the View PDF Link!]

8085 Microprocessor Kit
User's Manual
Rev1.0, December, 2016
Contents
Overview……………………………………………………..………………….3
Hardware Features – Software Features
Getting Started…..………………………………………………………………5
AC Adapter – LED Display and Keypad – RESET – ADDR – DATA –
INC – DEC – HOME – ALT – GO – STEP – MOD – Program 1 – Program
2 – Program 3
Connecting Terminal..……………………………………….…………………18
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……………………………………………………………………….27
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 8085 Microprocessor kit 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
kit can receive the Intel hex file and disassemble the machine code into 8085
instructions.
Figure 1: Components layout.
3
Hardware Features:
CPU: Mitsubishi M5M80C85AP-2 @4MHz
Memory: 32kB Monitor ROM and 32kB SRAM
Simple I/O Port: 8-bit GPIO
Programmable Ports: 8255 chips
Programmable Counter: 8254
UART: NS8250 UART chip
Onboard I/O devices:
6-digit seven segment super bright LED
28-keypad
8-bit dot LED indicates status of GPIO1
Speaker
Direct BUS interface text LCD
Serial Interface: RS232C 9600bit/s 8-data bit no parity one stop bit
+5V Power Supply: voltage regulator with input protection
40-pin header for CPU bus
Counter timer 8254
onboard logic probe power supply
Test button for single pulse generation to the interrupt pins
Brown-out Protection
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
4
Getting Started
AC Adapter
The kit requires DC power input to operate. The input voltage accepts from +7.5V
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. The center pin is positive.
+
-
Figure 2: Polarity of DC jack.
When power up the board, the 8085 fetches
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 speaker will
sound beep. The HOME location is pointed to RAM at address 8100H. The data
LED will display the content at 8100H.
5
LED Display and Keypad
The kit has 6 digits 7-segment LED and 28 tact switches keypad.
Four digits is used for displaying the memory address and user registers contents.
Two digits “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. 8100 1E.
Figure 3: 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
The functions key are:
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 the 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.
ALT F Toggle beep ON/OFF.
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 memory spaces 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 us 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 content of
the accumulator using onboard gpio LED. The kit has 8-bit dot LED tied to the 8-
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 accumulator
content.
8
Figure 4: Writing the Accumulator content to gpio PORT at location 0.
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 8085 hex 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
Accumulator
1010 1010 GPIO port
1010 1010
8-bit DOT LED
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 as shown below.
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 content to the gpio port at location 00
has two bytes machine code, D3, 00. D3 is the instruction OUT and 00 is port
location.
10
Figure 6: I/O space allocation, User PPI is not available for this version.
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.
8100 3C.
Step 2 Press key + to increment address.
The address display will show 8101. Then repeat step1 until 81 byte was entered
to address 8105.
8100 d3.
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.
12
We can keep press key STEP, we will see every time 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.
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.
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.
13
How can we make the speed of counting slower? We can just simply add the job
that uses CPU time. 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
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
both are ZERO, the CPU will continue execute the next instruction.
14
Here is the 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 . 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
8109 81
810A 15
810B C2
810C 06
810D 81
810E C3
810F 00
8110 81
15
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.
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
16
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 GO, and check result in AF again, we will
get 21. This the correct BCD number from the addition of 19+02=21.
17
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. You may download free
terminal program, teraterm from this URL,
http://ttssh2.sourceforge.jp/index.html.en
Figure 7: Connecting PC running teraterm and kit with RS232 cross 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.
18
RS232C cable
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
19
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>
20
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.
21
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
22
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
23
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
24
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
25
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
26
Hardware
A block diagram of the 8085 kit is shown below. For complete hardware
schematic, see Appendix D.
CPU
The CPU is the 8-bit Microprocessor, 80C85. The XTAL frequency is 4MHz. The
reset signal is generated by RC circuit. The CPU is reset 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 operating
properly.
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.
27
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 list of
location of interrupts.
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.
GPIO1
GPIO1 provides 8-bit output port. The I/O address is 00. The output drives 8-dot
LED. We can use it for program testing easily.
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.
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.
20H COUNTER0
21H COUNTER1
22H COUNTER2
23H CONTROL REGISTER
28
Headers and Connectors
CPU Header JP1
29
Onboard LCD Header JR1
30
RS232C DB9 male connector VB1
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, D10 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 8255, 8-bit GPIO
Counter: Programmable Counter 8254
UART: NS8250
Brownout Reset: KIA7042
Board Size: 170 x 170 mm
Weight: 320g (complete components except LCD)
DC Power Supply: AC-to-DC adapter +7.5V-12V 400mA
Power consumption: (350mA @12VDC)
31
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
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
32
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
Entry: A
Exit: none
0D - demo2
Running GPIO LED
Entry: none
Exit: none
NVRAM Bootable (available for special kit only)
User can replace U2, SRAM with a Nonvolatile RAM for program storage, when
the board is powered 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 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 be changed to 00, thus get back to normal RESET.
The sample code that demonstrates NVRAM Bootable is shown in Appendix D.
33
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
34
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
35
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
36
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
37
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
38
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
39
40
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
41
count dfs 1 ; use RAM one byte for count
variable
end
42
Appendix E Machine code and 8085 Instructions
43
!""#$%&'()(*+,-&$#(./%#(+$%(*$#0/$&,(/1(2324(5$6789,7&/$6
MOVE, LOAD and STORE
40 MOV B,B
41 MOV B,C
42 MOV B,D
43 MOV B,E
44 MOV B,H
45 MOV B,L
46 MOV B,M
47 MOV B,A
48 MOV C,B
49 MOV C,C
4A MOV C,D
4B MOV C,E
4C MOV C,H
4D MOV C,L
4E MOV C,M
4F MOV C,A
50 MOV D,B
51 MOV D,C
52 MOV D,D
53 MOV D,E
54 MOV D,H
55 MOV D,L
56 MOV D,M
57 MOV D,A
58 MOV E,B
59 MOV E,C
5A MOV E,D
5B MOV E,E
5C MOV E,H
5D MOV E,L
5E MOV E,M
5F MOV E,A
60 MOV H,B
61 MOV H,C
62 MOV H,D
63 MOV H,E
64 MOV H,H
65 MOV H,L
66 MOV H,M
67 MOV H,A
68 MOV L,B
69 MOV L,C
6A MOV L,D
6B MOV L,E
6C MOV L,H
6D MOV L,L
6E MOV L,M
6F MOV L,A
70 MOV M,B
71 MOV M,C
72 MOV M,D
73 MOV M,E
74 MOV M,H
75 MOV M,L
77 MOV M,A
78 MOV A,B
79 MOV A,C
7A MOV A,D
7B MOV A,E
7C MOV A,H
7D MOV A,L
7E MOV A,M
7F MOV A,A
3E nn MVI A,byte
06 nn MVI B,byte
0E nn MVI C,byte
16 nn MVI D,byte
1E nn MVI E,byte
26 nn MVI H,byte
2E nn MVI L,byte
36 nn MVI M,byte
01 nnnn LXI B,dble
11 nnnn LXI D,dble
21 nnnn LXI H,dble
31 nnnn LXI SP,dble
02 STAX B
12 STAX D
0A LDAX B
1A LDAX D
32 nnnn STA adr
3A nnnn LDA adr
22 nnnn SHLD adr
2A nnnn LHLD adr
EB XCHG
STACK
C5 PUSH B
D5 PUSH D
E5 PUSH H
F5 PUSH PSW
C1 POP B
D1 POP D
E1 POP H
F1 POP PSW
E3 XTHL
F9 SPHL
33 INX SP
3B DCX SP
ARITHEMATICS
C6 nn ADI byte
CE nn ACI byte
80 ADD B
81 ADD C
82 ADD D
83 ADD E
84 ADD H
85 ADD L
86 ADD M
87 ADD A
88 ADC B
89 ADC C
8A ADC D
8B ADC E
8C ADC H
8D ADC L
8E ADC M
8F ADC A
D6 nn SUI byte
DE nn SBI byte
90 SUB B
91 SUB C
92 SUB D
93 SUB E
94 SUB H
95 SUB L
96 SUB M
97 SUB A
98 SBB B
99 SBB C
9A SBB D
9B SBB E
9C SBB H
9D SBB L
9E SBB M
9F SBB A
09 DAD B
19 DAD D
29 DAD H
39 DAD SP
LOGICAL
E6 nn ANI byte
EE nn XRI byte
F6 nn ORI byte
A0 ANA B
A1 ANA C
A2 ANA D
A3 ANA E
A4 ANA H
A5 ANA L
A6 ANA M
A7 ANA A
A8 XRA B
A9 XRA C
AA XRA D
AB XRA E
AC XRA H
AD XRA L
AE XRA M
AF XRA A
B0 ORA B
B1 ORA C
B2 ORA D
B3 ORA E
B4 ORA H
B5 ORA L
B6 ORA M
B7 ORA A
COMPARE
FE nn CPI byte
B8 CMP B
B9 CMP C
BA CMP D
BB CMP E
BC CMP H
BD CMP L
BE CMP M
BF CMP A
ROTATE
07! RLC
17 RAL
0F RRC
1F RAR
JUMP
C3 nnnn JMP adr
DA nnnn JC adr
D2 nnnn JNC adr
CA nnnn JZ adr
C2 nnnn JNZ adr
F2 nnnn JP adr
FA nnnn JM adr
EA nnnn JPE adr
E2 nnnn JPO adr
E9 PCHL
CALL
CD nnnn CALL adr
DC nnnn CC adr
D4 nnnn CNC adr
CC nnnn CZ adr
C4 nnnn CNZ adr
F4 nnnn CP adr
FC nnnn CM adr
EC nnnn CPE adr
E4 nnnn CPO adr
RETURN
C9 RET
D8 RC
D0 RNC
C8 RZ
C0 RNZ
F0 RP
F8 RM
E8 RPE
E0 RPO
RESTART
C7 RST 0
CF RST 1
D7 RST 2
DF RST 3
E7 RST 4
EF RST 5
F7 RST 6
FF RST 7
INPUT/OUTPUT
DB nn IN byte
D3 nn OUT byte
INCREMENT/DECREMENT
04 INR B
0C INR C
14 INR D
1C INR E
24 INR H
2C INR L
34 INR M
3C INR A
03 INX B
13 INX D
23 INX H
05 DCR B
0D DCR C
15 DCR D
1D DCR E
25 DCR H
2D DCR L
35 DCR M
3D DCR A
0B DCX B
1B DCX D
2B DCX H
SPECIALS
2F CMA
37 STC
3F CMC
27 DAA
CONTROL
00! NOP
F3 DI
FB EI
76 HLT
20 RIM
30 SIM
Appendix F Hardware schematic, Parts list
44
5
5
4
4
3
3
2
2
1
1
D D
C C
B B
A A
memory & i/o decoder
Designed by Wichit Sirichote, wichit.sirichote@gmail.com
0x8000-0xFFFF
32kB SRAM
0x0000-0x7FFF
32kB ROM
<Doc> 2
8085 Microprocesor Kit
B
1 3Friday, April 15, 2016
Title
Size Document Number Rev
Date: Sheet of
D1
D0
CLKOUT
A14
A9
A0
A3
D4
A0
A2A2
A7
SOD
D[0..7]
D0
/RD
D7
A2
A10
A11
A12
A8
A14
A12
D5
A6
A5
D5
D5
D3
A4D4
A8
/RD D7
A3
D0
D6
D2
A8
A[0..7]
D2
A6
A12
A9
D6
A13
/WR
A13
A1
D2
D7
D0
A10
A4
D1
D2
A[8..14]
D1
A0
D7
D3 D2
D6
ALE
A5
A9
A7
D5
D4
A1
A6
D3
D0
D4
D6
D1
D5
D4
ROM_CE
A3 A5
D6
A14
A13 D1
D7
D3
RAM_CE
A10
A4
A1
A11
A11
D3
A7
A15
A15
IO/M
RAM_CES0
S1 A4
A5
A6
A7
/RD
/WR
ALE
HLDA
RESET_OUT
ROM_CE
SID
TRAP
RST5.5
RST6.5
RST7.5
INTR
INTA
S0
S1
READY
SID
D2
D0
D7
D3
D4
GPIO1
D1
D6
D5
ALE
TRAP
*RST5.5 RST5.5
*RST6.5
*INTR
RST6.5
RST7.5
INTR
D0
D1
D2
D3
D4
D5
D7
D6
/RD
/WR
SID
S0
S1
ALE
IO/M
SOD
READY
RESET_OUT
CLKOUT
*RST7.5
A0
*RST5.5
A1
HLDA
A3
A6
*INTR
A7
INTA
A4
A2
A5
*RST6.5
HOLD
A0
A1
A2
GPIO1
D7
D5
D6
CLKOUT
D4
D2
D3
D0
D1
WR
RD
reset
SYSTEM_PPI
CTC
USER_PPI
UART
LCD_E
TRACE
*RST7.5
VCC
VSS
A0
A1
A2
OUT1
OUT2
+5V
+5V
+5V
+5V
+5V
+5V
+5V
+5V
+5V
+5V
+5V VCC
+5V
+5V
D5D4
JP1
HEADER 20X2
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
D3
LED 3mm
R3
10k
D2
R6
10k
D9
1N5237A
D1
U9
74HC164
1
2
8
9
3
4
5
6
10
11
12
13
A
B
CLK
CLR
QA
QB
QC
QD
QE
QF
QG
QH
U5
GAL16V8B
1
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
I/CLK
I/OE
I/O/Q
I/O/Q
I/O/Q
I/O/Q
I/O/Q
I/O/Q
I/O/Q
I/O/Q
I
I
I
I
I
I
I
I
U7A
4001
1
23
Q2
KIA7042
1
2
3
U7B
4001
5
64
SW2
SW SPDT
12
3
U4
74HC573
1
11
20
19
18
17
16
15
14
13
12
2
3
4
5
6
7
8
9
OE
LE
VCC
1Q
2Q
3Q
4Q
5Q
6Q
7Q
8Q
1D
2D
3D
4D
5D
6D
7D
8D
+
C3
10uF
U1
27C256
10
9
8
7
6
5
4
3
25
24
21
23
2
26
27
20
22
1
11
12
13
15
16
17
18
19
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
CE
OE
VPP
O0
O1
O2
O3
O4
O5
O6
O7
U2
HM62256B
10
9
8
7
6
5
4
3
25
24
21
23
2
26
1
20
22
27
11
12
13
15
16
17
18
19
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
CE
OE
WE
D0
D1
D2
D3
D4
D5
D6
D7
U6
MSM80C85A
36
1
2
5
6
9
8
7
10
11
29
33
39
35
12
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
30
31
32
34
3
37
4
38
RST-IN
X1
X2
SID
TRAP
RST 5.5
RST 6.5
RST 7.5
INTR
INTA
S0
S1
HOLD
READY
AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
A8
A9
A10
A11
A12
A13
A14
A15
ALE
WR
RD
IO/M
RST-OT
CLKO
SOD
HLDA
SW1
SW DIP-4
1
2
3
4
8
7
6
5
U8F
74LS14
1312
U7C
4001
8
910
U7D
4001
12
13 11
R1
10k
U8E
74LS14
11 10
R2
100
R4 10k
R5
10k
U8A
74LS14
1 2
R8
10k
D10
LED
Q1 4MHz
U8B
74LS14
3 4
U8C
74LS14
5 6
R7 330
U8D
74LS14
9 8
S1 RESET
D8
C130pF
D7
C2
30pF
U3
74HC573
1
11
20
19
18
17
16
15
14
13
12
2
3
4
5
6
7
8
9
OE
LE
VCC
1Q
2Q
3Q
4Q
5Q
6Q
7Q
8Q
1D
2D
3D
4D
5D
6D
7D
8D
D6
5
5
4
4
3
3
2
2
1
1
D D
C C
B B
A A
GO
INC
0
4
8
C D
9
5
1
DEC
ALT
E
A
6
2
STEP
ADDR
F
B
7
3
HOME
DATA
USER1
MODE
OPTION
<Doc> 2
8085 Microprocesssor Kit
B
2 3Friday, April 15, 2016
Title
Size Document Number Rev
Date: Sheet of
C
D
G
E
F
A
DP
BC
G
E
DP
B
F
D
APB0
PB1
PB3
PB2
PB5
PB6
PB7
PB4
PC0
PC3
PC1
PC2
PB0
PB1
PB2
PB3
PB5
PB4
PB7
PB6
PA0
PA3
PA7
PA6
PA1
PA2
PA4
PA5
PC5
PC0
PC3
PC2
PC7
PC4
PC1
SPEAKER
PC6
PA5
PA2
PA6
PA3
PA7
PA0
PA1
PA4
D6
D3
D2
D1
D4
D7
D0
D5
A1
A0
D1
D6
D3
D7
D4
D2
D5
D0
A0
A1
A2
SPEAKER
PA6
PA7
USER
TRACE
VSS
VCC
SYSTEM_PPI reset
WR
RD
D0
D7
D5
D2
D4
D3
D1
D6
A0
A1
A2
VCC+5V
VCC
VCC
+5V
U11
LTC-4727JR
14
16
13
3
5
11
15
7
1
2
6
8
4
A
B
C
D
E
F
G
DP
DIGIT1
DIGIT2
DIGIT3
DIGIT4
L1L2L3
SW8
1 2
SW13
1 2
SW3
1 2
SW17
1 2
R9
R-PACK
1 16
2 15
3 14
4 13
5 12
6 11
7 10
8 9
SW14
1 2
SW15
1 2
SW16
1 2 R12
10
LS1
SPEAKER
SW25
1 2
SW22
1 2
SW23
1 2
SW26
1 2
SW12
1 2
U12
74LS244
2
4
6
8
11
13
15
17
1
19
18
16
14
12
9
7
5
3
1A1
1A2
1A3
1A4
2A1
2A2
2A3
2A4
1G
2G
1Y1
1Y2
1Y3
1Y4
2Y1
2Y2
2Y3
2Y4
SW24
1 2
SW9
1 2
U13
74LS145
15
14
13
12
1
2
3
4
5
6
7
9
10
11
A
B
C
D
0
1
2
3
4
5
6
7
8
9
U14
8255
34
33
32
31
30
29
28
27
5
36
9
8
35
6
4
3
2
1
40
39
38
37
18
19
20
21
22
23
24
25
14
15
16
17
13
12
11
10
D0
D1
D2
D3
D4
D5
D6
D7
RD
WR
A0
A1
RESET
CS
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
PC0
PC1
PC2
PC3
PC4
PC5
PC6
PC7
SW10
1 2
SW27
1 2
SW11
1 2
SW28
1 2
D11
TONE
C
R13
10k RESISTOR SIP 9 12
3
4
5
6
7
8
9
R10
4.7k
SW29
1 2
SW21
1 2
R11
330
SW18
1 2
SW7
1 2
SW19
1 2
SW4
1 2
SW5
1 2
SW20
1 2
Q3
BC557
1
2
3
SW6
1 2
U10
LTC-4727JR
14
16
13
3
5
11
15
7
1
2
6
8
4
A
B
C
D
E
F
G
DP
DIGIT1
DIGIT2
DIGIT3
DIGIT4
L1L2L3
5
5
4
4
3
3
2
2
1
1
D D
C C
B B
A A
RS
R/W
16x2 text LCD interface
<Doc> 2
8085 Microprocessor Kit
B
3 3Friday, April 15, 2016
Title
Size Document Number Rev
Date: Sheet of
D5
D6
D4
D7
D0
D3
D2
D1
D1
D6
D7
D0
D2
D5
D4
D3
D[0..7]
A0
A1
A0
A1
A2
A0
A1
A2 RXD
TXD
RTS
DCD
RTS
DCD
D7
D0
D3
D2
D1
D4
A0
D6
A1
D5
DC2
D1
D3
D4
D0
D6
D7
D2
D5
RD
WR
CTC
CLKOUT
VCC
VSS
*RST7.5
A0
A1
A2
RD
WR
reset
UART
RXD
TXD
LCD_E
OUT1
OUT2
D4
D5
D6
D1
D3
D0
D7
D2
VCC+5V
+5V
+5V
+5V
+5V
+5V
VCC
+5V
+5V +5V
+
C11
10uF
C18
0.1uF
C16
0.1uF
D13
1N4007
12
+
C12
10uF 16V
C15
0.1uF
+
C5
10uF
VB1
SUB-D 9, Male (cross cable)
5
9
4
8
3
7
2
6
1
+
C4
10uF 10V
U16
8254
8
7
6
5
4
3
2
1
22
23
19
20
21
9
11
10
15
14
13
18
16
17
D0
D1
D2
D3
D4
D5
D6
D7
RD
WR
A0
A1
CS
CLK0
G0
OUT0
CLK1
G1
OUT1
CLK2
G2
OUT2
C19
0.1uF
U15
8250
12
13
14
21
18
22
19
28
27
26
1
2
3
4
5
6
7
8
25
35
16
17
9
34
31
30
11
32
33
10
38
37
36
39
24
23
29
15
CS0
CS1
CS2
RD
WR
RD
WR
A0
A1
A2
D0
D1
D2
D3
D4
D5
D6
D7
ADS
RESET
XTAL1/CLK
XTAL2
RCLK
OUT1
OUT2
INT
TXD
RTS
DTR
RXD
DCD
DSR
CTS
RI
CSOUT
DDIS
NC
BAUDOUT
C17
0.1uF
J1 DC input
1
2
JR1
CONN RECT 16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+
C6
10uF
R14 5
C20
0.1uF
C8
100nF
R16 2k
C9
100nF
TP1
+5V 1
+
C7
10uF
R15
10K
1 3
2
D12
POWER
U17
MAX232A
13
8
11
10
1
3
4
5
2
6
12
9
14
7
R1IN
R2IN
T1IN
T2IN
C+
C1-
C2+
C2-
V+
V-
R1OUT
R2OUT
T1OUT
T2OUT
C14
0.1uF
TP2
GND 1
+
C13
1000uF 16V
U18
LM7805/TO 1
2
3VIN
GND
VOUT
+
C10
10uF
PARTS LIST
Semiconductors
U1 27C256, 32kM EPROM
U2 HM62256B, 32kB SRAM
U4,U3 74HC573, 8-bit LATCH
U5 GAL16V8B, PLD
U6 MSM80C85A, Microprocessor
U7 4001, Nor gate
U8 74LS14, hex inverter
U9 74HC164, shift register
U11,U10 LTC-4727JR, 7-segment LED
U12 74LS244, tri-state driver
U13 74LS145, BCD to decimal
U14 8255, PPI
U15 8250, UART
U16 8254, CTC
U17 MAX232A
U18 LM7805/TO, voltage regulator
D1,D2,D4,D5,D6,D7,D8,D10 LED
D3 LED 3mm
D9 1N5227A
D11 TONE LED
D12 POWER LED
D13 1N4007
Q2 KIA7042
Q3 BC557
Capacitors
C1,C2 30pF, ceramic cap
C3,C5,C6,C7,C10,C11 10uF
C4 10uF 10V
C8,C9 100nF
C12 10uF 16V, electrolytic
C13 1000uF 16V, electrolytic
C14,C15,C16,C17,C18 0.1uF
C19,C20 0.1uF
Resistors (all resistors are 1/8W +/-5%)
R1,R3,R4,R5,R6,R8,R15 10K
R2 100 Ohms
R11,R7 330 Ohms
R9 100x8
R10 4.7k
R12 10
R13 10k RESISTOR SIP 9
R14 5 Ohms
R16 1k
Additional parts
JP1 HEADER 20X2
JR1 CONN RECT 16
J1 DC input
LS1 SPEAKER
Q1 4MHz
SW1 SW DIP-4, DIP switch
SW2 SW SPDT
SW3,SW4,SW5,SW6,SW7,SW8,SW
PUSHBUTTON-
SPST,SW9,SW10,SW11,SW12,SW13,
SW14,SW15,SW16,SW17,SW18,
SW19,SW20,SW21,SW22,SW23,
SW24,SW25,SW26,SW27,SW28,
SW29
S1 RESET
TP1 +5V
TP2 GND
VB1 SUB-D 9, Male (cross cable)
PCB double side plate through hole
LED cover Clear RED color 0.8mm acrylic
plastic
Keyboard sticker printable SVG file
45
46
Appendix G Monitor source code listing
47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
;-----------------------------------------------------------------
; B8085.ASM
; monitor program for MTK-85 8085 MICROPROCESSOT TRAINING KIT
; COPYTIGHT (C) 2007-2015 BY WICHIT SIRICHOTE, kswichit@kmitl.ac.th
;
; source file was assembled with C32 Cross Assembler V3.0
;
; 18 May 2007 add insert byte, ALT E
; delete byte, ALT D
; click sound when key pressed
;
; 8 March 2015 remove repeat key
; modified address and data entry mode
; 3 April 2016 replace buzzer with small speaker for tone experiment
; add beep/no beep with ALT F press
; 16 April 2016 add delay after no beep
;
;-----------------------------------------------------------------
0000 CPU "8085.TBL" ;CPU TABLE
0000 HOF "INT8" ;HEX FORMAT
; ---------- onboard GPIO --------------------------------------
0000 = gpio equ 0 ; D0-D3 is 4-bit output port, D4-D7 is 4-bit input port
;---------- 8255 PPI system port I/O address ----------------------
0010 = system_port_a: equ 10h
0011 = system_port_b: equ 11h
0012 = system_port_c: equ 12h
0013 = system_port_control: equ 13h
;-------------------- 8254 counter/timer --------------------------
0020 = counter0_8254 equ 20h
0021 = counter1_8254 equ 21h
0022 = counter2_8254 equ 22h
0023 = control_8254 equ 23h
0034 = control_word_8254 equ 00110100B ; mode 0, counter0
;---------- 8255 PPI user port I/O address ------------------------
0030 = user_port_a: equ 30h
0031 = user_port_b: equ 31h
0032 = user_port_c: equ 32h
0033 = user_port_control: equ 33h
;---------- 16C550 compatible UART I/O address --------------------
; e.g., UM8250B, 16C450, 16C550
0040 = uart_buffer: equ 40h
0045 = uart_line_status: equ 45h
0042 = uart_fifo: equ 42h
0043 = uart_lcr: equ 43h
0040 = uart_divisor_lsb: equ 40h
0041 = uart_divisor_msb: equ 41h
0047 = uart_scr: equ 47h
;------------------- onboard LCD registers ------------------------
0050 = command_write equ 50h
0052 = command_read equ 52h
0051 = data_write equ 51h
0053 = data_read equ 53h
0080 = busy equ 80h
0009 = TAB EQU 9 ; ASCII TAB
0000 = RS EQU 0 ; terminator
000D = cr: equ 0dh
B8085.LST 29/12/2559 12:32
Page 1 of 64
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
000A = lf: equ 0ah
0020 = sp: equ 20h
F000 = system_ram equ 0f000h
;system_stack equ 0ffffh
8100 = home_address equ 8100h
0000 = rom equ 0 ;8000h ; change to 8000 for testing under RAM
; change to 0000 for rom programming
8000 = my_rom equ 8000h
0000 ORG rom
0000 C30001 JMP START ; reset vector
0008 ORG rom+8 ; RST 1 opcode is CF
0008 C36102 jmp monitor_call
0010 ORG rom+10h ; RST 2 used for testing RST 7
; jmp service_rst2
0010 C31080 jmp my_rom+10h
0018 ORG rom+18h ; DF RST 3 for testing monitor call
function
0018 C31880 jmp my_rom+18h
; jmp monitor_call
0020 ORG rom+20h ; RST 4
0020 C32080 jmp my_rom+20h
0024 ORG rom+24h
; jmp my_rom+24h
0024 C3DD02 jmp service_trap ; sing step running service routine
0028 ORG rom+28h ; RST 5
0028 C32880 jmp my_rom+28h
002C ORG rom+2ch ; relocate RST5.5 to external ram
002C C32C80 jmp my_rom+2ch
0030 ORG rom+30h ; relocate RST 6
0030 C33080 jmp my_rom+30h
0034 ORG rom+34h ; relocate RST6.5 to external ram
0034 C33480 jmp my_rom+34h
0038 ORG ROM+38H
0038 C39302 jmp service_rst7 ; RST 7 service jump back to monitor
003C ORG rom+3ch ; relocate RST7.5 to external ram
003C C33C80 jmp my_rom+3ch
0100 ORG rom+100h
0100 F3 START di
0101 3179F0 lxi sp,system_stack+32 ; point to top of system stack
0104 2199F0 lxi h,user_stack+32 ; point to top of user stack
0107 2234F0 shld user_SP
010A 3E90 MVI A,90H
010C D313 OUT system_port_control
010E 3EF0 mvi a,0f0h ; disable trap
0110 D312 out system_port_c
0112 CD0612 call init_uart
0115 CD0802 call init_lcd
0118 21A41D lxi h,prompt2
B8085.LST 29/12/2559 12:32
Page 2 of 64
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
011B CD1A02 call put_str_lcd
011E 210100 lxi h,01
0121 CD2A02 call goto_xy
0124 21B91D lxi h,text3
0127 CD1A02 call put_str_lcd
012A CD8F01 call init_8254
; NVRAM booting
; if location 8000H has C3 opcode then jump to 8000H
; if user press USER1 with RESET put 00 to 8000H
; ans skip booting
012D DB10 in system_port_a
012F E680 ani 80h
0131 CA4101 jz skip_boot
0134 3A0080 lda 8000H
0137 FEC3 cpi 0c3h
0139 C24101 jnz skip_boot
013C 210080 lxi h,8000h
013F E5 push h
0140 C9 ret ; jump to NVRAM
0141 AF skip_boot: xra a ; write 00 to 8000H
0142 320080 sta 8000H
0145 3227F0 sta counter1 ; clear counter1
0148 3A29F0 lda warm_code
014B FE24 cpi "$"
014D CA6401 jz skip_cold_boot
0150 3E24 mvi a,"$"
0152 3229F0 sta warm_code
0155 CD2D06 call test_buzzer
0158 3EFF mvi a,0ffh
015A D300 out gpio ; make GPIO LED on
015C CD760B call cold_boot
015F 3E00 mvi a, 0
0161 3224F0 sta beep_flag
0164 skip_cold_boot:
0164 210081 lxi h,home_address
0167 222AF0 shld user_PC
016A 223CF0 shld pointer
016D 3A25F0 lda uart_found
0170 FE00 cpi 0
0172 CA7B01 jz skip_send_prompt
0175 CDB312 call send_prompt3
0178 CD3A0D call send_prompt
017B skip_send_prompt:
017B AF xra a
017C D300 out gpio ; turn LED off
017E 3E00 mvi a,0
0180 3226F0 sta entry_mode ; set data entry mode
0183 CDBE0A call read_memory
0186 CD7E0C main: call scan_key
0189 CD8105 call key_execute
018C F28601 jp main
B8085.LST 29/12/2559 12:32
Page 3 of 64
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
;---------------- initialize counter0 for RST7.5 interrupt
----------------
018F 3E34 init_8254: mvi a, control_word_8254
0191 D323 out control_8254
0193 AF xra a
0194 D320 out counter0_8254
0196 D320 out counter0_8254
0198 C9 ret
; convert 8-bit unsigned in A to ASCII string in line_buffer
; entry: A
0199 bin2ascii:
0199 1E00 mvi e,0
019B FE64 bin1 cpi 100
019D DAA601 jc bin2
01A0 D664 sui 100
01A2 1C inr e
01A3 C39B01 jmp bin1
01A6 57 bin2: mov d,a
01A7 7B mov a,e
01A8 C630 adi "0"
01AA 3247F0 sta line_buffer
01AD 7A mov a,d
01AE 1E00 mvi e,0
01B0 FE0A bin3: cpi 10
01B2 DABB01 jc bin4
01B5 D60A sui 10
01B7 1C inr e
01B8 C3B001 jmp bin3
01BB 57 bin4: mov d,a
01BC 7B mov a,e
01BD C630 adi "0"
01BF 3248F0 sta line_buffer+1
01C2 7A mov a,d
01C3 C630 adi "0"
01C5 3249F0 sta line_buffer+2
01C8 C9 ret
; print 8-bit unsigned decimal to terminal
; entry: A
01C9 CD9901 pint8u: call bin2ascii
01CC 3A47F0 lda line_buffer
01CF FE30 cpi "0"
01D1 CAE401 jz pint1
01D4 CD2F12 call cout
01D7 3A48F0 lda line_buffer+1
01DA CD2F12 call cout
01DD 3A49F0 lda line_buffer+2
01E0 CD2F12 call cout
01E3 C9 ret
01E4 3A48F0 pint1: lda line_buffer+1
01E7 FE30 cpi "0"
01E9 CAEF01 jz pint2
01EC CD2F12 call cout
01EF 3A49F0 pint2: lda line_buffer+2
01F2 CD2F12 call cout
01F5 C9 ret
; convert 16-bit unsigned integer to ASCII code stored in line_buffer
; entry: HL
B8085.LST 29/12/2559 12:32
Page 4 of 64
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
;--------------------- LCD driver routines
--------------------------------
01F6 F5 lcd_ready: push psw
01F7 DB52 lcd_ready1: in command_read
01F9 E680 ani 80h
01FB C2F701 jnz lcd_ready1 ; wait until lcd ready
01FE F1 pop psw
01FF C9 ret
0200 CDF601 clear_lcd: call lcd_ready
0203 3E01 mvi a,1
0205 D350 out command_write
0207 C9 exit_clear: ret
0208 CDF601 init_lcd: call lcd_ready
020B 3E38 mvi a,38h
020D D350 out command_write
020F CDF601 call lcd_ready
0212 3E0C mvi a, 0ch
0214 D350 out command_write
0216 CD0002 call clear_lcd
0219 C9 ret
; print ASCII text on LCD
; entry: HL pointer with 0 for end of string
021A 7E put_str_lcd: mov a,m ; get A from [HL]
021B FE00 cpi 0
021D C22102 jnz put_str_lcd1
0220 C9 ret
0221 put_str_lcd1:
0221 CDF601 call lcd_ready
0224 D351 out data_write
0226 23 inx h
0227 F21A02 jp put_str_lcd
; goto_xy set cursor location on lcd
; entry: HL: H = x, L = y
022A CDF601 goto_xy: call lcd_ready
022D 7D mov a,l
022E FE00 cpi 0
0230 C23902 jnz goto_xy1
0233 7C mov a,h
0234 C680 adi 80h
0236 D350 out command_write
0238 C9 ret
0239 FE01 goto_xy1: cpi 1
023B C24402 jnz goto_xy2
023E 7C mov a,h
023F C6C0 adi 0c0h
0241 D350 out command_write
0243 C9 ret
0244 FE02 goto_xy2: cpi 2
0246 C24F02 jnz goto_xy3
0249 7C mov a,h
024A C694 adi 094h
024C D350 out command_write
024E C9 ret
024F FE03 goto_xy3: cpi 3
0251 C25A02 jnz goto_xy4
0254 7C mov a,h
0255 C6D4 adi 0d4h
0257 D350 out command_write
B8085.LST 29/12/2559 12:32
Page 5 of 64
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
0259 C9 ret
025A C9 goto_xy4: ret
; put_ch_lcd put character to lcd
; entry: A
025B CDF601 put_ch_lcd: call lcd_ready
025E D351 out data_write
0260 C9 ret
;--------------------------------------------------------------------
; monitor call entry
; entry: E = monitor call number 0-255
; calling monitor function is made with RST 1 command after loading the
; regsiter E with call number
; destroy: BC user must save it in stack memory
0261 E5 monitor_call: push h
0262 F5 push psw
0263 D5 push d
0264 7B mov a,e ; get call number
0265 07 rlc ; x2
0266 5F mov e,a ; put it back
0267 217502 lxi h,vector_table
026A 1600 mvi d,0
026C 19 dad d ; get location in jump table
026D 4E mov c,m
026E 23 inx h
026F 46 mov b,m
0270 D1 pop d
0271 F1 pop psw
0272 E1 pop h
0273 C5 push b ; push address into top of stack
0274 C9 ret ; jump to monitor call function
0275 vector_table:
0275 A00B dwl demo ; #0 running LED with HL pointer
0277 0006 dwl delay ; #1 simple delay routine
0279 760B dwl cold_boot ; #2 show 8085 running
027B AE0C dwl scan ; #3 scan display one cycle
027D 3B12 dwl cin ; #4 get byte from console
027F 2F12 dwl cout ; #5 print byte to console
0281 5812 dwl put_str ; #6 print string with 0 terminator to
console
0283 0802 dwl init_lcd ; #7 initialize lcd
0285 F601 dwl lcd_ready ; #8 wait until lcd is ready
0287 0002 dwl clear_lcd ; #9 clear lcd display
0289 2A02 dwl goto_xy ; #10 set lcd cursor position
028B 1A02 dwl put_str_lcd ; #11 print ASCII string on lcd
028D 5B02 dwl put_ch_lcd ; #12 print ASCII letter on lcd
028F F205 dwl test_led ; #13 run LED onboard
0291 C901 dwl pint8u ; #14 print 8-bit unsigned to terminal
; save CPU registers to stack and write them to user registers
;
0293 service_rst7:
0293 F5 push psw
0294 C5 push b
0295 D5 push d
0296 E1 pop h
0297 2230F0 shld user_DE
029A E1 pop h
029B 222EF0 shld user_BC
029E E1 pop h
029F 222CF0 shld user_AF
02A2 E1 pop h
B8085.LST 29/12/2559 12:32
Page 6 of 64
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
02A3 222AF0 shld user_PC ; store next PC
02A6 210000 lxi h,0000h
02A9 39 dad sp ; get SP
02AA 2234F0 shld user_SP ; save user SP
02AD CDBE0A call read_memory
02B0 CD540F call register_display1
02B3 2A57F0 lhld save_stack
02B6 F9 sphl ; restore system stack
02B7 C9 ret
; test diplay register after break
; RST 2 opcode is D7
; later will be changed to RST 7
02B8 service_rst2:
02B8 F5 push psw
02B9 C5 push b
02BA D5 push d
02BB E1 pop h
02BC 2230F0 shld user_DE
02BF E1 pop h
02C0 222EF0 shld user_BC
02C3 E1 pop h
02C4 222CF0 shld user_AF
02C7 E1 pop h
02C8 222AF0 shld user_PC ; store next PC
02CB 210000 lxi h,0000h
02CE 39 dad sp ; get content of SP
02CF 2234F0 shld user_SP ; save user SP
02D2 CDBE0A call read_memory
02D5 CD540F call register_display1
02D8 2A57F0 lhld save_stack
02DB F9 sphl ; restore system stack
02DC C9 ret
; service trap for single step running
; disable trap input by setting system port c.6
; save CPU registers to user registers
02DD service_trap:
02DD F5 push psw ; save A and Flag
02DE 3EFF mvi a,0ffh
02E0 D312 out system_port_c ; turn trap off by clearing shift
register
02E2 C5 push b
02E3 D5 push d
02E4 E5 push h
02E5 E1 pop h
02E6 2232F0 shld user_HL ; save HL
02E9 E1 pop h
02EA 2230F0 shld user_DE
02ED E1 pop h
02EE 222EF0 shld user_BC
02F1 E1 pop h
02F2 222CF0 shld user_AF
B8085.LST 29/12/2559 12:32
Page 7 of 64
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
02F5 E1 pop h ; store next PC
02F6 222AF0 shld user_PC
02F9 210000 lxi h,0
02FC 39 dad sp
02FD 2234F0 shld user_SP ; save user SP
0300 CDBE0A call read_memory
0303 3A25F0 lda uart_found
0306 FE00 cpi 0
0308 CA0E03 jz skip1
030B CD540F call register_display1
030E skip1:
030E 2A57F0 lhld save_stack
0311 F9 sphl ; restore system stack
0312 C9 ret ; jump back to main body
; disassemble machine code into mnemonic
0313 disassemble1:
0313 3A22F0 lda command
0316 FE64 cpi "d"
0318 C23903 jnz exit_disassemble
031B 21A11E lxi h,disassemble_text
031E CD5812 call put_str
0321 CDDA12 call new_line
0324 0E10 mvi c,16 ; 16 lines
0326 C5 dis2: push b
0327 CDDA12 call new_line
032A CDB003 call d_disassemble
032D C1 pop b
032E 0D dcr c
032F C22603 jnz dis2
0332 CDDA12 call new_Line
0335 CD3A0D call send_prompt
0338 C9 ret
0339 C9 exit_disassemble: ret
; disassemble opcode to mnemonic
; entry: user_PC
; exit: user_PC = next address
033A 2A2AF0 disassemble: lhld user_PC
033D E5 push h
033E 7C mov a,h
033F CDCB12 call out2x
0342 7D mov a,l
0343 CDCB12 call out2x
0346 CDE512 call space
0349 7E mov a,m ; get opcode
034A CD2604 call get_number_of_byte
034D 4F mov c,a
034E 7E disassem3: mov a,m
034F CDCB12 call out2x
0352 23 inx h
0353 0D dcr c
B8085.LST 29/12/2559 12:32
Page 8 of 64
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
0354 C24E03 jnz disassem3
0357 E1 pop h
0358 7E mov a,m
0359 CD2604 call get_number_of_byte
035C FE01 cpi 1
035E C26603 jnz one_tab
0361 3E09 mvi a,tab ; print two tabs for one byte opcode
0363 CD2F12 call cout
0366 3E09 one_tab: mvi a,tab ; else only one tab
0368 CD2F12 call cout
036B E5 push h
036C 7E mov a,m ; get opcode
036D F5 push psw
036E 210000 lxi h,0000h ; clear HL
0371 6F mov l,a
0372 29 dad h ; HL = HLx2
0373 5D mov e,l
0374 54 mov d,h
0375 210B15 lxi h,ins_table
0378 19 dad d ; ADD HL,DE
0379 5E mov e,m
037A 23 inx h
037B 56 mov d,m
037C 6B mov l,e
037D 62 mov h,d
037E CD5812 call put_str
0381 F1 pop psw
0382 E1 pop h
0383 CD2604 call get_number_of_byte
0386 FE01 cpi 1
0388 C29003 jnz disassem1
038B 23 inx h
038C 222AF0 shld user_PC
038F C9 ret
0390 FE02 disassem1: cpi 2
0392 C29F03 jnz disassem2
0395 23 inx h
0396 7E mov a,m
0397 CDCB12 call out2x
039A 23 inx h
039B 222AF0 shld user_PC
039E C9 ret
039F 23 disassem2: inx h
03A0 23 inx h
03A1 7E mov a,m
03A2 CDCB12 call out2x
03A5 2B dcx h
03A6 7E mov a,m
03A7 CDCB12 call out2x
03AA 23 inx h
03AB 23 inx h
03AC 222AF0 shld user_PC
03AF C9 ret
; disassemble opcode to mnemonic with command 'd'
; entry: pointer
; exit: pointer = next address
03B0 2A3CF0 d_disassemble: lhld pointer
B8085.LST 29/12/2559 12:32
Page 9 of 64
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
03B3 E5 push h
03B4 7C mov a,h
03B5 CDCB12 call out2x
03B8 7D mov a,l
03B9 CDCB12 call out2x
03BC CDE512 call space
03BF 7E mov a,m ; get opcode
03C0 CD2604 call get_number_of_byte
03C3 4F mov c,a
03C4 7E d_disassem3: mov a,m
03C5 CDCB12 call out2x
03C8 23 inx h
03C9 0D dcr c
03CA C2C403 jnz d_disassem3
03CD E1 pop h
03CE 7E mov a,m
03CF CD2604 call get_number_of_byte
03D2 FE01 cpi 1
03D4 C2DC03 jnz d_one_tab
03D7 3E09 mvi a,tab ; print two tabs for one byte opcode
03D9 CD2F12 call cout
03DC 3E09 d_one_tab: mvi a,tab ; else only one tab
03DE CD2F12 call cout
03E1 E5 push h
03E2 7E mov a,m ; get opcode
03E3 F5 push psw
03E4 210000 lxi h,0000h ; clear HL
03E7 6F mov l,a
03E8 29 dad h ; HL = HLx2
03E9 5D mov e,l
03EA 54 mov d,h
03EB 210B15 lxi h,ins_table
03EE 19 dad d ; ADD HL,DE
03EF 5E mov e,m
03F0 23 inx h
03F1 56 mov d,m
03F2 6B mov l,e
03F3 62 mov h,d
03F4 CD5812 call put_str
03F7 F1 pop psw
03F8 E1 pop h
03F9 CD2604 call get_number_of_byte
03FC FE01 cpi 1
03FE C20604 jnz d_disassem1
0401 23 inx h
0402 223CF0 shld pointer
0405 C9 ret
0406 FE02 d_disassem1: cpi 2
0408 C21504 jnz d_disassem2
040B 23 inx h
040C 7E mov a,m
040D CDCB12 call out2x
0410 23 inx h
0411 223CF0 shld pointer
0414 C9 ret
B8085.LST 29/12/2559 12:32
Page 10 of 64
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
0415 23 d_disassem2: inx h
0416 23 inx h
0417 7E mov a,m
0418 CDCB12 call out2x
041B 2B dcx h
041C 7E mov a,m
041D CDCB12 call out2x
0420 23 inx h
0421 23 inx h
0422 223CF0 shld pointer
0425 C9 ret
; get number of byte
; entry: A = OPCODE
; exit: A = number of byte, 1,2,3
; 0 = undefined opcode
0426 get_number_of_byte:
0426 FE01 cpi 01
0428 C22E04 jnz number1
042B 3E03 mvi a,3
042D C9 ret
042E FE06 number1: cpi 6
0430 C23604 jnz number2
0433 3E02 mvi a,2
0435 C9 ret
0436 FE0E number2: cpi 0eh
0438 C23E04 jnz number3
043B 3E02 mvi a,2
043D C9 ret
043E FE11 number3: cpi 11h
0440 C24604 jnz number4
0443 3E03 mvi a,3
0445 C9 ret
0446 FE16 number4: cpi 16h
0448 C24E04 jnz number5
044B 3E02 mvi a,2
044D C9 ret
044E FE1E number5: cpi 1eh
0450 C25604 jnz number6
0453 3E02 mvi a,2
0455 C9 ret
0456 FE21 number6: cpi 21h
0458 C25E04 jnz number7
045B 3E03 mvi a,3
045D C9 ret
045E FE22 number7: cpi 22h
0460 C26604 jnz number8
0463 3E03 mvi a,3
0465 C9 ret
0466 FE26 number8: cpi 26h
0468 C26E04 jnz number9
046B 3E02 mvi a,2
046D C9 ret
046E FE2A number9: cpi 2ah
0470 C27604 jnz number10
0473 3E03 mvi a,3
0475 C9 ret
0476 FE2E number10: cpi 2eh
0478 C27E04 jnz number11
047B 3E02 mvi a,2
047D C9 ret
047E FE31 number11: cpi 31h
B8085.LST 29/12/2559 12:32
Page 11 of 64
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
0480 C28604 jnz number12
0483 3E03 mvi a,3
0485 C9 ret
0486 FE32 number12: cpi 32h
0488 C28E04 jnz number13
048B 3E03 mvi a,3
048D C9 ret
048E FE36 number13: cpi 36h
0490 C29604 jnz number14
0493 3E03 mvi a,3
0495 C9 ret
0496 FE3A number14: cpi 3ah
0498 C29E04 jnz number15
049B 3E03 mvi a,3
049D C9 ret
049E FE3E number15: cpi 3eh
04A0 C2A604 jnz number16
04A3 3E02 mvi a,2
04A5 C9 ret
04A6 FEC2 number16: cpi 0c2h
04A8 C2AE04 jnz number17
04AB 3E03 mvi a,3
04AD C9 ret
04AE FEC3 number17: cpi 0c3h
04B0 C2B604 jnz number18
04B3 3E03 mvi a,3
04B5 C9 ret
04B6 FEC4 number18: cpi 0c4h
04B8 C2BE04 jnz number19
04BB 3E03 mvi a,3
04BD C9 ret
04BE FEC6 number19: cpi 0c6h
04C0 C2C604 jnz number20
04C3 3E02 mvi a,2
04C5 C9 ret
04C6 FECA number20: cpi 0cah
04C8 C2CE04 jnz number21
04CB 3E03 mvi a,3
04CD C9 ret
04CE FECC number21: cpi 0cch
04D0 C2D604 jnz number22
04D3 3E03 mvi a,3
04D5 C9 ret
04D6 FECD number22: cpi 0cdh
04D8 C2DE04 jnz number23
04DB 3E03 mvi a,3
04DD C9 ret
04DE FECE number23: cpi 0ceh
04E0 C2E604 jnz number24
04E3 3E02 mvi a,2
04E5 C9 ret
04E6 FED2 number24: cpi 0d2h
04E8 C2EE04 jnz number25
04EB 3E03 mvi a,3
04ED C9 ret
04EE FED3 number25: cpi 0d3h
04F0 C2F604 jnz number26
04F3 3E02 mvi a,2
04F5 C9 ret
04F6 FED4 number26: cpi 0d4h
04F8 C2FE04 jnz number27
B8085.LST 29/12/2559 12:32
Page 12 of 64
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
04FB 3E03 mvi a,3
04FD C9 ret
04FE FED6 number27: cpi 0d6h
0500 C20605 jnz number28
0503 3E02 mvi a,2
0505 C9 ret
0506 FEDA number28: cpi 0dah
0508 C20E05 jnz number29
050B 3E03 mvi a,3
050D C9 ret
050E FEDB number29: cpi 0dbh
0510 C21605 jnz number30
0513 3E02 mvi a,2
0515 C9 ret
0516 FEDC number30: cpi 0dch
0518 C21E05 jnz number31
051B 3E03 mvi a,3
051D C9 ret
051E FEE2 number31: cpi 0e2h
0520 C22605 jnz number32
0523 3E03 mvi a,3
0525 C9 ret
0526 FEE4 number32: cpi 0e4h
0528 C22E05 jnz number33
052B 3E03 mvi a,3
052D C9 ret
052E FEE6 number33: cpi 0e6h
0530 C23605 jnz number34
0533 3E02 mvi a,2
0535 C9 ret
0536 FEEA number34: cpi 0eah
0538 C23E05 jnz number35
053B 3E03 mvi a,3
053D C9 ret
053E FEEC number35: cpi 0ech
0540 C24605 jnz number36
0543 3E03 mvi a,3
0545 C9 ret
0546 FEEE number36: cpi 0eeh
0548 C24E05 jnz number37
054B 3E02 mvi a,2
054D C9 ret
054E FEF2 number37: cpi 0f2h
0550 C25605 jnz number38
0553 3E03 mvi a,3
0555 C9 ret
0556 FEF4 number38: cpi 0f4h
0558 C25E05 jnz number39
055B 3E03 mvi a,3
055D C9 ret
055E FEF6 number39: cpi 0f6h
0560 C26605 jnz number40
0563 3E02 mvi a,2
0565 C9 ret
0566 FEFA number40: cpi 0fah
0568 C26E05 jnz number41
056B 3E03 mvi a,3
056D C9 ret
056E FEFC number41: cpi 0fch
0570 C27605 jnz number42
0573 3E03 mvi a,3
B8085.LST 29/12/2559 12:32
Page 13 of 64
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
0575 C9 ret
0576 FEFE number42: cpi 0feh
0578 C27E05 jnz number43
057B 3E02 mvi a,2
057D C9 ret
057E 3E01 number43: mvi a,1
0580 C9 ret
; execute key 0-F or 10H-19H
0581 FE10 key_execute: cpi 10h
0583 D28D05 jnc function_key ; 0-9 jump to data key
0586 57 mov d,a
0587 CD3106 call buzzer
058A F20906 jp data_key
058D FE12 function_key: cpi 12h
058F C29805 jnz function1
0592 CD3106 call buzzer
0595 F2650A jp increment
0598 FE15 function1: cpi 15h
059A C2A305 jnz function2
059D CD3106 call buzzer
05A0 F2780A jp decrement
05A3 FE10 function2: cpi 10h
05A5 C2AE05 jnz function3
05A8 CD3106 call buzzer
05AB F2010A jp address_mode
05AE FE11 function3: cpi 11h
05B0 C2B905 jnz function4
05B3 CD3106 call buzzer
05B6 F20E0A jp data_mode
05B9 FE13 function4: cpi 13h
05BB C2C505 jnz function5
05BE CD3106 call buzzer
05C1 F29B09 jp go
05C4 C9 ret
05C5 FE14 function5: cpi 14h
05C7 C2D005 jnz function6
05CA CD3106 call buzzer
05CD F2190A jp function_2nd
05D0 FE16 function6: cpi 16h
05D2 C2DB05 jnz function7
05D5 CD3106 call buzzer
05D8 F2BF09 jp single_step
05DB FE17 function7: cpi 17h
05DD C2E605 jnz function8
05E0 CD3106 call buzzer
05E3 F28109 jp home
05E6 FE18 function8: cpi 18h
05E8 C2F105 jnz function9
05EB CD3106 call buzzer
05EE F23D0A jp modify_register
05F1 C9 function9: ret
; test running onboard led
B8085.LST 29/12/2559 12:32
Page 14 of 64
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
05F2 3E01 test_led: mvi a,1
05F4 D300 test_led1: out gpio
05F6 115010 lxi d,1050h
05F9 CD0006 call delay
05FC 07 rlc
05FD C3F405 jmp test_led1
; delay subroutine
; entry: D= outer loop E=inner loop (should be 0 for long delay)
; exit: none
0600 1D delay: dcr e
0601 C20006 jnz delay
0604 15 dcr d
0605 C20006 jnz delay
0608 C9 ret
0609 3A26F0 data_key: lda entry_mode
060C FE00 cpi 0
060E C21406 jnz data_key1
0611 F2CF06 jp enter_data
0614 FE01 data_key1: cpi 1
0616 C21C06 jnz data_key2
0619 F20907 jp enter_address
061C FE02 data_key2: cpi 2
061E C22406 jnz data_key3
0621 F24307 jp select_register
0624 FE03 data_key3: cpi 3
0626 C22C06 jnz data_key4
0629 F26F06 jp enter_register
062C data_key4:
062C C9 ret
062D CD4006 test_buzzer: call beep_on
0630 C9 ret
;mvi a,7fh
;out system_port_c
;lxi d,1000h
;call delay
;mvi a,0ffh
;out system_port_c
;ret
; produce beep output at system port c.7
; click when key pressed
0631 3A24F0 buzzer: lda beep_flag
0634 E601 ani 1
0636 CA4006 jz beep_on
0639 0600 mvi b,0
063B 05 delay_nobeep: dcr b
063C C23B06 jnz delay_nobeep
063F C9 ret
0640 beep_on:
0640 0E20 mvi c,20h
0642 3E7F buzzer1: mvi a,7fh
0644 D312 out system_port_c ;nop ;out system_port_c
0646 CD5906 call delay_us
0649 3EFF mvi a,0ffh
064B D312 out system_port_c ;nop ;out system_port_c
064D CD5906 call delay_us
0650 0D dcr c
B8085.LST 29/12/2559 12:32
Page 15 of 64
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
0651 C24206 jnz buzzer1
0654 3EFF mvi a,0ffh
0656 D312 out system_port_c
0658 C9 ret
0659 0660 delay_us: mvi b,60h
065B 05 delay_us1: dcr b
065C C25B06 jnz delay_us1
065F C9 ret
;----- turn display off while key has been pressing ------------------
; useful for no function accepted
0660 219E1D display_off: lxi h,off_display
0663 CDAE0C off_display1: call scan
0666 3A21F0 lda key
0669 FEFF cpi 0ffh
066B C26306 jnz off_display1 ; loop if key still pressed
066E C9 ret
;************* modify current displayed register **********************
; entry: current user register displayed
;
066F enter_register:
066F 2A38F0 lhld current_register
0672 4E mov c,m
0673 23 inx h
0674 46 mov b,m
0675 210000 lxi h,0
0678 09 dad b ; MOV HL,BC
0679 5A mov e,d ; save key code to E
067A shift_register:
067A 7D mov a,l
067B 07 rlc
067C 6F mov l,a
067D 7C mov a,h
067E 17 ral
067F 67 mov h,a
0680 7D mov a,l
0681 07 rlc
0682 6F mov l,a
0683 7C mov a,h
0684 17 ral
0685 67 mov h,a
0686 7D mov a,l
0687 07 rlc
0688 6F mov l,a
0689 7C mov a,h
068A 17 ral
068B 67 mov h,a
068C 7D mov a,l
068D 07 rlc
068E 6F mov l,a
068F 7C mov a,h
0690 17 ral
0691 67 mov h,a
0692 7D mov a,l
0693 E6F0 ani 0f0h
0695 82 add d
0696 6F mov l,a
B8085.LST 29/12/2559 12:32
Page 16 of 64
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
0697 44 mov b,h
0698 4D mov c,l
0699 2A38F0 lhld current_register
069C 71 mov m,c
069D 23 inx h
069E 70 mov m,b
069F 2A38F0 lhld current_register
06A2 4E mov c,m
06A3 23 inx h
06A4 46 mov b,m
06A5 210000 lxi h,0
06A8 09 dad b ; MOV HL,BC
06A9 CD930A call read_register
06AC F5 push psw
06AD 3A13F0 lda buffer+3
06B0 F680 ori 80h
06B2 3213F0 sta buffer+3
06B5 3A12F0 lda buffer+2
06B8 F680 ori 80h
06BA 3212F0 sta buffer+2
06BD 3A11F0 lda buffer+1
06C0 F680 ori 80h
06C2 3211F0 sta buffer+1
06C5 3A10F0 lda buffer
06C8 F680 ori 80h
06CA 3210F0 sta buffer
06CD F1 pop psw
06CE C9 ret
; enter nibble into current location
06CF 2A2AF0 enter_data: lhld user_PC
06D2 5A mov e,d ; save key code to E
06D3 3A27F0 lda counter1
06D6 FE00 cpi 0
06D8 C2E206 jnz shift_data
06DB 3C inr a
06DC 3227F0 sta counter1
06DF 3E00 mvi a,0
06E1 77 mov m,a
06E2 7E shift_data: mov a,m
06E3 07 rlc
06E4 07 rlc
06E5 07 rlc
06E6 07 rlc
06E7 E6F0 ani 0f0h ; make low nibble to 0 before insert
06E9 83 add e ; insert low nibble to A
06EA 77 mov m,a
06EB 57 mov d,a
06EC 7E mov a,m ; check if the space is ram or rom
06ED BA cmp d
06EE CA0507 jz it_is_ram
; if it was rom them turn of led while key has been pressed
06F1 219E1D lxi h,off_display
B8085.LST 29/12/2559 12:32
Page 17 of 64
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
06F4 CDAE0C enter_data1: call scan
06F7 3A21F0 lda key
06FA FEFF cpi 0ffh
06FC C2F406 jnz enter_data1 ; loop if key still pressed
06FF CDA70C call debounce ; debounce after key was released
0702 2110F0 lxi h,buffer ; back to show display again
0705 it_is_ram:
0705 CDBE0A call read_memory
0708 C9 ret
; enter nibble into current pointer
0709 2A2AF0 enter_address: lhld user_PC
070C 5A mov e,d ; save key code to E
070D 3A28F0 lda counter2
0710 FE00 cpi 0
0712 C21F07 jnz shift_address
0715 3C inr a
0716 3228F0 sta counter2
0719 210000 lxi h,0
071C 222AF0 shld user_PC
071F shift_address:
071F 7D mov a,l
0720 07 rlc
0721 6F mov l,a
0722 7C mov a,h
0723 17 ral
0724 67 mov h,a
0725 7D mov a,l
0726 07 rlc
0727 6F mov l,a
0728 7C mov a,h
0729 17 ral
072A 67 mov h,a
072B 7D mov a,l
072C 07 rlc
072D 6F mov l,a
072E 7C mov a,h
072F 17 ral
0730 67 mov h,a
0731 7D mov a,l
0732 07 rlc
0733 6F mov l,a
0734 7C mov a,h
0735 17 ral
0736 67 mov h,a
0737 7D mov a,l
0738 E6F0 ani 0f0h
073A 82 add d
073B 6F mov l,a
073C 222AF0 shld user_PC ; store new pointer
073F CDBE0A call read_memory
0742 C9 ret
;****************** ALT register display ******************************
0743 5A select_register: mov e,d ; save key for selecting user register
0744 7A mov a,d
0745 FE00 cpi 0
0747 C26107 jnz register1
B8085.LST 29/12/2559 12:32
Page 18 of 64
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
074A 3E77 mvi a,77h ; AF register pair
074C 3214F0 sta buffer+4
074F 3E71 mvi a,71h
0751 3215F0 sta buffer+5
0754 212CF0 lxi h,user_AF
0757 2238F0 shld current_register
075A 2A2CF0 lhld user_AF
075D CD930A call read_register
0760 C9 ret
0761 register1:
0761 FE01 cpi 1
0763 C27D07 jnz register2
0766 3E7C mvi a,7ch ; BC register pair
0768 3214F0 sta buffer+4
076B 3E39 mvi a,39h
076D 3215F0 sta buffer+5
0770 212EF0 lxi h,user_BC
0773 2238F0 shld current_register
0776 2A2EF0 lhld user_BC
0779 CD930A call read_register
077C C9 ret
077D register2:
077D FE02 cpi 2
077F C29907 jnz register3
0782 3E5E mvi a,5eh ; DE register pair
0784 3214F0 sta buffer+4
0787 3E79 mvi a,79h
0789 3215F0 sta buffer+5
078C 2130F0 lxi h,user_DE
078F 2238F0 shld current_register
0792 2A30F0 lhld user_DE
0795 CD930A call read_register
0798 C9 ret
0799 register3:
0799 FE03 cpi 3
079B C2B507 jnz register4
079E 3E76 mvi a,76h ; HL register pair
07A0 3214F0 sta buffer+4
07A3 3E38 mvi a,38h
07A5 3215F0 sta buffer+5
07A8 2132F0 lxi h,user_HL
07AB 2238F0 shld current_register
07AE 2A32F0 lhld user_HL
07B1 CD930A call read_register
07B4 C9 ret
07B5 register4:
07B5 FE04 cpi 4
07B7 C2D107 jnz register5
07BA 3E6D mvi a,6dh ; user SP
07BC 3214F0 sta buffer+4
07BF 3E73 mvi a,73h
07C1 3215F0 sta buffer+5
07C4 2134F0 lxi h,user_SP
07C7 2238F0 shld current_register
07CA 2A34F0 lhld user_SP
B8085.LST 29/12/2559 12:32
Page 19 of 64
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
07CD CD930A call read_register
07D0 C9 ret
07D1 register5:
07D1 FE05 cpi 5
07D3 C2F807 jnz register6
07D6 3E73 mvi a,73h ; user PC
07D8 3214F0 sta buffer+4
07DB 3E39 mvi a,39h
07DD 3215F0 sta buffer+5
07E0 212AF0 lxi h,user_PC
07E3 2238F0 shld current_register
07E6 2A2AF0 lhld user_PC
07E9 CD930A call read_register
07EC C9 ret
;---- display carry flag
-------------------------------------------------
07ED C2F507 put_flag: jnz put_high1
07F0 3E3F mvi a,3fh
07F2 C3F707 jmp skip_put_high1
07F5 3E06 put_high1: mvi a,06h
07F7 skip_put_high1:
07F7 C9 ret
07F8 register6:
07F8 FE06 cpi 6
07FA C22008 jnz register7
07FD 3E39 mvi a,39h ; carry flag
07FF 3210F0 sta buffer
0802 3E6E mvi a,6eh
0804 3211F0 sta buffer+1
0807 3E48 mvi a,48h
0809 3212F0 sta buffer+2
080C 2A2CF0 lhld user_AF
080F 7D mov a,l
0810 E601 ani 1
0812 CDED07 call put_flag
0815 3213F0 sta buffer+3
0818 AF xra a
0819 3214F0 sta buffer+4
081C 3215F0 sta buffer+5
081F C9 ret
0820 register7:
0820 FE07 cpi 7
0822 C24B08 jnz register8
0825 3E49 mvi a,49h ; zero flag
0827 3210F0 sta buffer
082A 3E79 mvi a,79h
082C 3211F0 sta buffer+1
082F 3E50 mvi a,50h
0831 3212F0 sta buffer+2
0834 3E5C mvi a,5ch
0836 3213F0 sta buffer+3
0839 3E48 mvi a,48h
083B 3214F0 sta buffer+4
083E 2A2CF0 lhld user_AF
0841 7D mov a,l
0842 E640 ani 40h
B8085.LST 29/12/2559 12:32
Page 20 of 64
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
0844 CDED07 call put_flag
0847 3215F0 sta buffer+5
084A C9 ret
084B register8:
084B FE08 cpi 8
084D C27C08 jnz register9
0850 3E6D mvi a,6dh ; sign flag
0852 3210F0 sta buffer
0855 3E11 mvi a,11h
0857 3211F0 sta buffer+1
085A 3E6F mvi a,6fh
085C 3212F0 sta buffer+2
085F 3E54 mvi a,54h
0861 3213F0 sta buffer+3
0864 3E48 mvi a,48h
0866 3214F0 sta buffer+4
0869 2A2CF0 lhld user_AF
086C 7D mov a,l
086D 17 ral
086E DA7608 jc put_high2
0871 3E3F mvi a,3fh
0873 C37808 jmp skip_put_high2
0876 3E06 put_high2: mvi a,06h
0878 skip_put_high2:
0878 3215F0 sta buffer+5
087B C9 ret
087C register9:
087C FE09 cpi 9
087E C2A408 jnz register10
0881 3E77 mvi a,77h ; AC flag
0883 3210F0 sta buffer
0886 3E39 mvi a,39h
0888 3211F0 sta buffer+1
088B 3E48 mvi a,48h
088D 3212F0 sta buffer+2
0890 2A2CF0 lhld user_AF
0893 7D mov a,l
0894 E610 ani 10h
0896 CDED07 call put_flag
0899 3213F0 sta buffer+3
089C AF xra a
089D 3214F0 sta buffer+4
08A0 3215F0 sta buffer+5
08A3 C9 ret
08A4 register10:
08A4 FE0A cpi 10
08A6 C2CA08 jnz break
08A9 3E73 mvi a,73h ; Parity flag
08AB 3210F0 sta buffer
08AE 3E48 mvi a,48h
08B0 3211F0 sta buffer+1
08B3 2A2CF0 lhld user_AF
08B6 7D mov a,l
08B7 E604 ani 4
08B9 CDED07 call put_flag
08BC 3212F0 sta buffer+2
08BF AF xra a
B8085.LST 29/12/2559 12:32
Page 21 of 64
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
08C0 3213F0 sta buffer+3
08C3 3214F0 sta buffer+4
08C6 3215F0 sta buffer+5
08C9 C9 ret
; ------------------ ALT B SET BREAK POINT ---------------------------
08CA FE0B break: cpi 11
08CC C20409 jnz clear_break
08CF 2A2AF0 lhld user_PC ; save user PC
08D2 223EF0 shld break_address
08D5 7E mov a,m ; get user code
08D6 3240F0 sta break_opcode ; save it
08D9 E5 push h
08DA CDBE0A call read_memory
08DD E1 pop h
08DE 3EFF mvi a,0FFh ; RST 7 opcode
08E0 77 mov m,a ; replace user code with RST 7
08E1 F5 push psw
08E2 3A10F0 lda buffer
08E5 F680 ori 80h
08E7 3210F0 sta buffer
08EA 3A11F0 lda buffer+1
08ED F680 ori 80h
08EF 3211F0 sta buffer+1
08F2 3A12F0 lda buffer+2
08F5 F680 ori 80h
08F7 3212F0 sta buffer+2
08FA 3A13F0 lda buffer+3
08FD F680 ori 80h
08FF 3213F0 sta buffer+3
0902 F1 pop psw
0903 C9 ret
;----------------- ALT C CLEAR BREAK POINT ---------------------------
0904 FE0C clear_break: cpi 12
0906 C21F09 jnz insert_byte
0909 2140F0 lxi h,break_opcode ; restore user code
090C 7E mov a,m
090D 2A3EF0 lhld break_address
0910 77 mov m,a
0911 222AF0 shld user_PC
0914 CDBE0A call read_memory
0917 AF xra a
0918 3226F0 sta entry_mode
091B CD020B call mode_indicator
091E C9 ret
;--------------- ALT E insert byte ---------------------------------
; insert byte within 512 bytes from current location
091F FE0E insert_byte: cpi 14 ; test with key E
0921 C24A09 jnz delete_byte
0924 2A2AF0 lhld user_PC
0927 E5 push h ; save PC to stack
0928 110002 lxi d,512
092B 19 dad d
092C E5 push h
092D C1 pop b ; copy HL to BC
092E 0B dcx b
B8085.LST 29/12/2559 12:32
Page 22 of 64
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
092F 110002 lxi d,512 ; load counter with 512 bytes
0932 insert_byte1:
0932 0A ldax b
0933 77 mov m,a
0934 2B dcx h
0935 0B dcx b
0936 1B dcx d
0937 7B mov a,e
0938 B2 ora d ; check DE ==0
0939 C23209 jnz insert_byte1
093C E1 pop h ; restore user PC
093D AF xra a
093E 77 mov m,a ; store 00 at insert byte
093F CDBE0A call read_memory
0942 AF xra a
0943 3226F0 sta entry_mode
0946 CD020B call mode_indicator
0949 C9 ret
;--------------- ALT D delete byte ---------------------------------
; delete byte within 512 bytes
094A FE0D delete_byte: cpi 13
094C C26F09 jnz beep_chk
094F 2A2AF0 lhld user_PC
0952 E5 push h
0953 E5 push h
0954 C1 pop b
0955 03 inx b
0956 110002 lxi d,512
0959 delete_byte1:
0959 0A ldax b
095A 77 mov m,a
095B 23 inx h
095C 03 inx b
095D 1B dcx d
095E 7B mov a,e
095F B2 ora d ; check if DE ==0
0960 C25909 jnz delete_byte1
0963 E1 pop h
0964 CDBE0A call read_memory
0967 AF xra a
0968 3226F0 sta entry_mode
096B CD020B call mode_indicator
096E C9 ret
;--------------- ALT F BEEP/NO BEEP ---------------------------------
096F FE0F beep_chk: cpi 15
0971 C27D09 jnz option1
0974 3A24F0 lda beep_flag
0977 EE01 xri 1
0979 3224F0 sta beep_flag
097C C9 ret
097D option1:
097D CD6006 call display_off ; no service key
0980 C9 ret
0981 210081 home: lxi h,home_address
0984 222AF0 shld user_PC
0987 2110F0 lxi h,buffer
098A CDBE0A call read_memory
098D AF xra a
B8085.LST 29/12/2559 12:32
Page 23 of 64
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
098E 3226F0 sta entry_mode
0991 CD020B call mode_indicator
0994 C9 ret
0995 3E2A debug: mvi a,"*"
0997 CD2F12 call cout
099A C9 ret
; go function, jump from monitor program to user program
; save system stack and load user stack
; load CPU registers with user registers before jump
099B go:
099B 210000 lxi h,0
099E 39 dad sp ; save system stack
099F 2257F0 shld save_stack
09A2 2A34F0 lhld user_SP ; get user stack
09A5 F9 sphl ; load user stack
09A6 2A2AF0 lhld user_PC
09A9 E5 push h
09AA 2A2CF0 lhld user_AF
09AD E5 push h
09AE 2A2EF0 lhld user_BC
09B1 E5 push h
09B2 2A30F0 lhld user_DE
09B5 E5 push h
09B6 2A32F0 lhld user_HL
09B9 E5 push h
09BA E1 pop h
09BB D1 pop d
09BC C1 pop b
09BD F1 pop psw
09BE C9 ret ; jump to user program
; single step
; load CPU registers with user registers, enable trap signal then jump
to
; program
; disassemble line to be executed
09BF single_step:
09BF 210000 lxi h,0
09C2 39 dad sp ; save system stack
09C3 2257F0 shld save_stack
09C6 2A34F0 lhld user_SP
09C9 F9 sphl ; load user stack
09CA 2A2AF0 lhld user_PC ; get address to be executed
09CD E5 push h ; save to stack
09CE 3A25F0 lda uart_found
09D1 FE00 cpi 0
09D3 CADF09 jz skip2 ; if no uart, skip disassemble
09D6 CDDA12 call new_line
09D9 CDEB12 call send_tab
09DC CD3A03 call disassemble
09DF skip2:
09DF E1 pop h
09E0 222AF0 shld user_PC
09E3 2A2AF0 lhld user_PC
09E6 E5 push h
09E7 2A2CF0 lhld user_AF
09EA E5 push h
B8085.LST 29/12/2559 12:32
Page 24 of 64
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
09EB 2A2EF0 lhld user_BC
09EE E5 push h
09EF 2A30F0 lhld user_DE
09F2 E5 push h
09F3 2A32F0 lhld user_HL
09F6 E5 push h
09F7 E1 pop h
09F8 D1 pop d
09F9 C1 pop b
09FA 3EBF mvi a,0bfh ; make port_c.6 low to enable trap
09FC D312 out system_port_c ;
; now the shift register 74LS164 is running
; within 8 ALE, trap will be high, trap will be recorgnized after
instruction
; followed RET was executed
09FE 00 nop ; 1 cycles
09FF F1 pop psw ; 5 cycles
0A00 C9 ret ; 3 cycles
; set mode to 1
0A01 3E01 address_mode: mvi a,1
0A03 3226F0 sta entry_mode
0A06 CDBE0A call read_memory
0A09 AF xra a
0A0A 3228F0 sta counter2
0A0D C9 ret
0A0E AF data_mode: xra a
0A0F 3226F0 sta entry_mode
0A12 3227F0 sta counter1
0A15 CDBE0A call read_memory
0A18 C9 ret
0A19 3E02 function_2nd: mvi a,2
0A1B 3226F0 sta entry_mode
0A1E 3E77 mvi a,77h
0A20 3210F0 sta buffer
0A23 3E38 mvi a,38h
0A25 3211F0 sta buffer+1
0A28 3E78 mvi a,78h
0A2A 3212F0 sta buffer+2
0A2D 3E00 mvi a,0
0A2F 3213F0 sta buffer+3
0A32 3E00 mvi a,0
0A34 3214F0 sta buffer+4
0A37 3E00 mvi a,0
0A39 3215F0 sta buffer+5
0A3C C9 ret
; set entry mode to 3
; hex data will be used for register modifying
0A3D modify_register:
0A3D F5 push psw
0A3E 3E03 mvi a,3
0A40 3226F0 sta entry_mode
0A43 3A13F0 lda buffer+3
0A46 F680 ori 80h
0A48 3213F0 sta buffer+3
0A4B 3A12F0 lda buffer+2
0A4E F680 ori 80h
0A50 3212F0 sta buffer+2
0A53 3A11F0 lda buffer+1
0A56 F680 ori 80h
0A58 3211F0 sta buffer+1
B8085.LST 29/12/2559 12:32
Page 25 of 64
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
0A5B 3A10F0 lda buffer
0A5E F680 ori 80h
0A60 3210F0 sta buffer
0A63 F1 pop psw
0A64 C9 ret
; increment key works with mode0 or mode1 display
0A65 3E00 increment: mvi a,0
0A67 3226F0 sta entry_mode ; switch to data mode
0A6A 3227F0 sta counter1 ; clear event counter1
0A6D 2A2AF0 lhld user_PC
0A70 23 inx h
0A71 222AF0 shld user_PC
0A74 CDBE0A call read_memory
0A77 C9 ret
; decrement key works with mode0 or mode1 display
0A78 3E00 decrement: mvi a,0
0A7A 3226F0 sta entry_mode ; switch to data mode
0A7D 2A2AF0 lhld user_PC
0A80 2B dcx h
0A81 222AF0 shld user_PC
0A84 CDBE0A call read_memory
0A87 C9 ret
; convert nibble 0-F to 8-bit seven segment code
; entry: A
; exit: A
0A88 to_seven_segment:
0A88 E60F ani 0fh ; get only low nibble as the index
0A8A 218E1D lxi h,convert
0A8D 5F mov e,a
0A8E 1600 mvi d,0
0A90 19 dad d
0A91 7E mov a,m ; get code
0A92 C9 ret
; convert [HL] to display buffer 0-3
; for register display
; entry: HL
0A93 read_register:
0A93 E5 push h
0A94 7C mov a,h
0A95 F5 push psw
0A96 0F rrc
0A97 0F rrc
0A98 0F rrc
0A99 0F rrc
0A9A CD880A call to_seven_segment
0A9D 3210F0 sta buffer
0AA0 F1 pop psw
0AA1 CD880A call to_seven_segment
0AA4 3211F0 sta buffer+1
0AA7 E1 pop h
0AA8 E5 push h
B8085.LST 29/12/2559 12:32
Page 26 of 64
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
0AA9 7D mov a,l
0AAA F5 push psw
0AAB 0F rrc
0AAC 0F rrc
0AAD 0F rrc
0AAE 0F rrc
0AAF CD880A call to_seven_segment
0AB2 3212F0 sta buffer+2
0AB5 F1 pop psw
0AB6 CD880A call to_seven_segment
0AB9 3213F0 sta buffer+3
0ABC E1 pop h
0ABD C9 ret
; convert current address and data to display buffer
;
0ABE 2A2AF0 read_memory: lhld user_PC
0AC1 E5 push h
0AC2 7C mov a,h
0AC3 F5 push psw
0AC4 0F rrc
0AC5 0F rrc
0AC6 0F rrc
0AC7 0F rrc
0AC8 CD880A call to_seven_segment
0ACB 3210F0 sta buffer
0ACE F1 pop psw
0ACF CD880A call to_seven_segment
0AD2 3211F0 sta buffer+1
0AD5 E1 pop h
0AD6 E5 push h
0AD7 7D mov a,l
0AD8 F5 push psw
0AD9 0F rrc
0ADA 0F rrc
0ADB 0F rrc
0ADC 0F rrc
0ADD CD880A call to_seven_segment
0AE0 3212F0 sta buffer+2
0AE3 F1 pop psw
0AE4 CD880A call to_seven_segment
0AE7 3213F0 sta buffer+3
0AEA E1 pop h
0AEB 7E mov a,m ; read from memory
0AEC F5 push psw
0AED 0F rrc
0AEE 0F rrc
0AEF 0F rrc
0AF0 0F rrc
0AF1 CD880A call to_seven_segment
0AF4 3214F0 sta buffer+4
0AF7 F1 pop psw
0AF8 CD880A call to_seven_segment
0AFB 3215F0 sta buffer+5
0AFE CD020B call mode_indicator
0B01 C9 ret
0B02 mode_indicator:
0B02 F5 push psw
0B03 3A26F0 lda entry_mode
B8085.LST 29/12/2559 12:32
Page 27 of 64
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
0B06 FE00 cpi 0
0B08 C23D0B jnz mode1
0B0B 3A15F0 lda buffer+5 ; mode 0 indicator
0B0E F680 ori 80h
0B10 3215F0 sta buffer+5
0B13 3A14F0 lda buffer+4
0B16 F680 ori 80h
0B18 3214F0 sta buffer+4
0B1B 3A13F0 lda buffer+3
0B1E E67F ani 7fh
0B20 3213F0 sta buffer+3
0B23 3A12F0 lda buffer+2
0B26 E67F ani 7fh
0B28 3212F0 sta buffer+2
0B2B 3A11F0 lda buffer+1
0B2E E67F ani 7fh
0B30 3211F0 sta buffer+1
0B33 3A10F0 lda buffer
0B36 E67F ani 7fh
0B38 3210F0 sta buffer
0B3B F1 pop psw
0B3C C9 ret
0B3D FE01 mode1: cpi 1
0B3F C2740B jnz mode2
0B42 3A15F0 lda buffer+5 ; mode 1 indicator
0B45 E67F ani 7fh
0B47 3215F0 sta buffer+5
0B4A 3A14F0 lda buffer+4
0B4D E67F ani 7fh
0B4F 3214F0 sta buffer+4
0B52 3A13F0 lda buffer+3
0B55 F680 ori 80h
0B57 3213F0 sta buffer+3
0B5A 3A12F0 lda buffer+2
0B5D F680 ori 80h
0B5F 3212F0 sta buffer+2
0B62 3A11F0 lda buffer+1
0B65 F680 ori 80h
0B67 3211F0 sta buffer+1
0B6A 3A10F0 lda buffer
0B6D F680 ori 80h
0B6F 3210F0 sta buffer
0B72 F1 pop psw
0B73 C9 ret
0B74 F1 mode2: pop psw
0B75 C9 ret
0B76 0E07 cold_boot: mvi c,7
0B78 21940B lxi h,title
0B7B 1650 cold2: mvi d,50h
B8085.LST 29/12/2559 12:32
Page 28 of 64
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
0B7D CDAE0C cold1: call scan
0B80 15 dcr d
0B81 C27D0B jnz cold1
0B84 23 inx h
0B85 0D dcr c
0B86 C27B0B jnz cold2
0B89 2B dcx h
0B8A 0E00 mvi c,0
0B8C CDAE0C cold3: call scan
0B8F 0D dcr c
0B90 C28C0B jnz cold3
0B93 C9 ret
0B94 0000000000title: dfb 0,0,0,0,0,0,7fh,3fh,7fh,6dh,0,0
; display data read from memory pointed to by HL on LED
; entry: HL
;
0BA0 1605 demo: mvi d,5
0BA2 CDAE0C demo1_2: call scan
0BA5 15 dcr d
0BA6 C2A20B jnz demo1_2
0BA9 23 inx h
0BAA C9 ret
; convert position key to internal key code 0-F for data entry and 10-19
H
; function keys
; entry: A = scan code
; exit: A = internal code
0BAB FE02 get_key_code: cpi 2
0BAD C2B30B jnz code1
0BB0 3E00 mvi a,0
0BB2 C9 ret
0BB3 FE0A code1: cpi 0ah
0BB5 C2BB0B jnz code2
0BB8 3E01 mvi a,1
0BBA C9 ret
0BBB FE12 code2: cpi 12h
0BBD C2C30B jnz code3
0BC0 3E02 mvi a,2
0BC2 C9 ret
0BC3 FE1A code3: cpi 1ah
0BC5 C2CB0B jnz code4
0BC8 3E03 mvi a,3
0BCA C9 ret
0BCB FE03 code4: cpi 3
0BCD C2D30B jnz code5
0BD0 3E04 mvi a,4
0BD2 C9 ret
0BD3 FE0B code5: cpi 0bh
0BD5 C2DB0B jnz code6
0BD8 3E05 mvi a,5
0BDA C9 ret
0BDB FE13 code6: cpi 13h
0BDD C2E30B jnz code7
0BE0 3E06 mvi a,6
0BE2 C9 ret
0BE3 FE1B code7: cpi 1bh
0BE5 C2EB0B jnz code8
B8085.LST 29/12/2559 12:32
Page 29 of 64
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
0BE8 3E07 mvi a,7
0BEA C9 ret
0BEB FE04 code8: cpi 4
0BED C2F30B jnz code9
0BF0 3E08 mvi a,8
0BF2 C9 ret
0BF3 FE0C code9: cpi 0ch
0BF5 C2FB0B jnz code10
0BF8 3E09 mvi a,9
0BFA C9 ret
0BFB FE14 code10: cpi 14h
0BFD C2030C jnz code11
0C00 3E0A mvi a,0ah
0C02 C9 ret
0C03 FE1C code11: cpi 1ch
0C05 C20B0C jnz code12
0C08 3E0B mvi a,0bh
0C0A C9 ret
0C0B FE05 code12: cpi 5
0C0D C2130C jnz code13
0C10 3E0C mvi a,0ch
0C12 C9 ret
0C13 FE0D code13: cpi 0dh
0C15 C21B0C jnz code14
0C18 3E0D mvi a,0dh
0C1A C9 ret
0C1B FE15 code14: cpi 15h
0C1D C2230C jnz code15
0C20 3E0E mvi a,0eh
0C22 C9 ret
0C23 FE1D code15: cpi 1dh
0C25 C22B0C jnz code16
0C28 3E0F mvi a,0fh
0C2A C9 ret
0C2B FE10 code16: cpi 10h
0C2D C2330C jnz code17
0C30 3E10 mvi a,10h
0C32 C9 ret
0C33 FE18 code17: cpi 18h
0C35 C23B0C jnz code18
0C38 3E11 mvi a,11h
0C3A C9 ret
0C3B FE01 code18: cpi 1
0C3D C2430C jnz code19
0C40 3E12 mvi a,12h
0C42 C9 ret
0C43 FE00 code19: cpi 0
0C45 C24B0C jnz code20
0C48 3E13 mvi a,13h
0C4A C9 ret
0C4B FE08 code20: cpi 8
0C4D C2530C jnz code21
0C50 3E14 mvi a,14h
0C52 C9 ret
0C53 FE09 code21: cpi 9
0C55 C25B0C jnz code22
0C58 3E15 mvi a,15h
0C5A C9 ret
0C5B FE11 code22: cpi 11h
0C5D C2630C jnz code23
0C60 3E16 mvi a,16h
B8085.LST 29/12/2559 12:32
Page 30 of 64
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
0C62 C9 ret
0C63 FE19 code23: cpi 19h
0C65 C26B0C jnz code24
0C68 3E17 mvi a,17h
0C6A C9 ret
0C6B FE2E code24: cpi 2eh
0C6D C2730C jnz code25
0C70 3E18 mvi a,18h
0C72 C9 ret
0C73 FE2F code25: cpi 2fh
0C75 C27B0C jnz code26
0C78 3E19 mvi a,19h
0C7A C9 ret
0C7B 3EFF code26: mvi a,0ffh
0C7D C9 ret
; scan display and keyboard unitl key was pressed
0C7E scan_key: ; mvi d,50 ; number of loop for timeout if key still
pressed
0C7E scan_key4: ;push d ; save d
0C7E 2110F0 lxi h,buffer
0C81 CDAE0C call scan
0C84 3A21F0 lda key
0C87 FEFF cpi 0ffh
0C89 C27E0C jnz scan_key4 ; loop if key still pressed
;pop d
0C8C F28F0C jp scan_key3
0C8F scan_key2: ;pop d
; dcr d
; jp scan_key4 ; no repeat function
; repeat if still pressed when timeout
0C8F CDA70C scan_key3: call debounce ; debounce after released
0C92 2110F0 lxi h,buffer
0C95 CDAE0C scan_key1: call scan
0C98 3A21F0 lda key
0C9B FEFF cpi 0ffh
0C9D CA950C jz scan_key1 ; loop until key will be pressed
0CA0 CDA70C call debounce
0CA3 CDAB0B call get_key_code
; call out2x
0CA6 C9 ret
0CA7 0614 debounce: mvi b,20
0CA9 05 debounce1: dcr b
0CAA C2A90C jnz debounce1
0CAD C9 ret
; subroutine scan keyboard and display
; input: hl pointer to buffer
; exit: key = scan code
; -1 no key pressed
;
0CAE E5 scan: push h
0CAF C5 push b
0CB0 D5 push d
B8085.LST 29/12/2559 12:32
Page 31 of 64
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
0CB1 0E06 mvi c,6 ; for 6-digit LED
0CB3 1E00 mvi e,0 ; digit scan code appears at 4-to-10 decoder
0CB5 1600 mvi d,0 ; key position
0CB7 3EFF mvi a,0ffh ; put -1 to key
0CB9 3221F0 sta key ; key = -1
0CBC 7B scan1: mov a,e
0CBD F6F0 ori 0f0h ; high nibble must be 1111
0CBF D312 out system_port_c ; active digit first
0CC1 7E mov a,m ; load a with [hl]
0CC2 D311 out system_port_b ; then turn segment on
0CC4 060A mvi b,10 ; delay for transition process
0CC6 05 wait1: dcr b
0CC7 C2C60C jnz wait1
0CCA AF xra a
0CCB D311 out system_port_b ; turn off segment
0CCD DB10 in system_port_a ; read input port
0CCF 0608 mvi b,8 ; check all 8-row
0CD1 1F shift_key: rar ; rotate right through carry
0CD2 DADB0C jc next_key ; if carry = 1 then no key pressed
0CD5 F5 push psw
0CD6 7A mov a,d
0CD7 3221F0 sta key ; save key position
0CDA F1 pop psw
0CDB next_key:
0CDB 14 inr d ; next key position
0CDC 05 dcr b ; until 8-bit was shifted
0CDD C2D10C jnz shift_key
; mvi a,0 ; clear a
; out system_port_b ; turn off led
0CE0 1C inr e ; next digit scan code
0CE1 23 inx h ; next location
0CE2 0D dcr c ; next column
0CE3 C2BC0C jnz scan1
0CE6 CDED0C call serial_command
0CE9 D1 pop d
0CEA C1 pop b
0CEB E1 pop h
0CEC C9 ret
;----------- serial commands with 9600 8n1 terminal --------------------
; check if serial buffer has command
;
0CED serial_command:
0CED 3A25F0 lda uart_found
0CF0 FE00 cpi 0
0CF2 CA310D jz skip_serial
0CF5 CD4512 call get_command
0CF8 CD500D call download
0CFB CD320D call prompting
0CFE CDF112 call hex_dump
0D01 CDEE11 call help
0D04 CDC711 call quick_home
0D07 CDDC11 call io_address
0D0A CDAA11 call new_location
0D0D CD2711 call edit_location
0D10 CDDD10 call jump_to_user_pgm
B8085.LST 29/12/2559 12:32
Page 32 of 64
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
0D13 CDC410 call monitor_function
0D16 CD720D call ascii_print
0D19 CD8010 call fill_memory
0D1C CD4C0F call register_display
0D1F CD0C0F call stack_display
0D22 CD1303 call disassemble1
0D25 CD000F call single_step_
0D28 CDF10E call print_watch
0D2B CDD60E call clear_watch
0D2E CDA40D call set_user_register
0D31 skip_serial:
0D31 C9 ret
0D32 3A22F0 prompting: lda command
0D35 FE0D cpi cr
0D37 C24F0D jnz exit_prompting
0D3A send_prompt:
0D3A CDDA12 call new_line
0D3D 2A3CF0 lhld pointer ; user_PC
0D40 7C mov a,h
0D41 CDCB12 call out2x
0D44 7D mov a,l
0D45 CDCB12 call out2x
0D48 21E41D lxi h,prompt_text
0D4B CD5812 call put_str
0D4E C9 ret
0D4F C9 exit_prompting: ret
; command execute
; get command from serial port
0D50 3A22F0 download: lda command
0D53 FE6C cpi "l"
0D55 C2710D jnz exit_download
0D58 CDD514 call clear_bcd1 ; reset bcd counter1
0D5B 3E01 mvi a,1
0D5D 323AF0 sta temp
0D60 AF xra a
0D61 3220F0 sta bcs ; clear byte chekc sum error
0D64 21CD1D lxi h,download_text
0D67 CD5812 call put_str
0D6A CD0314 call get_record
0D6D CD3A0D call send_prompt
0D70 C9 ret
0D71 C9 exit_download ret
; display printable ASCII code, 20H-7FH
0D72 3A22F0 ascii_print: lda command
0D75 FE61 cpi "a"
0D77 C2A30D jnz exit_ascii_print
0D7A 215E1E lxi h, ascii_text
0D7D CD5812 call put_str
0D80 CDDA12 call new_line
0D83 CDDA12 call new_line
0D86 2E20 mvi l,20h
0D88 0E60 mvi c,96
0D8A ascii_print1:
B8085.LST 29/12/2559 12:32
Page 33 of 64
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
0D8A 7D mov a,l
0D8B CD2F12 call cout
0D8E 3E3D mvi a,"="
0D90 CD2F12 call cout
0D93 7D mov a,l
0D94 CDCB12 call out2x
0D97 CDE512 call space
0D9A 2C inr l
0D9B 0D dcr c
0D9C C28A0D jnz ascii_print1
0D9F CD3A0D call send_prompt
0DA2 C9 ret
0DA3 exit_ascii_print:
0DA3 C9 ret
;------------------- set value to user registers ---------------------
; set value to user register AF, BC, DE, HL, SP, PC
0DA4 set_user_register:
0DA4 3A22F0 lda command
0DA7 FE73 cpi "s"
0DA9 C2B80E jnz exit_set_user
0DAC 210C1F lxi h, set_register_text
0DAF CD5812 call put_str
0DB2 CD3B12 call cin
0DB5 FE61 cpi "a"
0DB7 C2E00D jnz set_user1
0DBA CDDA12 call new_line
0DBD 21B01E lxi h,af_text
0DC0 CD5812 call put_str
0DC3 2A2CF0 lhld user_AF
0DC6 7C mov a,h
0DC7 CDCB12 call out2x
0DCA 7D mov a,l
0DCB CDCB12 call out2x
0DCE CDEB12 call send_tab
0DD1 CD9E13 call get_hex2
0DD4 67 mov h,a
0DD5 CD9E13 call get_hex2
0DD8 6F mov l,a
0DD9 222CF0 shld user_AF
0DDC CD3A0D call send_prompt
0DDF C9 ret
0DE0 set_user1:
0DE0 FE62 cpi "b"
0DE2 C20B0E jnz set_user2
0DE5 CDDA12 call new_line
0DE8 21B41E lxi h,bc_text
0DEB CD5812 call put_str
0DEE 2A2EF0 lhld user_BC
0DF1 7C mov a,h
0DF2 CDCB12 call out2x
0DF5 7D mov a,l
0DF6 CDCB12 call out2x
0DF9 CDEB12 call send_tab
0DFC CD9E13 call get_hex2
0DFF 67 mov h,a
0E00 CD9E13 call get_hex2
0E03 6F mov l,a
0E04 222EF0 shld user_BC
0E07 CD3A0D call send_prompt
0E0A C9 ret
B8085.LST 29/12/2559 12:32
Page 34 of 64
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
0E0B set_user2:
0E0B FE64 cpi "d"
0E0D C2360E jnz set_user3
0E10 CDDA12 call new_line
0E13 21B81E lxi h,de_text
0E16 CD5812 call put_str
0E19 2A30F0 lhld user_DE
0E1C 7C mov a,h
0E1D CDCB12 call out2x
0E20 7D mov a,l
0E21 CDCB12 call out2x
0E24 CDEB12 call send_tab
0E27 CD9E13 call get_hex2
0E2A 67 mov h,a
0E2B CD9E13 call get_hex2
0E2E 6F mov l,a
0E2F 2230F0 shld user_DE
0E32 CD3A0D call send_prompt
0E35 C9 ret
0E36 set_user3:
0E36 FE68 cpi "h"
0E38 C2610E jnz set_user4
0E3B CDDA12 call new_line
0E3E 21BC1E lxi h,hl_text
0E41 CD5812 call put_str
0E44 2A32F0 lhld user_HL
0E47 7C mov a,h
0E48 CDCB12 call out2x
0E4B 7D mov a,l
0E4C CDCB12 call out2x
0E4F CDEB12 call send_tab
0E52 CD9E13 call get_hex2
0E55 67 mov h,a
0E56 CD9E13 call get_hex2
0E59 6F mov l,a
0E5A 2232F0 shld user_HL
0E5D CD3A0D call send_prompt
0E60 C9 ret
0E61 set_user4:
0E61 FE73 cpi "s"
0E63 C28C0E jnz set_user5
0E66 CDDA12 call new_line
0E69 21C01E lxi h,sp_text
0E6C CD5812 call put_str
0E6F 2A34F0 lhld user_SP
0E72 7C mov a,h
0E73 CDCB12 call out2x
0E76 7D mov a,l
0E77 CDCB12 call out2x
0E7A CDEB12 call send_tab
0E7D CD9E13 call get_hex2
0E80 67 mov h,a
0E81 CD9E13 call get_hex2
0E84 6F mov l,a
0E85 2234F0 shld user_SP
0E88 CD3A0D call send_prompt
0E8B C9 ret
0E8C set_user5:
0E8C FE70 cpi "p"
0E8E C2B70E jnz set_user6
0E91 CDDA12 call new_line
0E94 21C91E lxi h,pc_text
0E97 CD5812 call put_str
0E9A 2A2AF0 lhld user_PC
0E9D 7C mov a,h
0E9E CDCB12 call out2x
B8085.LST 29/12/2559 12:32
Page 35 of 64
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
0EA1 7D mov a,l
0EA2 CDCB12 call out2x
0EA5 CDEB12 call send_tab
0EA8 CD9E13 call get_hex2
0EAB 67 mov h,a
0EAC CD9E13 call get_hex2
0EAF 6F mov l,a
0EB0 222AF0 shld user_PC
0EB3 CD3A0D call send_prompt
0EB6 C9 ret
0EB7 C9 set_user6: ret
0EB8 exit_set_user:
0EB8 C9 ret
0EB9 print_watch_ram:
0EB9 CDDA12 call new_line
0EBC 2100F0 lxi h, watch_ram
0EBF 0E10 mvi c,16
0EC1 7C mov a,h
0EC2 CDCB12 call out2x
0EC5 7D mov a,l
0EC6 CDCB12 call out2x
0EC9 watch1:
0EC9 CDE512 call space
0ECC 7E mov a,m
0ECD CDCB12 call out2x
0ED0 23 inx h
0ED1 0D dcr c
0ED2 C2C90E jnz watch1
0ED5 C9 ret
;----------- clear watch variables------------------------------------
0ED6 3A22F0 clear_watch: lda command
0ED9 FE63 cpi "c"
0EDB C2F00E jnz exit_clear_watch
0EDE 2100F0 lxi h, watch_ram
0EE1 0E10 mvi c,16
0EE3 AF clear1: xra a
0EE4 77 mov m,a
0EE5 23 inx h
0EE6 0D dcr c
0EE7 C2E30E jnz clear1
0EEA CDB90E call print_watch_ram
0EED CD3A0D call send_prompt
0EF0 C9 exit_clear_watch: ret
;----------- print watch variables ------------------------------------
0EF1 print_watch:
0EF1 3A22F0 lda command
B8085.LST 29/12/2559 12:32
Page 36 of 64
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
0EF4 FE77 cpi "w"
0EF6 C2FF0E jnz exit_watch
0EF9 CDB90E call print_watch_ram
0EFC CD3A0D call send_prompt
0EFF C9 exit_watch: ret
;---------- single step running with key space -----------------------
0F00 single_step_:
0F00 3A22F0 lda command
0F03 FE20 cpi " "
0F05 C20B0F jnz exit_step
0F08 CDBF09 call single_step
0F0B exit_step:
0F0B C9 ret
;------- display stack area from top of stack to initial -------------
0F0C stack_display:
0F0C 3A22F0 lda command
0F0F FE6B cpi "k"
0F11 C24B0F jnz exit_stack
; lxi h,stack_text
; call put_str
0F14 21391E lxi h,edit_text2
0F17 CD5812 call put_str
0F1A CDDA12 call new_line
0F1D 2A34F0 lhld user_SP
0F20 stack_display1:
0F20 7C mov a,h
0F21 CDCB12 call out2x
0F24 7D mov a,l
0F25 CDCB12 call out2x
0F28 CDE512 call space
0F2B CDE512 call space
0F2E 3E5B mvi a,"["
0F30 CD2F12 call cout
0F33 7E mov a,m
0F34 CDCB12 call out2x
0F37 3E5D mvi a,"]"
0F39 CD2F12 call cout
0F3C CDDA12 call new_line
0F3F 23 inx h
0F40 119AF0 lxi d, user_stack+32+1 ; load base of user stack
0F43 7D mov a,l
0F44 AB xra e
0F45 C2200F jnz stack_display1
0F48 CD3A0D call send_prompt
0F4B exit_stack:
0F4B C9 ret
;---------------- registers display ----------------------------------
0F4C register_display:
0F4C 3A22F0 lda command
B8085.LST 29/12/2559 12:32
Page 37 of 64
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
0F4F FE72 cpi "r"
0F51 C27110 jnz exit_register
0F54 register_display1:
; lda uart_found
; cpi 0
; jz exit_register ; exit of no uart
0F54 CDDA12 call new_line
0F57 register_display2:
0F57 CDDA12 call new_line
0F5A 21B01E lxi h,af_text
0F5D CD5812 call put_str
0F60 2A2CF0 lhld user_AF
0F63 7C mov a,h
0F64 CDCB12 call out2x
0F67 7D mov a,l
0F68 CDCB12 call out2x
0F6B CDE512 call space
0F6E 21B41E lxi h,bc_text
0F71 CD5812 call put_str
0F74 2A2EF0 lhld user_BC
0F77 7C mov a,h
0F78 CDCB12 call out2x
0F7B 7D mov a,l
0F7C CDCB12 call out2x
0F7F CDE512 call space
0F82 21B81E lxi h,de_text
0F85 CD5812 call put_str
0F88 2A30F0 lhld user_DE
0F8B 7C mov a,h
0F8C CDCB12 call out2x
0F8F 7D mov a,l
0F90 CDCB12 call out2x
0F93 CDE512 call space
0F96 21BC1E lxi h,hl_text
0F99 CD5812 call put_str
0F9C 2A32F0 lhld user_HL
0F9F 7C mov a,h
0FA0 CDCB12 call out2x
0FA3 7D mov a,l
0FA4 CDCB12 call out2x
0FA7 CDE512 call space
0FAA 21C01E lxi h,sp_text
0FAD CD5812 call put_str
0FB0 2A34F0 lhld user_SP
0FB3 7C mov a,h
0FB4 CDCB12 call out2x
0FB7 7D mov a,l
0FB8 CDCB12 call out2x
0FBB CDE512 call space
; lxi h,tos_text
; call put_str
; lhld tos
; mov a,h
; call out2x
; mov a,l
; call out2x
; call space
0FBE 21C91E lxi h,pc_text
0FC1 CD5812 call put_str
0FC4 2A2AF0 lhld user_PC
0FC7 7C mov a,h
B8085.LST 29/12/2559 12:32
Page 38 of 64
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
0FC8 CDCB12 call out2x
0FCB 7D mov a,l
0FCC CDCB12 call out2x
0FCF CDE512 call space
0FD2 21E31E lxi h,sign_text
0FD5 CD5812 call put_str
0FD8 2A2CF0 lhld user_AF
0FDB 7D mov a,l
0FDC E680 ani 80h
0FDE C2E90F jnz register_flag1
0FE1 3E30 mvi a,"0"
0FE3 CD2F12 call cout
0FE6 C3EE0F jmp register_flag2
0FE9 register_flag1:
0FE9 3E31 mvi a,"1"
0FEB CD2F12 call cout
0FEE register_flag2:
0FEE CDE512 call space
0FF1 217210 lxi h,zero_text
0FF4 CD5812 call put_str
0FF7 2A2CF0 lhld user_AF
0FFA 7D mov a,l
0FFB E640 ani 40h
0FFD C20810 jnz register_flag3
1000 3E30 mvi a,"0"
1002 CD2F12 call cout
1005 C30D10 jmp register_flag4
1008 register_flag3:
1008 3E31 mvi a,"1"
100A CD2F12 call cout
100D register_flag4:
100D CDE512 call space
1010 217510 lxi h,AC_text
1013 CD5812 call put_str
1016 2A2CF0 lhld user_AF
1019 7D mov a,l
101A E610 ani 10h
101C C22710 jnz register_flag5
101F 3E30 mvi a,"0"
1021 CD2F12 call cout
1024 C32C10 jmp register_flag6
1027 register_flag5:
1027 3E31 mvi a,"1"
1029 CD2F12 call cout
102C register_flag6:
102C CDE512 call space
102F 217910 lxi h,P_text
1032 CD5812 call put_str
1035 2A2CF0 lhld user_AF
1038 7D mov a,l
1039 E604 ani 4
103B C24610 jnz register_flag7
103E 3E30 mvi a,"0"
1040 CD2F12 call cout
1043 C34B10 jmp register_flag8
1046 register_flag7:
1046 3E31 mvi a,"1"
1048 CD2F12 call cout
104B register_flag8:
104B CDE512 call space
104E 217C10 lxi h,CY_text
1051 CD5812 call put_str
B8085.LST 29/12/2559 12:32
Page 39 of 64
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
1054 2A2CF0 lhld user_AF
1057 7D mov a,l
1058 E601 ani 1
105A C26510 jnz register_flag9
105D 3E30 mvi a,"0"
105F CD2F12 call cout
1062 C36A10 jmp register_flag10
1065 register_flag9:
1065 3E31 mvi a,"1"
1067 CD2F12 call cout
106A register_flag10:
106A CDE512 call space
106D CD3A0D call send_prompt
1070 C9 ret
1071 exit_register:
1071 C9 ret
1072 5A3D00 zero_text dfb "Z=",0
1075 41433D00 AC_text dfb "AC=",0
1079 503D00 P_text dfb "P=",0
107C 43593D00 CY_text dfb "CY=",0
;----------------- fill constant to memory ---------------------------
1080 fill_memory:
1080 3A22F0 lda command
1083 FE66 cpi "f"
1085 C2C310 jnz exit_fill
1088 216F1E lxi h,fill_text1
108B CD5812 call put_str
108E CD8513 call get_hex1
1091 67 mov h,a
1092 CD8513 call get_hex1
1095 6F mov l,a
1096 E5 push h ; save begin address to stack
1097 21801E lxi h,fill_text2
109A CD5812 call put_str
109D CD8513 call get_hex1
10A0 67 mov h,a
10A1 CD8513 call get_hex1
10A4 6F mov l,a
10A5 E5 push h ; save end address to stack
10A6 21901E lxi h,fill_text3
10A9 CD5812 call put_str
10AC CD8513 call get_hex1
10AF 47 mov b,a ; byte save to B
10B0 D1 pop d ; end address in DE
10B1 E1 pop h ; begin address in HL
10B2 fill_memory1:
10B2 78 mov a,b
10B3 77 mov m,a
10B4 23 inx h
10B5 7D mov a,l
10B6 BB cmp e
10B7 C2B210 jnz fill_memory1
10BA 7C mov a,h
10BB BA cmp d
10BC C2B210 jnz fill_memory1
B8085.LST 29/12/2559 12:32
Page 40 of 64
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
10BF CD3A0D call send_prompt
10C2 C9 ret
10C3 exit_fill:
10C3 C9 ret
;---------------- monitor function list -------------------------------
10C4 monitor_function:
10C4 3A22F0 lda command
10C7 FE6D cpi "m"
10C9 C2DC10 jnz exit_monitor
10CC CDDA12 call new_line
10CF 216C22 lxi h,monitor_text
10D2 CD5812 call put_str
10D5 CDDA12 call new_line
10D8 CD3A0D call send_prompt
10DB C9 ret
10DC exit_monitor:
10DC C9 ret
;----------------------- jump to user program --------------------
10DD 3A22F0 jump_to_user_pgm: lda command
10E0 FE6A cpi "j"
10E2 C22611 jnz exit_jump
10E5 21471E lxi h, jump_text1
10E8 CD5812 call put_str
10EB 2A2AF0 lhld user_PC
10EE 7C mov a,h
10EF CDCB12 call out2x
10F2 7D mov a,l
10F3 CDCB12 call out2x
10F6 21591E lxi h,jump_text2
10F9 CD5812 call put_str
10FC CD9E13 call get_hex2
10FF F5 push psw
1100 3A23F0 lda flag1
1103 E601 ani 1
1105 C21711 jnz skip_load_PC
1108 F1 pop psw
1109 67 mov h,a
110A CD9E13 call get_hex2
110D 6F mov l,a
110E 222AF0 shld user_PC
1111 CDDA12 call new_line
1114 C39B09 jmp go
1117 skip_load_PC:
1117 F1 pop psw
1118 3A23F0 lda flag1
111B E6FE ani 0feh
111D 3223F0 sta flag1
1120 CDDA12 call new_line
1123 C39B09 jmp go
1126 C9 exit_jump: ret
;------------ edit memory -----------------------------------------
B8085.LST 29/12/2559 12:32
Page 41 of 64
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
1127 3A22F0 edit_location: lda command
112A FE65 cpi "e"
112C C2A911 jnz exit_edit
112F 21F61D lxi h, edit_text
1132 CD5812 call put_str
1135 CD8513 call get_hex1
1138 67 mov h,a
1139 CD8513 call get_hex1
113C 6F mov l,a
113D 223CF0 shld pointer ;user_PC
1140 210E1E lxi h, edit_text1
1143 CD5812 call put_str
1146 21391E lxi h, edit_text2
1149 CD5812 call put_str
114C CDDA12 edit1: call new_line
114F 2A3CF0 lhld pointer ;user_PC
1152 7C mov a,h
1153 CDCB12 call out2x
1156 7D mov a,l
1157 CDCB12 call out2x
115A CDE512 call space
115D CDE512 call space
1160 3E5B mvi a,"["
1162 CD2F12 call cout
1165 7E mov a,m
1166 CDCB12 call out2x
1169 3E5D mvi a,"]"
116B CD2F12 call cout
116E CDE512 call space
1171 CD9E13 call get_hex2
1174 F5 push psw
1175 3A23F0 lda flag1
1178 E601 ani 1
117A C29A11 jnz exit_edit1 ; Enter key?
117D 3A23F0 lda flag1
1180 E602 ani 2
1182 C28A11 jnz skip_edit1 ; SPACE key?
1185 F1 pop psw
1186 77 mov m,a
1187 C39311 jmp skip_edit2
118A F1 skip_edit1: pop psw
118B 3A23F0 lda flag1
118E E6FD ani 0fdh
1190 3223F0 sta flag1
1193 skip_edit2:
1193 23 inx h
1194 223CF0 shld pointer ;user_PC
1197 C34C11 jmp edit1
119A F1 exit_edit1: pop psw
119B 3A23F0 lda flag1
119E E6FE ani 0feh
11A0 3223F0 sta flag1
11A3 CDDA12 call new_line
11A6 CD3A0D call send_prompt
11A9 C9 exit_edit: ret
B8085.LST 29/12/2559 12:32
Page 42 of 64
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
11AA 3A22F0 new_location: lda command
11AD FE6E cpi "n"
11AF C2C611 jnz exit_new_location
11B2 21E61D lxi h,new_text
11B5 CD5812 call put_str
11B8 CD8513 call get_hex1
11BB 67 mov h,a
11BC CD8513 call get_hex1
11BF 6F mov l,a
11C0 223CF0 shld pointer ; user_PC
11C3 CD3A0D call send_prompt
11C6 exit_new_location:
11C6 C9 ret
11C7 quick_home:
11C7 3A22F0 lda command
11CA FE71 cpi "q"
11CC C2DB11 jnz exit_quick_home
11CF 210081 lxi h,home_address
11D2 222AF0 shld user_PC
11D5 223CF0 shld pointer
11D8 CD3A0D call send_prompt
11DB exit_quick_home:
11DB C9 ret
; i/o address map
11DC 3A22F0 io_address: lda command
11DF FE69 cpi "i"
11E1 C2ED11 jnz exit_io
11E4 210321 lxi h,io_text
11E7 CD5812 call put_str
11EA CD3A0D call send_prompt
11ED C9 exit_io: ret
; help listing
11EE 3A22F0 help: lda command
11F1 FE3F cpi "?"
11F3 C20512 jnz exit_help
11F6 216F12 lxi h,prompt3
11F9 CD6612 call alt_put_str
11FC 216E1F lxi h,help_text1
11FF CD5812 call put_str
1202 CD3A0D call send_prompt
1205 C9 exit_help: ret
; initialize 16C550 uart to 9600 8n1 with 2MHz clock
; 2MHz/13 = 153846Hz
1206 init_uart:
1206 3E83 mvi a,83h
1208 D343 out uart_lcr ; set DLAB bit to access divider
120A 3E0D mvi a,13
120C D340 out uart_divisor_lsb
120E 3E00 mvi a,0
1210 D341 out uart_divisor_msb ; 2MHz/13 = 153846 Hz
; 153846Hz/16 = 9615Hz
1212 3E07 mvi a,7
1214 D342 out uart_fifo ; init fifo and clear all buffers
B8085.LST 29/12/2559 12:32
Page 43 of 64
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
1216 3E03 mvi a,03h
1218 D343 out uart_lcr ; clar DLAB
; check uart line status, if the byte is FF then no uart
;
;
121A AF xra a
121B D347 out uart_scr ; check if there is uart
121D DB47 in uart_scr
121F FE00 cpi 0
1221 CA2912 jz found
1224 AF xra a
1225 3225F0 sta uart_found
1228 C9 ret
1229 3E01 found mvi a,1
122B 3225F0 sta uart_found
122E C9 ret
122F 47 cout: mov b,a ; save a
1230 DB45 cout1: in uart_line_status
1232 E620 ani 20h ; transmitter ready?
1234 CA3012 jz cout1
1237 78 mov a,b ; restore a
1238 D340 out uart_buffer
123A C9 ret
123B DB45 cin: in uart_line_status
123D E601 ani 1 ; data available?
123F CA3B12 jz cin
1242 DB40 in uart_buffer
1244 C9 ret
1245 DB45 get_command: in uart_line_status
1247 E601 ani 1
1249 CA5212 jz no_data
124C DB40 in uart_buffer
124E 3222F0 sta command ; command = ASCII code
1251 C9 ret
1252 3EFF no_data: mvi a,0ffh ; command == -1
1254 3222F0 sta command
1257 C9 ret
; print string terminated by 0
; input: HL
1258 7E put_str: mov a,m ; get A from [HL]
1259 FE00 cpi 0
125B C25F12 jnz put_str1
125E C9 ret
125F CD2F12 put_str1: call cout
1262 23 inx h
1263 F25812 jp put_str
1266 7E alt_put_str: mov a,m ; get A from [HL]
1267 EEAA xri 0aah
1269 FE00 cpi 0
126B C2A512 jnz put_str2
126E C9 ret
126F A7A0A0E7FEprompt3: dfb 0A7h,0A0h,0A0h,0E7h,0FEh,0E1h,087h,092h,09Fh,08Ah,092h,
09
127F E3E9F8E5FA dfb 0E3h,0E9h,0F8h,0E5h,0FAh,0F8h,0E5h,0E9h,0EFh,0F9h,0F9h,0
E
128F EBE3E4E3E4 dfb 0EBh,0E3h,0E4h,0E3h,0E4h,0EDh,08Ah,0E1h,0E3h,0FEh,08Ah,
082
129F E6FA83A7A0 dfb 0E6h,0FAh,083h,0A7h,0a0h,0aah
12A5 CD2F12 put_str2: call cout
12A8 23 inx h
12A9 F26612 jp alt_put_str
B8085.LST 29/12/2559 12:32
Page 44 of 64
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
12AC 21581D send_prompt1: lxi h,prompt1
12AF CD5812 call put_str
12B2 C9 ret
12B3 216F12 send_prompt3: lxi h,prompt3
12B6 CD6612 call alt_put_str
12B9 C9 ret
12BA F5 out1x: push psw
12BB E60F ani 0fh
12BD C630 adi "0"
12BF FE3A cpi 3Ah
12C1 DAC612 jc out1x1
12C4 C607 adi 7
12C6 CD2F12 out1x1: call cout
12C9 F1 pop psw
12CA C9 ret
12CB out2x:
12CB 0F rrc
12CC 0F rrc
12CD 0F rrc
12CE 0F rrc
12CF CDBA12 call out1x
12D2 07 rlc
12D3 07 rlc
12D4 07 rlc
12D5 07 rlc
12D6 CDBA12 call out1x
12D9 C9 ret
; new_line
12DA 3E0D new_line: mvi a,cr
12DC CD2F12 call cout
12DF 3E0A mvi a,lf
12E1 CD2F12 call cout
12E4 C9 ret
12E5 3E20 space: mvi a," "
12E7 CD2F12 call cout
12EA C9 ret
12EB 3E09 send_tab: mvi a,9
12ED CD2F12 call cout
12F0 C9 ret
12F1 3A22F0 hex_dump: lda command
12F4 FE68 cpi "h"
12F6 C25013 jnz exit_hex_dump
12F9 CDDA12 call new_line
12FC 0E08 mvi c,8 ; 8 lines
12FE C5 hex_dump2: push b
12FF CDDA12 call new_line
1302 2A3CF0 lhld pointer ;user_PC
1305 7C mov a,h
1306 CDCB12 call out2x
1309 7D mov a,l
130A CDCB12 call out2x
130D CDE512 call space
1310 0E10 mvi c,16
1312 CDE512 hex_dump1: call space
1315 7E mov a,m
1316 CDCB12 call out2x
1319 23 inx h
B8085.LST 29/12/2559 12:32
Page 45 of 64
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
131A 0D dcr c
131B C21213 jnz hex_dump1
131E CDE512 call space
1321 CDE512 call space
1324 CDE512 call space
; print ASCII representation 20H-7FH
; outside such range, print . instead
1327 11F0FF lxi d,0FFF0h ; load DE with -16
132A 19 dad d ; ADD HL,DE
132B 0E10 mvi c,16
132D 7E hex_dump5: mov a,m
132E FE20 cpi 20h ; <20H?
1330 DA3813 jc hex_dump3
1333 FE80 cpi 80h
1335 DA3A13 jc hex_dump4
1338 3E2E hex_dump3: mvi a,"."
133A CD2F12 hex_dump4: call cout
133D 23 inx h
133E 0D dcr c
133F C22D13 jnz hex_dump5
1342 223CF0 shld pointer ;user_PC
1345 C1 pop b
1346 0D dcr c
1347 C2FE12 jnz hex_dump2
134A CDDA12 call new_line
134D CD3A0D call send_prompt
1350 C9 exit_hex_dump: ret
1351 210081 dump_memory: lxi h,8100h
1354 0E64 mvi c,100 ; 100 bytes display
1356 CDDA12 call new_line
1359 7E dump1: mov a,m
135A CDCB12 call out2x
135D CDE512 call space
1360 23 inx h
1361 0D dcr c
1362 C25913 jnz dump1
1365 C9 ret
; convert ASCII letter to one nibble 0-F
; 0-9 -> al-30
; A-F -> al-7
; entry: A
; exit: A
1366 D630 to_hex: sui "0"
1368 FE0A cpi 10
136A DA7113 jc zero_nine
136D E6DF ani 11011111b
136F D607 sui 7 ; convert to A-F
1371 zero_nine:
1371 C9 ret
; read two ASCII bytes and convert them to one bye 8-bit data
; exit: A
; used: A, E
1372 CD3B12 get_hex: call cin
1375 CD6613 call to_hex
1378 0F rrc
1379 0F rrc
137A 0F rrc
B8085.LST 29/12/2559 12:32
Page 46 of 64
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
137B 0F rrc
137C 5F mov e,a
137D CD3B12 call cin
1380 CD6613 call to_hex
1383 83 add e
1384 C9 ret
; read two ASCII bytes echo to screen and convert them to one bye 8-bit
data
; exit: A
1385 CD3B12 get_hex1: call cin
1388 CD2F12 call cout
138B CD6613 call to_hex
138E 0F rrc
138F 0F rrc
1390 0F rrc
1391 0F rrc
1392 5F mov e,a
1393 CD3B12 call cin
1396 CD2F12 call cout
1399 CD6613 call to_hex
139C 83 add e
139D C9 ret
; read two ASCII bytes echo to screen and convert them to one bye 8-bit
data
; exit: A
139E 3A23F0 get_hex2: lda flag1
13A1 E6FC ani 0fch ; clear flag1.1 and flag1.0
13A3 3223F0 sta flag1
13A6 CD3B12 call cin
13A9 FE0D cpi cr
13AB CAF113 jz exit_get_hex2
13AE FE20 cpi " "
13B0 CAFA13 jz exit_get_hex3
13B3 FE30 cpi 30h ; hex must be 0-9 and A-F
13B5 DA9E13 jc get_hex2
13B8 FE40 cpi 40h
13BA DAC713 jc ascii_0_9
13BD FE61 cpi 97 ; < 97?
13BF DA9E13 jc get_hex2
13C2 FE67 cpi 103 ; >= 103?
13C4 D29E13 jnc get_hex2
13C7 ascii_0_9:
13C7 CD2F12 call cout
13CA CD6613 call to_hex
13CD 0F rrc
13CE 0F rrc
13CF 0F rrc
13D0 0F rrc
13D1 5F mov e,a
13D2 get_2nd_hex:
13D2 CD3B12 call cin
13D5 FE30 cpi 30h ; hex must be 0-9 and A-F
13D7 DAD213 jc get_2nd_hex
13DA FE40 cpi 40h
13DC DAE913 jc ok_0_9
13DF FE61 cpi 97 ; < 97?
13E1 DAD213 jc get_2nd_hex
13E4 FE67 cpi 103 ; >= 103?
13E6 D2D213 jnc get_2nd_hex
B8085.LST 29/12/2559 12:32
Page 47 of 64
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
13E9 ok_0_9:
13E9 CD2F12 call cout
13EC CD6613 call to_hex
13EF 83 add e
13F0 C9 ret
13F1 exit_get_hex2:
13F1 3A23F0 lda flag1
13F4 F601 ori 1
13F6 3223F0 sta flag1 ; Q key has been pressed
13F9 C9 ret
13FA exit_get_hex3:
13FA 3A23F0 lda flag1
13FD F602 ori 2
13FF 3223F0 sta flag1 ; SPACE key has been pressed
1402 C9 ret
; add check sum
; get record, write to SRAM and jump to 8000h
; entry: A= byte received, B= byte check sum
add_bcs: macro ; add accumulator with byte check sum stored in B
push psw
add b
mov b,a
pop psw
endm
001B = esc equ 1bh
1403 CD3B12 get_record: call cin
1406 FE1B cpi 27
1408 CA5A14 jz esc_quit
140B FE3A cpi ":"
140D C20314 jnz get_record ; wait until begin of record found
1410 0600 mvi b,0 ; byte check sum
1412 CD7213 call get_hex ; get number of byte
1415 4F mov c,a ; put to c
1416 add_bcs
1416 F5 push psw
1417 80 add b
1418 47 mov b,a
1419 F1 pop psw
141A endm
141A CD7213 call get_hex ; get destination address, put to bx register
141D 67 mov h,a ; save high byte
141E add_bcs
141E F5 push psw
141F 80 add b
1420 47 mov b,a
1421 F1 pop psw
1422 endm
1422 CD7213 call get_hex
1425 6F mov l,a ; and low byte
1426 add_bcs
1426 F5 push psw
1427 80 add b
1428 47 mov b,a
1429 F1 pop psw
142A endm
142A CD7213 call get_hex
B8085.LST 29/12/2559 12:32
Page 48 of 64
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
142D add_bcs
142D F5 push psw
142E 80 add b
142F 47 mov b,a
1430 F1 pop psw
1431 endm
1431 FE01 cpi 1 ; end of record type is 01 ?
1433 C25B14 jnz data_record ; jump if not 01
1436 CD3B12 wait_cr: call cin
1439 FE0D cpi cr
143B C23614 jnz wait_cr ; until end of record sending! with cr
detection
143E 3EFF mvi a, 0ffh ; turn speaker off
1440 D312 out system_port_c
1442 AF xra a
1443 D300 out 0 ; turn off GPIO
1445 CDB914 call print_bcd1
1448 CDE512 call space
144B 3A20F0 lda bcs
144E CDC901 call pint8u
1451 21991E lxi h,error_text
1454 CD5812 call put_str
1457 CDDA12 call new_line
145A C9 esc_quit: ret
145B CD7213 data_record: call get_hex ; get data byte
145E 77 mov m,a ; save to SRAM at [HL]
145F add_bcs
145F F5 push psw
1460 80 add b
1461 47 mov b,a
1462 F1 pop psw
1463 endm
1463 CD8914 call inc_bcd1
; ori 7fh
; out system_port_c ; make buzzer sound
1466 23 inx h ; next location
1467 0D dcr c
1468 C25B14 jnz data_record ; until c = 0
146B 78 mov a,b
146C 2F cma
146D 47 mov b,a
146E 04 inr b ; compute two's complement
146F CD7213 call get_hex ; get check sum
1472 B8 cmp b
1473 CA7D14 jz skip_error
1476 3A20F0 lda bcs
1479 3C inr a
147A 3220F0 sta bcs
147D skip_error:
147D 3A3AF0 lda temp ; then shift into temp8
1480 07 rlc
1481 323AF0 sta temp
1484 D300 out 0 ; send to GPIO
1486 C30314 jmp get_record ; back to next record
;---------------- increment BCD counter1 -------------------------
B8085.LST 29/12/2559 12:32
Page 49 of 64
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
1489 E5 inc_bcd1: push h
148A 2141F0 lxi h,bcd_counter1
148D AF xra a
148E 7E mov a,m
148F C601 adi 1
1491 27 daa
1492 77 mov m,a
1493 23 inx h
1494 7E mov a,m
1495 CE00 aci 0
1497 27 daa
1498 77 mov m,a
1499 23 inx h
149A 7E mov a,m
149B CE00 aci 0
149D 27 daa
149E 77 mov m,a
149F E1 pop h
14A0 C9 ret
14A1 E5 inc_bcd2: push h
14A2 2144F0 lxi h,bcd_counter2
14A5 AF xra a
14A6 7E mov a,m
14A7 C601 adi 1
14A9 27 daa
14AA 77 mov m,a
14AB 23 inx h
14AC 7E mov a,m
14AD CE00 aci 0
14AF 27 daa
14B0 77 mov m,a
14B1 23 inx h
14B2 7E mov a,m
14B3 CE00 aci 0
14B5 27 daa
14B6 77 mov m,a
14B7 E1 pop h
14B8 C9 ret
14B9 print_bcd1:
14B9 2143F0 lxi h,bcd_counter1+2
14BC 7E mov a,m
14BD CDCB12 call out2x
14C0 2142F0 lxi h,bcd_counter1+1
14C3 7E mov a,m
14C4 CDCB12 call out2x
14C7 2141F0 lxi h,bcd_counter1
14CA 7E mov a,m
14CB CDCB12 call out2x
14CE 21E61E lxi h,byte_text
14D1 CD5812 call put_str
14D4 C9 ret
14D5 210000 clear_bcd1: lxi h,0
14D8 2241F0 shld bcd_counter1
14DB 2242F0 shld bcd_counter1+1
14DE 2243F0 shld bcd_counter1+2
14E1 C9 ret
14E2 print_bcd2:
14E2 2146F0 lxi h,bcd_counter2+2
14E5 7E mov a,m
14E6 CDCB12 call out2x
B8085.LST 29/12/2559 12:32
Page 50 of 64
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
14E9 2145F0 lxi h,bcd_counter2+1
14EC 7E mov a,m
14ED CDCB12 call out2x
14F0 2144F0 lxi h,bcd_counter2
14F3 7E mov a,m
14F4 CDCB12 call out2x
14F7 21E61E lxi h,byte_text
14FA CD5812 call put_str
14FD C9 ret
14FE 210000 clear_bcd2: lxi h,0
1501 2244F0 shld bcd_counter2
1504 2245F0 shld bcd_counter2+1
1507 2246F0 shld bcd_counter2+2
150A C9 ret
; constants
150B INS_TABLE:
150B 0B17 DWL C0 ; "NOP",TAB,RS ; 00
150D 1017 DWL C1 ; "LXI",TAB,"B,",RS ; 01
150F 1717 DWL C2 ; "STAX",TAB,"B",RS ; 02
1511 1E17 DWL C3 ; "INX",TAB,"B",RS ; 03
1513 2417 DWL C4 ; "INR",TAB,"B",RS ; 04
1515 2A17 DWL C5 ; "DCR",TAB,"B",RS ; 05
1517 3017 DWL C6 ; "MVI",TAB,"B,",RS ; 06
1519 3717 DWL C7 ; "RLC",TAB,RS ; 07
151B 3C17 DWL C8 ; "DFB",TAB,RS ; 08
151D 4117 DWL C9 ; "DAD",TAB,"B",RS ; 09
151F 4717 DWL CA ; "LDAX",TAB,"B",RS ; 0A
1521 4E17 DWL CB ; "DCX",TAB,"B",RS ; 0B
1523 5417 DWL CC ; "INR",TAB,"C",RS ; 0C
1525 5A17 DWL CD ; "DCR",TAB,"C",RS ; 0D
1527 6017 DWL CE ; "MVI",TAB,"C,",RS ; 0E
1529 6717 DWL CF ; "RRC",TAB,RS ; 0F
152B 6C17 DWL C10 ; "DFB",TAB,RS ; 10
152D 7117 DWL C11 ; "LXI",TAB,"D,",RS ; 11
152F 7817 DWL C12 ; "STAX",TAB,"D",RS ; 12
1531 7F17 DWL C13 ; "INX",TAB,"D",RS ; 13
1533 8517 DWL C14 ; "INR",TAB,"D",RS ; 14
1535 8B17 DWL C15 ; "DCR",TAB,"D",RS ; 15
1537 9117 DWL C16 ; "MVI",TAB,"D,",RS ; 16
1539 9817 DWL C17 ; "RAL",TAB,RS ; 17
153B 9D17 DWL C18 ; "DFB",TAB,RS ; 18
153D A217 DWL C19 ; "DAD",TAB,"D",RS ; 19
153F A817 DWL C1A ; "LDAX",TAB,"D",RS ; 1A
1541 AF17 DWL C1B ; "DCX",TAB,"D",RS ; 1B
1543 B517 DWL C1C ; "INR",TAB,"E",RS ; 1C
1545 BB17 DWL C1D ; "DCR",TAB,"E",RS ; 1D
1547 C117 DWL C1E ; "MVI",TAB,"E,",RS ; 1E
1549 C817 DWL C1F ; "RAR",TAB,RS ; 1F
154B CD17 DWL C20 ; "RIM",TAB,RS ; 20
154D D217 DWL C21 ; "LXI",TAB,"H,",RS ; 21
154F D917 DWL C22 ; "SHLD",TAB,RS ; 22
1551 DF17 DWL C23 ; "INX",TAB,"H",RS ; 23
1553 E517 DWL C24 ; "INR",TAB,"H",RS ; 24
1555 EB17 DWL C25 ; "DCR",TAB,"H",RS ; 25
1557 F117 DWL C26 ; "MVI",TAB,"H,",RS ; 26
1559 F817 DWL C27 ; "DAA",TAB,RS ; 27
155B FD17 DWL C28 ; "DFB",TAB,RS ; 28
155D 0218 DWL C29 ; "DAD",TAB,"H",RS ; 29
155F 0818 DWL C2A ; "LHLD",TAB,RS ; 2A
1561 0E18 DWL C2B ; "DCX",TAB,"H",RS ; 2B
1563 1418 DWL C2C ; "INR",TAB,"L",RS ; 2C
1565 1A18 DWL C2D ; "DCR",TAB,"L",RS ; 2D
1567 2018 DWL C2E ; "MVI",TAB,"L,",RS ; 2E
1569 2718 DWL C2F ; "CMA",TAB,RS ; 2F
156B 2C18 DWL C30 ; "SIM",TAB,RS ; 30
156D 3118 DWL C31 ; "LXI",TAB,"SP,",RS ; 31
156F 3918 DWL C32 ; "STA",TAB,RS ; 32
1571 3E18 DWL C33 ; "INX",TAB,"SP",RS ; 33
1573 4518 DWL C34 ; "INR",TAB,"M",RS ; 34
1575 4B18 DWL C35 ; "DCR",TAB,"M",RS ; 35
1577 5118 DWL C36 ; "MVI",TAB,"M,",RS ; 36
1579 5818 DWL C37 ; "STC",TAB,RS ; 37
B8085.LST 29/12/2559 12:32
Page 51 of 64
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
157B 5D18 DWL C38 ; "DFB",TAB,RS ; 38
157D 6218 DWL C39 ; "DAD",TAB,"SP",RS ; 39
157F 6918 DWL C3A ; "LDA",TAB,RS ; 3A
1581 6E18 DWL C3B ; "DCX",TAB,"SP",RS ; 3B
1583 7518 DWL C3C ; "INR",TAB,"A",RS ; 3C
1585 7B18 DWL C3D ; "DCR",TAB,"A",RS ; 3D
1587 8118 DWL C3E ; "MVI",TAB,"A,",RS ; 3E
1589 8818 DWL C3F ; "CMC",TAB,RS ; 3F
158B 8D18 DWL C40 ; "MOV",TAB,"B,B",RS ; 40
158D 9518 DWL C41 ; "MOV",TAB,"B,C",RS ; 41
158F 9D18 DWL C42 ; "MOV",TAB,"B,D",RS ; 42
1591 A518 DWL C43 ; "MOV",TAB,"B,E",RS ; 43
1593 AD18 DWL C44 ; "MOV",TAB,"B,H",RS ; 44
1595 B518 DWL C45 ; "MOV",TAB,"B,L",RS ; 45
1597 BD18 DWL C46 ; "MOV",TAB,"B,M",RS ; 46
1599 C518 DWL C47 ; "MOV",TAB,"B,A",RS ; 47
159B CD18 DWL C48 ; "MOV",TAB,"C,B",RS ; 48
159D D518 DWL C49 ; "MOV",TAB,"C,C",RS ; 49
159F DD18 DWL C4A ; "MOV",TAB,"C,D",RS ; 4A
15A1 E518 DWL C4B ; "MOV",TAB,"C,E",RS ; 4B
15A3 ED18 DWL C4C ; "MOV",TAB,"C,H",RS ; 4C
15A5 F518 DWL C4D ; "MOV",TAB,"C,L",RS ; 4D
15A7 FD18 DWL C4E ; "MOV",TAB,"C,M",RS ; 4E
15A9 0519 DWL C4F ; "MOV",TAB,"C,A",RS ; 4F
15AB 0D19 DWL C50 ; "MOV",TAB,"D,B",RS ; 50
15AD 1519 DWL C51 ; "MOV",TAB,"D,C",RS ; 51
15AF 1D19 DWL C52 ; "MOV",TAB,"D,D",RS ; 52
15B1 2519 DWL C53 ; "MOV",TAB,"D,E",RS ; 53
15B3 2D19 DWL C54 ; "MOV",TAB,"D,H",RS ; 54
15B5 3519 DWL C55 ; "MOV",TAB,"D,L",RS ; 55
15B7 3D19 DWL C56 ; "MOV",TAB,"D,M",RS ; 56
15B9 4519 DWL C57 ; "MOV",TAB,"D,A",RS ; 57
15BB 4D19 DWL C58 ; "MOV",TAB,"E,B",RS ; 58
15BD 5519 DWL C59 ; "MOV",TAB,"E,C",RS ; 59
15BF 5D19 DWL C5A ; "MOV",TAB,"E,D",RS ; 5A
15C1 6519 DWL C5B ; "MOV",TAB,"E,E",RS ; 5B
15C3 6D19 DWL C5C ; "MOV",TAB,"E,H",RS ; 5C
15C5 7519 DWL C5D ; "MOV",TAB,"E,L",RS ; 5D
15C7 7D19 DWL C5E ; "MOV",TAB,"E,M",RS ; 5E
15C9 8519 DWL C5F ; "MOV",TAB,"E,A",RS ; 5F
15CB 8D19 DWL C60 ; "MOV",TAB,"H,B",RS ; 60
15CD 9519 DWL C61 ; "MOV",TAB,"H,C",RS ; 61
15CF 9D19 DWL C62 ; "MOV",TAB,"H,D",RS ; 62
15D1 A519 DWL C63 ; "MOV",TAB,"H,E",RS ; 63
15D3 AD19 DWL C64 ; "MOV",TAB,"H,H",RS ; 64
15D5 B519 DWL C65 ; "MOV",TAB,"H,L",RS ; 65
15D7 BD19 DWL C66 ; "MOV",TAB,"H,M",RS ; 66
15D9 C519 DWL C67 ; "MOV",TAB,"H,A",RS ; 67
15DB CD19 DWL C68 ; "MOV",TAB,"L,B",RS ; 68
15DD D519 DWL C69 ; "MOV",TAB,"L,C",RS ; 69
15DF DD19 DWL C6A ; "MOV",TAB,"L,D",RS ; 6A
15E1 E519 DWL C6B ; "MOV",TAB,"L,E",RS ; 6B
15E3 ED19 DWL C6C ; "MOV",TAB,"L,H",RS ; 6C
15E5 F519 DWL C6D ; "MOV",TAB,"L,L",RS ; 6D
15E7 FD19 DWL C6E ; "MOV",TAB,"L,M",RS ; 6E
15E9 051A DWL C6F ; "MOV",TAB,"L,A",RS ; 6F
15EB 0D1A DWL C70 ; "MOV",TAB,"M,B",RS ; 70
15ED 151A DWL C71 ; "MOV",TAB,"M,C",RS ; 71
15EF 1D1A DWL C72 ; "MOV",TAB,"M,D",RS ; 72
15F1 251A DWL C73 ; "MOV",TAB,"M,E",RS ; 73
15F3 2D1A DWL C74 ; "MOV",TAB,"M,H",RS ; 74
15F5 351A DWL C75 ; "MOV",TAB,"M,L",RS ; 75
15F7 3D1A DWL C76 ; "HLT",TAB,RS ; 76
15F9 421A DWL C77 ; "MOV",TAB,"M,A",RS ; 77
15FB 4A1A DWL C78 ; "MOV",TAB,"A,B",RS ; 78
15FD 521A DWL C79 ; "MOV",TAB,"A,C",RS ; 79
15FF 5A1A DWL C7A ; "MOV",TAB,"A,D",RS ; 7A
1601 621A DWL C7B ; "MOV",TAB,"A,E",RS ; 7B
1603 6A1A DWL C7C ; "MOV",TAB,"A,H",RS ; 7C
1605 721A DWL C7D ; "MOV",TAB,"A,L",RS ; 7D
1607 7A1A DWL C7E ; "MOV",TAB,"A,M",RS ; 7E
1609 821A DWL C7F ; "MOV",TAB,"A,A",RS ; 7F
160B 8A1A DWL C80 ; "ADD",TAB,"B",RS ; 80
160D 901A DWL C81 ; "ADD",TAB,"C",RS ; 81
160F 961A DWL C82 ; "ADD",TAB,"D",RS ; 82
1611 9C1A DWL C83 ; "ADD",TAB,"E",RS ; 83
B8085.LST 29/12/2559 12:32
Page 52 of 64
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
1613 A21A DWL C84 ; "ADD",TAB,"H",RS ; 84
1615 A81A DWL C85 ; "ADD",TAB,"L",RS ; 85
1617 AE1A DWL C86 ; "ADD",TAB,"M",RS ; 86
1619 B41A DWL C87 ; "ADD",TAB,"A",RS ; 87
161B BA1A DWL C88 ; "ADC",TAB,"B",RS ; 88
161D C01A DWL C89 ; "ADC",TAB,"C",RS ; 89
161F C61A DWL C8A ; "ADC",TAB,"D",RS ; 8A
1621 CC1A DWL C8B ; "ADC",TAB,"E",RS ; 8B
1623 D21A DWL C8C ; "ADC",TAB,"H",RS ; 8C
1625 D81A DWL C8D ; "ADC",TAB,"L",RS ; 8D
1627 DE1A DWL C8E ; "ADC",TAB,"M",RS ; 8E
1629 E41A DWL C8F ; "ADC",TAB,"A",RS ; 8F
162B EA1A DWL C90 ; "SUB",TAB,"B",RS ; 90
162D F01A DWL C91 ; "SUB",TAB,"C",RS ; 91
162F F61A DWL C92 ; "SUB",TAB,"D",RS ; 92
1631 FC1A DWL C93 ; "SUB",TAB,"E",RS ; 93
1633 021B DWL C94 ; "SUB",TAB,"H",RS ; 94
1635 081B DWL C95 ; "SUB",TAB,"L",RS ; 95
1637 0E1B DWL C96 ; "SUB",TAB,"M",RS ; 96
1639 141B DWL C97 ; "SUB",TAB,"A",RS ; 97
163B 1A1B DWL C98 ; "SBB",TAB,"B",RS ; 98
163D 201B DWL C99 ; "SBB",TAB,"C",RS ; 99
163F 261B DWL C9A ; "SBB",TAB,"D",RS ; 9A
1641 2C1B DWL C9B ; "SBB",TAB,"E",RS ; 9B
1643 321B DWL C9C ; "SBB",TAB,"H",RS ; 9C
1645 381B DWL C9D ; "SBB",TAB,"L",RS ; 9D
1647 3E1B DWL C9E ; "SBB",TAB,"M",RS ; 9E
1649 441B DWL C9F ; "SBB",TAB,"A",RS ; 9F
164B 4A1B DWL CA0 ; "ANA",TAB,"B",RS ; A0
164D 501B DWL CA1 ; "ANA",TAB,"C",RS ; A1
164F 561B DWL CA2 ; "ANA",TAB,"D",RS ; A2
1651 5C1B DWL CA3 ; "ANA",TAB,"E",RS ; A3
1653 621B DWL CA4 ; "ANA",TAB,"H",RS ; A4
1655 681B DWL CA5 ; "ANA",TAB,"L",RS ; A5
1657 6E1B DWL CA6 ; "ANA",TAB,"M",RS ; A6
1659 741B DWL CA7 ; "ANA",TAB,"A",RS ; A7
165B 7A1B DWL CA8 ; "XRA",TAB,"B",RS ; A8
165D 801B DWL CA9 ; "XRA",TAB,"C",RS ; A9
165F 861B DWL CAA ; "XRA",TAB,"D",RS ; AA
1661 8C1B DWL CAB ; "XRA",TAB,"E",RS ; AB
1663 921B DWL CAC ; "XRA",TAB,"H",RS ; AC
1665 981B DWL CAD ; "XRA",TAB,"L",RS ; AD
1667 9E1B DWL CAE ; "XRA",TAB,"M",RS ; AE
1669 A41B DWL CAF ; "XRA",TAB,"A",RS ; AF
166B AA1B DWL CB0 ; "ORA",TAB,"B",RS ; B0
166D B01B DWL CB1 ; "ORA",TAB,"C",RS ; B1
166F B61B DWL CB2 ; "ORA",TAB,"D",RS ; B2
1671 BC1B DWL CB3 ; "ORA",TAB,"E",RS ; B3
1673 C21B DWL CB4 ; "ORA",TAB,"H",RS ; B4
1675 C81B DWL CB5 ; "ORA",TAB,"L",RS ; B5
1677 CE1B DWL CB6 ; "ORA",TAB,"M",RS ; B6
1679 D41B DWL CB7 ; "ORA",TAB,"A",RS ; B7
167B DA1B DWL CB8 ; "CMP",TAB,"B",RS ; B8
167D E01B DWL CB9 ; "CMP",TAB,"C",RS ; B9
167F E61B DWL CBA ; "CMP",TAB,"D",RS ; BA
1681 EC1B DWL CBB ; "CMP",TAB,"E",RS ; BB
1683 F21B DWL CBC ; "CMP",TAB,"H",RS ; BC
1685 F81B DWL CBD ; "CMP",TAB,"L",RS ; BD
1687 FE1B DWL CBE ; "CMP",TAB,"M",RS ; BE
1689 041C DWL CBF ; "CMP",TAB,"A",RS ; BF
168B 0A1C DWL CC0 ; "RNZ",TAB,RS ; C0
168D 0F1C DWL CC1 ; "POP",TAB,"B",RS ; C1
168F 151C DWL CC2 ; "JNZ",TAB,RS ; C2
1691 1A1C DWL CC3 ; "JMP",TAB,RS ; C3
1693 1F1C DWL CC4 ; "CNZ",TAB,RS ; C4
1695 241C DWL CC5 ; "PUSH",TAB,"B",RS ; C5
1697 2B1C DWL CC6 ; "ADI",TAB,RS ; C6
1699 301C DWL CC7 ; "RST",TAB,"0",RS ; C7
169B 361C DWL CC8 ; "RZ",TAB,RS ; C8
169D 3A1C DWL CC9 ; "RET",TAB,RS ; C9
169F 3F1C DWL CCA ; "JZ",TAB,RS ; CA
16A1 431C DWL CCB ; "DFB",TAB,RS ; CB
16A3 481C DWL CCC ; "CZ",TAB,RS ; CC
16A5 4C1C DWL CCD ; "CALL",TAB,RS ; CD
16A7 521C DWL CCE ; "ACI",TAB,RS ; CE
16A9 571C DWL CCF ; "RST",TAB,"1",RS ; CF
B8085.LST 29/12/2559 12:32
Page 53 of 64
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
16AB 5D1C DWL CD0 ; "RNC",TAB,RS ; D0
16AD 621C DWL CD1 ; "POP",TAB,"D",RS ; D1
16AF 681C DWL CD2 ; "JNC",TAB,RS ; D2
16B1 6D1C DWL CD3 ; "OUT",TAB,RS ; D3
16B3 721C DWL CD4 ; "CNC",TAB,RS ; D4
16B5 771C DWL CD5 ; "PUSH",TAB,"D",RS ; D5
16B7 7E1C DWL CD6 ; "SUI",TAB,RS ; D6
16B9 831C DWL CD7 ; "RST",TAB,"2",RS ; D7
16BB 891C DWL CD8 ; "RC",TAB,RS ; D8
16BD 8D1C DWL CD9 ; "DFB",TAB,RS ; D9
16BF 921C DWL CDA ; "JC",TAB,RS ; DA
16C1 961C DWL CDB ; "IN",TAB,RS ; DFB
16C3 9A1C DWL CDC ; "CC",TAB,RS ; DC
16C5 9E1C DWL CDD ; "DFB",TAB,RS ; DD
16C7 A31C DWL CDE ; "SBI",TAB,RS ; DE
16C9 A81C DWL CDF ; "RST",TAB,"3",RS ; DF
16CB AE1C DWL CE0 ; "RPO",TAB,RS ; E0
16CD B31C DWL CE1 ; "POP",TAB,"H",RS ; E1
16CF B91C DWL CE2 ; "JPO",TAB,RS ; E2
16D1 BE1C DWL CE3 ; "XTHL",TAB,RS ; E3
16D3 C41C DWL CE4 ; "CPO",TAB,RS ; E4
16D5 C91C DWL CE5 ; "PUSH",TAB,"H",RS ; E5
16D7 D01C DWL CE6 ; "ANI",TAB,RS ; E6
16D9 D51C DWL CE7 ; "RST",TAB,"4",RS ; E7
16DB DB1C DWL CE8 ; "RPE",TAB,RS ; E8
16DD E01C DWL CE9 ; "PCHL",TAB,RS ; E9
16DF E61C DWL CEA ; "JPE",TAB,RS ; EA
16E1 EB1C DWL CEB ; "XCHG",TAB,RS ; EB
16E3 F11C DWL CEC ; "CPE",TAB,RS ; EC
16E5 F61C DWL CED ; "DFB",TAB,RS ; ED
16E7 FB1C DWL CEE ; "XRI",TAB,RS ; EE
16E9 001D DWL CEF ; "RST",TAB,"5",RS ; EF
16EB 061D DWL CF0 ; "RP",TAB,RS ; F0
16ED 0A1D DWL CF1 ; "POP",TAB,"PSW",RS ; F1
16EF 121D DWL CF2 ; "JP",TAB,RS ; F2
16F1 161D DWL CF3 ; "DI",TAB,RS ; F3
16F3 1A1D DWL CF4 ; "CP",TAB,RS ; F4
16F5 1E1D DWL CF5 ; "PUSH",TAB,"PSW",RS ; F5
16F7 271D DWL CF6 ; "ORI",TAB,RS ; F6
16F9 2C1D DWL CF7 ; "RST",TAB,"6",RS ; F7
16FB 321D DWL CF8 ; "RM",TAB,RS ; F8
16FD 361D DWL CF9 ; "SPHL",TAB,RS ; F9
16FF 3C1D DWL CFA ; "JM",TAB,RS ; FA
1701 401D DWL CFB ; "EI",TAB,RS ; FB
1703 441D DWL CFC ; "CM",TAB,RS ; FC
1705 481D DWL CFD ; "DFB",TAB,RS ; FD
1707 4D1D DWL CFE ; "CPI",TAB,RS ; FE
1709 521D DWL CFF ; "RST",TAB,"7",RS, ; FF
; --------- mnemonic table ---------------------------------------
170B MNEM
170B 4E4F500900C0 DFB "NOP",TAB,RS ; 00
1710 4C58490942C1 DFB "LXI",TAB,"B,",RS ; 01
1717 5354415809C2 DFB "STAX",TAB,"B",RS ; 02
171E 494E580942C3 DFB "INX",TAB,"B",RS ; 03
1724 494E520942C4 DFB "INR",TAB,"B",RS ; 04
172A 4443520942C5 DFB "DCR",TAB,"B",RS ; 05
1730 4D56490942C6 DFB "MVI",TAB,"B,",RS ; 06
1737 524C430900C7 DFB "RLC",TAB,RS ; 07
173C 4446420900C8 DFB "DFB",TAB,RS ; 08
1741 4441440942C9 DFB "DAD",TAB,"B",RS ; 09
1747 4C44415809CA DFB "LDAX",TAB,"B",RS ; 0A
174E 4443580942CB DFB "DCX",TAB,"B",RS ; 0B
1754 494E520943CC DFB "INR",TAB,"C",RS ; 0C
175A 4443520943CD DFB "DCR",TAB,"C",RS ; 0D
1760 4D56490943CE DFB "MVI",TAB,"C,",RS ; 0E
1767 5252430900CF DFB "RRC",TAB,RS ; 0F
176C 4446420900C10 DFB "DFB",TAB,RS ; 10
1771 4C58490944C11 DFB "LXI",TAB,"D,",RS ; 11
1778 5354415809C12 DFB "STAX",TAB,"D",RS ; 12
177F 494E580944C13 DFB "INX",TAB,"D",RS ; 13
1785 494E520944C14 DFB "INR",TAB,"D",RS ; 14
178B 4443520944C15 DFB "DCR",TAB,"D",RS ; 15
1791 4D56490944C16 DFB "MVI",TAB,"D,",RS ; 16
B8085.LST 29/12/2559 12:32
Page 54 of 64
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
1798 52414C0900C17 DFB "RAL",TAB,RS ; 17
179D 4446420900C18 DFB "DFB",TAB,RS ; 18
17A2 4441440944C19 DFB "DAD",TAB,"D",RS ; 19
17A8 4C44415809C1A DFB "LDAX",TAB,"D",RS ; 1A
17AF 4443580944C1B DFB "DCX",TAB,"D",RS ; 1B
17B5 494E520945C1C DFB "INR",TAB,"E",RS ; 1C
17BB 4443520945C1D DFB "DCR",TAB,"E",RS ; 1D
17C1 4D56490945C1E DFB "MVI",TAB,"E,",RS ; 1E
17C8 5241520900C1F DFB "RAR",TAB,RS ; 1F
17CD 52494D0900C20 DFB "RIM",TAB,RS ; 20
17D2 4C58490948C21 DFB "LXI",TAB,"H,",RS ; 21
17D9 53484C4409C22 DFB "SHLD",TAB,RS ; 22
17DF 494E580948C23 DFB "INX",TAB,"H",RS ; 23
17E5 494E520948C24 DFB "INR",TAB,"H",RS ; 24
17EB 4443520948C25 DFB "DCR",TAB,"H",RS ; 25
17F1 4D56490948C26 DFB "MVI",TAB,"H,",RS ; 26
17F8 4441410900C27 DFB "DAA",TAB,RS ; 27
17FD 4446420900C28 DFB "DFB",TAB,RS ; 28
1802 4441440948C29 DFB "DAD",TAB,"H",RS ; 29
1808 4C484C4409C2A DFB "LHLD",TAB,RS ; 2A
180E 4443580948C2B DFB "DCX",TAB,"H",RS ; 2B
1814 494E52094CC2C DFB "INR",TAB,"L",RS ; 2C
181A 444352094CC2D DFB "DCR",TAB,"L",RS ; 2D
1820 4D5649094CC2E DFB "MVI",TAB,"L,",RS ; 2E
1827 434D410900C2F DFB "CMA",TAB,RS ; 2F
182C 53494D0900C30 DFB "SIM",TAB,RS ; 30
1831 4C58490953C31 DFB "LXI",TAB,"SP,",RS ; 31
1839 5354410900C32 DFB "STA",TAB,RS ; 32
183E 494E580953C33 DFB "INX",TAB,"SP",RS ; 33
1845 494E52094DC34 DFB "INR",TAB,"M",RS ; 34
184B 444352094DC35 DFB "DCR",TAB,"M",RS ; 35
1851 4D5649094DC36 DFB "MVI",TAB,"M,",RS ; 36
1858 5354430900C37 DFB "STC",TAB,RS ; 37
185D 4446420900C38 DFB "DFB",TAB,RS ; 38
1862 4441440953C39 DFB "DAD",TAB,"SP",RS ; 39
1869 4C44410900C3A DFB "LDA",TAB,RS ; 3A
186E 4443580953C3B DFB "DCX",TAB,"SP",RS ; 3B
1875 494E520941C3C DFB "INR",TAB,"A",RS ; 3C
187B 4443520941C3D DFB "DCR",TAB,"A",RS ; 3D
1881 4D56490941C3E DFB "MVI",TAB,"A,",RS ; 3E
1888 434D430900C3F DFB "CMC",TAB,RS ; 3F
188D 4D4F560942C40 DFB "MOV",TAB,"B,B",RS ; 40
1895 4D4F560942C41 DFB "MOV",TAB,"B,C",RS ; 41
189D 4D4F560942C42 DFB "MOV",TAB,"B,D",RS ; 42
18A5 4D4F560942C43 DFB "MOV",TAB,"B,E",RS ; 43
18AD 4D4F560942C44 DFB "MOV",TAB,"B,H",RS ; 44
18B5 4D4F560942C45 DFB "MOV",TAB,"B,L",RS ; 45
18BD 4D4F560942C46 DFB "MOV",TAB,"B,M",RS ; 46
18C5 4D4F560942C47 DFB "MOV",TAB,"B,A",RS ; 47
18CD 4D4F560943C48 DFB "MOV",TAB,"C,B",RS ; 48
18D5 4D4F560943C49 DFB "MOV",TAB,"C,C",RS ; 49
18DD 4D4F560943C4A DFB "MOV",TAB,"C,D",RS ; 4A
18E5 4D4F560943C4B DFB "MOV",TAB,"C,E",RS ; 4B
18ED 4D4F560943C4C DFB "MOV",TAB,"C,H",RS ; 4C
18F5 4D4F560943C4D DFB "MOV",TAB,"C,L",RS ; 4D
18FD 4D4F560943C4E DFB "MOV",TAB,"C,M",RS ; 4E
1905 4D4F560943C4F DFB "MOV",TAB,"C,A",RS ; 4F
190D 4D4F560944C50 DFB "MOV",TAB,"D,B",RS ; 50
1915 4D4F560944C51 DFB "MOV",TAB,"D,C",RS ; 51
191D 4D4F560944C52 DFB "MOV",TAB,"D,D",RS ; 52
1925 4D4F560944C53 DFB "MOV",TAB,"D,E",RS ; 53
192D 4D4F560944C54 DFB "MOV",TAB,"D,H",RS ; 54
1935 4D4F560944C55 DFB "MOV",TAB,"D,L",RS ; 55
193D 4D4F560944C56 DFB "MOV",TAB,"D,M",RS ; 56
1945 4D4F560944C57 DFB "MOV",TAB,"D,A",RS ; 57
194D 4D4F560945C58 DFB "MOV",TAB,"E,B",RS ; 58
1955 4D4F560945C59 DFB "MOV",TAB,"E,C",RS ; 59
195D 4D4F560945C5A DFB "MOV",TAB,"E,D",RS ; 5A
1965 4D4F560945C5B DFB "MOV",TAB,"E,E",RS ; 5B
196D 4D4F560945C5C DFB "MOV",TAB,"E,H",RS ; 5C
1975 4D4F560945C5D DFB "MOV",TAB,"E,L",RS ; 5D
197D 4D4F560945C5E DFB "MOV",TAB,"E,M",RS ; 5E
1985 4D4F560945C5F DFB "MOV",TAB,"E,A",RS ; 5F
198D 4D4F560948C60 DFB "MOV",TAB,"H,B",RS ; 60
1995 4D4F560948C61 DFB "MOV",TAB,"H,C",RS ; 61
199D 4D4F560948C62 DFB "MOV",TAB,"H,D",RS ; 62
B8085.LST 29/12/2559 12:32
Page 55 of 64
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
19A5 4D4F560948C63 DFB "MOV",TAB,"H,E",RS ; 63
19AD 4D4F560948C64 DFB "MOV",TAB,"H,H",RS ; 64
19B5 4D4F560948C65 DFB "MOV",TAB,"H,L",RS ; 65
19BD 4D4F560948C66 DFB "MOV",TAB,"H,M",RS ; 66
19C5 4D4F560948C67 DFB "MOV",TAB,"H,A",RS ; 67
19CD 4D4F56094CC68 DFB "MOV",TAB,"L,B",RS ; 68
19D5 4D4F56094CC69 DFB "MOV",TAB,"L,C",RS ; 69
19DD 4D4F56094CC6A DFB "MOV",TAB,"L,D",RS ; 6A
19E5 4D4F56094CC6B DFB "MOV",TAB,"L,E",RS ; 6B
19ED 4D4F56094CC6C DFB "MOV",TAB,"L,H",RS ; 6C
19F5 4D4F56094CC6D DFB "MOV",TAB,"L,L",RS ; 6D
19FD 4D4F56094CC6E DFB "MOV",TAB,"L,M",RS ; 6E
1A05 4D4F56094CC6F DFB "MOV",TAB,"L,A",RS ; 6F
1A0D 4D4F56094DC70 DFB "MOV",TAB,"M,B",RS ; 70
1A15 4D4F56094DC71 DFB "MOV",TAB,"M,C",RS ; 71
1A1D 4D4F56094DC72 DFB "MOV",TAB,"M,D",RS ; 72
1A25 4D4F56094DC73 DFB "MOV",TAB,"M,E",RS ; 73
1A2D 4D4F56094DC74 DFB "MOV",TAB,"M,H",RS ; 74
1A35 4D4F56094DC75 DFB "MOV",TAB,"M,L",RS ; 75
1A3D 484C540900C76 DFB "HLT",TAB,RS ; 76
1A42 4D4F56094DC77 DFB "MOV",TAB,"M,A",RS ; 77
1A4A 4D4F560941C78 DFB "MOV",TAB,"A,B",RS ; 78
1A52 4D4F560941C79 DFB "MOV",TAB,"A,C",RS ; 79
1A5A 4D4F560941C7A DFB "MOV",TAB,"A,D",RS ; 7A
1A62 4D4F560941C7B DFB "MOV",TAB,"A,E",RS ; 7B
1A6A 4D4F560941C7C DFB "MOV",TAB,"A,H",RS ; 7C
1A72 4D4F560941C7D DFB "MOV",TAB,"A,L",RS ; 7D
1A7A 4D4F560941C7E DFB "MOV",TAB,"A,M",RS ; 7E
1A82 4D4F560941C7F DFB "MOV",TAB,"A,A",RS ; 7F
1A8A 4144440942C80 DFB "ADD",TAB,"B",RS ; 80
1A90 4144440943C81 DFB "ADD",TAB,"C",RS ; 81
1A96 4144440944C82 DFB "ADD",TAB,"D",RS ; 82
1A9C 4144440945C83 DFB "ADD",TAB,"E",RS ; 83
1AA2 4144440948C84 DFB "ADD",TAB,"H",RS ; 84
1AA8 414444094CC85 DFB "ADD",TAB,"L",RS ; 85
1AAE 414444094DC86 DFB "ADD",TAB,"M",RS ; 86
1AB4 4144440941C87 DFB "ADD",TAB,"A",RS ; 87
1ABA 4144430942C88 DFB "ADC",TAB,"B",RS ; 88
1AC0 4144430943C89 DFB "ADC",TAB,"C",RS ; 89
1AC6 4144430944C8A DFB "ADC",TAB,"D",RS ; 8A
1ACC 4144430945C8B DFB "ADC",TAB,"E",RS ; 8B
1AD2 4144430948C8C DFB "ADC",TAB,"H",RS ; 8C
1AD8 414443094CC8D DFB "ADC",TAB,"L",RS ; 8D
1ADE 414443094DC8E DFB "ADC",TAB,"M",RS ; 8E
1AE4 4144430941C8F DFB "ADC",TAB,"A",RS ; 8F
1AEA 5355420942C90 DFB "SUB",TAB,"B",RS ; 90
1AF0 5355420943C91 DFB "SUB",TAB,"C",RS ; 91
1AF6 5355420944C92 DFB "SUB",TAB,"D",RS ; 92
1AFC 5355420945C93 DFB "SUB",TAB,"E",RS ; 93
1B02 5355420948C94 DFB "SUB",TAB,"H",RS ; 94
1B08 535542094CC95 DFB "SUB",TAB,"L",RS ; 95
1B0E 535542094DC96 DFB "SUB",TAB,"M",RS ; 96
1B14 5355420941C97 DFB "SUB",TAB,"A",RS ; 97
1B1A 5342420942C98 DFB "SBB",TAB,"B",RS ; 98
1B20 5342420943C99 DFB "SBB",TAB,"C",RS ; 99
1B26 5342420944C9A DFB "SBB",TAB,"D",RS ; 9A
1B2C 5342420945C9B DFB "SBB",TAB,"E",RS ; 9B
1B32 5342420948C9C DFB "SBB",TAB,"H",RS ; 9C
1B38 534242094CC9D DFB "SBB",TAB,"L",RS ; 9D
1B3E 534242094DC9E DFB "SBB",TAB,"M",RS ; 9E
1B44 5342420941C9F DFB "SBB",TAB,"A",RS ; 9F
1B4A 414E410942CA0 DFB "ANA",TAB,"B",RS ; A0
1B50 414E410943CA1 DFB "ANA",TAB,"C",RS ; A1
1B56 414E410944CA2 DFB "ANA",TAB,"D",RS ; A2
1B5C 414E410945CA3 DFB "ANA",TAB,"E",RS ; A3
1B62 414E410948CA4 DFB "ANA",TAB,"H",RS ; A4
1B68 414E41094CCA5 DFB "ANA",TAB,"L",RS ; A5
1B6E 414E41094DCA6 DFB "ANA",TAB,"M",RS ; A6
1B74 414E410941CA7 DFB "ANA",TAB,"A",RS ; A7
1B7A 5852410942CA8 DFB "XRA",TAB,"B",RS ; A8
1B80 5852410943CA9 DFB "XRA",TAB,"C",RS ; A9
1B86 5852410944CAA DFB "XRA",TAB,"D",RS ; AA
1B8C 5852410945CAB DFB "XRA",TAB,"E",RS ; AB
1B92 5852410948CAC DFB "XRA",TAB,"H",RS ; AC
1B98 585241094CCAD DFB "XRA",TAB,"L",RS ; AD
1B9E 585241094DCAE DFB "XRA",TAB,"M",RS ; AE
B8085.LST 29/12/2559 12:32
Page 56 of 64
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
1BA4 5852410941CAF DFB "XRA",TAB,"A",RS ; AF
1BAA 4F52410942CB0 DFB "ORA",TAB,"B",RS ; B0
1BB0 4F52410943CB1 DFB "ORA",TAB,"C",RS ; B1
1BB6 4F52410944CB2 DFB "ORA",TAB,"D",RS ; B2
1BBC 4F52410945CB3 DFB "ORA",TAB,"E",RS ; B3
1BC2 4F52410948CB4 DFB "ORA",TAB,"H",RS ; B4
1BC8 4F5241094CCB5 DFB "ORA",TAB,"L",RS ; B5
1BCE 4F5241094DCB6 DFB "ORA",TAB,"M",RS ; B6
1BD4 4F52410941CB7 DFB "ORA",TAB,"A",RS ; B7
1BDA 434D500942CB8 DFB "CMP",TAB,"B",RS ; B8
1BE0 434D500943CB9 DFB "CMP",TAB,"C",RS ; B9
1BE6 434D500944CBA DFB "CMP",TAB,"D",RS ; BA
1BEC 434D500945CBB DFB "CMP",TAB,"E",RS ; BB
1BF2 434D500948CBC DFB "CMP",TAB,"H",RS ; BC
1BF8 434D50094CCBD DFB "CMP",TAB,"L",RS ; BD
1BFE 434D50094DCBE DFB "CMP",TAB,"M",RS ; BE
1C04 434D500941CBF DFB "CMP",TAB,"A",RS ; BF
1C0A 524E5A0900CC0 DFB "RNZ",TAB,RS ; C0
1C0F 504F500942CC1 DFB "POP",TAB,"B",RS ; C1
1C15 4A4E5A0900CC2 DFB "JNZ",TAB,RS ; C2
1C1A 4A4D500900CC3 DFB "JMP",TAB,RS ; C3
1C1F 434E5A0900CC4 DFB "CNZ",TAB,RS ; C4
1C24 5055534809CC5 DFB "PUSH",TAB,"B",RS ; C5
1C2B 4144490900CC6 DFB "ADI",TAB,RS ; C6
1C30 5253540930CC7 DFB "RST",TAB,"0",RS ; C7
1C36 525A0900 CC8 DFB "RZ",TAB,RS ; C8
1C3A 5245540900CC9 DFB "RET",TAB,RS ; C9
1C3F 4A5A0900 CCA DFB "JZ",TAB,RS ; CA
1C43 4446420900CCB DFB "DFB",TAB,RS ; CB
1C48 435A0900 CCC DFB "CZ",TAB,RS ; CC
1C4C 43414C4C09CCD DFB "CALL",TAB,RS ; CD
1C52 4143490900CCE DFB "ACI",TAB,RS ; CE
1C57 5253540931CCF DFB "RST",TAB,"1",RS ; CF
1C5D 524E430900CD0 DFB "RNC",TAB,RS ; D0
1C62 504F500944CD1 DFB "POP",TAB,"D",RS ; D1
1C68 4A4E430900CD2 DFB "JNC",TAB,RS ; D2
1C6D 4F55540900CD3 DFB "OUT",TAB,RS ; D3
1C72 434E430900CD4 DFB "CNC",TAB,RS ; D4
1C77 5055534809CD5 DFB "PUSH",TAB,"D",RS ; D5
1C7E 5355490900CD6 DFB "SUI",TAB,RS ; D6
1C83 5253540932CD7 DFB "RST",TAB,"2",RS ; D7
1C89 52430900 CD8 DFB "RC",TAB,RS ; D8
1C8D 4446420900CD9 DFB "DFB",TAB,RS ; D9
1C92 4A430900 CDA DFB "JC",TAB,RS ; DA
1C96 494E0900 CDB DFB "IN",TAB,RS ; DFB
1C9A 43430900 CDC DFB "CC",TAB,RS ; DC
1C9E 4446420900CDD DFB "DFB",TAB,RS ; DD
1CA3 5342490900CDE DFB "SBI",TAB,RS ; DE
1CA8 5253540933CDF DFB "RST",TAB,"3",RS ; DF
1CAE 52504F0900CE0 DFB "RPO",TAB,RS ; E0
1CB3 504F500948CE1 DFB "POP",TAB,"H",RS ; E1
1CB9 4A504F0900CE2 DFB "JPO",TAB,RS ; E2
1CBE 5854484C09CE3 DFB "XTHL",TAB,RS ; E3
1CC4 43504F0900CE4 DFB "CPO",TAB,RS ; E4
1CC9 5055534809CE5 DFB "PUSH",TAB,"H",RS ; E5
1CD0 414E490900CE6 DFB "ANI",TAB,RS ; E6
1CD5 5253540934CE7 DFB "RST",TAB,"4",RS ; E7
1CDB 5250450900CE8 DFB "RPE",TAB,RS ; E8
1CE0 5043484C09CE9 DFB "PCHL",TAB,RS ; E9
1CE6 4A50450900CEA DFB "JPE",TAB,RS ; EA
1CEB 5843484709CEB DFB "XCHG",TAB,RS ; EB
1CF1 4350450900CEC DFB "CPE",TAB,RS ; EC
1CF6 4446420900CED DFB "DFB",TAB,RS ; ED
1CFB 5852490900CEE DFB "XRI",TAB,RS ; EE
1D00 5253540935CEF DFB "RST",TAB,"5",RS ; EF
1D06 52500900 CF0 DFB "RP",TAB,RS ; F0
1D0A 504F500950CF1 DFB "POP",TAB,"PSW",RS ; F1
1D12 4A500900 CF2 DFB "JP",TAB,RS ; F2
1D16 44490900 CF3 DFB "DI",TAB,RS ; F3
1D1A 43500900 CF4 DFB "CP",TAB,RS ; F4
1D1E 5055534809CF5 DFB "PUSH",TAB,"PSW",RS ; F5
1D27 4F52490900CF6 DFB "ORI",TAB,RS ; F6
1D2C 5253540936CF7 DFB "RST",TAB,"6",RS ; F7
1D32 524D0900 CF8 DFB "RM",TAB,RS ; F8
1D36 5350484C09CF9 DFB "SPHL",TAB,RS ; F9
1D3C 4A4D0900 CFA DFB "JM",TAB,RS ; FA
B8085.LST 29/12/2559 12:32
Page 57 of 64
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
1D40 45490900 CFB DFB "EI",TAB,RS ; FB
1D44 434D0900 CFC DFB "CM",TAB,RS ; FC
1D48 4446420900CFD DFB "DFB",TAB,RS ; FD
1D4D 4350490900CFE DFB "CPI",TAB,RS ; FE
1D52 5253540937CFF DFB "RST",TAB,"7",RS, ; FF
1D58 0D0A0A4D54prompt1: dfb cr,lf,lf,"MTK-85 8085 MICROPROCESSOR TRAINING KIT (?
HELP
1D8E 3F065B4F66convert dfb 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h
,
1D9E 0000000000off_display: dfb 0,0,0,0,0,0
; lcd message |--- 20 letters ---|
1DA4 4D544B2D38prompt2: dfb "MTK-85 8085 MICROPRO",0
1DB9 434553534Ftext3: dfb "CESSOR TRAINING KIT",0
1DCD 6C6F616420download_text: dfb "load Intel hex file...",0
1DE4 3E00 prompt_text: dfb ">",0
1DE6 6E6577206Cnew_text: dfb "new location = ",0
1DF6 6564697420edit_text: dfb "edit memory location = ",0
1E0E 0D0A456E74edit_text1: dfb cr,lf,"Enter to quit, SPACE key to view content",0
1E39 0D0A0A4144edit_text2: dfb cr,lf,lf,"ADDR DATA",0
1E47 6A756D7020jump_text1: dfb "jump to address [",0
1E59 5D203D2000jump_text2: dfb "] = ",0
1E5E 7072696E74ascii_text: dfb "print ASCII code",0
1E6F 426567696Efill_text1: dfb "Begin address = ",0
1E80 20456E6420fill_text2: dfb " End address = ",0
1E90 2044617461fill_text3: dfb " Data = ",0
1E99 206572726Ferror_text: dfb " errors",0
1EA1 6469736173disassemble_text: dfb "disassemble...",0
0000 = eos equ 0
1EB0 41463D00 af_text: dfb "AF=",eos
1EB4 42433D00 bc_text: dfb "BC=",eos
1EB8 44453D00 de_text: dfb "DE=",eos
1EBC 484C3D00 hl_text: dfb "HL=",eos
1EC0 53503D00 sp_text: dfb "SP=",eos
1EC4 544F533D00tos_text: dfb "TOS=",eos
1EC9 50433D00 pc_text: dfb "PC=",eos
1ECD 5B53205A20flag_text: dfb "[S Z - AC - P - CY]=",eos
1EE3 533D00 sign_text: dfb "S=",0
1EE6 2062797465byte_text: dfb " bytes loaded",0
1EF4 535441434Bstack_text: dfb "STACK Memory Contents..",0
1F0C 7365742076set_register_text: dfb "set value to user register (enter A for AF) ? ",
0
1F3B 0D0A0A4D54help_text: dfb cr,lf,lf,"MTK-85 8085 MICROPROCESSOR TRAINING KIT (?
HELP
1F6E 0D0A41202Dhelp_text1: dfb cr,lf, "A - ASCII code"
1F7E 0D0A43202D dfb cr,lf, "C - clear watch variables"
1F99 0D0A44202D dfb cr,lf, "D - disassemble"
1FAA 0D0A45202D dfb cr,lf, "E - edit memory"
1FBB 0D0A46202D dfb cr,lf, "F - fill constant"
1FCE 0D0A48202D dfb cr,lf, "H - hex dump"
1FDC 0D0A49202D dfb cr,lf, "I - i/o address map"
1FF1 0D0A4A202D dfb cr,lf, "J - jump to user program"
200B 0D0A4B202D dfb cr,lf, "K - display user STACK"
2023 0D0A4C202D dfb cr,lf, "L - load Intel hex file"
203C 0D0A4D202D dfb cr,lf, "M - monitor call number"
2055 0D0A4E202D dfb cr,lf, "N - new location pointer"
206F 0D0A51202D dfb cr,lf, "Q - quick home location"
2088 0D0A52202D dfb cr,lf, "R - user register display"
20A3 0D0A53202D dfb cr,lf, "S - set value to user register"
20C3 0D0A57202D dfb cr,lf, "W - watch variables"
B8085.LST 29/12/2559 12:32
Page 58 of 64
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
20D8 0D0A535041 dfb cr,lf, "SPACE BAR - single step"
20F1 0D0A3F202D dfb cr,lf, "? - help menu",cr,lf,0
2103 0D0A303048io_text dfb cr,lf,"00H-0FH onboard 4-bit GPIO, D0-D3=output port"
2132 0D0A202020 dfb cr,lf," D4-D7=input port"
214C 0D0A dfb cr,lf
214E 0D0A313048 dfb cr,lf,"10H-13H 8255 system PPI, 10H=PORTA, 11H=PORTB, 12
H
2195 0D0A dfb cr,lf
2197 0D0A323048 dfb cr,lf,"20H-23H 8254 programmable counter, 20H=counter0,
21
21D7 0D0A202020 dfb cr,lf," 22H=counter2, 23H control register"
2203 0D0A dfb cr,lf
2205 0D0A333048 dfb cr,lf,"30H-33H 8255 user PPI, 30H=PORTA, 31H=PORTB, 32H=
PORTC
224A 0D0A dfb cr,lf
224C 0D0A343048 dfb cr,lf,"40H-47H C16550 UART registers",0
226C monitor_text:
226C 7365652069 dfb "see input parameters in user manual",cr,lf
2291 0D0A31456E dfb cr,lf,"1Enn MVI E,function_number"
22AD 0D0A434620 dfb cr,lf,"CF RST 1"
22B9 0D0A dfb cr,lf
22BB 0D0A303020 dfb cr,lf,"00 - demo" ; #0 running LED with HL pointer
22C6 0D0A303120 dfb cr,lf,"01 - delay" ; #1 simple delay routine
22D2 0D0A303220 dfb cr,lf,"02 - cold_boot" ; #2 show 8085 running
22E2 0D0A303320 dfb cr,lf,"03 - scan" ; #3 scan display one cycle
22ED 0D0A303420 dfb cr,lf,"04 - cin" ; #4 get byte from console
22F7 0D0A303520 dfb cr,lf,"05 - cout" ; #5 print byte to console
2302 0D0A303620 dfb cr,lf,"06 - put_str" ; #6 print string with 0
terminator
2310 0D0A303720 dfb cr,lf,"07 - init_lcd" ; #7 initialize lcd
231F 0D0A303820 dfb cr,lf,"08 - lcd_ready" ; #8 wait until lcd is ready
232F 0D0A303920 dfb cr,lf,"09 - clear_lcd" ; #9 clear lcd display
233F 0D0A304120 dfb cr,lf,"0A - goto_xy" ; #10 set lcd cursor position
234D 0D0A304220 dfb cr,lf,"0B - put_str_lcd" ; #11 print ASCII string on
lcd
235F 0D0A304320 dfb cr,lf,"0C - put_ch_lcd" ; #12 print ASCII letter on
lcd
2370 0D0A304420 dfb cr,lf,"0D - demo2",0 ; #13 run GPIO LED
237D 0D0A304520 dfb cr,lf,"0E - pint16u",0 ;#14 print 16-bit unsigned
; data segment
F000 org system_ram
F000 watch_ram dfs 16 ; watch variable F000-F00F
F010 buffer dfs 16 ; buffer display
F020 bcs dfs 1 ; byte checksum
F021 key dfs 1 ; key position
F022 command dfs 1 ; serial command
F023 flag1 dfs 1 ; user flag
; flag1.0 Space key was pressed
; flag1.1 Enter key was pressed
F024 beep_flag dfs 1 ; beep/no beep
F025 uart_found dfs 1 ; 0 = no uart, 1 uart found
F026 entry_mode dfs 1 ; 0 for data mode
; 1 for address mode
; 2 register display
F027 counter1 dfs 1 ; event counter1 for data entry
F028 counter2 dfs 1 ; event counter2 for address entry
F029 warm_code dfs 1 ; warm boot code
F02A user_PC dfs 2 ; user PC
F02C user_AF dfs 2 ; user AF
F02E user_BC dfs 2 ; user BC
F030 user_DE dfs 2 ; user DE
F032 user_HL dfs 2 ; user HL
F034 user_SP dfs 2 ; user SP
F036 tos dfs 2 ; Top of STACK
F038 current_register dfs 2 ; stores current displayed register
F03A temp dfs 2 ; temporary 16-bit storage
F03C pointer dfs 2 ; for hex dump
B8085.LST 29/12/2559 12:32
Page 59 of 64
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
4501
F03E break_address dfs 2 ; break address
F040 break_opcode dfs 1 ; opcode that saved
F041 bcd_counter1 dfs 3 ; 6-digit BCD counter1
F044 bcd_counter2 dfs 3 ; 6-digit BCD counter2
F047 line_buffer dfs 16 ; reserved for terminal printing
F057 save_stack dfs 2 ; for saving system stack
F059 system_stack dfs 32
F079 user_stack dfs 32
0000 END
B8085.LST 29/12/2559 12:32
Page 60 of 64
4501
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
1075 AC_TEXT 0A01 ADDRESS_MODE 1EB0 AF_TEXT
1266 ALT_PUT_STR 13C7 ASCII_0_9 0D72 ASCII_PRINT
0D8A ASCII_PRINT1 1E5E ASCII_TEXT F041 BCD_COUNTER1
F044 BCD_COUNTER2 F020 BCS 1EB4 BC_TEXT
096F BEEP_CHK F024 BEEP_FLAG 0640 BEEP_ON
019B BIN1 01A6 BIN2 0199 BIN2ASCII
01B0 BIN3 01BB BIN4 08CA BREAK
F03E BREAK_ADDRESS F040 BREAK_OPCODE F010 BUFFER
0080 BUSY 0631 BUZZER 0642 BUZZER1
1EE6 BYTE_TEXT 170B C0 1710 C1
176C C10 1771 C11 1778 C12
177F C13 1785 C14 178B C15
1791 C16 1798 C17 179D C18
17A2 C19 17A8 C1A 17AF C1B
17B5 C1C 17BB C1D 17C1 C1E
17C8 C1F 1717 C2 17CD C20
17D2 C21 17D9 C22 17DF C23
17E5 C24 17EB C25 17F1 C26
17F8 C27 17FD C28 1802 C29
1808 C2A 180E C2B 1814 C2C
181A C2D 1820 C2E 1827 C2F
171E C3 182C C30 1831 C31
1839 C32 183E C33 1845 C34
184B C35 1851 C36 1858 C37
185D C38 1862 C39 1869 C3A
186E C3B 1875 C3C 187B C3D
1881 C3E 1888 C3F 1724 C4
188D C40 1895 C41 189D C42
18A5 C43 18AD C44 18B5 C45
18BD C46 18C5 C47 18CD C48
18D5 C49 18DD C4A 18E5 C4B
18ED C4C 18F5 C4D 18FD C4E
1905 C4F 172A C5 190D C50
1915 C51 191D C52 1925 C53
192D C54 1935 C55 193D C56
1945 C57 194D C58 1955 C59
195D C5A 1965 C5B 196D C5C
1975 C5D 197D C5E 1985 C5F
1730 C6 198D C60 1995 C61
199D C62 19A5 C63 19AD C64
19B5 C65 19BD C66 19C5 C67
19CD C68 19D5 C69 19DD C6A
19E5 C6B 19ED C6C 19F5 C6D
19FD C6E 1A05 C6F 1737 C7
1A0D C70 1A15 C71 1A1D C72
1A25 C73 1A2D C74 1A35 C75
1A3D C76 1A42 C77 1A4A C78
1A52 C79 1A5A C7A 1A62 C7B
1A6A C7C 1A72 C7D 1A7A C7E
1A82 C7F 173C C8 1A8A C80
1A90 C81 1A96 C82 1A9C C83
1AA2 C84 1AA8 C85 1AAE C86
1AB4 C87 1ABA C88 1AC0 C89
1AC6 C8A 1ACC C8B 1AD2 C8C
1AD8 C8D 1ADE C8E 1AE4 C8F
1741 C9 1AEA C90 1AF0 C91
1AF6 C92 1AFC C93 1B02 C94
1B08 C95 1B0E C96 1B14 C97
1B1A C98 1B20 C99 1B26 C9A
1B2C C9B 1B32 C9C 1B38 C9D
1B3E C9E 1B44 C9F 1747 CA
1B4A CA0 1B50 CA1 1B56 CA2
1B5C CA3 1B62 CA4 1B68 CA5
1B6E CA6 1B74 CA7 1B7A CA8
1B80 CA9 1B86 CAA 1B8C CAB
1B92 CAC 1B98 CAD 1B9E CAE
1BA4 CAF 174E CB 1BAA CB0
1BB0 CB1 1BB6 CB2 1BBC CB3
1BC2 CB4 1BC8 CB5 1BCE CB6
1BD4 CB7 1BDA CB8 1BE0 CB9
1BE6 CBA 1BEC CBB 1BF2 CBC
1BF8 CBD 1BFE CBE 1C04 CBF
1754 CC 1C0A CC0 1C0F CC1
1C15 CC2 1C1A CC3 1C1F CC4
1C24 CC5 1C2B CC6 1C30 CC7
B8085.LST 29/12/2559 12:32
Page 61 of 64
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
1C36 CC8 1C3A CC9 1C3F CCA
1C43 CCB 1C48 CCC 1C4C CCD
1C52 CCE 1C57 CCF 175A CD
1C5D CD0 1C62 CD1 1C68 CD2
1C6D CD3 1C72 CD4 1C77 CD5
1C7E CD6 1C83 CD7 1C89 CD8
1C8D CD9 1C92 CDA 1C96 CDB
1C9A CDC 1C9E CDD 1CA3 CDE
1CA8 CDF 1760 CE 1CAE CE0
1CB3 CE1 1CB9 CE2 1CBE CE3
1CC4 CE4 1CC9 CE5 1CD0 CE6
1CD5 CE7 1CDB CE8 1CE0 CE9
1CE6 CEA 1CEB CEB 1CF1 CEC
1CF6 CED 1CFB CEE 1D00 CEF
1767 CF 1D06 CF0 1D0A CF1
1D12 CF2 1D16 CF3 1D1A CF4
1D1E CF5 1D27 CF6 1D2C CF7
1D32 CF8 1D36 CF9 1D3C CFA
1D40 CFB 1D44 CFC 1D48 CFD
1D4D CFE 1D52 CFF 123B CIN
0EE3 CLEAR1 14D5 CLEAR_BCD1 14FE CLEAR_BCD2
0904 CLEAR_BREAK 0200 CLEAR_LCD 0ED6 CLEAR_WATCH
0BB3 CODE1 0BFB CODE10 0C03 CODE11
0C0B CODE12 0C13 CODE13 0C1B CODE14
0C23 CODE15 0C2B CODE16 0C33 CODE17
0C3B CODE18 0C43 CODE19 0BBB CODE2
0C4B CODE20 0C53 CODE21 0C5B CODE22
0C63 CODE23 0C6B CODE24 0C73 CODE25
0C7B CODE26 0BC3 CODE3 0BCB CODE4
0BD3 CODE5 0BDB CODE6 0BE3 CODE7
0BEB CODE8 0BF3 CODE9 0B7D COLD1
0B7B COLD2 0B8C COLD3 0B76 COLD_BOOT
F022 COMMAND 0052 COMMAND_READ 0050 COMMAND_WRITE
0023 CONTROL_8254 0034 CONTROL_WORD_8254 1D8E CONVERT
0020 COUNTER0_8254 F027 COUNTER1 0021 COUNTER1_8254
F028 COUNTER2 0022 COUNTER2_8254 122F COUT
1230 COUT1 000D CR F038 CURRENT_REGISTER
107C CY_TEXT 0609 DATA_KEY 0614 DATA_KEY1
061C DATA_KEY2 0624 DATA_KEY3 062C DATA_KEY4
0A0E DATA_MODE 0053 DATA_READ 145B DATA_RECORD
0051 DATA_WRITE 0CA7 DEBOUNCE 0CA9 DEBOUNCE1
0995 DEBUG 0A78 DECREMENT 0600 DELAY
063B DELAY_NOBEEP 0659 DELAY_US 065B DELAY_US1
094A DELETE_BYTE 0959 DELETE_BYTE1 0BA0 DEMO
0BA2 DEMO1_2 1EB8 DE_TEXT 0326 DIS2
0390 DISASSEM1 039F DISASSEM2 034E DISASSEM3
033A DISASSEMBLE 0313 DISASSEMBLE1 1EA1 DISASSEMBLE_TEXT
0660 DISPLAY_OFF 0D50 DOWNLOAD 1DCD DOWNLOAD_TEXT
1359 DUMP1 1351 DUMP_MEMORY 0406 D_DISASSEM1
0415 D_DISASSEM2 03C4 D_DISASSEM3 03B0 D_DISASSEMBLE
03DC D_ONE_TAB 114C EDIT1 1127 EDIT_LOCATION
1DF6 EDIT_TEXT 1E0E EDIT_TEXT1 1E39 EDIT_TEXT2
0709 ENTER_ADDRESS 06CF ENTER_DATA 06F4 ENTER_DATA1
066F ENTER_REGISTER F026 ENTRY_MODE 0000 EOS
1E99 ERROR_TEXT 001B ESC 145A ESC_QUIT
0DA3 EXIT_ASCII_PRINT 0207 EXIT_CLEAR 0EF0 EXIT_CLEAR_WATCH
0339 EXIT_DISASSEMBLE 0D71 EXIT_DOWNLOAD 11A9 EXIT_EDIT
119A EXIT_EDIT1 10C3 EXIT_FILL 13F1 EXIT_GET_HEX2
13FA EXIT_GET_HEX3 1205 EXIT_HELP 1350 EXIT_HEX_DUMP
11ED EXIT_IO 1126 EXIT_JUMP 10DC EXIT_MONITOR
11C6 EXIT_NEW_LOCATION 0D4F EXIT_PROMPTING 11DB EXIT_QUICK_HOME
1071 EXIT_REGISTER 0EB8 EXIT_SET_USER 0F4B EXIT_STACK
0F0B EXIT_STEP 0EFF EXIT_WATCH 1080 FILL_MEMORY
10B2 FILL_MEMORY1 1E6F FILL_TEXT1 1E80 FILL_TEXT2
1E90 FILL_TEXT3 F023 FLAG1 1ECD FLAG_TEXT
1229 FOUND 0598 FUNCTION1 05A3 FUNCTION2
05AE FUNCTION3 05B9 FUNCTION4 05C5 FUNCTION5
05D0 FUNCTION6 05DB FUNCTION7 05E6 FUNCTION8
05F1 FUNCTION9 0A19 FUNCTION_2ND 058D FUNCTION_KEY
13D2 GET_2ND_HEX 1245 GET_COMMAND 1372 GET_HEX
1385 GET_HEX1 139E GET_HEX2 0BAB GET_KEY_CODE
0426 GET_NUMBER_OF_BYTE 1403 GET_RECORD 099B GO
022A GOTO_XY 0239 GOTO_XY1 0244 GOTO_XY2
024F GOTO_XY3 025A GOTO_XY4 0000 GPIO
11EE HELP 1F3B HELP_TEXT 1F6E HELP_TEXT1
12F1 HEX_DUMP 1312 HEX_DUMP1 12FE HEX_DUMP2
B8085.LST 29/12/2559 12:32
Page 62 of 64
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
1338 HEX_DUMP3 133A HEX_DUMP4 132D HEX_DUMP5
1EBC HL_TEXT 0981 HOME 8100 HOME_ADDRESS
0A65 INCREMENT 1489 INC_BCD1 14A1 INC_BCD2
018F INIT_8254 0208 INIT_LCD 1206 INIT_UART
091F INSERT_BYTE 0932 INSERT_BYTE1 150B INS_TABLE
11DC IO_ADDRESS 2103 IO_TEXT 0705 IT_IS_RAM
1E47 JUMP_TEXT1 1E59 JUMP_TEXT2 10DD JUMP_TO_USER_PGM
F021 KEY 0581 KEY_EXECUTE 01F6 LCD_READY
01F7 LCD_READY1 000A LF F047 LINE_BUFFER
0186 MAIN 170B MNEM 0B3D MODE1
0B74 MODE2 0B02 MODE_INDICATOR 0A3D MODIFY_REGISTER
0261 MONITOR_CALL 10C4 MONITOR_FUNCTION 226C MONITOR_TEXT
8000 MY_ROM 12DA NEW_LINE 11AA NEW_LOCATION
1DE6 NEW_TEXT 0CDB NEXT_KEY 1252 NO_DATA
042E NUMBER1 0476 NUMBER10 047E NUMBER11
0486 NUMBER12 048E NUMBER13 0496 NUMBER14
049E NUMBER15 04A6 NUMBER16 04AE NUMBER17
04B6 NUMBER18 04BE NUMBER19 0436 NUMBER2
04C6 NUMBER20 04CE NUMBER21 04D6 NUMBER22
04DE NUMBER23 04E6 NUMBER24 04EE NUMBER25
04F6 NUMBER26 04FE NUMBER27 0506 NUMBER28
050E NUMBER29 043E NUMBER3 0516 NUMBER30
051E NUMBER31 0526 NUMBER32 052E NUMBER33
0536 NUMBER34 053E NUMBER35 0546 NUMBER36
054E NUMBER37 0556 NUMBER38 055E NUMBER39
0446 NUMBER4 0566 NUMBER40 056E NUMBER41
0576 NUMBER42 057E NUMBER43 044E NUMBER5
0456 NUMBER6 045E NUMBER7 0466 NUMBER8
046E NUMBER9 1D9E OFF_DISPLAY 0663 OFF_DISPLAY1
13E9 OK_0_9 0366 ONE_TAB 097D OPTION1
12BA OUT1X 12C6 OUT1X1 12CB OUT2X
1EC9 PC_TEXT 01E4 PINT1 01EF PINT2
01C9 PINT8U F03C POINTER 14B9 PRINT_BCD1
14E2 PRINT_BCD2 0EF1 PRINT_WATCH 0EB9 PRINT_WATCH_RAM
1D58 PROMPT1 1DA4 PROMPT2 126F PROMPT3
0D32 PROMPTING 1DE4 PROMPT_TEXT 025B PUT_CH_LCD
07ED PUT_FLAG 07F5 PUT_HIGH1 0876 PUT_HIGH2
1258 PUT_STR 125F PUT_STR1 12A5 PUT_STR2
021A PUT_STR_LCD 0221 PUT_STR_LCD1 1079 P_TEXT
11C7 QUICK_HOME 0ABE READ_MEMORY 0A93 READ_REGISTER
0761 REGISTER1 08A4 REGISTER10 077D REGISTER2
0799 REGISTER3 07B5 REGISTER4 07D1 REGISTER5
07F8 REGISTER6 0820 REGISTER7 084B REGISTER8
087C REGISTER9 0F4C REGISTER_DISPLAY 0F54 REGISTER_DISPLAY1
0F57 REGISTER_DISPLAY2 0FE9 REGISTER_FLAG1 106A REGISTER_FLAG10
0FEE REGISTER_FLAG2 1008 REGISTER_FLAG3 100D REGISTER_FLAG4
1027 REGISTER_FLAG5 102C REGISTER_FLAG6 1046 REGISTER_FLAG7
104B REGISTER_FLAG8 1065 REGISTER_FLAG9 0000 ROM
0000 RS F057 SAVE_STACK 0CAE SCAN
0CBC SCAN1 0C7E SCAN_KEY 0C95 SCAN_KEY1
0C8F SCAN_KEY2 0C8F SCAN_KEY3 0C7E SCAN_KEY4
0743 SELECT_REGISTER 0D3A SEND_PROMPT 12AC SEND_PROMPT1
12B3 SEND_PROMPT3 12EB SEND_TAB 0CED SERIAL_COMMAND
02B8 SERVICE_RST2 0293 SERVICE_RST7 02DD SERVICE_TRAP
1F0C SET_REGISTER_TEXT 0DE0 SET_USER1 0E0B SET_USER2
0E36 SET_USER3 0E61 SET_USER4 0E8C SET_USER5
0EB7 SET_USER6 0DA4 SET_USER_REGISTER 071F SHIFT_ADDRESS
06E2 SHIFT_DATA 0CD1 SHIFT_KEY 067A SHIFT_REGISTER
1EE3 SIGN_TEXT 09BF SINGLE_STEP 0F00 SINGLE_STEP_
030E SKIP1 09DF SKIP2 0141 SKIP_BOOT
0164 SKIP_COLD_BOOT 118A SKIP_EDIT1 1193 SKIP_EDIT2
147D SKIP_ERROR 1117 SKIP_LOAD_PC 07F7 SKIP_PUT_HIGH1
0878 SKIP_PUT_HIGH2 017B SKIP_SEND_PROMPT 0D31 SKIP_SERIAL
0020 SP 12E5 SPACE 1EC0 SP_TEXT
0F0C STACK_DISPLAY 0F20 STACK_DISPLAY1 1EF4 STACK_TEXT
0100 START 0010 SYSTEM_PORT_A 0011 SYSTEM_PORT_B
0012 SYSTEM_PORT_C 0013 SYSTEM_PORT_CONTROL F000 SYSTEM_RAM
F059 SYSTEM_STACK 0009 TAB F03A TEMP
062D TEST_BUZZER 05F2 TEST_LED 05F4 TEST_LED1
1DB9 TEXT3 0B94 TITLE F036 TOS
1EC4 TOS_TEXT 1366 TO_HEX 0A88 TO_SEVEN_SEGMENT
0040 UART_BUFFER 0040 UART_DIVISOR_LSB 0041 UART_DIVISOR_MSB
0042 UART_FIFO F025 UART_FOUND 0043 UART_LCR
0045 UART_LINE_STATUS 0047 UART_SCR F02C USER_AF
F02E USER_BC F030 USER_DE F032 USER_HL
F02A USER_PC 0030 USER_PORT_A 0031 USER_PORT_B
B8085.LST 29/12/2559 12:32
Page 63 of 64
4728
4729
4730
4731
4732
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
4733
0032 USER_PORT_C 0033 USER_PORT_CONTROL F034 USER_SP
F079 USER_STACK 0275 VECTOR_TABLE 0CC6 WAIT1
1436 WAIT_CR F029 WARM_CODE 0EC9 WATCH1
F000 WATCH_RAM 1371 ZERO_NINE 1072 ZERO_TEXT
B8085.LST 29/12/2559 12:32
Page 64 of 64

Navigation menu