Question

I can't understand the behavior of processing code for Intel 8080. For example I want to add two hex numbers: 3H and 4H so I wrote:

MVI A, 3H
MVI B, 4H
ADD B
HLT

But where can I find the result after processing? Should I copy result from A to some memory address or what? Sorry, but this is my first time with that kind of things and I can't see how does it works.

And for example, picture showing my example in 8085 Simulator. enter image description here

Another question is why some flags changed but registers stayed untouched? Shouldn't MVI B, 4H change value of B-register? If not, please explain how does it works.

After giving 2 bytes for each instruction accumulator also stayed with no result. enter image description here

And it seems that the only instruction that could affect accumulator or any other registry is INR. Is it possible that "my" simulator has a defect and don't work properly? enter image description here

Was it helpful?

Solution

As I could see from the screenshots, you are wrongly entering the code. your final code is suppose to be like:

MVI A, 3H       ->   3E 03
MVI B, 4H       ->   06 04
ADD B           ->   80
HLT             ->   76

I haven't used this simulator but I suppose you are inputting wrong Mnemonics. I think it should be like:

Address    Mnemonics   M Code
Address1:  MVI A       3E
Address2:  3           03
Address3:  MVI B       06
Address4:  4           04
Address5:  ADD B       80
Address6:  HLT         76

And not like:

Address1: MVI A, 3
Address2: MVI B, 4
Address3: ADD B
Address4: HLT

(this is clear if we see the coloumn M. Code where MVI A, 3 and MVI B, 4 has got no opcodes) Then only you will get the intended code as:

3E 03 06 04 80 76

What you are actually running till now was some NOP operations (opcode value 00) and HLT. :-)

OTHER TIPS

The result of

MVI A, 3H
MVI B, 4H
ADD B

Will have a result in register A.

The result of MVI B, 4H will be 4H in register B.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top