changeset 128:4c588c3d1f12

Saturation graphs in customview divemode
author JeanDo
date Tue, 04 Jan 2011 15:14:42 +0100
parents 245de99d1d15
children 03df42de03e1
files code_part1/OSTC_code_asm_part1/18f4685_ostc_mkII.lkr code_part1/OSTC_code_asm_part1/customview.asm code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 5 files changed, 227 insertions(+), 142 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/18f4685_ostc_mkII.lkr	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/18f4685_ostc_mkII.lkr	Tue Jan 04 15:14:42 2011 +0100
@@ -1,8 +1,7 @@
 // File: 18f4685.lkr
 // Sample linker script for the PIC18F4685 processor
-
-// Not intended for use with MPLAB C18.  For C18 projects,
-// use the linker scripts provided with that product.
+// History:
+// 2010-12-25 : [jDG] Added link information for .o or .c modules.
 
 LIBPATH .
 FILES "clib.lib"
@@ -25,9 +24,9 @@
 DATABANK   NAME=gpr7       START=0x700          END=0x7FF
 DATABANK   NAME=gpr8       START=0x800          END=0x8FF
 DATABANK   NAME=gpr9       START=0x900          END=0x9FF
-DATABANK   NAME=gpr10      START=0xA00          END=0xAFF
-DATABANK   NAME=gpr11      START=0xB00          END=0xBFF
-DATABANK   NAME=gpr12      START=0xC00          END=0xCFF
+// DATABANK   NAME=gpr10      START=0xA00          END=0xAFF		; Does not exists on PIC18F
+// DATABANK   NAME=gpr11      START=0xB00          END=0xBFF		; Does not exists on PIC18F
+// DATABANK   NAME=gpr12      START=0xC00          END=0xCFF		; Does not exists on PIC18F
 DATABANK   NAME=sfr13      START=0xD00          END=0xDFF          PROTECTED
 DATABANK   NAME=sfr14      START=0xE00          END=0xEFF          PROTECTED
 DATABANK   NAME=sfr15      START=0xF00          END=0xF5F          PROTECTED
--- a/code_part1/OSTC_code_asm_part1/customview.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/customview.asm	Tue Jan 04 15:14:42 2011 +0100
@@ -18,105 +18,130 @@
 ; Customviews for divemode
 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
 ; written: 101212
-; last updated: 101212
+; history:
+;   2010-12-12: [MH] last updated
+;   2011-01-04: [jDG] Saturation graphs in customview divemode
 ; known bugs:
 ; ToDo:
 
-customview_menu_entry3:		; Show the customview-dependent entry for the divemode menu
+;=============================================================================
+; Show the customview-dependent entry for the divemode menu
+;
+customview_menu_entry3:		
 	bcf		menu3_active	;=1: menu entry three in divemode menu is active
-	movff	menupos3,temp1		; copy
-	dcfsnz	temp1,F
-	bra		customview_menu3_stopwatch		; Show the stopwatch option in divemode menu
-	dcfsnz	temp1,F
-	bra		customview_menu3_marker			; Show the marker option in divemode menu
-	dcfsnz	temp1,F
-	bra		customview_menu3_clock			; Show the clock option in divemode menu
-	dcfsnz	temp1,F
-	bra		customview_menu3_lead_tiss		; Show the leading tissue option in divemode menu
+
+	movff	menupos3,WREG	            ; copy
+	dcfsnz	WREG,F
+	bra		customview_menu3_stopwatch  ; Show the stopwatch option in divemode menu
+	dcfsnz	WREG,F
+	bra		customview_menu3_marker     ; Show the marker option in divemode menu
+	dcfsnz	WREG,F
+	bra		customview_menu3_clock      ; Show the clock option in divemode menu
+	dcfsnz	WREG,F
+	bra		customview_menu3_lead_tiss  ; Show the leading tissue option in divemode menu
 	; Menupos3=0, do nothing
 	return
 
 customview_menu3_stopwatch:
-	bsf		menu3_active			; Set Flag
-	DISPLAYTEXT	.33					; ResetAvr
+	bsf		menu3_active                ; Set Flag
+	DISPLAYTEXT	.33                     ; ResetAvr
 	return
 
 customview_menu3_marker:
