Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Making all bits zero

Status
Not open for further replies.
Register A of a hypothetical CPU contains a binary value 10011001. A programmer needs to make all the bits zero. Is it possible to achieve this without using MOVE or SUBTRACT instructions?

Could i just AND those bits with all zero's 10011001 & 00000000?

Or do i have to do four seperate bit mask XORs saving the result each time or something?
 
I would use said hypothetical CPU's register clear instruction myself...
Or if you're going to go to the effort of loading a separate register with all 0's to and it with the other register why not just load the register you're trying to clear with all 0's in the first place?
 
Ok so i could just use clrf instruction on the particular register. I am totally new to this...sorry for the dumb question...thanks. :)
 
I have no idea what instruction you would use as I've never used a hypothetical instruction set, only real ones! =) It's not a dumb question but make sure you provide details about what you're talking about or we can't help you.
 
You can always exclusive or the register with itself, or and it with its complement, or add it to its complement. If you can use shifting then logical left or right shift will give you zeros.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top