view code_part1/OSTC_code_c_part2/old/p2_deco_main_old_v107.c @ 0:96a35aeda5f2

Initial setup
author heinrichsweikamp
date Tue, 12 Jan 2010 15:05:59 +0100
parents
children
line wrap: on
line source

/*
 * p2_deco_main_c_v107.c
 *
 *  Created on: 31.03.2009
 *      Author: chsw
 */

//#include <p2_deco_header_c_v102d.h>


// OSTC - diving computer code
// Copyright (C) 2008 HeinrichsWeikamp GbR

//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.

//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.

//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.


// *****************************
// ** I N T R O D U C T I O N **
// *****************************
//
// OSTC
//
// code:
// p2_deco_main_c_v101.c
// part2 of the OSTC code
// code with constant O2 partial pressure routines
// under construction !!
//
// summary:
// decompression routines
// for the OSTC experimental project
// written by Christian Weikamp
// last revision __________
// comments added _________
//
// additional files:
// p2_tables_v100.romdata (other files)
// 18f4685_ostc_v100.lkr (linker script)
//
// history:
// 01/03/08 v100: first release candidate
// 03/13/08 v101: start of programming ppO2 code
// 03/13/25 v101a: backup of interrim version with ppO2 calculation
// 03/13/25 v101: open circuit gas change during deco
// 03/13/25 v101: CNS_fraction calculation
// 03/13/26 v101: optimization of tissue calc routines
// 07/xx/08 v102a: debug of bottom time routine
// 09/xx/08 v102d: Gradient Factor Model implemenation
// 10/10/08 v104: renamed to build v103 for v118 stable
// 10/14/08	v104: integration of temp_depth_last_deco for Gradient Model
// 03/31/090 v107: integration of FONT Incon24

//
// literature:
// B"uhlmann, Albert: Tauchmedizin; 4. Auflage;
// Schr"oder, Kai & Reith, Steffen; 2000; S"attigungsvorg"ange beim Tauchen, das Modell ZH-L16, Funktionsweise von Tauchcomputern; http://www.achim-und-kai.de/kai/tausim/saett_faq
// Morrison, Stuart; 2000; DIY DECOMPRESSION; http://www.lizardland.co.uk/DIYDeco.html
// Balthasar, Steffen; Dekompressionstheorie I: Neo Haldane Modelle; http://www.txfreak.de/dekompressionstheorie_1.pdf
// Baker, Erik C.; Clearing Up The Confusion About "Deep Stops"
// Baker, Erik C.; Understanding M-values; http://www.txfreak.de/understanding_m-values.pdf


// *********************
// ** I N C L U D E S **
// *********************
 #include <p18f4685.h>
 #include <math.h>

// ********************************
// ** C O N F I G U R A T I O N  **
// ** for simulation without asm **
// ********************************
 #pragma config OSC = IRCIO67
 #pragma config FCMEN = OFF
 #pragma config IESO = OFF
 #pragma config PWRT = ON
 #pragma config BOREN = OFF
 #pragma config WDT = OFF
 #pragma config WDTPS = 128
 #pragma config MCLRE = ON
 #pragma config LPT1OSC = OFF
 #pragma config PBADEN = OFF
 #pragma config DEBUG = OFF
 #pragma config XINST = OFF
 #pragma config LVP = OFF
 #pragma config STVREN = OFF

// ****************************
// ** D E F I N E S          **
// ** missing in  p18f4685.h **
// ****************************
#define INT0IF	1
#define INT1IF	0
#define TMR1IF	0

#define oled_clk			PORTD, 0,0
#define oled_data			PORTD, 1,0
#define oled_en				PORTE, 0,0
#define oled_rs				PORTE, 1,0
#define flag5				0x29	// in Bank1
//#define	no_sensor_int		flag5,7,1	// ; block any further access to pressure sensor

// ***********************
// ** V A R I A B L E S **
// ***********************
// prefixes etc:
// _O_ = output for use in the assembler code
// _I_ = input from the assembler code for the c code
// char_ and int_ = used to identify output and input size
// var = variable (from b"uhlmann)
// pres = pressure
// gtissue = guiding tissue, the one limiting the ascent
// e2secs = exp of the b"uhlmann formula precalculated for a 2 second step
// e1min = same for 1 minute step
// sim = used in simulating the ascent to the surface
// nullzeit = remaining ground/bottom time for "no deco"
// hauptroutine = main

#pragma udata bank0a=0x060
volatile unsigned char dd2_stringstore[17];
#pragma udata bank0b=0x071
volatile unsigned char keep_free_bank0[21];

#pragma udata bank0c=0x086
volatile unsigned char dd2_left;		// 1 - 64
volatile unsigned char dd2_top;			// 1 - 64
volatile unsigned char dd2_heightmax; 	// 1 - 37
volatile unsigned char dd2_oled_brightness_offset; // 0 - 15 (15 is pitch black always)
volatile unsigned char dd2_fontwidth;	//  8, 12, 21 for Incon16, Incon24, Incon42
volatile unsigned char dd2_fontheight;	// 14, 21, 37 for "
volatile unsigned long dd2_pointer;		// for font lut
volatile unsigned char dd2_i;
volatile unsigned char dd2_j;
volatile unsigned char dd2_k;
volatile unsigned char dd2_char;
volatile unsigned char dd2_lowbyte;
volatile unsigned char dd2_temp;
volatile unsigned char dd2_data;
volatile unsigned long dd2_base;			// for font lut
volatile unsigned char dd2_start;			// for font lut
volatile unsigned char dd2_end;			// for font lut


 #pragma udata bank1=0x100
 const unsigned char keep_free_bank1[256]; // used by the assembler code

 #pragma udata bank2a=0x200
// output:
 static unsigned int	int_O_tissue_for_debug[32];
 static unsigned int	int_O_GF_spare____;						// 0x240
 static unsigned int	int_O_GF_step;							// 0x242
 static unsigned int 	int_O_gtissue_limit;					// 0x244
 static unsigned int 	int_O_gtissue_press;					// 0x246
 static unsigned int 	int_O_limit_GF_low;						// 0x248
 static unsigned int 	int_O_gtissue_press_at_GF_low;			// 0x24A
// ...
 #pragma udata bank2b=0x24E
 static unsigned char	char_O_GF_low_pointer;					// 0x24E
 static unsigned char	char_O_actual_pointer;					// 0x24F
 #pragma udata bank2c=0x250
 static unsigned char	char_O_deco_table[32];					// 0x250
 #pragma udata bank2d=0x270
 static unsigned char	char_I_table_deco_done[32];
 #pragma udata bank2e=0x290
 static unsigned int 	int_O_calc_tissue_call_counter;			// 0x290



// internal:
 unsigned char 			lock_GF_depth_list;
 static float			temp_limit;
 static float			GF_low;
 static float			GF_high;
 static float			GF_delta;
 static float			GF_temp;
 static float			GF_step;
 static float			GF_step2;
 static float			temp_pres_gtissue;
 static float			temp_pres_gtissue_diff;
 static float			temp_pres_gtissue_limit_GF_low;
 static float			temp_pres_gtissue_limit_GF_low_below_surface;
 static	unsigned int	temp_depth_limit;
 static unsigned char	temp_decotime;
 static unsigned char	temp_gtissue_no;
 static	unsigned int	temp_depth_last_deco;				// new in v.101

 static unsigned char	temp_depth_GF_low_meter;
 static unsigned char	temp_depth_GF_low_number;
 static unsigned char	internal_deco_pointer;
 static unsigned char	internal_deco_table[32];
 static float			temp_pres_deco_GF_low;

static unsigned int debug_temp;


#pragma udata bank3a=0x300
static char output[32];
// used by the math routines
#pragma udata bank3b=0x380
volatile float pres_tissue_vault[32];
 #pragma udata bank4a=0x400
// internal:
 unsigned char			ci ; // don't move - used in _asm routines - if moved then modify movlb commands
 unsigned char 			x;
 unsigned int 			main_i;
 unsigned int 			int_temp;
 unsigned int 			int_temp_decostatus;
 static float 			pres_respiration;
 static float			pres_surface;
 static float			temp1;
 static float			temp2;
 static float			temp3;
 static float			temp4;
 static float			temp_deco;
 static float			temp_atem;
 static float			temp2_atem;
 static float			temp_tissue;
 static float			temp_surface;
 static float			N2_ratio;
 static float			He_ratio;
 static float			temp_ratio;
 static float 			var_a;
 static float 			var2_a;
 static float 			var_b;
 static float 			var2_b;
 static float 			var_t05nc;
 static float 			var2_t05nc;
 static float  			var_e2secs;
 static float  			var2_e2secs;
 static float  			var_e1min;
 static float  			var2_e1min;
 static float  			var_halftimes;
 static float  			var2_halftimes;
 static float			pres_gtissue_limit;
 static float			temp_pres_gtissue_limit;
 static float			actual_ppO2;						// new in v.102
 #pragma udata bank4b=0x480
 static float			pres_tissue[32];

 #pragma udata bank5=0x500
// don't move positions in this bank, the registers are addressed directly from assembler code
// input:
 static unsigned int	int_I_pres_respiration;				// 0x500
 static unsigned int	int_I_pres_surface;					// 0x502
 static unsigned int	int_I_temp;							// 0x504  new in v101
 static unsigned char	char_I_temp;						// 0x506  new in v101
 static unsigned char	char_I_actual_ppO2;					// 0x507
 static unsigned int	int_I_spare_3;
 static unsigned int	int_I_spare_4;
 static unsigned int	int_I_spare_5;
 static unsigned int	int_I_spare_6;
 static unsigned char	char_I_N2_ratio;					// 0x510
 static unsigned char	char_I_He_ratio;					// 0x511
 static unsigned char	char_I_saturation_multiplier;		// for conservatism/safety values 1.0 (no conservatism) to 1.5 (50% faster saturation
 static unsigned char	char_I_desaturation_multiplier; 	// for conservatism/safety values 0.66 (50% slower desaturation) to 1.0 (no conservatism)// consveratism used in calc_tissue(), calc_tissue_step_1_min() and sim_tissue_1min()
 static unsigned char	char_I_GF_High_percentage;			// 0x514	new in v.102
 static unsigned char	char_I_GF_Low_percentage;			// 0x515	new in v.102
 static unsigned char	char_I_spare;					// 0x516
 static unsigned char	char_I_deco_distance;				// 0x517
 static unsigned char	char_I_const_ppO2;					// 0x518	new in v.101
 static unsigned char	char_I_deco_ppO2_change;			// 0x519	new in v.101
 static unsigned char	char_I_deco_ppO2;					// 0x51A	new in v.101
 static unsigned char	char_I_deco_gas_change;				// 0x51B	new in v.101
 static unsigned char	char_I_deco_N2_ratio;				// 0x51C	new in v.101
 static unsigned char	char_I_deco_He_ratio;				// 0x51D	new in v.101
 static unsigned char	char_I_depth_last_deco;				// 0x51E	new in v.101 unit: [m]
 static unsigned char	char_I_deco_model;					// 0x51F	new in v.102	( 1 = MultiGraF, sonst Std. mit (de-)saturation_multiplier)
// output:
 static unsigned int	int_O_desaturation_time;			// 0x520
 static unsigned char	char_O_nullzeit;					// 0x522
 static unsigned char	char_O_deco_status;					// 0x523
 static unsigned char	char_O_array_decotime[7];			// 0x524
 static unsigned char	char_O_array_decodepth[6];			// 0x52B
 static unsigned char	char_O_ascenttime;					// 0x531
 static unsigned char	char_O_gradient_factor;				// 0x532
 static unsigned char	char_O_tissue_saturation[32];		// 0x533
 static unsigned char	char_O_array_gradient_weighted[16];	// 0x553
 static unsigned char	char_O_gtissue_no;					// 0x563
 static unsigned char	char_O_diluent;						// 0x564	new in v.101
 static unsigned char	char_O_CNS_fraction;				// 0x565	new in v.101
 static unsigned char	char_O_relative_gradient_GF;		// 0x566	new in v.102
// internal:
 static float			pres_tissue_limit[16];
 static float			sim_pres_tissue_limit[16];
 static float			pres_diluent;						// new in v.101
 static float			deco_diluent;						// new in v.101
 static float			const_ppO2;							// new in v.101
 static float			deco_ppO2_change;					// new in v.101
 static float			deco_ppO2;							// new in v.101



 #pragma udata bank6=0x600
// internal:
 static float			sim_pres_tissue[32];
 static float			sim_pres_tissue_backup[32];

 #pragma udata bank7=0x700
 const unsigned char keep_free_bank7[256]; // used by the assembler code (DD font2display)

 #pragma udata bank8=0x800
 static char			md_pi_subst[256];

 #pragma udata bank9=0x900
// output:
 static char			md_state[48];		// DONT MOVE !! has to be at the beginning of bank 9 for the asm code!!!
// internal:
 static char			md_t;
 static char			md_buffer[16];
 static char			md_cksum[16];
 static char			md_i;
 static char			md_j;
 static char			md_temp;
 static unsigned int	md_pointer;
 static float			deco_N2_ratio;						// new in v.101
 static float			deco_He_ratio;						// new in v.101
 static float			calc_N2_ratio;						// new in v.101
 static float			calc_He_ratio;						// new in v.101
 static float			deco_gas_change;					// new in v.101
 static float			CNS_fraction;						// new in v.101
 static float			float_saturation_multiplier;		// new in v.101
 static float			float_desaturation_multiplier;		// new in v.101
 static float			float_deco_distance;				// new in v.101



// *************************
// ** P R O T O T Y P E S **
// *************************
void main_calc_hauptroutine(void);
void main_calc_without_deco(void);
void main_clear_tissue(void);
void main_calc_percentage(void);
void main_calc_wo_deco_step_1_min(void);
void main_debug(void);
void main_gradient_array(void);
void main_hash(void);

void calc_hauptroutine(void);
void calc_tissue(void);
void calc_nullzeit(void);
void backup_sim_pres_tissue(void);
void restore_sim_pres_tissue(void);

void calc_without_deco(void);
void clear_tissue(void);
void calc_ascenttime(void);
void update_startvalues(void);
void clear_decoarray(void);
void update_decoarray(void);
void sim_tissue_1min(void);
void sim_tissue_10min(void);
void calc_gradient_factor(void);
void calc_gradient_array_only(void);
void calc_desaturation_time(void);
void calc_wo_deco_step_1_min(void);
void calc_tissue_step_1_min(void);
//void debug(void);
void hash(void);
void clear_CNS_fraction(void);
void calc_CNS_fraction(void);
void calc_CNS_decrease_15min(void);
void calc_percentage(void);
void main(void);
void calc_hauptroutine_data_input(void);
void calc_hauptroutine_update_tissues(void);
void calc_hauptroutine_calc_deco(void);
void calc_hauptroutine_calc_ascend_to_deco(void);
//void build_debug_output(void);
void calc_nextdecodepth_GF(void);
void copy_deco_table_GF(void);
void clear_internal_deco_table_GF(void);
void update_internal_deco_table_GF(void);
void DD2_write(void);
void DD2_write_incon42(void);
void DD2_get_pointer_to_char(void);//dd2_char, &dd2_pointer);
void DD2_set_column(void);//top, dd2_k);void DD2_load_background(void);//&dd2_columnstore, &dd2_background, dd2_top, dd2_left, dd2_heightmax);
void DD2_load_background(void);
void DD2_build_one_line_of_char(void);//&dd2_columnstore, &dd2_pointer, dd2_fontheight, dd2_lowbyte);
void DD2_print_column(void);//&dd2_columnstore, dd2_heightmax);
void DD2_CmdWrite(void);
void DD2_DataWrite(void);
void push_tissues_to_vault(void);
void pull_tissues_from_vault(void);
void main_push_tissues_to_vault(void);
void main_pull_tissues_from_vault(void);

// *******************************
// ** start                     **
// ** necessary for compilation **
// *******************************
#pragma romdata der_code = 0x0000
#pragma code der_start = 0x0000
void der_start(void)
{
_asm
	goto	main
_endasm
}

