#include "c:\miniide\hcs12.inc" org $1000 org $1500 lds #$1500 ; set up stack pointer feraseverify brclr FSTAT,CBEIF,cantE ; command buffer not empty std 0,x ; write any data to flash sector address movb #EraseVerify,FCMD ; write the command movb #CBEIF,FSTAT ; launch the erase and check command brclr FSTAT,ACCERR+PVIOL,EVNoErr ldab #1 ; return error code 1 rts EVNoErr brclr FSTAT,CCIF,EVNoErr ; wait until command is done brset FSTAT,BLANK,EVFOK ; successful erase and verify? cantE ldab #1 ; flash is not blank rts EVFOK clrb rts end