ADD Comand

Thread Starter

thexy

Joined Dec 13, 2015
130
upload_2016-1-8_14-45-56.png

Hello everyone. I want to do some stuff before my teacher explains it. If someone would like to do it and explain me how to do it I would be really thankful. If yes read whole example.

It's given part of Programm
MOV A, DDh
MOV B, FBh
ADD B

Enter the given through this program memory content when the program is loaded into memory from 0000h. Fill in the following table for memory accesses, which are executed at the ADD command.
What value is in A after execution of the ADD instruction? What are the flags CZVS set?
Translate of table.
Wert-Value Quelle-source Ziel-Goal/target.
 
Last edited:

WBahn

Joined Mar 31, 2012
25,064
"Got comments and read whole example" -- huh? What comments? Do you show YOUR attempt to work the problem?
 

WBahn

Joined Mar 31, 2012
25,064
You still aren't giving us anything to even look at. What/where is this "example" you are referring to. Remember, all we have to go on is what you have presented in THIS thread!
 

Thread Starter

thexy

Joined Dec 13, 2015
130
You still aren't giving us anything to even look at. What/where is this "example" you are referring to. Remember, all we have to go on is what you have presented in THIS thread!
So I need to put DD and FB in binary. But how that is my problem? I need to add them and find COZSC Flags. That's not problem. I know that. Currently first sentence in this comment is my problem.
 

Papabravo

Joined Feb 24, 2006
12,767
So I need to put DD and FB in binary. But how that is my problem? ...
Well you can find a table of hexadecimal to binary equivalents or you could make such a table for yourself.
00h --> 0000 0000 binary
01h --> 0000 0001 binary
...
now you add the next 14 lines in the table and part 1 is done.
 

WBahn

Joined Mar 31, 2012
25,064
There is apparently a pretty significant language barrier here -- we'll just have to struggle through it.

By "comment" I'm guessing you are referring to the post you have made here. Is that correct?

In order to put DDh and FBh into binary, you need to look up how to work with hexademical and binary values. Each hexadecimal digit maps directly to four binary bits.
 

Thread Starter

thexy

Joined Dec 13, 2015
130
Well you can find a table of hexadecimal to binary equivalents or you could make such a table for yourself.
00h --> 0000 0000 binary
01h --> 0000 0001 binary
...
now you add the next 14 lines in the table and part 1 is done.
Hm, how do I know that?
There is apparently a pretty significant language barrier here -- we'll just have to struggle through it.

By "comment" I'm guessing you are referring to the post you have made here. Is that correct?

In order to put DDh and FBh into binary, you need to look up how to work with hexademical and binary values. Each hexadecimal digit maps directly to four binary bits.

Just watch my post with new edit. Chill.

Ok, I found on google that DD is 11011101, FB 11111011, but is it possible to count without using some tables?

When I add them I get 11011010
CF=1
ZF=0
Overflow flag=1
SF=1

How to fill table now?
 

WBahn

Joined Mar 31, 2012
25,064
Ok, I found on google that DD is 11011101, FB 11111011, but is it possible to count without using some tables?
Uh... yeah. It's called becoming familiar with hexadecimal and binary. Gee, seems like someone recommended that already.

When I add them I get 11011010
Wrong. Since you don't show any work, it's not possible to even guess where you went wrong.


CF=1
ZF=0
Overflow flag=1
SF=1

How to fill table now?
Again, you have not given any meaningful context for your question. How are we supposed to know how the ADD B command works on the processor you are working with when you have given no hint as to what that processor, or assembly language instruction set, is?
 

hp1729

Joined Nov 23, 2015
2,304
View attachment 98190

Hello everyone. I want to do some stuff before my teacher explains it. If someone would like to do it and explain me how to do it I would be really thankful. If yes read whole example.

It's given part of Programm
MOV A, DDh
MOV B, FBh
ADD B

Enter the given through this program memory content when the program is loaded into memory from 0000h. Fill in the following table for memory accesses, which are executed at the ADD command.
What value is in A after execution of the ADD instruction? What are the flags CZVS set?
Translate of table.
Wert-Value Quelle-source Ziel-Goal/target.
I am not certain this will agree with what your teacher has in mind, but ...
Assuming an 8-bit processor.

Address 0000 Move to A, DD (two bytes, the Move instruction followed by the data)
A = DD = 1101 1101

Address 0002 Move to B, FB
B = FB = 1111 1010

Address 0004 ADD B to A (one byte)
A = 1 D8 (8 bit machine, A = 1101 1000 with a Carry out, negative result

Next address, 0005
 

hp1729

Joined Nov 23, 2015
2,304
Hm, how do I know that?



Just watch my post with new edit. Chill.

Ok, I found on google that DD is 11011101, FB 11111011, but is it possible to count without using some tables?

When I add them I get 11011010
CF=1
ZF=0
Overflow flag=1
SF=1

How to fill table now?
How did you get that result of 1101 1010?
D + B = 8, with a carry.
1101
1011
Starting from the right
1+1 = 0, with a carry out
0+1 with a carry in = 0, with a carry out
1+0 with a carry in = 0, with a carry out
1+1 with a carry in = 1, with a carry out
So, 1000, with a carry out
 
Last edited:

Thread Starter

thexy

Joined Dec 13, 2015
130
I am not certain this will agree with what your teacher has in mind, but ...
Assuming an 8-bit processor.

Address 0000 Move to A, DD (two bytes, the Move instruction followed by the data)
A = DD = 1101 1101

Address 0002 Move to B, FB
B = FB = 1111 1010

Address 0004 ADD B to A (one byte)
A = 1 D8 (8 bit machine, A = 1101 1000 with a Carry out, negative result

Next address, 0005
How can I know which adress is A and B? Why did you choose 0004?
 

Thread Starter

thexy

Joined Dec 13, 2015
130
How did you get that result of 1101 1010?
D + B = 8, with a carry.
1101
1011
Starting from the right
1+1 = 0, with a carry
0+1 with a carry = 0, with a carry
1+0 with a carry = 0, with a carry
1+1 with a carry = 1, with a carry
So, 1000, with a carry
How did you get d+b? and why is that 8?
 

djsfantasi

Joined Apr 11, 2010
5,913
0xDD
0xFB
0x??

Look at the first column. See the D and B?
And note that it isn't 8... It is 0x8 with a carry out (i.e., 0x18).
Try it yourself...
 
Top