// ***********************************
// ** main code for simulation /    **
// ** tests without assembler code  **
// ** is NOT a part of the OSTC     **
// ***********************************
#pragma code main = 0x9000
void main(void)
{
#if 1
// new main to test DR-5

GF_low = 1.0;
GF_high = 1.0;

GF_temp = GF_low * GF_high;

clear_CNS_fraction();
//char_I_const_ppO2 = 100;
//for (main_i=0;main_i<255;main_i++)
//{
//calc_CNS_fraction();
//} //for




int_I_pres_respiration = 1000;//980;
int_I_pres_surface = 1000;//980;
char_I_N2_ratio = 39; //38;
char_I_He_ratio = 40; //50;
char_I_deco_distance = 0; // 10 = 1 meter
char_I_depth_last_deco = 3;	// values below 3 (meter) are ignored

char_I_const_ppO2 = 0;
char_I_deco_ppO2_change = 0; // [dm] 10 = 1 meter
char_I_deco_ppO2 = 0;

char_I_deco_gas_change = 0; // [m] 1 = 1 meter
char_I_deco_N2_ratio = 0;
char_I_deco_He_ratio = 0;

//char_I_actual_ppO2;					// 0x507
char_I_GF_High_percentage = 100;			// 0x514	new in v.102
char_I_GF_Low_percentage = 100;			// 0x515	new in v.102

char_I_saturation_multiplier = 110;
char_I_desaturation_multiplier = 90;

char_I_deco_model = 0;

main_clear_tissue();

int_I_pres_respiration = 1000 + int_I_pres_surface;
main_calc_wo_deco_step_1_min();
int_I_pres_respiration = 3000 + int_I_pres_surface;
main_calc_wo_deco_step_1_min();
int_I_pres_respiration = 5000 + int_I_pres_surface;
main_calc_wo_deco_step_1_min();


int_I_pres_respiration = 6000 + int_I_pres_surface;
for (main_i=0;main_i<27;main_i++)
	main_calc_wo_deco_step_1_min();

char_O_deco_status = 255;
while (char_O_deco_status)
	main_calc_hauptroutine();
_asm
nop
_endasm

for (main_i=0;main_i<50;main_i++)
{
main_calc_hauptroutine();
}
int_I_pres_respiration = 10000;
for (main_i=0;main_i<1500;main_i++)
{
main_calc_hauptroutine();
}

_asm
nop
_endasm


int_I_pres_respiration = 3000;
for (main_i=0;main_i<150;main_i++)
{
	calc_hauptroutine_data_input();
	calc_hauptroutine_update_tissues();
} //for

			update_startvalues();
			clear_decoarray();
			clear_internal_deco_table_GF();
			calc_hauptroutine_calc_ascend_to_deco();
 			if (char_O_deco_status > 15)		// can't go up to first deco, too deep to calculate in the given time slot
			{
				char_O_deco_status = 2;
//				char_O_lock_depth_list = 255;
			}
 			else
			{
//				char_O_lock_depth_list = lock_GF_depth_list;
				calc_hauptroutine_calc_deco();
			}
//			build_debug_output();

_asm
nop
_endasm
while (char_O_deco_status == 1)
{
			char_O_deco_status = 0;
//			char_O_lock_depth_list = 255;
			calc_hauptroutine_calc_deco();
//			build_debug_output();
_asm
nop
_endasm
};
debug_temp = 60; // [mtr Aufstieg in 10 mtr/min (30steps'2sec/min]
int_I_pres_respiration = 9980;
for (main_i=0;main_i<debug_temp;main_i++)
{
int_I_pres_respiration = int_I_pres_respiration - 33;
	calc_hauptroutine_data_input();
	calc_hauptroutine_update_tissues();
int_I_pres_respiration = int_I_pres_respiration - 33;
	calc_hauptroutine_data_input();
	calc_hauptroutine_update_tissues();
int_I_pres_respiration = int_I_pres_respiration - 34;
	calc_hauptroutine_data_input();
	calc_hauptroutine_update_tissues();
} //for
_asm
nop
_endasm

			update_startvalues();
			clear_decoarray();
			clear_internal_deco_table_GF();
			calc_hauptroutine_calc_ascend_to_deco();
 			if (char_O_deco_status > 15)		// can't go up to first deco, too deep to calculate in the given time slot
			{
				char_O_deco_status = 2;
//				char_O_lock_depth_list = 255;
			}
 			else
			{
//				char_O_lock_depth_list = lock_GF_depth_list;
				calc_hauptroutine_calc_deco();
			}
//			build_debug_output();

_asm
nop
_endasm
while (char_O_deco_status == 1)
{
			char_O_deco_status = 0;
//			char_O_lock_depth_list = 255;
			calc_hauptroutine_calc_deco();
//			build_debug_output();
_asm
nop
_endasm
};
_asm
nop
_endasm
debug_temp = 60; // [mtr Aufstieg in 10 mtr/min (30steps'2sec/min]
int_I_pres_respiration = 9980;
debug_temp = debug_temp * 3;
for (main_i=0;main_i<debug_temp;main_i++)
{
	calc_hauptroutine_data_input();
	calc_hauptroutine_update_tissues();
} //for
_asm
nop
_endasm
#endif
// -----------------------

} // main

// ******************************************************
// ******************************************************
// ** THE FOLLOWING CODE HAS TO BE COPPIED TO THE OSTC **
// ******************************************************
// ******************************************************

// ***********************
// ***********************
// ** THE SUBROUTINES 2 **
// ***********************
// ***********************
// all new in v.102

#pragma code subroutines2 = 0x0D000	// can be adapted to fit the romdata tables ahead

// -------------------------
// calc_next_decodepth_GF //
// -------------------------
// new in v.102
void calc_nextdecodepth_GF(void)
{
// INPUT, changing during dive:
// temp_pres_gtissue_limit_GF_low
// temp_pres_gtissue_limit_GF_low_below_surface
// temp_pres_gtissue
// temp_pres_gtissue_diff
// lock_GF_depth_list

// INPUT, fixed during dive:
// pres_surface
// GF_delta
// GF_high
// GF_low
// temp_depth_last_deco
// float_deco_distance

// OUTPUT
// GF_step
// temp_deco
// temp_depth_limt
// lock_GF_depth_list

// USES
// temp1
// temp2
// int_temp

	char_I_table_deco_done[0] = 0; // safety if changed somewhere else. Needed for exit
	if (char_I_deco_model == 1)
	{
		if (lock_GF_depth_list == 0)
		{
			temp2 =  temp_pres_gtissue_limit_GF_low_below_surface / 0.29985; 					// = ... / 99.95 / 0.003;
 			int_temp = (int) (temp2 + 0.99);
			if (int_temp > 31)
				int_temp = 31;						//	deepest deco at 93 meter (31 deco stops)
			if (int_temp < 0)
				int_temp = 0;
			temp_depth_GF_low_number = int_temp;
 			temp_depth_GF_low_meter = 3 * temp_depth_GF_low_number;
			temp2 = (float)temp_depth_GF_low_meter * 0.09995;
			temp_pres_deco_GF_low = temp2 + float_deco_distance + pres_surface;
			if (temp_depth_GF_low_number == 0)
				GF_step = 0;
			else
				GF_step = GF_delta / (float)temp_depth_GF_low_number;
			if (GF_step < 0)
				GF_step = 0;
			if (GF_step > GF_delta)
				GF_step = GF_delta;
			int_O_GF_step = (int)(GF_step * 10000);
			int_O_limit_GF_low = (int)(temp_pres_deco_GF_low * 1000);
			int_O_gtissue_press_at_GF_low = (int)(temp_pres_gtissue * 1000);
			char_O_GF_low_pointer = temp_depth_GF_low_number;
			lock_GF_depth_list = 1;
			internal_deco_pointer = 0;
		}
		if (internal_deco_pointer == 0)		// new run
		{
			internal_deco_pointer = temp_depth_GF_low_number;
			GF_temp = GF_high - ((float)internal_deco_pointer * GF_step);
			int_temp = char_I_table_deco_done[internal_deco_pointer];
			output[8] = int_temp;
			output[9] = 33;
		}
		else
		{
			int_temp = 1;
		}
		while (int_temp == 1)
		{
			int_temp = internal_deco_pointer - 1;
			if (int_temp == 1)								// new in v104
			{
				temp2 = (float)(temp_depth_last_deco * int_temp) * 0.09995;
				GF_step2 = GF_step/3.0 * ((float)(6 - temp_depth_last_deco));
			}
			else
			if (int_temp == 0)
			{
				temp2 = 0.0;
				GF_step2 = GF_high - GF_temp;
			}
			else
			{
				temp2 = (float)(3 *int_temp) * 0.09995;
				GF_step2 = GF_step;
			}
			temp2 = temp2 + pres_surface; // next deco stop to be tested
			temp1 = ((GF_temp + GF_step2)* temp_pres_gtissue_diff) + temp_pres_gtissue;	// upper limit (lowest pressure allowed) // changes GF_step2 in v104
			if (temp1 > temp2) // check if ascent to next deco stop is ok
			{
				int_temp = 0;	// no
			}
			else
			{
				internal_deco_pointer = int_temp;
				GF_temp = GF_temp + GF_step2; // changed in v104
				int_temp = char_I_table_deco_done[internal_deco_pointer]; // yes and check for ascent to even next stop if deco_done is set
			}
		} // while
		if (internal_deco_pointer > 0)
		{
			temp2 = (float)(0.29985 * internal_deco_pointer);
			temp_deco = temp2 + float_deco_distance + pres_surface;
			if (internal_deco_pointer == 1)						// new in v104
				temp_depth_limit = temp_depth_last_deco;
			else
				temp_depth_limit = 3 * internal_deco_pointer;
			if (output[9] == 33)
			{
				output[9] = internal_deco_pointer;
				output[10] = char_I_table_deco_done[internal_deco_pointer];
				output[12] = output[12] + 1;
				if (output[12] == 100)
					output[12] = 0;
			}
		}
		else	// 	if (char_I_deco_model == 1)
		{
			temp_deco = pres_surface;
			temp_depth_limit = 0;
		}
	}
	else
	{
		// calc_nextdecodepth - original
		// optimized in v.101
		// depth_last_deco included in v.101

		temp1 = temp_pres_gtissue_limit - pres_surface;
		if (temp1 >= 0)
 		{
 			temp1 = temp1 / 0.29985; 									// = temp1 / 99.95 / 0.003;
 			temp_depth_limit = (int) (temp1 + 0.99);
 			temp_depth_limit = 3 * temp_depth_limit; 					// depth for deco [m]
 			if (temp_depth_limit == 0)
  				temp_deco = pres_surface;
 			else
  			{
  				if (temp_depth_limit < temp_depth_last_deco)
					temp_depth_limit = temp_depth_last_deco;
  				temp1 = (float)temp_depth_limit * 0.09995;
  				temp_deco = temp1 + float_deco_distance + pres_surface; 	// depth for deco [bar]
  			} // if (temp_depth_limit == 0)
 		} // if (temp1 >= 0)
		else
 		{
 			temp_deco = pres_surface;
 			temp_depth_limit = 0;
 		} // if (temp1 >= 0)
	} // calc_nextdecodepth original
} // calc_nextdecodepth_GF


#if 0
void 			build_debug_output(void)
{
output[0] = 0; // not used in asm PLED output
output[1] = (int) (GF_low * 100);
output[2] = (int) (GF_high * 100);
output[3] = (int) (GF_step * 100);
output[4] = (int) temp_depth_GF_low_number;
output[5] = (int) temp_depth_GF_low_meter;
//output[6]
output[7] = (int) internal_deco_pointer;
//output[8] = char_I_table_deco_done[temp_depth_GF_low_number]
//output[9] = internal_deco_pointer @ new run
//output[10] = char_I_table_deco_done[internal_deco_pointer] @ new run
output [11] = (int) (temp_pres_deco_GF_low * 10);
}	// build_debug_output
#endif

// ---------------------
// copy_deco_table_GF //
// ---------------------
// new in v.102
void copy_deco_table_GF(void)
{
	if (char_I_deco_model == 1)
	{
		int_temp = 32;
		for (ci=0;ci<int_temp;ci++)
			char_O_deco_table[ci] = internal_deco_table[ci];
	}
}		// copy_deco_table_GF


// ------------------------------
// clear_internal_deco_table_GF//
// ------------------------------
// new in v.102
void clear_internal_deco_table_GF(void)
{
	if (char_I_deco_model == 1)
	{
		for (ci=0;ci<32;ci++)  // cycle through the 16 b"uhlmann tissues for Helium
		{
			internal_deco_table[ci] = 0;
		}
	}
}	// clear_internal_deco_table_GF


// --------------------------------
// update_internal_deco_table_GF //
// --------------------------------
// new in v.102
void update_internal_deco_table_GF(void)
{
	if ((char_I_deco_model == 1) && (internal_deco_table[internal_deco_pointer] < 255))
		internal_deco_table[internal_deco_pointer] = internal_deco_table[internal_deco_pointer] + 1;
}	// update_internal_deco_table_GF


// ---------------------
// temp_tissue_safety //
// ---------------------
// outsourced in v.102
void temp_tissue_safety(void)
{
	if (char_I_deco_model == 1)
	{
	}
	else
	{
		if (temp_tissue < 0.0)
			temp_tissue = temp_tissue * float_desaturation_multiplier;
 		else
			temp_tissue = temp_tissue * float_saturation_multiplier;
	}
} // temp_tissue_safety

// ---------------------
// dd2_write_incon42  //
// ---------------------
void DD2_write_incon42(void)
{
//dd2_fontwidth	= 21;
//dd2_fontheight  = 30;
dd2_fontwidth	= 19;
dd2_fontheight  = 28;
dd2_base = 0x0F500;
dd2_start = '0';
dd2_end = '9';
DD2_write();
}

// ---------------------
// dd2_write_incon24  //
// ---------------------
void DD2_write_incon24(void)
{
dd2_fontwidth	= 12;
dd2_fontheight  = 16;
dd2_base = 0x0E100;
dd2_start = '.';
dd2_end = '9' + 5;
DD2_write();
}


void DD2_write(void)
{
	dd2_i = 0;
_asm
	movff	dd2_i, POSTINC2 // write 0x00 at the end of dd2_strinstore[]
	bsf		oled_rs
_endasm
	dd2_stringstore[16] = 0;	// safety if more than 16 letters (max at font incon16) are written, the other space is used by font remap
	if (dd2_top == 0) dd2_top = 1;
	if (dd2_left == 0) dd2_left = 1;
	if (dd2_heightmax > dd2_fontheight) dd2_heightmax = dd2_fontheight;
	if ((dd2_top + dd2_heightmax) > 65) dd2_heightmax = 65 - dd2_top;

	dd2_k = dd2_left;
	dd2_j = 0;
	dd2_char = dd2_stringstore[dd2_j++];
	DD2_get_pointer_to_char();//dd2_char, &dd2_pointer);
	dd2_i = 0;
	dd2_lowbyte = 1;

while (dd2_char != 0)
{
		if (dd2_lowbyte == 1)	DD2_load_background();//&dd2_columnstore, &dd2_background, dd2_top, dd2_left, dd2_heightmax);
		DD2_build_one_line_of_char();	//&dd2_columnstore, &dd2_pointer, dd2_fontheight, dd2_lowbyte); 	// dd2_heightmax
		dd2_lowbyte = dd2_lowbyte ^ 1;
		if (dd2_lowbyte == 1)
		{
			DD2_set_column();//top, dd2_k); 				//
			if(dd2_k < 64) dd2_k++;
			DD2_print_column();//&dd2_columnstore, dd2_heightmax);				// dd2_column_store, dd2_heightmax
		}
		dd2_i++;
		if ((dd2_i >= dd2_fontwidth) | (((dd2_char == '.') |(dd2_char == ':') | (dd2_char == '<')) & (dd2_i >= 4)))
		{
			dd2_char = dd2_stringstore[dd2_j++];
			DD2_get_pointer_to_char();//dd2_char, &dd2_pointer);
			dd2_i = 0;
		}
}
}		// void dd2_write(void)

