changeset 521:33abbc08f01e

Minor cleanups for TESTING=1 emulator mode.
author JeanDo
date Fri, 09 Dec 2011 20:43:39 +0100
parents acf4776eec08
children e33a8ac4b660
files code_part1/OSTC_code_asm_part1/start.asm code_part1/OSTC_code_asm_part1/surfmode.asm code_part1/OSTC_code_asm_part1/wait.asm
diffstat 3 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/start.asm	Fri Dec 09 20:43:35 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Fri Dec 09 20:43:39 2011 +0100
@@ -24,7 +24,7 @@
 
 start:
 	movlb	b'00000001'				; ram bank 1 selected
-	movff	STKPTR,temp10
+	movff	STKPTR,temp10           ; Save stack pointer, for crash reports.
 	clrf    temp10+1
 	call	init
 	btfsc	divemode				; Reset from Divemode?
@@ -59,12 +59,20 @@
 	call	pressuretest_sleep_fast	; Gets pressure without averaging (faster!)
 	bcf		sleepmode				; Normal mode again
 
-  Ifdef TESTING
-    movlw   LOW(.1000)
-    movwf   amb_pressure+0
-    movlw   HIGH(.1000)
-    movwf   amb_pressure+1
-  Else
+; Extra power-up reset (JeanDo emulator)
+	Ifdef	TESTING
+        call	reset_gases
+		call 	reset_all_cf
+		call    reset_external_eeprom
+
+        movlw   LOW(.1000)
+        movwf   amb_pressure+0
+        movlw   HIGH(.1000)
+        movwf   amb_pressure+1
+	Endif
+
+; Get real pressure (if not in emulator mode)
+  Ifndef TESTING
     SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure	; copy for compatibility
   Endif
 
@@ -92,12 +100,6 @@
 	movff	int_I_pres_respiration+0,int_I_pres_surface+0   ; copy for desat routine
 	movff	int_I_pres_respiration+1,int_I_pres_surface+1		
 
-; Extra power-up reset (JeanDo)
-	ifdef	TESTING
-        call	reset_gases
-		call 	reset_all_cf
-	endif
-
 	call    deco_clear_tissue
 	movlb   b'00000001'                     ; select ram bank 1
 
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Fri Dec 09 20:43:35 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Fri Dec 09 20:43:39 2011 +0100
@@ -267,6 +267,7 @@
 
 	call	deco_calc_wo_deco_step_1_min    ; calculate deco in surface mode 
 	movlb	b'00000001'									; select ram bank 1
+
 	ostc_debug	'J'		; Sends debug-information to screen if debugmode active
 	return
 
--- a/code_part1/OSTC_code_asm_part1/wait.asm	Fri Dec 09 20:43:35 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/wait.asm	Fri Dec 09 20:43:39 2011 +0100
@@ -90,6 +90,9 @@
 
 WAITMSX		movwf	waitms_temp			; Holds number of ms to wait
 
+    Ifdef TESTING
+            return                      ; In emulation, just skips waits
+    Endif
 WAITMSX1:
 			movf	TMR1L,W
 			addlw	d'66'				; 66*15,26µs ~ 1ms