#include "c:\miniide\hcs12.inc" org $1000 org $1500 lds #$1500 ; set up stack pointer ; **************************************************************************** ; The following function bulk erases the EEPROM and then verifies if the ; EEPROM has been bulk erased. ; **************************************************************************** eeraseverify brclr ESTAT,CBEIF,cantEE ; command buffer not empty std 0,x ; write any data to EEPROM address movb #EraseVerify,ECMD ; write the command movb #CBEIF,ESTAT ; launch the erase and check command brclr ESTAT,ACCERR+PVIOL,EEEVOK ldab #1 ; return error code 1 rts EEEVOK brclr ESTAT,CCIF,EEEVOK ; wait until command is done brset ESTAT,BLANK,EVEOK ; successful erase and verify? cantEE ldab #1 ; EEPROM is not blank rts EVEOK clrb rts end