void DD2_get_pointer_to_char(void)//dd2_char, &dd2_pointer);
{
		if((dd2_char < dd2_start) | (dd2_char > dd2_end))
		{
			dd2_pointer = 0;
			dd2_temp = 0;
		}
		else
		{
			dd2_pointer = dd2_char - dd2_start;
			dd2_pointer = dd2_pointer * ((dd2_fontheight+1)/2);
			dd2_pointer = dd2_pointer * dd2_fontwidth;
			dd2_pointer += dd2_base;
			if((dd2_char == '.') | (dd2_char == ':') | (dd2_char == '<'))
			{
				dd2_pointer += 2 * dd2_fontheight;
			}

		}
}		// void DD2_get_pointer_to_char(void)

void DD2_set_column(void)//top, dd2_k);
{
	dd2_data = 0x75;
	DD2_CmdWrite();
	dd2_data = dd2_top - 1;
	DD2_CmdWrite();
	dd2_data = 0x3f;
	DD2_CmdWrite();

	dd2_data = 0x15;
	DD2_CmdWrite();
	dd2_data = dd2_k - 1;
	DD2_CmdWrite();
	dd2_data = dd2_k - 1;
	DD2_CmdWrite();
}		// DD2_set_column()

void DD2_load_background(void)//&dd2_columnstore, &dd2_background, dd2_top, dd2_left, dd2_heightmax);
{
	for(dd2_temp = 0; dd2_temp < dd2_heightmax; dd2_temp++)
		md_pi_subst[dd2_temp] = 0x00;
}		// void DD2_load_background()

void DD2_build_one_line_of_char(void)//&dd2_columnstore, &dd2_pointer, dd2_fontheight, dd2_lowbyte);
{
	if (dd2_pointer != 0)
	{
		dd2_temp = (char)(dd2_pointer & 255);
_asm
		movff	dd2_temp,TBLPTRL
_endasm
		dd2_temp = (char)((dd2_pointer >> 8) & 255);
_asm
		movff	dd2_temp,TBLPTRH
_endasm
		dd2_temp = (char)((dd2_pointer >> 16)& 255);
_asm
		movff	dd2_temp,TBLPTRU
_endasm

		for(dd2_temp = 0; dd2_temp < dd2_heightmax; dd2_temp += 2)
		{
_asm
			TBLRDPOSTINC
			movff	TABLAT,dd2_data
_endasm
			if (dd2_oled_brightness_offset != 0)
			{
				if ((dd2_oled_brightness_offset << 4) < (dd2_data & 0xF0))
					dd2_data = dd2_data - (dd2_oled_brightness_offset << 4);
				if ((dd2_oled_brightness_offset) < (dd2_data & 0x0F))
					dd2_data = dd2_data - dd2_oled_brightness_offset;
			}
			if (dd2_lowbyte == 1)
			{
				md_pi_subst[dd2_temp]   = dd2_data & 0xF0;
				md_pi_subst[dd2_temp+1] = (dd2_data << 4) & 0xF0;
			}
			else
			{
				md_pi_subst[dd2_temp]   = (md_pi_subst[dd2_temp] & 0xF0) | ((dd2_data >> 4) & 0x0F);
				md_pi_subst[dd2_temp+1] = (md_pi_subst[dd2_temp+1] & 0xF0) | (dd2_data & 0x0F);
			}
		}//for
		dd2_pointer += (dd2_fontheight+1)/2;
	}//if
}		//

void DD2_print_column(void)//&dd2_columnstore, dd2_heightmax);
{
_asm
		bsf	oled_rs
_endasm
	for(dd2_temp = 0; dd2_temp < dd2_heightmax; dd2_temp++)
	{
		dd2_data = md_pi_subst[dd2_temp];
		DD2_DataWrite();
	}
}		// void DD2_print_column(void)

//; -----------------------------
//; DD Write Cmd via W
//; two jump_ins:
//;  DD_CmdWrite and DD_CmdWrite2
//; -----------------------------
void DD2_CmdWrite(void)
{
_asm
	bcf		oled_rs
_endasm
	DD2_DataWrite();
}

void DD2_DataWrite(void)
{
_asm
	movlb	1
//	bsf		no_sensor_int					// flag5, no_sensor_int
	bcf		oled_en
	movlb	0
	bcf		oled_clk				//; CLK=0
	btfsc	dd2_data,7,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,7,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,6,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,6,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,5,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,5,1
	bcf		oled_data				//;
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,4,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,4,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,3,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,3,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,2,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,2,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,1,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,1,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	btfsc	dd2_data,0,1				//; Bit
	bsf		oled_data
	bcf		oled_clk				//; CLK=0
	btfss	dd2_data,0,1
	bcf		oled_data
	bsf		oled_clk				//; CLK=1
	bsf		oled_en					//; CS#=1
	movlb	1
//	bcf		no_sensor_int					// flag5, no_sensor_int
	movlb	0
_endasm
	dd2_data	= 0; // to be sure that C knows we are in Bank0
}
#pragma romdata font_incon_24h15 = 0x0E100
 rom const rom unsigned char incon24h15[] =
 {
		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x80
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xf0
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xf0
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0xff, 0xa0
		 ,0x00, 0x00, 0x00, 0x00, 0x5c, 0xff, 0x91, 0x00
		 ,0x00, 0x00, 0x00, 0x6d, 0xfe, 0x71, 0x00, 0x00
		 ,0x00, 0x01, 0x7e, 0xfd, 0x60, 0x00, 0x00, 0x00
		 ,0x01, 0x8f, 0xfd, 0x50, 0x00, 0x00, 0x00, 0x00
		 ,0x9f, 0xfb, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xfa, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x01, 0x69, 0xbc, 0xca, 0x72, 0x00, 0x00
		 ,0x00, 0x9f, 0xfe, 0xdc, 0xdf, 0xff, 0xb2, 0x00
		 ,0x1d, 0xf8, 0x20, 0x00, 0x05, 0xfd, 0xff, 0x30
		 ,0xaf, 0x30, 0x00, 0x00, 0x9f, 0x90, 0x2e, 0xd0
		 ,0xf8, 0x00, 0x00, 0x2c, 0xf5, 0x00, 0x06, 0xf0
		 ,0xf8, 0x00, 0x04, 0xed, 0x30, 0x00, 0x05, 0xf0
		 ,0xaf, 0x30, 0x8f, 0xb1, 0x00, 0x00, 0x0c, 0xe0
		 ,0x1d, 0xfd, 0xf8, 0x00, 0x00, 0x16, 0xdf, 0x40
		 ,0x00, 0x9f, 0xff, 0xdc, 0xde, 0xff, 0xc3, 0x00
		 ,0x00, 0x01, 0x69, 0xbc, 0xca, 0x73, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x02, 0x90, 0x00, 0x00, 0x00, 0x00, 0x01, 0x30
		 ,0x0a, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x04, 0xf0
		 ,0x2f, 0x60, 0x00, 0x00, 0x00, 0x00, 0x04, 0xf0
		 ,0xaf, 0x97, 0x77, 0x77, 0x77, 0x77, 0x79, 0xf0
		 ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0
		 ,0x12, 0x22, 0x22, 0x22, 0x22, 0x22, 0x26, 0xf0
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xf0
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd0
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40
		 ,0x07, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0
		 ,0x4f, 0x80, 0x00, 0x00, 0x00, 0x1c, 0xfe, 0xf0
		 ,0xcc, 0x00, 0x00, 0x00, 0x02, 0xef, 0x57, 0xf0
		 ,0xf7, 0x00, 0x00, 0x00, 0x2e, 0xe2, 0x07, 0xf0
		 ,0xf8, 0x00, 0x00, 0x01, 0xde, 0x20, 0x07, 0xf0
		 ,0xce, 0x10, 0x00, 0x2d, 0xe2, 0x00, 0x07, 0xf0
		 ,0x4f, 0xd6, 0x58, 0xfe, 0x30, 0x00, 0x07, 0xf0
		 ,0x06, 0xff, 0xff, 0xb1, 0x00, 0x00, 0x07, 0xf0
		 ,0x00, 0x14, 0x52, 0x00, 0x00, 0x00, 0x05, 0x80
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00
		 ,0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x50
		 ,0x6f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xd0
		 ,0xdb, 0x00, 0x00, 0x59, 0x00, 0x00, 0x07, 0xf0
		 ,0xf8, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x04, 0xf0
		 ,0xea, 0x00, 0x00, 0xcf, 0x10, 0x00, 0x06, 0xf0
		 ,0x9f, 0x30, 0x07, 0xff, 0x90, 0x00, 0x1e, 0xe0
		 ,0x1e, 0xfc, 0xdf, 0x87, 0xfb, 0x79, 0xef, 0x50
		 ,0x01, 0x9d, 0xc6, 0x00, 0x7e, 0xff, 0xd5, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x2b, 0xb0, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x06, 0xff, 0xe0, 0x00, 0x00
		 ,0x00, 0x00, 0x02, 0xcf, 0x69, 0xe0, 0x00, 0x00
		 ,0x00, 0x00, 0x7f, 0xb1, 0x09, 0xe0, 0x00, 0x00
		 ,0x00, 0x2c, 0xe6, 0x00, 0x09, 0xe0, 0x00, 0x00
		 ,0x07, 0xfb, 0x10, 0x00, 0x09, 0xe0, 0x00, 0x00
		 ,0xcf, 0xfc, 0xcc, 0xcc, 0xce, 0xfd, 0xdd, 0xd0
		 ,0xde, 0xee, 0xee, 0xee, 0xef, 0xfe, 0xee, 0xe0
		 ,0x00, 0x00, 0x00, 0x00, 0x09, 0xe0, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x08, 0xc0, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00
		 ,0x78, 0xab, 0xcd, 0xed, 0x00, 0x00, 0xce, 0x20
		 ,0xff, 0xed, 0xcc, 0xfa, 0x00, 0x00, 0x5f, 0xb0
		 ,0xf9, 0x00, 0x06, 0xf0, 0x00, 0x00, 0x08, 0xf0
		 ,0xf9, 0x00, 0x0a, 0xb0, 0x00, 0x00, 0x04, 0xf0
		 ,0xf9, 0x00, 0x0a, 0xc0, 0x00, 0x00, 0x04, 0xf0
		 ,0xf9, 0x00, 0x08, 0xf3, 0x00, 0x00, 0x0b, 0xf0
		 ,0xf9, 0x00, 0x01, 0xfe, 0x62, 0x13, 0xbf, 0x90
		 ,0xf9, 0x00, 0x00, 0x4e, 0xff, 0xff, 0xfb, 0x00
		 ,0x11, 0x00, 0x00, 0x01, 0x6a, 0xa9, 0x40, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x03, 0x56, 0x65, 0x30, 0x00, 0x00
		 ,0x00, 0x4b, 0xff, 0xff, 0xff, 0xff, 0xa2, 0x00
		 ,0x08, 0xfe, 0x96, 0x8f, 0x95, 0x6a, 0xff, 0x30
		 ,0x6f, 0x90, 0x01, 0xf8, 0x00, 0x00, 0x3e, 0xd0
		 ,0xec, 0x00, 0x08, 0xf0, 0x00, 0x00, 0x06, 0xf0
		 ,0xf6, 0x00, 0x0a, 0xe0, 0x00, 0x00, 0x04, 0xf0
		 ,0xf7, 0x00, 0x07, 0xf3, 0x00, 0x00, 0x09, 0xf0
		 ,0xcd, 0x10, 0x01, 0xef, 0x72, 0x13, 0xaf, 0x90
		 ,0x4d, 0x20, 0x00, 0x2d, 0xff, 0xff, 0xf9, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x47, 0x86, 0x10, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x90
		 ,0xfa, 0x00, 0x00, 0x00, 0x00, 0x39, 0xef, 0xf0
		 ,0xfa, 0x00, 0x00, 0x01, 0x7d, 0xff, 0xe9, 0x40
		 ,0xfa, 0x00, 0x05, 0xbf, 0xff, 0x94, 0x00, 0x00
		 ,0xfa, 0x18, 0xef, 0xfb, 0x50, 0x00, 0x00, 0x00
		 ,0xfe, 0xff, 0xd7, 0x10, 0x00, 0x00, 0x00, 0x00
		 ,0xff, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x02, 0x78, 0x50, 0x00
		 ,0x03, 0xad, 0xb4, 0x00, 0x7f, 0xff, 0xfc, 0x00
		 ,0x3f, 0xfc, 0xff, 0x66, 0xfa, 0x43, 0xaf, 0xa0
		 ,0xcd, 0x10, 0x1c, 0xfe, 0x70, 0x00, 0x0b, 0xf0
		 ,0xf5, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x05, 0xf0
		 ,0xf5, 0x00, 0x00, 0xbf, 0x10, 0x00, 0x04, 0xf0
		 ,0xec, 0x00, 0x07, 0xff, 0xb0, 0x00, 0x0a, 0xf0
		 ,0x6f, 0xd9, 0xcf, 0x78, 0xfb, 0x32, 0x9f, 0x90
		 ,0x07, 0xef, 0xe6, 0x00, 0x9f, 0xff, 0xfb, 0x00
		 ,0x00, 0x01, 0x00, 0x00, 0x03, 0x88, 0x50, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x03, 0x55, 0x20, 0x00, 0x00, 0x00, 0x00
		 ,0x04, 0xdf, 0xff, 0xfb, 0x10, 0x00, 0x0b, 0x60
		 ,0x4f, 0xd7, 0x45, 0x9f, 0xd0, 0x00, 0x1c, 0xe0
		 ,0xdd, 0x00, 0x00, 0x05, 0xf5, 0x00, 0x05, 0xf0
		 ,0xf7, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x04, 0xf0
		 ,0xf8, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x08, 0xf0
		 ,0xbe, 0x20, 0x00, 0x06, 0xf2, 0x00, 0x5f, 0xa0
		 ,0x2e, 0xf9, 0x54, 0x7f, 0x94, 0x7c, 0xfc, 0x00
		 ,0x02, 0xaf, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x00
		 ,0x00, 0x01, 0x46, 0x77, 0x75, 0x30, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x06, 0xa1, 0x00, 0x00, 0x09, 0x80
		 ,0x00, 0x00, 0x1f, 0xf9, 0x00, 0x00, 0x6f, 0xf0
		 ,0x00, 0x00, 0x0d, 0xf5, 0x00, 0x00, 0x3f, 0xe0
		 ,0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xba, 0xae, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xff, 0xe9, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x97, 0x8c, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xff, 0xfb, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x75, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x75, 0x6a, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xff, 0xfd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xa8, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x2c, 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xdd, 0x78, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xf2, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0xf0, 0x00, 0x4f, 0x10, 0x00, 0x00, 0x00, 0x00
		 ,0xea, 0x23, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x4f, 0xff, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x01, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10
		 ,0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0
		 ,0x00, 0x00, 0x9f, 0xa7, 0x77, 0x77, 0x77, 0x70
		 ,0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x02, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x01, 0xff, 0xcb, 0xbb, 0xbb, 0xbb, 0xb0
		 ,0x00, 0x00, 0x4f, 0xfe, 0xee, 0xee, 0xee, 0xe0
		 ,0x00, 0x00, 0xab, 0x20, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x01, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x00
		 ,0x00, 0x02, 0xfa, 0x55, 0x55, 0x55, 0x55, 0x50
		 ,0x00, 0x00, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xf0
		 ,0x00, 0x00, 0x02, 0x44, 0x44, 0x44, 0x44, 0x40
 };

