8085 Executing the program and checking result

MicroprocessorMicrocontroller8085

In this section we will see how to use 8085 to write a program in 8085 kit. We will also see how to debug the program and check the result after successful execution. 

Let us see a typical keypad structure of 8085 kit. (This keyboard pattern may vary indifferent kits of different manufacturers)

The following table will show the functionalities of different control keys. There are 16alphanumeric keys (0-9, A-F) to provide data and address −

KeysFunctionalities
RESETReset the system
VCT INTVector Interrupt. It generates hardware interruptRST 7.5 via keypad
SHIFTProvides second level commands to all keys
GOExecute the program
SIExecute in Single Step Mode
EXREGExamine Register. It allows to see the values of different registers.
PREPoint to previous memory address
DELDelete a part of program
INSInsert a part of program
B.MBlock Move. This helps to move a block of memory to any RAM area
FILLFill some RAM area with constant values
RELReallocates the program written for some memory area.
INS DATAInsert one or more data into memory
STRINGFind a string of data lying at particular address/s
MEMCCompare two blocks of memory for equality

Now we will see a sample program, where sixteen bytes of data are stored in memory location sat 8050H to 805FH. Transfer the entire block of data to new memory locations starting at 8070H.

Program

T-StatesAddressHEX CodesLabelsMnemonicsComments
10800021, 50, 80STARTLXI H, 8050HSet up HL as a pointer for source memory
10800311, 70, 80
LXI D, 8070HSet DE for destination address
7800606, 10
MVI B,10HSet up B to count 16 bytes
480087ENEXTMOV A,MGet data byte from source memory
7800912
STAX DStore data byte at destination
6800A23
INX HPointing HL to next source location
6800B13
INX DPointing DE to next destination
4800C05
DCR BDecrement count
10800DC2, 08, 80
JNZ NEXTIf counter is not 0, go to transfer next byte
5801076
HLTStop

Total 17 bytes




TotalT-States = Toutside_loop+Tinside_loop                        

               = (10 + 10 + 7 + 5) + ((4 + 7 + 6 + 6 + 4 + 10) x 16 - 3)                        

               = 32 + (37 x 16 – 3)                         

               = 32 + 589                        

               = 621

The debugging options of 8085 kit.

CommandFunction/Format
Examine/Modify MemoryDisplays/Modifies the contents of a memory location EXAM MEM <address> NEXT [[<data>] NEXT/PREV] EXEC
Examine/Modify registerDisplays/modifies 8085 register contents. EXAM REG <reg key> [[<data>] NEXT]* EXEC
Single stepExecutes a single user program instruction SINGLE STEP <start address> NEXT [[<start address>]NEXT]* EXEC
GoTransfers control from monitor to user program GO <address>EXEC
Block move/Block copyMoves/copies a block of data from one portion to another BLK MOVE <start address> NEXT <end address> NEXT<destination address> EXEC
InsertInserts one or more instructions in the user program INSERT [<low limit>] NEXT[<high limit>] NEXT <low insert address> NEXT <number of bytes> NEXT [[<data>] NEXT]* EXEC
DeleteDeletes one or more instructions inthe user program DELETE [<low limit>] NEXT[<high limit>] NEXT <low delete address> NEXT <high delete address> EXEC

Demonstration of block move operation

InitialCondition of memory addresses

Source AddressValueDestination AddressValue
800000H8100XXH
800111H8101XXH
800222H8102XXH
800333H8103XXH
800444H8104XXH
800555H8105XXH
800666H8106XXH
800777H8107XXH
800888H8108XXH
800999H8109XXH

Keys −

<Block Move>, 8000H<Next>, 8009H <Next>, 8100H <Exec>

Final Condition of memory addresses

Source AddressValueDestination AddressValue
800000H810000H
800111H810111H
800222H810222H
800333H810333H
800444H810444H
800555H810555H
800666H810666H
800777H810777H
800888H810888H
800999H810999H

Demonstration of block insert and block delete operations

InitialCondition of memory addresses

Source AddressValue
800000H
800111H
800222H
800333H
800444H
800555H
800666H
800777H
800888H
800999H

Keys −

<INSERT>8000H <NEXT>, 8009H <NEXT>, 8005H <NEXT>, 5 <NEXT>,AAH<INSERT>, BBH <NEXT>, CCH <NEXT>, DDH <NEXT>,EEH <NEXT>

<DELETE>,8000H <NEXT>, 800EH <NEXT>, 8005H <NEXT>, 8009H<EXEC>

FinalCondition of memory addresses

Source AddressValue
800000H
800111H
800222H
800333H
800444H
8005AAH
8006BBH
8007CCH
8008DDH
8009EEH
800A55H
800B66H
800C77H
800D88H
800E99H


Here we are using the 32Kmemory space 62256 at U3 with address map of 8000H to FFFFH. Instead of using HLT (76H) instruction to end the program we can use RST 5(EFH) to return back to the monitor program. Because it helps us to debug whether a program has caused halt and hang or not.

raja
Updated on 30-Jul-2019 22:30:24

Advertisements