fix exit code
Created by: youzi27
To fix #2012 (closed)
The previous code would fail to exit normally under certain circumstances.
For example, before exiting, a0=0b01
(which becomes 0b10
after left shifting), so it is necessary to clear the value of a0
before exiting.