#pragma romdata font_incon_42 = 0x0F500
 rom const rom unsigned char incon42[] =
 {
	 // 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
	  ,0x00, 0x00, 0x00, 0x03, 0x7a, 0xcd, 0xee, 0xdc, 0xa8, 0x40, 0x00, 0x00, 0x00, 0x00
	  ,0x00, 0x00, 0x18, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x92, 0x00, 0x00, 0x00
	  ,0x00, 0x07, 0xef, 0xff, 0xff, 0xdc, 0xbb, 0xce, 0xff, 0xff, 0xff, 0x91, 0x00, 0x00
	  ,0x00, 0xbf, 0xff, 0xc7, 0x65, 0x43, 0x22, 0x33, 0x57, 0xbf, 0xff, 0xfd, 0x20, 0x00
	  ,0x0b, 0xff, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x6e, 0xff, 0xd1, 0x00
	  ,0x7f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xbf, 0xfa, 0x00
	  ,0xef, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xff, 0x20
	  ,0xff, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0x60
	  ,0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x70
	  ,0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50
	  ,0xcf, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xff, 0x10
	  ,0x4f, 0xfe, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xcf, 0xf8, 0x00
	  ,0x07, 0xff, 0xd7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7e, 0xff, 0xb0, 0x00
	  ,0x00, 0x5e, 0xff, 0xfb, 0x98, 0x54, 0x33, 0x34, 0x58, 0xbf, 0xff, 0xfa, 0x00, 0x00
	  ,0x00, 0x01, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x50, 0x00, 0x00
	  ,0x00, 0x00, 0x01, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x40, 0x00, 0x00, 0x00
	  ,0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x77, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
	  ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
	 // ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

#if 0
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x03, 0x7a, 0xcd, 0xee, 0xdc, 0xa8, 0x40, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x18, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x92, 0x00, 0x00, 0x00
 ,0x00, 0x07, 0xef, 0xff, 0xff, 0xdc, 0xbb, 0xce, 0xff, 0xff, 0xff, 0x91, 0x00, 0x00
 ,0x00, 0xbf, 0xff, 0xc7, 0x20, 0x00, 0x00, 0x00, 0x1c, 0xff, 0xff, 0xfd, 0x20, 0x00
 ,0x0b, 0xff, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x02, 0xcf, 0xfc, 0x6e, 0xff, 0xd1, 0x00
 ,0x7f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xff, 0x90, 0x01, 0xbf, 0xfa, 0x00
 ,0xef, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0xe5, 0x00, 0x00, 0x0d, 0xff, 0x20
 ,0xff, 0x60, 0x00, 0x00, 0x00, 0x02, 0xcf, 0xfc, 0x20, 0x00, 0x00, 0x05, 0xff, 0x60
 ,0xff, 0x40, 0x00, 0x00, 0x00, 0x5e, 0xff, 0x90, 0x00, 0x00, 0x00, 0x03, 0xff, 0x70
 ,0xff, 0x80, 0x00, 0x00, 0x08, 0xff, 0xf6, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50
 ,0xcf, 0xf3, 0x00, 0x01, 0xcf, 0xfd, 0x30, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xff, 0x10
 ,0x4f, 0xfe, 0x50, 0x4e, 0xff, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x01, 0xcf, 0xf8, 0x00
 ,0x07, 0xff, 0xfd, 0xff, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7e, 0xff, 0xb0, 0x00
 ,0x00, 0x5e, 0xff, 0xff, 0xd8, 0x54, 0x33, 0x34, 0x58, 0xbf, 0xff, 0xfa, 0x00, 0x00
 ,0x00, 0x01, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x50, 0x00, 0x00
 ,0x00, 0x00, 0x01, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x40, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x77, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
#endif
//
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x1f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0x00
 ,0x00, 0x9f, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x02, 0xff, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x0a, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0xbf, 0xfc, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x79, 0xff, 0x00
 ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x36, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xcc, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x08, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xff, 0x00
 ,0x00, 0xbf, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xff, 0x00
 ,0x0a, 0xff, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xdf, 0xff, 0xff, 0x00
 ,0x4f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xff, 0xdb, 0xff, 0x00
 ,0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xf8, 0x08, 0xff, 0x00
 ,0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xfe, 0x40, 0x08, 0xff, 0x00
 ,0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0xd2, 0x00, 0x08, 0xff, 0x00
 ,0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xfd, 0x10, 0x00, 0x08, 0xff, 0x00
 ,0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xd1, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x8f, 0xfe, 0x20, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x9f, 0xfa, 0x00, 0x00, 0x00, 0x1a, 0xff, 0xe2, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x2e, 0xff, 0xd6, 0x21, 0x38, 0xef, 0xfd, 0x20, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x3d, 0xff, 0xff, 0xff, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x00, 0x59, 0xbb, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x30, 0x00
 ,0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xd0, 0x00
 ,0x1e, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xdf, 0xf8, 0x00
 ,0x7f, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0xfe, 0x00
 ,0xdf, 0xc0, 0x00, 0x00, 0x00, 0x07, 0x95, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0x30
 ,0xff, 0x70, 0x00, 0x00, 0x00, 0x0c, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0xff, 0x50, 0x00, 0x00, 0x00, 0x0e, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x70
 ,0xff, 0x60, 0x00, 0x00, 0x00, 0x2f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0xff, 0xb0, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0x30
 ,0xbf, 0xf4, 0x00, 0x00, 0x02, 0xef, 0xff, 0x70, 0x00, 0x00, 0x00, 0x2f, 0xfe, 0x00
 ,0x4f, 0xfe, 0x60, 0x00, 0x5e, 0xfd, 0xbf, 0xf5, 0x00, 0x00, 0x03, 0xef, 0xf7, 0x00
 ,0x09, 0xff, 0xff, 0xdf, 0xff, 0xf3, 0x2f, 0xff, 0xb6, 0x56, 0xbf, 0xff, 0xc0, 0x00
 ,0x00, 0x8f, 0xff, 0xff, 0xfe, 0x40, 0x04, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x10, 0x00
 ,0x00, 0x02, 0x8c, 0xdb, 0x71, 0x00, 0x00, 0x2b, 0xff, 0xff, 0xfe, 0x80, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x66, 0x30, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xef, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xaf, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xff, 0xd4, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x06, 0xef, 0xf8, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x02, 0xbf, 0xfc, 0x30, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x7f, 0xff, 0x70, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x2c, 0xff, 0xb2, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x07, 0xff, 0xe6, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x03, 0xcf, 0xfa, 0x10, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x8f, 0xff, 0xea, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xef, 0xea, 0xaa, 0xaa, 0xaa, 0x00
 ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xdf, 0xd4, 0x44, 0x44, 0x44, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x70, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x72, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00
 ,0xab, 0xcd, 0xef, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x1e, 0xff, 0x80, 0x00
 ,0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x00, 0x00, 0x00, 0x28, 0xff, 0xf3, 0x00
 ,0xff, 0xda, 0xa9, 0x87, 0x67, 0xff, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfb, 0x00
 ,0xff, 0x70, 0x00, 0x00, 0x06, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xff, 0x10
 ,0xff, 0x70, 0x00, 0x00, 0x0b, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0x50
 ,0xff, 0x70, 0x00, 0x00, 0x0d, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x70
 ,0xff, 0x70, 0x00, 0x00, 0x0e, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x70
 ,0xff, 0x70, 0x00, 0x00, 0x0e, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0xff, 0x70, 0x00, 0x00, 0x0b, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0x30
 ,0xff, 0x70, 0x00, 0x00, 0x06, 0xff, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xfd, 0x00
 ,0xff, 0x70, 0x00, 0x00, 0x00, 0xdf, 0xfd, 0x40, 0x00, 0x00, 0x29, 0xff, 0xf5, 0x00
 ,0xff, 0x70, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xfe, 0xba, 0xbd, 0xff, 0xff, 0x90, 0x00
 ,0xff, 0x70, 0x00, 0x00, 0x00, 0x03, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00
 ,0x55, 0x20, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0xff, 0xff, 0xea, 0x30, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x34, 0x42, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x33, 0x33, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x49, 0xce, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x71, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x90, 0x00, 0x00
 ,0x00, 0x3d, 0xff, 0xff, 0xfc, 0xba, 0xff, 0xfb, 0xab, 0xef, 0xff, 0xfd, 0x20, 0x00
 ,0x04, 0xff, 0xfe, 0x83, 0x00, 0x1c, 0xfd, 0x20, 0x00, 0x02, 0x8e, 0xff, 0xd1, 0x00
 ,0x1e, 0xff, 0x90, 0x00, 0x00, 0xbf, 0xe1, 0x00, 0x00, 0x00, 0x01, 0xcf, 0xf9, 0x00
 ,0xaf, 0xf7, 0x00, 0x00, 0x05, 0xff, 0x50, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xff, 0x10
 ,0xff, 0xb0, 0x00, 0x00, 0x0a, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50
 ,0xff, 0x50, 0x00, 0x00, 0x0d, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x70
 ,0xff, 0x20, 0x00, 0x00, 0x0d, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x60
 ,0xff, 0x30, 0x00, 0x00, 0x0a, 0xff, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0x30
 ,0xff, 0x70, 0x00, 0x00, 0x05, 0xff, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x00
 ,0xef, 0xe1, 0x00, 0x00, 0x00, 0xcf, 0xfd, 0x50, 0x00, 0x00, 0x28, 0xff, 0xf4, 0x00
 ,0x7f, 0xfd, 0x00, 0x00, 0x00, 0x2d, 0xff, 0xff, 0xdb, 0xcd, 0xff, 0xff, 0x70, 0x00
 ,0x0c, 0xd2, 0x00, 0x00, 0x00, 0x01, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xe5, 0x00, 0x00
 ,0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x03, 0x9d, 0xff, 0xfe, 0xb6, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xcc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xef, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x9e, 0xff, 0xff, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xdf, 0xff, 0xff, 0xfe, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7d, 0xff, 0xff, 0xff, 0xd9, 0x40, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x00, 0x05, 0xbf, 0xff, 0xff, 0xfd, 0x83, 0x00, 0x00, 0x00
 ,0xff, 0x90, 0x00, 0x00, 0x39, 0xef, 0xff, 0xff, 0xe8, 0x30, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0x90, 0x00, 0x6c, 0xff, 0xff, 0xfe, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0x92, 0x8e, 0xff, 0xff, 0xfb, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0xef, 0xff, 0xff, 0xd7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0xff, 0xff, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xff, 0xfd, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0xba, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x67, 0x62, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x24, 0x42, 0x00, 0x00, 0x00, 0x04, 0xdf, 0xff, 0xff, 0xb2, 0x00, 0x00
 ,0x00, 0x3c, 0xff, 0xff, 0xc4, 0x00, 0x00, 0x8f, 0xff, 0xff, 0xff, 0xfe, 0x30, 0x00
 ,0x05, 0xff, 0xff, 0xff, 0xff, 0x70, 0x08, 0xff, 0xfb, 0x77, 0xaf, 0xff, 0xe1, 0x00
 ,0x3f, 0xff, 0xa7, 0x8d, 0xff, 0xf6, 0x4f, 0xfc, 0x20, 0x00, 0x02, 0xdf, 0xf9, 0x00
 ,0xbf, 0xe3, 0x00, 0x00, 0x8f, 0xfe, 0xdf, 0xb0, 0x00, 0x00, 0x00, 0x2e, 0xff, 0x00
 ,0xff, 0x60, 0x00, 0x00, 0x08, 0xff, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x08, 0xff, 0x40
 ,0xff, 0x10, 0x00, 0x00, 0x00, 0xcf, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0xff, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x60
 ,0xff, 0x20, 0x00, 0x00, 0x00, 0x5f, 0xff, 0x10, 0x00, 0x00, 0x00, 0x05, 0xff, 0x50
 ,0xff, 0x80, 0x00, 0x00, 0x03, 0xef, 0xff, 0xa0, 0x00, 0x00, 0x00, 0x0a, 0xff, 0x20
 ,0xdf, 0xf6, 0x00, 0x00, 0x5e, 0xfc, 0xcf, 0xf8, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x00
 ,0x4f, 0xff, 0xc8, 0x9d, 0xff, 0xf3, 0x3f, 0xff, 0xa2, 0x00, 0x06, 0xff, 0xf5, 0x00
 ,0x07, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x06, 0xff, 0xff, 0xdc, 0xef, 0xff, 0xa0, 0x00
 ,0x00, 0x4c, 0xff, 0xff, 0x91, 0x00, 0x00, 0x5e, 0xff, 0xff, 0xff, 0xfa, 0x00, 0x00
 ,0x00, 0x00, 0x24, 0x30, 0x00, 0x00, 0x00, 0x01, 0x8e, 0xff, 0xfb, 0x40, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 //
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x01, 0x7d, 0xff, 0xff, 0xea, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00
 ,0x00, 0x6e, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xe2, 0x00
 ,0x08, 0xff, 0xff, 0xb9, 0x9b, 0xef, 0xff, 0xc0, 0x00, 0x00, 0x00, 0xbf, 0xfa, 0x00
 ,0x4f, 0xff, 0x70, 0x00, 0x00, 0x05, 0xef, 0xf8, 0x00, 0x00, 0x00, 0x0c, 0xff, 0x10
 ,0xdf, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xff, 0x10, 0x00, 0x00, 0x06, 0xff, 0x50
 ,0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x70, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0xff, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x70, 0x00, 0x00, 0x07, 0xff, 0x40
 ,0xff, 0x70, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x40, 0x00, 0x00, 0x0d, 0xfe, 0x00
 ,0xef, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xfd, 0x00, 0x00, 0x00, 0x9f, 0xf8, 0x00
 ,0x7f, 0xfd, 0x30, 0x00, 0x00, 0x00, 0x7f, 0xf4, 0x00, 0x00, 0x1a, 0xff, 0xd1, 0x00
 ,0x0b, 0xff, 0xfb, 0x52, 0x00, 0x08, 0xff, 0x60, 0x13, 0x6a, 0xff, 0xfe, 0x20, 0x00
 ,0x00, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xc2, 0x00, 0x00
 ,0x00, 0x04, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc5, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x02, 0x69, 0xcd, 0xef, 0xff, 0xed, 0xb9, 0x62, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };

