Assembly Source for Algorithms
PRELIMINARY
**
* The following resources are used for temporary storage: *
* | BASE_0 | Flash STOP command, and FFFF for WDATA. | * |
* | BASE_5 | Flash erase command. | * |
* | BASE_6 | Flash erase + EXE command. | * |
*************************************************************
ERASE_A |
|
|
|
|
* SET UP FLASH ERASE COMMANDS FOR PROTECT MASK. | ** | |||
LACL | PROTECT | ;GET SEGMENT PROTECT MASK | ** | |
OR |
| #ER_CMND | ;OR IN ERASE COMMAND | ** |
SACL | BASE_5 | ;BASE_5 = ERASE COMMAND | ** | |
OR |
| #ER_EXE | ;OR IN EXEBIN COMMAND | ** |
SACL | BASE_6 | ;BASE_6 = ERASE EXE COMMAND | ** | |
* |
|
|
| ** |
* MUST LOAD WDATA WITH FFFF. | ** | |||
SPLK | #0FFFFh,BASE_0 ;WDATA VALUE FOR ERASE | ** | ||
LACC | FL_ST | ;ACC => FLASH | ** | |
TBLW | BASE_0 | ;SET WDATA = FFFF | ** | |
* |
|
|
| ** |
* THIS SECTION ACTIVATES THE WRITE COMMAND. | ** | |||
SPLK | #STOP,BASE_0 | ;Stop command. | ** | |
CALL | SET_MODE | ;Disable any flash cmds. | ** | |
CALL | REGS | ;ACCESS FLASH REGS | ** | |
LACC | FL_ST | ;ACC => FLASH | ** | |
TBLW | BASE_5 | ;ACTIVATE ERASE | ** | |
LAR |
| AR6,#D10 | ;SET DELAY | ** |
CALL | DELAY,*,AR6 | ;WAIT | ** | |
* |
|
|
| ** |
* THIS SECTION ACTIVATES THE EXEBIN COMMAND. | ** | |||
TBLW | BASE_6 | ;START ERASURE | ** | |
LAR |
| AR6,#D7K | ;SET DELAY to 7 ms | ** |
CALL | DELAY,*,AR6 | ;WAIT | ** | |
SPLK | #STOP,BASE_0 | ;STOP COMMAND | ** | |
CALL | SET_MODE | ;STOP ERASE | ** | |
RET |
|
| ;RETURN TO CALLING CODE | ** |
**************************************************************
.end
PRELIMINARY |