From f963ff6b7ad0709d512ff6682646c21d84ae1f4f Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Wed, 5 Apr 2023 22:55:21 +0200 Subject: [PATCH] avr: started working on flash protocol. --- avr/flash.asm | 20 +------ avr/flashproto.asm | 145 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 17 deletions(-) create mode 100644 avr/flashproto.asm diff --git a/avr/flash.asm b/avr/flash.asm index a5574bc..e911bc1 100644 --- a/avr/flash.asm +++ b/avr/flash.asm @@ -1,19 +1,5 @@ -; *************************************************************************** -; data - - -.dseg - -flashDataBegin: - flashCurrentAddress: .byte 2 - flashLastReceivedMsg: .byte 2 -flashDataEnd: - - - - ; *************************************************************************** ; code @@ -31,7 +17,7 @@ Flash_StartPage: push zh push zl ldi r16, ((PAGESIZE*2)-1) - and r16, zl + and zl, r16 rcall Flash_ReadPageIntoPageBuffer pop zl pop zh @@ -47,7 +33,7 @@ Flash_StartPage: Flash_FinishPage: ldi r16, ((PAGESIZE*2)-1) - and r16, zl + and zl, r16 rcall Flash_ErasePage rcall Flash_WritePage ret @@ -76,7 +62,7 @@ Flash_ReadPageIntoPageBuffer_loop: ldi r20, (1<