📄 program flash.asm
字号:
/* This program Programs the flash with the input file
Input - None
Output - None */
#include <def21369.h>
#include "flashprogrammer.h"
.global PROGRAM_FLASH;
.extern Data_Byte, External_Byte_Address;
.extern WRITE_FLASH_BYTE ;
.extern my_file;
.section/pm seg_pmco;
PROGRAM_FLASH:
r0 = FLASH_START_ADDRESS;
dm(External_Byte_Address) = r0;
i0=my_file;
m0=1;
lcntr=@my_file, do PROGRAM_FLASH_LOOP until lce; //each loop iteration writes two 8-bit flash locations
r6 = dm(i0,m0); //data is 16 bits wide in 'my_file'
dm(Data_Byte) = r6;
call WRITE_FLASH_BYTE ; //write 8 bits of the data
r0 = dm(External_Byte_Address);
r0 = r0 + 1;
dm(External_Byte_Address) = r0; //update flash address for DMA in WRITE_FLASH_BYTE
r6 = lshift r6 by -8; //get the other 8 bits
dm(Data_Byte) = r6;
call WRITE_FLASH_BYTE ; //write the other 8 bits of the word
r0 = dm(External_Byte_Address);
r0 = r0 +1;
dm(External_Byte_Address) = r0; //update flash address for DMA in WRITE_FLASH_BYTE
nop;
PROGRAM_FLASH_LOOP:
nop;
nop;
PROGRAM_FLASH.END:
rts;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -