ADD Comand

Discussion in 'Homework Help' started by thexy, Jan 8, 2016.

  1. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    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: Jan 8, 2016
  2. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    "Got comments and read whole example" -- huh? What comments? Do you show YOUR attempt to work the problem?
     
  3. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    Mistake in writing. Hm I have watched some stuff about adressing mode but I'm not able to solve this.
     
  4. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    This is homework topic. Thank you.
     
  5. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    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!
     
  6. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    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.
     
  7. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    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.
     
  8. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    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.
     
  9. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    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?
     
  10. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    Uh... yeah. It's called becoming familiar with hexadecimal and binary. Gee, seems like someone recommended that already.

    Wrong. Since you don't show any work, it's not possible to even guess where you went wrong.


    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?
     
  11. hp1729

    Well-Known Member

    Nov 23, 2015
    1,944
    219
    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
     
  12. hp1729

    Well-Known Member

    Nov 23, 2015
    1,944
    219
    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: Jan 9, 2016
  13. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    How can I know which adress is A and B? Why did you choose 0004?
     
  14. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    How did you get d+b? and why is that 8?
     
  15. WBahn

    Moderator

    Mar 31, 2012
    17,716
    4,788
    What is 'd' in binary? (what is it in decimal)?
    What is 'b' in binary? (what is it in decimal)?

    What is 'd' + 'b' in binary? (what is it in decimal)?
     
  16. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    Obviosuly I don't know.
     
  17. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    Do I have to learn whole tabele or?
     
  18. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,796
    831
    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...
     
  19. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,796
    831
    It makes the whole process easier and less prone to mistakes. To be honest, in a complicated case, I'll do some interim math in decimal and convert back to hex. But in most cases, I just know the tables.
     
  20. thexy

    Thread Starter Member

    Dec 13, 2015
    126
    0
    Hm I don't understand
     
Loading...