gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > How can I read the WriteOnly Register ?

#9883 - aladdin - Thu Aug 21, 2003 3:37 am

As I learned GBA , I have some Project that need to read the WriteOnly regsiter on GBA , ie
BG2X_L
BG2X_H

When I tried , I read 0x3402 the wrong number , how can I get the real one , please help me !

#9884 - tepples - Thu Aug 21, 2003 4:27 am

Whenever you write to a write-only register that you want to read later, write the same thing to a variable. Then when you want to read the register, read the corresponding variable instead.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#9935 - aladdin - Fri Aug 22, 2003 3:27 am

but this methead is not suitable for my case ,
I can't track the rigister ,but i need to read it .
so is there any more solution??

#9938 - tepples - Fri Aug 22, 2003 3:34 am

Why, specifically, can't you track those registers whenever you write them?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#9940 - sgeos - Fri Aug 22, 2003 4:11 am

aladdin wrote:
I ... need to read the WriteOnly regsiter on GBA.


Write only means that you can only write to it. You can not read from it. The only way to get around this is to write to a location that you can read from at the same time, as tepples suggested.

If you want to read a register that the GBA changes after you write to it, you are out of luck. (As far as I know, at least.)

-Brendan