#if 0
#pragma romdata font_incon_42 = 0x0E000
 rom const rom unsigned char incon42[] =
 {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x03, 0x7a, 0xcd, 0xee, 0xdc, 0xa8, 0x40, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x18, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x92, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x07, 0xef, 0xff, 0xff, 0xdc, 0xbb, 0xce, 0xff, 0xff, 0xff, 0x91, 0x00, 0x00
 ,0x00, 0x00, 0xbf, 0xff, 0xc7, 0x20, 0x00, 0x00, 0x00, 0x1c, 0xff, 0xff, 0xfd, 0x20, 0x00
 ,0x00, 0x0b, 0xff, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x02, 0xcf, 0xfc, 0x6e, 0xff, 0xd1, 0x00
 ,0x00, 0x7f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xff, 0x90, 0x01, 0xbf, 0xfa, 0x00
 ,0x00, 0xef, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0xe5, 0x00, 0x00, 0x0d, 0xff, 0x20
 ,0x03, 0xff, 0x60, 0x00, 0x00, 0x00, 0x02, 0xcf, 0xfc, 0x20, 0x00, 0x00, 0x05, 0xff, 0x60
 ,0x04, 0xff, 0x40, 0x00, 0x00, 0x00, 0x5e, 0xff, 0x90, 0x00, 0x00, 0x00, 0x03, 0xff, 0x70
 ,0x02, 0xff, 0x80, 0x00, 0x00, 0x08, 0xff, 0xf6, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50
 ,0x00, 0xcf, 0xf3, 0x00, 0x01, 0xcf, 0xfd, 0x30, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xff, 0x10
 ,0x00, 0x4f, 0xfe, 0x50, 0x4e, 0xff, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x01, 0xcf, 0xf8, 0x00
 ,0x00, 0x07, 0xff, 0xfd, 0xff, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7e, 0xff, 0xb0, 0x00
 ,0x00, 0x00, 0x5e, 0xff, 0xff, 0xd8, 0x54, 0x33, 0x34, 0x58, 0xbf, 0xff, 0xfa, 0x00, 0x00
 ,0x00, 0x00, 0x01, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x50, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x01, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe9, 0x40, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x46, 0x77, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x1f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x44, 0x00
 ,0x00, 0x00, 0x9f, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x02, 0xff, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x0a, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0xbf, 0xfc, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x79, 0xff, 0x00
 ,0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x36, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xcc, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x08, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xff, 0x00
 ,0x00, 0x00, 0xbf, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xff, 0x00
 ,0x00, 0x0a, 0xff, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xdf, 0xff, 0xff, 0x00
 ,0x00, 0x4f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xff, 0xdb, 0xff, 0x00
 ,0x00, 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xf8, 0x08, 0xff, 0x00
 ,0x01, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xfe, 0x40, 0x08, 0xff, 0x00
 ,0x04, 0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0xd2, 0x00, 0x08, 0xff, 0x00
 ,0x04, 0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xfd, 0x10, 0x00, 0x08, 0xff, 0x00
 ,0x03, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xd1, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x8f, 0xfe, 0x20, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x9f, 0xfa, 0x00, 0x00, 0x00, 0x1a, 0xff, 0xe2, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x2e, 0xff, 0xd6, 0x21, 0x38, 0xef, 0xfd, 0x20, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x59, 0xbb, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xff, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x30, 0x00
 ,0x00, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0xd0, 0x00
 ,0x00, 0x1e, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xdf, 0xf8, 0x00
 ,0x00, 0x7f, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0xfe, 0x00
 ,0x00, 0xdf, 0xc0, 0x00, 0x00, 0x00, 0x07, 0x95, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0x30
 ,0x01, 0xff, 0x70, 0x00, 0x00, 0x00, 0x0c, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0x03, 0xff, 0x50, 0x00, 0x00, 0x00, 0x0e, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x70
 ,0x03, 0xff, 0x60, 0x00, 0x00, 0x00, 0x2f, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0x01, 0xff, 0xb0, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x09, 0xff, 0x30
 ,0x00, 0xbf, 0xf4, 0x00, 0x00, 0x02, 0xef, 0xff, 0x70, 0x00, 0x00, 0x00, 0x2f, 0xfe, 0x00
 ,0x00, 0x4f, 0xfe, 0x60, 0x00, 0x5e, 0xfd, 0xbf, 0xf5, 0x00, 0x00, 0x03, 0xef, 0xf7, 0x00
 ,0x00, 0x09, 0xff, 0xff, 0xdf, 0xff, 0xf3, 0x2f, 0xff, 0xb6, 0x56, 0xbf, 0xff, 0xc0, 0x00
 ,0x00, 0x00, 0x8f, 0xff, 0xff, 0xfe, 0x40, 0x04, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x10, 0x00
 ,0x00, 0x00, 0x02, 0x8c, 0xdb, 0x71, 0x00, 0x00, 0x2b, 0xff, 0xff, 0xfe, 0x80, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x66, 0x30, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xef, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xaf, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xff, 0xd4, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xef, 0xf8, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x02, 0xbf, 0xfc, 0x30, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0x70, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x2c, 0xff, 0xb2, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x07, 0xff, 0xe6, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x03, 0xcf, 0xfa, 0x10, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x8f, 0xff, 0xea, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xef, 0xea, 0xaa, 0xaa, 0xaa, 0x00
 ,0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 ,0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xdf, 0xd4, 0x44, 0x44, 0x44, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc0, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x70, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x72, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00
 ,0x01, 0xab, 0xcd, 0xef, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x1e, 0xff, 0x80, 0x00
 ,0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x00, 0x00, 0x00, 0x28, 0xff, 0xf3, 0x00
 ,0x02, 0xff, 0xda, 0xa9, 0x87, 0x67, 0xff, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfb, 0x00
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x06, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xff, 0x10
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x0b, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0x50
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x0d, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x70
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x0e, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x70
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x0e, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x0b, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0x30
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x06, 0xff, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xfd, 0x00
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x00, 0xdf, 0xfd, 0x40, 0x00, 0x00, 0x29, 0xff, 0xf5, 0x00
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xfe, 0xba, 0xbd, 0xff, 0xff, 0x90, 0x00
 ,0x02, 0xff, 0x70, 0x00, 0x00, 0x00, 0x03, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00
 ,0x01, 0x55, 0x20, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0xff, 0xff, 0xea, 0x30, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x34, 0x42, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x33, 0x33, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x49, 0xce, 0xff, 0xff, 0xff, 0xff, 0xeb, 0x71, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x90, 0x00, 0x00
 ,0x00, 0x00, 0x3d, 0xff, 0xff, 0xfc, 0xba, 0xff, 0xfb, 0xab, 0xef, 0xff, 0xfd, 0x20, 0x00
 ,0x00, 0x04, 0xff, 0xfe, 0x83, 0x00, 0x1c, 0xfd, 0x20, 0x00, 0x02, 0x8e, 0xff, 0xd1, 0x00
 ,0x00, 0x1e, 0xff, 0x90, 0x00, 0x00, 0xbf, 0xe1, 0x00, 0x00, 0x00, 0x01, 0xcf, 0xf9, 0x00
 ,0x00, 0xaf, 0xf7, 0x00, 0x00, 0x05, 0xff, 0x50, 0x00, 0x00, 0x00, 0x00, 0x1d, 0xff, 0x10
 ,0x01, 0xff, 0xb0, 0x00, 0x00, 0x0a, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50
 ,0x04, 0xff, 0x50, 0x00, 0x00, 0x0d, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x70
 ,0x06, 0xff, 0x20, 0x00, 0x00, 0x0d, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x60
 ,0x06, 0xff, 0x30, 0x00, 0x00, 0x0a, 0xff, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0xff, 0x30
 ,0x03, 0xff, 0x70, 0x00, 0x00, 0x05, 0xff, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x00
 ,0x00, 0xef, 0xe1, 0x00, 0x00, 0x00, 0xcf, 0xfd, 0x50, 0x00, 0x00, 0x28, 0xff, 0xf4, 0x00
 ,0x00, 0x7f, 0xfd, 0x00, 0x00, 0x00, 0x2d, 0xff, 0xff, 0xdb, 0xcd, 0xff, 0xff, 0x70, 0x00
 ,0x00, 0x0c, 0xd2, 0x00, 0x00, 0x00, 0x01, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xe5, 0x00, 0x00
 ,0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x03, 0x9d, 0xff, 0xfe, 0xb6, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xcc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xef, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x9e, 0xff, 0xff, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xdf, 0xff, 0xff, 0xfe, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7d, 0xff, 0xff, 0xff, 0xd9, 0x40, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x00, 0x05, 0xbf, 0xff, 0xff, 0xfd, 0x83, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x00, 0x39, 0xef, 0xff, 0xff, 0xe8, 0x30, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0x90, 0x00, 0x6c, 0xff, 0xff, 0xfe, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0x92, 0x8e, 0xff, 0xff, 0xfb, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0xef, 0xff, 0xff, 0xd7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0xff, 0xff, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xff, 0xfd, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x02, 0xba, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x67, 0x62, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x24, 0x42, 0x00, 0x00, 0x00, 0x04, 0xdf, 0xff, 0xff, 0xb2, 0x00, 0x00
 ,0x00, 0x00, 0x3c, 0xff, 0xff, 0xc4, 0x00, 0x00, 0x8f, 0xff, 0xff, 0xff, 0xfe, 0x30, 0x00
 ,0x00, 0x05, 0xff, 0xff, 0xff, 0xff, 0x70, 0x08, 0xff, 0xfb, 0x77, 0xaf, 0xff, 0xe1, 0x00
 ,0x00, 0x3f, 0xff, 0xa7, 0x8d, 0xff, 0xf6, 0x4f, 0xfc, 0x20, 0x00, 0x02, 0xdf, 0xf9, 0x00
 ,0x00, 0xbf, 0xe3, 0x00, 0x00, 0x8f, 0xfe, 0xdf, 0xb0, 0x00, 0x00, 0x00, 0x2e, 0xff, 0x00
 ,0x01, 0xff, 0x60, 0x00, 0x00, 0x08, 0xff, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x08, 0xff, 0x40
 ,0x05, 0xff, 0x10, 0x00, 0x00, 0x00, 0xcf, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0x06, 0xff, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x60
 ,0x06, 0xff, 0x20, 0x00, 0x00, 0x00, 0x5f, 0xff, 0x10, 0x00, 0x00, 0x00, 0x05, 0xff, 0x50
 ,0x03, 0xff, 0x80, 0x00, 0x00, 0x03, 0xef, 0xff, 0xa0, 0x00, 0x00, 0x00, 0x0a, 0xff, 0x20
 ,0x00, 0xdf, 0xf6, 0x00, 0x00, 0x5e, 0xfc, 0xcf, 0xf8, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x00
 ,0x00, 0x4f, 0xff, 0xc8, 0x9d, 0xff, 0xf3, 0x3f, 0xff, 0xa2, 0x00, 0x06, 0xff, 0xf5, 0x00
 ,0x00, 0x07, 0xff, 0xff, 0xff, 0xfe, 0x40, 0x06, 0xff, 0xff, 0xdc, 0xef, 0xff, 0xa0, 0x00
 ,0x00, 0x00, 0x4c, 0xff, 0xff, 0x91, 0x00, 0x00, 0x5e, 0xff, 0xff, 0xff, 0xfa, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x24, 0x30, 0x00, 0x00, 0x00, 0x01, 0x8e, 0xff, 0xfb, 0x40, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x01, 0x7d, 0xff, 0xff, 0xea, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00
 ,0x00, 0x00, 0x6e, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xe2, 0x00
 ,0x00, 0x08, 0xff, 0xff, 0xb9, 0x9b, 0xef, 0xff, 0xc0, 0x00, 0x00, 0x00, 0xbf, 0xfa, 0x00
 ,0x00, 0x4f, 0xff, 0x70, 0x00, 0x00, 0x05, 0xef, 0xf8, 0x00, 0x00, 0x00, 0x0c, 0xff, 0x10
 ,0x00, 0xdf, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xff, 0x10, 0x00, 0x00, 0x06, 0xff, 0x50
 ,0x03, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x50, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0x05, 0xff, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x70, 0x00, 0x00, 0x04, 0xff, 0x60
 ,0x06, 0xff, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x70, 0x00, 0x00, 0x07, 0xff, 0x40
 ,0x04, 0xff, 0x70, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x40, 0x00, 0x00, 0x0d, 0xfe, 0x00
 ,0x00, 0xef, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xfd, 0x00, 0x00, 0x00, 0x9f, 0xf8, 0x00
 ,0x00, 0x7f, 0xfd, 0x30, 0x00, 0x00, 0x00, 0x7f, 0xf4, 0x00, 0x00, 0x1a, 0xff, 0xd1, 0x00
 ,0x00, 0x0b, 0xff, 0xfb, 0x52, 0x00, 0x08, 0xff, 0x60, 0x13, 0x6a, 0xff, 0xfe, 0x20, 0x00
 ,0x00, 0x00, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xc2, 0x00, 0x00
 ,0x00, 0x00, 0x04, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc5, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x02, 0x69, 0xcd, 0xef, 0xff, 0xed, 0xb9, 0x62, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
#endif

// **********************
// **********************
// ** THE JUMP-IN CODE **
// ** for the asm code **
// **********************
// **********************
#pragma code main_calc_hauptroutine = 0x10000
void main_calc_hauptroutine(void)
{
calc_hauptroutine();
int_O_desaturation_time = 65535;
}				// divemode
#pragma code main_without_deco = 0x10020
void main_calc_without_deco(void)
{
calc_without_deco();
calc_desaturation_time();
}

#pragma code main_clear_CNS_fraction = 0x10030
void main_clear_CNS_fraction(void)
{
clear_CNS_fraction();
}

#pragma code main_calc_CNS_decrease_15min = 0x10034
void main_calc_CNS_decrease_15min(void)
{
calc_CNS_decrease_15min();
}

#pragma code main_calc_percentage = 0x10038
void main_calc_percentage (void)
{
calc_percentage();
}

#pragma code main_clear_tissue = 0x10040
void main_clear_tissue(void)
{
clear_tissue();
char_I_depth_last_deco	= 0;		// for compatibility with v.101pre_no_last_deco
}

#pragma code main_calc_CNS_fraction = 0x10050
void main_calc_CNS_fraction(void)
{
calc_CNS_fraction();
}

#pragma code main_calc_desaturation_time = 0x10060
void main_calc_desaturation_time(void)
{
calc_desaturation_time();
}

#pragma code main_calc_wo_deco_step_1_min = 0x10080
void main_calc_wo_deco_step_1_min(void)
{
calc_wo_deco_step_1_min();
char_O_deco_status = 3; // surface new in v.102 overwrites value of calc_wo_deco_step_1_min
calc_desaturation_time();
}			// surface mode

#pragma code main_debug = 0x100A0
void main_debug(void)
{
//debug();
}

#pragma code main_DD2_write_incon42 = 0x100B0
void main_DD2_write_incon42(void)
{
	DD2_write_incon42();
}

#pragma code main_DD2_write_incon24 = 0x100B4
void main_DD2_write_incon24(void)
{
	DD2_write_incon24();
}

#pragma code main_gradient_array = 0x100C0
void main_gradient_array(void)
{
calc_gradient_array_only();
}
#pragma code main_push_tissues = 0x100C4
void main_push_tissues_to_vault(void)
{
	push_tissues_to_vault();
}
#pragma code main_pull_tissues = 0x100C8
void main_pull_tissues_from_vault(void)
{
	pull_tissues_from_vault();
}

#pragma code main_hash = 0x100E0
void main_hash(void)
{
hash();
}

// ***********************
// ***********************
// ** THE LOOKUP TABLES **
// ***********************
// ***********************

#pragma romdata tables = 0x10200
#include	<p2_tables.romdata> 		// new table for deco_main_v.101 (var_a modified)

#pragma romdata tables2 = 0x10600
rom const rom unsigned int md_pi[] =
{
    0x292E, 0x43C9, 0xA2D8, 0x7C01, 0x3D36, 0x54A1, 0xECF0, 0x0613
  , 0x62A7, 0x05F3, 0xC0C7, 0x738C, 0x9893, 0x2BD9, 0xBC4C, 0x82CA
  , 0x1E9B, 0x573C, 0xFDD4, 0xE016, 0x6742, 0x6F18, 0x8A17, 0xE512
  , 0xBE4E, 0xC4D6, 0xDA9E, 0xDE49, 0xA0FB, 0xF58E, 0xBB2F, 0xEE7A
  , 0xA968, 0x7991, 0x15B2, 0x073F, 0x94C2, 0x1089, 0x0B22, 0x5F21
  , 0x807F, 0x5D9A, 0x5A90, 0x3227, 0x353E, 0xCCE7, 0xBFF7, 0x9703
  , 0xFF19, 0x30B3, 0x48A5, 0xB5D1, 0xD75E, 0x922A, 0xAC56, 0xAAC6
  , 0x4FB8, 0x38D2, 0x96A4, 0x7DB6, 0x76FC, 0x6BE2, 0x9C74, 0x04F1
  , 0x459D, 0x7059, 0x6471, 0x8720, 0x865B, 0xCF65, 0xE62D, 0xA802
  , 0x1B60, 0x25AD, 0xAEB0, 0xB9F6, 0x1C46, 0x6169, 0x3440, 0x7E0F
  , 0x5547, 0xA323, 0xDD51, 0xAF3A, 0xC35C, 0xF9CE, 0xBAC5, 0xEA26
  , 0x2C53, 0x0D6E, 0x8528, 0x8409, 0xD3DF, 0xCDF4, 0x4181, 0x4D52
  , 0x6ADC, 0x37C8, 0x6CC1, 0xABFA, 0x24E1, 0x7B08, 0x0CBD, 0xB14A
  , 0x7888, 0x958B, 0xE363, 0xE86D, 0xE9CB, 0xD5FE, 0x3B00, 0x1D39
  , 0xF2EF, 0xB70E, 0x6658, 0xD0E4, 0xA677, 0x72F8, 0xEB75, 0x4B0A
  , 0x3144, 0x50B4, 0x8FED, 0x1F1A, 0xDB99, 0x8D33, 0x9F11, 0x8314
};

// *********************
// *********************
// ** THE SUBROUTINES **
// *********************
// *********************

#pragma code subroutines = 0x10700	// can be adapted to fit the romdata tables ahead


// ---------------
// CLEAR tissue //
// ---------------
// optimized in v.101 (var_a)

void clear_tissue(void)    // preload tissues with standard pressure for the given ambient pressure
{
_asm
lfsr 1, 0x300 // C math routines shall use this variable bank
movlw	0x01
movwf	TBLPTRU,0
_endasm

// N2_ratio = (float)char_I_N2_ratio; // the 0.0002 of 0.7902 are missing with standard air
 N2_ratio = 0.7902; // N2_ratio / 100.0;
 pres_respiration = (float)int_I_pres_respiration / 1000.0;
for (ci=0;ci<16;ci++)  // cycle through the 16 b"uhlmann tissues
{
 pres_tissue[ci] =  N2_ratio * (pres_respiration -  0.0627) ;
_asm
movlw	0x02
movwf	TBLPTRH,0
movlb	4 // fuer ci
movf ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addlw	0x80
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_a+1
TBLRDPOSTINC
movff	TABLAT,var_a
TBLRDPOSTINC
movff	TABLAT,var_a+3
TBLRD
movff	TABLAT,var_a+2
addlw	0x80
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_b+1
TBLRDPOSTINC
movff	TABLAT,var_b
TBLRDPOSTINC
movff	TABLAT,var_b+3
TBLRD
movff	TABLAT,var_b+2
_endasm

pres_tissue_limit[ci] = (pres_tissue[ci] - var_a) * var_b ;
// now update the guiding tissue
if (pres_tissue_limit[ci] < 0)
pres_tissue_limit[ci] = 0;
} // for 0 to 16

for (ci=16;ci<32;ci++)  // cycle through the 16 b"uhlmann tissues for Helium
{
 pres_tissue[ci] = 0.0;
}  // for

 clear_decoarray();
 char_O_deco_status = 0;
 char_O_nullzeit = 0;
 char_O_ascenttime = 0;
 char_O_gradient_factor = 0;
 char_O_relative_gradient_GF = 0;
} // clear_tissue(void)


// --------------------
// calc_without_deco //
// fixed N2_ratio !  //
// --------------------
// optimized in v.101 (float_..saturation_multiplier)

void calc_without_deco(void)
{
_asm
 lfsr 1, 0x300
_endasm
 N2_ratio = 0.7902; // FIXED RATIO !! sum as stated in b"uhlmann
 pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system
 pres_surface = (float)int_I_pres_surface / 1000.0;
 temp_atem = N2_ratio * (pres_respiration - 0.0627); // 0.0627 is the extra pressure in the body
 temp2_atem = 0.0;
 temp_surface = pres_surface; // the b"uhlmann formula using temp_surface does apply to the pressure without any inert ratio
 float_desaturation_multiplier = char_I_desaturation_multiplier / 100.0;
 float_saturation_multiplier = char_I_saturation_multiplier / 100.0;

 calc_tissue();  // update the pressure in the 16 tissues in accordance with the new ambient pressure

 clear_decoarray();
 char_O_deco_status = 0;
 char_O_nullzeit = 0;
 char_O_ascenttime = 0;
 calc_gradient_factor();

} // calc_without_deco


// --------------------
// calc_hauptroutine //
// --------------------
// this is the major code in dive mode
// calculates:
// 		the tissues,
//		the bottom time
//		and simulates the ascend with all deco stops

void calc_hauptroutine(void)
{
	calc_hauptroutine_data_input();
	calc_hauptroutine_update_tissues();
	calc_gradient_factor();


	switch (char_O_deco_status)	// toggle between calculation for nullzeit (bottom time), deco stops and more deco stops (continue)
	{
 		case 0:
			update_startvalues();
			calc_nullzeit();
			char_O_deco_status = 255; // calc deco next time
			break;
		case 1:
			if (char_O_deco_status == 3)
				break;
			char_O_deco_status = 0;
//			char_O_lock_depth_list = 255;
			calc_hauptroutine_calc_deco();
//			build_debug_output();
			break;
		case 3:				// new dive
			clear_decoarray();
			clear_internal_deco_table_GF();
			copy_deco_table_GF();
			internal_deco_pointer = 0;
			lock_GF_depth_list = 0;
			update_startvalues();
			calc_nextdecodepth_GF();
			char_O_deco_status = 0;
			break;
		default:
			update_startvalues();
			clear_decoarray();
			clear_internal_deco_table_GF();
			output[6] = 1;
			calc_hauptroutine_calc_ascend_to_deco();
 			if (char_O_deco_status > 15)		// can't go up to first deco, too deep to calculate in the given time slot
			{
				char_O_deco_status = 2;
//				char_O_lock_depth_list = 255;
			}
 			else
			{
//				char_O_lock_depth_list = lock_GF_depth_list;
				calc_hauptroutine_calc_deco();
			}
//			build_debug_output();
			break;
	}
	calc_ascenttime();
}

void calc_hauptroutine_data_input(void)
{
 pres_respiration = (float)int_I_pres_respiration / 1000.0;
 pres_surface = (float)int_I_pres_surface / 1000.0;

 N2_ratio = (float)char_I_N2_ratio / 100.0;; // the 0.0002 of 0.7902 are missing with standard air
 He_ratio = (float)char_I_He_ratio / 100.0;;
 deco_N2_ratio = (float)char_I_deco_N2_ratio / 100.0;
 deco_He_ratio = (float)char_I_deco_He_ratio / 100.0;
 float_deco_distance = (float)char_I_deco_distance / 100.0;
 deco_gas_change = (float)char_I_deco_gas_change / 9.995 + pres_surface;
 deco_gas_change = deco_gas_change + float_deco_distance;
 const_ppO2 = (float)char_I_const_ppO2 / 100.0;
 deco_ppO2_change = (float)char_I_deco_ppO2_change / 99.95 + pres_surface;
 deco_ppO2_change = deco_ppO2_change + float_deco_distance;
 deco_ppO2 = (float)char_I_deco_ppO2 / 100.0;
 float_desaturation_multiplier = (float)char_I_desaturation_multiplier / 100.0;
 float_saturation_multiplier = (float)char_I_saturation_multiplier / 100.0;
 GF_low = (float)char_I_GF_Low_percentage / 100.0;
 GF_high = (float)char_I_GF_High_percentage / 100.0;
 GF_delta = GF_high - GF_low;

 temp2 = (pres_respiration - pres_surface) / 0.29985;
 int_temp = (int)(temp2);
 if (int_temp < 0)
	int_temp = 0;
 if (int_temp > 255)
	int_temp = 255;
 char_O_actual_pointer = int_temp;

 temp_depth_last_deco = (int)char_I_depth_last_deco;
}

void calc_hauptroutine_update_tissues(void)
{
	int_O_calc_tissue_call_counter = int_O_calc_tissue_call_counter + 1;
 	if (char_I_const_ppO2 == 0)																// new in v.101
  		pres_diluent = pres_respiration;															// new in v.101
 	else																						// new in v.101
  		pres_diluent = ((pres_respiration - const_ppO2)/(N2_ratio + He_ratio));					// new in v.101
 	if (pres_diluent > pres_respiration)														// new in v.101
  		pres_diluent = pres_respiration;															// new in v.101
 	if (pres_diluent > 0.0627)																	// new in v.101
 	{
 		temp_atem = N2_ratio * (pres_diluent - 0.0627);											// changed in v.101
 		temp2_atem = He_ratio * (pres_diluent - 0.0627);											// changed in v.101
 		char_O_diluent = (char)(pres_diluent/pres_respiration*100.0);
 	}
 	else																						// new in v.101
 	{
 		temp_atem = 0.0;																			// new in v.101
 		temp2_atem = 0.0;																			// new in v.101
 		char_O_diluent = 0;
 	}
 	temp_surface = pres_surface;
 	calc_tissue();
 	int_O_gtissue_limit = (int)(pres_tissue_limit[char_O_gtissue_no] * 1000);
	int_O_gtissue_press = (int)((pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16]) * 1000);
 	if (char_I_deco_model == 1)
 	{
		temp1 = temp1 * GF_high;
 	}
	else
	{
	temp1 = temp_surface;
	}
	if (pres_gtissue_limit > temp1 && char_O_deco_status == 0)  // if guiding tissue can not be exposed to surface pressure immediately
 	{
  		char_O_nullzeit = 0; // deco necessary
  		char_O_deco_status = 255; // calculate deco skip nullzeit calculation
 	}
} 		// calc_hauptroutine_update_tissues
void calc_hauptroutine_calc_deco(void)
{
 	do
  	{
  		int_temp_decostatus = 0;
  		calc_nextdecodepth_GF();
  		if (temp_depth_limit > 0)
   		{
    		if (char_I_const_ppO2 == 0)																// new in v.101
	 		{
     			deco_diluent = temp_deco;																// new in v.101
	 			if (temp_deco > deco_gas_change)
	  			{
	  				calc_N2_ratio = N2_ratio;
	  				calc_He_ratio = He_ratio;
	  			}
	 			else
	  			{
	  				calc_N2_ratio = deco_N2_ratio;
	  				calc_He_ratio = deco_He_ratio;
	  			}
	 		}
    		else																					// new in v.101
	 		{
	 			calc_N2_ratio = N2_ratio;
	 			calc_He_ratio = He_ratio;
	 			if (temp_deco > deco_ppO2_change)
				{
      				deco_diluent = ((temp_deco - const_ppO2)/(N2_ratio + He_ratio));			// new in v.101
				}
	 			else
				{
      				deco_diluent = ((temp_deco - deco_ppO2)/(N2_ratio + He_ratio));			// new in v.101
				}
	 		}
    		if (deco_diluent > temp_deco)															// new in v.101
     			deco_diluent = temp_deco;																// new in v.101
 			if (deco_diluent > 0.0627)																// new in v.101
    		{
     			temp_atem = calc_N2_ratio * (deco_diluent - 0.0627);										// changed in v.101
				temp2_atem = calc_He_ratio * (deco_diluent - 0.0627);										// changed in v.101
    		}
    		else																					// new in v.101
    		{
     			temp_atem = 0.0;																		// new in v.101
     			temp2_atem = 0.0;																		// new in v.101
    		}
   			sim_tissue_1min();
			update_internal_deco_table_GF();
   			temp_decotime = 1;
   			update_decoarray();
   			char_O_deco_status = char_O_deco_status + 1;
   			if (char_O_deco_status < 16)
     			int_temp_decostatus = 1;
   		}
  		else // if (temp_depth_limit > 0)
		{
   		char_O_deco_status = 0;
		}
	} while (int_temp_decostatus == 1);
	if (char_O_deco_status > 15)
	{
   		char_O_deco_status = 1;
	}
  	else
  	{
		copy_deco_table_GF();
		char_O_deco_status = 0;
  	}
}

