Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8085 microprocessor question

Status
Not open for further replies.

erece

Junior Member level 3
Joined
Mar 17, 2011
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,470
Write a program .. A set of ten current readings is stored in memory locations starting at C200H . The readings are expected to be positive (<127 base 10).
Please tell where i am wrong


MVI A,00H
JZ beg
neg : MOV A,D
JMP NXTBYT
beg: LXI H,C200H
MVI M,28H
INX H
MVI M,D8H
INX H
MVI M,C2H
INX H
MVI M,21H
INX H
MVI M,24H
INX H
MVI M,30H
INX H
MVI M,2FH
INX H
MVI M,19H
INX H
MVI M,F2H
INX H
MVI M,9FH
MVI B,FFH
MVI C,06H
LXI H,C200H
start: MOV D,A
MOV A,M
RAL
JC neg
RAR
MOV A,D
ADD M
CMP B
JC over
NXTBYT: INX H
DCR C
JNZ start
STA C300H
JMP end
over: MVI A,FFH
STA C301H
end: HLT
 

hi,
what is your problem? I think, as the first number is 28h ,RAL will not set the carry flag and so the program halts. it continues to next location only if RAL sets the carry flag.
 

hi,
what is your problem? I think, as the first number is 28h ,RAL will not set the carry flag and so the program halts. it continues to next location only if RAL sets the carry flag.

why will it halt?
it will simply execute RAR
 

why will it halt?
it will simply execute RAR

for the first no, A=00h
then it jumps to beg and load the addresses.
then,B=FFH
C=06h
D=00h (as MOV D,A executes)
M is now 28h
RAL resets carry fag, so RAR executes and then A=00h again (MOV A,D)(D still contains 00h)
ADD M gives 00h+28h=28h
so CMP B sets the CY flag. So it jumps to over.
I hope u'll get it
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top