diff src/simulator.asm @ 132:ec0b1e829399

Bugfix: Start dive mode simulator in correct depth
author heinrichsweikamp
date Tue, 08 Jul 2014 11:39:00 +0200
parents c61b7a4e317c
children 9a637c9bb19a
line wrap: on
line diff
--- a/src/simulator.asm	Fri Jul 04 12:51:20 2014 +0200
+++ b/src/simulator.asm	Tue Jul 08 11:39:00 2014 +0200
@@ -709,15 +709,18 @@
 		bra		$-2
 
 		bsf		simulatormode_active				; Set Flag
-		movlw	LOW			simulator_start_depth
-		movff	WREG,rel_pressure+0
-		movlw	HIGH		simulator_start_depth
-		movff	WREG,rel_pressure+1					; Set Depth
-
-		movlw	LOW			(simulator_start_depth+.1000)
-		movff	WREG,sim_pressure+0
-		movlw	HIGH		(simulator_start_depth+.1000)
-		movff	WREG,sim_pressure+1					; Set Depth
+        ; Compute dive ambient conditions
+        banksel char_I_bottom_depth
+        movf    char_I_bottom_depth,W
+        mullw   .100
+        movff   PRODL,rel_pressure+0
+        movff   PRODH,rel_pressure+1
+        movlw   LOW(.1000)
+        addwf   PRODL,W
+        movff   WREG,sim_pressure+0
+        movlw   HIGH(.1000)
+        addwfc  PRODH,W
+        movff   WREG,sim_pressure+1
 
 		bsf		divemode
 		goto	diveloop							; Switch into Divemode!