void calc_hauptroutine_calc_ascend_to_deco(void)
{
 	update_startvalues();
 	char_O_deco_status = 0;
   	temp_deco = pres_respiration;
 	lock_GF_depth_list = 1; 																// new in v.102
 	do								// go up to first deco
  	{
  		int_temp_decostatus = 0;
  		temp_deco = temp_deco - 1.0;
  		if ( char_I_deco_model == 1)																// new in v.102 , 4 = deep stops
			temp_limit = temp_pres_gtissue_limit_GF_low;
  		else
			temp_limit = temp_pres_gtissue_limit;
  		if ((temp_deco > temp_limit) && (temp_deco > pres_surface)) 								// changes in v.102
   		{
   			lock_GF_depth_list = 0; 																	// new in v.102, distance to first stop > 10 mtr.
			output[6] = 0;
  		 	if (char_I_const_ppO2 == 0)																// new in v.101 // calculate at half of the ascent
			{
    			deco_diluent = temp_deco + 0.5;															// new in v.101
				if (temp_deco + 0.5 > deco_gas_change)
	 			{
	 				calc_N2_ratio = N2_ratio;
	 				calc_He_ratio = He_ratio;
	 			}
				else
	 			{
	 				calc_N2_ratio = deco_N2_ratio;
	 				calc_He_ratio = deco_He_ratio;
	 			}
			}
   			else																						// new in v.101
			{
					calc_N2_ratio = N2_ratio;
					calc_He_ratio = He_ratio;
					if (temp_deco + 0.5 > deco_ppO2_change)
     					deco_diluent = ((temp_deco + 0.5 - const_ppO2)/(N2_ratio + He_ratio));	// new in v.101 // calculate at half of the ascent
					else
     					deco_diluent = ((temp_deco + 0.5 - deco_ppO2)/(N2_ratio + He_ratio));	// new in v.101 // calculate at half of the ascent
    				if (deco_diluent > (temp_deco +0.5))															// new in v.101
     					deco_diluent = temp_deco + 0.5;															// new in v.101 // calculate at half of the ascent
			}
   			if (deco_diluent > 0.0627)																// new in v.101
    		{
    			temp_atem = calc_N2_ratio * (deco_diluent - 0.0627);											// changed in v.101
    			temp2_atem = calc_He_ratio * (deco_diluent - 0.0627);										// changed in v.101
    		}
   			else																						// new in v.101
    		{
    			temp_atem = 0.0;																		// new in v.101
    			temp2_atem = 0.0;																		// new in v.101
    		}
   			sim_tissue_1min();
   			char_O_deco_status = char_O_deco_status + 1;
   			if (char_O_deco_status < 16)  // 16 is the limit of calculations for one time slot
    			int_temp_decostatus = 1;
   		}
	} while (int_temp_decostatus == 1);
}	// calc_hauptroutine_calc_ascend_to_deco

// --------------
// calc_tissue //
// --------------
// optimized in v.101

void calc_tissue(void)
{
_asm
lfsr 1, 0x300
movlw	0x01
movwf	TBLPTRU,0
_endasm

 char_O_gtissue_no = 255;
 pres_gtissue_limit = 0.0;

for (ci=0;ci<16;ci++)
{
_asm
movlw	0x02
movwf	TBLPTRH,0
movlb	4 // fuer ci
movf ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addwf	ci,0,1
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_e2secs+1 // the order is confussing
TBLRDPOSTINC
movff	TABLAT,var_e2secs	// low byte first, high afterwards
TBLRDPOSTINC
movff	TABLAT,var_e2secs+3
TBLRD
movff	TABLAT,var_e2secs+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_e2secs+1
TBLRDPOSTINC
movff	TABLAT,var2_e2secs
TBLRDPOSTINC
movff	TABLAT,var2_e2secs+3
TBLRD
movff	TABLAT,var2_e2secs+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_a+1
TBLRDPOSTINC
movff	TABLAT,var_a
TBLRDPOSTINC
movff	TABLAT,var_a+3
TBLRD
movff	TABLAT,var_a+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_a+1
TBLRDPOSTINC
movff	TABLAT,var2_a
TBLRDPOSTINC
movff	TABLAT,var2_a+3
TBLRD
movff	TABLAT,var2_a+2
addlw	0x40
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_b+1
TBLRDPOSTINC
movff	TABLAT,var_b
TBLRDPOSTINC
movff	TABLAT,var_b+3
TBLRD
movff	TABLAT,var_b+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_b+1
TBLRDPOSTINC
movff	TABLAT,var2_b
TBLRDPOSTINC
movff	TABLAT,var2_b+3
TBLRD
movff	TABLAT,var2_b+2
_endasm
 // the start values are the previous end values // write new values in temp

// N2
 temp_tissue = (temp_atem - pres_tissue[ci]) * var_e2secs;
 temp_tissue_safety();
 pres_tissue[ci] = pres_tissue[ci] + temp_tissue;

// He
 temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e2secs;
 temp_tissue_safety();
 pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue;

 temp_tissue = pres_tissue[ci] + pres_tissue[ci+16];

 var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue;
 var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue;
 pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b;
 if (pres_tissue_limit[ci] < 0)
  pres_tissue_limit[ci] = 0;
 if (pres_tissue_limit[ci] > pres_gtissue_limit)
  {
  pres_gtissue_limit = pres_tissue_limit[ci];
  char_O_gtissue_no = ci;
  }//if
} // for
}//calc_tissue(void)