-	bsf		menu3_active			; Set Flag
-	DISPLAYTEXT	.30					; Set Marker
+	bsf		menu3_active                ; Set Flag
+	DISPLAYTEXT	.30                     ; Set Marker
 	return
 
-customview_menu3_clock:				; No menu entry
-customview_menu3_lead_tiss			; No menu entry
+customview_menu3_clock:                 ; No menu entry
+customview_menu3_lead_tiss              ; No menu entry
 	return
 
-customview_second:		; Do every-second tasks for the custom view area
-	movff	menupos3,temp1		; copy
-	dcfsnz	temp1,F
-	bra		customview_1sec_stopwatch		; Update the Stopwatch
-	dcfsnz	temp1,F
-	bra		customview_1sec_marker			; Update the Marker
-	dcfsnz	temp1,F
-	bra		customview_1sec_clock			; Update the Clock
-	dcfsnz	temp1,F
-	bra		customview_1sec_lead_tiss		; Update the leading tissue
+;=============================================================================
+; Do every-second tasks for the custom view area
+
+customview_second:                      
+	movff	menupos3,WREG               ; copy
+	dcfsnz	WREG,F
+	bra		customview_1sec_stopwatch   ; Update the Stopwatch
+	dcfsnz	WREG,F
+	bra		customview_1sec_marker      ; Update the Marker
+	dcfsnz	WREG,F
+	bra		customview_1sec_clock       ; Update the Clock
+	dcfsnz	WREG,F
+	bra		customview_1sec_lead_tiss   ; Update the leading tissue
+	dcfsnz	WREG,F
+	bra		customview_1sec_graphs      ; Update the leading tissue
 	; Menupos3=0, do nothing
 	return
 	
 customview_1sec_stopwatch:
-	call	PLED_stopwatch_show2	; Update figures only
+	call	PLED_stopwatch_show2        ; Update figures only
 	return
 
-customview_1sec_marker:				; Do nothing extra
-customview_1sec_lead_tiss:			; Do nothing extra
-customview_1sec_clock:				; Do nothing extra
+customview_1sec_marker:                 ; Do nothing extra
+customview_1sec_clock:                  ; Do nothing extra
+customview_1sec_lead_tiss:              ; Do nothing extra
+customview_1sec_graphs:                 ; Do nothing extra
 	return
 
+;=============================================================================
+; Do every-minute tasks for the custom view area
 
-customview_minute:		; Do every-minute tasks for the custom view area
-	movff	menupos3,temp1		; copy
-	dcfsnz	temp1,F
-	bra		customview_minute_stopwatch		; Update the Stopwatch
-	dcfsnz	temp1,F
-	bra		customview_minute_marker		; Update the Marker
-	dcfsnz	temp1,F
-	bra		customview_minute_clock			; Update the Clock
-	dcfsnz	temp1,F
-	bra		customview_minute_lead_tiss		; Update the leading tissue
+customview_minute:
+	movff	menupos3,WREG               ; copy
+	dcfsnz	WREG,F
+	bra		customview_minute_stopwatch ; Update the Stopwatch
+	dcfsnz	WREG,F
+	bra		customview_minute_marker    ; Update the Marker
+	dcfsnz	WREG,F
+	bra		customview_minute_clock     ; Update the Clock
+	dcfsnz	WREG,F
+	bra		customview_minute_lead_tiss ; Update the leading tissue
+	dcfsnz	WREG,F
+	bra		customview_minute_graphs	; Update the graphs
 	; Menupos3=0, do nothing
 	return
 
 customview_minute_clock:
-	call	PLED_diveclock2			; Update the clock
+	call	PLED_diveclock2             ; Update the clock
 	return
 
 customview_minute_lead_tiss:
-	call	PLED_show_leading_tissue_2 ; Update the leading tissue
+	call	PLED_show_leading_tissue_2  ; Update the leading tissue
 	return
 
-customview_minute_marker:			; Do nothing extra
-customview_minute_stopwatch:		; Do nothing extra
+customview_minute_graphs:
+	call	PLED_tissue_saturation_graph
+	return
+
+customview_minute_marker:               ; Do nothing extra
+customview_minute_stopwatch:            ; Do nothing extra
 	return
 
