8085 PDF
8085 PDF
1
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CONTENTS
Sl.No
CHAPTER
INTRODUCTION
1.
Page .No
4
1.1
8085 Microprocessor
1.2
8085 Overview
1.3
1.4
VIK-85L Specifications
2.0
SYSTEM DESCRIPTION
10
2.1
Hardware
10
2.2
Port Details
11
2.3
12
2.4
Keyboard Details
13
3.0
14
3.1
Reset
14
3.2
H (Help Menu)
14
4.0
OPERATING INSTRUCTIONS
15
4.1
Power On
15
4.2
Keyboard Operation
15
4.3
16
4.4
Assembler
16
4.5
Disassembler
19
4.6
20
2
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
4.7
G (Go Command)
24
4.8
R (Register Display/Modify)
25
4.9
T (Transfer Command)
27
4.10
B (Baud Rate)
28
4.11
29
4.12
30
5.0
31
5.1
Serial Port
31
5.2
Software Package
31
6.0
32
6.1
Download
35
6.2
Upload
37
7.0
PROGRAMMING DETAILS
38
7.1
Registers
38
7.2
Monitor Program
38
7.3
Breakpoint
39
APPENDIX I
40
APPENDIX II
42
50
SCHEMATIC DIAGRAM
3
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 1
INTRODUCTION
1.1 8085 MICROPROCESSOR:
MICROPROCESSOR offers more advantages than conventional
discrete hardwired logic circuits. The major advantage is its programmability
to adapt to different environment and in addition it reduces the PCB space.
These ICs are also cost effective and could be used for any applications
ranging from Electronic toys to Programmable Logic Controllers (PLC) to
text or data processing equipment.
At present 8 bit Microprocessors are used in low end Video terminals,
PLCs etc. earlier these were used in CP/M computers.16 bit Microprocessors
are more popular at present and these are used in IBM PC computers.
The 8085 Microprocessor is the updated version of 8 bit
Microprocessor 8080A and the main advantage is that it can be operated
using single 5 volts supply. In addition it has more interrupt facilities and
serial input/output facility.
4
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Register (Accumulator)
Flag Register
5
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Trap
07
06
05
04
03
02
01
00
AC
--
Sign bit
--
Zero flag
AC --
--
Parity bit
--
Carry bit
--
Undefined
7
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
LCD
26 PIN CONNECTOR
BOTTOM
26 PIN CONNECTOR
TOP
8
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
9
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 2
SYSTEM DESCRIPTION
2.1 HARDWARE:
VIK-85L Microprocessor board designed around 8085 is ideal for
learning Microprocessors and peripherals.
The Microprocessor operates at 6.144 MHz using a 6.144 MHz crystal.
Lower bytes of address and data are multiplexed as in 8085 and hence a
decoder is necessary separate address and data. IC 74LS373 is used for this
purpose.
Firmware is stored in 27C128 EPROM. User data/programs can be
stored in 32KB CMOS static RAM (type 62256). Memory and I/O address
decoding signals are generated using simple 3 to 8 decoder 74139 and 7432
OR gates.
On board uses two 8255 ICs enhances the capabilities of the VIK-85L
kit. All the 48 I/O lines are brought to two 26-pin FRC connectors.
VIK-85L has onboard serial port; USART 8251A is used for this
purpose. MAX232 IC converts TTL transmit and receive signals to RS232C
levels. These signals are brought to 9 pin D type connector. This RS232
connector may be used for communicating with remote PC computer. Baud
rate of serial communication may be changed from 150 to 9600 baud.
10
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
of
8255
port
pins.
Communication
between
keyboard
and
Microprocessor takes place using 2 wires- one for serial clock and serial
data.
2 Line by 16 Character LCD display is directly connected to the bus
like a memory device. VIK-85L board is connected to the external power
supply using 9 pin D type connector.
2.2 PORT DETAILS:
DEVICE
ADDRESS
0000 3FFF
20 23
30 33
10 13
00 01
40 command
41 data
User RAM
8000 8FFF
A000 -- FFFF
(9000-9FFF reserved for
Monitor program)
EPROM
8255-1
8255-2
8253/8254
8251
LCD
11
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
VIK-85L trainer kit will work at 0 - 5v (1amp) from the power supply.
For your extra provision power supply have some dc Regulated voltage
outputs.
+5v
1Amp
+12v
250mA
-12v
250mA
12
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
13
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 3
COMMANDS AND KEYS
To enter the commands and data 101 keyboard is provided along with
the board.
3.1 RESET:
This key is located in the main 85L board. On depressing this key the
program starts executing from the beginning or reset address 0000. On power
on reset it. Display VIK - 85 in local LCD display.
VIK 85
A <BEG>
B
D <BEG>
E<BEG><END>
G<BEG>
H
L<OFFSET>
M<ADDR>
N
Q
R<REG>
S
T<START><END><DS>
U<BEG><END>
-ASSEMBLE
-BAUD RATE
-DISASSEMBLE
-EXAMINE
-EXECUTE
-HELP COMMANDS
-DOWN LODE
-MODIFY
-NORMAL MODE
-QUIT
-REGISTER DISPLAY
-SERIAL MODE
-BLOCK TRANSFER
-UP LOAD
14
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 4
OPERATING INSTRUCTIONS
4.1 POWER ON:
Connect the VIK-85L board to the power supply having the following
specifications.
+5V DC
1 Amp.
16
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
(Enter key =
On typing this line VIK-85L is ready to store the user program from
start address 9000.
Display the following and waits for the user data to be typed in the
second line.
9000:
-
ENTERING MNEMONICS:
As mentioned before, each instruction of Microprocessor can be
entered by specific set of characters- generally 2/3/4 letters followed by
respective operands.
List of instructions and mnemonics are given in the Appendix A.
17
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
20
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
21
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Display In LCD
VIK - 85
-
VIK - 85
-M8
VIK - 85
-M84
VIK - 85
-M840
VIK - 85
-M8400
Enter
8400:
55 (previous data)
8400:
55 A
8400:
55 A3
Space bar
8401:
99 (previous data)
UP
8402:
66 (previous data)
UP
8403:
78 (previous data)
22
8404:
9A (previous data)
DOWN
8403:
78
ENTER
VIK-85
-
M8400
23
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
8401-2322
8402-3533
8403-4544
Display In LCD
VIK - 85
-
VIK - 85
-G8
VIK - 85
-G85
VIK 85
-G850
VIK - 85
-G8500
Enter
Entering Space bar key increments register number and its data is
displayed once again. Thus it is possible to display and modify all the sixteen
registers. Termination of this command is by Enter key.
Example 1:
Key
Display
R
A
Enter
-R
-RA
A = 12 (previous data)
25
3
4
Space bar
Enter
A = 12 3
A = 12 34
B = 89 (previous data)
VIK-85
-
After typing the R the user has a choice to display all registers by
depressing Enter key.
Example 2:
R (Enter key)
L=89
PC=8902
B=67
SP=9FF0
C=11
PSW=01
D=22
E=34
H=56
B=67 66
(Enter key)
26
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
L=89
PC=8902
B=66
SP=9FF0
C=11
PSW=01
D=22
E=34
H=56
9000
90FF
9800
28
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
VIK-85L board data format is one start bit, 8 data bit (ASCII) and one
stop bit.
If serial communication is established the sign on message VIK-85
appears on the PC screen with prompt character in the next line indicating
the system is ready to accept commands from the user. Each command has to
be terminated by the Enter key of the PC and parameters are separated by
space key.
All the Commands, in the Local mode, can also be applied
in the serial mode. In addition serial mode has one more
command called E (Examine memory).
29
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
NORMAL MODE
30
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 5
TERMINAL EMULATION SOFTWARE
5.1 SERIAL PORT:
VIK-85L Microprocessor Trainer may be interfaced to a Personal
Computer using any PC terminal emulation software. Interface between
VIK-85L and PC is through RS232 connector.
31
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 6
REMOTE OPERATION OF VIK-85L
Any IBM PC compatible PC or video terminal may be used for
communicating with VIK-85L via serial interface connector.
TCSERIAL software converts the PC to act as a video terminal. To
run this software type
TCSERIAL followed by Enter key in the PC.
Then display the following message
32
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
May enter the COM port no and the baud rate as a command line arguments
Example:
D:\8086>TCSERIAL 1 6 [enter]
-1
300 BR
-2
600 BR
-3
33
! SERIAL MODE
34
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
If you want to download any hex file from pc type the following
command
In serial mode local operation of the kit is inhibited except for reset key
and N.
To exit from this mode and to return to DOS mode, depress Esc
key
35
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Depress S in the local keyboard of trainer kit. The kit displays the
following message.
!
SERIAL MODE
36
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
The user may key in the OFFSET address, which stores the data at
Offset plus received address. If Offset address is zero, the storing address is
same as that of received address.
Termination for the offset address is Enter key. Now the kit is ready to
accept the data from PC.
Example:
L<0200>
Enter the file name =
a hex file in PC. This hex code may be transferred to VIK-85L kit using the
download facility as explained above.
37
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
38
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CHAPTER 7
PROGRAMMING DETAILS
This chapter describes the technique for development programs in
VIK-85L board. For the development of programs it is essential to get
familiar with the machine code of 8085 Microprocessor or mnemonics of
instruction set.
7.1 REGISTERS:
From the programmers point of view 8085 has the following registers:
0000-3FFF
8000-8FFF
A000-FFFF
39
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
When Break point is encountered, all the register values are saved and
A=xx message is displayed in the LCD display. Now use Space bar key to
check register values one by one.
BREAK POINT DISPLAY IN SERIAL MODE:
When Break point is encountered, all the register values are saved and
all the Register contents are displayed in the console.
40
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
ICs:
U1
----------- 8085
U2
----------- 74LS373
U3
----------- 27C128
U4
----------- 62256
U5
----------- 7402
U6
----------- 74139
U7
----------- 74138
U8
----------- 8255
U9
----------- 8255
------------
0.1MF
C14
------------
1MF/25V
C15
------------
22MF/25V
C16
------------
22MF/25V
C17
------------
22MF/25V
C18
------------
22MF/25V
41
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
L2
RESISTORS:
R1
---------------
10K
R2
---------------
10K
R3
---------------
1K
R4
---------------
1K
R5
---------------
1K
R6
---------------
1K(Variable Resister)
R7
---------------
1K
R8
---------------
1K
R9
---------------
10K
1K
R15
---------------
330
D1
---------------
1N4148
X1
---------------
6.144MHz
42
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Signal Details
A0
CS5
A1
CS3
A2
CS4
A3
CS6
A4
10
GND
11
A5
12
GND
13
A6
14
AD8
15
A7
16
AD9
17
HOLD
18
AD10
19
CS12
20
AD11
43
Signal Details
21
CS13
22
AD12
23
RST 5 . 5
24
AD13
25
RST6.5
26
AD14
27
RST 7.5
28
AD15
29
TRAP
30
PSENNC
31
SOD
32
ALE
33
SID
34
AD7
35
CS14
36
AD6
37
NC
38
AD5
39
HLDA
40
AD4
41
INTA
42
AD3
43
INTR
44
Signal Details
44
AD2
45
WR
46
AD1
47
RD
48
AD0
49
CLK
50
RESET
PC3
PB0
PC2
PB1
PC1
PB2
PC0
PB3
PC4
10
PB4
11
PC5
12
PB5
13
PC6
14
PB6
15
PC7
45
Signal Details
16
PB7
17
RESET
18
GND
19
PA0
20
PA7
21
PA1
22
PA6
23
PA2
24
PA5
25
PA3
26
PA4
PC3
PB0
PC2
PB1
PC1
PB2
PC0
PB3
PC4
10
PB4
46
Pin Nos
Signal Details
11
PC5
12
PB5
13
PC6
14
PB6
15
PC7
16
PB7
17
RESET
18
GND
19
PA0
20
PA7
21
PA1
22
PA6
23
PA2
24
PA5
25
PA3
26
PA4
47
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
CONTRAST
R\D
W\D
LCD CE
D0
D1
D2
D3
D4
R\D
D5
D6
D7
BACK LIGHT
48
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Signal Details
+5V
P2
NC
1
6
2
7
3
8
4
9
5
NC
GND
NC
GND
NC
NC
NC
CONNECTOR DB9
P2
1
6
2
7
3
8
4
9
5
RXD
CTS
TXD
NC
NC
NC
GND
CONNECTOR DB9
49
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
50
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
NO
Is the
YES
Multiplier is
zero?
Transfer zero in result register
Initialize the content of a temporary register to zero
NO
Is the
Multiplier is
zero?
YES
Transfer the temp.reg value to result register
EXIT
51
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START:
:
Multiplicand in 8500
Multiplier in 8501
:
Result is stored at 8502
Result is also in Acc .If the result exceeds FF the carry
flag will set.
3A 00 85
LDA 8500
8103
8104
8107
47
3A 01 85
4F
MOV B,A
LDA 8501
MOV C,A
8108
FE 00
CPI 00
810A
810D
CA 16 81
AF
JZ 8116
XRA A
810E
810f
8110
8113
8116
8119
80
OD
CA 16 81
C3 0E 81
32 02 85
CF
ADD B
DCR C
JZ 8116
JMP 810E
STA 8502
RST 1
Comments
; Mov the multiplicand (X1)
; to Acc. And also to B reg
; Mov the multiplier (x1) in to
; C reg
; If X2=0 then result is 0 and
; exit
; Exit addr=8116
; Clear acc and flags add the
; X1 as many time as the X2
; Decrement x2
; Store the result and exit
; Multiply start addr=810E
; Store the content of acc
; Break point
EX:
INPUT:
OUTPUT:
8500 - 0B
8501 - 0C
8502 - 84
*****
52
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
NO
YES
Is
Multiplier
is zero?
Transfer zero to the result reg.
Decrement multiplier
NO
Is the
Multiplier
is zero?
YES
Transfer the temp.reg content to result reg.
EXIT
53
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
OUTPUT:
START:
Address Opcode
Mnemonics
8100
8103
8104
8105
8108
2A 00 85
54
5D
3A 02 85
4F
LHLD 8500
MOV D,H
MOV E,L
LDA 8502
MOV C,A
8109
FE 00
CPI 00
810B
810E
CA 19 81
21 00 00
JZ 8119
LXI H,0000
8111
19
DAD D
8112
8113
0D
CA 19 81
DCR C
JZ 8119
8116
C3 11 81
JMP 8111
8119
811C
22 03 85
CF
SHLD 8503
RST 1
EX:
INPUT:
8500: 0B ;LSB
8501: 0A ;MSB
8502: 03
Comments
; Move the x1 to HL pair
; Copy the x1 to DE pair
; Mov the multiplier (x2)
; into c reg
; If x2=0 then result is 0
; and exit
; Exit addr =8119
; Init the hl to 0 add x1 as
; many time as the x2
; 16 bit addition between hl
; and DE added value in HL
; Decrement x2
; Store the result and exit
; (exit addr=8119)
; Jump multiply (multiply =
; 8111)
; Store the content of acc
; Break point
OUTPUT:
8503: 21 ;LSB
8504: 1E ;MSB
*****
54
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
YES
If dividend
is < divisor
NO
Subtract (dividend - divisor)
Increment temp.reg 1
EXIT
if dividend
is < divisor
NO
YES
55
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
8500
8501
Dividend
Divider
OUTPUT
8502
8503
Quotient
Reminder
START:
Address
8100
8103
8104
8107
8109
810A
810D
810E
810F
8112
8115
8516
8119
EX:
Opcode
Mnemonics
3A 01 85
47
3A 00 85
0E 00
B8
DA 12 81
90
0C
C3 09 81
32 03 85
79
32 02 85
CF
INPUT
RESULT
Comments
LDA 8501
MOV B,A ;BA
LDA 8500
MVI C,00
CMP B
JC 8112
SUB B
INR C
JMP 8109
STA 8503
MOV A,C
STA 8502
RST 1
:
; ADivider
; ADividend
; Count for quotient
; Check for A<B
; IF A<b then go to store
; A=A-B
; Count for quotient
; {8503}A--- Reminder
; A C quotient
; {8502} A Quotient
; Break point
8500
8501
Oa
02
8502
8503
05 Quotient
00 Reminder
(that is 0a/02)
******
56
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START
Add the reg r with temporary reg and result is stored in reg r.
Yes
IS the
Counter
is zero?
No
Move the least significant byte to a temp.reg.
Add the reg r with temporary reg and result is stored in reg r.
EXIT
57
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START:
Address
Opcode
Mnemonics
8100
8103
21 01 85
7E
LXI H,8501
MOV A,M
8104
8105
87
47
ADD A
MOV B,A
8106
8107
8108
8109
87
87
80
2B
ADD A
ADD A
ADD B
DCX H
810A
86
ADD M
810B
23
INX H
810C
810D
810F
23
77
CF
INX H
MOV M,A
RST 1
Comments
; Get msb of bcd (x1) from
; 8051
; Now multiply x1 with 10
; Here multiplication is
; Done by addition method
******
58
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
NO
If the
value > 9
YES
Add '07'.
Add '30'
59
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
A
NO
If the
value > 9
YES
Add '07'.
Add '30'
EXIT
PROGRAM:
INPUT :
OUTPUT:
EXAMPLE:
8500 A1
THEN
60
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Address
Opcode
Mnemonics
8100
8103
8104
8105
8106
21 00 85
7E
47
23
0F
LXI H, 8500
MOV A,M
MOV B,A
INX H
RRC
8107
8108
8109
810A
0F
0F
0F
CD 15 81
RRC
RRC
RRC
CALL 8115
810D
77
MOV M,A
810E
810F
8110
23
78
CD 15 81
INX H
MOV A,B
CALL 8115
8113
77
MOV M,A
8114
CF
RST 1
Comments
; Acc (8500) hex byte
;B A
; Now HL=8501
; Bring the higher nibble
; to lower nibble of acc
ASCII :
This function converts the lower nibble of Acc to its ASCII
value.
8115
8117
8119
E6 OF
FE 0A
DA 1E 81
ANI 0F
CPI 0A
JC 811E
811C
C6 07
ADI 07
811E
8120
C6 30
C9
ADI 30
RET
******
61
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
NO
If the
temp.reg data
< next data
YES
Is the
count is
zero?
START
NO
YES
62
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
YES
Start
Is the
swap flag is
zero ?
NO
Exit
PROGRAM:
INPUT:
OUTPUT:
EXAMPLE:
RESULT:
63
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Address Opcode
Mnemonics
Comments
; Flag for swapping
8100
8102
8105
06 00
21 00 85
4E
MVI B,00
LXI H,8500
MOV C,M
8106
8107
810A
0D
CA 20 81
23
DCR C
JZ 8120
INX H
810B
7E
MOV A,M
810C
23
INX H
810D
810E
BE
DA 18 81
CMP M
JC 8118
8111
8112
8113
8114
8115
56
77
2B
72
23
MOV D,M
MOV M ,A
DCX H
MOV M,D
INX H
8116
06 01
MVI B,01
8118
0D
DCR C
8119
C2 0B 81
JNZ 810B
; If C
811C
05
DCR B
; flag.
811D
CA 00 81
JZ 8100
8120
CF
RST 1
; Break point
64
NO
If the
temp.reg data
> next data
YES
Is the
count is
zero?
START
NO
YES
65
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
YES
Start
Is the
swap flag is
zero ?
NO
Exit
PROGRAM:
INPUT:
OUTPUT:
EXAMPLE:
RESULT:
66
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Address Opcode
Mnemonics
Comments
; Flag for swapping
8100
8102
8105
06 00
21 00 85
4E
MVI B,00
LXI H,8500
MOV C,M
8106
8107
810A
0D
CA 20 81
23
DCR C
JZ 8120
INX H
810B
7E
MOV A,M
810C
23
INX H
810D
810E
BE
D2 18 81
CMP M
JNC 8118
8111
56
MOV D,M
8112
8113
8114
8115
77
2B
72
23
MOV M,A
DCX H
MOV M,D
INX H
8116
8118
8119
811C
06 01
0D
C2 0B 81
05
MVI B,01
DCR C
JNZ 810B
DCR B
811D
CA 00 81
JZ 8100
8120
CF
RST 1
******
67
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Yes
Is the
EXIT
Counter is zero?
No
Is the
Counter is one?
YES
No
EXIT
No
If the Next
Data<temp.reg
data
Yes
Decrement the
counter.
A
68
No
Is the
Counter zero?
Yes
Store the temp.reg value to result reg.
EXIT
PROGRAM:
INPUT:
OUTPUT:
EXAMPLE:
8500
8501
8510
Acc
05
08 , 02 ,01 , 05 , 09
09
09
69
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START:
21 00 85
4E
0D
CA 1B 81
23
LXI H,8500
MOV C,M
DCR C
JZ 811B
INX H
8109
810A
810B
810C
810F
8110
8111
8114
8117
8118
811B
7E
23
BE
D2 10 81
7E
0D
C2 0A 81
C3 18 81
7E
32 10 85
CF
MOV A,M
INX H
CMP M
JNC 8110
MOV A,M
DCR C
JNZ 810A
JNZ 8118
MOV A,M
STA 8510
RST 1
Comments
; Load the count
; Load the count in to C reg
; If count =0 then exit
; Get the num and exit
; Move the memory pointer
;to start address
; Get the byte pointed by m ptr
; Move them ptr to the next byte
; Compare with Acc.
; If Acc > m then no swapping.
; Else get the large no in to Acc.
; Decrement the count.
; If C=0 then jump 810A
; Store the biggest num
; Break Point
******
70
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START
output to port A .
output to port B .
output to port C .
EXIT
71
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START:
Address Opcode
Mnemonics
Comments
8100
3E 80
MVI A,80
8102
D3 23
OUT 23
8104
3E 44
MVI A,44
8106
D3 20
OUT 20
; output to port A
8108
3E 88
MVI A,88
810A
D3 21
OUT 21
; output to port B.
810C
3E FF
MVI A,FF
; Load data
810E
D3 22
OUT 22
; output to port C
8110
CF
RST 1
; Break point
******
72
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
START
START
73
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972
Address
Opcode Mnemonics
Comments
8100
8102
3E B7
D3 13
MVI A,B7
OUT 13
8104
8106
3E 02
D3 12
MVI A,02
OUT 12
8108
810A
3E 00
D3 12
MVI A,00
OUT 12
810C
CF
RST 1
******
74
VIKASHA ELECTRONICS (MADRAS) PVT LTD, CHENNAI- 32, PH-22501972