// ----------------
// calc_nullzeit //
// ----------------
// calculates the remaining bottom time

// unchanged in v.101

void calc_nullzeit(void)
{
	char_O_nullzeit = 0;
	int_temp = 1;
 	do
	{
  		backup_sim_pres_tissue();
  		sim_tissue_10min();
  		char_O_nullzeit = char_O_nullzeit + 10;
  		int_temp = int_temp + 1;
		if (char_I_deco_model == 1)
			temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue;
		else
			temp1 = temp_pres_gtissue_limit;
		if (temp1 > temp_surface)  // changed in v.102 , if guiding tissue can not be exposed to surface pressure immediately
			int_temp = 255;
 	} while (int_temp < 17);
 	if (int_temp == 255)
 	{
  		restore_sim_pres_tissue();
  		char_O_nullzeit = char_O_nullzeit - 10;
 	} //if int_temp == 255]
 	int_temp = 1;
 	if (char_O_nullzeit < 60)
 	{
  		do
		{
   			sim_tissue_1min();
   			char_O_nullzeit = char_O_nullzeit + 1;
   			int_temp = int_temp + 1;			// new in v.102a
		if (char_I_deco_model == 1)
			temp1 = GF_high * temp_pres_gtissue_diff + temp_pres_gtissue;
		else
			temp1 = temp_pres_gtissue_limit;
		if (temp1 > temp_surface)  // changed in v.102 , if guiding tissue can not be exposed to surface pressure immediately
			int_temp = 255;
  		} while (int_temp < 10);
  		if (int_temp == 255)
   			char_O_nullzeit = char_O_nullzeit - 1;
 	} // if char_O_nullzeit < 60
} //calc_nullzeit

// -------------------------
// backup_sim_pres_tissue //
// -------------------------
void backup_sim_pres_tissue(void)
{
  for (x = 0;x<16;x++)
  {
   sim_pres_tissue_backup[x] = sim_pres_tissue[x];
   sim_pres_tissue_backup[x+16] = sim_pres_tissue[x+16];
  }
} // backup_sim

// --------------------------
// restore_sim_pres_tissue //
// --------------------------
void restore_sim_pres_tissue(void)
{
  for (x = 0;x<16;x++)
  {
   sim_pres_tissue[x] = sim_pres_tissue_backup[x];
   sim_pres_tissue[x+16] = sim_pres_tissue_backup[x+16];
  }
} // restore_sim

// ------------------
// calc_ascenttime //
// ------------------

void calc_ascenttime(void)
{
if (pres_respiration > pres_surface)
 {
 switch (char_O_deco_status)
  {
  case 2:
	char_O_ascenttime = 255;
	break;
  case 1:
	break;
  default:
	temp1 = pres_respiration - pres_surface + 0.6; // + 0.6 hence 1 minute ascent time from a depth of 4 meter on
	if (temp1 < 0)
		temp1 = 0;
	if (temp1 > 255)
		temp1 = 255;
    char_O_ascenttime = (char)temp1;

	for(ci=0;ci<7;ci++)
	{
	x = char_O_ascenttime + char_O_array_decotime[ci];
	if (x < char_O_ascenttime)
		char_O_ascenttime = 255;
	else
		char_O_ascenttime = x;
	}
  }
 }
else
 char_O_ascenttime = 0;
} // calc_ascenttime()


// ---------------------
// update_startvalues //
// ---------------------
// updated in v.102

void update_startvalues(void)
{
  	temp_pres_gtissue_limit = pres_gtissue_limit;
  	temp_pres_gtissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16];
  	temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue;						// negative number
	temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue;
  	temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface;
	if (temp_pres_gtissue_limit_GF_low_below_surface < 0)
		temp_pres_gtissue_limit_GF_low_below_surface = 0;

	temp_gtissue_no = char_O_gtissue_no;
  	for (x = 0;x<16;x++)
  	{
   		sim_pres_tissue[x] = pres_tissue[x];
   		sim_pres_tissue[x+16] = pres_tissue[x+16];
   		sim_pres_tissue_limit[x] = pres_tissue_limit[x];
  	}
} // update_startvalues


// ------------------
// sim_tissue_1min //
// ------------------
// optimized in v.101

void sim_tissue_1min(void)
{
temp_pres_gtissue_limit = 0.0;
temp_gtissue_no = 255;

_asm
lfsr 1, 0x300
movlw	0x01
movwf	TBLPTRU,0
_endasm


for (ci=0;ci<16;ci++)
{
_asm
movlw	0x02
movwf	TBLPTRH,0
movlb	4 // fuer ci
movf ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addlw	0x80
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_a+1
TBLRDPOSTINC
movff	TABLAT,var_a
TBLRDPOSTINC
movff	TABLAT,var_a+3
TBLRD
movff	TABLAT,var_a+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_a+1
TBLRDPOSTINC
movff	TABLAT,var2_a
TBLRDPOSTINC
movff	TABLAT,var2_a+3
TBLRD
movff	TABLAT,var2_a+2
addlw	0x40
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_b+1
TBLRDPOSTINC
movff	TABLAT,var_b
TBLRDPOSTINC
movff	TABLAT,var_b+3
TBLRD
movff	TABLAT,var_b+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_b+1
TBLRDPOSTINC
movff	TABLAT,var2_b
TBLRDPOSTINC
movff	TABLAT,var2_b+3
TBLRD
movff	TABLAT,var2_b+2
addlw	0xC0
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_e1min+1
TBLRDPOSTINC
movff	TABLAT,var_e1min
TBLRDPOSTINC
movff	TABLAT,var_e1min+3
TBLRD
movff	TABLAT,var_e1min+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_e1min+1
TBLRDPOSTINC
movff	TABLAT,var2_e1min
TBLRDPOSTINC
movff	TABLAT,var2_e1min+3
TBLRD
movff	TABLAT,var2_e1min+2
_endasm
// N2
 temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min;
 temp_tissue_safety();
 sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue;
// He
 temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min;
 temp_tissue_safety();
 sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue;
// pressure limit
 temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16];
 var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue;
 var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue;
 sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b;

 if (sim_pres_tissue_limit[ci] < 0)
  sim_pres_tissue_limit[ci] = 0;
 if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit)
  {
  temp_pres_gtissue = temp_tissue;
  temp_pres_gtissue_limit = sim_pres_tissue_limit[ci];
  temp_gtissue_no = ci;
  }
} // for
  	temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue;
	temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue;
  	temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface;
	if (temp_pres_gtissue_limit_GF_low_below_surface < 0)
		temp_pres_gtissue_limit_GF_low_below_surface = 0;
} //sim_tissue_1min()

//--------------------
// sim_tissue_10min //
//--------------------

// Attention!! uses var_e1min und var2_e1min to load 10min data !!!
// is identical to sim_tissue_1min routine except for the different load of those variables

// optimized in v.101

void sim_tissue_10min(void)
{
temp_pres_gtissue_limit = 0.0;
temp_gtissue_no = 255;

_asm
lfsr 1, 0x300
movlw	0x01
movwf	TBLPTRU,0
_endasm

for (ci=0;ci<16;ci++)
{
_asm
movlw	0x02
movwf	TBLPTRH,0
movlb	4 // fuer ci
movf ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addlw	0x80
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_a+1
TBLRDPOSTINC
movff	TABLAT,var_a
TBLRDPOSTINC
movff	TABLAT,var_a+3
TBLRD
movff	TABLAT,var_a+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_a+1
TBLRDPOSTINC
movff	TABLAT,var2_a
TBLRDPOSTINC
movff	TABLAT,var2_a+3
TBLRD
movff	TABLAT,var2_a+2
addlw	0x40
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_b+1
TBLRDPOSTINC
movff	TABLAT,var_b
TBLRDPOSTINC
movff	TABLAT,var_b+3
TBLRD
movff	TABLAT,var_b+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_b+1
TBLRDPOSTINC
movff	TABLAT,var2_b
TBLRDPOSTINC
movff	TABLAT,var2_b+3
TBLRD
movff	TABLAT,var2_b+2
addlw	0xC0				// different to 1 min
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
incf	TBLPTRH,1,0			// different to 1 min
TBLRDPOSTINC
movff	TABLAT,var_e1min+1
TBLRDPOSTINC
movff	TABLAT,var_e1min
TBLRDPOSTINC
movff	TABLAT,var_e1min+3
TBLRD
movff	TABLAT,var_e1min+2
addlw	0x40
movwf	TBLPTRL,0
//incf	TBLPTRH,1,0			// different to 1 min
TBLRDPOSTINC
movff	TABLAT,var2_e1min+1
TBLRDPOSTINC
movff	TABLAT,var2_e1min
TBLRDPOSTINC
movff	TABLAT,var2_e1min+3
TBLRD
movff	TABLAT,var2_e1min+2
_endasm
// N2
 temp_tissue = (temp_atem - sim_pres_tissue[ci]) * var_e1min;
 temp_tissue_safety();
 sim_pres_tissue[ci] = sim_pres_tissue[ci] + temp_tissue;
// He
 temp_tissue = (temp2_atem - sim_pres_tissue[ci+16]) * var2_e1min;
 temp_tissue_safety();
 sim_pres_tissue[ci+16] = sim_pres_tissue[ci+16] + temp_tissue;
// pressure limit
temp_tissue = sim_pres_tissue[ci] + sim_pres_tissue[ci+16];
 var_a = (var_a * sim_pres_tissue[ci] + var2_a * sim_pres_tissue[ci+16]) / temp_tissue;
 var_b = (var_b * sim_pres_tissue[ci] + var2_b * sim_pres_tissue[ci+16]) / temp_tissue;

sim_pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b;
 if (sim_pres_tissue_limit[ci] < 0)
  sim_pres_tissue_limit[ci] = 0;
 if (sim_pres_tissue_limit[ci] > temp_pres_gtissue_limit)
  {
  temp_pres_gtissue = temp_tissue;
  temp_pres_gtissue_limit = sim_pres_tissue_limit[ci];
  temp_gtissue_no = ci;
  }
} // for
  	temp_pres_gtissue_diff = temp_pres_gtissue_limit - temp_pres_gtissue;							// negative number
	temp_pres_gtissue_limit_GF_low = GF_low * temp_pres_gtissue_diff + temp_pres_gtissue;
  	temp_pres_gtissue_limit_GF_low_below_surface = temp_pres_gtissue_limit_GF_low - pres_surface;
	if (temp_pres_gtissue_limit_GF_low_below_surface < 0)
		temp_pres_gtissue_limit_GF_low_below_surface = 0;
} //sim_tissue_10min()


// ------------------
// clear_decoarray //
// ------------------
// unchanged in v.101

void clear_decoarray(void)
{
char_O_array_decodepth[0] = 0;
char_O_array_decodepth[1] = 0;
char_O_array_decodepth[2] = 0;
char_O_array_decodepth[3] = 0;
char_O_array_decodepth[4] = 0;
char_O_array_decodepth[5] = 0;
char_O_array_decotime[0] = 0;
char_O_array_decotime[1] = 0;
char_O_array_decotime[2] = 0;
char_O_array_decotime[3] = 0;
char_O_array_decotime[4] = 0;
char_O_array_decotime[5] = 0;
char_O_array_decotime[6] = 0;
} // clear_decoarray


// -------------------
// update_decoarray //
// -------------------
// unchanged in v.101

void update_decoarray()
{
	x = 0;
	do
	{
		if (char_O_array_decodepth[x] == temp_depth_limit)
		{
			int_temp = char_O_array_decotime[x] + temp_decotime;
			if (int_temp < 0)
				int_temp = 0;
			if (int_temp > 240)
				int_temp = 240;
 			char_O_array_decotime[x] = int_temp;
			x = 10; // exit
		} // if
		else
 		{
 			if (char_O_array_decodepth[x] == 0)
  			{
  				if (temp_depth_limit > 255)
   					char_O_array_decodepth[x] = 255;
  				else
   					char_O_array_decodepth[x] = (char)temp_depth_limit;
  				int_temp = char_O_array_decotime[x] + temp_decotime;
  				if (int_temp > 240)
   					char_O_array_decotime[x] = 240;
  				else
   					char_O_array_decotime[x] = (char)int_temp;
  				x = 10; // exit
  			} // if
 			else
  				x++;
 		} // else
	} while (x<6);
	if (x == 6)
 	{
 		int_temp = char_O_array_decotime[6] + temp_decotime;
 		if (int_temp > 220)
  			char_O_array_decotime[6] = 220;
 		else
  			char_O_array_decotime[6] = (char)int_temp;
 	} // if x == 6
} // update_decoarray


// -----------------------
// calc_gradient_factor //
// -----------------------
// optimized in v.101 (var_a)
// new code in v.102

void calc_gradient_factor(void)
{
	// tissue > respiration (entsaettigungsvorgang)
	// gradient ist wieviel prozent an limit mit basis tissue
	// dh. 0% = respiration == tissue
	// dh. 100% = respiration == limit
	temp_tissue = pres_tissue[char_O_gtissue_no] + pres_tissue[char_O_gtissue_no+16];
	temp1 = temp_tissue - pres_respiration;
	temp2 = temp_tissue - pres_tissue_limit[char_O_gtissue_no];	// changed in v.102
	temp2 = temp1/temp2;
	temp2 = temp2 * 100; // displayed in percent
	if (temp2 < 0)
		temp2 = 0;
	if (temp2 > 255)
		temp2 = 255;
	if (temp1 < 0)
 		char_O_gradient_factor = 0;
	else
 		char_O_gradient_factor = (char)temp2;

	temp3 = temp2;

	if (char_I_deco_model == 1)		// calculate relative gradient factor
	{
		temp1 = (float)temp_depth_GF_low_meter * 0.09995;
		temp2 = pres_respiration - pres_surface;
		if (temp2 <= 0)
			temp1 = GF_high;
		else
		if (temp2 >= temp1)
			temp1 = GF_low;
		else
			temp1 = GF_low + (temp1 - temp2)/temp1*GF_delta;
		if (temp_depth_GF_low_meter == 0)
			temp1 = GF_high;
		temp2 = temp3 / temp1; // temp3 is already in percent
		if (temp2 < 0)
			temp2 = 0;
		if (temp2 > 255)
			temp2 = 255;
		char_O_relative_gradient_GF  = (char)temp2;
	}	// calc relative gradient factor
	else
	{
 			char_O_relative_gradient_GF = char_O_gradient_factor;
	}
} // calc_gradient

// ---------------------------
// calc_gradient_array_only //
// ---------------------------
// optimized in v.101 (var_a)
// new code in v.102

void calc_gradient_array_only()
{
 pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system
for (ci=0;ci<16;ci++)
{
	temp_tissue = pres_tissue[ci] + pres_tissue[ci+16];
	temp1 = temp_tissue - pres_respiration;
	temp2 = temp_tissue - pres_tissue_limit[ci];
	temp2 = temp1/temp2;
	temp2 = temp2 * 200; // because of output in (Double-)percentage
	if (temp2 < 0)
		temp2 = 0;
	if (temp2 > 255)
		temp2 = 255;
	if (temp1 < 0)
 		char_O_array_gradient_weighted[ci] = 0;
	else
 		char_O_array_gradient_weighted[ci] = (char)temp2;
} // for
} // calc_gradient_array_only


// -------------------------
// calc_desaturation_time //
// -------------------------
// FIXED N2_ratio
// unchanged in v.101