-customview_toggle:		; Yes, show next customview (and delete this flag)
+;=============================================================================
+; Yes, show next customview (and delete this flag)
+
+customview_toggle:		
 	ostc_debug	'X'		; Sends debug-information to screen if debugmode active
-	incf	menupos3,F			; Number of customview to show
-	movlw	d'4'				; Max number
-	cpfsgt	menupos3			; Max reached?
-	bra		customview_mask		; No, show
-	clrf	menupos3			; Reset to zero (Zero=no custom view)
+	incf	menupos3,F			            ; Number of customview to show
+	movlw	d'5'				            ; Max number
+	cpfsgt	menupos3			            ; Max reached?
+	bra		customview_mask		            ; No, show
+	clrf	menupos3			            ; Reset to zero (Zero=no custom view)
 customview_mask:	
 	call	PLED_clear_customview_divemode
-	movff	menupos3,temp1		; Menupos3 holds number of customview function
-	dcfsnz	temp1,F
+	movff	menupos3,WREG                   ; Menupos3 holds number of customview function
+	dcfsnz	WREG,F
 	bra		customview_init_stopwatch		; Show the Stopwatch
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		customview_init_marker			; Show the Marker-Menu
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		customview_init_clock			; Show the clock
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		customview_init_lead_tissue		; Show the leading tissue
-;	bra		customview_init_nocustomview	; menupos3=0 -> No Customview
+	dcfsnz	WREG,F
+	bra		customview_init_graphs		    ; Show the graphs
+
 customview_init_nocustomview:
 	bra		customview_toggle_exit	
 
@@ -125,7 +150,8 @@
 	call	PLED_stopwatch_show
 	bra		customview_toggle_exit	
 
-customview_init_marker:					; Init Marker 
+customview_init_marker:					; Init Marker
+    call    PLED_standard_color
 	DISPLAYTEXT		d'151'				; Set Marker?
 	bra		customview_toggle_exit	
 
@@ -137,14 +163,19 @@
 	call	PLED_show_leading_tissue
 	bra		customview_toggle_exit	
 
+customview_init_graphs:			        ; Show graphs
+	call	PLED_tissue_saturation_graph
+	bra		customview_toggle_exit	
+
 customview_toggle_exit:
 	bcf		toggle_customview			; Clear flag
-	ostc_debug	'Y'		; Sends debug-information to screen if debugmode active
+	ostc_debug	'Y'		                ; Sends debug-information to screen in debugmode
 	return
 
-
+;=============================================================================
+; Yes, show next customview (and delete this flag)
 
-surfcustomview_toggle:			; Yes, show next customview (and delete this flag)
+surfcustomview_toggle:
 	incf	menupos3,F			; Number of customview to show
 	movlw	d'4'				; Max number
 	cpfsgt	menupos3			; Max reached?
@@ -152,16 +183,16 @@
 	clrf	menupos3			; Reset to zero (Zero=no custom view)
 surfcustomview_mask:	
 	call	PLED_clear_customview_surfmode
-	movff	menupos3,temp1		; Menupos3 holds number of customview function
-	dcfsnz	temp1,F
+	movff	menupos3,WREG       ; Menupos3 holds number of customview function
+	dcfsnz	WREG,F
 	bra		surfcustomview_init_graphs			; Show the tissue graphs
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		surfcustomview_init_gaslist			; Show pre-dive gaslist/setpoint list
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		surfcustomview_init_interval		; Show the interval counter
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		surfcustomview_init_cfview			; Show the interval counter
-;	bra		surfcustomview_init_nocustomview	; menupos3=0 -> No Customview
+
 surfcustomview_init_nocustomview:
 	bra		surfcustomview_toggle_exit	
 
@@ -200,38 +231,40 @@
 
 surfcustomview_toggle_exit:
 	bcf		toggle_customview			; Clear flag
-
+    bra     surfcustomview_second
 
-
+;=============================================================================
+; Do every-second tasks for the custom view area
 
