#include "c:\miniide\hcs12.inc" org $1000 org $1500 lds #$1500 ; setup stack pointer ; ****************************************************************************** ; The following function erase a sector pointed to by index register x. ; ****************************************************************************** EraseFSector brclr FSTAT,CBEIF,err2ES ; erase prohibited if command buffer not empty std 0,X ; write any data to sector address movb #SectorErase,FCMD ; write sector erase command movb #CBEIF,FSTAT ; launch the erase command brclr FSTAT,ACCERR+PVIOL,OK2ER ; no error flag? err2ES ldab #1 ; return error code of "1" rts OK2ER brclr FSTAT,CCIF,OK2ER ; wait until command is completed ldab #0 ; erase successfully, return code "0" rts end