void calc_desaturation_time(void)
{
_asm
lfsr 1, 0x300
movlw	0x01
movwf	TBLPTRU,0
_endasm
 N2_ratio = 0.7902; // FIXED sum as stated in b"uhlmann
 pres_surface = (float)int_I_pres_surface / 1000.0;
 temp_atem = N2_ratio * (pres_surface - 0.0627);
 int_O_desaturation_time = 0;
 float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101	(70,42%/100.=142)

for (ci=0;ci<16;ci++)
{
_asm
movlw	0x04
movwf	TBLPTRH,0
movlb	4 // fuer ci
movf ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addlw	0x80
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_halftimes+1
TBLRDPOSTINC
movff	TABLAT,var_halftimes
TBLRDPOSTINC
movff	TABLAT,var_halftimes+3
TBLRD
movff	TABLAT,var_halftimes+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_halftimes+1
TBLRDPOSTINC
movff	TABLAT,var2_halftimes
TBLRDPOSTINC
movff	TABLAT,var2_halftimes+3
TBLRD
movff	TABLAT,var2_halftimes+2
_endasm

// saturation_time (for flight) and N2_saturation in multiples of halftime
// version v.100: 1.1 = 10 percent distance to totally clean (totally clean is not possible, would take infinite time )
// new in version v.101: 1.07 = 7 percent distance to totally clean (totally clean is not possible, would take infinite time )
// changes in v.101: 1.05 = 5 percent dist to totally clean is new desaturation point for display and noFly calculations
// N2
 temp1 = 1.05 * temp_atem;
 temp1 = temp1 - pres_tissue[ci];
 temp2 = temp_atem - pres_tissue[ci];
  if (temp2 >= 0.0)
	{
	temp1 = 0;
	temp2 = 0;
	}
 else
    temp1 = temp1 / temp2;
  if (temp1 > 0.0)
	{
	temp1 = log(1.0 - temp1);
	temp1 = temp1 / -0.6931; // temp1 is the multiples of half times necessary.
							 // 0.6931 is ln(2), because the math function log() calculates with a base of e not 2 as requested.
							 // minus because log is negative
	temp2 = var_halftimes * temp1 / float_desaturation_multiplier; // time necessary (in minutes ) for complete desaturation (see comment about 10 percent) , new in v.101: float_desaturation_multiplier
	}
 else
	{
	temp1 = 0;
	temp2 = 0;
	}

// He
 temp3 = 0.1 - pres_tissue[ci+16];
if (temp3 >= 0.0)
	{
	temp3 = 0;
	temp4 = 0;
	}
 else
    temp3 = -1.0 * temp3 / pres_tissue[ci+16];
  if (temp3 > 0.0)
	{
	temp3 = log(1.0 - temp3);
	temp3 = temp3 / -0.6931; // temp1 is the multiples of half times necessary.
							 // 0.6931 is ln(2), because the math function log() calculates with a base of e  not 2 as requested.
							 // minus because log is negative
	temp4 = var2_halftimes * temp3 / float_desaturation_multiplier; // time necessary (in minutes ) for "complete" desaturation, new in v.101 float_desaturation_multiplier
	}
 else
	{
	temp3 = 0;
	temp4 = 0;
	}

// saturation_time (for flight)
 if (temp4 > temp2)
	 int_temp = (int)temp4;
 else
	 int_temp = (int)temp2;
 if(int_temp > int_O_desaturation_time)
	int_O_desaturation_time = int_temp;

// N2 saturation in multiples of halftime for display purposes
 temp2 = temp1 * 20.0;  // 0 = 1/8, 120 = 0, 249 = 8
 temp2 = temp2 + 80.0; // set center
 if (temp2 < 0.0)
	 temp2 = 0.0;
 if (temp2 > 255.0)
 	 temp2 = 255.0;
 char_O_tissue_saturation[ci] = (char)temp2;
// He saturation in multiples of halftime for display purposes
 temp4 = temp3 * 20.0;  // 0 = 1/8, 120 = 0, 249 = 8
 temp4 = temp4 + 80.0; // set center
 if (temp4 < 0.0)
	 temp4 = 0.0;
 if (temp4 > 255.0)
 	 temp4 = 255.0;
 char_O_tissue_saturation[ci+16] = (char)temp4;
} // for
} // calc_desaturation_time


// --------------------------
// calc_wo_deco_step_1_min //
// --------------------------
// FIXED N2 Ratio
// optimized in v.101 (...saturation_multiplier)
// desaturation slowed down to 70,42%

void calc_wo_deco_step_1_min(void)
{
_asm
 lfsr 1, 0x300
_endasm
 N2_ratio = 0.7902; // FIXED, sum lt. buehlmann
 pres_respiration = (float)int_I_pres_respiration / 1000.0; // assembler code uses different digit system
 pres_surface = (float)int_I_pres_surface / 1000.0;
 temp_atem = N2_ratio * (pres_respiration - 0.0627); // 0.0627 is the extra pressure in the body
 temp2_atem = 0.0;
 temp_surface = pres_surface; // the b"uhlmann formula using temp_surface does not use the N2_ratio
 float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101	(70,42%/100.=142)
 float_saturation_multiplier = char_I_saturation_multiplier / 100.0;

 calc_tissue_step_1_min();  // update the pressure in the 16 tissues in accordance with the new ambient pressure
 clear_decoarray();
 char_O_deco_status = 0;
 char_O_nullzeit = 0;
 char_O_ascenttime = 0;
 calc_gradient_factor();

} // calc_wo_deco_step_1_min(void)


// -------------------------
// calc_tissue_step_1_min //
// -------------------------
// optimized in v.101

void calc_tissue_step_1_min(void)
{
_asm
lfsr 1, 0x300
movlw	0x01
movwf	TBLPTRU,0
_endasm

 char_O_gtissue_no = 255;
 pres_gtissue_limit = 0.0;

for (ci=0;ci<16;ci++)
{
_asm
movlw	0x02
movwf	TBLPTRH,0
movlb	4 // fuer ci
movf ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addwf	ci,0,1
addlw	0x80
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var_a+1
TBLRDPOSTINC
movff	TABLAT,var_a
TBLRDPOSTINC
movff	TABLAT,var_a+3
TBLRD
movff	TABLAT,var_a+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_a+1
TBLRDPOSTINC
movff	TABLAT,var2_a
TBLRDPOSTINC
movff	TABLAT,var2_a+3
TBLRD
movff	TABLAT,var2_a+2
addlw	0x40
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_b+1
TBLRDPOSTINC
movff	TABLAT,var_b
TBLRDPOSTINC
movff	TABLAT,var_b+3
TBLRD
movff	TABLAT,var_b+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_b+1
TBLRDPOSTINC
movff	TABLAT,var2_b
TBLRDPOSTINC
movff	TABLAT,var2_b+3
TBLRD
movff	TABLAT,var2_b+2
addlw	0xC0
movwf	TBLPTRL,0
incf	TBLPTRH,1,0
TBLRDPOSTINC
movff	TABLAT,var_e1min+1
TBLRDPOSTINC
movff	TABLAT,var_e1min
TBLRDPOSTINC
movff	TABLAT,var_e1min+3
TBLRD
movff	TABLAT,var_e1min+2
addlw	0x40
movwf	TBLPTRL,0
TBLRDPOSTINC
movff	TABLAT,var2_e1min+1
TBLRDPOSTINC
movff	TABLAT,var2_e1min
TBLRDPOSTINC
movff	TABLAT,var2_e1min+3
TBLRD
movff	TABLAT,var2_e1min+2
_endasm

// N2 1 min
 temp_tissue = (temp_atem - pres_tissue[ci]) * var_e1min;
 temp_tissue_safety();
 pres_tissue[ci] = pres_tissue[ci] + temp_tissue;

// He 1 min
 temp_tissue = (temp2_atem - pres_tissue[ci+16]) * var2_e1min;
 temp_tissue_safety();
 pres_tissue[ci+16] = pres_tissue[ci+16] + temp_tissue;

 temp_tissue = pres_tissue[ci] + pres_tissue[ci+16];
 var_a = (var_a * pres_tissue[ci] + var2_a * pres_tissue[ci+16]) / temp_tissue;
 var_b = (var_b * pres_tissue[ci] + var2_b * pres_tissue[ci+16]) / temp_tissue;
 pres_tissue_limit[ci] = (temp_tissue - var_a) * var_b;
 if (pres_tissue_limit[ci] < 0)
  pres_tissue_limit[ci] = 0;
 if (pres_tissue_limit[ci] > pres_gtissue_limit)
  {
  pres_gtissue_limit = pres_tissue_limit[ci];
  char_O_gtissue_no = ci;
  }//if

// gradient factor array for graphical display
// display range is 0 to 250! in steps of 5 for 1 pixel
// the display is divided in 6 blocks
// -> double the gradient 100% = 200
// tissue > respiration (entsaettigungsvorgang)
// gradient ist wieviel prozent an limit von tissue aus
// dh. 0% = respiration == tissue
// dh. 100% = respiration == limit
temp1 = temp_tissue - pres_respiration;
temp2 = temp_tissue - pres_tissue_limit[ci];	// changed in v.102
temp2 = temp1/temp2;
temp2 = temp2 * 200; // because of output in (Double-)percentage
if (temp2 < 0)
	temp2 = 0;
if (temp2 > 255)
	temp2 = 255;
if (temp1 < 0)
 char_O_array_gradient_weighted[ci] = 0;
else
 char_O_array_gradient_weighted[ci] = (char)temp2;

} // for
} // calc wo deco 1min

#if 0
// --------
// debug //
// --------
void debug(void)
{
for (ci=0;ci<32;ci++)
{
 int_O_tissue_for_debug[ci] = (unsigned int)(pres_tissue[ci] *1000);
}
} // void debug(void)
#endif

// ----------
// md hash //
// ----------
void hash(void)
{
// init
 for (md_i=0;md_i<16;md_i++)
 {
  md_state[md_i] = 0;
  md_cksum[md_i] = 0;
 } // for md_i 16

_asm
 movlw	0x01
 movwf	TBLPTRU,0
 movlw	0x06
 movwf	TBLPTRH,0
 movlw	0x00
 movwf	TBLPTRL,0
_endasm
 for (md_i=0;md_i<127;md_i++)
 {
_asm
 TBLRDPOSTINC
 movff	TABLAT,md_temp
_endasm
  md_pi_subst[md_i] = md_temp;
 } // for md_i 256
_asm
 TBLRDPOSTINC
 movff	TABLAT,md_temp
_endasm
  md_pi_subst[127] = md_temp;
 for (md_i=0;md_i<127;md_i++)
 {
_asm
 TBLRDPOSTINC
 movff	TABLAT,md_temp
_endasm
  md_pi_subst[md_i+128] = md_temp;
 } // for md_i 256
_asm
 TBLRD
 movff	TABLAT,md_temp
_endasm
  md_pi_subst[255] = md_temp;

_asm
 movlw	0x00
 movwf	TBLPTRU,0
 movlw	0x00
 movwf	TBLPTRH,0
 movlw	0x00
 movwf	TBLPTRL,0
_endasm
// cycle buffers
for (md_pointer=0x0000;md_pointer<0x17f3;md_pointer++)
{
 md_t = 0;
 for (md_i=0;md_i<16;md_i++)
 {
  if(md_pointer == 9)
   md_temp = md_cksum[md_i];
  else
  {
_asm
  TBLRDPOSTINC
  movff	TABLAT,md_temp
_endasm
  } // else
  md_buffer[md_i] = md_temp;
  md_state[md_i+16] = md_buffer[md_i];
  md_state[md_i+32] = (unsigned char)(md_buffer[md_i] ^ md_state[md_i]);
 } // for md_i 16

 for (md_i=0;md_i<18;md_i++)
 {
  for (md_j=0;md_j<48;md_j++)
  {
   md_state[md_j] = (unsigned char)(md_state[md_j] ^ md_pi_subst[md_t]);
   md_t = md_state[md_j];
  } // for md_j 48
  md_t = (unsigned char)(md_t+1);
 } // for md_i 18
 md_t = md_cksum[15];

 for (md_i=0;md_i<16;md_i++)
 {
  md_cksum[md_i] = (unsigned char)(md_cksum[md_i] ^ md_pi_subst[(md_buffer[md_i] ^ md_t)]);
  md_t = md_cksum[md_i];
 } // for md_i 16
} // for md_pointer
} // void hash(void)

// ---------------------
// clear_CNS_fraction //
// ---------------------
// new in v.101

void clear_CNS_fraction(void)
{
 CNS_fraction = 0.0;
 char_O_CNS_fraction = 0;
} // void clear_CNS_fraction(void)


// --------------------
// calc_CNS_fraction //
// --------------------
// new in v.101
// optimized in v.102 : with new variables char_I_actual_ppO2 and actual_ppO2

// Input: char_I_actual_ppO2
// Output: char_O_CNS_fraction
// Uses and Updates: CNS_fraction
// Uses: acutal_ppO2

void calc_CNS_fraction(void)
{
 actual_ppO2 = (float)char_I_actual_ppO2 / 100.0;

 if (char_I_actual_ppO2 < 50)
  CNS_fraction = CNS_fraction;// no changes
 else if (char_I_actual_ppO2 < 60)
  CNS_fraction = 1/(-54000.0 * actual_ppO2 + 54000.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 70)
  CNS_fraction = 1/(-45000.0 * actual_ppO2 + 48600.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 80)
  CNS_fraction = 1/(-36000.0 * actual_ppO2 + 42300.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 90)
  CNS_fraction = 1/(-27000.0 * actual_ppO2 + 35100.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 110)
  CNS_fraction = 1/(-18000.0 * actual_ppO2 + 27000.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 150)
  CNS_fraction = 1/(-9000.0 * actual_ppO2 + 17100.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 160)
  CNS_fraction = 1/(-22500.0 * actual_ppO2 + 37350.0) + CNS_fraction;
 else if (char_I_actual_ppO2 < 165)
  CNS_fraction =  0.000755 + CNS_fraction; // Arieli et all.(2002): Modeling pulmonary and CNS O2 toxicity... Formula (A1) based on value for 1.55 and c=20
 else if (char_I_actual_ppO2 < 170)
  CNS_fraction =  0.00102 + CNS_fraction; // example calculation: Sqrt((1.7/1.55)^20)*0.000404
 else if (char_I_actual_ppO2 < 175)
  CNS_fraction =  0.00136 + CNS_fraction;
 else if (char_I_actual_ppO2 < 180)
  CNS_fraction =  0.00180 + CNS_fraction;
 else if (char_I_actual_ppO2 < 185)
  CNS_fraction =  0.00237 + CNS_fraction;
 else if (char_I_actual_ppO2 < 190)
  CNS_fraction =  0.00310 + CNS_fraction;
 else if (char_I_actual_ppO2 < 195)
  CNS_fraction =  0.00401 + CNS_fraction;
 else if (char_I_actual_ppO2 < 200)
  CNS_fraction =  0.00517 + CNS_fraction;
 else if (char_I_actual_ppO2 < 230)
  CNS_fraction =  0.0209 + CNS_fraction;
 else
  CNS_fraction =  0.0482 + CNS_fraction; // value for 2.5

 if (CNS_fraction > 2.5)
  CNS_fraction = 2.5;
 if (CNS_fraction < 0.0)
  CNS_fraction = 0.0;
 char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0);
} // void calc_CNS_fraction(void)

// --------------------------
// calc_CNS_decrease_15min //
// --------------------------
// new in v.101

// calculates the half time of 90 minutes in 6 steps of 15 min

// Output: char_O_CNS_fraction
// Uses and Updates: CNS_fraction

void calc_CNS_decrease_15min(void)
{
 CNS_fraction =  0.890899 * CNS_fraction;
 char_O_CNS_fraction = (char)((CNS_fraction + 0.005)* 100.0);
}// calc_CNS_decrease_15min(void)


// ------------------
// calc_percentage //
// ------------------
// new in v.101

// calculates int_I_temp * char_I_temp / 100
// output is int_I_temp

void calc_percentage(void)
{
 temp1 = (float)int_I_temp;
 temp2 = (float)char_I_temp / 100.0;
 temp3 = temp1 * temp2;
 int_I_temp = (int)temp3;
}
void push_tissues_to_vault(void)
{
	for (ci=0;ci<32;ci++)
		pres_tissue_vault[ci] = pres_tissue[ci];
}
void pull_tissues_from_vault(void)
{
	for (ci=0;ci<32;ci++)
		pres_tissue[ci] = pres_tissue_vault[ci];
}