⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 assembly.s90

📁 Mega8完美下载 包含源程序
💻 S90
字号:

write_page:
        RCALL   WAIT_SPMEN  ;Wait for SPMEN flag cleared
        ;MOV     R31,R17         
        MOVW     R30,R16     ;move adress to z pointer (R31=ZH R30=ZL)
        MOV	 R17,R20
        RJMP	SPMSTUFF


fill_temp_buffer:

        RCALL   WAIT_SPMEN  ;Wait for SPMEN flag cleared

        ;MOV     R31,R17     ;move adress to z pointer (R31=ZH R30=ZL)   
        MOVW     R30,R16     
        ;MOV     R1,R21      ;move data to reg 0 and 1      
        MOVW     R0,R20
 
        LDI     R17,(1<<SPMEN)

SPMSTUFF:
;;        #ifdef _ATMEGA104
;;        STS     SPMCSR,R17  ;argument 2 decides function
;;        #else
        OUT     SPMCR,R17   ;argument 2 decides function
;;        #endif
        SPM                ;Store program memory
        .DW      0xFFFF      ;For future part compatibility, instruction alignment
        NOP
 

WAIT_SPMEN:
;;        #ifdef _ATMEGA104
;;        LDS     R19,SPMCSR
;;        SBRC    R19,SPMEN
;;        RJMP    WAIT_SPMEN  ;Wait for SPMEN flag cleared
;;        #endif
        
        RET



read_program_memory:
        RCALL    WAIT_SPMEN

        ;MOV     R31,R17     ;R31=ZH R30=ZL
        MOVW     R30,R16     ;move adress to z pointer
        SBRC    R20,0       ;read lockbits? (second argument=0x09)
                            ;if so, place second argument in SPMEN register
;;        #ifdef _ATMEGA104
;;        STS     SPMCSR,R20  ;argument 2 decides function
;;        #else
        OUT     SPMCR,R20   ;argument 2 decides function
;;        #endif
        
        LPM     R16,Z+              

        LPM     R17,Z+


        RET

write_lock_bits:
        RCALL   WAIT_SPMEN  ;Wait for SPMEN flag cleared

        MOV     R0,R16   
        LDI     R17,((1<<BLBSET)|(1<<SPMEN))
	RJMP SPMSTUFF
	

⌨️ 快捷键说明

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