selfdestruct.s

来自「Microchip平台下的网络程序源码。包括TCP、IP、FTP等等协议的源码!」· S 代码 · 共 33 行

S
33
字号
	.include "p24fxxxx.inc"
	
	goto	PostSelfDestruct	; Make sure this code isn't executed on accident
	.global _SelfDestruct
_SelfDestruct:
	;Write a goto	0 to first possible instruction
	mov		#0x4001, W0
	mov		W0, NVMCON
	clr		W0
	mov		W0, TBLPAG
	;0x040000 0x000000 is a GOTO 0x00000000 program memory instruction
	mov		#0x0000, W2
	mov		#0x0004, W3

	mov		#64, W1
WriteProgramLatches:
	tblwtl	W2, [W0]
	tblwth	W3, [W0++]
	dec		W1, W1
	bra		NZ, WriteProgramLatches

	disi	#5
	mov		#0x55, W0
	mov		W0, NVMKEY
	mov		#0xAA, W1
	mov		W1, NVMKEY
	bset	NVMCON, #WR
	nop
	nop

	reset
PostSelfDestruct:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?