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.

How to set a second bit of the register ?

Status
Not open for further replies.

littlefield

Junior Member level 3
Junior Member level 3
Joined
Jul 7, 2007
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,472
A small computer has an 8 bit CPU and only one register.
XOR - is the only assembly command it understands.
How to set a second bit of the register ?
The initial state of the register is unknown.
 

vlsi_freak

Full Member level 2
Full Member level 2
Joined
Sep 3, 2007
Messages
127
Helped
14
Reputation
28
Reaction score
8
Trophy points
1,298
Activity points
2,041
Hi.

I did not clearly understand your question. As far as i understood, u can write a value to the register if you know the address of that register.

If the initial value of the register is '0' u can use the instr

XOR BIT, '1';

Hope it helps.

Thanks
 

stevepre

Member level 4
Member level 4
Joined
May 10, 2001
Messages
78
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
595
do you need to keep other bits same as their original value? Or it is OK to clear them to 0?
 

asicganesh

Member level 3
Member level 3
Joined
Oct 18, 2007
Messages
58
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
1,681
You can do this by using the following two steps:

XOR BIT, BIT; --> will reset the bit
XOR BIT, '1'; --> will set the bit

Hope this works!!

Regards
Ganesh S
 

hamed_sotoudi

Full Member level 3
Full Member level 3
Joined
Aug 1, 2007
Messages
156
Helped
15
Reputation
30
Reaction score
4
Trophy points
1,298
Location
Germany Hamburg
Activity points
2,195
if u want to have the other bits unchanged it is imposible. u need at least to register to do this. but the other bits is not important for u do like this:
(a is your register)
a= a xor a
a = a xor 04h
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top