The usage of は is a bit of an exception in the _Hiragana_ system. It's almost like irregular verbs that you simply have to memorize the different forms because there are not "make-sense" rules.
So, here it is.
In Hiragana, with the exception of the topic marker _*Wa*_ or *は* the sound _*Wa*_ is always written *わ*. Like in *わかります* *_(Wakarimasu)_* "understand" and feminine sentence ending particle *わ* like *うれしいわ!* *_(Ureshii wa!)_*. :P
:idea: BUT... the __TOPIC MARKER__ _*Wa*_ is an EXCEPTION. It's written *は*.
When *は* appears __ANYWHERE ELSE__ it is read _*Ha*_ like in *はい* *_(Hai)_*, but as a topic marker, it is read _*Wa*_.
The good news is, you NEVER have to be confused over *わ*, and when you come across a *は* you have to determine if it's marking a topic or it's part of another word.