Hello, and welcome to the forum.
From the reference manual for the device, Table 4.23, for the erase verify command -
Verify all memory bytes in the flash array memory are erased.
If the flash array memory is erased, the FBLANK flag in the FSTAT register will set upon
command completion.
Therefore, the erase verify command tests whether the whole flash array has been erased, i.e. a mass erase has succeeded. Running the code from flash cannot work as intended, since a mass erase would erase the code that executes the command.
In the event that no mass erase has occurred, the situation that you currently seem to have, I would expect that the returned result would be zero.
You may assume that a sector erase process has succeeded if the FSTAT_FACCERR and FSTAT_FPVIOL error flags are clear upon exit from the sector erase function.
I have attached some sample code for a different 9S08 device, that is capable of erasing a single flash sector, and provides byte by byte flash programming. But you should be able to adapt. It uses a fixed block of RAM for the code that requires to be RAM resident.
Regards,
Mac