summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-07-11 01:48:37 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2013-07-11 01:48:37 (GMT)
commit138ef9a70dccb603494a899bc9a318a2ab818f30 (patch)
treeab1e2163ac94ce3a4cc858e2458627d69477d245
parenta98d62341d4a72bc9393308421343524c48958c2 (diff)
flash write address checks work
git-svn-id: https://svn.spreadspace.org/pic/trunk@78 a09c6847-51d9-44de-8ef2-e725cf50f3c7
-rw-r--r--bootloader/cmds-16f1847.inc23
1 files changed, 11 insertions, 12 deletions
diff --git a/bootloader/cmds-16f1847.inc b/bootloader/cmds-16f1847.inc
index d5460c1..bb51298 100644
--- a/bootloader/cmds-16f1847.inc
+++ b/bootloader/cmds-16f1847.inc
@@ -68,13 +68,14 @@ read_flash_segment_next
;; flash write --------
cmd_w_flash
-;; movf combuff + .3,f ; if addr[15:8] == 0 -> boot loader section
-;; btfsc STATUS,Z
-;; goto address_prohibited
-;; movlw FLASH_BOUNDARY ; addr on boundary?
-;; andwf combuff + .2,w
-;; btfss STATUS,Z
-;; goto address_invalid
+ movlw .2 ; if addr[15:8] < 2 -> boot loader section
+ subwf combuff + .3,w
+ btfss STATUS,C
+ goto address_prohibited
+ movlw FLASH_BOUNDARY ; addr on boundary?
+ andwf combuff + .2,w
+ btfss STATUS,Z
+ goto address_invalid
;; movlw FSS ; initialize EEADR:EEADRH and FSR
;; movwf cnt
;; movlw b'01011000'
@@ -119,9 +120,7 @@ cmd_w_flash
;; movlw E_FLASH_WERR
;; bcf STATUS,RP1
;; bcf STATUS,RP0
-;; movwf combuff + .2 ; = E_OK
-;; movlw .1 ; bytes to send
-;; call send_answer
- movlw E_NOT_IMPL
- call ack_cmd
+ movwf combuff + .2 ; = E_OK
+ movlw .1 ; bytes to send
+ call send_answer
goto wait_new_cmd