-surfcustomview_second:		; Do every-second tasks for the custom view area
-	movff	menupos3,temp1		; copy
-	dcfsnz	temp1,F
-	bra		surfcustomview_1sec_graphs		; Update the Graphs
-	dcfsnz	temp1,F
-	bra		surfcustomview_1sec_gaslist		; Update the Gaslist/SetPoint List
-	dcfsnz	temp1,F
-	bra		surfcustomview_1sec_interval	; Update the Interval display
-	dcfsnz	temp1,F
-	bra		surfcustomview_1sec_cfview		; Update the critical cf view
-	; Menupos3=0, do nothing
-	return
-surfcustomview_1sec_cfview:				; Do nothing extra
-surfcustomview_1sec_graphs:				; Do nothing extra
-surfcustomview_1sec_gaslist:			; Do nothing extra
-surfcustomview_1sec_interval:			; Do nothing extra
+surfcustomview_second:
+;	movff	menupos3,WREG               ; copy
+;	dcfsnz	WREG,F
+;	bra		surfcustomview_1sec_graphs		; Update the Graphs
+;	dcfsnz	WREG,F
+;	bra		surfcustomview_1sec_gaslist		; Update the Gaslist/SetPoint List
+;	dcfsnz	WREG,F
+;	bra		surfcustomview_1sec_interval	; Update the Interval display
+;	dcfsnz	WREG,F
+;	bra		surfcustomview_1sec_cfview		; Update the critical cf view
+;	; Menupos3=0, do nothing
+;	return
+;surfcustomview_1sec_cfview:				; Do nothing extra
+;surfcustomview_1sec_graphs:				; Do nothing extra
+;surfcustomview_1sec_gaslist:			; Do nothing extra
+;surfcustomview_1sec_interval:			; Do nothing extra
 	return
 
+;=============================================================================
 
 surfcustomview_minute:		; Do every-minute tasks for the custom view area
-	movff	menupos3,temp1		; copy
-	dcfsnz	temp1,F
+	movff	menupos3,WREG               ; copy
+	dcfsnz	WREG,F
 	bra		surfcustomview_minute_graphs		; Update the Graphs
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		surfcustomview_minute_gaslist		; Update the Gaslist/SetPoint List
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		surfcustomview_minute_interval		; Update the Interval display
-	dcfsnz	temp1,F
+	dcfsnz	WREG,F
 	bra		surfcustomview_minute_cfview			; Update the critical cf view
 	; Menupos3=0, do nothing
 	return
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Jan 04 15:14:42 2011 +0100
@@ -165,17 +165,17 @@
 	bra		diveloop_loop					; Loop the divemode
 
 timeout_premenu_divemode:
-	incf	timeout_counter3,F		; Yes...
+	incf	timeout_counter3,F              ; Yes...
 
-	GETCUSTOM8	d'4'				; loads premenu_timeout into WREG
-	cpfsgt	timeout_counter3		; ... longer then premenu_timeout
-	return							; No!
+	GETCUSTOM8	d'4'                        ; loads premenu_timeout into WREG
+	cpfsgt	timeout_counter3                ; ... longer then premenu_timeout
+	return                                  ; No!
 
-	bcf		premenu					; Yes, so clear "Menu?" and clear pre_menu bit
-	call	PLED_menu_clear			; Remove "Menu?"
+	bcf		premenu                         ; Yes, so clear "Menu?" and clear pre_menu bit
+	call	PLED_menu_clear                 ; Remove "Menu?"
 	return
 
-divemode_apnoe_tasks:						; 1 sec. Apnoe tasks
+divemode_apnoe_tasks:                       ; 1 sec. Apnoe tasks
 	call	PLED_display_apnoe_descent		; Show descent timer
 
 	btfsc	divemode2						; Time running?
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Tue Jan 04 15:14:42 2011 +0100
@@ -138,7 +138,7 @@
 	CF_DEFAULT    CF_INT15,	    d'0',   d'0',   0 		; logbook_offset			No Offset, but 15Bit value
 	CF_DEFAULT    CF_INT8,	    d'3',   d'2',   d'6'	; last_deco_depth			3m
 
-	CF_DEFAULT    CF_SEC,	    d'10',  d'1',   d'15'  ; timeout_apnoe_mode		10min
+	CF_DEFAULT    CF_SEC,	    d'10',  d'1',   d'15'   ; timeout_apnoe_mode		10min
 	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; show_voltage_value		=1 Show value instead of symbol, =0 Show Symbol
 
     ;---- BANK1 custom function defaults -------------------------------------
