2 Replies - 414 Views - Last Post: 25 April 2010 - 05:10 PM

#1 trabalas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 14-October 08

how does OR works?

Posted 25 April 2010 - 04:57 PM

Hello i am now learning assembly Z80 i have the following example code:
 
       LD   A,5FH
       OR   85H
       LD   C,A
       HALT
       END



this supposes to load the hex value 5FH in A, and after that makes the logic operation OR between A and the hex value 85H. Finally it loads the result from A to C.
My question is why the result of the simulation is the hex value DF.
I mean wht does the OR thing exactly does why isn't 0 or 1.
Thanks for your time, and sorry if the q is too silly :(

Is This A Good Question/Topic? 0
  • +

Replies To: how does OR works?

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: how does OR works?

Posted 25 April 2010 - 05:08 PM

It do the OR on each individual bit of the value.

Eg
A 1100
B 1010
------ OR
C 1110
Was This Post Helpful? 1
  • +
  • -

#3 trabalas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 14-October 08

Re: how does OR works?

Posted 25 April 2010 - 05:10 PM

View PostAdamSpeight2008, on 25 April 2010 - 04:08 PM, said:

It do the OR on each individual bit of the value.

Eg
A 1100
B 1010
------ OR
C 1110


Thnx alot i get it now :):):)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1