; *************************************************************************** ; copyright : (C) 2025 by Martin Preuss ; email : martin@libchipcard.de ; ; *************************************************************************** ; * This file is part of the project "AqHome". * ; * Please see toplevel file COPYING of that project for license details. * ; *************************************************************************** .equ FLASH_PAGESIZE = (PAGESIZE*2*4) ; *************************************************************************** ; data .dseg flashPageStart: .byte 2 flashPageBuffer: .byte FLASH_PAGESIZE ; *************************************************************************** ; code .cseg ; --------------------------------------------------------------------------- ; flash4pWritePage ; ; Interrupts must be disabled! ; ; @clobbers r0, r1, r20, r24, r25, X, Z flash4pWritePage: ; copy from SDRAM into MCUs temporary page buffer lds zl, flashPageStart lds zh, flashPageStart+1 ldi xl, LOW(flashPageBuffer) ldi xh, HIGH(flashPageBuffer) ldi r25, 4 ; handle 4 pages at a time flash4pWritePage_loop1: ldi r24, LOW(PAGESIZE) flash4pWritePage_loop2: ld r0, X+ ; read source data from buffer (low) ld r1, X+ ; read source data from buffer (high) ldi r20, (1<