@@ -155,13 +155,13 @@
 	CF_DEFAULT    CF_INT15,     0,      0,      0 		; UNUSED
 	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; warn_ceiling_divemode		=1 Warn ceiling violation in divemode
 	CF_DEFAULT    CF_BOOL,      d'1',   0,      0 		; Show mix type is surfmode
-    
+
 	CF_DEFAULT    CF_BOOL,	    d'0',   0,      0       ; blink_gas_divemode 		=1 blink better gas
 	CF_DEFAULT    CF_INT15,     d'13000', 0,   d'13000' ; color_warn_depth_mBar		Warn depths
 	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'	; color_warn_cns_percent    Warn-%
 	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'  ; color_warn_gf_percent		Warn-%
 	CF_DEFAULT    CF_CENTI,     d'161', d'100', d'161'  ; color_warn_ppo2_cbar		ppO2 warn
-    
+
 	CF_DEFAULT    CF_INT8,	    d'15',  d'7',   d'20'	; color_warn_celocity_mmin	warn at xx m/min
 	CF_DEFAULT    CF_SEC,	    d'42',  d'0',   d'240'  ; time_correction_value_default	Adds to Seconds on Midnight
 	CF_DEFAULT    CF_BOOL,      d'1',   0,      0 		; CF#49 Show Altimeter in surface mode
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Jan 04 02:49:15 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Jan 04 15:14:42 2011 +0100
@@ -23,6 +23,7 @@
 ; History:
 ; 2008-06-06 [MH] last updated
 ; 2010-12-31 [jDG] Multi-page display for GF decoplan
+; 2011-01-04 [jDG] Saturation graphs in customview divemode
 ;
 ; known bugs:
 ; ToDo:	More comments
@@ -2511,7 +2512,7 @@
 	return						; no, return
 
 PLED_clear_divemode_menu:
-    WIN_BOX_BLACK   .0, .169, .82, .160
+    WIN_BOX_BLACK   .0, .168, .82, .160
 	return
 
 PLED_divemenu_cursor:
@@ -2550,31 +2551,71 @@
 ;;	DISPLAYTEXT	.132					;"Format"
 ;	return
 
-;PLED_saturation_graph_divemode:
-;	ostc_debug	'h'		; Sends debug-information to screen if debugmode active
+
+;=============================================================================
+; Draw saturation graph, is surface mode or in dive mode.
+;
 PLED_tissue_saturation_graph:
 	ostc_debug	'i'		; Sends debug-information to screen if debugmode active
 
-;; Clear graph area...
-;   WIN_BOX_BLACK  .25, .120, .82, .159
-
-; Draw Frame
-    WIN_FRAME_STD   .25, .120, .82, .159
-
-; Draw N2 Tissues
+    ;---- Draw Frame ---------------------------------------------------------
+    btfsc   divemode
+    bra     PLED_tsg_1
+    
+    WIN_FRAME_STD   .25, .120, .82, .159    ; Surfmode
+    bra     PLED_tsg_2
+PLED_tsg_1:    
+    WIN_FRAME_STD   .169, .239, .90, .159   ; Divemode
+PLED_tsg_2:
+
+    ;---- Draw grid ----------------------------------------------------------
+	movlw   color_grey
+    call	PLED_set_color
+
+	movlw	.25+.1                      ; surfmode
+    btfsc   divemode
+    movlw   .169+.1                     ; divemode
+	movff	WREG,win_top
+	
+	movlw	.120-.25-.1                 ; surfmode
+    btfsc   divemode
+    movlw   .239-.169-.1                ; divemode
+	movff	WREG,win_height
+
+    movlw   1
+    movff   WREG,win_width
+
+    movlw   .122
+    movff   WREG,win_leftx2
+    call    PLED_box
+    movlw   .131
+    movff   WREG,win_leftx2
+    call    PLED_box
+    movlw   .140
+    movff   WREG,win_leftx2
+    call    PLED_box
+    movlw   .149
+    movff   WREG,win_leftx2
+    call    PLED_box
+    
+    ;---- Draw N2 Tissues ----------------------------------------------------
 	lfsr	FSR2, char_O_tissue_saturation+.000	; N2
 	movlw	d'16'
