Sei sulla pagina 1di 3

T.Y.EII Microprocessor-IV N.

KAPOOR
Programming the 8085→ It is the process of developing a program. A program is a sequence
of instructions operating on certain data items. There are many
possible languages in which program is written but a µ p can understand only instructions
written in binary i.e. 0’s & 1’s. A program written using only 0 & 1 is called machine language
program. Writing machine language program is quiet troublesome and leads to error.
The program can also be written using mnemonic operation codes & symbolic address for
writing instructions & the data using different notations i.e. binary, decimal hexadecimal etc.
This is called assembly language. Program written in assembly language has to be translated
into a machine language. A translator, which translates an assembly language program into a
machine language program is known as assembler.
High Level Languages → Programming Languages that are machine- independent are called
HLL. e.g. FORTRAN -- ( Formula Translation) It is a language that is designed for scientists &
engineers.
COBOL -- Common Business Oriented Language.
BASIC --- Beginner’s All-purpose symbolic instruction Code -- for non- professional programs to
learn & use.
PASCAL -- it is designed to encourage the programmer to adhere to correct programming
practices C & C++ .
These programs which are written in English are converted into binary language using program
called a compiler or interpreter.
Flow Chart→ The steps necessary to write program can be represented in a pictorial format
called a “ flow chart.” Flow charts use graphic symbols ( shapes) to represent different types of
program operations. The specific operation desired is written in the graphic symbols. The
common flow chart symbols are, It shows direction of program execution.

beginning or ending of program.

process

Subroutines

Decision

Continuation

The algorithm represented by flow chart is coded into assembly language and then mnemonics
for different steps are written & program is translated into machine language i.e. machine code
is written for each instruction. Each code is then has to be stored in memory location.
( R/W memory ) Thus program has five columns memory add Machine code, opcode, operand
& Comments.
(1) Memory Address→ These are 2 byte R/W users memory in systems where machine code
of program is stored. The beginning address is generally xyoo, Where xy represent page no. of
available R/W memory in µ p & 00 represents line no.
(2) Machine Code→ These are hexadecimal instruction codes that are stored in respective
memory addresses through hexadecimal keyboard of µ p. The monitor program which is stored
in ROM of µ p translates hexadecimal number into binary digits & stores binary digits in the R/W
memory.
(3) Op Code→ It indicates type of operation or function that will be performed by machine code.
(4) Operand→ It specifies the item to be processed. It can be 8 or 16 bit data, a register or a
memory address. Thus a mnemonic instruction is combination of an opcode and operand.
(5) Comment→ It explains the purpose of instruction used. They play a critical role in users
understanding of the logic behind the program.
To enter & execute the program→
1. Push reset key.
2. Enter 16.bit memory address of 1st machine code of programme.
3. Enter and store all the machine codes sequentially using hexadeciml key board on system.
4. Reset the system.
5. Enter memory address where the programme begins and push execute key.
T.Y.EII Microprocessor-IV N.KAPOOR
After executing the programme answer can be found in accumulator by pushing “Examine
register key”.

Debugging the programme: It is nothing but finding the troubleshooting in a programme.


Dehugging process can be divided into two parts, 1) Static debugging 2) Dynamic debugging
Static debugging: It consist of cheking flow charts and machine code point by point.
Dynamic debugging: It involves observing the o/p or register contents following the execution of
each instruction single step technique or of a group of instructions (the break point techniques.

The common errors are:


1. Selecting a wrong code.
2. Forgetting 2nd and 3rd byte of an instruction.
3. Specifying ROM jump location.
4. Not reversing order of high and low bytes in the jump instructions.
5. Writing memory address in decimal and thus specifying wrong jump locations.

Program→ Add the two numbers stored in 2100 & 2101 and store the result at 2102.
START
|
HL 2100

HL → A

HL → HL+1

A A+ HL

Store A→2102

END

Address Mnemonic Opcode Comment


2000 LXIH 2100 21 Load memory location
2001 00 in HL pair
2002 21
2003 MOV A, M 7E Move content of M to A
2004 INX H 23 Increment location shown in HL
2005 ADD M 86 Add contents of M to accumulator
2006 STA 2102 32 Store content of accumulator
2007 02 at location 2102
2008 21
2009 HLT ( RST) 76 (CF) STOP
2) Subtraction of numbers → Same as above except ADD M → SUB M & 86 → 96
3)Multiplication of two numbers by addition method→
START Address Mnemonics Opcode Comment
2000 MVI B O2 06 Loading register B
load B = Data 2001 02 with 02
load C = Data 2002 MVI C 03 0E Load register C
A = 00 2003 03 with 03
2004 MVI A 00 3E Clear the
accumulator
2005 00
A A+C 2006 loop ADD C 89 Add C to accumulator
2007 DCR B 05
2008 JNZ 2006 C2 If B ≠ 0 then repeat
B=B-1 2009 06 the process
200A 20
No Is 200B STA 2102 32 Store the answer at
B=0 200C 02 2102
YES 200D 21
Save Product 200E HLT 76 Stop

STOP

Potrebbero piacerti anche