# HG changeset patch
# User heinrichsweikamp
# Date 1368194177 -7200
# Node ID 13cda523891f65d6b9072c8dc024ebdd2b1a70d2
# Parent  ed1dec74d5fdefd3b2fec71473d0a33687048862
bugfix: dive length in normal header

diff -r ed1dec74d5fd -r 13cda523891f src/external_flash.asm
--- a/src/external_flash.asm	Fri May 10 15:35:23 2013 +0200
+++ b/src/external_flash.asm	Fri May 10 15:56:17 2013 +0200
@@ -144,6 +144,11 @@
 	rcall		ext_flash_byte_write	; Write the byte
 	bra			incf_ext_flash_address_p1	; +1 and return
 
+    global  write_byte_ext_flash_plus_nocnt
+write_byte_ext_flash_plus_nocnt:       ; Write from WREG and increase address after write with banking at 0x200000
+    movwf		temp1					; store data
+    bra         write_byte_ext_flash_plus2
+
 	global	write_byte_ext_flash_plus	; Write from WREG and increase address after write with banking at 0x200000
 write_byte_ext_flash_plus:
 	movwf		temp1					; store data
@@ -154,6 +159,7 @@
     addwfc      ext_flash_dive_counter+1,F
     addwfc      ext_flash_dive_counter+2,F  ; 24bit++
 
+write_byte_ext_flash_plus2:
 	; Now test if write is done at first byte of 4kB block
 	; if yes -> delete 4kB block first
 	tstfsz		ext_flash_address+0			; at 0x00?
diff -r ed1dec74d5fd -r 13cda523891f src/external_flash.inc
--- a/src/external_flash.inc	Fri May 10 15:35:23 2013 +0200
+++ b/src/external_flash.inc	Fri May 10 15:56:17 2013 +0200
@@ -16,6 +16,7 @@
 
 ; Writes
  extern	write_byte_ext_flash_plus	; Write from WREG and increase address after write with banking at 0x200000
+ extern write_byte_ext_flash_plus_nocnt
  extern write_byte_ext_flash_plus_header ; Write from WREG and increase address after write
  extern ext_flash_byte_write		; Writes one byte from WREG @ext_flash_address:3
  extern	write_spi1					; Just (dummy)write to read a byte
diff -r ed1dec74d5fd -r 13cda523891f src/ghostwriter.asm
--- a/src/ghostwriter.asm	Fri May 10 15:35:23 2013 +0200
+++ b/src/ghostwriter.asm	Fri May 10 15:56:17 2013 +0200
@@ -336,11 +336,11 @@
     incf_ext_flash_address_0x20	d'6'        ; Skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" Header
     ; Store dive length
     movf   ext_flash_dive_counter+0,W
-	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	call    write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase)
     movf   ext_flash_dive_counter+1,W
-	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	call    write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase)
     movf   ext_flash_dive_counter+2,W
-	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	call    write_byte_ext_flash_plus_nocnt ; WREG -> Profile in ext. flash (No ext_flash_dive_counter:3 increase)
 
 ; profile recording done.