-	movwf	wait_temp		; 16 tissues
-	clrf	waitms_temp		; Row offset
-
+	movwf	wait_temp                   ; 16 tissues
+	clrf	waitms_temp                 ; Row offset
+
+    call    PLED_standard_color
 	movlw	.1
 	movff	WREG,win_height             ; row bottom (0-239)
-	movlw	.100
+	movlw	.82+.18                     ; surfmode
+    btfsc   divemode
+    movlw   .90+.10                     ; divemode
 	movff	WREG,win_leftx2             ; column left (0-159)
 
 PLED_tissue_saturation_graph3:
-
-	movlw	.28
+	movlw	.25+3                       ; surfmode: 3pix below top border
+    btfsc   divemode
+    movlw   .169+3                      ; divemode
 	addwf	waitms_temp,W
 	movff	WREG,win_top                ; row top (0-239)
 
@@ -2596,21 +2637,17 @@
 	decfsz	wait_temp,F
 	bra		PLED_tissue_saturation_graph3
 
-; Draw He Tissues
+    ;---- Draw He Tissues ----------------------------------------------------
 	lfsr	FSR2, char_O_tissue_saturation+.016	; He
 	movlw	d'16'
-	movwf	wait_temp		; 16 tissues
-	clrf	waitms_temp		; Row offset
-
-;	movlw	.1
-;	movff	WREG,win_height             ; row bottom (0-239)
-;	movlw	.100
-;	movff	WREG,win_leftx2             ; column left (0-159)
-;   call    PLED_standard_color
+	movwf	wait_temp                   ; 16 tissues
+	clrf	waitms_temp                 ; Row offset
 
 PLED_tissue_saturation_graph2:
 
-	movlw	.86
+	movlw	.120-.33                    ; surfmode : 33pix above bottom border
+    btfsc   divemode
+    movlw   .239-.33                    ; divemode
 	addwf	waitms_temp,W
 	movff	WREG,win_top                ; row top (0-239)
 
@@ -2632,13 +2669,27 @@
 	decfsz	wait_temp,F
 	bra		PLED_tissue_saturation_graph2
 
-; Draw Text
-	WIN_LEFT	.84
-	WIN_TOP		.32
+    ;---- Draw N2/He Text ----------------------------------------------------
+	movlw	.82+2                       ; surfmode: 2pix right of left border
+    btfsc   divemode
+    movlw   .90+2                       ; divemode
+    movff   WREG,win_leftx2
+
+	movlw	.25+7                       ; surfmode: 7pix below top border
+    btfsc   divemode
+    movlw   .169+7                      ; divemode
+    movff   WREG,win_top
 	STRCPY_PRINT  "N2"
 
-	WIN_TOP		.90
+	movlw	.120-.30                    ; surfmode: 30pix above bottom border
+    btfsc   divemode
+    movlw   .239-.30                    ; divemode
+    movff   WREG,win_top
 	STRCPY_PRINT  "He"
+	
+    ;---- Draw scale and O2[16]% ---------------------------------------------
+    btfsc   divemode
+    return
 
 	movff	char_O_gtissue_no,wait_temp			; used as temp
 
@@ -2650,16 +2701,16 @@
 	decfsz	wait_temp,F			; count until zero
 	bra		PLED_tissue_saturation_graph4	;loop
 
-	lfsr	FSR2,letter
-	output_8
-	STRCAT  "% "
-
 	WIN_TOP		.62
 	WIN_FONT	FT_SMALL
-	call	word_processor
+	lfsr	FSR2,letter
+	bsf		leftbind
+	output_8
 	bcf		leftbind
 
-; Draw Scale
+	STRCAT_PRINT  "% "
+
+    ;---- Draw Scale ---------------------------------------------------------
     WIN_BOX_STD .73, .74, .121, .157
     WIN_BOX_STD .61, .84, .121, .122
     WIN_BOX_STD .65, .80, .130, .131
@@ -2668,6 +2719,8 @@
     WIN_BOX_STD .61, .84, .157, .158
 	return
 
+;=============================================================================
+
 PLED_startupscreen1:
 	call	PLED_topline_box
 	WIN_INVERT	.1	; Init new Wordprocessor