changeset 0:11d4fc797f74

init
author heinrichsweikamp
date Wed, 24 Apr 2013 19:22:45 +0200
parents
children e4e662746c02
files .hgignore src/18F87K22_ostc3.lkr src/Fonts/aa_font16.inc src/Fonts/aa_font16_idx.inc src/Fonts/aa_font28.inc src/Fonts/aa_font28_idx.inc src/Fonts/aa_font34.inc src/Fonts/aa_font34_idx.inc src/Fonts/aa_font36.inc src/Fonts/aa_font36_idx.inc src/Fonts/aa_font48.inc src/Fonts/aa_font48_idx.inc src/Fonts/aa_font90.inc src/Fonts/aa_font90_idx.inc src/Fonts/c16_aa.png src/Fonts/c16_aa.psd src/Fonts/c28_aa.png src/Fonts/c28_aa.psd src/Fonts/c34_aa.png src/Fonts/c34_aa.psd src/Fonts/c36_aa.png src/Fonts/c48_aa.png src/Fonts/c48_aa.psd src/Fonts/c90_aa.psd src/Fonts/c90_aal.png src/Icons/dive_warning.bmp src/Icons/dive_warning.inc src/Icons/ostc3_logo.PNG src/Icons/ostc3_logo.inc src/Icons/warning.bmp src/Icons/warning.inc src/aa_fonts.asm src/aa_wordprocessor.asm src/adc_lightsensor.asm src/adc_lightsensor.inc src/color_processor.asm src/comm.asm src/comm.inc src/compass.c src/compass.h src/compass_calib.c src/compass_ops.asm src/convert.asm src/convert.inc src/customview.asm src/customview.inc src/divemenu_tree.asm src/divemode.asm src/divemode.inc src/eeprom_rs232.asm src/eeprom_rs232.inc src/external_flash.asm src/external_flash.inc src/gaslist.asm src/gaslist.inc src/ghostwriter.asm src/ghostwriter.inc src/i2c.asm src/i2c.inc src/icons.asm src/isr.asm src/isr.inc src/logbook.asm src/logbook.inc src/math.asm src/math.inc src/mcp.asm src/mcp.inc src/menu_processor.asm src/menu_processor.inc src/menu_tree.asm src/ms5541.asm src/ms5541.inc src/options.asm src/ostc3.asm src/ostc3.inc src/p2_deco.c src/p2_definitions.h src/p2_tables.romdata src/ports.inc src/rtc.asm src/rtc.inc src/shared_definitions.h src/simulator.asm src/sleepmode.asm src/sleepmode.inc src/start.asm src/start.inc src/strings.asm src/strings.inc src/surfmode.asm src/surfmode.inc src/testmode.asm src/text_english.inc src/text_french.inc src/text_german.inc src/text_italian.inc src/text_multilang.asm src/text_multilang.inc src/text_spanish.inc src/tft.asm src/tft.inc src/tft_outputs.asm src/tft_outputs.inc src/varargs.inc src/wait.asm src/wait.inc tools/crop_ostc3_hex.bat tools/srec_cat.exe
diffstat 108 files changed, 32115 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/18F87K22_ostc3.lkr	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,42 @@
+// Linker script for the OSTC3 Divecomputer
+// History:
+
+LIBPATH .
+FILES "clib.lib"
+FILES "p18F87K22.lib"
+
+// General PROM code area
+CODEPAGE   NAME=page       START=0x0            END=0x1DCFF
+CODEPAGE   NAME=boot       START=0x1E000        END=0x1FFFF
+
+// Special area reserved for tables. Just to make sure the linker won't
+// relocate something at the end of the bühlmann text table...
+CODEPAGE   NAME=tables     START=0x1DD00        END=0x1DFFF        PROTECTED
+
+// Internal EEPROM: R/O and R/W sections.
+CODEPAGE   NAME=eedata_ro  START=0xF00000       END=0xF0000F       PROTECTED
+CODEPAGE   NAME=eedata     START=0xF00010       END=0xF003FF       PROTECTED
+
+// Hardware specific areas:
+CODEPAGE   NAME=idlocs     START=0x200000       END=0x200007       PROTECTED
+CODEPAGE   NAME=config     START=0x300000       END=0x30000D       PROTECTED
+CODEPAGE   NAME=devid      START=0x3FFFFE       END=0x3FFFFF       PROTECTED
+
+ACCESSBANK NAME=accessram  START=0x0            END=0x5F
+DATABANK   NAME=gpr0       START=0x60           END=0xFF
+DATABANK   NAME=gpr1       START=0x100          END=0x1FF
+DATABANK   NAME=gpr2       START=0x200          END=0x2FF
+DATABANK   NAME=gpr3       START=0x300          END=0x3FF
+DATABANK   NAME=gpr4       START=0x400          END=0x4FF
+DATABANK   NAME=gpr5       START=0x500          END=0x5FF
+DATABANK   NAME=gpr6       START=0x600          END=0x6FF
+DATABANK   NAME=gpr7       START=0x700          END=0x7FF
+DATABANK   NAME=gpr8       START=0x800          END=0x8FF
+DATABANK   NAME=gpr9       START=0x900          END=0x9FF
+DATABANK   NAME=gpr10      START=0xA00          END=0xAFF
+DATABANK   NAME=gpr11      START=0xB00          END=0xBFF
+DATABANK   NAME=gpr12      START=0xC00          END=0xCFF
+DATABANK   NAME=grp13      START=0xD00          END=0xDFF
+DATABANK   NAME=grp14      START=0xE00          END=0xEFF
+DATABANK   NAME=grp15      START=0xF00          END=0xF5F
+ACCESSBANK NAME=accesssfr  START=0xF60          END=0xFFF          PROTECTED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font16.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,461 @@
+;==========================================================================
+; Font data exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font16_height	EQU	.14
+aa_font16_width		EQU	.9
+aa_font16_nbbits	EQU	.3
+;
+aa_font16_bits:
+;   Space
+			DB 0xFD
+; ! mark
+			DB 0xB8, 0x06, 0x80, 0x01, 0xBA
+; " dquote
+			DB 0x83, 0x00, 0x89, 0x01, 0x80, 0x00, 0x89, 0x02
+			DB 0x9B, 0x00, 0x89, 0x02, 0x8A, 0x01, 0xA6
+; # sharp
+			DB 0x86, 0x00, 0x89, 0x00, 0x81, 0x00, 0x87, 0x08
+			DB 0x83, 0x00, 0x81, 0x00, 0x81, 0x00, 0x89, 0x00
+			DB 0x81, 0x00, 0x81, 0x00, 0x83, 0x08, 0x87, 0x00
+			DB 0x81, 0x00, 0x89, 0x00, 0x96
+; $ dolar
+			DB 0x90, 0x02, 0x83, 0x01, 0x84, 0x00, 0x81, 0x00
+			DB 0x83, 0x00, 0x83, 0x00, 0x82, 0x00, 0x83, 0x00
+			DB 0x80, 0x00, 0x80, 0x0C, 0x81, 0x00, 0x83, 0x00
+			DB 0x82, 0x00, 0x89, 0x02, 0x9E
+; % percent
+			DB 0x80, 0x02, 0x85, 0x00, 0x82, 0x00, 0x82, 0x00
+			DB 0x82, 0x01, 0x83, 0x00, 0x82, 0x00, 0x81, 0x00
+			DB 0x86, 0x02, 0x81, 0x00, 0x8B, 0x00, 0x81, 0x01
+			DB 0x86, 0x01, 0x81, 0x00, 0x81, 0x00, 0x83, 0x01
+			DB 0x83, 0x00, 0x81, 0x00, 0x82, 0x00, 0x86, 0x01
+			DB 0x91
+; & and
+			DB 0x8F, 0x01, 0x82, 0x02, 0x84, 0x00, 0x81, 0x00
+			DB 0x80, 0x00, 0x82, 0x00, 0x83, 0x00, 0x82, 0x00
+			DB 0x83, 0x00, 0x83, 0x00, 0x81, 0x00, 0x80, 0x00
+			DB 0x82, 0x00, 0x84, 0x01, 0x82, 0x00, 0x80, 0x00
+			DB 0x88, 0x01, 0x80, 0x02, 0x9E
+; ' quote
+			DB 0x92, 0x00, 0x88, 0x01, 0x80, 0x00, 0x89, 0x02
+			DB 0xCF
+; ( lparent
+			DB 0x91, 0x05, 0x85, 0x01, 0x85, 0x01, 0x82, 0x00
+			DB 0x89, 0x00, 0x80, 0x00, 0x8B, 0x00, 0xB7
+; ) rparent
+			DB 0x8D, 0x00, 0x8B, 0x00, 0x80, 0x00, 0x89, 0x00
+			DB 0x82, 0x01, 0x85, 0x01, 0x85, 0x05, 0xBB
+; * star
+			DB 0x93, 0x00, 0x82, 0x00, 0x89, 0x00, 0x80, 0x00
+			DB 0x8B, 0x03, 0x86, 0x03, 0x8B, 0x00, 0x80, 0x00
+			DB 0x89, 0x00, 0x82, 0x00, 0x9E
+; + plus
+			DB 0x94, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x89, 0x06
+			DB 0x89, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x93
+; , comma
+			DB 0xA8, 0x00, 0x88, 0x01, 0x80, 0x00, 0x89, 0x02
+			DB 0xB9
+; - minus
+			DB 0xA2, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0xAF
+; . dot
+			DB 0xA4, 0x01, 0x8B, 0x01, 0xC8
+; / slash
+			DB 0x97, 0x00, 0x89, 0x02, 0x88, 0x01, 0x88, 0x02
+			DB 0x89, 0x00, 0xB5
+; 0 0
+			DB 0x91, 0x04, 0x87, 0x00, 0x84, 0x00, 0x85, 0x00
+			DB 0x86, 0x00, 0x84, 0x00, 0x86, 0x00, 0x85, 0x00
+			DB 0x84, 0x00, 0x87, 0x04, 0xA0
+; 1 1
+			DB 0x9E, 0x00, 0x85, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x84, 0x08, 0x8C, 0x00, 0x8C, 0x00, 0x9E
+; 2 2
+			DB 0x9E, 0x00, 0x85, 0x00, 0x84, 0x00, 0x85, 0x01
+			DB 0x84, 0x00, 0x84, 0x00, 0x80, 0x00, 0x84, 0x00
+			DB 0x82, 0x01, 0x81, 0x00, 0x85, 0x02, 0x83, 0x00
+			DB 0x9E
+; 3 3
+			DB 0x9E, 0x00, 0x81, 0x00, 0x82, 0x00, 0x84, 0x00
+			DB 0x82, 0x00, 0x82, 0x00, 0x84, 0x00, 0x82, 0x00
+			DB 0x82, 0x00, 0x84, 0x00, 0x81, 0x01, 0x81, 0x00
+			DB 0x86, 0x01, 0x81, 0x02, 0x9F
+; 4 4
+			DB 0x94, 0x01, 0x89, 0x01, 0x80, 0x00, 0x88, 0x00
+			DB 0x82, 0x00, 0x87, 0x00, 0x83, 0x00, 0x86, 0x08
+			DB 0x8A, 0x00, 0x8C, 0x00, 0x92
+; 5 5
+			DB 0x9D, 0x03, 0x83, 0x00, 0x84, 0x00, 0x81, 0x00
+			DB 0x83, 0x00, 0x84, 0x00, 0x81, 0x00, 0x83, 0x00
+			DB 0x84, 0x00, 0x81, 0x00, 0x82, 0x00, 0x85, 0x00
+			DB 0x82, 0x02, 0xA0
+; 6 6
+			DB 0x91, 0x04, 0x87, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x85, 0x00, 0x81, 0x00, 0x83, 0x00, 0x84, 0x00
+			DB 0x81, 0x00, 0x83, 0x00, 0x84, 0x00, 0x81, 0x00
+			DB 0x82, 0x00, 0x89, 0x03, 0x9F
+; 7 7
+			DB 0x81, 0x00, 0x8C, 0x00, 0x86, 0x00, 0x84, 0x00
+			DB 0x85, 0x01, 0x84, 0x00, 0x83, 0x01, 0x86, 0x00
+			DB 0x81, 0x01, 0x88, 0x02, 0x8A, 0x00, 0xA6
+; 8 8
+			DB 0x90, 0x01, 0x82, 0x01, 0x85, 0x00, 0x81, 0x00
+			DB 0x80, 0x00, 0x81, 0x00, 0x84, 0x00, 0x82, 0x00
+			DB 0x82, 0x00, 0x84, 0x00, 0x82, 0x00, 0x82, 0x00
+			DB 0x84, 0x00, 0x81, 0x00, 0x80, 0x00, 0x81, 0x00
+			DB 0x85, 0x01, 0x82, 0x01, 0x9F
+; 9 9
+			DB 0x83, 0x02, 0x82, 0x00, 0x85, 0x00, 0x82, 0x00
+			DB 0x81, 0x00, 0x84, 0x00, 0x83, 0x00, 0x81, 0x00
+			DB 0x84, 0x00, 0x82, 0x00, 0x82, 0x00, 0x85, 0x00
+			DB 0x81, 0x00, 0x80, 0x01, 0x87, 0x03, 0xAF
+; : colon
+			DB 0x9F, 0x01, 0x82, 0x01, 0x86, 0x01, 0x82, 0x01
+			DB 0xC8
+; ; semicolon
+			DB 0x9A, 0x00, 0x83, 0x01, 0x82, 0x01, 0x81, 0x00
+			DB 0x83, 0x01, 0x82, 0x03, 0xC6
+; < less
+			DB 0x86, 0x00, 0x8B, 0x01, 0x8A, 0x00, 0x81, 0x00
+			DB 0x88, 0x00, 0x82, 0x00, 0x88, 0x00, 0x83, 0x00
+			DB 0x86, 0x00, 0x85, 0x00, 0xAC
+; = equal
+			DB 0x85, 0x00, 0x80, 0x00, 0x8A, 0x00, 0x80, 0x00
+			DB 0x8A, 0x00, 0x80, 0x00, 0x8A, 0x00, 0x80, 0x00
+			DB 0x8A, 0x00, 0x80, 0x00, 0x8A, 0x00, 0x80, 0x00
+			DB 0xAE
+; > greater
+			DB 0x82, 0x00, 0x85, 0x00, 0x86, 0x00, 0x83, 0x00
+			DB 0x88, 0x00, 0x81, 0x00, 0x89, 0x00, 0x81, 0x00
+			DB 0x8A, 0x01, 0x8B, 0x00, 0xB0
+; ? question
+			DB 0x8E, 0x00, 0x8C, 0x00, 0x83, 0x01, 0x80, 0x01
+			DB 0x83, 0x00, 0x82, 0x00, 0x89, 0x00, 0x81, 0x00
+			DB 0x8A, 0x01, 0xB2
+; @ arobas
+			DB 0x83, 0x04, 0x87, 0x00, 0x84, 0x00, 0x85, 0x00
+			DB 0x81, 0x02, 0x81, 0x00, 0x83, 0x00, 0x81, 0x00
+			DB 0x82, 0x00, 0x80, 0x00, 0x83, 0x00, 0x81, 0x00
+			DB 0x82, 0x00, 0x80, 0x00, 0x83, 0x00, 0x81, 0x03
+			DB 0x81, 0x00, 0x84, 0x00, 0x84, 0x00, 0x87, 0x04
+			DB 0x93
+; A A
+			DB 0x89, 0x00, 0x89, 0x02, 0x87, 0x02, 0x80, 0x00
+			DB 0x86, 0x01, 0x83, 0x00, 0x85, 0x02, 0x83, 0x00
+			DB 0x88, 0x02, 0x80, 0x00, 0x8B, 0x02, 0x8D, 0x00
+			DB 0x90
+; B B
+			DB 0x8E, 0x09, 0x83, 0x00, 0x83, 0x00, 0x82, 0x00
+			DB 0x83, 0x00, 0x83, 0x00, 0x82, 0x00, 0x83, 0x00
+			DB 0x83, 0x00, 0x82, 0x00, 0x83, 0x00, 0x82, 0x00
+			DB 0x80, 0x00, 0x80, 0x00, 0x85, 0x02, 0x81, 0x02
+			DB 0x9F
+; C C
+			DB 0x82, 0x05, 0x86, 0x00, 0x85, 0x00, 0x84, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x87, 0x00, 0xAC
+; D D
+			DB 0x80, 0x09, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x86, 0x00, 0x85, 0x00, 0x84, 0x01, 0x86, 0x04
+			DB 0xA1
+; E E
+			DB 0x8E, 0x09, 0x83, 0x00, 0x83, 0x00, 0x82, 0x00
+			DB 0x83, 0x00, 0x83, 0x00, 0x82, 0x00, 0x83, 0x00
+			DB 0x83, 0x00, 0x82, 0x00, 0x83, 0x00, 0x83, 0x00
+			DB 0x82, 0x00, 0xAC
+; F F
+			DB 0x9C, 0x09, 0x83, 0x00, 0x83, 0x00, 0x87, 0x00
+			DB 0x83, 0x00, 0x87, 0x00, 0x83, 0x00, 0x87, 0x00
+			DB 0x83, 0x00, 0xA2
+; G G
+			DB 0x91, 0x04, 0x86, 0x01, 0x84, 0x00, 0x85, 0x00
+			DB 0x86, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x01
+			DB 0x82, 0x03, 0x91
+; H H
+			DB 0x8E, 0x09, 0x88, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0x8C, 0x00, 0x87, 0x09, 0x9E
+; I I
+			DB 0x9C, 0x00, 0x87, 0x00, 0x83, 0x00, 0x87, 0x00
+			DB 0x83, 0x09, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x9E
+; J J
+			DB 0x97, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x86, 0x00, 0x84, 0x08
+			DB 0xAD
+; K K
+			DB 0x80, 0x09, 0x87, 0x00, 0x8B, 0x00, 0x80, 0x01
+			DB 0x88, 0x00, 0x83, 0x00, 0x85, 0x01, 0x85, 0x01
+			DB 0x83, 0x00, 0x87, 0x00, 0xAC
+; L L
+			DB 0x8E, 0x09, 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0x8C, 0x00, 0xAC
+; M M
+			DB 0x81, 0x08, 0x83, 0x01, 0x8D, 0x02, 0x8D, 0x01
+			DB 0x88, 0x02, 0x88, 0x01, 0x8C, 0x08, 0x9E
+; N N
+			DB 0x80, 0x09, 0x84, 0x01, 0x8D, 0x01, 0x8D, 0x01
+			DB 0x8D, 0x01, 0x84, 0x09, 0xAC
+; O O
+			DB 0x82, 0x05, 0x86, 0x00, 0x85, 0x00, 0x84, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x84, 0x00, 0x85, 0x00, 0x86, 0x05
+			DB 0xA0
+; P P
+			DB 0x9C, 0x09, 0x83, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x83, 0x00, 0x88, 0x03
+			DB 0xA3
+; Q Q
+			DB 0x90, 0x05, 0x86, 0x00, 0x85, 0x00, 0x84, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0x87, 0x00, 0x80, 0x00
+			DB 0x81, 0x00, 0x87, 0x00, 0x80, 0x00, 0x82, 0x00
+			DB 0x85, 0x00, 0x82, 0x00, 0x82, 0x05, 0x83, 0x00
+			DB 0x8D
+; R R
+			DB 0x8E, 0x09, 0x83, 0x00, 0x83, 0x00, 0x87, 0x00
+			DB 0x83, 0x01, 0x86, 0x00, 0x83, 0x00, 0x80, 0x00
+			DB 0x85, 0x00, 0x82, 0x00, 0x82, 0x00, 0x85, 0x02
+			DB 0x84, 0x00, 0x8C, 0x00, 0x90
+; S S
+			DB 0x8F, 0x02, 0x84, 0x00, 0x83, 0x00, 0x82, 0x00
+			DB 0x83, 0x00, 0x83, 0x00, 0x82, 0x00, 0x83, 0x00
+			DB 0x83, 0x00, 0x83, 0x00, 0x82, 0x00, 0x83, 0x00
+			DB 0x83, 0x00, 0x81, 0x00, 0x84, 0x00, 0x84, 0x02
+			DB 0x9F
+; T T
+			DB 0x8E, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x09
+			DB 0x83, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x99
+; U U
+			DB 0x8E, 0x08, 0x8D, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0x8B, 0x00, 0x84, 0x07, 0xA0
+; V V
+			DB 0x80, 0x00, 0x8D, 0x02, 0x8D, 0x02, 0x8D, 0x02
+			DB 0x8B, 0x00, 0x88, 0x03, 0x86, 0x02, 0x89, 0x00
+			DB 0x99
+; W W
+			DB 0x8E, 0x08, 0x8C, 0x01, 0x88, 0x02, 0x88, 0x01
+			DB 0x8D, 0x02, 0x8D, 0x01, 0x83, 0x08, 0x91
+; X X
+			DB 0x80, 0x00, 0x87, 0x00, 0x83, 0x01, 0x85, 0x01
+			DB 0x85, 0x00, 0x82, 0x01, 0x88, 0x02, 0x8A, 0x02
+			DB 0x89, 0x00, 0x82, 0x01, 0x85, 0x01, 0x85, 0x01
+			DB 0x83, 0x00, 0x87, 0x00, 0x90
+; Y Y
+			DB 0x8E, 0x00, 0x8D, 0x01, 0x8D, 0x01, 0x8D, 0x04
+			DB 0x86, 0x01, 0x89, 0x01, 0x8A, 0x00, 0x99
+; Z Z
+			DB 0x8E, 0x00, 0x87, 0x00, 0x83, 0x00, 0x85, 0x02
+			DB 0x83, 0x00, 0x84, 0x00, 0x81, 0x00, 0x83, 0x00
+			DB 0x82, 0x01, 0x82, 0x00, 0x83, 0x00, 0x81, 0x00
+			DB 0x84, 0x00, 0x83, 0x02, 0x85, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x90
+; [ lsqbracket
+			DB 0xA9, 0x0E, 0x8B, 0x01, 0x8B, 0x00, 0xA9
+; \ backslash
+			DB 0xAA, 0x00, 0x8D, 0x02, 0x8D, 0x01, 0x8D, 0x02
+			DB 0x8D, 0x00, 0x90
+; ] rsqbracket
+			DB 0xB7, 0x00, 0x8B, 0x01, 0x8B, 0x0E, 0x9B
+; ^ caret
+			DB 0xA0, 0x00, 0x8A, 0x01, 0x89, 0x01, 0x8C, 0x00
+			DB 0x8D, 0x01, 0x8D, 0x00, 0x95
+; _ underline
+			DB 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0x8D
+; ` backquote
+			DB 0x9C, 0x00, 0x8D, 0x00, 0x8C, 0x00, 0xC2
+; a a
+			DB 0x92, 0x00, 0x81, 0x01, 0x87, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x86, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x86, 0x00, 0x81, 0x00, 0x81, 0x00, 0x86, 0x00
+			DB 0x81, 0x00, 0x80, 0x00, 0x88, 0x05, 0x9E
+; b b
+			DB 0x8D, 0x0A, 0x87, 0x00, 0x83, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x83, 0x00, 0x88, 0x03, 0xA0
+; c c
+			DB 0x93, 0x02, 0x89, 0x00, 0x82, 0x00, 0x87, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x9E
+; d d
+			DB 0x85, 0x03, 0x88, 0x00, 0x83, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x83, 0x00, 0x83, 0x0A, 0xAC
+; e e
+			DB 0x85, 0x02, 0x89, 0x00, 0x80, 0x00, 0x80, 0x00
+			DB 0x87, 0x00, 0x81, 0x00, 0x81, 0x00, 0x86, 0x00
+			DB 0x81, 0x00, 0x81, 0x00, 0x86, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x87, 0x02, 0x81, 0x00, 0xAC
+; f f
+			DB 0x84, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x88, 0x09
+			DB 0x82, 0x00, 0x83, 0x00, 0x87, 0x00, 0x83, 0x00
+			DB 0x87, 0x00, 0x83, 0x00, 0xA3
+; g g
+			DB 0x84, 0x02, 0x80, 0x00, 0x80, 0x01, 0x84, 0x00
+			DB 0x82, 0x00, 0x80, 0x00, 0x81, 0x00, 0x83, 0x00
+			DB 0x82, 0x00, 0x80, 0x00, 0x81, 0x00, 0x83, 0x00
+			DB 0x82, 0x00, 0x80, 0x00, 0x81, 0x00, 0x83, 0x00
+			DB 0x82, 0x00, 0x80, 0x00, 0x81, 0x00, 0x83, 0x03
+			DB 0x82, 0x01, 0x84, 0x00, 0xA4
+; h h
+			DB 0x0A, 0x87, 0x00, 0x8B, 0x00, 0x8C, 0x00, 0x8C
+			DB 0x00, 0x8D, 0x05, 0xAC
+; i i
+			DB 0x89, 0x00, 0x86, 0x00, 0x84, 0x00, 0x83, 0x01
+			DB 0x80, 0x00, 0x84, 0x00, 0x84, 0x00, 0x80, 0x06
+			DB 0x8C, 0x00, 0x8C, 0x00, 0xAC
+; j j
+			DB 0x83, 0x00, 0x86, 0x00, 0x84, 0x00, 0x87, 0x00
+			DB 0x83, 0x00, 0x87, 0x00, 0x83, 0x00, 0x87, 0x00
+			DB 0x80, 0x01, 0x80, 0x08, 0x82, 0x00, 0xB4
+; k k
+			DB 0x8D, 0x0A, 0x89, 0x00, 0x8B, 0x00, 0x80, 0x00
+			DB 0x89, 0x00, 0x82, 0x00, 0x87, 0x00, 0x84, 0x00
+			DB 0x86, 0x00, 0x84, 0x00, 0x9E
+; l l
+			DB 0x8D, 0x00, 0x88, 0x00, 0x82, 0x00, 0x88, 0x00
+			DB 0x82, 0x0A, 0x8C, 0x00, 0x8C, 0x00, 0xAC
+; m m
+			DB 0x91, 0x06, 0x87, 0x00, 0x8B, 0x00, 0x8D, 0x05
+			DB 0x87, 0x00, 0x8B, 0x00, 0x8D, 0x05, 0x90
+; n n
+			DB 0x91, 0x06, 0x87, 0x00, 0x8B, 0x00, 0x8C, 0x00
+			DB 0x8C, 0x00, 0x8D, 0x05, 0x9E
+; o o
+			DB 0x93, 0x02, 0x89, 0x00, 0x82, 0x00, 0x87, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x87, 0x00
+			DB 0x82, 0x00, 0x89, 0x02, 0xA0
+; p p
+			DB 0x91, 0x09, 0x84, 0x00, 0x83, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x83, 0x00, 0x88, 0x03, 0xA0
+; q q
+			DB 0x93, 0x03, 0x88, 0x00, 0x83, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x83, 0x00, 0x87, 0x09, 0x9B
+; r r
+			DB 0x91, 0x00, 0x84, 0x00, 0x86, 0x00, 0x84, 0x00
+			DB 0x86, 0x06, 0x87, 0x00, 0x83, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x8C, 0x00, 0x96
+; s s
+			DB 0xA0, 0x01, 0x82, 0x00, 0x86, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x86, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x86, 0x00, 0x81, 0x00, 0x81, 0x00, 0x86, 0x00
+			DB 0x82, 0x01, 0x9F
+; t t
+			DB 0x91, 0x00, 0x8C, 0x00, 0x89, 0x08, 0x87, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x9E
+; u u
+			DB 0x91, 0x05, 0x8D, 0x00, 0x8C, 0x00, 0x8C, 0x00
+			DB 0x8B, 0x00, 0x87, 0x06, 0x9E
+; v v
+			DB 0x91, 0x00, 0x8D, 0x01, 0x8D, 0x02, 0x8D, 0x00
+			DB 0x89, 0x02, 0x88, 0x01, 0x8A, 0x00, 0x96
+; w w
+			DB 0x83, 0x01, 0x8D, 0x04, 0x8A, 0x01, 0x89, 0x01
+			DB 0x8C, 0x01, 0x8D, 0x01, 0x88, 0x03, 0x87, 0x01
+			DB 0x95
+; x x
+			DB 0x91, 0x00, 0x84, 0x00, 0x86, 0x00, 0x83, 0x01
+			DB 0x87, 0x01, 0x80, 0x00, 0x8B, 0x00, 0x8B, 0x00
+			DB 0x80, 0x00, 0x88, 0x01, 0x82, 0x01, 0x86, 0x00
+			DB 0x84, 0x00, 0x90
+; y y
+			DB 0x91, 0x00, 0x87, 0x00, 0x83, 0x02, 0x85, 0x00
+			DB 0x86, 0x01, 0x82, 0x00, 0x89, 0x02, 0x88, 0x01
+			DB 0x89, 0x01, 0x8A, 0x00, 0x96
+; z z
+			DB 0x91, 0x00, 0x84, 0x00, 0x86, 0x00, 0x83, 0x01
+			DB 0x86, 0x00, 0x81, 0x01, 0x80, 0x00, 0x86, 0x00
+			DB 0x80, 0x00, 0x82, 0x00, 0x86, 0x01, 0x83, 0x00
+			DB 0x86, 0x00, 0x84, 0x00, 0x9E
+; { lbrace
+			DB 0x93, 0x00, 0x8C, 0x00, 0x87, 0x04, 0x80, 0x05
+			DB 0x80, 0x00, 0x8B, 0x01, 0x8B, 0x00, 0xA9
+; | bar
+			DB 0xB7, 0x0D, 0xB7
+; } rbrace
+			DB 0x9B, 0x00, 0x8B, 0x01, 0x8B, 0x00, 0x80, 0x04
+			DB 0x80, 0x05, 0x86, 0x00, 0x8C, 0x00, 0xA2
+; ~ tilde
+			DB 0x90, 0x01, 0x8A, 0x00, 0x8D, 0x00, 0x8D, 0x00
+			DB 0x8C, 0x00, 0x8A, 0x01, 0xA5
+;  7F
+			DB 0x9C, 0x03, 0x88, 0x00, 0x83, 0x00, 0x87, 0x00
+			DB 0x83, 0x00, 0x87, 0x00, 0x83, 0x00, 0x88, 0x03
+			DB 0xA4
+; € 80
+			DB 0x93, 0x02, 0x85, 0x00, 0x82, 0x00, 0x82, 0x00
+			DB 0x87, 0x00, 0x84, 0x00, 0x86, 0x00, 0x84, 0x00
+			DB 0x83, 0x00, 0x82, 0x00, 0x82, 0x00, 0x89, 0x02
+			DB 0xA0
+;  81
+			DB 0x84, 0x00, 0x81, 0x01, 0x84, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x81, 0x00, 0x86, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x86, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x83, 0x00, 0x81, 0x00, 0x81, 0x00, 0x80, 0x00
+			DB 0x88, 0x05, 0xAC
+; ‚ 82
+			DB 0x91, 0x05, 0x84, 0x00, 0x87, 0x00, 0x8C, 0x00
+			DB 0x8C, 0x00, 0x83, 0x00, 0x86, 0x00, 0x87, 0x06
+			DB 0x9E
+; ƒ 83
+			DB 0x8F, 0x08, 0x83, 0x00, 0x8B, 0x00, 0x8C, 0x00
+			DB 0x82, 0x01, 0x83, 0x00, 0x82, 0x00, 0x81, 0x00
+			DB 0x81, 0x01, 0x81, 0x00, 0x83, 0x01, 0x84, 0x01
+			DB 0x9F
+; „ 84
+			DB 0x85, 0x02, 0x89, 0x00, 0x80, 0x00, 0x80, 0x00
+			DB 0x85, 0x00, 0x80, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x84, 0x00, 0x80, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x83, 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x87, 0x02, 0x81, 0x00, 0xAC
+; … 85
+			DB 0x85, 0x02, 0x85, 0x00, 0x82, 0x00, 0x80, 0x00
+			DB 0x80, 0x00, 0x85, 0x00, 0x80, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x84, 0x00, 0x80, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x86, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x87, 0x02, 0x81, 0x00, 0xAC
+; † 86
+			DB 0x85, 0x02, 0x86, 0x00, 0x81, 0x00, 0x80, 0x00
+			DB 0x80, 0x00, 0x84, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x83, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x84, 0x00, 0x80, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x87, 0x02, 0x81, 0x00, 0xAC
+; ‡ 87
+			DB 0x84, 0x02, 0x89, 0x00, 0x82, 0x00, 0x87, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x84, 0x00, 0x80, 0x02
+			DB 0x82, 0x00, 0x84, 0x00, 0x81, 0x00, 0x83, 0x00
+			DB 0x84, 0x00, 0xAD
+; ˆ 88
+			DB 0x84, 0x00, 0x81, 0x01, 0x87, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x84, 0x00, 0x80, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x84, 0x00, 0x80, 0x00, 0x81, 0x00
+			DB 0x81, 0x00, 0x83, 0x00, 0x81, 0x00, 0x81, 0x00
+			DB 0x80, 0x00, 0x88, 0x05, 0xAC
+; ‰ 89
+			DB 0x89, 0x00, 0x86, 0x00, 0x84, 0x00, 0x84, 0x00
+			DB 0x80, 0x00, 0x84, 0x00, 0x84, 0x00, 0x80, 0x06
+			DB 0x83, 0x00, 0x87, 0x00, 0x8C, 0x00, 0xAC
+; Š 8A
+			DB 0x85, 0x02, 0x89, 0x00, 0x82, 0x00, 0x85, 0x00
+			DB 0x80, 0x00, 0x84, 0x00, 0x84, 0x00, 0x80, 0x00
+			DB 0x84, 0x00, 0x83, 0x00, 0x82, 0x00, 0x82, 0x00
+			DB 0x89, 0x02, 0xAE
+; ‹ 8B
+			DB 0x83, 0x05, 0x8D, 0x00, 0x84, 0x00, 0x86, 0x00
+			DB 0x84, 0x00, 0x86, 0x00, 0x83, 0x00, 0x86, 0x00
+			DB 0x87, 0x06, 0xAC
+; Π8C
+			DB 0x83, 0x06, 0x84, 0x00, 0x81, 0x00, 0x88, 0x00
+			DB 0x81, 0x00, 0x8A, 0x00, 0x80, 0x00, 0x8A, 0x00
+			DB 0x80, 0x00, 0x89, 0x00, 0x82, 0x05, 0xAC
+;  8D
+			DB 0xAC, 0x01, 0x80, 0x06, 0xC6
+; Ž 8E
+			DB 0x96, 0x02, 0x89, 0x00, 0x81, 0x00, 0x84, 0x01
+			DB 0x80, 0x01, 0x83, 0x00, 0x8C, 0x00, 0xB8
+; TOTAL COMPRESSED SIZE = 2320
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font16_idx.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,120 @@
+;==========================================================================
+; Font index exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font16_chars		EQU	.111
+aa_font16_firstChar	EQU	' '
+aa_font16_lastChar	EQU	'Ž'
+;
+aa_font16_idx:
+			DW	aa_font16_bits + 0x0000	;   Space
+			DW	aa_font16_bits + 0x0001	; ! mark
+			DW	aa_font16_bits + 0x0006	; " dquote
+			DW	aa_font16_bits + 0x0015	; # sharp
+			DW	aa_font16_bits + 0x0032	; $ dolar
+			DW	aa_font16_bits + 0x004F	; % percent
+			DW	aa_font16_bits + 0x0078	; & and
+			DW	aa_font16_bits + 0x009D	; ' quote
+			DW	aa_font16_bits + 0x00A6	; ( lparent
+			DW	aa_font16_bits + 0x00B5	; ) rparent
+			DW	aa_font16_bits + 0x00C4	; * star
+			DW	aa_font16_bits + 0x00D9	; + plus
+			DW	aa_font16_bits + 0x00E8	; , comma
+			DW	aa_font16_bits + 0x00F1	; - minus
+			DW	aa_font16_bits + 0x00FA	; . dot
+			DW	aa_font16_bits + 0x00FF	; / slash
+			DW	aa_font16_bits + 0x010A	; 0 0
+			DW	aa_font16_bits + 0x011F	; 1 1
+			DW	aa_font16_bits + 0x012E	; 2 2
+			DW	aa_font16_bits + 0x0147	; 3 3
+			DW	aa_font16_bits + 0x0164	; 4 4
+			DW	aa_font16_bits + 0x0179	; 5 5
+			DW	aa_font16_bits + 0x0194	; 6 6
+			DW	aa_font16_bits + 0x01B1	; 7 7
+			DW	aa_font16_bits + 0x01C8	; 8 8
+			DW	aa_font16_bits + 0x01ED	; 9 9
+			DW	aa_font16_bits + 0x020C	; : colon
+			DW	aa_font16_bits + 0x0215	; ; semicolon
+			DW	aa_font16_bits + 0x0222	; < less
+			DW	aa_font16_bits + 0x0237	; = equal
+			DW	aa_font16_bits + 0x0250	; > greater
+			DW	aa_font16_bits + 0x0265	; ? question
+			DW	aa_font16_bits + 0x0278	; @ arobas
+			DW	aa_font16_bits + 0x02A1	; A A
+			DW	aa_font16_bits + 0x02BA	; B B
+			DW	aa_font16_bits + 0x02DB	; C C
+			DW	aa_font16_bits + 0x02F2	; D D
+			DW	aa_font16_bits + 0x030B	; E E
+			DW	aa_font16_bits + 0x0326	; F F
+			DW	aa_font16_bits + 0x0339	; G G
+			DW	aa_font16_bits + 0x0354	; H H
+			DW	aa_font16_bits + 0x0361	; I I
+			DW	aa_font16_bits + 0x0374	; J J
+			DW	aa_font16_bits + 0x0385	; K K
+			DW	aa_font16_bits + 0x039A	; L L
+			DW	aa_font16_bits + 0x03A5	; M M
+			DW	aa_font16_bits + 0x03B4	; N N
+			DW	aa_font16_bits + 0x03C1	; O O
+			DW	aa_font16_bits + 0x03DA	; P P
+			DW	aa_font16_bits + 0x03EB	; Q Q
+			DW	aa_font16_bits + 0x040C	; R R
+			DW	aa_font16_bits + 0x0429	; S S
+			DW	aa_font16_bits + 0x044A	; T T
+			DW	aa_font16_bits + 0x0459	; U U
+			DW	aa_font16_bits + 0x0466	; V V
+			DW	aa_font16_bits + 0x0477	; W W
+			DW	aa_font16_bits + 0x0486	; X X
+			DW	aa_font16_bits + 0x04A3	; Y Y
+			DW	aa_font16_bits + 0x04B2	; Z Z
+			DW	aa_font16_bits + 0x04D5	; [ lsqbracket
+			DW	aa_font16_bits + 0x04DC	; \ backslash
+			DW	aa_font16_bits + 0x04E7	; ] rsqbracket
+			DW	aa_font16_bits + 0x04EE	; ^ caret
+			DW	aa_font16_bits + 0x04FB	; _ underline
+			DW	aa_font16_bits + 0x050C	; ` backquote
+			DW	aa_font16_bits + 0x0513	; a a
+			DW	aa_font16_bits + 0x0532	; b b
+			DW	aa_font16_bits + 0x0547	; c c
+			DW	aa_font16_bits + 0x055E	; d d
+			DW	aa_font16_bits + 0x0573	; e e
+			DW	aa_font16_bits + 0x0592	; f f
+			DW	aa_font16_bits + 0x05A7	; g g
+			DW	aa_font16_bits + 0x05D4	; h h
+			DW	aa_font16_bits + 0x05E0	; i i
+			DW	aa_font16_bits + 0x05F5	; j j
+			DW	aa_font16_bits + 0x060C	; k k
+			DW	aa_font16_bits + 0x0621	; l l
+			DW	aa_font16_bits + 0x0630	; m m
+			DW	aa_font16_bits + 0x063F	; n n
+			DW	aa_font16_bits + 0x064C	; o o
+			DW	aa_font16_bits + 0x0661	; p p
+			DW	aa_font16_bits + 0x0676	; q q
+			DW	aa_font16_bits + 0x068B	; r r
+			DW	aa_font16_bits + 0x06A2	; s s
+			DW	aa_font16_bits + 0x06BD	; t t
+			DW	aa_font16_bits + 0x06D0	; u u
+			DW	aa_font16_bits + 0x06DD	; v v
+			DW	aa_font16_bits + 0x06EC	; w w
+			DW	aa_font16_bits + 0x06FD	; x x
+			DW	aa_font16_bits + 0x0718	; y y
+			DW	aa_font16_bits + 0x072D	; z z
+			DW	aa_font16_bits + 0x074A	; { lbrace
+			DW	aa_font16_bits + 0x0759	; | bar
+			DW	aa_font16_bits + 0x075C	; } rbrace
+			DW	aa_font16_bits + 0x076B	; ~ tilde
+			DW	aa_font16_bits + 0x0778	;  7F
+			DW	aa_font16_bits + 0x0789	; € 80
+			DW	aa_font16_bits + 0x07A2	;  81
+			DW	aa_font16_bits + 0x07C5	; ‚ 82
+			DW	aa_font16_bits + 0x07D6	; ƒ 83
+			DW	aa_font16_bits + 0x07EF	; „ 84
+			DW	aa_font16_bits + 0x0814	; … 85
+			DW	aa_font16_bits + 0x0839	; † 86
+			DW	aa_font16_bits + 0x0860	; ‡ 87
+			DW	aa_font16_bits + 0x087B	; ˆ 88
+			DW	aa_font16_bits + 0x08A0	; ‰ 89
+			DW	aa_font16_bits + 0x08B7	; Š 8A
+			DW	aa_font16_bits + 0x08D2	; ‹ 8B
+			DW	aa_font16_bits + 0x08E5	; Π8C
+			DW	aa_font16_bits + 0x08FC	;  8D
+			DW	aa_font16_bits + 0x0901	; Ž 8E
+			DW	aa_font16_bits + 0x0910	; END OF INDEX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font28.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,1155 @@
+;==========================================================================
+; Font data exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font28_height	EQU	.24
+aa_font28_width		EQU	.14
+aa_font28_nbbits	EQU	.3
+;
+aa_font28_bits:
+;   Space
+			DB 0xFF, 0xFF, 0xCF
+; ! mark
+			DB 0xFF, 0x91, 0x20, 0x0B, 0x80, 0x02, 0x86, 0x0C
+			DB 0x60, 0x02, 0x86, 0x20, 0x0B, 0x80, 0x02, 0xFC
+; " dquote
+			DB 0x9E, 0x41, 0x90, 0x60, 0x83, 0x20, 0x40, 0x8F
+			DB 0x40, 0x00, 0x20, 0x61, 0x20, 0x00, 0x60, 0x8F
+			DB 0x05, 0x40, 0x90, 0x40, 0x03, 0x60, 0x92, 0x62
+			DB 0x99, 0x40, 0x20, 0x90, 0x61, 0x81, 0x60, 0x00
+			DB 0x40, 0x8F, 0x20, 0x01, 0x41, 0x20, 0x00, 0x90
+			DB 0x05, 0x60, 0x90, 0x40, 0x02, 0x20, 0x60, 0x93
+			DB 0x61, 0xAA
+; # sharp
+			DB 0x8C, 0x61, 0x8F, 0x40, 0x60, 0x83, 0x00, 0x40
+			DB 0x8F, 0x00, 0x40, 0x83, 0x00, 0x40, 0x8F, 0x00
+			DB 0x40, 0x82, 0x60, 0x00, 0x20, 0x41, 0x21, 0x86
+			DB 0x62, 0x41, 0x00, 0x21, 0x08, 0x86, 0x07, 0x21
+			DB 0x40, 0x00, 0x20, 0x61, 0x88, 0x42, 0x61, 0x00
+			DB 0x40, 0x83, 0x00, 0x40, 0x8F, 0x00, 0x40, 0x83
+			DB 0x00, 0x40, 0x8F, 0x00, 0x40, 0x81, 0x61, 0x00
+			DB 0x20, 0x40, 0x22, 0x86, 0x61, 0x42, 0x00, 0x20
+			DB 0x09, 0x86, 0x06, 0x22, 0x40, 0x00, 0x40, 0x61
+			DB 0x88, 0x41, 0x62, 0x00, 0x40, 0x83, 0x00, 0x40
+			DB 0x8F, 0x00, 0x40, 0x83, 0x00, 0x40, 0x8F, 0x00
+			DB 0x40, 0x83, 0x61, 0x88
+; $ dolar
+			DB 0x9C, 0x62, 0x93, 0x20, 0x02, 0x20, 0x60, 0x85
+			DB 0x40, 0x20, 0x40, 0x87, 0x20, 0x05, 0x60, 0x84
+			DB 0x60, 0x00, 0x20, 0x86, 0x40, 0x00, 0x20, 0x60
+			DB 0x80, 0x60, 0x01, 0x40, 0x85, 0x01, 0x86, 0x20
+			DB 0x00, 0x60, 0x82, 0x40, 0x01, 0x85, 0x20, 0x00
+			DB 0x80, 0x62, 0x80, 0x61, 0x00, 0x20, 0x61, 0x42
+			DB 0x01, 0x24, 0x05, 0x40, 0x80, 0x0B, 0x24, 0x01
+			DB 0x42, 0x60, 0x80, 0x40, 0x60, 0x00, 0x20, 0x61
+			DB 0x82, 0x40, 0x01, 0x60, 0x83, 0x00, 0x20, 0x86
+			DB 0x00, 0x20, 0x85, 0x20, 0x00, 0x20, 0x60, 0x80
+			DB 0x60, 0x20, 0x00, 0x40, 0x86, 0x20, 0x00, 0x60
+			DB 0x84, 0x60, 0x05, 0x20, 0x90, 0x60, 0x20, 0x02
+			DB 0x40, 0x93, 0x61, 0xA0
+; % percent
+			DB 0x99, 0x60, 0x20, 0x01, 0x20, 0x40, 0x88, 0x60
+			DB 0x40, 0x85, 0x40, 0x01, 0x22, 0x00, 0x40, 0x86
+			DB 0x40, 0x01, 0x60, 0x84, 0x00, 0x20, 0x83, 0x40
+			DB 0x00, 0x84, 0x60, 0x01, 0x20, 0x60, 0x85, 0x00
+			DB 0x40, 0x83, 0x21, 0x82, 0x60, 0x20, 0x01, 0x40
+			DB 0x87, 0x40, 0x00, 0x22, 0x01, 0x40, 0x81, 0x40
+			DB 0x01, 0x20, 0x60, 0x89, 0x40, 0x20, 0x01, 0x20
+			DB 0x60, 0x80, 0x60, 0x20, 0x01, 0x40, 0x91, 0x40
+			DB 0x01, 0x20, 0x80, 0x60, 0x20, 0x01, 0x20, 0x60
+			DB 0x8A, 0x60, 0x20, 0x00, 0x20, 0x60, 0x80, 0x60
+			DB 0x01, 0x21, 0x01, 0x60, 0x88, 0x20, 0x01, 0x40
+			DB 0x82, 0x21, 0x82, 0x60, 0x00, 0x40, 0x86, 0x40
+			DB 0x01, 0x20, 0x60, 0x83, 0x00, 0x40, 0x83, 0x00
+			DB 0x40, 0x84, 0x60, 0x20, 0x01, 0x40, 0x85, 0x21
+			DB 0x60, 0x81, 0x40, 0x00, 0x60, 0x84, 0x40, 0x00
+			DB 0x20, 0x60, 0x86, 0x40, 0x04, 0x40, 0x86, 0x40
+			DB 0x89, 0x60, 0x40, 0x20, 0x41, 0x85
+; & and
+			DB 0xA3, 0x40, 0x20, 0x01, 0x20, 0x60, 0x87, 0x60
+			DB 0x20, 0x01, 0x20, 0x60, 0x82, 0x20, 0x05, 0x60
+			DB 0x86, 0x05, 0x40, 0x80, 0x20, 0x00, 0x20, 0x40
+			DB 0x60, 0x40, 0x20, 0x00, 0x40, 0x85, 0x40, 0x00
+			DB 0x40, 0x80, 0x60, 0x40, 0x03, 0x40, 0x84, 0x01
+			DB 0x85, 0x20, 0x00, 0x83, 0x60, 0x01, 0x20, 0x85
+			DB 0x20, 0x00, 0x85, 0x20, 0x00, 0x83, 0x40, 0x02
+			DB 0x60, 0x84, 0x00, 0x20, 0x85, 0x40, 0x00, 0x20
+			DB 0x61, 0x20, 0x00, 0x20, 0x40, 0x01, 0x60, 0x82
+			DB 0x40, 0x00, 0x40, 0x85, 0x60, 0x04, 0x20, 0x81
+			DB 0x40, 0x01, 0x60, 0x80, 0x40, 0x01, 0x87, 0x60
+			DB 0x20, 0x00, 0x20, 0x40, 0x83, 0x40, 0x01, 0x20
+			DB 0x01, 0x60, 0x8F, 0x61, 0x03, 0x60, 0x8E, 0x40
+			DB 0x06, 0x20, 0x41, 0x8C, 0x40, 0x00, 0x21, 0x40
+			DB 0x60, 0x40, 0x20, 0x02, 0x94, 0x60, 0x40, 0x20
+			DB 0x84
+; ' quote
+			DB 0xCF, 0x41, 0x95, 0x00, 0x40, 0x8E, 0x40, 0x00
+			DB 0x20, 0x60, 0x81, 0x40, 0x00, 0x60, 0x8E, 0x03
+			DB 0x21, 0x00, 0x20, 0x8F, 0x20, 0x04, 0x20, 0x90
+			DB 0x60, 0x40, 0x20, 0x00, 0x20, 0x40, 0xFF, 0x88
+; ( lparent
+			DB 0xD1, 0x63, 0x90, 0x40, 0x20, 0x05, 0x20, 0x40
+			DB 0x60, 0x8A, 0x40, 0x0B, 0x20, 0x60, 0x86, 0x40
+			DB 0x02, 0x20, 0x40, 0x60, 0x83, 0x60, 0x40, 0x20
+			DB 0x02, 0x40, 0x84, 0x40, 0x01, 0x20, 0x60, 0x89
+			DB 0x60, 0x20, 0x01, 0x40, 0x82, 0x40, 0x01, 0x60
+			DB 0x8D, 0x60, 0x01, 0x20, 0x80, 0x40, 0x00, 0x20
+			DB 0x90, 0x60, 0x20, 0x00, 0x20, 0x60, 0x20, 0x93
+			DB 0x20, 0x60, 0xC7
+; ) rparent
+			DB 0xC7, 0x60, 0x20, 0x93, 0x20, 0x40, 0x20, 0x00
+			DB 0x20, 0x60, 0x90, 0x20, 0x00, 0x40, 0x80, 0x20
+			DB 0x01, 0x60, 0x8D, 0x60, 0x01, 0x20, 0x82, 0x40
+			DB 0x01, 0x20, 0x60, 0x89, 0x60, 0x20, 0x01, 0x40
+			DB 0x84, 0x40, 0x02, 0x20, 0x40, 0x60, 0x83, 0x60
+			DB 0x40, 0x20, 0x02, 0x40, 0x86, 0x60, 0x20, 0x0B
+			DB 0x40, 0x8A, 0x60, 0x40, 0x20, 0x05, 0x20, 0x40
+			DB 0x90, 0x63, 0xD1
+; * star
+			DB 0xB7, 0x40, 0x20, 0x82, 0x20, 0x40, 0x90, 0x40
+			DB 0x00, 0x40, 0x80, 0x40, 0x00, 0x60, 0x91, 0x21
+			DB 0x80, 0x21, 0x93, 0x00, 0x20, 0x00, 0x90, 0x00
+			DB 0x23, 0x00, 0x23, 0x00, 0x8C, 0x20, 0x42, 0x20
+			DB 0x00, 0x20, 0x42, 0x20, 0x8F, 0x60, 0x00, 0x40
+			DB 0x00, 0x60, 0x92, 0x21, 0x80, 0x21, 0x91, 0x40
+			DB 0x00, 0x60, 0x80, 0x60, 0x00, 0x40, 0x90, 0x40
+			DB 0x20, 0x82, 0x20, 0x40, 0xB8
+; + plus
+			DB 0xA3, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95, 0x00
+			DB 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20, 0x90
+			DB 0x0B, 0x8B, 0x0B, 0x90, 0x00, 0x20, 0x95, 0x00
+			DB 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95
+			DB 0x00, 0x20, 0xA1
+; , comma
+			DB 0xDD, 0x41, 0x95, 0x00, 0x20, 0x8E, 0x40, 0x00
+			DB 0x20, 0x60, 0x81, 0x40, 0x00, 0x60, 0x8E, 0x03
+			DB 0x21, 0x00, 0x20, 0x8F, 0x20, 0x04, 0x20, 0x90
+			DB 0x60, 0x40, 0x20, 0x00, 0x20, 0x40, 0xFA
+; - minus
+			DB 0xD3, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95, 0x00
+			DB 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95
+			DB 0x00, 0x20, 0x95, 0x00, 0x20, 0x95, 0x41, 0xD1
+; . dot
+			DB 0xEF, 0x61, 0x94, 0x40, 0x01, 0x40, 0x92, 0x60
+			DB 0x03, 0x92, 0x60, 0x02, 0x20, 0x93, 0x40, 0x00
+			DB 0x20, 0x60, 0xFC
+; / slash
+			DB 0xBF, 0x60, 0x41, 0x92, 0x40, 0x20, 0x01, 0x20
+			DB 0x8F, 0x60, 0x40, 0x02, 0x20, 0x40, 0x60, 0x8D
+			DB 0x40, 0x20, 0x02, 0x20, 0x60, 0x8D, 0x60, 0x40
+			DB 0x02, 0x20, 0x40, 0x60, 0x8D, 0x40, 0x20, 0x02
+			DB 0x20, 0x60, 0x8E, 0x40, 0x02, 0x20, 0x40, 0x60
+			DB 0x90, 0x20, 0x00, 0x20, 0x60, 0x93, 0x61, 0xDB
+; 0 0
+			DB 0xA0, 0x63, 0x90, 0x40, 0x20, 0x06, 0x20, 0x60
+			DB 0x8A, 0x60, 0x0B, 0x40, 0x88, 0x60, 0x01, 0x20
+			DB 0x40, 0x60, 0x83, 0x61, 0x40, 0x01, 0x40, 0x87
+			DB 0x40, 0x00, 0x40, 0x89, 0x40, 0x00, 0x20, 0x87
+			DB 0x21, 0x8B, 0x20, 0x00, 0x87, 0x00, 0x20, 0x8B
+			DB 0x20, 0x00, 0x87, 0x20, 0x00, 0x8B, 0x00, 0x20
+			DB 0x87, 0x40, 0x00, 0x40, 0x89, 0x20, 0x00, 0x40
+			DB 0x87, 0x60, 0x01, 0x20, 0x41, 0x63, 0x40, 0x20
+			DB 0x01, 0x20, 0x89, 0x40, 0x0A, 0x20, 0x8C, 0x40
+			DB 0x21, 0x03, 0x20, 0x40, 0x60, 0x9F
+; 1 1
+			DB 0xB3, 0x62, 0x89, 0x41, 0x88, 0x40, 0x00, 0x40
+			DB 0x89, 0x20, 0x00, 0x88, 0x01, 0x60, 0x89, 0x20
+			DB 0x00, 0x87, 0x40, 0x00, 0x20, 0x8A, 0x20, 0x00
+			DB 0x87, 0x20, 0x00, 0x40, 0x6A, 0x20, 0x00, 0x87
+			DB 0x0F, 0x87, 0x0F, 0x95, 0x20, 0x00, 0x95, 0x20
+			DB 0x00, 0x95, 0x20, 0x00, 0x95, 0x40, 0x20, 0x9C
+; 2 2
+			DB 0xA8, 0x61, 0x87, 0x60, 0x00, 0x20, 0x89, 0x40
+			DB 0x01, 0x87, 0x40, 0x00, 0x40, 0x88, 0x40, 0x02
+			DB 0x87, 0x20, 0x00, 0x88, 0x40, 0x03, 0x87, 0x00
+			DB 0x20, 0x87, 0x40, 0x01, 0x60, 0x01, 0x87, 0x00
+			DB 0x20, 0x86, 0x40, 0x01, 0x60, 0x80, 0x01, 0x87
+			DB 0x20, 0x00, 0x60, 0x84, 0x20, 0x01, 0x60, 0x81
+			DB 0x01, 0x87, 0x40, 0x00, 0x20, 0x60, 0x81, 0x40
+			DB 0x20, 0x01, 0x60, 0x82, 0x01, 0x87, 0x60, 0x06
+			DB 0x20, 0x60, 0x83, 0x01, 0x88, 0x60, 0x20, 0x02
+			DB 0x20, 0x40, 0x85, 0x01, 0x8A, 0x62, 0x87, 0x21
+			DB 0xB4
+; 3 3
+			DB 0xBF, 0x60, 0x41, 0x87, 0x40, 0x00, 0x40, 0x83
+			DB 0x41, 0x84, 0x00, 0x20, 0x87, 0x40, 0x00, 0x60
+			DB 0x83, 0x00, 0x20, 0x84, 0x20, 0x00, 0x87, 0x21
+			DB 0x84, 0x00, 0x20, 0x84, 0x20, 0x00, 0x87, 0x00
+			DB 0x20, 0x83, 0x60, 0x00, 0x20, 0x84, 0x20, 0x00
+			DB 0x87, 0x00, 0x20, 0x83, 0x40, 0x00, 0x20, 0x84
+			DB 0x00, 0x20, 0x87, 0x20, 0x00, 0x60, 0x82, 0x20
+			DB 0x01, 0x60, 0x82, 0x40, 0x00, 0x40, 0x87, 0x40
+			DB 0x00, 0x20, 0x61, 0x20, 0x00, 0x40, 0x01, 0x40
+			DB 0x60, 0x40, 0x01, 0x60, 0x88, 0x04, 0x20, 0x80
+			DB 0x20, 0x04, 0x40, 0x89, 0x60, 0x20, 0x01, 0x40
+			DB 0x82, 0x40, 0x01, 0x20, 0x60, 0xB6
+; 4 4
+			DB 0xA4, 0x41, 0x93, 0x40, 0x02, 0x91, 0x60, 0x20
+			DB 0x03, 0x90, 0x40, 0x01, 0x20, 0x60, 0x20, 0x00
+			DB 0x8E, 0x60, 0x20, 0x01, 0x40, 0x81, 0x20, 0x00
+			DB 0x8D, 0x40, 0x01, 0x20, 0x60, 0x82, 0x20, 0x00
+			DB 0x8B, 0x60, 0x20, 0x01, 0x40, 0x84, 0x20, 0x00
+			DB 0x8B, 0x01, 0x20, 0x60, 0x85, 0x20, 0x00, 0x8B
+			DB 0x0F, 0x87, 0x0F, 0x91, 0x20, 0x00, 0x95, 0x20
+			DB 0x00, 0x95, 0x40, 0x20, 0x88
+; 5 5
+			DB 0xC0, 0x61, 0x87, 0x07, 0x85, 0x00, 0x20, 0x87
+			DB 0x07, 0x85, 0x20, 0x00, 0x87, 0x01, 0x83, 0x20
+			DB 0x00, 0x85, 0x20, 0x00, 0x87, 0x01, 0x83, 0x20
+			DB 0x00, 0x85, 0x20, 0x00, 0x87, 0x01, 0x83, 0x20
+			DB 0x00, 0x60, 0x84, 0x00, 0x20, 0x87, 0x01, 0x83
+			DB 0x40, 0x00, 0x40, 0x83, 0x40, 0x00, 0x40, 0x87
+			DB 0x01, 0x83, 0x60, 0x01, 0x40, 0x81, 0x40, 0x01
+			DB 0x60, 0x87, 0x01, 0x84, 0x20, 0x05, 0x40, 0x88
+			DB 0x21, 0x85, 0x40, 0x02, 0x20, 0x40, 0x93, 0x61
+			DB 0xA0
+; 6 6
+			DB 0xA1, 0x63, 0x90, 0x40, 0x20, 0x05, 0x20, 0x60
+			DB 0x8B, 0x60, 0x20, 0x02, 0x20, 0x05, 0x40, 0x89
+			DB 0x60, 0x01, 0x20, 0x60, 0x80, 0x40, 0x00, 0x40
+			DB 0x81, 0x40, 0x01, 0x60, 0x88, 0x20, 0x00, 0x40
+			DB 0x81, 0x40, 0x00, 0x60, 0x83, 0x60, 0x00, 0x20
+			DB 0x87, 0x40, 0x00, 0x40, 0x82, 0x21, 0x85, 0x20
+			DB 0x00, 0x87, 0x40, 0x00, 0x60, 0x82, 0x00, 0x20
+			DB 0x85, 0x20, 0x00, 0x87, 0x21, 0x83, 0x00, 0x20
+			DB 0x85, 0x21, 0x87, 0x00, 0x20, 0x83, 0x20, 0x00
+			DB 0x60, 0x83, 0x40, 0x00, 0x40, 0x87, 0x00, 0x20
+			DB 0x83, 0x40, 0x01, 0x40, 0x61, 0x40, 0x01, 0x60
+			DB 0x87, 0x41, 0x84, 0x20, 0x05, 0x40, 0x90, 0x40
+			DB 0x20, 0x01, 0x40, 0x60, 0x9E
+; 7 7
+			DB 0x9A, 0x61, 0x95, 0x01, 0x95, 0x01, 0x95, 0x01
+			DB 0x8B, 0x40, 0x20, 0x87, 0x01, 0x88, 0x60, 0x40
+			DB 0x02, 0x87, 0x01, 0x86, 0x60, 0x20, 0x03, 0x20
+			DB 0x87, 0x01, 0x84, 0x60, 0x20, 0x02, 0x20, 0x40
+			DB 0x60, 0x88, 0x01, 0x82, 0x40, 0x20, 0x02, 0x20
+			DB 0x40, 0x8B, 0x01, 0x80, 0x60, 0x20, 0x02, 0x40
+			DB 0x60, 0x8D, 0x01, 0x20, 0x02, 0x40, 0x60, 0x8F
+			DB 0x03, 0x40, 0x60, 0x91, 0x01, 0x40, 0x60, 0xA8
+; 8 8
+			DB 0xA5, 0x61, 0x8C, 0x40, 0x01, 0x20, 0x60, 0x81
+			DB 0x60, 0x20, 0x02, 0x40, 0x89, 0x20, 0x04, 0x61
+			DB 0x05, 0x60, 0x87, 0x40, 0x00, 0x20, 0x61, 0x20
+			DB 0x00, 0x21, 0x00, 0x40, 0x81, 0x20, 0x00, 0x40
+			DB 0x87, 0x20, 0x00, 0x83, 0x02, 0x20, 0x83, 0x00
+			DB 0x20, 0x87, 0x00, 0x20, 0x83, 0x40, 0x01, 0x60
+			DB 0x83, 0x20, 0x00, 0x87, 0x00, 0x20, 0x83, 0x60
+			DB 0x00, 0x20, 0x84, 0x20, 0x00, 0x87, 0x21, 0x83
+			DB 0x20, 0x01, 0x60, 0x83, 0x20, 0x00, 0x87, 0x40
+			DB 0x00, 0x40, 0x81, 0x40, 0x00, 0x20, 0x00, 0x20
+			DB 0x82, 0x60, 0x00, 0x20, 0x87, 0x60, 0x05, 0x60
+			DB 0x01, 0x20, 0x61, 0x20, 0x00, 0x40, 0x88, 0x40
+			DB 0x02, 0x20, 0x60, 0x80, 0x40, 0x04, 0x20, 0x8B
+			DB 0x61, 0x83, 0x60, 0x20, 0x01, 0x40, 0x9E
+; 9 9
+			DB 0x9C, 0x60, 0x20, 0x01, 0x20, 0x40, 0x85, 0x61
+			DB 0x88, 0x40, 0x05, 0x20, 0x84, 0x00, 0x20, 0x87
+			DB 0x60, 0x01, 0x40, 0x61, 0x40, 0x01, 0x40, 0x83
+			DB 0x20, 0x00, 0x87, 0x20, 0x00, 0x60, 0x83, 0x60
+			DB 0x00, 0x20, 0x83, 0x20, 0x00, 0x87, 0x00, 0x20
+			DB 0x85, 0x20, 0x00, 0x83, 0x21, 0x87, 0x00, 0x20
+			DB 0x85, 0x20, 0x00, 0x82, 0x60, 0x00, 0x40, 0x87
+			DB 0x00, 0x20, 0x85, 0x21, 0x82, 0x20, 0x00, 0x40
+			DB 0x87, 0x20, 0x00, 0x40, 0x83, 0x40, 0x00, 0x40
+			DB 0x81, 0x40, 0x00, 0x20, 0x88, 0x60, 0x01, 0x40
+			DB 0x61, 0x40, 0x00, 0x20, 0x60, 0x40, 0x02, 0x60
+			DB 0x89, 0x40, 0x09, 0x20, 0x8C, 0x60, 0x40, 0x20
+			DB 0x02, 0x21, 0x40, 0x60, 0xB8
+; : colon
+			DB 0xFE, 0x40, 0x00, 0x20, 0x60, 0x82, 0x60, 0x20
+			DB 0x00, 0x40, 0x8C, 0x02, 0x40, 0x82, 0x20, 0x02
+			DB 0x8C, 0x20, 0x01, 0x40, 0x82, 0x40, 0x01, 0x20
+			DB 0x8C, 0x60, 0x20, 0x40, 0x84, 0x40, 0x20, 0x60
+			DB 0xFD
+; ; semicolon
+			DB 0xDD, 0x40, 0x20, 0x94, 0x60, 0x00, 0x40, 0x86
+			DB 0x40, 0x00, 0x20, 0x60, 0x83, 0x60, 0x01, 0x40
+			DB 0x80, 0x60, 0x20, 0x00, 0x60, 0x86, 0x02, 0x40
+			DB 0x83, 0x20, 0x05, 0x40, 0x87, 0x20, 0x01, 0x40
+			DB 0x83, 0x40, 0x04, 0x40, 0x88, 0x60, 0x20, 0x40
+			DB 0x85, 0x60, 0x40, 0x20, 0x40, 0x60, 0xFA
+; < less
+			DB 0xA3, 0x60, 0x40, 0x94, 0x60, 0x01, 0x60, 0x93
+			DB 0x20, 0x02, 0x92, 0x20, 0x00, 0x41, 0x00, 0x20
+			DB 0x90, 0x40, 0x00, 0x20, 0x81, 0x20, 0x00, 0x40
+			DB 0x8E, 0x60, 0x01, 0x60, 0x81, 0x60, 0x01, 0x40
+			DB 0x8C, 0x60, 0x01, 0x60, 0x83, 0x60, 0x01, 0x60
+			DB 0x8B, 0x20, 0x00, 0x40, 0x85, 0x40, 0x00, 0x20
+			DB 0x8A, 0x20, 0x00, 0x20, 0x87, 0x20, 0x00, 0x20
+			DB 0x89, 0x40, 0x00, 0x88, 0x60, 0x20, 0x40, 0xCB
+; = equal
+			DB 0xA1, 0x41, 0x81, 0x41, 0x91, 0x00, 0x20, 0x81
+			DB 0x00, 0x20, 0x91, 0x00, 0x20, 0x81, 0x00, 0x20
+			DB 0x91, 0x00, 0x20, 0x81, 0x00, 0x20, 0x91, 0x00
+			DB 0x20, 0x81, 0x00, 0x20, 0x91, 0x00, 0x20, 0x81
+			DB 0x00, 0x20, 0x91, 0x00, 0x20, 0x81, 0x00, 0x20
+			DB 0x91, 0x00, 0x20, 0x81, 0x00, 0x20, 0x91, 0x00
+			DB 0x20, 0x81, 0x00, 0x20, 0x91, 0x00, 0x20, 0x81
+			DB 0x00, 0x20, 0x91, 0x00, 0x20, 0x81, 0x00, 0x20
+			DB 0xB7
+; > greater
+			DB 0xB5, 0x40, 0x20, 0x60, 0x87, 0x60, 0x00, 0x40
+			DB 0x89, 0x20, 0x00, 0x20, 0x87, 0x20, 0x00, 0x20
+			DB 0x8A, 0x20, 0x00, 0x40, 0x85, 0x40, 0x00, 0x20
+			DB 0x8B, 0x60, 0x01, 0x60, 0x83, 0x40, 0x01, 0x60
+			DB 0x8C, 0x40, 0x01, 0x60, 0x81, 0x60, 0x01, 0x60
+			DB 0x8E, 0x40, 0x00, 0x20, 0x81, 0x20, 0x00, 0x40
+			DB 0x90, 0x20, 0x00, 0x41, 0x00, 0x20, 0x92, 0x02
+			DB 0x20, 0x93, 0x60, 0x01, 0x60, 0x94, 0x40, 0x60
+			DB 0xB9
+; ? question
+			DB 0xB2, 0x60, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20
+			DB 0x86, 0x40, 0x21, 0x60, 0x80, 0x40, 0x00, 0x40
+			DB 0x86, 0x20, 0x00, 0x85, 0x20, 0x02, 0x40, 0x80
+			DB 0x02, 0x86, 0x20, 0x00, 0x60, 0x83, 0x40, 0x00
+			DB 0x20, 0x41, 0x60, 0x80, 0x20, 0x00, 0x20, 0x86
+			DB 0x40, 0x00, 0x20, 0x82, 0x40, 0x00, 0x20, 0x85
+			DB 0x60, 0x88, 0x01, 0x40, 0x60, 0x40, 0x01, 0x90
+			DB 0x40, 0x04, 0x60, 0x91, 0x40, 0x20, 0x00, 0x20
+			DB 0x60, 0xD6
+; @ arobas
+			DB 0x87, 0x60, 0x40, 0x22, 0x40, 0x60, 0x8E, 0x40
+			DB 0x07, 0x20, 0x60, 0x8A, 0x60, 0x01, 0x20, 0x40
+			DB 0x60, 0x82, 0x60, 0x40, 0x01, 0x40, 0x88, 0x60
+			DB 0x01, 0x40, 0x87, 0x60, 0x01, 0x60, 0x87, 0x00
+			DB 0x20, 0x60, 0x81, 0x60, 0x40, 0x20, 0x01, 0x20
+			DB 0x60, 0x80, 0x40, 0x00, 0x40, 0x86, 0x40, 0x00
+			DB 0x60, 0x81, 0x60, 0x01, 0x22, 0x00, 0x20, 0x81
+			DB 0x00, 0x20, 0x86, 0x21, 0x82, 0x20, 0x40, 0x83
+			DB 0x40, 0x00, 0x81, 0x20, 0x00, 0x86, 0x00, 0x40
+			DB 0x82, 0x00, 0x60, 0x81, 0x60, 0x40, 0x00, 0x40
+			DB 0x81, 0x20, 0x00, 0x86, 0x00, 0x40, 0x82, 0x20
+			DB 0x04, 0x20, 0x60, 0x81, 0x21, 0x86, 0x40, 0x00
+			DB 0x82, 0x40, 0x21, 0x42, 0x00, 0x20, 0x81, 0x00
+			DB 0x40, 0x86, 0x60, 0x00, 0x20, 0x60, 0x86, 0x40
+			DB 0x00, 0x8B, 0x40, 0x01, 0x40, 0x60, 0x82, 0x60
+			DB 0x40, 0x00, 0x20, 0x8C, 0x60, 0x20, 0x06, 0x20
+			DB 0x60, 0x8E, 0x60, 0x40, 0x22, 0x40, 0x60, 0x8A
+; A A
+			DB 0x90, 0x60, 0x40, 0x92, 0x60, 0x40, 0x02, 0x8F
+			DB 0x60, 0x40, 0x04, 0x40, 0x8C, 0x60, 0x40, 0x04
+			DB 0x40, 0x60, 0x8B, 0x60, 0x40, 0x03, 0x20, 0x40
+			DB 0x20, 0x00, 0x8A, 0x41, 0x03, 0x20, 0x40, 0x60
+			DB 0x81, 0x20, 0x00, 0x8A, 0x02, 0x20, 0x40, 0x60
+			DB 0x84, 0x20, 0x00, 0x8A, 0x02, 0x20, 0x40, 0x60
+			DB 0x84, 0x20, 0x00, 0x8A, 0x40, 0x04, 0x20, 0x40
+			DB 0x60, 0x81, 0x20, 0x00, 0x8C, 0x60, 0x40, 0x20
+			DB 0x03, 0x20, 0x40, 0x20, 0x00, 0x8F, 0x60, 0x40
+			DB 0x20, 0x04, 0x40, 0x60, 0x90, 0x60, 0x40, 0x20
+			DB 0x03, 0x20, 0x40, 0x91, 0x60, 0x40, 0x20, 0x02
+			DB 0x94, 0x60, 0x40, 0x20, 0x84
+; B B
+			DB 0xB1, 0x10, 0x86, 0x10, 0x86, 0x00, 0x20, 0x65
+			DB 0x00, 0x20, 0x64, 0x20, 0x00, 0x86, 0x00, 0x20
+			DB 0x85, 0x00, 0x20, 0x84, 0x20, 0x00, 0x86, 0x00
+			DB 0x20, 0x85, 0x00, 0x20, 0x84, 0x20, 0x00, 0x86
+			DB 0x00, 0x20, 0x84, 0x60, 0x00, 0x20, 0x84, 0x20
+			DB 0x00, 0x86, 0x20, 0x00, 0x84, 0x40, 0x01, 0x84
+			DB 0x00, 0x20, 0x86, 0x40, 0x00, 0x20, 0x60, 0x81
+			DB 0x40, 0x02, 0x40, 0x82, 0x40, 0x00, 0x40, 0x86
+			DB 0x60, 0x06, 0x60, 0x01, 0x40, 0x60, 0x40, 0x01
+			DB 0x60, 0x87, 0x60, 0x03, 0x20, 0x60, 0x80, 0x40
+			DB 0x04, 0x40, 0x8A, 0x61, 0x84, 0x40, 0x20, 0x00
+			DB 0x20, 0x60, 0x9E
+; C C
+			DB 0x9F, 0x60, 0x43, 0x60, 0x8E, 0x60, 0x20, 0x07
+			DB 0x40, 0x8B, 0x40, 0x0B, 0x60, 0x88, 0x40, 0x01
+			DB 0x20, 0x40, 0x60, 0x82, 0x61, 0x40, 0x01, 0x20
+			DB 0x87, 0x60, 0x01, 0x40, 0x88, 0x60, 0x01, 0x40
+			DB 0x86, 0x40, 0x00, 0x40, 0x8A, 0x40, 0x00, 0x20
+			DB 0x86, 0x20, 0x00, 0x8C, 0x00, 0x20, 0x86, 0x00
+			DB 0x20, 0x8C, 0x20, 0x00, 0x86, 0x00, 0x20, 0x8C
+			DB 0x20, 0x00, 0x86, 0x20, 0x00, 0x8C, 0x00, 0x20
+			DB 0x86, 0x20, 0x00, 0x60, 0x8A, 0x60, 0x00, 0x40
+			DB 0x86, 0x41, 0x60, 0x8A, 0x40, 0x20, 0x60, 0x9C
+; D D
+			DB 0x99, 0x20, 0x0E, 0x20, 0x86, 0x10, 0x86, 0x00
+			DB 0x20, 0x6C, 0x20, 0x00, 0x86, 0x00, 0x20, 0x8C
+			DB 0x20, 0x00, 0x86, 0x00, 0x20, 0x8C, 0x20, 0x00
+			DB 0x86, 0x00, 0x20, 0x8C, 0x21, 0x86, 0x20, 0x00
+			DB 0x8B, 0x60, 0x00, 0x40, 0x86, 0x40, 0x00, 0x40
+			DB 0x8A, 0x20, 0x00, 0x40, 0x86, 0x60, 0x01, 0x40
+			DB 0x88, 0x40, 0x00, 0x20, 0x88, 0x20, 0x01, 0x20
+			DB 0x61, 0x82, 0x60, 0x40, 0x20, 0x01, 0x60, 0x89
+			DB 0x20, 0x0A, 0x60, 0x8B, 0x40, 0x20, 0x05, 0x20
+			DB 0x40, 0x90, 0x63, 0x8B
+; E E
+			DB 0xB1, 0x70, 0x86, 0x10, 0x86, 0x10, 0x86, 0x00
+			DB 0x20, 0x85, 0x00, 0x20, 0x84, 0x20, 0x00, 0x86
+			DB 0x00, 0x20, 0x85, 0x00, 0x20, 0x84, 0x20, 0x00
+			DB 0x86, 0x00, 0x20, 0x85, 0x00, 0x20, 0x84, 0x20
+			DB 0x00, 0x86, 0x00, 0x20, 0x85, 0x00, 0x20, 0x84
+			DB 0x20, 0x00, 0x86, 0x00, 0x20, 0x85, 0x00, 0x20
+			DB 0x84, 0x20, 0x00, 0x86, 0x00, 0x20, 0x85, 0x00
+			DB 0x20, 0x84, 0x20, 0x00, 0x86, 0x20, 0x40, 0x85
+			DB 0x41, 0x84, 0x40, 0x20, 0xB4
+; F F
+			DB 0xB1, 0x70, 0x86, 0x10, 0x86, 0x10, 0x86, 0x00
+			DB 0x20, 0x85, 0x00, 0x20, 0x8D, 0x00, 0x20, 0x85
+			DB 0x00, 0x20, 0x8D, 0x00, 0x20, 0x85, 0x00, 0x20
+			DB 0x8D, 0x00, 0x20, 0x85, 0x00, 0x20, 0x8D, 0x00
+			DB 0x20, 0x85, 0x00, 0x20, 0x8D, 0x00, 0x20, 0x85
+			DB 0x00, 0x20, 0x8D, 0x20, 0x40, 0x85, 0x41, 0xBB
+; G G
+			DB 0x88, 0x63, 0x90, 0x40, 0x20, 0x05, 0x20, 0x60
+			DB 0x8B, 0x60, 0x20, 0x09, 0x20, 0x89, 0x60, 0x01
+			DB 0x20, 0x40, 0x60, 0x82, 0x60, 0x40, 0x20, 0x01
+			DB 0x40, 0x88, 0x20, 0x00, 0x40, 0x88, 0x40, 0x01
+			DB 0x60, 0x86, 0x40, 0x00, 0x20, 0x8A, 0x40, 0x00
+			DB 0x40, 0x86, 0x20, 0x00, 0x60, 0x8A, 0x60, 0x00
+			DB 0x20, 0x86, 0x21, 0x8C, 0x20, 0x00, 0x86, 0x00
+			DB 0x20, 0x8C, 0x20, 0x00, 0x86, 0x00, 0x20, 0x8C
+			DB 0x20, 0x00, 0x86, 0x20, 0x00, 0x8C, 0x00, 0x20
+			DB 0x86, 0x20, 0x00, 0x60, 0x84, 0x20, 0x06, 0x40
+			DB 0x86, 0x40, 0x00, 0x40, 0x84, 0x20, 0x06, 0x60
+			DB 0x8E, 0x67, 0x85
+; H H
+			DB 0x99, 0x70, 0x86, 0x10, 0x86, 0x10, 0x8E, 0x00
+			DB 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95
+			DB 0x00, 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20
+			DB 0x8D, 0x67, 0x00, 0x20, 0x66, 0x86, 0x10, 0x86
+			DB 0x10, 0x9C
+; I I
+			DB 0xB1, 0x00, 0x20, 0x8C, 0x20, 0x00, 0x86, 0x00
+			DB 0x20, 0x8C, 0x20, 0x00, 0x86, 0x00, 0x20, 0x8C
+			DB 0x20, 0x00, 0x86, 0x00, 0x20, 0x6C, 0x20, 0x00
+			DB 0x86, 0x10, 0x86, 0x10, 0x86, 0x00, 0x20, 0x8C
+			DB 0x20, 0x00, 0x86, 0x00, 0x20, 0x8C, 0x20, 0x00
+			DB 0x86, 0x00, 0x20, 0x8C, 0x20, 0x00, 0x86, 0x20
+			DB 0x40, 0x8C, 0x40, 0x20, 0xB4
+; J J
+			DB 0xB1, 0x61, 0x8C, 0x41, 0x86, 0x00, 0x20, 0x8C
+			DB 0x00, 0x20, 0x86, 0x00, 0x20, 0x8C, 0x20, 0x00
+			DB 0x86, 0x00, 0x20, 0x8C, 0x20, 0x00, 0x86, 0x00
+			DB 0x20, 0x8C, 0x00, 0x20, 0x86, 0x00, 0x20, 0x8B
+			DB 0x40, 0x00, 0x40, 0x86, 0x00, 0x20, 0x6A, 0x40
+			DB 0x01, 0x60, 0x86, 0x0E, 0x40, 0x87, 0x0C, 0x20
+			DB 0x60, 0xCE
+; K K
+			DB 0x99, 0x70, 0x86, 0x10, 0x86, 0x10, 0x8D, 0x20
+			DB 0x00, 0x40, 0x92, 0x60, 0x20, 0x02, 0x20, 0x90
+			DB 0x40, 0x01, 0x20, 0x40, 0x02, 0x60, 0x8D, 0x20
+			DB 0x01, 0x40, 0x81, 0x60, 0x02, 0x40, 0x8A, 0x60
+			DB 0x02, 0x40, 0x84, 0x20, 0x01, 0x20, 0x60, 0x87
+			DB 0x40, 0x01, 0x20, 0x60, 0x86, 0x40, 0x02, 0x40
+			DB 0x86, 0x01, 0x40, 0x89, 0x60, 0x20, 0x01, 0x86
+			DB 0x00, 0x40, 0x8C, 0x20, 0x00, 0x86, 0x60, 0x8E
+			DB 0x40, 0x9C
+; L L
+			DB 0xB1, 0x70, 0x86, 0x10, 0x86, 0x10, 0x95, 0x20
+			DB 0x00, 0x95, 0x20, 0x00, 0x95, 0x20, 0x00, 0x95
+			DB 0x20, 0x00, 0x95, 0x20, 0x00, 0x95, 0x20, 0x00
+			DB 0x95, 0x20, 0x00, 0x95, 0x61, 0x9C
+; M M
+			DB 0x84, 0x63, 0x44, 0x23, 0x00, 0x86, 0x10, 0x86
+			DB 0x01, 0x20, 0x45, 0x64, 0x89, 0x20, 0x02, 0x20
+			DB 0x40, 0x60, 0x91, 0x60, 0x40, 0x20, 0x02, 0x20
+			DB 0x40, 0x60, 0x91, 0x60, 0x40, 0x20, 0x02, 0x20
+			DB 0x60, 0x92, 0x40, 0x20, 0x01, 0x40, 0x8F, 0x60
+			DB 0x40, 0x02, 0x20, 0x40, 0x8D, 0x60, 0x40, 0x20
+			DB 0x01, 0x20, 0x40, 0x60, 0x8E, 0x20, 0x01, 0x20
+			DB 0x40, 0x60, 0x91, 0x02, 0x21, 0x44, 0x64, 0x88
+			DB 0x10, 0x89, 0x63, 0x43, 0x23, 0x01, 0x9C
+; N N
+			DB 0x99, 0x10, 0x86, 0x02, 0x20, 0x0C, 0x86, 0x03
+			DB 0x40, 0x60, 0x92, 0x40, 0x03, 0x40, 0x60, 0x92
+			DB 0x40, 0x20, 0x02, 0x20, 0x60, 0x92, 0x40, 0x20
+			DB 0x02, 0x20, 0x60, 0x92, 0x60, 0x20, 0x02, 0x20
+			DB 0x40, 0x92, 0x60, 0x20, 0x02, 0x20, 0x40, 0x92
+			DB 0x60, 0x40, 0x03, 0x86, 0x0C, 0x20, 0x02, 0x86
+			DB 0x10, 0xB4
+; O O
+			DB 0x85, 0x60, 0x40, 0x20, 0x03, 0x20, 0x40, 0x60
+			DB 0x8B, 0x60, 0x20, 0x09, 0x20, 0x89, 0x40, 0x02
+			DB 0x41, 0x62, 0x41, 0x20, 0x01, 0x20, 0x88, 0x01
+			DB 0x40, 0x88, 0x40, 0x01, 0x40, 0x86, 0x40, 0x00
+			DB 0x40, 0x8A, 0x40, 0x00, 0x20, 0x86, 0x20, 0x00
+			DB 0x8C, 0x00, 0x20, 0x86, 0x00, 0x20, 0x8C, 0x20
+			DB 0x00, 0x86, 0x00, 0x20, 0x8C, 0x21, 0x86, 0x20
+			DB 0x00, 0x60, 0x8A, 0x60, 0x00, 0x40, 0x86, 0x40
+			DB 0x00, 0x20, 0x60, 0x88, 0x60, 0x01, 0x60, 0x87
+			DB 0x02, 0x40, 0x61, 0x82, 0x60, 0x40, 0x20, 0x01
+			DB 0x40, 0x88, 0x60, 0x20, 0x0A, 0x40, 0x8B, 0x40
+			DB 0x20, 0x05, 0x20, 0x40, 0x60, 0x8F, 0x63, 0x8B
+; P P
+			DB 0xB1, 0x20, 0x0F, 0x86, 0x10, 0x86, 0x00, 0x20
+			DB 0x66, 0x20, 0x00, 0x65, 0x86, 0x00, 0x20, 0x86
+			DB 0x20, 0x00, 0x8C, 0x00, 0x20, 0x86, 0x20, 0x00
+			DB 0x8C, 0x00, 0x20, 0x86, 0x21, 0x8C, 0x20, 0x00
+			DB 0x60, 0x84, 0x60, 0x00, 0x20, 0x8C, 0x40, 0x00
+			DB 0x20, 0x84, 0x20, 0x00, 0x60, 0x8C, 0x60, 0x01
+			DB 0x20, 0x61, 0x40, 0x20, 0x00, 0x20, 0x8E, 0x40
+			DB 0x05, 0x20, 0x90, 0x60, 0x20, 0x01, 0x20, 0x40
+			DB 0xA5
+; Q Q
+			DB 0x88, 0x63, 0x8F, 0x60, 0x40, 0x20, 0x05, 0x20
+			DB 0x40, 0x8B, 0x40, 0x0B, 0x60, 0x88, 0x40, 0x01
+			DB 0x20, 0x40, 0x60, 0x82, 0x61, 0x40, 0x02, 0x87
+			DB 0x60, 0x01, 0x60, 0x88, 0x60, 0x20, 0x00, 0x40
+			DB 0x86, 0x40, 0x00, 0x60, 0x8A, 0x60, 0x00, 0x20
+			DB 0x86, 0x21, 0x8C, 0x20, 0x00, 0x81, 0x20, 0x40
+			DB 0x82, 0x00, 0x20, 0x8C, 0x20, 0x00, 0x80, 0x60
+			DB 0x00, 0x40, 0x82, 0x20, 0x00, 0x8C, 0x00, 0x20
+			DB 0x81, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x8A
+			DB 0x40, 0x00, 0x40, 0x81, 0x00, 0x20, 0x82, 0x40
+			DB 0x01, 0x40, 0x88, 0x40, 0x01, 0x60, 0x81, 0x21
+			DB 0x83, 0x20, 0x01, 0x20, 0x41, 0x62, 0x41, 0x02
+			DB 0x40, 0x82, 0x40, 0x00, 0x84, 0x40, 0x09, 0x20
+			DB 0x60, 0x83, 0x40, 0x00, 0x85, 0x60, 0x40, 0x20
+			DB 0x03, 0x20, 0x40, 0x60, 0x85, 0x40, 0x00, 0x80
+; R R
+			DB 0xB1, 0x20, 0x0F, 0x86, 0x10, 0x86, 0x00, 0x20
+			DB 0x65, 0x00, 0x20, 0x66, 0x86, 0x00, 0x20, 0x85
+			DB 0x01, 0x20, 0x8C, 0x00, 0x20, 0x85, 0x02, 0x20
+			DB 0x60, 0x8A, 0x01, 0x84, 0x60, 0x00, 0x40, 0x20
+			DB 0x01, 0x40, 0x89, 0x20, 0x00, 0x60, 0x83, 0x20
+			DB 0x00, 0x60, 0x80, 0x20, 0x01, 0x40, 0x88, 0x40
+			DB 0x01, 0x40, 0x61, 0x20, 0x00, 0x20, 0x82, 0x40
+			DB 0x01, 0x20, 0x60, 0x87, 0x20, 0x05, 0x60, 0x83
+			DB 0x60, 0x02, 0x88, 0x40, 0x20, 0x00, 0x20, 0x40
+			DB 0x86, 0x60, 0x20, 0x00, 0x96, 0x20, 0x9C
+; S S
+			DB 0xA9, 0x60, 0x88, 0x40, 0x20, 0x00, 0x20, 0x40
+			DB 0x86, 0x40, 0x00, 0x40, 0x87, 0x40, 0x04, 0x20
+			DB 0x85, 0x60, 0x00, 0x20, 0x86, 0x60, 0x01, 0x40
+			DB 0x60, 0x20, 0x01, 0x40, 0x85, 0x01, 0x86, 0x20
+			DB 0x00, 0x60, 0x82, 0x20, 0x00, 0x20, 0x85, 0x20
+			DB 0x00, 0x86, 0x20, 0x00, 0x83, 0x60, 0x01, 0x40
+			DB 0x84, 0x20, 0x00, 0x86, 0x00, 0x20, 0x84, 0x20
+			DB 0x00, 0x20, 0x84, 0x00, 0x20, 0x86, 0x00, 0x20
+			DB 0x84, 0x40, 0x01, 0x60, 0x82, 0x60, 0x00, 0x40
+			DB 0x86, 0x00, 0x20, 0x85, 0x20, 0x01, 0x60, 0x80
+			DB 0x60, 0x20, 0x00, 0x60, 0x86, 0x20, 0x00, 0x85
+			DB 0x60, 0x05, 0x20, 0x87, 0x61, 0x86, 0x60, 0x20
+			DB 0x02, 0x40, 0x93, 0x61, 0xA0
+; T T
+			DB 0x99, 0x20, 0x40, 0x95, 0x00, 0x20, 0x95, 0x00
+			DB 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95
+			DB 0x10, 0x86, 0x10, 0x86, 0x00, 0x20, 0x6E, 0x86
+			DB 0x00, 0x20, 0x95, 0x00, 0x20, 0x95, 0x00, 0x20
+			DB 0x95, 0x00, 0x20, 0xAB
+; U U
+			DB 0x99, 0x0C, 0x20, 0x60, 0x88, 0x0E, 0x40, 0x87
+			DB 0x6B, 0x40, 0x20, 0x01, 0x60, 0x94, 0x40, 0x00
+			DB 0x20, 0x95, 0x00, 0x20, 0x95, 0x20, 0x00, 0x95
+			DB 0x20, 0x00, 0x95, 0x00, 0x20, 0x94, 0x40, 0x00
+			DB 0x40, 0x86, 0x6B, 0x40, 0x20, 0x01, 0x87, 0x0E
+			DB 0x60, 0x87, 0x0B, 0x20, 0x40, 0x9F
+; V V
+			DB 0x81, 0x40, 0x60, 0x95, 0x02, 0x40, 0x60, 0x92
+			DB 0x20, 0x04, 0x40, 0x60, 0x90, 0x60, 0x40, 0x20
+			DB 0x04, 0x20, 0x40, 0x90, 0x60, 0x40, 0x20, 0x04
+			DB 0x20, 0x40, 0x60, 0x90, 0x60, 0x40, 0x04, 0x20
+			DB 0x40, 0x91, 0x60, 0x40, 0x20, 0x02, 0x92, 0x60
+			DB 0x40, 0x20, 0x01, 0x8F, 0x60, 0x40, 0x03, 0x20
+			DB 0x40, 0x8C, 0x40, 0x20, 0x03, 0x20, 0x40, 0x60
+			DB 0x8A, 0x60, 0x40, 0x20, 0x03, 0x20, 0x40, 0x60
+			DB 0x8B, 0x40, 0x20, 0x03, 0x20, 0x40, 0x60, 0x8E
+			DB 0x02, 0x20, 0x40, 0x60, 0x91, 0x20, 0x40, 0x60
+			DB 0x92
+; W W
+			DB 0x99, 0x01, 0x22, 0x43, 0x63, 0x8A, 0x10, 0x88
+			DB 0x64, 0x44, 0x22, 0x01, 0x91, 0x60, 0x40, 0x20
+			DB 0x01, 0x20, 0x8E, 0x60, 0x40, 0x20, 0x01, 0x20
+			DB 0x40, 0x60, 0x8C, 0x60, 0x40, 0x20, 0x01, 0x20
+			DB 0x40, 0x60, 0x8F, 0x60, 0x02, 0x40, 0x60, 0x92
+			DB 0x40, 0x20, 0x02, 0x20, 0x40, 0x92, 0x60, 0x40
+			DB 0x20, 0x02, 0x20, 0x40, 0x92, 0x60, 0x40, 0x20
+			DB 0x02, 0x89, 0x63, 0x44, 0x22, 0x01, 0x86, 0x0F
+			DB 0x20, 0x86, 0x00, 0x23, 0x43, 0x63, 0x88
+; X X
+			DB 0x99, 0x20, 0x60, 0x8C, 0x40, 0x00, 0x86, 0x01
+			DB 0x40, 0x89, 0x60, 0x20, 0x01, 0x86, 0x20, 0x01
+			DB 0x20, 0x60, 0x86, 0x40, 0x02, 0x40, 0x87, 0x40
+			DB 0x02, 0x20, 0x60, 0x82, 0x40, 0x02, 0x20, 0x60
+			DB 0x8A, 0x40, 0x02, 0x40, 0x60, 0x20, 0x01, 0x20
+			DB 0x60, 0x8D, 0x60, 0x20, 0x03, 0x20, 0x40, 0x90
+			DB 0x60, 0x20, 0x02, 0x40, 0x90, 0x40, 0x02, 0x20
+			DB 0x01, 0x20, 0x60, 0x8C, 0x40, 0x02, 0x20, 0x60
+			DB 0x80, 0x40, 0x02, 0x20, 0x60, 0x88, 0x60, 0x20
+			DB 0x01, 0x20, 0x60, 0x83, 0x60, 0x20, 0x02, 0x40
+			DB 0x87, 0x02, 0x40, 0x87, 0x60, 0x20, 0x02, 0x86
+			DB 0x00, 0x40, 0x8B, 0x40, 0x01, 0x86, 0x60, 0x8D
+			DB 0x60, 0x20, 0x84
+; Y Y
+			DB 0x81, 0x20, 0x60, 0x95, 0x01, 0x20, 0x60, 0x93
+			DB 0x20, 0x02, 0x40, 0x60, 0x92, 0x60, 0x20, 0x02
+			DB 0x40, 0x93, 0x60, 0x20, 0x02, 0x40, 0x93, 0x60
+			DB 0x20, 0x02, 0x40, 0x65, 0x8D, 0x60, 0x20, 0x07
+			DB 0x8D, 0x40, 0x20, 0x07, 0x8B, 0x40, 0x02, 0x20
+			DB 0x60, 0x8F, 0x40, 0x20, 0x01, 0x20, 0x60, 0x8F
+			DB 0x60, 0x20, 0x01, 0x20, 0x40, 0x90, 0x20, 0x02
+			DB 0x40, 0x92, 0x01, 0x40, 0x94, 0x40, 0x60, 0x93
+; Z Z
+			DB 0x99, 0x20, 0x40, 0x8B, 0x40, 0x01, 0x86, 0x00
+			DB 0x20, 0x89, 0x60, 0x20, 0x02, 0x86, 0x00, 0x20
+			DB 0x88, 0x40, 0x04, 0x86, 0x00, 0x20, 0x86, 0x60
+			DB 0x02, 0x40, 0x80, 0x01, 0x86, 0x00, 0x20, 0x84
+			DB 0x60, 0x20, 0x01, 0x20, 0x60, 0x81, 0x01, 0x86
+			DB 0x00, 0x20, 0x83, 0x40, 0x02, 0x40, 0x83, 0x01
+			DB 0x86, 0x00, 0x20, 0x81, 0x60, 0x20, 0x01, 0x20
+			DB 0x60, 0x84, 0x01, 0x86, 0x00, 0x20, 0x80, 0x40
+			DB 0x02, 0x40, 0x86, 0x01, 0x86, 0x00, 0x20, 0x02
+			DB 0x20, 0x88, 0x01, 0x86, 0x02, 0x20, 0x60, 0x89
+			DB 0x01, 0x86, 0x01, 0x40, 0x8B, 0x01, 0x86, 0x61
+			DB 0x8C, 0x61, 0x9C
+; [ lsqbracket
+			DB 0xDF, 0x20, 0x15, 0x21, 0x15, 0x21, 0x00, 0x93
+			DB 0x00, 0x21, 0x00, 0x93, 0x00, 0x21, 0x00, 0x93
+			DB 0x00, 0x21, 0x00, 0x93, 0x00, 0x20, 0x61, 0x93
+			DB 0x61, 0xC7
+; \ backslash
+			DB 0xB1, 0x41, 0x60, 0x94, 0x20, 0x01, 0x20, 0x40
+			DB 0x93, 0x40, 0x20, 0x02, 0x40, 0x60, 0x92, 0x60
+			DB 0x40, 0x02, 0x20, 0x40, 0x92, 0x60, 0x40, 0x20
+			DB 0x01, 0x20, 0x40, 0x60, 0x92, 0x60, 0x20, 0x02
+			DB 0x40, 0x60, 0x92, 0x60, 0x40, 0x02, 0x20, 0x40
+			DB 0x93, 0x40, 0x20, 0x01, 0x20, 0x94, 0x60, 0x41
+			DB 0xCB
+; ] rsqbracket
+			DB 0xAF, 0x61, 0x93, 0x61, 0x20, 0x00, 0x93, 0x00
+			DB 0x21, 0x00, 0x93, 0x00, 0x21, 0x00, 0x93, 0x00
+			DB 0x21, 0x00, 0x93, 0x00, 0x21, 0x15, 0x21, 0x15
+			DB 0x20, 0xF7
+; ^ caret
+			DB 0xB7, 0x40, 0x20, 0x40, 0x92, 0x40, 0x20, 0x01
+			DB 0x40, 0x90, 0x40, 0x20, 0x01, 0x40, 0x90, 0x40
+			DB 0x20, 0x00, 0x20, 0x40, 0x92, 0x01, 0x40, 0x94
+			DB 0x20, 0x01, 0x40, 0x94, 0x40, 0x01, 0x20, 0x40
+			DB 0x94, 0x40, 0x01, 0x20, 0x40, 0x93, 0x60, 0x40
+			DB 0x01, 0x20, 0x94, 0x60, 0x20, 0x40, 0xBC
+; _ underline
+			DB 0x96, 0x20, 0x96, 0x20, 0x96, 0x20, 0x96, 0x20
+			DB 0x96, 0x20, 0x96, 0x20, 0x96, 0x20, 0x96, 0x20
+			DB 0x96, 0x20, 0x96, 0x20, 0x96, 0x20, 0x96, 0x20
+			DB 0x96, 0x20, 0x96, 0x20
+; ` backquote
+			DB 0xC8, 0x60, 0x40, 0x95, 0x20, 0x00, 0x60, 0x94
+			DB 0x60, 0x00, 0x20, 0x95, 0x20, 0x00, 0x60, 0x94
+			DB 0x60, 0x00, 0x40, 0x95, 0x41, 0xFF, 0x8A
+; a a
+			DB 0xB7, 0x61, 0x83, 0x40, 0x01, 0x40, 0x8C, 0x40
+			DB 0x00, 0x40, 0x82, 0x40, 0x03, 0x40, 0x8B, 0x20
+			DB 0x00, 0x82, 0x60, 0x00, 0x40, 0x80, 0x60, 0x01
+			DB 0x8B, 0x00, 0x20, 0x82, 0x40, 0x00, 0x82, 0x20
+			DB 0x00, 0x8B, 0x00, 0x20, 0x82, 0x21, 0x82, 0x21
+			DB 0x8B, 0x00, 0x20, 0x82, 0x20, 0x40, 0x82, 0x00
+			DB 0x40, 0x8B, 0x20, 0x00, 0x82, 0x00, 0x40, 0x81
+			DB 0x40, 0x00, 0x60, 0x8B, 0x20, 0x00, 0x20, 0x61
+			DB 0x00, 0x40, 0x60, 0x20, 0x00, 0x60, 0x8C, 0x60
+			DB 0x0A, 0x8C, 0x60, 0x20, 0x08, 0xB4
+; b b
+			DB 0xB0, 0x10, 0x40, 0x85, 0x10, 0x20, 0x85, 0x66
+			DB 0x40, 0x20, 0x00, 0x40, 0x64, 0x01, 0x8B, 0x60
+			DB 0x00, 0x20, 0x86, 0x20, 0x00, 0x8B, 0x20, 0x00
+			DB 0x87, 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x20
+			DB 0x00, 0x8B, 0x00, 0x20, 0x86, 0x60, 0x00, 0x20
+			DB 0x8B, 0x20, 0x00, 0x40, 0x85, 0x20, 0x00, 0x40
+			DB 0x8B, 0x40, 0x01, 0x40, 0x62, 0x40, 0x20, 0x00
+			DB 0x20, 0x8D, 0x20, 0x06, 0x20, 0x8F, 0x40, 0x20
+			DB 0x02, 0x20, 0x40, 0x9F
+; c c
+			DB 0xB9, 0x40, 0x20, 0x02, 0x20, 0x60, 0x8F, 0x20
+			DB 0x06, 0x40, 0x8D, 0x20, 0x00, 0x20, 0x40, 0x61
+			DB 0x40, 0x20, 0x01, 0x60, 0x8B, 0x40, 0x00, 0x20
+			DB 0x85, 0x20, 0x00, 0x40, 0x8B, 0x20, 0x00, 0x60
+			DB 0x85, 0x60, 0x00, 0x20, 0x8B, 0x21, 0x87, 0x20
+			DB 0x00, 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00, 0x8B
+			DB 0x00, 0x20, 0x87, 0x21, 0x8B, 0x20, 0x00, 0x87
+			DB 0x00, 0x20, 0x8B, 0x40, 0x20, 0x60, 0x85, 0x60
+			DB 0x00, 0x40, 0xB4
+; d d
+			DB 0xA3, 0x62, 0x91, 0x60, 0x40, 0x04, 0x40, 0x60
+			DB 0x8D, 0x60, 0x08, 0x60, 0x8C, 0x01, 0x40, 0x60
+			DB 0x82, 0x40, 0x20, 0x00, 0x40, 0x8B, 0x40, 0x00
+			DB 0x40, 0x85, 0x60, 0x01, 0x8B, 0x20, 0x00, 0x87
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x21, 0x8B
+			DB 0x00, 0x20, 0x86, 0x40, 0x00, 0x40, 0x8B, 0x00
+			DB 0x20, 0x84, 0x60, 0x40, 0x00, 0x40, 0x86, 0x0E
+			DB 0x22, 0x85, 0x11, 0x85, 0x71, 0x9C
+; e e
+			DB 0xA3, 0x62, 0x91, 0x60, 0x20, 0x03, 0x20, 0x40
+			DB 0x8E, 0x40, 0x07, 0x40, 0x8C, 0x60, 0x01, 0x41
+			DB 0x00, 0x80, 0x60, 0x40, 0x01, 0x40, 0x8B, 0x20
+			DB 0x00, 0x60, 0x80, 0x40, 0x00, 0x82, 0x60, 0x00
+			DB 0x20, 0x8B, 0x00, 0x20, 0x81, 0x40, 0x00, 0x83
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x81, 0x40, 0x00
+			DB 0x83, 0x20, 0x00, 0x8B, 0x20, 0x00, 0x81, 0x40
+			DB 0x00, 0x83, 0x20, 0x00, 0x8B, 0x40, 0x00, 0x20
+			DB 0x60, 0x40, 0x00, 0x83, 0x21, 0x8C, 0x20, 0x03
+			DB 0x83, 0x00, 0x40, 0x8D, 0x40, 0x02, 0x82, 0x60
+			DB 0x20, 0x60, 0x8F, 0x61, 0xA2
+; f f
+			DB 0x9F, 0x40, 0x20, 0x95, 0x20, 0x00, 0x95, 0x20
+			DB 0x00, 0x95, 0x20, 0x00, 0x92, 0x62, 0x20, 0x00
+			DB 0x68, 0x86, 0x60, 0x20, 0x0E, 0x85, 0x60, 0x10
+			DB 0x85, 0x40, 0x00, 0x20, 0x60, 0x82, 0x20, 0x00
+			DB 0x8E, 0x21, 0x84, 0x20, 0x00, 0x8E, 0x00, 0x20
+			DB 0x84, 0x20, 0x00, 0x8E, 0x00, 0x20, 0x84, 0x20
+			DB 0x00, 0x8E, 0x21, 0x84, 0x20, 0x00, 0x8E, 0x41
+			DB 0x84, 0x61, 0x8D
+; g g
+			DB 0xAA, 0x60, 0x20, 0x00, 0x20, 0x60, 0x88, 0x40
+			DB 0x20, 0x00, 0x20, 0x40, 0x80, 0x60, 0x41, 0x60
+			DB 0x04, 0x87, 0x20, 0x04, 0x20, 0x02, 0x21, 0x40
+			DB 0x60, 0x20, 0x00, 0x86, 0x40, 0x00, 0x40, 0x81
+			DB 0x60, 0x01, 0x20, 0x60, 0x01, 0x60, 0x81, 0x60
+			DB 0x00, 0x86, 0x20, 0x40, 0x83, 0x60, 0x00, 0x40
+			DB 0x80, 0x20, 0x00, 0x83, 0x20, 0x86, 0x00, 0x60
+			DB 0x84, 0x00, 0x40, 0x80, 0x20, 0x00, 0x83, 0x20
+			DB 0x86, 0x00, 0x60, 0x84, 0x00, 0x40, 0x80, 0x20
+			DB 0x00, 0x83, 0x20, 0x86, 0x00, 0x40, 0x83, 0x60
+			DB 0x00, 0x60, 0x80, 0x20, 0x00, 0x83, 0x20, 0x86
+			DB 0x01, 0x40, 0x81, 0x60, 0x01, 0x81, 0x20, 0x00
+			DB 0x60, 0x81, 0x60, 0x00, 0x86, 0x06, 0x40, 0x81
+			DB 0x40, 0x00, 0x20, 0x60, 0x40, 0x01, 0x86, 0x00
+			DB 0x20, 0x40, 0x01, 0x20, 0x60, 0x82, 0x60, 0x04
+			DB 0x40, 0x86, 0x00, 0x20, 0x88, 0x60, 0x20, 0x00
+			DB 0x20, 0x60, 0x87, 0x61, 0x8E
+; h h
+			DB 0xB0, 0x11, 0x85, 0x11, 0x85, 0x66, 0x40, 0x20
+			DB 0x00, 0x40, 0x66, 0x8B, 0x60, 0x00, 0x20, 0x94
+			DB 0x40, 0x00, 0x60, 0x94, 0x21, 0x95, 0x00, 0x20
+			DB 0x95, 0x20, 0x00, 0x20, 0x68, 0x8B, 0x40, 0x0A
+			DB 0x8C, 0x40, 0x20, 0x08, 0xB4
+; i i
+			DB 0x9E, 0x61, 0x87, 0x41, 0x8B, 0x00, 0x20, 0x87
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00
+			DB 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00, 0x86, 0x60
+			DB 0x40, 0x82, 0x00, 0x20, 0x87, 0x20, 0x00, 0x85
+			DB 0x60, 0x01, 0x20, 0x81, 0x0B, 0x85, 0x40, 0x02
+			DB 0x81, 0x0B, 0x86, 0x20, 0x00, 0x40, 0x81, 0x69
+			DB 0x20, 0x00, 0x95, 0x20, 0x00, 0x95, 0x20, 0x00
+			DB 0x95, 0x20, 0x00, 0x95, 0x41, 0x9C
+; j j
+			DB 0x96, 0x40, 0x86, 0x61, 0x8C, 0x20, 0x00, 0x86
+			DB 0x00, 0x20, 0x8C, 0x60, 0x00, 0x86, 0x00, 0x20
+			DB 0x8D, 0x20, 0x86, 0x00, 0x20, 0x8D, 0x20, 0x86
+			DB 0x00, 0x20, 0x8D, 0x20, 0x86, 0x00, 0x20, 0x8C
+			DB 0x60, 0x00, 0x81, 0x20, 0x00, 0x40, 0x81, 0x00
+			DB 0x20, 0x8B, 0x60, 0x20, 0x00, 0x80, 0x40, 0x02
+			DB 0x81, 0x0F, 0x20, 0x80, 0x60, 0x01, 0x20, 0x81
+			DB 0x0E, 0x40, 0x82, 0x60, 0x40, 0x82, 0x6D, 0xCA
+; k k
+			DB 0x98, 0x71, 0x85, 0x11, 0x85, 0x11, 0x8F, 0x60
+			DB 0x00, 0x40, 0x93, 0x40, 0x02, 0x40, 0x91, 0x40
+			DB 0x01, 0x40, 0x01, 0x40, 0x8F, 0x40, 0x01, 0x40
+			DB 0x80, 0x40, 0x01, 0x20, 0x8D, 0x40, 0x01, 0x40
+			DB 0x82, 0x60, 0x01, 0x20, 0x60, 0x8B, 0x01, 0x40
+			DB 0x84, 0x60, 0x02, 0x8B, 0x00, 0x40, 0x86, 0x60
+			DB 0x20, 0x00, 0x8B, 0x40, 0x89, 0x20, 0xB4
+; l l
+			DB 0x98, 0x41, 0x8D, 0x41, 0x85, 0x00, 0x20, 0x8D
+			DB 0x20, 0x00, 0x85, 0x00, 0x20, 0x8D, 0x20, 0x00
+			DB 0x85, 0x00, 0x20, 0x8D, 0x20, 0x00, 0x85, 0x00
+			DB 0x20, 0x6D, 0x20, 0x00, 0x85, 0x11, 0x85, 0x11
+			DB 0x95, 0x20, 0x00, 0x95, 0x20, 0x00, 0x95, 0x20
+			DB 0x00, 0x95, 0x20, 0x00, 0x95, 0x61, 0x9C
+; m m
+			DB 0x9E, 0x0B, 0x8B, 0x41, 0x20, 0x01, 0x26, 0x8B
+			DB 0x60, 0x21, 0x60, 0x93, 0x21, 0x95, 0x00, 0x20
+			DB 0x60, 0x94, 0x20, 0x0A, 0x8C, 0x40, 0x20, 0x01
+			DB 0x26, 0x8B, 0x60, 0x21, 0x60, 0x93, 0x21, 0x95
+			DB 0x00, 0x20, 0x60, 0x94, 0x20, 0x0A, 0x8C, 0x40
+			DB 0x29, 0x9C
+; n n
+			DB 0xB6, 0x0B, 0x8B, 0x01, 0x20, 0x08, 0x8C, 0x40
+			DB 0x00, 0x20, 0x40, 0x60, 0x91, 0x60, 0x00, 0x40
+			DB 0x94, 0x21, 0x95, 0x00, 0x20, 0x95, 0x01, 0x40
+			DB 0x94, 0x40, 0x0A, 0x8C, 0x20, 0x09, 0x8E, 0x68
+			DB 0xB4
+; o o
+			DB 0xA1, 0x40, 0x20, 0x01, 0x20, 0x40, 0x60, 0x8E
+			DB 0x60, 0x20, 0x06, 0x40, 0x8D, 0x20, 0x00, 0x20
+			DB 0x40, 0x61, 0x40, 0x20, 0x01, 0x60, 0x8B, 0x40
+			DB 0x00, 0x40, 0x85, 0x40, 0x00, 0x20, 0x8B, 0x20
+			DB 0x00, 0x87, 0x00, 0x20, 0x8B, 0x00, 0x20, 0x87
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x21, 0x8B
+			DB 0x20, 0x00, 0x60, 0x85, 0x40, 0x00, 0x40, 0x8B
+			DB 0x40, 0x01, 0x40, 0x60, 0x81, 0x60, 0x40, 0x01
+			DB 0x8D, 0x40, 0x07, 0x60, 0x8E, 0x40, 0x20, 0x03
+			DB 0x40, 0x60, 0x91, 0x62, 0xA1
+; p p
+			DB 0xB6, 0x10, 0x86, 0x10, 0x86, 0x61, 0x20, 0x00
+			DB 0x40, 0x64, 0x00, 0x20, 0x64, 0x86, 0x60, 0x00
+			DB 0x20, 0x86, 0x20, 0x00, 0x8B, 0x20, 0x00, 0x87
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00
+			DB 0x8B, 0x00, 0x20, 0x86, 0x60, 0x00, 0x20, 0x8B
+			DB 0x20, 0x00, 0x40, 0x85, 0x20, 0x00, 0x40, 0x8B
+			DB 0x40, 0x01, 0x40, 0x62, 0x40, 0x20, 0x00, 0x20
+			DB 0x8D, 0x20, 0x06, 0x20, 0x8F, 0x40, 0x20, 0x02
+			DB 0x20, 0x40, 0x9F
+; q q
+			DB 0xA3, 0x62, 0x91, 0x60, 0x40, 0x04, 0x40, 0x60
+			DB 0x8D, 0x60, 0x08, 0x60, 0x8C, 0x01, 0x40, 0x60
+			DB 0x82, 0x40, 0x20, 0x00, 0x40, 0x8B, 0x40, 0x00
+			DB 0x40, 0x86, 0x01, 0x8B, 0x20, 0x00, 0x87, 0x20
+			DB 0x00, 0x8B, 0x00, 0x20, 0x87, 0x21, 0x8B, 0x00
+			DB 0x20, 0x86, 0x40, 0x00, 0x60, 0x8B, 0x00, 0x20
+			DB 0x84, 0x60, 0x20, 0x00, 0x40, 0x8C, 0x20, 0x07
+			DB 0x20, 0x06, 0x86, 0x20, 0x0F, 0x86, 0x70, 0x97
+; r r
+			DB 0x9E, 0x41, 0x87, 0x41, 0x8B, 0x00, 0x20, 0x87
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00
+			DB 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00, 0x8B, 0x0B
+			DB 0x8B, 0x01, 0x20, 0x08, 0x8C, 0x60, 0x20, 0x00
+			DB 0x40, 0x61, 0x82, 0x20, 0x00, 0x8C, 0x01, 0x60
+			DB 0x85, 0x20, 0x00, 0x8B, 0x40, 0x00, 0x60, 0x86
+			DB 0x20, 0x00, 0x8B, 0x21, 0x87, 0x41, 0x8B, 0x00
+			DB 0x20, 0x95, 0x20, 0x00, 0x95, 0x61, 0x8E
+; s s
+			DB 0xB9, 0x60, 0x85, 0x61, 0x8C, 0x40, 0x02, 0x40
+			DB 0x82, 0x60, 0x00, 0x20, 0x8B, 0x60, 0x04, 0x83
+			DB 0x00, 0x20, 0x8B, 0x20, 0x00, 0x60, 0x80, 0x20
+			DB 0x00, 0x40, 0x82, 0x20, 0x00, 0x8B, 0x00, 0x20
+			DB 0x81, 0x60, 0x00, 0x20, 0x82, 0x20, 0x00, 0x8B
+			DB 0x00, 0x20, 0x82, 0x01, 0x82, 0x20, 0x00, 0x8B
+			DB 0x00, 0x20, 0x82, 0x20, 0x00, 0x60, 0x81, 0x00
+			DB 0x20, 0x8B, 0x21, 0x82, 0x40, 0x01, 0x40, 0x20
+			DB 0x00, 0x40, 0x8B, 0x20, 0x00, 0x83, 0x03, 0x20
+			DB 0x92, 0x60, 0x20, 0x00, 0x20, 0x60, 0xB5
+; t t
+			DB 0x9E, 0x00, 0x20, 0x95, 0x00, 0x20, 0x95, 0x00
+			DB 0x20, 0x91, 0x63, 0x00, 0x20, 0x66, 0x89, 0x40
+			DB 0x0D, 0x40, 0x87, 0x20, 0x0E, 0x40, 0x8B, 0x00
+			DB 0x20, 0x85, 0x60, 0x40, 0x00, 0x20, 0x8B, 0x00
+			DB 0x20, 0x87, 0x01, 0x8B, 0x00, 0x20, 0x87, 0x20
+			DB 0x00, 0x8B, 0x00, 0x20, 0x87, 0x21, 0x8B, 0x00
+			DB 0x20, 0x87, 0x00, 0x20, 0x8B, 0x61, 0x87, 0x61
+			DB 0x9C
+; u u
+			DB 0xB6, 0x08, 0x20, 0x40, 0x8C, 0x0A, 0x40, 0x8B
+			DB 0x68, 0x20, 0x00, 0x20, 0x95, 0x20, 0x00, 0x95
+			DB 0x20, 0x00, 0x95, 0x00, 0x20, 0x94, 0x20, 0x00
+			DB 0x60, 0x8B, 0x66, 0x40, 0x00, 0x20, 0x60, 0x8C
+			DB 0x0B, 0x8B, 0x0B, 0xB4
+; v v
+			DB 0x9E, 0x20, 0x40, 0x95, 0x02, 0x40, 0x60, 0x92
+			DB 0x40, 0x03, 0x20, 0x40, 0x92, 0x40, 0x20, 0x03
+			DB 0x40, 0x60, 0x91, 0x60, 0x40, 0x20, 0x02, 0x20
+			DB 0x40, 0x92, 0x60, 0x40, 0x02, 0x92, 0x60, 0x40
+			DB 0x20, 0x01, 0x90, 0x40, 0x20, 0x02, 0x20, 0x40
+			DB 0x8D, 0x60, 0x20, 0x03, 0x40, 0x60, 0x8D, 0x40
+			DB 0x20, 0x02, 0x20, 0x40, 0x90, 0x02, 0x40, 0x60
+			DB 0x92, 0x20, 0x40, 0xA6
+; w w
+			DB 0x86, 0x60, 0x96, 0x01, 0x21, 0x41, 0x60, 0x90
+			DB 0x08, 0x20, 0x41, 0x8D, 0x60, 0x41, 0x21, 0x04
+			DB 0x92, 0x60, 0x40, 0x02, 0x90, 0x40, 0x20, 0x02
+			DB 0x40, 0x60, 0x8E, 0x20, 0x02, 0x40, 0x60, 0x91
+			DB 0x02, 0x40, 0x60, 0x92, 0x40, 0x20, 0x02, 0x20
+			DB 0x40, 0x92, 0x60, 0x40, 0x03, 0x40, 0x93, 0x40
+			DB 0x02, 0x8B, 0x61, 0x41, 0x21, 0x05, 0x8B, 0x06
+			DB 0x21, 0x40, 0x61, 0x8B, 0x00, 0x20, 0x41, 0x61
+			DB 0x8A
+; x x
+			DB 0x9E, 0x40, 0x89, 0x40, 0x8B, 0x00, 0x40, 0x87
+			DB 0x20, 0x00, 0x8B, 0x01, 0x20, 0x84, 0x60, 0x20
+			DB 0x01, 0x8B, 0x60, 0x02, 0x60, 0x81, 0x40, 0x01
+			DB 0x20, 0x8D, 0x60, 0x20, 0x01, 0x41, 0x01, 0x40
+			DB 0x90, 0x40, 0x03, 0x60, 0x92, 0x20, 0x01, 0x20
+			DB 0x91, 0x60, 0x20, 0x03, 0x20, 0x60, 0x8E, 0x60
+			DB 0x01, 0x20, 0x61, 0x20, 0x01, 0x40, 0x8C, 0x40
+			DB 0x01, 0x40, 0x83, 0x20, 0x01, 0x20, 0x8B, 0x01
+			DB 0x40, 0x85, 0x40, 0x01, 0x8B, 0x20, 0x60, 0x87
+			DB 0x60, 0x00, 0x96, 0x60, 0x84
+; y y
+			DB 0x9E, 0x20, 0x60, 0x8D, 0x20, 0x86, 0x01, 0x20
+			DB 0x40, 0x60, 0x8A, 0x20, 0x86, 0x20, 0x03, 0x20
+			DB 0x60, 0x88, 0x00, 0x87, 0x60, 0x40, 0x20, 0x02
+			DB 0x20, 0x40, 0x60, 0x83, 0x60, 0x20, 0x00, 0x8A
+			DB 0x60, 0x40, 0x03, 0x20, 0x61, 0x20, 0x01, 0x20
+			DB 0x8D, 0x40, 0x20, 0x05, 0x40, 0x8E, 0x60, 0x40
+			DB 0x02, 0x20, 0x40, 0x8D, 0x60, 0x40, 0x20, 0x02
+			DB 0x40, 0x60, 0x8D, 0x40, 0x20, 0x02, 0x20, 0x40
+			DB 0x60, 0x8D, 0x40, 0x03, 0x20, 0x60, 0x90, 0x02
+			DB 0x40, 0x60, 0x92, 0x20, 0x40, 0xA6
+; z z
+			DB 0xB6, 0x20, 0x40, 0x86, 0x60, 0x20, 0x00, 0x8B
+			DB 0x00, 0x20, 0x85, 0x60, 0x02, 0x8B, 0x00, 0x20
+			DB 0x84, 0x40, 0x03, 0x8B, 0x00, 0x20, 0x83, 0x20
+			DB 0x01, 0x40, 0x20, 0x00, 0x8B, 0x00, 0x20, 0x81
+			DB 0x60, 0x20, 0x01, 0x40, 0x80, 0x20, 0x00, 0x8B
+			DB 0x00, 0x20, 0x80, 0x40, 0x01, 0x20, 0x60, 0x81
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x40, 0x01, 0x20
+			DB 0x83, 0x20, 0x00, 0x8B, 0x03, 0x40, 0x84, 0x20
+			DB 0x00, 0x8B, 0x02, 0x60, 0x85, 0x20, 0x00, 0x8B
+			DB 0x21, 0x87, 0x20, 0x00, 0xB4
+; { lbrace
+			DB 0xA1, 0x40, 0x20, 0x95, 0x20, 0x00, 0x95, 0x01
+			DB 0x60, 0x93, 0x40, 0x00, 0x21, 0x60, 0x8B, 0x40
+			DB 0x20, 0x05, 0x20, 0x40, 0x07, 0x20, 0x40, 0x82
+			DB 0x20, 0x06, 0x40, 0x81, 0x40, 0x20, 0x07, 0x20
+			DB 0x81, 0x00, 0x20, 0x60, 0x8F, 0x60, 0x20, 0x00
+			DB 0x41, 0x00, 0x60, 0x91, 0x60, 0x00, 0x40, 0x20
+			DB 0x00, 0x93, 0x00, 0x20, 0x40, 0x20, 0x93, 0x20
+			DB 0x40, 0xC7
+; | bar
+			DB 0xFF, 0x8F, 0x17, 0x37, 0xFF, 0x8F
+; } rbrace
+			DB 0xAF, 0x40, 0x20, 0x93, 0x20, 0x40, 0x20, 0x00
+			DB 0x93, 0x00, 0x20, 0x40, 0x00, 0x60, 0x91, 0x60
+			DB 0x00, 0x41, 0x00, 0x20, 0x60, 0x8F, 0x60, 0x20
+			DB 0x00, 0x40, 0x80, 0x20, 0x06, 0x40, 0x81, 0x40
+			DB 0x20, 0x07, 0x20, 0x82, 0x40, 0x20, 0x05, 0x20
+			DB 0x40, 0x07, 0x20, 0x40, 0x8A, 0x40, 0x00, 0x21
+			DB 0x60, 0x93, 0x01, 0x60, 0x94, 0x20, 0x00, 0x95
+			DB 0x40, 0x20, 0xBB
+; ~ tilde
+			DB 0x9E, 0x40, 0x60, 0x93, 0x60, 0x01, 0x40, 0x93
+			DB 0x20, 0x00, 0x60, 0x94, 0x00, 0x20, 0x95, 0x20
+			DB 0x00, 0x60, 0x94, 0x40, 0x01, 0x60, 0x94, 0x40
+			DB 0x00, 0x20, 0x95, 0x20, 0x00, 0x95, 0x20, 0x00
+			DB 0x93, 0x60, 0x40, 0x00, 0x40, 0x93, 0x40, 0x00
+			DB 0x40, 0xBF
+;  7F
+			DB 0xB2, 0x40, 0x20, 0x00, 0x20, 0x40, 0x91, 0x20
+			DB 0x05, 0x8F, 0x40, 0x00, 0x40, 0x81, 0x60, 0x40
+			DB 0x00, 0x40, 0x8E, 0x21, 0x84, 0x20, 0x00, 0x8E
+			DB 0x00, 0x40, 0x84, 0x20, 0x00, 0x8E, 0x21, 0x84
+			DB 0x00, 0x20, 0x8E, 0x40, 0x00, 0x40, 0x81, 0x60
+			DB 0x20, 0x00, 0x40, 0x8E, 0x60, 0x05, 0x20, 0x90
+			DB 0x60, 0x40, 0x01, 0x20, 0x40, 0xD7
+; € 80
+			DB 0xA3, 0x62, 0x91, 0x60, 0x20, 0x03, 0x20, 0x40
+			DB 0x88, 0x40, 0x20, 0x60, 0x82, 0x40, 0x07, 0x20
+			DB 0x87, 0x01, 0x20, 0x81, 0x60, 0x01, 0x40, 0x60
+			DB 0x81, 0x60, 0x40, 0x01, 0x40, 0x86, 0x40, 0x00
+			DB 0x40, 0x81, 0x40, 0x00, 0x40, 0x85, 0x40, 0x00
+			DB 0x20, 0x8B, 0x21, 0x87, 0x20, 0x00, 0x8B, 0x00
+			DB 0x20, 0x87, 0x20, 0x00, 0x86, 0x40, 0x20, 0x60
+			DB 0x81, 0x20, 0x00, 0x87, 0x00, 0x20, 0x86, 0x01
+			DB 0x20, 0x81, 0x20, 0x00, 0x40, 0x85, 0x40, 0x00
+			DB 0x40, 0x86, 0x40, 0x00, 0x40, 0x81, 0x60, 0x01
+			DB 0x20, 0x40, 0x61, 0x40, 0x20, 0x00, 0x20, 0x8D
+			DB 0x40, 0x06, 0x20, 0x60, 0x8E, 0x60, 0x40, 0x20
+			DB 0x01, 0x20, 0x40, 0x9F
+;  81
+			DB 0xB7, 0x61, 0x83, 0x40, 0x01, 0x40, 0x87, 0x40
+			DB 0x20, 0x60, 0x81, 0x40, 0x00, 0x40, 0x82, 0x40
+			DB 0x03, 0x40, 0x86, 0x01, 0x20, 0x81, 0x20, 0x00
+			DB 0x82, 0x60, 0x00, 0x40, 0x80, 0x60, 0x01, 0x86
+			DB 0x40, 0x00, 0x40, 0x81, 0x00, 0x20, 0x82, 0x40
+			DB 0x00, 0x82, 0x20, 0x00, 0x8B, 0x00, 0x20, 0x82
+			DB 0x21, 0x82, 0x21, 0x8B, 0x00, 0x20, 0x82, 0x20
+			DB 0x40, 0x82, 0x00, 0x40, 0x86, 0x40, 0x20, 0x60
+			DB 0x81, 0x20, 0x00, 0x82, 0x00, 0x40, 0x81, 0x40
+			DB 0x00, 0x60, 0x86, 0x01, 0x20, 0x81, 0x20, 0x00
+			DB 0x20, 0x61, 0x00, 0x40, 0x60, 0x20, 0x00, 0x60
+			DB 0x87, 0x40, 0x00, 0x40, 0x81, 0x60, 0x0A, 0x8C
+			DB 0x60, 0x20, 0x08, 0xB4
+; ‚ 82
+			DB 0xB6, 0x08, 0x20, 0x40, 0x87, 0x40, 0x20, 0x60
+			DB 0x81, 0x0A, 0x40, 0x86, 0x01, 0x20, 0x81, 0x68
+			DB 0x20, 0x00, 0x20, 0x86, 0x40, 0x00, 0x40, 0x8B
+			DB 0x20, 0x00, 0x95, 0x20, 0x00, 0x95, 0x00, 0x20
+			DB 0x86, 0x40, 0x20, 0x60, 0x8A, 0x20, 0x00, 0x60
+			DB 0x86, 0x01, 0x20, 0x81, 0x66, 0x40, 0x00, 0x20
+			DB 0x60, 0x87, 0x40, 0x00, 0x40, 0x81, 0x0B, 0x8B
+			DB 0x0B, 0xB4
+; ƒ 83
+			DB 0xB2, 0x40, 0x20, 0x0D, 0x86, 0x40, 0x0F, 0x85
+			DB 0x40, 0x00, 0x20, 0x60, 0x93, 0x20, 0x00, 0x8D
+			DB 0x61, 0x85, 0x00, 0x20, 0x83, 0x60, 0x20, 0x00
+			DB 0x20, 0x40, 0x84, 0x00, 0x20, 0x85, 0x00, 0x20
+			DB 0x83, 0x20, 0x03, 0x40, 0x83, 0x20, 0x00, 0x85
+			DB 0x20, 0x00, 0x82, 0x40, 0x00, 0x40, 0x60, 0x20
+			DB 0x01, 0x83, 0x20, 0x00, 0x85, 0x20, 0x00, 0x40
+			DB 0x60, 0x40, 0x00, 0x40, 0x82, 0x20, 0x00, 0x20
+			DB 0x82, 0x21, 0x85, 0x60, 0x03, 0x20, 0x83, 0x60
+			DB 0x01, 0x40, 0x60, 0x40, 0x00, 0x40, 0x86, 0x60
+			DB 0x20, 0x00, 0x20, 0x60, 0x84, 0x40, 0x04, 0x60
+			DB 0x91, 0x40, 0x20, 0x00, 0x20, 0x60, 0x9D
+; „ 84
+			DB 0xA3, 0x62, 0x91, 0x60, 0x20, 0x03, 0x20, 0x40
+			DB 0x8E, 0x40, 0x07, 0x40, 0x8C, 0x60, 0x01, 0x41
+			DB 0x00, 0x80, 0x60, 0x40, 0x01, 0x40, 0x87, 0x61
+			DB 0x81, 0x20, 0x00, 0x60, 0x80, 0x40, 0x00, 0x82
+			DB 0x60, 0x00, 0x20, 0x87, 0x00, 0x20, 0x81, 0x00
+			DB 0x20, 0x81, 0x40, 0x00, 0x83, 0x20, 0x00, 0x86
+			DB 0x40, 0x00, 0x60, 0x81, 0x00, 0x20, 0x81, 0x40
+			DB 0x00, 0x83, 0x20, 0x00, 0x85, 0x60, 0x00, 0x20
+			DB 0x82, 0x20, 0x00, 0x81, 0x40, 0x00, 0x83, 0x20
+			DB 0x00, 0x85, 0x20, 0x00, 0x40, 0x82, 0x40, 0x00
+			DB 0x20, 0x60, 0x40, 0x00, 0x83, 0x21, 0x85, 0x60
+			DB 0x20, 0x84, 0x20, 0x03, 0x83, 0x00, 0x40, 0x8D
+			DB 0x40, 0x02, 0x82, 0x60, 0x20, 0x60, 0x8F, 0x61
+			DB 0xA2
+; … 85
+			DB 0xA3, 0x62, 0x91, 0x60, 0x20, 0x03, 0x20, 0x40
+			DB 0x87, 0x60, 0x40, 0x84, 0x40, 0x07, 0x40, 0x86
+			DB 0x20, 0x00, 0x60, 0x82, 0x60, 0x01, 0x41, 0x00
+			DB 0x80, 0x60, 0x40, 0x01, 0x40, 0x85, 0x60, 0x00
+			DB 0x20, 0x82, 0x20, 0x00, 0x60, 0x80, 0x40, 0x00
+			DB 0x82, 0x60, 0x00, 0x20, 0x86, 0x20, 0x00, 0x60
+			DB 0x81, 0x00, 0x20, 0x81, 0x40, 0x00, 0x83, 0x20
+			DB 0x00, 0x86, 0x60, 0x00, 0x40, 0x81, 0x00, 0x20
+			DB 0x81, 0x40, 0x00, 0x83, 0x20, 0x00, 0x87, 0x41
+			DB 0x81, 0x20, 0x00, 0x81, 0x40, 0x00, 0x83, 0x20
+			DB 0x00, 0x8B, 0x40, 0x00, 0x20, 0x60, 0x40, 0x00
+			DB 0x83, 0x21, 0x8C, 0x20, 0x03, 0x83, 0x00, 0x40
+			DB 0x8D, 0x40, 0x02, 0x82, 0x60, 0x20, 0x60, 0x8F
+			DB 0x61, 0xA2
+; † 86
+			DB 0xA3, 0x62, 0x91, 0x60, 0x20, 0x03, 0x20, 0x40
+			DB 0x89, 0x60, 0x83, 0x40, 0x07, 0x40, 0x88, 0x21
+			DB 0x81, 0x60, 0x01, 0x41, 0x00, 0x80, 0x60, 0x40
+			DB 0x01, 0x40, 0x86, 0x40, 0x00, 0x60, 0x81, 0x20
+			DB 0x00, 0x60, 0x80, 0x40, 0x00, 0x82, 0x60, 0x00
+			DB 0x20, 0x85, 0x60, 0x00, 0x20, 0x82, 0x00, 0x20
+			DB 0x81, 0x40, 0x00, 0x83, 0x20, 0x00, 0x85, 0x60
+			DB 0x00, 0x40, 0x82, 0x00, 0x20, 0x81, 0x40, 0x00
+			DB 0x83, 0x20, 0x00, 0x86, 0x20, 0x00, 0x60, 0x81
+			DB 0x20, 0x00, 0x81, 0x40, 0x00, 0x83, 0x20, 0x00
+			DB 0x86, 0x60, 0x00, 0x40, 0x81, 0x40, 0x00, 0x20
+			DB 0x60, 0x40, 0x00, 0x83, 0x21, 0x87, 0x41, 0x82
+			DB 0x20, 0x03, 0x83, 0x00, 0x40, 0x8D, 0x40, 0x02
+			DB 0x82, 0x60, 0x20, 0x60, 0x8F, 0x61, 0xA2
+; ‡ 87
+			DB 0xB9, 0x40, 0x20, 0x02, 0x20, 0x60, 0x8F, 0x20
+			DB 0x06, 0x40, 0x8D, 0x20, 0x00, 0x20, 0x40, 0x61
+			DB 0x40, 0x20, 0x01, 0x60, 0x8B, 0x40, 0x00, 0x20
+			DB 0x85, 0x20, 0x00, 0x40, 0x8B, 0x20, 0x00, 0x60
+			DB 0x85, 0x60, 0x00, 0x20, 0x80, 0x62, 0x20, 0x86
+			DB 0x21, 0x87, 0x20, 0x00, 0x80, 0x40, 0x02, 0x86
+			DB 0x00, 0x20, 0x87, 0x20, 0x00, 0x80, 0x60, 0x21
+			DB 0x60, 0x86, 0x00, 0x20, 0x87, 0x21, 0x8B, 0x20
+			DB 0x00, 0x87, 0x00, 0x20, 0x8B, 0x40, 0x20, 0x60
+			DB 0x85, 0x60, 0x00, 0x40, 0xB4
+; ˆ 88
+			DB 0xB7, 0x61, 0x83, 0x40, 0x01, 0x40, 0x8C, 0x40
+			DB 0x00, 0x40, 0x82, 0x40, 0x03, 0x40, 0x8B, 0x20
+			DB 0x00, 0x82, 0x60, 0x00, 0x40, 0x80, 0x60, 0x01
+			DB 0x87, 0x61, 0x81, 0x00, 0x20, 0x82, 0x40, 0x00
+			DB 0x82, 0x20, 0x00, 0x87, 0x00, 0x20, 0x81, 0x00
+			DB 0x20, 0x82, 0x21, 0x82, 0x21, 0x86, 0x40, 0x00
+			DB 0x60, 0x81, 0x00, 0x20, 0x82, 0x20, 0x40, 0x82
+			DB 0x00, 0x40, 0x85, 0x60, 0x00, 0x20, 0x82, 0x20
+			DB 0x00, 0x82, 0x00, 0x40, 0x81, 0x40, 0x00, 0x60
+			DB 0x85, 0x20, 0x00, 0x40, 0x82, 0x20, 0x00, 0x20
+			DB 0x61, 0x00, 0x40, 0x60, 0x20, 0x00, 0x60, 0x86
+			DB 0x60, 0x20, 0x83, 0x60, 0x0A, 0x8C, 0x60, 0x20
+			DB 0x08, 0xB4
+; ‰ 89
+			DB 0x9E, 0x61, 0x87, 0x41, 0x8B, 0x00, 0x20, 0x87
+			DB 0x20, 0x00, 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00
+			DB 0x8B, 0x00, 0x20, 0x87, 0x20, 0x00, 0x87, 0x41
+			DB 0x81, 0x00, 0x20, 0x87, 0x20, 0x00, 0x86, 0x60
+			DB 0x00, 0x40, 0x81, 0x0B, 0x86, 0x20, 0x00, 0x60
+			DB 0x81, 0x0B, 0x85, 0x60, 0x00, 0x40, 0x82, 0x69
+			DB 0x20, 0x00, 0x85, 0x20, 0x00, 0x60, 0x8C, 0x20
+			DB 0x00, 0x85, 0x60, 0x40, 0x8D, 0x20, 0x00, 0x95
+			DB 0x20, 0x00, 0x95, 0x61, 0x9C
+; Š 8A
+			DB 0xA1, 0x40, 0x20, 0x01, 0x20, 0x40, 0x60, 0x8E
+			DB 0x60, 0x20, 0x06, 0x40, 0x8D, 0x20, 0x00, 0x20
+			DB 0x40, 0x61, 0x40, 0x20, 0x01, 0x60, 0x8B, 0x40
+			DB 0x00, 0x40, 0x85, 0x40, 0x00, 0x20, 0x87, 0x41
+			DB 0x81, 0x20, 0x00, 0x87, 0x00, 0x20, 0x86, 0x60
+			DB 0x00, 0x40, 0x81, 0x00, 0x20, 0x87, 0x20, 0x00
+			DB 0x86, 0x20, 0x00, 0x60, 0x81, 0x00, 0x20, 0x87
+			DB 0x21, 0x85, 0x60, 0x00, 0x40, 0x82, 0x20, 0x00
+			DB 0x60, 0x85, 0x40, 0x00, 0x40, 0x85, 0x20, 0x00
+			DB 0x60, 0x82, 0x40, 0x01, 0x40, 0x60, 0x81, 0x60
+			DB 0x40, 0x01, 0x86, 0x60, 0x40, 0x84, 0x40, 0x07
+			DB 0x60, 0x8E, 0x40, 0x20, 0x03, 0x40, 0x60, 0x91
+			DB 0x62, 0xA1
+; ‹ 8B
+			DB 0x9E, 0x69, 0x8D, 0x09, 0x20, 0x8C, 0x0A, 0x40
+			DB 0x94, 0x40, 0x01, 0x87, 0x41, 0x8B, 0x20, 0x00
+			DB 0x86, 0x60, 0x00, 0x40, 0x8B, 0x21, 0x86, 0x20
+			DB 0x00, 0x60, 0x8A, 0x40, 0x00, 0x40, 0x85, 0x60
+			DB 0x00, 0x40, 0x89, 0x60, 0x40, 0x00, 0x40, 0x86
+			DB 0x20, 0x00, 0x60, 0x82, 0x08, 0x22, 0x85, 0x60
+			DB 0x40, 0x83, 0x0B, 0x8B, 0x6B, 0xB4
+; Π8C
+			DB 0xB6, 0x0B, 0x86, 0x60, 0x20, 0x40, 0x81, 0x01
+			DB 0x20, 0x08, 0x86, 0x20, 0x00, 0x60, 0x82, 0x40
+			DB 0x00, 0x20, 0x40, 0x60, 0x8C, 0x00, 0x20, 0x82
+			DB 0x60, 0x00, 0x40, 0x8F, 0x20, 0x00, 0x82, 0x21
+			DB 0x90, 0x60, 0x00, 0x40, 0x81, 0x00, 0x20, 0x91
+			DB 0x00, 0x20, 0x81, 0x01, 0x40, 0x8F, 0x40, 0x00
+			DB 0x40, 0x81, 0x40, 0x0A, 0x86, 0x41, 0x83, 0x20
+			DB 0x09, 0x8E, 0x68, 0xB4
+;  8D
+			DB 0xFE, 0x40, 0x20, 0x40, 0x80, 0x68, 0x43, 0x86
+			DB 0x02, 0x60, 0x40, 0x0B, 0x86, 0x20, 0x01, 0x80
+			DB 0x40, 0x27, 0x03, 0x87, 0x60, 0xFF, 0x86
+; Ž 8E
+			DB 0xC2, 0x61, 0x93, 0x40, 0x02, 0x20, 0x91, 0x40
+			DB 0x04, 0x20, 0x8F, 0x40, 0x01, 0x60, 0x80, 0x60
+			DB 0x01, 0x60, 0x86, 0x40, 0x00, 0x40, 0x80, 0x62
+			DB 0x40, 0x01, 0x60, 0x82, 0x40, 0x00, 0x40, 0x86
+			DB 0x02, 0x80, 0x40, 0x03, 0x60, 0x84, 0x00, 0x20
+			DB 0x86, 0x20, 0x00, 0x20, 0x80, 0x40, 0x01, 0x20
+			DB 0x60, 0x85, 0x20, 0x00, 0x87, 0x60, 0x83, 0x60
+			DB 0x87, 0x20, 0x00, 0x95, 0x61, 0xC7
+;  8F
+			DB 0x9C, 0x40, 0x89, 0x40, 0x8A, 0x20, 0x00, 0x20
+			DB 0x61, 0x20, 0x01, 0x20, 0x40, 0x60, 0x20, 0x00
+			DB 0x20, 0x89, 0x60, 0x20, 0x09, 0x20, 0x60, 0x8B
+			DB 0x40, 0x00, 0x20, 0x60, 0x81, 0x60, 0x20, 0x00
+			DB 0x20, 0x8D, 0x40, 0x00, 0x60, 0x83, 0x60, 0x00
+			DB 0x20, 0x8D, 0x20, 0x00, 0x85, 0x00, 0x20, 0x8D
+			DB 0x20, 0x00, 0x60, 0x83, 0x60, 0x00, 0x40, 0x8D
+			DB 0x40, 0x00, 0x20, 0x60, 0x81, 0x60, 0x01, 0x40
+			DB 0x8C, 0x40, 0x09, 0x40, 0x8A, 0x20, 0x01, 0x41
+			DB 0x20, 0x01, 0x20, 0x60, 0x40, 0x01, 0x20, 0x89
+			DB 0x60, 0x20, 0x60, 0x87, 0x60, 0x20, 0x60, 0xB5
+;  90
+			DB 0x94, 0x40, 0x20, 0x00, 0x92, 0x60, 0x20, 0x01
+			DB 0x20, 0x84, 0x40, 0x8B, 0x40, 0x01, 0x20, 0x00
+			DB 0x60, 0x83, 0x60, 0x00, 0x40, 0x88, 0x60, 0x01
+			DB 0x21, 0x00, 0x60, 0x83, 0x60, 0x01, 0x20, 0x86
+			DB 0x60, 0x40, 0x00, 0x40, 0x21, 0x00, 0x20, 0x84
+			DB 0x00, 0x20, 0x60, 0x00, 0x84, 0x60, 0x40, 0x01
+			DB 0x40, 0x22, 0x00, 0x60, 0x83, 0x60, 0x00, 0x61
+			DB 0x00, 0x40, 0x81, 0x60, 0x40, 0x01, 0x20, 0x40
+			DB 0x22, 0x00, 0x40, 0x84, 0x20, 0x00, 0x61, 0x00
+			DB 0x20, 0x60, 0x20, 0x01, 0x20, 0x41, 0x22, 0x00
+			DB 0x20, 0x84, 0x60, 0x00, 0x40, 0x61, 0x40, 0x02
+			DB 0x20, 0x42, 0x23, 0x00, 0x60, 0x84, 0x40, 0x00
+			DB 0x63, 0x45, 0x23, 0x00, 0x20, 0x85, 0x00, 0x20
+			DB 0x64, 0x43, 0x24, 0x00, 0x60, 0x84, 0x60, 0x00
+			DB 0x40, 0x64, 0x42, 0x24, 0x00, 0x20, 0x85, 0x60
+			DB 0x00, 0x66, 0x40, 0x25, 0x00, 0x60, 0x85, 0x20
+			DB 0x00, 0x65, 0x41, 0x26, 0x86
+; ‘ 91
+			DB 0x20, 0x00, 0x64, 0x43, 0x23, 0x00, 0x40, 0x86
+			DB 0x00, 0x40, 0x64, 0x44, 0x22, 0x00, 0x60, 0x86
+			DB 0x00, 0x64, 0x46, 0x21, 0x00, 0x40, 0x86, 0x00
+			DB 0x63, 0x48, 0x21, 0x01, 0x60, 0x84, 0x00, 0x62
+			DB 0x4B, 0x21, 0x00, 0x20, 0x40, 0x82, 0x00, 0x61
+			DB 0x4D, 0x20, 0x01, 0x40, 0x82, 0x00, 0x60, 0x4C
+			DB 0x20, 0x01, 0x40, 0x60, 0x83, 0x00, 0x4A, 0x20
+			DB 0x02, 0x20, 0x60, 0x85, 0x02, 0x25, 0x03, 0x20
+			DB 0x40, 0x60, 0x87, 0x60, 0x40, 0x20, 0x05, 0x20
+			DB 0x41, 0x60, 0xEA
+; ’ 92
+			DB 0x89, 0x02, 0x94, 0x02, 0x94, 0x02, 0x8E, 0x20
+			DB 0x0C, 0x20, 0x89, 0x20, 0x0A, 0x20, 0x8B, 0x20
+			DB 0x08, 0x20, 0x8D, 0x20, 0x06, 0x20, 0x8F, 0x20
+			DB 0x04, 0x20, 0x91, 0x20, 0x02, 0x20, 0x93, 0x20
+			DB 0x00, 0x20, 0x95, 0x20, 0xD3
+; “ 93
+			DB 0xB9, 0x01, 0x85, 0x20, 0x8E, 0x01, 0x85, 0x00
+			DB 0x20, 0x8D, 0x01, 0x85, 0x60, 0x00, 0x8D, 0x01
+			DB 0x20, 0x84, 0x60, 0x20, 0x00, 0x8C, 0x0A, 0x20
+			DB 0x8B, 0x20, 0x09, 0x20, 0x93, 0x60, 0x20, 0x00
+			DB 0x94, 0x60, 0x00, 0x95, 0x00, 0x20, 0x95, 0x20
+			DB 0xB4
+; ” 94
+			DB 0xB3, 0x20, 0x85, 0x01, 0x8D, 0x20, 0x00, 0x85
+			DB 0x01, 0x8D, 0x00, 0x40, 0x85, 0x01, 0x8C, 0x01
+			DB 0x60, 0x84, 0x20, 0x01, 0x8B, 0x20, 0x0A, 0x8B
+			DB 0x20, 0x09, 0x20, 0x8C, 0x01, 0x60, 0x95, 0x00
+			DB 0x40, 0x95, 0x20, 0x00, 0x96, 0x20, 0xC2
+; • 95
+			DB 0xA2, 0x21, 0x94, 0x20, 0x01, 0x20, 0x91, 0x20
+			DB 0x60, 0x03, 0x60, 0x20, 0x8E, 0x21, 0x00, 0x80
+			DB 0x01, 0x40, 0x00, 0x21, 0x8E, 0x40, 0x60, 0x80
+			DB 0x01, 0x80, 0x60, 0x40, 0x92, 0x01, 0x95, 0x01
+			DB 0x92, 0x60, 0x81, 0x01, 0x81, 0x60, 0x8E, 0x20
+			DB 0x00, 0x20, 0x60, 0x01, 0x60, 0x20, 0x00, 0x20
+			DB 0x8E, 0x21, 0x03, 0x21, 0x91, 0x20, 0x01, 0x20
+			DB 0x94, 0x21, 0x96, 0x60, 0x8A
+; TOTAL COMPRESSED SIZE = 7823
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font28_idx.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,127 @@
+;==========================================================================
+; Font index exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font28_chars		EQU	.118
+aa_font28_firstChar	EQU	' '
+aa_font28_lastChar	EQU	'•'
+;
+aa_font28_idx:
+			DW	aa_font28_bits + 0x0000	;   Space
+			DW	aa_font28_bits + 0x0003	; ! mark
+			DW	aa_font28_bits + 0x0013	; " dquote
+			DW	aa_font28_bits + 0x0045	; # sharp
+			DW	aa_font28_bits + 0x00A1	; $ dolar
+			DW	aa_font28_bits + 0x0105	; % percent
+			DW	aa_font28_bits + 0x018B	; & and
+			DW	aa_font28_bits + 0x0204	; ' quote
+			DW	aa_font28_bits + 0x0224	; ( lparent
+			DW	aa_font28_bits + 0x025F	; ) rparent
+			DW	aa_font28_bits + 0x029A	; * star
+			DW	aa_font28_bits + 0x02D7	; + plus
+			DW	aa_font28_bits + 0x02FA	; , comma
+			DW	aa_font28_bits + 0x0319	; - minus
+			DW	aa_font28_bits + 0x0331	; . dot
+			DW	aa_font28_bits + 0x0344	; / slash
+			DW	aa_font28_bits + 0x0374	; 0 0
+			DW	aa_font28_bits + 0x03C2	; 1 1
+			DW	aa_font28_bits + 0x03F2	; 2 2
+			DW	aa_font28_bits + 0x0443	; 3 3
+			DW	aa_font28_bits + 0x04A1	; 4 4
+			DW	aa_font28_bits + 0x04DE	; 5 5
+			DW	aa_font28_bits + 0x0527	; 6 6
+			DW	aa_font28_bits + 0x058C	; 7 7
+			DW	aa_font28_bits + 0x05CC	; 8 8
+			DW	aa_font28_bits + 0x063B	; 9 9
+			DW	aa_font28_bits + 0x06A0	; : colon
+			DW	aa_font28_bits + 0x06C1	; ; semicolon
+			DW	aa_font28_bits + 0x06F0	; < less
+			DW	aa_font28_bits + 0x0730	; = equal
+			DW	aa_font28_bits + 0x0771	; > greater
+			DW	aa_font28_bits + 0x07B2	; ? question
+			DW	aa_font28_bits + 0x07F4	; @ arobas
+			DW	aa_font28_bits + 0x087C	; A A
+			DW	aa_font28_bits + 0x08D9	; B B
+			DW	aa_font28_bits + 0x0934	; C C
+			DW	aa_font28_bits + 0x0984	; D D
+			DW	aa_font28_bits + 0x09D0	; E E
+			DW	aa_font28_bits + 0x0A15	; F F
+			DW	aa_font28_bits + 0x0A45	; G G
+			DW	aa_font28_bits + 0x0AA0	; H H
+			DW	aa_font28_bits + 0x0AC2	; I I
+			DW	aa_font28_bits + 0x0AF7	; J J
+			DW	aa_font28_bits + 0x0B29	; K K
+			DW	aa_font28_bits + 0x0B6B	; L L
+			DW	aa_font28_bits + 0x0B89	; M M
+			DW	aa_font28_bits + 0x0BD0	; N N
+			DW	aa_font28_bits + 0x0C02	; O O
+			DW	aa_font28_bits + 0x0C62	; P P
+			DW	aa_font28_bits + 0x0CA3	; Q Q
+			DW	aa_font28_bits + 0x0D1B	; R R
+			DW	aa_font28_bits + 0x0D6A	; S S
+			DW	aa_font28_bits + 0x0DCF	; T T
+			DW	aa_font28_bits + 0x0DF3	; U U
+			DW	aa_font28_bits + 0x0E21	; V V
+			DW	aa_font28_bits + 0x0E72	; W W
+			DW	aa_font28_bits + 0x0EB9	; X X
+			DW	aa_font28_bits + 0x0F1C	; Y Y
+			DW	aa_font28_bits + 0x0F5C	; Z Z
+			DW	aa_font28_bits + 0x0FB7	; [ lsqbracket
+			DW	aa_font28_bits + 0x0FD1	; \ backslash
+			DW	aa_font28_bits + 0x1002	; ] rsqbracket
+			DW	aa_font28_bits + 0x101C	; ^ caret
+			DW	aa_font28_bits + 0x104B	; _ underline
+			DW	aa_font28_bits + 0x1067	; ` backquote
+			DW	aa_font28_bits + 0x107E	; a a
+			DW	aa_font28_bits + 0x10CC	; b b
+			DW	aa_font28_bits + 0x1110	; c c
+			DW	aa_font28_bits + 0x1153	; d d
+			DW	aa_font28_bits + 0x1191	; e e
+			DW	aa_font28_bits + 0x11E6	; f f
+			DW	aa_font28_bits + 0x1221	; g g
+			DW	aa_font28_bits + 0x12A6	; h h
+			DW	aa_font28_bits + 0x12CB	; i i
+			DW	aa_font28_bits + 0x1309	; j j
+			DW	aa_font28_bits + 0x1349	; k k
+			DW	aa_font28_bits + 0x1380	; l l
+			DW	aa_font28_bits + 0x13AF	; m m
+			DW	aa_font28_bits + 0x13D9	; n n
+			DW	aa_font28_bits + 0x13FA	; o o
+			DW	aa_font28_bits + 0x1447	; p p
+			DW	aa_font28_bits + 0x148A	; q q
+			DW	aa_font28_bits + 0x14CA	; r r
+			DW	aa_font28_bits + 0x1509	; s s
+			DW	aa_font28_bits + 0x1558	; t t
+			DW	aa_font28_bits + 0x1591	; u u
+			DW	aa_font28_bits + 0x15B5	; v v
+			DW	aa_font28_bits + 0x15F1	; w w
+			DW	aa_font28_bits + 0x1632	; x x
+			DW	aa_font28_bits + 0x167F	; y y
+			DW	aa_font28_bits + 0x16CD	; z z
+			DW	aa_font28_bits + 0x171A	; { lbrace
+			DW	aa_font28_bits + 0x1754	; | bar
+			DW	aa_font28_bits + 0x175A	; } rbrace
+			DW	aa_font28_bits + 0x1795	; ~ tilde
+			DW	aa_font28_bits + 0x17BF	;  7F
+			DW	aa_font28_bits + 0x17F5	; € 80
+			DW	aa_font28_bits + 0x1859	;  81
+			DW	aa_font28_bits + 0x18BD	; ‚ 82
+			DW	aa_font28_bits + 0x18F7	; ƒ 83
+			DW	aa_font28_bits + 0x1956	; „ 84
+			DW	aa_font28_bits + 0x19BF	; … 85
+			DW	aa_font28_bits + 0x1A29	; † 86
+			DW	aa_font28_bits + 0x1A98	; ‡ 87
+			DW	aa_font28_bits + 0x1AE5	; ˆ 88
+			DW	aa_font28_bits + 0x1B47	; ‰ 89
+			DW	aa_font28_bits + 0x1B8C	; Š 8A
+			DW	aa_font28_bits + 0x1BEE	; ‹ 8B
+			DW	aa_font28_bits + 0x1C24	; Π8C
+			DW	aa_font28_bits + 0x1C60	;  8D
+			DW	aa_font28_bits + 0x1C77	; Ž 8E
+			DW	aa_font28_bits + 0x1CB5	;  8F
+			DW	aa_font28_bits + 0x1D0D	;  90
+			DW	aa_font28_bits + 0x1D92	; ‘ 91
+			DW	aa_font28_bits + 0x1DDD	; ’ 92
+			DW	aa_font28_bits + 0x1E02	; “ 93
+			DW	aa_font28_bits + 0x1E2B	; ” 94
+			DW	aa_font28_bits + 0x1E52	; • 95
+			DW	aa_font28_bits + 0x1E8F	; END OF INDEX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font34.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,1615 @@
+;==========================================================================
+; Font data exported mar. nov. 20 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font34_height	EQU	.32
+aa_font34_width		EQU	.18
+aa_font34_nbbits	EQU	.3
+;
+aa_font34_bits:
+;   Space
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xBF
+; ! mark
+			DB 0xFF, 0xBF, 0x60, 0x41, 0x60, 0x8E, 0x60, 0x40
+			DB 0x20, 0x60, 0x88, 0x20, 0x0A, 0x24, 0x60, 0x80
+			DB 0x20, 0x02, 0x60, 0x87, 0x20, 0x0F, 0x40, 0x80
+			DB 0x03, 0x40, 0x87, 0x20, 0x0A, 0x24, 0x60, 0x80
+			DB 0x20, 0x02, 0x60, 0x87, 0x60, 0x40, 0x60, 0x90
+			DB 0x41, 0x60, 0xFF, 0xE8
+; " dquote
+			DB 0x87, 0x40, 0x60, 0x9C, 0x60, 0x00, 0x20, 0x96
+			DB 0x40, 0x60, 0x83, 0x20, 0x00, 0x40, 0x95, 0x20
+			DB 0x01, 0x40, 0x80, 0x60, 0x20, 0x01, 0x96, 0x07
+			DB 0x60, 0x96, 0x06, 0x40, 0x97, 0x20, 0x04, 0x40
+			DB 0x99, 0x43, 0xA2, 0x41, 0x9C, 0x40, 0x00, 0x20
+			DB 0x95, 0x60, 0x41, 0x82, 0x60, 0x20, 0x00, 0x40
+			DB 0x95, 0x02, 0x20, 0x41, 0x20, 0x00, 0x20, 0x96
+			DB 0x07, 0x60, 0x96, 0x06, 0x60, 0x97, 0x20, 0x03
+			DB 0x20, 0x60, 0x99, 0x60, 0x41, 0xDB
+; # sharp
+			DB 0x85, 0x60, 0x41, 0x84, 0x40, 0x00, 0x20, 0x94
+			DB 0x40, 0x00, 0x20, 0x84, 0x40, 0x00, 0x20, 0x94
+			DB 0x40, 0x00, 0x20, 0x84, 0x40, 0x00, 0x20, 0x94
+			DB 0x40, 0x00, 0x20, 0x83, 0x60, 0x40, 0x01, 0x40
+			DB 0x22, 0x01, 0x8C, 0x60, 0x41, 0x01, 0x21, 0x0B
+			DB 0x89, 0x40, 0x0E, 0x22, 0x42, 0x89, 0x40, 0x06
+			DB 0x20, 0x44, 0x00, 0x20, 0x8F, 0x43, 0x60, 0x40
+			DB 0x00, 0x20, 0x84, 0x40, 0x00, 0x20, 0x94, 0x40
+			DB 0x00, 0x20, 0x84, 0x40, 0x00, 0x20, 0x94, 0x40
+			DB 0x00, 0x20, 0x84, 0x40, 0x00, 0x20, 0x80, 0x60
+			DB 0x43, 0x8E, 0x40, 0x00, 0x20, 0x43, 0x21, 0x07
+			DB 0x89, 0x60, 0x41, 0x21, 0x0F, 0x20, 0x89, 0x40
+			DB 0x0A, 0x21, 0x01, 0x41, 0x60, 0x8C, 0x40, 0x00
+			DB 0x23, 0x00, 0x20, 0x40, 0x83, 0x40, 0x00, 0x20
+			DB 0x94, 0x40, 0x00, 0x20, 0x84, 0x40, 0x00, 0x20
+			DB 0x94, 0x40, 0x00, 0x20, 0x84, 0x40, 0x00, 0x20
+			DB 0x94, 0x40, 0x00, 0x20, 0x84, 0x60, 0x40, 0x60
+			DB 0x94, 0x60, 0x40, 0x60, 0x96
+; $ dolar
+			DB 0xA5, 0x40, 0x20, 0x01, 0x20, 0x40, 0x60, 0x87
+			DB 0x40, 0x01, 0x40, 0x8B, 0x20, 0x05, 0x20, 0x60
+			DB 0x86, 0x60, 0x01, 0x20, 0x8A, 0x40, 0x07, 0x20
+			DB 0x87, 0x20, 0x01, 0x8A, 0x02, 0x40, 0x80, 0x60
+			DB 0x40, 0x02, 0x40, 0x86, 0x20, 0x01, 0x89, 0x40
+			DB 0x01, 0x60, 0x83, 0x20, 0x01, 0x20, 0x86, 0x40
+			DB 0x01, 0x44, 0x84, 0x40, 0x00, 0x20, 0x84, 0x60
+			DB 0x02, 0x80, 0x60, 0x43, 0x21, 0x05, 0x20, 0x84
+			DB 0x40, 0x00, 0x20, 0x81, 0x60, 0x42, 0x0E, 0x21
+			DB 0x40, 0x81, 0x42, 0x0E, 0x22, 0x40, 0x20, 0x01
+			DB 0x60, 0x85, 0x09, 0x22, 0x02, 0x85, 0x40, 0x01
+			DB 0x86, 0x00, 0x21, 0x01, 0x20, 0x40, 0x60, 0x84
+			DB 0x02, 0x60, 0x84, 0x20, 0x01, 0x89, 0x40, 0x00
+			DB 0x20, 0x86, 0x20, 0x01, 0x20, 0x83, 0x60, 0x01
+			DB 0x20, 0x89, 0x40, 0x01, 0x86, 0x60, 0x02, 0x20
+			DB 0x60, 0x80, 0x60, 0x20, 0x01, 0x60, 0x89, 0x40
+			DB 0x01, 0x60, 0x86, 0x20, 0x07, 0x20, 0x8A, 0x60
+			DB 0x21, 0x60, 0x86, 0x60, 0x20, 0x05, 0x20, 0x60
+			DB 0x97, 0x40, 0x20, 0x01, 0x20, 0x40, 0xC9
+; % percent
+			DB 0x80, 0x40, 0x20, 0x02, 0x20, 0x40, 0x8C, 0x41
+			DB 0x88, 0x40, 0x06, 0x20, 0x89, 0x60, 0x20, 0x01
+			DB 0x40, 0x87, 0x01, 0x20, 0x42, 0x20, 0x01, 0x60
+			DB 0x87, 0x40, 0x02, 0x20, 0x60, 0x87, 0x00, 0x40
+			DB 0x84, 0x40, 0x00, 0x40, 0x85, 0x60, 0x20, 0x02
+			DB 0x40, 0x89, 0x00, 0x40, 0x84, 0x40, 0x00, 0x40
+			DB 0x84, 0x40, 0x02, 0x20, 0x60, 0x8A, 0x00, 0x20
+			DB 0x84, 0x20, 0x00, 0x40, 0x82, 0x60, 0x20, 0x02
+			DB 0x40, 0x8C, 0x02, 0x20, 0x41, 0x20, 0x01, 0x60
+			DB 0x81, 0x40, 0x02, 0x20, 0x60, 0x8D, 0x40, 0x06
+			DB 0x60, 0x80, 0x60, 0x20, 0x02, 0x40, 0x90, 0x60
+			DB 0x40, 0x22, 0x40, 0x60, 0x80, 0x40, 0x02, 0x20
+			DB 0x60, 0x80, 0x60, 0x43, 0x91, 0x60, 0x20, 0x02
+			DB 0x40, 0x81, 0x20, 0x05, 0x40, 0x8E, 0x40, 0x02
+			DB 0x20, 0x60, 0x81, 0x20, 0x01, 0x22, 0x02, 0x60
+			DB 0x8B, 0x60, 0x20, 0x02, 0x40, 0x83, 0x01, 0x60
+			DB 0x82, 0x60, 0x20, 0x00, 0x40, 0x8A, 0x40, 0x02
+			DB 0x20, 0x60, 0x83, 0x40, 0x00, 0x40, 0x84, 0x40
+			DB 0x00, 0x40, 0x88, 0x60, 0x20, 0x02, 0x40, 0x85
+			DB 0x40, 0x00, 0x20, 0x84, 0x40, 0x00, 0x40, 0x87
+			DB 0x40, 0x02, 0x20, 0x60, 0x86, 0x60, 0x01, 0x40
+			DB 0x60, 0x81, 0x40, 0x01, 0x60, 0x87, 0x02, 0x40
+			DB 0x89, 0x20, 0x06, 0x20, 0x88, 0x40, 0x20, 0x60
+			DB 0x8B, 0x20, 0x04, 0x40, 0x9A, 0x60, 0x40, 0x60
+			DB 0x8B
+; & and
+			DB 0x8D, 0x60, 0x40, 0x22, 0x40, 0x60, 0x8C, 0x60
+			DB 0x42, 0x60, 0x85, 0x40, 0x06, 0x40, 0x8A, 0x40
+			DB 0x04, 0x40, 0x83, 0x20, 0x08, 0x40, 0x88, 0x40
+			DB 0x06, 0x20, 0x60, 0x80, 0x20, 0x02, 0x20, 0x42
+			DB 0x20, 0x01, 0x20, 0x88, 0x02, 0x20, 0x40, 0x20
+			DB 0x02, 0x21, 0x01, 0x20, 0x60, 0x84, 0x20, 0x01
+			DB 0x88, 0x01, 0x60, 0x82, 0x40, 0x04, 0x20, 0x86
+			DB 0x60, 0x01, 0x60, 0x87, 0x00, 0x20, 0x84, 0x60
+			DB 0x20, 0x02, 0x60, 0x87, 0x01, 0x60, 0x87, 0x00
+			DB 0x20, 0x84, 0x60, 0x03, 0x20, 0x86, 0x60, 0x01
+			DB 0x88, 0x01, 0x60, 0x82, 0x40, 0x05, 0x40, 0x85
+			DB 0x40, 0x00, 0x20, 0x88, 0x02, 0x41, 0x20, 0x02
+			DB 0x61, 0x02, 0x40, 0x83, 0x60, 0x01, 0x40, 0x88
+			DB 0x20, 0x06, 0x60, 0x81, 0x40, 0x02, 0x40, 0x81
+			DB 0x40, 0x02, 0x89, 0x60, 0x20, 0x03, 0x20, 0x60
+			DB 0x83, 0x40, 0x02, 0x40, 0x20, 0x02, 0x60, 0x8B
+			DB 0x42, 0x60, 0x86, 0x40, 0x05, 0x60, 0x93, 0x22
+			DB 0x06, 0x20, 0x60, 0x93, 0x0B, 0x21, 0x91, 0x01
+			DB 0x21, 0x41, 0x81, 0x40, 0x04, 0x9B, 0x40, 0x20
+			DB 0x01, 0xA8
+; ' quote
+			DB 0xE7, 0x60, 0x40, 0x60, 0x9C, 0x40, 0x00, 0x20
+			DB 0x9C, 0x01, 0x40, 0x94, 0x20, 0x01, 0x60, 0x82
+			DB 0x40, 0x01, 0x95, 0x03, 0x20, 0x40, 0x20, 0x01
+			DB 0x40, 0x95, 0x07, 0x20, 0x96, 0x06, 0x20, 0x60
+			DB 0x96, 0x40, 0x04, 0x40, 0x60, 0x99, 0x60, 0x40
+			DB 0x60, 0xFF, 0xDA
+; ( lparent
+			DB 0xFF, 0x89, 0x60, 0x40, 0x22, 0x02, 0x21, 0x40
+			DB 0x60, 0x91, 0x40, 0x20, 0x0C, 0x40, 0x60, 0x8C
+			DB 0x40, 0x11, 0x40, 0x60, 0x88, 0x60, 0x20, 0x03
+			DB 0x21, 0x40, 0x60, 0x83, 0x60, 0x40, 0x20, 0x05
+			DB 0x40, 0x86, 0x40, 0x03, 0x20, 0x60, 0x8B, 0x60
+			DB 0x20, 0x03, 0x40, 0x84, 0x20, 0x02, 0x20, 0x60
+			DB 0x8F, 0x60, 0x20, 0x02, 0x20, 0x82, 0x20, 0x02
+			DB 0x40, 0x93, 0x40, 0x02, 0x20, 0x60, 0x20, 0x01
+			DB 0x20, 0x60, 0x95, 0x60, 0x20, 0x01, 0x21, 0x00
+			DB 0x20, 0x98, 0x60, 0x20, 0x00, 0x20, 0x80, 0x40
+			DB 0x9A, 0x60, 0x40, 0xFF, 0x80
+; ) rparent
+			DB 0xE0, 0x60, 0x9B, 0x60, 0x80, 0x40, 0x00, 0x20
+			DB 0x99, 0x40, 0x00, 0x40, 0x02, 0x20, 0x97, 0x40
+			DB 0x01, 0x20, 0x60, 0x02, 0x20, 0x60, 0x93, 0x60
+			DB 0x20, 0x02, 0x60, 0x80, 0x60, 0x20, 0x02, 0x40
+			DB 0x91, 0x40, 0x02, 0x20, 0x60, 0x82, 0x60, 0x20
+			DB 0x03, 0x40, 0x8D, 0x40, 0x03, 0x20, 0x60, 0x85
+			DB 0x40, 0x04, 0x20, 0x40, 0x60, 0x85, 0x60, 0x40
+			DB 0x20, 0x04, 0x40, 0x88, 0x40, 0x20, 0x06, 0x23
+			DB 0x06, 0x20, 0x60, 0x8B, 0x40, 0x20, 0x0D, 0x20
+			DB 0x60, 0x8F, 0x60, 0x40, 0x20, 0x06, 0x21, 0x40
+			DB 0x60, 0x96, 0x60, 0x41, 0x60, 0xFF, 0x8D
+; * star
+			DB 0xA3, 0x60, 0x83, 0x60, 0x97, 0x60, 0x21, 0x83
+			DB 0x00, 0x20, 0x60, 0x95, 0x40, 0x01, 0x60, 0x81
+			DB 0x40, 0x01, 0x60, 0x96, 0x20, 0x00, 0x40, 0x81
+			DB 0x01, 0x40, 0x97, 0x60, 0x01, 0x60, 0x40, 0x00
+			DB 0x20, 0x99, 0x40, 0x00, 0x40, 0x20, 0x00, 0x60
+			DB 0x95, 0x44, 0x20, 0x01, 0x45, 0x91, 0x0D, 0x91
+			DB 0x21, 0x42, 0x20, 0x01, 0x20, 0x42, 0x21, 0x95
+			DB 0x60, 0x00, 0x20, 0x01, 0x9A, 0x20, 0x00, 0x60
+			DB 0x40, 0x00, 0x40, 0x98, 0x40, 0x00, 0x20, 0x80
+			DB 0x60, 0x01, 0x60, 0x96, 0x60, 0x01, 0x40, 0x81
+			DB 0x40, 0x00, 0x20, 0x96, 0x40, 0x00, 0x20, 0x82
+			DB 0x60, 0x00, 0x20, 0x60, 0x96, 0x61, 0x83, 0x60
+			DB 0xD5
+; + plus
+			DB 0x8B, 0x60, 0x40, 0x60, 0x9C, 0x20, 0x00, 0x40
+			DB 0x9C, 0x20, 0x00, 0x40, 0x9C, 0x20, 0x00, 0x40
+			DB 0x9C, 0x20, 0x00, 0x40, 0x9C, 0x20, 0x00, 0x40
+			DB 0x9C, 0x20, 0x00, 0x40, 0x95, 0x26, 0x02, 0x25
+			DB 0x60, 0x8E, 0x20, 0x0E, 0x40, 0x8E, 0x20, 0x0E
+			DB 0x40, 0x95, 0x20, 0x00, 0x40, 0x9C, 0x20, 0x00
+			DB 0x40, 0x9C, 0x20, 0x00, 0x40, 0x9C, 0x20, 0x00
+			DB 0x40, 0x9C, 0x20, 0x00, 0x40, 0x9C, 0x20, 0x00
+			DB 0x40, 0x9C, 0x42, 0xB0
+; , comma
+			DB 0xFA, 0x20, 0x40, 0x9C, 0x60, 0x00, 0x20, 0x9C
+			DB 0x20, 0x00, 0x40, 0x94, 0x20, 0x01, 0x40, 0x82
+			DB 0x40, 0x01, 0x60, 0x93, 0x40, 0x03, 0x20, 0x40
+			DB 0x20, 0x01, 0x20, 0x94, 0x40, 0x08, 0x60, 0x94
+			DB 0x60, 0x07, 0x60, 0x96, 0x40, 0x04, 0x20, 0x60
+			DB 0x99, 0x60, 0x40, 0x60, 0xFF, 0xC8
+; - minus
+			DB 0xEB, 0x42, 0x9C, 0x01, 0x20, 0x9C, 0x01, 0x20
+			DB 0x9C, 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x01
+			DB 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C
+			DB 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x42, 0xFF
+			DB 0x90
+; . dot
+			DB 0xFF, 0xB2, 0x60, 0x40, 0x60, 0x9B, 0x40, 0x02
+			DB 0x40, 0x99, 0x60, 0x04, 0x99, 0x40, 0x04, 0x40
+			DB 0x98, 0x60, 0x04, 0x9A, 0x40, 0x02, 0x40, 0x9B
+			DB 0x60, 0x40, 0x60, 0xFF, 0xC9
+; / slash
+			DB 0xB9, 0x60, 0x40, 0x20, 0x60, 0x99, 0x60, 0x40
+			DB 0x02, 0x40, 0x97, 0x60, 0x20, 0x04, 0x40, 0x95
+			DB 0x40, 0x20, 0x04, 0x40, 0x60, 0x93, 0x60, 0x40
+			DB 0x04, 0x20, 0x40, 0x94, 0x60, 0x40, 0x04, 0x20
+			DB 0x40, 0x94, 0x60, 0x20, 0x04, 0x20, 0x60, 0x94
+			DB 0x40, 0x20, 0x04, 0x40, 0x60, 0x93, 0x60, 0x40
+			DB 0x04, 0x20, 0x40, 0x94, 0x60, 0x40, 0x04, 0x20
+			DB 0x40, 0x94, 0x40, 0x20, 0x04, 0x40, 0x60, 0x94
+			DB 0x40, 0x20, 0x04, 0x40, 0x60, 0x94, 0x60, 0x04
+			DB 0x20, 0x40, 0x97, 0x60, 0x02, 0x20, 0x60, 0x9A
+			DB 0x20, 0x40, 0x60, 0xDB
+; 0 0
+			DB 0x89, 0x60, 0x45, 0x95, 0x60, 0x20, 0x08, 0x20
+			DB 0x40, 0x91, 0x40, 0x0C, 0x20, 0x60, 0x8E, 0x40
+			DB 0x03, 0x21, 0x42, 0x21, 0x03, 0x20, 0x8D, 0x60
+			DB 0x02, 0x40, 0x60, 0x86, 0x60, 0x40, 0x02, 0x40
+			DB 0x8C, 0x20, 0x01, 0x60, 0x8A, 0x60, 0x01, 0x20
+			DB 0x8B, 0x60, 0x01, 0x40, 0x8C, 0x40, 0x01, 0x8B
+			DB 0x40, 0x01, 0x8D, 0x60, 0x01, 0x60, 0x8A, 0x40
+			DB 0x00, 0x20, 0x8E, 0x01, 0x40, 0x8A, 0x40, 0x01
+			DB 0x8D, 0x60, 0x01, 0x60, 0x8A, 0x40, 0x01, 0x60
+			DB 0x8C, 0x40, 0x01, 0x8B, 0x60, 0x01, 0x20, 0x8B
+			DB 0x60, 0x01, 0x20, 0x8C, 0x20, 0x01, 0x20, 0x60
+			DB 0x88, 0x40, 0x02, 0x60, 0x8C, 0x60, 0x03, 0x20
+			DB 0x45, 0x20, 0x03, 0x40, 0x8E, 0x60, 0x0D, 0x40
+			DB 0x90, 0x60, 0x20, 0x09, 0x20, 0x60, 0x93, 0x60
+			DB 0x41, 0x23, 0x41, 0x60, 0xAD
+; 1 1
+			DB 0xA7, 0x60, 0x9D, 0x40, 0x00, 0x20, 0x60, 0x88
+			DB 0x42, 0x8E, 0x60, 0x02, 0x60, 0x88, 0x40, 0x01
+			DB 0x8E, 0x20, 0x01, 0x40, 0x89, 0x40, 0x01, 0x8D
+			DB 0x40, 0x01, 0x20, 0x8A, 0x40, 0x01, 0x8D, 0x20
+			DB 0x01, 0x60, 0x8A, 0x40, 0x01, 0x8C, 0x40, 0x01
+			DB 0x40, 0x8B, 0x40, 0x01, 0x8B, 0x60, 0x02, 0x2C
+			DB 0x02, 0x8B, 0x40, 0x12, 0x8B, 0x40, 0x12, 0x8B
+			DB 0x60, 0x4F, 0x20, 0x01, 0x9C, 0x40, 0x01, 0x9C
+			DB 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01
+			DB 0x9C, 0x60, 0x41, 0xA8
+; 2 2
+			DB 0xB3, 0x60, 0x41, 0x8C, 0x60, 0x21, 0x40, 0x8A
+			DB 0x60, 0x02, 0x8C, 0x20, 0x01, 0x60, 0x89, 0x60
+			DB 0x03, 0x8C, 0x01, 0x20, 0x89, 0x60, 0x20, 0x03
+			DB 0x8B, 0x60, 0x01, 0x40, 0x88, 0x60, 0x20, 0x04
+			DB 0x8B, 0x40, 0x01, 0x60, 0x88, 0x20, 0x01, 0x21
+			DB 0x01, 0x8B, 0x40, 0x01, 0x88, 0x20, 0x01, 0x20
+			DB 0x80, 0x20, 0x01, 0x8B, 0x40, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x20, 0x60, 0x80, 0x20, 0x01, 0x8B
+			DB 0x40, 0x01, 0x40, 0x85, 0x20, 0x02, 0x60, 0x81
+			DB 0x20, 0x01, 0x8B, 0x60, 0x02, 0x40, 0x82, 0x60
+			DB 0x20, 0x02, 0x60, 0x82, 0x20, 0x01, 0x8C, 0x20
+			DB 0x03, 0x21, 0x03, 0x60, 0x83, 0x20, 0x01, 0x8C
+			DB 0x60, 0x08, 0x60, 0x84, 0x20, 0x01, 0x8D, 0x60
+			DB 0x20, 0x04, 0x20, 0x60, 0x85, 0x20, 0x01, 0x8F
+			DB 0x60, 0x42, 0x60, 0x87, 0x20, 0x01, 0x9C, 0x60
+			DB 0x41, 0xC8
+; 3 3
+			DB 0xC3, 0x42, 0x8F, 0x40, 0x21, 0x89, 0x20, 0x00
+			DB 0x20, 0x85, 0x41, 0x60, 0x86, 0x20, 0x00, 0x20
+			DB 0x88, 0x60, 0x01, 0x40, 0x85, 0x01, 0x40, 0x86
+			DB 0x40, 0x00, 0x20, 0x88, 0x40, 0x01, 0x86, 0x01
+			DB 0x40, 0x86, 0x40, 0x01, 0x88, 0x40, 0x00, 0x20
+			DB 0x85, 0x60, 0x01, 0x40, 0x86, 0x40, 0x01, 0x88
+			DB 0x40, 0x00, 0x20, 0x85, 0x40, 0x01, 0x40, 0x86
+			DB 0x40, 0x00, 0x20, 0x88, 0x40, 0x01, 0x85, 0x20
+			DB 0x01, 0x40, 0x86, 0x20, 0x00, 0x20, 0x88, 0x40
+			DB 0x01, 0x40, 0x83, 0x60, 0x02, 0x20, 0x85, 0x60
+			DB 0x01, 0x40, 0x88, 0x60, 0x01, 0x20, 0x60, 0x81
+			DB 0x60, 0x20, 0x03, 0x40, 0x84, 0x20, 0x01, 0x60
+			DB 0x89, 0x20, 0x02, 0x21, 0x02, 0x40, 0x02, 0x40
+			DB 0x60, 0x80, 0x60, 0x20, 0x01, 0x20, 0x8A, 0x60
+			DB 0x06, 0x40, 0x80, 0x20, 0x08, 0x60, 0x8B, 0x60
+			DB 0x20, 0x03, 0x40, 0x81, 0x60, 0x20, 0x05, 0x20
+			DB 0x60, 0x8E, 0x60, 0x40, 0x60, 0x85, 0x40, 0x20
+			DB 0x01, 0x20, 0x40, 0xE9
+; 4 4
+			DB 0x8F, 0x60, 0x20, 0x00, 0x20, 0x60, 0x99, 0x40
+			DB 0x03, 0x40, 0x97, 0x40, 0x20, 0x04, 0x40, 0x95
+			DB 0x60, 0x20, 0x02, 0x20, 0x40, 0x01, 0x40, 0x94
+			DB 0x40, 0x03, 0x40, 0x80, 0x40, 0x01, 0x40, 0x92
+			DB 0x60, 0x20, 0x02, 0x20, 0x60, 0x81, 0x40, 0x01
+			DB 0x40, 0x91, 0x40, 0x02, 0x20, 0x40, 0x83, 0x40
+			DB 0x01, 0x40, 0x8F, 0x40, 0x20, 0x02, 0x40, 0x85
+			DB 0x40, 0x01, 0x40, 0x8D, 0x60, 0x20, 0x02, 0x20
+			DB 0x60, 0x86, 0x40, 0x01, 0x40, 0x8D, 0x40, 0x02
+			DB 0x40, 0x88, 0x40, 0x01, 0x40, 0x8D, 0x40, 0x14
+			DB 0x20, 0x88, 0x40, 0x14, 0x20, 0x88, 0x40, 0x14
+			DB 0x20, 0x96, 0x40, 0x01, 0x40, 0x9B, 0x40, 0x01
+			DB 0x40, 0x9B, 0x40, 0x01, 0x40, 0x9B, 0x60, 0x21
+			DB 0x60, 0xAA
+; 5 5
+			DB 0xD6, 0x40, 0x21, 0x88, 0x40, 0x09, 0x20, 0x87
+			DB 0x40, 0x00, 0x20, 0x88, 0x40, 0x09, 0x40, 0x87
+			DB 0x40, 0x01, 0x88, 0x40, 0x02, 0x24, 0x01, 0x40
+			DB 0x87, 0x40, 0x01, 0x88, 0x40, 0x01, 0x40, 0x84
+			DB 0x20, 0x00, 0x40, 0x87, 0x40, 0x01, 0x88, 0x40
+			DB 0x01, 0x40, 0x84, 0x20, 0x00, 0x40, 0x87, 0x40
+			DB 0x00, 0x20, 0x88, 0x40, 0x01, 0x40, 0x84, 0x20
+			DB 0x00, 0x20, 0x87, 0x20, 0x00, 0x20, 0x88, 0x40
+			DB 0x01, 0x40, 0x84, 0x40, 0x01, 0x60, 0x85, 0x60
+			DB 0x01, 0x40, 0x88, 0x40, 0x01, 0x40, 0x84, 0x40
+			DB 0x01, 0x20, 0x84, 0x60, 0x20, 0x01, 0x60, 0x88
+			DB 0x40, 0x01, 0x40, 0x85, 0x02, 0x20, 0x60, 0x81
+			DB 0x40, 0x20, 0x01, 0x40, 0x89, 0x40, 0x01, 0x40
+			DB 0x85, 0x40, 0x08, 0x20, 0x8A, 0x40, 0x01, 0x40
+			DB 0x86, 0x20, 0x06, 0x20, 0x60, 0x8A, 0x60, 0x41
+			DB 0x60, 0x87, 0x40, 0x04, 0x40, 0x9A, 0x60, 0x40
+			DB 0x60, 0xCB
+; 6 6
+			DB 0xA8, 0x42, 0x23, 0x41, 0x60, 0x92, 0x60, 0x20
+			DB 0x0A, 0x20, 0x60, 0x8E, 0x60, 0x20, 0x0E, 0x60
+			DB 0x8C, 0x60, 0x20, 0x03, 0x20, 0x40, 0x20, 0x01
+			DB 0x20, 0x41, 0x20, 0x03, 0x60, 0x8B, 0x20, 0x02
+			DB 0x40, 0x81, 0x40, 0x01, 0x40, 0x83, 0x60, 0x20
+			DB 0x01, 0x20, 0x8A, 0x40, 0x01, 0x20, 0x60, 0x82
+			DB 0x01, 0x40, 0x86, 0x20, 0x01, 0x8A, 0x01, 0x20
+			DB 0x60, 0x82, 0x40, 0x01, 0x87, 0x40, 0x01, 0x89
+			DB 0x60, 0x01, 0x40, 0x83, 0x40, 0x00, 0x20, 0x88
+			DB 0x01, 0x40, 0x88, 0x40, 0x01, 0x84, 0x40, 0x00
+			DB 0x20, 0x87, 0x60, 0x01, 0x60, 0x88, 0x20, 0x00
+			DB 0x20, 0x84, 0x40, 0x01, 0x60, 0x86, 0x40, 0x01
+			DB 0x89, 0x20, 0x00, 0x40, 0x84, 0x60, 0x01, 0x20
+			DB 0x85, 0x60, 0x01, 0x20, 0x89, 0x20, 0x00, 0x40
+			DB 0x85, 0x02, 0x20, 0x60, 0x81, 0x60, 0x40, 0x02
+			DB 0x40, 0x89, 0x20, 0x00, 0x20, 0x85, 0x40, 0x09
+			DB 0x20, 0x94, 0x40, 0x07, 0x40, 0x96, 0x60, 0x21
+			DB 0x01, 0x20, 0x40, 0x60, 0xCB
+; 7 7
+			DB 0xA2, 0x60, 0x42, 0x9B, 0x40, 0x01, 0x40, 0x9B
+			DB 0x40, 0x01, 0x40, 0x9B, 0x40, 0x01, 0x40, 0x90
+			DB 0x60, 0x40, 0x88, 0x40, 0x01, 0x40, 0x8D, 0x60
+			DB 0x21, 0x00, 0x20, 0x88, 0x40, 0x01, 0x40, 0x8A
+			DB 0x60, 0x40, 0x04, 0x20, 0x88, 0x40, 0x01, 0x40
+			DB 0x88, 0x40, 0x20, 0x06, 0x20, 0x88, 0x40, 0x01
+			DB 0x40, 0x85, 0x60, 0x40, 0x06, 0x20, 0x40, 0x60
+			DB 0x89, 0x40, 0x01, 0x40, 0x83, 0x60, 0x20, 0x05
+			DB 0x20, 0x40, 0x60, 0x8C, 0x40, 0x01, 0x40, 0x81
+			DB 0x40, 0x20, 0x05, 0x40, 0x60, 0x8F, 0x40, 0x01
+			DB 0x40, 0x60, 0x20, 0x04, 0x20, 0x40, 0x92, 0x40
+			DB 0x07, 0x20, 0x60, 0x94, 0x40, 0x05, 0x40, 0x60
+			DB 0x96, 0x40, 0x03, 0x40, 0x60, 0x98, 0x60, 0x22
+			DB 0x60, 0xD7
+; 8 8
+			DB 0xA4, 0x60, 0x40, 0x60, 0x86, 0x60, 0x40, 0x21
+			DB 0x40, 0x60, 0x8D, 0x60, 0x20, 0x03, 0x40, 0x83
+			DB 0x60, 0x05, 0x40, 0x8B, 0x60, 0x06, 0x20, 0x81
+			DB 0x60, 0x07, 0x40, 0x89, 0x60, 0x03, 0x20, 0x03
+			DB 0x40, 0x60, 0x02, 0x20, 0x41, 0x20, 0x01, 0x20
+			DB 0x89, 0x40, 0x01, 0x40, 0x81, 0x60, 0x20, 0x02
+			DB 0x20, 0x01, 0x40, 0x83, 0x20, 0x01, 0x60, 0x88
+			DB 0x20, 0x00, 0x20, 0x84, 0x20, 0x03, 0x40, 0x84
+			DB 0x60, 0x01, 0x40, 0x88, 0x01, 0x40, 0x84, 0x60
+			DB 0x02, 0x20, 0x86, 0x20, 0x00, 0x40, 0x88, 0x01
+			DB 0x40, 0x85, 0x20, 0x01, 0x20, 0x86, 0x20, 0x00
+			DB 0x40, 0x88, 0x01, 0x40, 0x84, 0x60, 0x03, 0x60
+			DB 0x85, 0x20, 0x00, 0x40, 0x88, 0x20, 0x00, 0x20
+			DB 0x84, 0x20, 0x03, 0x20, 0x84, 0x60, 0x01, 0x40
+			DB 0x88, 0x20, 0x01, 0x40, 0x81, 0x60, 0x20, 0x01
+			DB 0x20, 0x02, 0x40, 0x83, 0x40, 0x01, 0x60, 0x88
+			DB 0x60, 0x02, 0x21, 0x02, 0x20, 0x80, 0x40, 0x02
+			DB 0x40, 0x60, 0x80, 0x40, 0x01, 0x20, 0x8A, 0x20
+			DB 0x05, 0x20, 0x60, 0x81, 0x20, 0x07, 0x60, 0x8B
+			DB 0x40, 0x03, 0x40, 0x83, 0x60, 0x20, 0x05, 0x40
+			DB 0x8E, 0x61, 0x86, 0x60, 0x40, 0x20, 0x01, 0x20
+			DB 0x60, 0xCA
+; 9 9
+			DB 0xA6, 0x40, 0x21, 0x01, 0x21, 0x60, 0x87, 0x60
+			DB 0x41, 0x8A, 0x60, 0x20, 0x07, 0x40, 0x86, 0x40
+			DB 0x00, 0x20, 0x8A, 0x20, 0x09, 0x40, 0x85, 0x40
+			DB 0x01, 0x89, 0x40, 0x01, 0x20, 0x40, 0x60, 0x80
+			DB 0x60, 0x40, 0x20, 0x02, 0x85, 0x40, 0x01, 0x89
+			DB 0x01, 0x20, 0x60, 0x84, 0x60, 0x20, 0x01, 0x40
+			DB 0x84, 0x40, 0x01, 0x88, 0x60, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x40, 0x84, 0x40, 0x00, 0x20, 0x88
+			DB 0x40, 0x01, 0x88, 0x01, 0x40, 0x84, 0x20, 0x00
+			DB 0x20, 0x88, 0x40, 0x00, 0x20, 0x88, 0x01, 0x40
+			DB 0x83, 0x40, 0x01, 0x40, 0x88, 0x40, 0x01, 0x87
+			DB 0x60, 0x01, 0x60, 0x82, 0x60, 0x20, 0x01, 0x89
+			DB 0x60, 0x01, 0x40, 0x86, 0x20, 0x00, 0x20, 0x82
+			DB 0x60, 0x20, 0x01, 0x40, 0x8A, 0x02, 0x40, 0x84
+			DB 0x40, 0x01, 0x40, 0x80, 0x60, 0x40, 0x02, 0x20
+			DB 0x8B, 0x40, 0x03, 0x20, 0x40, 0x20, 0x02, 0x22
+			DB 0x03, 0x20, 0x60, 0x8C, 0x20, 0x0E, 0x40, 0x8F
+			DB 0x40, 0x0B, 0x20, 0x60, 0x92, 0x60, 0x40, 0x24
+			DB 0x41, 0x60, 0xCD
+; : colon
+			DB 0xFF, 0xC6, 0x60, 0x20, 0x00, 0x20, 0x60, 0x84
+			DB 0x60, 0x20, 0x00, 0x20, 0x60, 0x90, 0x20, 0x02
+			DB 0x20, 0x84, 0x20, 0x02, 0x20, 0x90, 0x04, 0x84
+			DB 0x04, 0x90, 0x20, 0x02, 0x20, 0x84, 0x20, 0x02
+			DB 0x20, 0x90, 0x60, 0x20, 0x00, 0x20, 0x60, 0x84
+			DB 0x60, 0x20, 0x00, 0x20, 0x60, 0xFF, 0xE9
+; ; semicolon
+			DB 0xFA, 0x41, 0x9D, 0x01, 0x60, 0x9B, 0x40, 0x00
+			DB 0x20, 0x89, 0x60, 0x20, 0x00, 0x20, 0x60, 0x85
+			DB 0x60, 0x21, 0x40, 0x82, 0x60, 0x01, 0x40, 0x89
+			DB 0x20, 0x02, 0x20, 0x85, 0x20, 0x02, 0x20, 0x41
+			DB 0x02, 0x60, 0x89, 0x04, 0x85, 0x08, 0x40, 0x8A
+			DB 0x20, 0x02, 0x20, 0x85, 0x20, 0x06, 0x40, 0x8B
+			DB 0x60, 0x20, 0x00, 0x20, 0x60, 0x85, 0x60, 0x20
+			DB 0x03, 0x20, 0x40, 0x99, 0x60, 0x41, 0x60, 0xFF
+			DB 0xC7
+; < less
+			DB 0xAB, 0x60, 0x20, 0x9C, 0x60, 0x20, 0x00, 0x40
+			DB 0x9B, 0x20, 0x02, 0x60, 0x99, 0x40, 0x04, 0x60
+			DB 0x97, 0x60, 0x01, 0x20, 0x40, 0x01, 0x20, 0x96
+			DB 0x60, 0x20, 0x01, 0x60, 0x80, 0x20, 0x01, 0x40
+			DB 0x95, 0x20, 0x01, 0x40, 0x81, 0x60, 0x02, 0x60
+			DB 0x93, 0x40, 0x01, 0x20, 0x83, 0x40, 0x02, 0x60
+			DB 0x91, 0x60, 0x02, 0x60, 0x84, 0x40, 0x01, 0x20
+			DB 0x90, 0x60, 0x02, 0x60, 0x86, 0x20, 0x01, 0x40
+			DB 0x8F, 0x20, 0x01, 0x40, 0x87, 0x60, 0x02, 0x60
+			DB 0x8D, 0x40, 0x01, 0x20, 0x89, 0x40, 0x02, 0x60
+			DB 0x8C, 0x60, 0x01, 0x60, 0x8A, 0x20, 0x00, 0x20
+			DB 0x8E, 0x60, 0x40, 0x8B, 0x60, 0x40, 0xEA
+; = equal
+			DB 0xA8, 0x42, 0x82, 0x41, 0x60, 0x96, 0x40, 0x00
+			DB 0x20, 0x82, 0x01, 0x40, 0x96, 0x40, 0x00, 0x20
+			DB 0x82, 0x01, 0x40, 0x96, 0x40, 0x00, 0x20, 0x82
+			DB 0x01, 0x40, 0x96, 0x40, 0x00, 0x20, 0x82, 0x01
+			DB 0x40, 0x96, 0x40, 0x00, 0x20, 0x82, 0x01, 0x40
+			DB 0x96, 0x40, 0x00, 0x20, 0x82, 0x01, 0x40, 0x96
+			DB 0x40, 0x00, 0x20, 0x82, 0x01, 0x40, 0x96, 0x40
+			DB 0x00, 0x20, 0x82, 0x01, 0x40, 0x96, 0x40, 0x00
+			DB 0x20, 0x82, 0x01, 0x40, 0x96, 0x40, 0x00, 0x20
+			DB 0x82, 0x01, 0x40, 0x96, 0x40, 0x00, 0x20, 0x82
+			DB 0x01, 0x40, 0x96, 0x40, 0x00, 0x20, 0x82, 0x01
+			DB 0x40, 0x96, 0x40, 0x00, 0x20, 0x82, 0x01, 0x40
+			DB 0x96, 0x40, 0x21, 0x82, 0x21, 0x60, 0xCD
+; > greater
+			DB 0xA5, 0x60, 0x8C, 0x60, 0x8F, 0x21, 0x8B, 0x60
+			DB 0x00, 0x60, 0x8D, 0x40, 0x01, 0x40, 0x89, 0x60
+			DB 0x02, 0x60, 0x8C, 0x60, 0x02, 0x40, 0x88, 0x20
+			DB 0x01, 0x20, 0x8E, 0x40, 0x02, 0x60, 0x86, 0x40
+			DB 0x01, 0x20, 0x90, 0x20, 0x01, 0x20, 0x85, 0x60
+			DB 0x02, 0x60, 0x91, 0x20, 0x01, 0x40, 0x84, 0x20
+			DB 0x01, 0x40, 0x92, 0x60, 0x02, 0x60, 0x82, 0x20
+			DB 0x01, 0x20, 0x94, 0x40, 0x01, 0x20, 0x81, 0x40
+			DB 0x01, 0x20, 0x96, 0x20, 0x01, 0x40, 0x60, 0x02
+			DB 0x60, 0x97, 0x20, 0x04, 0x40, 0x98, 0x60, 0x03
+			DB 0x40, 0x9A, 0x40, 0x01, 0x20, 0x9C, 0x40, 0x00
+			DB 0x60, 0x9D, 0x60, 0xD1
+; ? question
+			DB 0xE0, 0x61, 0x9C, 0x20, 0x00, 0x20, 0x9C, 0x20
+			DB 0x00, 0x20, 0x89, 0x60, 0x42, 0x82, 0x41, 0x60
+			DB 0x88, 0x20, 0x01, 0x87, 0x60, 0x20, 0x03, 0x40
+			DB 0x80, 0x20, 0x02, 0x88, 0x40, 0x01, 0x60, 0x85
+			DB 0x60, 0x20, 0x04, 0x40, 0x80, 0x03, 0x40, 0x87
+			DB 0x40, 0x01, 0x40, 0x84, 0x60, 0x20, 0x02, 0x20
+			DB 0x40, 0x20, 0x60, 0x80, 0x20, 0x02, 0x60, 0x88
+			DB 0x02, 0x60, 0x83, 0x20, 0x01, 0x20, 0x60, 0x84
+			DB 0x60, 0x21, 0x40, 0x89, 0x20, 0x01, 0x20, 0x60
+			DB 0x80, 0x60, 0x20, 0x01, 0x20, 0x60, 0x93, 0x60
+			DB 0x07, 0x20, 0x60, 0x95, 0x40, 0x05, 0x20, 0x60
+			DB 0x97, 0x40, 0x03, 0x20, 0x60, 0x9A, 0x60, 0x40
+			DB 0xF8
+; @ arobas
+			DB 0x86, 0x60, 0x21, 0x07, 0x20, 0x40, 0x60, 0x8F
+			DB 0x40, 0x0E, 0x20, 0x60, 0x8B, 0x60, 0x20, 0x02
+			DB 0x20, 0x41, 0x60, 0x83, 0x60, 0x40, 0x20, 0x03
+			DB 0x40, 0x89, 0x60, 0x02, 0x40, 0x60, 0x8B, 0x40
+			DB 0x20, 0x01, 0x40, 0x87, 0x60, 0x01, 0x20, 0x60
+			DB 0x82, 0x60, 0x41, 0x23, 0x40, 0x60, 0x83, 0x20
+			DB 0x01, 0x60, 0x86, 0x20, 0x00, 0x20, 0x83, 0x40
+			DB 0x08, 0x40, 0x83, 0x20, 0x00, 0x40, 0x85, 0x60
+			DB 0x01, 0x60, 0x82, 0x40, 0x02, 0x20, 0x42, 0x20
+			DB 0x02, 0x83, 0x40, 0x00, 0x20, 0x85, 0x40, 0x00
+			DB 0x40, 0x82, 0x60, 0x01, 0x40, 0x85, 0x60, 0x01
+			DB 0x83, 0x60, 0x01, 0x85, 0x20, 0x00, 0x40, 0x82
+			DB 0x40, 0x00, 0x20, 0x84, 0x60, 0x40, 0x01, 0x60
+			DB 0x84, 0x01, 0x85, 0x20, 0x00, 0x40, 0x82, 0x40
+			DB 0x01, 0x41, 0x21, 0x02, 0x20, 0x60, 0x85, 0x01
+			DB 0x85, 0x20, 0x00, 0x40, 0x82, 0x60, 0x09, 0x20
+			DB 0x60, 0x83, 0x40, 0x00, 0x20, 0x85, 0x40, 0x01
+			DB 0x83, 0x01, 0x26, 0x01, 0x20, 0x83, 0x20, 0x00
+			DB 0x40, 0x85, 0x60, 0x01, 0x20, 0x8B, 0x60, 0x01
+			DB 0x8D, 0x40, 0x01, 0x20, 0x60, 0x89, 0x60, 0x00
+			DB 0x20, 0x8E, 0x20, 0x02, 0x20, 0x40, 0x60, 0x83
+			DB 0x60, 0x40, 0x20, 0x01, 0x40, 0x8F, 0x40, 0x0C
+			DB 0x40, 0x92, 0x40, 0x20, 0x06, 0x20, 0x40, 0x60
+			DB 0x96, 0x60, 0x42, 0x60, 0x92
+; A A
+			DB 0x91, 0x60, 0x20, 0x02, 0x97, 0x60, 0x40, 0x05
+			DB 0x94, 0x60, 0x40, 0x20, 0x05, 0x20, 0x40, 0x91
+			DB 0x60, 0x40, 0x20, 0x05, 0x20, 0x40, 0x60, 0x90
+			DB 0x60, 0x40, 0x20, 0x05, 0x20, 0x01, 0x90, 0x60
+			DB 0x40, 0x20, 0x05, 0x20, 0x40, 0x60, 0x40, 0x01
+			DB 0x8E, 0x40, 0x20, 0x05, 0x20, 0x40, 0x60, 0x82
+			DB 0x40, 0x01, 0x8E, 0x40, 0x03, 0x20, 0x40, 0x60
+			DB 0x85, 0x40, 0x01, 0x8E, 0x40, 0x01, 0x20, 0x40
+			DB 0x88, 0x40, 0x01, 0x8E, 0x40, 0x04, 0x20, 0x40
+			DB 0x85, 0x40, 0x01, 0x8E, 0x40, 0x20, 0x06, 0x20
+			DB 0x40, 0x82, 0x40, 0x01, 0x90, 0x60, 0x40, 0x20
+			DB 0x06, 0x20, 0x41, 0x01, 0x93, 0x60, 0x40, 0x20
+			DB 0x08, 0x60, 0x95, 0x60, 0x40, 0x20, 0x06, 0x20
+			DB 0x40, 0x60, 0x95, 0x60, 0x40, 0x20, 0x06, 0x20
+			DB 0x97, 0x60, 0x20, 0x05, 0x9A, 0x60, 0x20, 0x02
+			DB 0x9D, 0x60, 0x20, 0x88
+; B B
+			DB 0xA0, 0x60, 0x53, 0x60, 0x89, 0x40, 0x13, 0x20
+			DB 0x89, 0x40, 0x13, 0x20, 0x89, 0x40, 0x01, 0x25
+			DB 0x02, 0x26, 0x02, 0x89, 0x40, 0x00, 0x20, 0x85
+			DB 0x40, 0x00, 0x20, 0x86, 0x40, 0x01, 0x89, 0x40
+			DB 0x00, 0x20, 0x85, 0x40, 0x00, 0x20, 0x86, 0x40
+			DB 0x01, 0x89, 0x40, 0x00, 0x20, 0x85, 0x40, 0x00
+			DB 0x20, 0x86, 0x40, 0x01, 0x89, 0x40, 0x00, 0x20
+			DB 0x85, 0x20, 0x00, 0x20, 0x86, 0x40, 0x01, 0x89
+			DB 0x40, 0x01, 0x85, 0x20, 0x01, 0x86, 0x40, 0x00
+			DB 0x20, 0x89, 0x40, 0x01, 0x60, 0x83, 0x60, 0x02
+			DB 0x40, 0x85, 0x20, 0x00, 0x20, 0x89, 0x60, 0x01
+			DB 0x20, 0x82, 0x60, 0x20, 0x02, 0x20, 0x84, 0x40
+			DB 0x01, 0x40, 0x8A, 0x20, 0x02, 0x41, 0x02, 0x40
+			DB 0x01, 0x20, 0x60, 0x80, 0x60, 0x40, 0x02, 0x8B
+			DB 0x40, 0x06, 0x40, 0x60, 0x08, 0x40, 0x8C, 0x40
+			DB 0x04, 0x40, 0x81, 0x40, 0x06, 0x40, 0x8E, 0x60
+			DB 0x42, 0x60, 0x83, 0x60, 0x20, 0x02, 0x20, 0x60
+			DB 0xCB
+; C C
+			DB 0xA6, 0x60, 0x40, 0x21, 0x03, 0x21, 0x40, 0x92
+			DB 0x40, 0x20, 0x0B, 0x40, 0x8F, 0x20, 0x0E, 0x20
+			DB 0x8D, 0x20, 0x03, 0x20, 0x46, 0x04, 0x40, 0x8B
+			DB 0x40, 0x02, 0x20, 0x60, 0x88, 0x40, 0x03, 0x60
+			DB 0x8A, 0x20, 0x01, 0x40, 0x8B, 0x60, 0x20, 0x01
+			DB 0x20, 0x89, 0x60, 0x01, 0x20, 0x8D, 0x60, 0x01
+			DB 0x20, 0x89, 0x40, 0x01, 0x60, 0x8E, 0x20, 0x01
+			DB 0x89, 0x20, 0x01, 0x8F, 0x40, 0x01, 0x60, 0x88
+			DB 0x20, 0x00, 0x20, 0x8F, 0x40, 0x01, 0x40, 0x88
+			DB 0x20, 0x00, 0x20, 0x8F, 0x40, 0x01, 0x60, 0x88
+			DB 0x20, 0x00, 0x20, 0x8F, 0x40, 0x01, 0x89, 0x40
+			DB 0x01, 0x8F, 0x20, 0x01, 0x89, 0x40, 0x01, 0x40
+			DB 0x8E, 0x01, 0x20, 0x89, 0x60, 0x21, 0x40, 0x8D
+			DB 0x60, 0x01, 0x40, 0xC8
+; D D
+			DB 0x80, 0x60, 0x54, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x89, 0x40, 0x01, 0x30, 0x01, 0x60, 0x88
+			DB 0x40, 0x00, 0x20, 0x8F, 0x60, 0x01, 0x40, 0x88
+			DB 0x40, 0x00, 0x20, 0x90, 0x01, 0x40, 0x88, 0x40
+			DB 0x00, 0x20, 0x90, 0x01, 0x40, 0x88, 0x40, 0x00
+			DB 0x20, 0x8F, 0x60, 0x01, 0x89, 0x40, 0x01, 0x8F
+			DB 0x40, 0x01, 0x89, 0x40, 0x01, 0x60, 0x8E, 0x20
+			DB 0x00, 0x20, 0x8A, 0x01, 0x20, 0x8D, 0x60, 0x01
+			DB 0x40, 0x8A, 0x20, 0x01, 0x40, 0x8C, 0x20, 0x01
+			DB 0x60, 0x8A, 0x40, 0x02, 0x40, 0x89, 0x60, 0x20
+			DB 0x01, 0x20, 0x8C, 0x20, 0x02, 0x20, 0x41, 0x60
+			DB 0x82, 0x60, 0x40, 0x20, 0x02, 0x20, 0x60, 0x8C
+			DB 0x60, 0x20, 0x0D, 0x20, 0x60, 0x8E, 0x60, 0x20
+			DB 0x0B, 0x40, 0x60, 0x91, 0x60, 0x40, 0x21, 0x03
+			DB 0x21, 0x40, 0x60, 0xAD
+; E E
+			DB 0xC0, 0x60, 0x54, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x89, 0x40, 0x01, 0x26, 0x01, 0x27, 0x01
+			DB 0x89, 0x40, 0x00, 0x20, 0x85, 0x40, 0x01, 0x86
+			DB 0x40, 0x01, 0x89, 0x40, 0x00, 0x20, 0x85, 0x40
+			DB 0x01, 0x86, 0x40, 0x01, 0x89, 0x40, 0x00, 0x20
+			DB 0x85, 0x40, 0x01, 0x86, 0x40, 0x01, 0x89, 0x40
+			DB 0x00, 0x20, 0x85, 0x40, 0x01, 0x86, 0x40, 0x01
+			DB 0x89, 0x40, 0x00, 0x20, 0x85, 0x40, 0x01, 0x86
+			DB 0x40, 0x01, 0x89, 0x40, 0x00, 0x20, 0x85, 0x40
+			DB 0x01, 0x86, 0x40, 0x01, 0x89, 0x40, 0x00, 0x20
+			DB 0x85, 0x40, 0x01, 0x86, 0x40, 0x01, 0x89, 0x40
+			DB 0x00, 0x20, 0x85, 0x40, 0x01, 0x86, 0x40, 0x01
+			DB 0x89, 0x40, 0x21, 0x85, 0x60, 0x41, 0x86, 0x60
+			DB 0x21, 0xE8
+; F F
+			DB 0xC0, 0x60, 0x54, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x89, 0x40, 0x01, 0x26, 0x01, 0x29, 0x89
+			DB 0x40, 0x00, 0x20, 0x86, 0x01, 0x40, 0x92, 0x40
+			DB 0x00, 0x20, 0x86, 0x01, 0x40, 0x92, 0x40, 0x00
+			DB 0x20, 0x86, 0x01, 0x40, 0x92, 0x40, 0x00, 0x20
+			DB 0x86, 0x01, 0x40, 0x92, 0x40, 0x00, 0x20, 0x86
+			DB 0x01, 0x40, 0x92, 0x40, 0x00, 0x20, 0x86, 0x01
+			DB 0x40, 0x92, 0x40, 0x00, 0x20, 0x86, 0x01, 0x40
+			DB 0x92, 0x40, 0x00, 0x20, 0x86, 0x01, 0x40, 0x92
+			DB 0x40, 0x21, 0x86, 0x41, 0x60, 0xF1
+; G G
+			DB 0x86, 0x60, 0x40, 0x21, 0x02, 0x21, 0x40, 0x60
+			DB 0x92, 0x60, 0x20, 0x0A, 0x20, 0x60, 0x8F, 0x40
+			DB 0x0E, 0x40, 0x8D, 0x40, 0x03, 0x20, 0x45, 0x20
+			DB 0x04, 0x40, 0x8B, 0x60, 0x02, 0x20, 0x60, 0x88
+			DB 0x40, 0x03, 0x60, 0x8A, 0x20, 0x01, 0x20, 0x8B
+			DB 0x60, 0x20, 0x01, 0x40, 0x8A, 0x01, 0x20, 0x8D
+			DB 0x40, 0x01, 0x20, 0x89, 0x40, 0x01, 0x60, 0x8E
+			DB 0x20, 0x01, 0x89, 0x40, 0x00, 0x20, 0x8F, 0x40
+			DB 0x01, 0x60, 0x88, 0x20, 0x00, 0x20, 0x8F, 0x40
+			DB 0x01, 0x40, 0x88, 0x20, 0x00, 0x40, 0x8F, 0x40
+			DB 0x01, 0x40, 0x88, 0x20, 0x00, 0x40, 0x8F, 0x40
+			DB 0x01, 0x60, 0x88, 0x20, 0x00, 0x20, 0x8F, 0x20
+			DB 0x01, 0x89, 0x40, 0x01, 0x87, 0x47, 0x01, 0x20
+			DB 0x89, 0x40, 0x01, 0x60, 0x86, 0x09, 0x20, 0x89
+			DB 0x60, 0x01, 0x40, 0x86, 0x09, 0x40, 0x8A, 0x60
+			DB 0x88, 0x49, 0xA9
+; H H
+			DB 0xA0, 0x40, 0x14, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x92, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C
+			DB 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01
+			DB 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40
+			DB 0x01, 0x9C, 0x40, 0x01, 0x93, 0x40, 0x28, 0x01
+			DB 0x29, 0x89, 0x40, 0x14, 0x89, 0x40, 0x14, 0x89
+			DB 0x60, 0x54, 0xA8
+; I I
+			DB 0xC0, 0x40, 0x00, 0x20, 0x8F, 0x40, 0x01, 0x89
+			DB 0x40, 0x00, 0x20, 0x8F, 0x40, 0x01, 0x89, 0x40
+			DB 0x00, 0x20, 0x8F, 0x40, 0x01, 0x89, 0x40, 0x00
+			DB 0x20, 0x8F, 0x40, 0x01, 0x89, 0x40, 0x00, 0x20
+			DB 0x8F, 0x40, 0x01, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x89, 0x40, 0x14, 0x89, 0x40, 0x00, 0x20
+			DB 0x8F, 0x40, 0x01, 0x89, 0x40, 0x00, 0x20, 0x8F
+			DB 0x40, 0x01, 0x89, 0x40, 0x00, 0x20, 0x8F, 0x40
+			DB 0x01, 0x89, 0x40, 0x00, 0x20, 0x8F, 0x40, 0x01
+			DB 0x89, 0x40, 0x00, 0x20, 0x8F, 0x40, 0x01, 0xE8
+; J J
+			DB 0xD4, 0x41, 0x89, 0x40, 0x00, 0x20, 0x8F, 0x20
+			DB 0x01, 0x89, 0x40, 0x00, 0x20, 0x8F, 0x40, 0x01
+			DB 0x89, 0x40, 0x00, 0x20, 0x8F, 0x60, 0x01, 0x60
+			DB 0x88, 0x40, 0x00, 0x20, 0x90, 0x01, 0x40, 0x88
+			DB 0x40, 0x00, 0x20, 0x8F, 0x60, 0x01, 0x60, 0x88
+			DB 0x40, 0x00, 0x20, 0x8F, 0x40, 0x01, 0x89, 0x40
+			DB 0x00, 0x20, 0x8E, 0x60, 0x01, 0x20, 0x89, 0x40
+			DB 0x00, 0x20, 0x8C, 0x60, 0x40, 0x02, 0x40, 0x89
+			DB 0x40, 0x12, 0x20, 0x8A, 0x40, 0x11, 0x20, 0x60
+			DB 0x8A, 0x40, 0x0F, 0x20, 0x40, 0xFF, 0x8B
+; K K
+			DB 0xC0, 0x40, 0x14, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x92, 0x60, 0x01, 0x60, 0x9A, 0x40, 0x03
+			DB 0x40, 0x97, 0x60, 0x20, 0x05, 0x20, 0x60, 0x94
+			DB 0x60, 0x20, 0x02, 0x40, 0x20, 0x03, 0x40, 0x92
+			DB 0x40, 0x03, 0x60, 0x81, 0x40, 0x03, 0x40, 0x90
+			DB 0x40, 0x02, 0x20, 0x60, 0x83, 0x60, 0x20, 0x02
+			DB 0x20, 0x60, 0x8C, 0x60, 0x20, 0x02, 0x20, 0x86
+			DB 0x60, 0x20, 0x03, 0x40, 0x8A, 0x60, 0x03, 0x40
+			DB 0x89, 0x40, 0x03, 0x20, 0x89, 0x40, 0x02, 0x60
+			DB 0x8B, 0x40, 0x03, 0x89, 0x40, 0x00, 0x20, 0x60
+			DB 0x8D, 0x60, 0x20, 0x01, 0x89, 0x40, 0x20, 0x91
+			DB 0x20, 0x00, 0x89, 0x60, 0x93, 0x40, 0xA8
+; L L
+			DB 0xE0, 0x40, 0x14, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C
+			DB 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01
+			DB 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40
+			DB 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x60, 0x21, 0xC8
+; M M
+			DB 0x84, 0x60, 0x46, 0x23, 0x05, 0x89, 0x40, 0x14
+			DB 0x89, 0x40, 0x0D, 0x24, 0x41, 0x89, 0x40, 0x02
+			DB 0x20, 0x44, 0x60, 0x94, 0x40, 0x04, 0x20, 0x40
+			DB 0x60, 0x97, 0x60, 0x20, 0x05, 0x20, 0x40, 0x60
+			DB 0x97, 0x60, 0x20, 0x05, 0x20, 0x40, 0x60, 0x97
+			DB 0x60, 0x20, 0x05, 0x20, 0x60, 0x98, 0x60, 0x40
+			DB 0x03, 0x40, 0x96, 0x60, 0x21, 0x04, 0x60, 0x93
+			DB 0x40, 0x20, 0x05, 0x20, 0x40, 0x60, 0x90, 0x60
+			DB 0x40, 0x20, 0x05, 0x20, 0x40, 0x93, 0x40, 0x04
+			DB 0x21, 0x60, 0x96, 0x40, 0x02, 0x20, 0x43, 0x60
+			DB 0x95, 0x40, 0x0C, 0x24, 0x42, 0x89, 0x40, 0x14
+			DB 0x8B, 0x60, 0x45, 0x23, 0x08, 0x9A, 0x44, 0x88
+; N N
+			DB 0xA0, 0x40, 0x34, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x03, 0x22, 0x0D, 0x89, 0x40, 0x03, 0x20, 0x40
+			DB 0x98, 0x60, 0x40, 0x04, 0x20, 0x40, 0x98, 0x60
+			DB 0x40, 0x05, 0x40, 0x98, 0x60, 0x40, 0x05, 0x40
+			DB 0x98, 0x60, 0x40, 0x05, 0x40, 0x99, 0x40, 0x05
+			DB 0x40, 0x99, 0x40, 0x05, 0x40, 0x99, 0x40, 0x05
+			DB 0x40, 0x99, 0x40, 0x20, 0x04, 0x89, 0x40, 0x2D
+			DB 0x41, 0x20, 0x03, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0xC8
+; O O
+			DB 0x85, 0x60, 0x40, 0x20, 0x06, 0x21, 0x60, 0x91
+			DB 0x40, 0x0C, 0x20, 0x60, 0x8D, 0x60, 0x20, 0x0F
+			DB 0x60, 0x8B, 0x60, 0x20, 0x02, 0x20, 0x41, 0x83
+			DB 0x60, 0x41, 0x04, 0x60, 0x8A, 0x40, 0x01, 0x20
+			DB 0x40, 0x8A, 0x40, 0x02, 0x40, 0x89, 0x60, 0x02
+			DB 0x60, 0x8C, 0x40, 0x01, 0x20, 0x89, 0x40, 0x01
+			DB 0x40, 0x8E, 0x20, 0x01, 0x89, 0x20, 0x01, 0x8F
+			DB 0x40, 0x01, 0x40, 0x88, 0x20, 0x00, 0x20, 0x8F
+			DB 0x40, 0x01, 0x40, 0x88, 0x20, 0x01, 0x8F, 0x40
+			DB 0x01, 0x60, 0x88, 0x40, 0x01, 0x60, 0x8E, 0x20
+			DB 0x01, 0x89, 0x40, 0x01, 0x20, 0x8D, 0x40, 0x01
+			DB 0x20, 0x8A, 0x02, 0x20, 0x60, 0x89, 0x60, 0x40
+			DB 0x02, 0x60, 0x8A, 0x40, 0x03, 0x20, 0x41, 0x83
+			DB 0x60, 0x40, 0x20, 0x03, 0x40, 0x8C, 0x20, 0x0F
+			DB 0x40, 0x8E, 0x40, 0x0C, 0x20, 0x40, 0x91, 0x40
+			DB 0x20, 0x07, 0x20, 0x40, 0x97, 0x60, 0x41, 0x60
+			DB 0x91
+; P P
+			DB 0xC0, 0x40, 0x14, 0x89, 0x20, 0x14, 0x89, 0x20
+			DB 0x14, 0x89, 0x20, 0x00, 0x40, 0x87, 0x40, 0x01
+			DB 0x91, 0x20, 0x00, 0x40, 0x87, 0x40, 0x01, 0x91
+			DB 0x20, 0x00, 0x40, 0x87, 0x40, 0x01, 0x91, 0x20
+			DB 0x00, 0x20, 0x87, 0x40, 0x01, 0x91, 0x40, 0x00
+			DB 0x20, 0x87, 0x20, 0x00, 0x20, 0x91, 0x40, 0x01
+			DB 0x60, 0x86, 0x01, 0x20, 0x91, 0x60, 0x01, 0x20
+			DB 0x85, 0x40, 0x01, 0x40, 0x92, 0x20, 0x01, 0x20
+			DB 0x60, 0x81, 0x60, 0x20, 0x01, 0x20, 0x93, 0x40
+			DB 0x09, 0x60, 0x94, 0x40, 0x07, 0x60, 0x96, 0x60
+			DB 0x20, 0x02, 0x20, 0x40, 0x60, 0xD3
+; Q Q
+			DB 0x85, 0x60, 0x40, 0x20, 0x06, 0x21, 0x60, 0x90
+			DB 0x60, 0x40, 0x0C, 0x20, 0x60, 0x8D, 0x60, 0x20
+			DB 0x0F, 0x60, 0x8B, 0x60, 0x20, 0x02, 0x20, 0x41
+			DB 0x83, 0x60, 0x41, 0x04, 0x60, 0x8A, 0x20, 0x01
+			DB 0x20, 0x40, 0x8A, 0x40, 0x02, 0x40, 0x89, 0x60
+			DB 0x02, 0x60, 0x8C, 0x40, 0x01, 0x20, 0x89, 0x40
+			DB 0x01, 0x40, 0x8E, 0x20, 0x01, 0x89, 0x20, 0x01
+			DB 0x8F, 0x40, 0x01, 0x60, 0x88, 0x20, 0x00, 0x20
+			DB 0x8F, 0x40, 0x01, 0x40, 0x88, 0x20, 0x01, 0x8F
+			DB 0x40, 0x01, 0x40, 0x88, 0x40, 0x01, 0x60, 0x8E
+			DB 0x20, 0x01, 0x40, 0x88, 0x40, 0x01, 0x20, 0x8D
+			DB 0x40, 0x02, 0x20, 0x89, 0x02, 0x20, 0x60, 0x89
+			DB 0x60, 0x20, 0x04, 0x60, 0x88, 0x40, 0x03, 0x20
+			DB 0x41, 0x83, 0x60, 0x40, 0x20, 0x03, 0x40, 0x01
+			DB 0x40, 0x89, 0x20, 0x0F, 0x61, 0x01, 0x20, 0x8A
+			DB 0x40, 0x0C, 0x20, 0x60, 0x81, 0x20, 0x01, 0x8C
+			DB 0x40, 0x20, 0x06, 0x21, 0x60, 0x83, 0x40, 0x01
+			DB 0x90, 0x60, 0x41, 0x60, 0x87, 0x40, 0x01, 0x86
+; R R
+			DB 0xA0, 0x60, 0x54, 0x89, 0x40, 0x14, 0x89, 0x40
+			DB 0x14, 0x89, 0x20, 0x01, 0x26, 0x01, 0x29, 0x89
+			DB 0x20, 0x00, 0x40, 0x86, 0x01, 0x40, 0x92, 0x20
+			DB 0x00, 0x40, 0x86, 0x02, 0x40, 0x91, 0x20, 0x00
+			DB 0x40, 0x86, 0x03, 0x40, 0x90, 0x20, 0x00, 0x20
+			DB 0x86, 0x04, 0x20, 0x60, 0x8E, 0x40, 0x00, 0x20
+			DB 0x85, 0x40, 0x00, 0x20, 0x40, 0x03, 0x40, 0x8D
+			DB 0x40, 0x01, 0x60, 0x84, 0x20, 0x00, 0x20, 0x80
+			DB 0x60, 0x03, 0x40, 0x8C, 0x60, 0x01, 0x20, 0x83
+			DB 0x40, 0x01, 0x40, 0x81, 0x60, 0x20, 0x02, 0x20
+			DB 0x60, 0x8B, 0x03, 0x41, 0x20, 0x01, 0x20, 0x84
+			DB 0x20, 0x03, 0x40, 0x8A, 0x40, 0x07, 0x60, 0x85
+			DB 0x40, 0x03, 0x8B, 0x40, 0x04, 0x20, 0x60, 0x87
+			DB 0x60, 0x20, 0x01, 0x8C, 0x60, 0x42, 0x60, 0x8A
+			DB 0x60, 0x20, 0x00, 0x9E, 0x40, 0xA8
+; S S
+			DB 0xB4, 0x61, 0x8C, 0x40, 0x20, 0x01, 0x20, 0x40
+			DB 0x88, 0x60, 0x01, 0x20, 0x8B, 0x20, 0x05, 0x20
+			DB 0x60, 0x87, 0x20, 0x01, 0x8A, 0x40, 0x07, 0x20
+			DB 0x87, 0x40, 0x01, 0x8A, 0x02, 0x40, 0x80, 0x60
+			DB 0x20, 0x02, 0x40, 0x86, 0x60, 0x01, 0x60, 0x88
+			DB 0x40, 0x01, 0x40, 0x83, 0x20, 0x01, 0x20, 0x87
+			DB 0x01, 0x40, 0x88, 0x40, 0x00, 0x20, 0x84, 0x60
+			DB 0x02, 0x40, 0x86, 0x01, 0x40, 0x88, 0x20, 0x00
+			DB 0x20, 0x85, 0x20, 0x01, 0x20, 0x85, 0x60, 0x01
+			DB 0x89, 0x20, 0x00, 0x40, 0x85, 0x40, 0x02, 0x60
+			DB 0x84, 0x40, 0x01, 0x89, 0x20, 0x00, 0x40, 0x86
+			DB 0x02, 0x20, 0x84, 0x20, 0x00, 0x20, 0x89, 0x20
+			DB 0x00, 0x20, 0x86, 0x40, 0x02, 0x40, 0x82, 0x40
+			DB 0x01, 0x40, 0x89, 0x40, 0x00, 0x20, 0x87, 0x04
+			DB 0x20, 0x03, 0x60, 0x89, 0x40, 0x01, 0x87, 0x60
+			DB 0x07, 0x40, 0x96, 0x60, 0x05, 0x40, 0x99, 0x43
+			DB 0xCC
+; T T
+			DB 0x80, 0x42, 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x40
+			DB 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x40
+			DB 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x40
+			DB 0x00, 0x20, 0x9C, 0x40, 0x14, 0x89, 0x40, 0x14
+			DB 0x89, 0x40, 0x14, 0x89, 0x40, 0x00, 0x20, 0x9C
+			DB 0x40, 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20, 0x9C
+			DB 0x40, 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20, 0x9C
+			DB 0x40, 0x00, 0x20, 0x9C, 0x42, 0xBB
+; U U
+			DB 0x80, 0x60, 0x4E, 0x60, 0x8E, 0x40, 0x10, 0x20
+			DB 0x60, 0x8B, 0x40, 0x12, 0x40, 0x8A, 0x40, 0x2E
+			DB 0x04, 0x60, 0x9A, 0x60, 0x20, 0x01, 0x20, 0x9B
+			DB 0x60, 0x20, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x60
+			DB 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9B, 0x60, 0x01
+			DB 0x9C, 0x40, 0x01, 0x9C, 0x20, 0x00, 0x20, 0x9A
+			DB 0x60, 0x20, 0x01, 0x40, 0x89, 0x4F, 0x20, 0x02
+			DB 0x20, 0x8A, 0x40, 0x11, 0x20, 0x60, 0x8A, 0x40
+			DB 0x10, 0x40, 0x8C, 0x4F, 0x60, 0xAD
+; V V
+			DB 0x80, 0x40, 0x00, 0x20, 0x40, 0x60, 0x9A, 0x40
+			DB 0x03, 0x20, 0x40, 0x60, 0x97, 0x40, 0x06, 0x20
+			DB 0x40, 0x60, 0x95, 0x60, 0x40, 0x20, 0x06, 0x20
+			DB 0x40, 0x60, 0x95, 0x60, 0x40, 0x20, 0x06, 0x20
+			DB 0x40, 0x60, 0x95, 0x60, 0x40, 0x20, 0x06, 0x20
+			DB 0x40, 0x60, 0x96, 0x40, 0x20, 0x06, 0x20, 0x40
+			DB 0x97, 0x40, 0x20, 0x05, 0x9A, 0x60, 0x20, 0x02
+			DB 0x98, 0x40, 0x20, 0x04, 0x95, 0x40, 0x20, 0x06
+			DB 0x20, 0x92, 0x40, 0x20, 0x06, 0x20, 0x60, 0x91
+			DB 0x40, 0x20, 0x06, 0x20, 0x60, 0x91, 0x40, 0x20
+			DB 0x06, 0x20, 0x40, 0x91, 0x60, 0x20, 0x06, 0x20
+			DB 0x40, 0x94, 0x40, 0x04, 0x20, 0x40, 0x97, 0x40
+			DB 0x01, 0x20, 0x40, 0x60, 0x99, 0x41, 0x60, 0x9B
+; W W
+			DB 0x80, 0x40, 0x04, 0x23, 0x45, 0x60, 0x8E, 0x40
+			DB 0x12, 0x21, 0x89, 0x40, 0x22, 0x11, 0x91, 0x60
+			DB 0x48, 0x20, 0x02, 0x97, 0x60, 0x40, 0x20, 0x04
+			DB 0x94, 0x40, 0x20, 0x05, 0x20, 0x40, 0x60, 0x90
+			DB 0x60, 0x40, 0x20, 0x05, 0x20, 0x40, 0x93, 0x20
+			DB 0x04, 0x21, 0x60, 0x96, 0x20, 0x02, 0x20, 0x40
+			DB 0x99, 0x20, 0x05, 0x20, 0x40, 0x97, 0x60, 0x40
+			DB 0x20, 0x05, 0x20, 0x40, 0x97, 0x60, 0x40, 0x20
+			DB 0x05, 0x20, 0x40, 0x60, 0x96, 0x60, 0x40, 0x20
+			DB 0x05, 0x95, 0x60, 0x44, 0x20, 0x02, 0x89, 0x42
+			DB 0x24, 0x0D, 0x89, 0x40, 0x14, 0x89, 0x40, 0x04
+			DB 0x23, 0x46, 0x60, 0x8D, 0x60, 0x40, 0x60, 0x9B
+; X X
+			DB 0x80, 0x41, 0x91, 0x40, 0x00, 0x89, 0x40, 0x00
+			DB 0x20, 0x60, 0x8D, 0x60, 0x20, 0x01, 0x89, 0x40
+			DB 0x02, 0x40, 0x8B, 0x40, 0x03, 0x89, 0x40, 0x03
+			DB 0x20, 0x60, 0x87, 0x60, 0x20, 0x03, 0x40, 0x8A
+			DB 0x60, 0x20, 0x03, 0x40, 0x84, 0x60, 0x20, 0x03
+			DB 0x20, 0x60, 0x8D, 0x40, 0x03, 0x20, 0x40, 0x81
+			DB 0x40, 0x03, 0x20, 0x40, 0x90, 0x60, 0x20, 0x03
+			DB 0x21, 0x03, 0x40, 0x94, 0x40, 0x20, 0x05, 0x20
+			DB 0x60, 0x97, 0x20, 0x03, 0x40, 0x97, 0x60, 0x20
+			DB 0x05, 0x20, 0x60, 0x93, 0x60, 0x40, 0x03, 0x21
+			DB 0x03, 0x40, 0x91, 0x40, 0x03, 0x20, 0x40, 0x81
+			DB 0x40, 0x04, 0x40, 0x8D, 0x60, 0x20, 0x03, 0x40
+			DB 0x84, 0x60, 0x20, 0x03, 0x20, 0x60, 0x8A, 0x40
+			DB 0x03, 0x20, 0x60, 0x87, 0x40, 0x04, 0x40, 0x89
+			DB 0x40, 0x02, 0x40, 0x8A, 0x60, 0x20, 0x03, 0x89
+			DB 0x40, 0x00, 0x40, 0x60, 0x8D, 0x40, 0x02, 0x89
+			DB 0x40, 0x60, 0x90, 0x60, 0x40, 0x00, 0x9E, 0x60
+			DB 0x88
+; Y Y
+			DB 0x80, 0x40, 0x00, 0x40, 0x60, 0x9B, 0x40, 0x02
+			DB 0x40, 0x9A, 0x40, 0x04, 0x40, 0x99, 0x60, 0x20
+			DB 0x03, 0x20, 0x60, 0x99, 0x40, 0x20, 0x03, 0x20
+			DB 0x60, 0x99, 0x40, 0x04, 0x40, 0x60, 0x99, 0x40
+			DB 0x04, 0x40, 0x99, 0x60, 0x40, 0x0B, 0x93, 0x60
+			DB 0x20, 0x09, 0x92, 0x40, 0x0B, 0x90, 0x40, 0x04
+			DB 0x40, 0x96, 0x40, 0x20, 0x03, 0x40, 0x60, 0x95
+			DB 0x60, 0x20, 0x03, 0x20, 0x60, 0x95, 0x60, 0x40
+			DB 0x03, 0x20, 0x40, 0x96, 0x40, 0x04, 0x40, 0x98
+			DB 0x40, 0x02, 0x40, 0x60, 0x99, 0x40, 0x00, 0x20
+			DB 0x60, 0x9B, 0x41, 0x9C
+; Z Z
+			DB 0xA0, 0x40, 0x21, 0x8E, 0x60, 0x20, 0x01, 0x89
+			DB 0x40, 0x01, 0x8D, 0x40, 0x03, 0x89, 0x40, 0x01
+			DB 0x8B, 0x60, 0x20, 0x04, 0x89, 0x40, 0x01, 0x8A
+			DB 0x40, 0x06, 0x89, 0x40, 0x01, 0x88, 0x60, 0x20
+			DB 0x02, 0x20, 0x60, 0x20, 0x01, 0x89, 0x40, 0x01
+			DB 0x87, 0x40, 0x03, 0x40, 0x81, 0x20, 0x01, 0x89
+			DB 0x40, 0x01, 0x85, 0x60, 0x20, 0x02, 0x20, 0x60
+			DB 0x82, 0x20, 0x01, 0x89, 0x40, 0x01, 0x84, 0x40
+			DB 0x03, 0x40, 0x84, 0x20, 0x01, 0x89, 0x40, 0x01
+			DB 0x82, 0x60, 0x20, 0x02, 0x20, 0x60, 0x85, 0x20
+			DB 0x01, 0x89, 0x40, 0x01, 0x81, 0x40, 0x03, 0x20
+			DB 0x60, 0x86, 0x20, 0x01, 0x89, 0x40, 0x01, 0x60
+			DB 0x20, 0x03, 0x40, 0x88, 0x20, 0x01, 0x89, 0x40
+			DB 0x05, 0x20, 0x60, 0x89, 0x20, 0x01, 0x89, 0x40
+			DB 0x04, 0x40, 0x8B, 0x20, 0x01, 0x89, 0x40, 0x02
+			DB 0x20, 0x60, 0x8C, 0x20, 0x01, 0x89, 0x40, 0x21
+			DB 0x40, 0x8E, 0x20, 0x01, 0xC8
+; [ lsqbracket
+			DB 0xFF, 0x60, 0x5D, 0x60, 0x20, 0x1D, 0x40, 0x20
+			DB 0x1D, 0x40, 0x20, 0x00, 0x20, 0x59, 0x01, 0x40
+			DB 0x20, 0x00, 0x40, 0x99, 0x01, 0x40, 0x20, 0x00
+			DB 0x40, 0x99, 0x01, 0x40, 0x20, 0x00, 0x40, 0x99
+			DB 0x01, 0x40, 0x20, 0x00, 0x40, 0x99, 0x01, 0x40
+			DB 0x20, 0x00, 0x40, 0x99, 0x01, 0x40, 0xFF, 0x9F
+; \ backslash
+			DB 0x9F, 0x20, 0x40, 0x60, 0x9C, 0x02, 0x20, 0x60
+			DB 0x9A, 0x04, 0x20, 0x40, 0x99, 0x40, 0x20, 0x04
+			DB 0x40, 0x60, 0x98, 0x40, 0x20, 0x04, 0x40, 0x60
+			DB 0x98, 0x60, 0x20, 0x04, 0x20, 0x40, 0x98, 0x60
+			DB 0x40, 0x04, 0x20, 0x40, 0x99, 0x40, 0x20, 0x04
+			DB 0x40, 0x60, 0x98, 0x60, 0x20, 0x04, 0x20, 0x60
+			DB 0x98, 0x60, 0x40, 0x04, 0x20, 0x40, 0x98, 0x60
+			DB 0x40, 0x04, 0x20, 0x40, 0x99, 0x40, 0x20, 0x04
+			DB 0x40, 0x60, 0x98, 0x60, 0x20, 0x04, 0x40, 0x99
+			DB 0x60, 0x40, 0x02, 0x40, 0x9B, 0x60, 0x40, 0x20
+			DB 0x60, 0xC2
+; ] rsqbracket
+			DB 0xFF, 0x20, 0x00, 0x40, 0x99, 0x01, 0x40, 0x20
+			DB 0x00, 0x40, 0x99, 0x01, 0x40, 0x20, 0x00, 0x40
+			DB 0x99, 0x01, 0x40, 0x20, 0x00, 0x40, 0x99, 0x01
+			DB 0x40, 0x20, 0x00, 0x40, 0x99, 0x01, 0x40, 0x20
+			DB 0x00, 0x20, 0x59, 0x01, 0x40, 0x20, 0x1D, 0x40
+			DB 0x20, 0x1D, 0x40, 0x60, 0x5D, 0x60, 0xFF, 0x9F
+; ^ caret
+			DB 0xA9, 0x60, 0x9D, 0x40, 0x00, 0x40, 0x9A, 0x60
+			DB 0x20, 0x01, 0x20, 0x98, 0x60, 0x20, 0x02, 0x20
+			DB 0x60, 0x97, 0x40, 0x02, 0x20, 0x60, 0x97, 0x40
+			DB 0x20, 0x02, 0x40, 0x98, 0x40, 0x02, 0x40, 0x9A
+			DB 0x40, 0x01, 0x60, 0x9B, 0x40, 0x02, 0x40, 0x9B
+			DB 0x40, 0x03, 0x40, 0x9A, 0x60, 0x40, 0x02, 0x20
+			DB 0x60, 0x9A, 0x60, 0x20, 0x02, 0x40, 0x60, 0x9A
+			DB 0x40, 0x02, 0x20, 0x9B, 0x60, 0x20, 0x00, 0x40
+			DB 0x9D, 0x40, 0xD4
+; _ underline
+			DB 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01
+			DB 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C
+			DB 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40
+			DB 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01
+			DB 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C
+			DB 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40
+			DB 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40
+; ` backquote
+			DB 0xDF, 0x61, 0x9D, 0x00, 0x20, 0x9D, 0x01, 0x40
+			DB 0x9C, 0x20, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x20
+			DB 0x9C, 0x40, 0x01, 0x40, 0x9C, 0x40, 0x00, 0x20
+			DB 0x9D, 0x40, 0x60, 0xFF, 0xFA
+; a a
+			DB 0xB0, 0x40, 0x21, 0x40, 0x60, 0x90, 0x60, 0x20
+			DB 0x40, 0x60, 0x84, 0x20, 0x04, 0x60, 0x8F, 0x40
+			DB 0x01, 0x60, 0x83, 0x20, 0x05, 0x20, 0x8F, 0x20
+			DB 0x00, 0x20, 0x83, 0x60, 0x01, 0x20, 0x41, 0x02
+			DB 0x8F, 0x01, 0x40, 0x83, 0x40, 0x00, 0x20, 0x82
+			DB 0x40, 0x01, 0x60, 0x8E, 0x01, 0x60, 0x83, 0x20
+			DB 0x00, 0x40, 0x82, 0x60, 0x01, 0x60, 0x8D, 0x60
+			DB 0x01, 0x84, 0x01, 0x60, 0x82, 0x60, 0x01, 0x8E
+			DB 0x40, 0x01, 0x84, 0x01, 0x83, 0x40, 0x00, 0x20
+			DB 0x8E, 0x60, 0x01, 0x40, 0x82, 0x60, 0x00, 0x20
+			DB 0x83, 0x20, 0x00, 0x40, 0x8F, 0x01, 0x20, 0x82
+			DB 0x40, 0x00, 0x20, 0x81, 0x60, 0x20, 0x00, 0x20
+			DB 0x90, 0x20, 0x01, 0x20, 0x42, 0x00, 0x20, 0x41
+			DB 0x01, 0x20, 0x91, 0x40, 0x0E, 0x90, 0x40, 0x0D
+			DB 0x91, 0x60, 0x40, 0x2B, 0xE8
+; b b
+			DB 0xBF, 0x15, 0x20, 0x88, 0x16, 0x88, 0x08, 0x20
+			DB 0x0C, 0x90, 0x60, 0x20, 0x01, 0x41, 0x85, 0x40
+			DB 0x01, 0x60, 0x8E, 0x60, 0x01, 0x20, 0x60, 0x87
+			DB 0x60, 0x01, 0x40, 0x8E, 0x20, 0x00, 0x20, 0x8A
+			DB 0x01, 0x40, 0x8E, 0x01, 0x60, 0x8A, 0x01, 0x40
+			DB 0x8D, 0x60, 0x01, 0x8A, 0x40, 0x01, 0x8E, 0x60
+			DB 0x01, 0x40, 0x89, 0x20, 0x00, 0x20, 0x8F, 0x01
+			DB 0x20, 0x88, 0x40, 0x01, 0x40, 0x8F, 0x20, 0x01
+			DB 0x20, 0x40, 0x84, 0x60, 0x20, 0x01, 0x20, 0x90
+			DB 0x40, 0x04, 0x22, 0x04, 0x60, 0x91, 0x40, 0x09
+			DB 0x20, 0x60, 0x93, 0x60, 0x20, 0x05, 0x20, 0x40
+			DB 0x99, 0x41, 0x60, 0xAF
+; c c
+			DB 0xAD, 0x60, 0x41, 0x60, 0x97, 0x60, 0x40, 0x20
+			DB 0x04, 0x20, 0x40, 0x60, 0x93, 0x60, 0x09, 0x20
+			DB 0x60, 0x91, 0x60, 0x04, 0x21, 0x04, 0x20, 0x91
+			DB 0x02, 0x20, 0x40, 0x83, 0x60, 0x20, 0x02, 0x40
+			DB 0x8F, 0x40, 0x01, 0x20, 0x87, 0x40, 0x01, 0x20
+			DB 0x8F, 0x20, 0x00, 0x20, 0x89, 0x20, 0x01, 0x8F
+			DB 0x01, 0x40, 0x89, 0x40, 0x01, 0x60, 0x8D, 0x60
+			DB 0x01, 0x60, 0x89, 0x60, 0x01, 0x40, 0x8D, 0x40
+			DB 0x01, 0x8B, 0x01, 0x60, 0x8D, 0x60, 0x01, 0x60
+			DB 0x89, 0x60, 0x01, 0x8F, 0x01, 0x40, 0x89, 0x40
+			DB 0x01, 0x8F, 0x01, 0x20, 0x89, 0x20, 0x00, 0x20
+			DB 0x8F, 0x20, 0x00, 0x20, 0x89, 0x20, 0x00, 0x20
+			DB 0x8F, 0x60, 0x8C, 0x61, 0xC8
+; d d
+			DB 0xAA, 0x60, 0x40, 0x20, 0x02, 0x21, 0x40, 0x94
+			DB 0x60, 0x20, 0x08, 0x20, 0x60, 0x91, 0x60, 0x20
+			DB 0x0B, 0x60, 0x90, 0x20, 0x02, 0x40, 0x60, 0x82
+			DB 0x60, 0x40, 0x02, 0x20, 0x8F, 0x40, 0x01, 0x20
+			DB 0x87, 0x60, 0x02, 0x8F, 0x20, 0x00, 0x20, 0x89
+			DB 0x40, 0x01, 0x60, 0x8E, 0x01, 0x40, 0x89, 0x60
+			DB 0x01, 0x40, 0x8D, 0x60, 0x01, 0x60, 0x89, 0x60
+			DB 0x01, 0x8E, 0x40, 0x01, 0x8A, 0x40, 0x00, 0x20
+			DB 0x8E, 0x40, 0x01, 0x89, 0x40, 0x01, 0x60, 0x8E
+			DB 0x60, 0x01, 0x40, 0x86, 0x40, 0x20, 0x01, 0x40
+			DB 0x89, 0x26, 0x01, 0x26, 0x02, 0x21, 0x41, 0x88
+			DB 0x16, 0x88, 0x16, 0x88, 0x56, 0xC8
+; e e
+			DB 0xAA, 0x60, 0x40, 0x23, 0x40, 0x60, 0x95, 0x60
+			DB 0x20, 0x07, 0x20, 0x60, 0x92, 0x60, 0x0B, 0x40
+			DB 0x90, 0x60, 0x20, 0x01, 0x20, 0x40, 0x01, 0x42
+			DB 0x03, 0x60, 0x8F, 0x40, 0x01, 0x40, 0x81, 0x01
+			DB 0x83, 0x20, 0x01, 0x40, 0x8F, 0x01, 0x40, 0x82
+			DB 0x01, 0x84, 0x20, 0x01, 0x8E, 0x60, 0x01, 0x60
+			DB 0x82, 0x01, 0x84, 0x40, 0x01, 0x8E, 0x40, 0x01
+			DB 0x83, 0x01, 0x84, 0x60, 0x01, 0x60, 0x8D, 0x40
+			DB 0x01, 0x60, 0x82, 0x01, 0x85, 0x01, 0x40, 0x8D
+			DB 0x60, 0x01, 0x40, 0x82, 0x01, 0x85, 0x01, 0x60
+			DB 0x8E, 0x20, 0x01, 0x60, 0x81, 0x01, 0x84, 0x40
+			DB 0x01, 0x8F, 0x40, 0x02, 0x20, 0x40, 0x01, 0x84
+			DB 0x40, 0x00, 0x20, 0x90, 0x40, 0x05, 0x84, 0x20
+			DB 0x00, 0x20, 0x91, 0x40, 0x20, 0x03, 0x83, 0x60
+			DB 0x21, 0x40, 0x93, 0x60, 0x42, 0xD0
+; f f
+			DB 0x87, 0x60, 0x40, 0x60, 0x9C, 0x40, 0x00, 0x20
+			DB 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20
+			DB 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20
+			DB 0x98, 0x60, 0x42, 0x20, 0x00, 0x20, 0x4B, 0x8A
+			DB 0x40, 0x13, 0x89, 0x20, 0x14, 0x88, 0x40, 0x03
+			DB 0x22, 0x02, 0x2B, 0x88, 0x01, 0x20, 0x40, 0x83
+			DB 0x40, 0x00, 0x20, 0x94, 0x01, 0x60, 0x84, 0x40
+			DB 0x00, 0x20, 0x94, 0x01, 0x85, 0x40, 0x00, 0x20
+			DB 0x94, 0x00, 0x20, 0x85, 0x40, 0x00, 0x20, 0x94
+			DB 0x01, 0x85, 0x40, 0x00, 0x20, 0x94, 0x01, 0x85
+			DB 0x40, 0x00, 0x20, 0x94, 0x01, 0x60, 0x84, 0x42
+			DB 0x94, 0x60, 0x9E
+; g g
+			DB 0x98, 0x42, 0x60, 0x8B, 0x60, 0x40, 0x20, 0x01
+			DB 0x20, 0x40, 0x82, 0x41, 0x60, 0x80, 0x60, 0x04
+			DB 0x40, 0x89, 0x60, 0x06, 0x20, 0x60, 0x20, 0x02
+			DB 0x40, 0x06, 0x60, 0x87, 0x60, 0x10, 0x20, 0x40
+			DB 0x02, 0x20, 0x87, 0x40, 0x01, 0x20, 0x60, 0x80
+			DB 0x60, 0x40, 0x02, 0x20, 0x40, 0x02, 0x20, 0x60
+			DB 0x81, 0x60, 0x20, 0x01, 0x87, 0x20, 0x00, 0x40
+			DB 0x84, 0x40, 0x01, 0x60, 0x80, 0x40, 0x01, 0x40
+			DB 0x83, 0x40, 0x01, 0x60, 0x86, 0x01, 0x60, 0x85
+			DB 0x01, 0x40, 0x81, 0x01, 0x40, 0x83, 0x60, 0x01
+			DB 0x40, 0x85, 0x60, 0x00, 0x20, 0x86, 0x20, 0x00
+			DB 0x40, 0x81, 0x01, 0x40, 0x84, 0x01, 0x40, 0x85
+			DB 0x40, 0x00, 0x20, 0x86, 0x20, 0x00, 0x40, 0x81
+			DB 0x01, 0x40, 0x84, 0x01, 0x40, 0x86, 0x01, 0x60
+			DB 0x84, 0x60, 0x01, 0x60, 0x81, 0x01, 0x40, 0x83
+			DB 0x60, 0x01, 0x60, 0x86, 0x01, 0x20, 0x84, 0x20
+			DB 0x00, 0x20, 0x82, 0x01, 0x40, 0x83, 0x40, 0x01
+			DB 0x87, 0x02, 0x20, 0x42, 0x20, 0x01, 0x40, 0x82
+			DB 0x01, 0x40, 0x83, 0x01, 0x20, 0x87, 0x08, 0x20
+			DB 0x83, 0x20, 0x01, 0x40, 0x80, 0x60, 0x20, 0x01
+			DB 0x60, 0x87, 0x01, 0x20, 0x04, 0x20, 0x60, 0x83
+			DB 0x40, 0x06, 0x20, 0x88, 0x01, 0x41, 0x22, 0x40
+			DB 0x85, 0x60, 0x05, 0x20, 0x89, 0x01, 0x40, 0x8B
+			DB 0x60, 0x20, 0x01, 0x20, 0x40, 0x8A, 0x41, 0x60
+			DB 0xB5
+; h h
+			DB 0xBF, 0x16, 0x88, 0x16, 0x88, 0x08, 0x20, 0x0C
+			DB 0x90, 0x60, 0x20, 0x01, 0x20, 0x40, 0x98, 0x60
+			DB 0x20, 0x00, 0x20, 0x60, 0x9A, 0x20, 0x00, 0x20
+			DB 0x9C, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x9C, 0x40
+			DB 0x01, 0x60, 0x9C, 0x01, 0x20, 0x60, 0x9B, 0x03
+			DB 0x2B, 0x8F, 0x40, 0x0E, 0x90, 0x40, 0x0D, 0x92
+			DB 0x60, 0x4B, 0xC8
+; i i
+			DB 0xB3, 0x60, 0x41, 0x8F, 0x21, 0x60, 0x89, 0x40
+			DB 0x01, 0x8F, 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F
+			DB 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F, 0x01, 0x40
+			DB 0x89, 0x40, 0x01, 0x89, 0x61, 0x83, 0x01, 0x40
+			DB 0x89, 0x40, 0x01, 0x88, 0x40, 0x01, 0x40, 0x82
+			DB 0x01, 0x4B, 0x01, 0x88, 0x03, 0x60, 0x81, 0x0F
+			DB 0x88, 0x03, 0x60, 0x81, 0x0F, 0x88, 0x20, 0x01
+			DB 0x20, 0x82, 0x2D, 0x01, 0x89, 0x41, 0x90, 0x40
+			DB 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C
+			DB 0x40, 0x01, 0x9C, 0x40, 0x01, 0xC8
+; j j
+			DB 0x9B, 0x40, 0x20, 0x9C, 0x20, 0x01, 0x40, 0x87
+			DB 0x21, 0x60, 0x90, 0x60, 0x01, 0x20, 0x87, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x87, 0x01, 0x40, 0x91
+			DB 0x40, 0x01, 0x87, 0x01, 0x40, 0x91, 0x60, 0x01
+			DB 0x40, 0x86, 0x01, 0x40, 0x92, 0x01, 0x60, 0x86
+			DB 0x01, 0x40, 0x91, 0x40, 0x01, 0x87, 0x01, 0x40
+			DB 0x91, 0x20, 0x00, 0x20, 0x80, 0x40, 0x01, 0x40
+			DB 0x82, 0x01, 0x40, 0x8F, 0x60, 0x20, 0x01, 0x40
+			DB 0x80, 0x03, 0x60, 0x81, 0x01, 0x2F, 0x03, 0x20
+			DB 0x60, 0x80, 0x03, 0x40, 0x81, 0x14, 0x20, 0x60
+			DB 0x81, 0x03, 0x82, 0x12, 0x20, 0x40, 0x60, 0x82
+			DB 0x60, 0x21, 0x60, 0x82, 0x50, 0x60, 0xFF, 0x86
+; k k
+			DB 0xBF, 0x36, 0x88, 0x16, 0x88, 0x16, 0x88, 0x4C
+			DB 0x20, 0x00, 0x47, 0x94, 0x40, 0x02, 0x40, 0x99
+			DB 0x40, 0x04, 0x40, 0x97, 0x40, 0x02, 0x20, 0x02
+			DB 0x40, 0x95, 0x40, 0x02, 0x60, 0x80, 0x40, 0x02
+			DB 0x20, 0x93, 0x40, 0x02, 0x60, 0x82, 0x40, 0x02
+			DB 0x20, 0x60, 0x90, 0x40, 0x02, 0x60, 0x84, 0x40
+			DB 0x02, 0x20, 0x60, 0x8F, 0x02, 0x40, 0x86, 0x60
+			DB 0x03, 0x8F, 0x01, 0x40, 0x88, 0x60, 0x02, 0x8F
+			DB 0x00, 0x40, 0x8A, 0x60, 0x20, 0x00, 0x8F, 0x40
+			DB 0x8C, 0x60, 0x20, 0x9E, 0x60, 0xA8
+; l l
+			DB 0x9F, 0x41, 0x91, 0x60, 0x41, 0x88, 0x01, 0x91
+			DB 0x40, 0x01, 0x88, 0x01, 0x91, 0x40, 0x01, 0x88
+			DB 0x01, 0x91, 0x40, 0x01, 0x88, 0x01, 0x91, 0x40
+			DB 0x01, 0x88, 0x01, 0x91, 0x40, 0x01, 0x88, 0x01
+			DB 0x51, 0x20, 0x01, 0x88, 0x16, 0x88, 0x16, 0x88
+			DB 0x53, 0x20, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40
+			DB 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C
+			DB 0x40, 0x01, 0x9C, 0x60, 0x41, 0xA8
+; m m
+			DB 0x86, 0x4F, 0x8F, 0x0F, 0x8F, 0x22, 0x0C, 0x90
+			DB 0x40, 0x01, 0x20, 0x40, 0x60, 0x98, 0x20, 0x00
+			DB 0x20, 0x60, 0x9A, 0x60, 0x01, 0x60, 0x9B, 0x40
+			DB 0x01, 0x60, 0x9B, 0x60, 0x02, 0x2C, 0x8F, 0x40
+			DB 0x0E, 0x90, 0x60, 0x40, 0x03, 0x28, 0x8F, 0x60
+			DB 0x20, 0x01, 0x40, 0x60, 0x99, 0x20, 0x00, 0x20
+			DB 0x60, 0x9A, 0x60, 0x01, 0x60, 0x9B, 0x40, 0x01
+			DB 0x60, 0x9B, 0x60, 0x02, 0x2C, 0x8F, 0x40, 0x0E
+			DB 0x90, 0x60, 0x40, 0x2C, 0xA8
+; n n
+			DB 0xC6, 0x0F, 0x8F, 0x0F, 0x8F, 0x22, 0x05, 0x26
+			DB 0x90, 0x60, 0x20, 0x01, 0x40, 0x60, 0x98, 0x60
+			DB 0x01, 0x20, 0x9B, 0x20, 0x00, 0x20, 0x9C, 0x01
+			DB 0x40, 0x9B, 0x60, 0x01, 0x9C, 0x40, 0x01, 0x60
+			DB 0x9C, 0x01, 0x20, 0x60, 0x9B, 0x20, 0x02, 0x2B
+			DB 0x8F, 0x40, 0x0E, 0x90, 0x40, 0x0D, 0x92, 0x60
+			DB 0x4B, 0xC8
+; o o
+			DB 0xAA, 0x40, 0x21, 0x02, 0x21, 0x60, 0x94, 0x60
+			DB 0x20, 0x08, 0x20, 0x92, 0x60, 0x0B, 0x20, 0x91
+			DB 0x20, 0x01, 0x20, 0x40, 0x60, 0x81, 0x60, 0x40
+			DB 0x20, 0x02, 0x40, 0x8F, 0x40, 0x01, 0x40, 0x87
+			DB 0x40, 0x01, 0x20, 0x8F, 0x20, 0x00, 0x20, 0x89
+			DB 0x40, 0x01, 0x8F, 0x01, 0x60, 0x89, 0x60, 0x01
+			DB 0x60, 0x8D, 0x40, 0x01, 0x8B, 0x01, 0x40, 0x8D
+			DB 0x60, 0x01, 0x60, 0x89, 0x60, 0x01, 0x60, 0x8E
+			DB 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F, 0x20, 0x01
+			DB 0x60, 0x87, 0x60, 0x01, 0x40, 0x8F, 0x40, 0x02
+			DB 0x40, 0x60, 0x83, 0x60, 0x40, 0x02, 0x60, 0x90
+			DB 0x20, 0x03, 0x22, 0x04, 0x60, 0x91, 0x60, 0x20
+			DB 0x09, 0x40, 0x94, 0x40, 0x20, 0x04, 0x20, 0x40
+			DB 0x60, 0x98, 0x60, 0x41, 0xAF
+; p p
+			DB 0xC6, 0x17, 0x87, 0x17, 0x87, 0x23, 0x13, 0x88
+			DB 0x60, 0x20, 0x01, 0x20, 0x40, 0x85, 0x40, 0x01
+			DB 0x8F, 0x60, 0x01, 0x20, 0x60, 0x87, 0x60, 0x01
+			DB 0x40, 0x8E, 0x20, 0x00, 0x20, 0x8A, 0x01, 0x40
+			DB 0x8E, 0x01, 0x60, 0x8A, 0x01, 0x40, 0x8D, 0x60
+			DB 0x01, 0x8A, 0x60, 0x01, 0x60, 0x8D, 0x60, 0x01
+			DB 0x40, 0x89, 0x20, 0x01, 0x8F, 0x01, 0x20, 0x88
+			DB 0x40, 0x01, 0x40, 0x8F, 0x20, 0x01, 0x20, 0x40
+			DB 0x84, 0x60, 0x20, 0x02, 0x60, 0x8F, 0x40, 0x04
+			DB 0x22, 0x04, 0x40, 0x91, 0x40, 0x0A, 0x60, 0x93
+			DB 0x60, 0x20, 0x05, 0x20, 0x40, 0x99, 0x41, 0x60
+			DB 0xAF
+; q q
+			DB 0xAA, 0x60, 0x40, 0x20, 0x02, 0x21, 0x40, 0x95
+			DB 0x20, 0x08, 0x20, 0x60, 0x91, 0x60, 0x20, 0x0B
+			DB 0x60, 0x90, 0x20, 0x02, 0x40, 0x60, 0x82, 0x60
+			DB 0x40, 0x02, 0x20, 0x8F, 0x40, 0x01, 0x20, 0x87
+			DB 0x60, 0x02, 0x8F, 0x20, 0x00, 0x20, 0x89, 0x40
+			DB 0x01, 0x60, 0x8E, 0x01, 0x40, 0x8A, 0x01, 0x40
+			DB 0x8D, 0x60, 0x01, 0x60, 0x89, 0x60, 0x01, 0x8E
+			DB 0x40, 0x01, 0x8A, 0x40, 0x00, 0x20, 0x8E, 0x60
+			DB 0x01, 0x89, 0x40, 0x01, 0x60, 0x8F, 0x01, 0x40
+			DB 0x86, 0x40, 0x20, 0x01, 0x60, 0x90, 0x01, 0x26
+			DB 0x03, 0x2A, 0x87, 0x17, 0x87, 0x20, 0x16, 0x87
+			DB 0x60, 0x56, 0xC0
+; r r
+			DB 0x86, 0x41, 0x60, 0x89, 0x60, 0x41, 0x8F, 0x01
+			DB 0x40, 0x89, 0x40, 0x01, 0x8F, 0x01, 0x40, 0x89
+			DB 0x40, 0x01, 0x8F, 0x01, 0x40, 0x89, 0x40, 0x01
+			DB 0x8F, 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F, 0x0F
+			DB 0x8F, 0x0F, 0x8F, 0x23, 0x0B, 0x91, 0x40, 0x02
+			DB 0x20, 0x40, 0x60, 0x83, 0x40, 0x01, 0x90, 0x20
+			DB 0x01, 0x20, 0x60, 0x86, 0x40, 0x01, 0x8F, 0x40
+			DB 0x01, 0x40, 0x88, 0x40, 0x01, 0x8F, 0x02, 0x89
+			DB 0x40, 0x01, 0x8E, 0x60, 0x01, 0x40, 0x89, 0x60
+			DB 0x41, 0x8E, 0x40, 0x01, 0x40, 0x9B, 0x40, 0x01
+			DB 0x20, 0x9B, 0x60, 0x01, 0x20, 0x9C, 0x40, 0x60
+			DB 0xB6
+; s s
+			DB 0xC8, 0x60, 0x22, 0x60, 0x84, 0x60, 0x20, 0x00
+			DB 0x20, 0x90, 0x40, 0x04, 0x40, 0x84, 0x20, 0x00
+			DB 0x20, 0x8F, 0x60, 0x06, 0x60, 0x83, 0x40, 0x01
+			DB 0x8F, 0x20, 0x01, 0x21, 0x02, 0x40, 0x83, 0x40
+			DB 0x01, 0x60, 0x8E, 0x01, 0x40, 0x81, 0x40, 0x01
+			DB 0x20, 0x84, 0x01, 0x40, 0x8D, 0x60, 0x01, 0x60
+			DB 0x82, 0x02, 0x84, 0x01, 0x40, 0x8D, 0x40, 0x01
+			DB 0x83, 0x20, 0x01, 0x60, 0x83, 0x01, 0x40, 0x8D
+			DB 0x40, 0x01, 0x83, 0x40, 0x01, 0x40, 0x82, 0x60
+			DB 0x01, 0x60, 0x8D, 0x40, 0x01, 0x83, 0x60, 0x02
+			DB 0x82, 0x40, 0x01, 0x8E, 0x60, 0x01, 0x60, 0x83
+			DB 0x20, 0x01, 0x20, 0x41, 0x01, 0x20, 0x8F, 0x01
+			DB 0x40, 0x83, 0x40, 0x06, 0x60, 0x8F, 0x21, 0x40
+			DB 0x84, 0x20, 0x04, 0x40, 0x98, 0x60, 0x20, 0x01
+			DB 0x20, 0x40, 0xEA
+; t t
+			DB 0x86, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01
+			DB 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x96
+			DB 0x60, 0x24, 0x01, 0x29, 0x41, 0x8B, 0x40, 0x12
+			DB 0x20, 0x8A, 0x20, 0x13, 0x40, 0x89, 0x45, 0x01
+			DB 0x49, 0x20, 0x02, 0x8F, 0x01, 0x40, 0x89, 0x20
+			DB 0x01, 0x8F, 0x01, 0x40, 0x89, 0x60, 0x01, 0x40
+			DB 0x8E, 0x01, 0x40, 0x8A, 0x01, 0x40, 0x8E, 0x01
+			DB 0x40, 0x8A, 0x01, 0x8F, 0x01, 0x40, 0x89, 0x40
+			DB 0x01, 0x8F, 0x01, 0x40, 0x89, 0x40, 0x00, 0x20
+			DB 0x9C, 0x60, 0x40, 0x60, 0xC8
+; u u
+			DB 0xC6, 0x0C, 0x20, 0x60, 0x90, 0x0E, 0x60, 0x8F
+			DB 0x0E, 0x20, 0x9B, 0x40, 0x02, 0x9C, 0x40, 0x01
+			DB 0x60, 0x9C, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x9C
+			DB 0x20, 0x00, 0x20, 0x9B, 0x40, 0x01, 0x60, 0x99
+			DB 0x40, 0x20, 0x01, 0x60, 0x90, 0x28, 0x03, 0x20
+			DB 0x41, 0x8F, 0x0F, 0x8F, 0x0F, 0x8F, 0x4F, 0xC8
+; v v
+			DB 0x86, 0x40, 0x9E, 0x01, 0x40, 0x60, 0x9B, 0x03
+			DB 0x20, 0x40, 0x99, 0x06, 0x40, 0x60, 0x97, 0x40
+			DB 0x20, 0x05, 0x20, 0x40, 0x97, 0x60, 0x40, 0x06
+			DB 0x40, 0x60, 0x97, 0x60, 0x20, 0x05, 0x20, 0x40
+			DB 0x97, 0x60, 0x40, 0x20, 0x04, 0x9A, 0x60, 0x20
+			DB 0x02, 0x98, 0x40, 0x20, 0x04, 0x95, 0x60, 0x40
+			DB 0x05, 0x20, 0x40, 0x93, 0x40, 0x20, 0x05, 0x40
+			DB 0x60, 0x92, 0x60, 0x20, 0x05, 0x20, 0x40, 0x94
+			DB 0x20, 0x05, 0x40, 0x60, 0x96, 0x03, 0x20, 0x40
+			DB 0x99, 0x01, 0x40, 0x60, 0x9B, 0x40, 0xB7
+; w w
+			DB 0x86, 0x02, 0x20, 0x42, 0x60, 0x97, 0x08, 0x21
+			DB 0x42, 0x91, 0x21, 0x0D, 0x93, 0x42, 0x21, 0x06
+			DB 0x9A, 0x40, 0x03, 0x97, 0x40, 0x20, 0x04, 0x20
+			DB 0x94, 0x60, 0x20, 0x04, 0x20, 0x40, 0x94, 0x60
+			DB 0x04, 0x20, 0x40, 0x60, 0x96, 0x40, 0x02, 0x20
+			DB 0x60, 0x99, 0x60, 0x04, 0x20, 0x40, 0x60, 0x98
+			DB 0x40, 0x20, 0x04, 0x20, 0x40, 0x98, 0x60, 0x20
+			DB 0x05, 0x40, 0x99, 0x40, 0x20, 0x03, 0x96, 0x43
+			DB 0x21, 0x02, 0x8F, 0x41, 0x22, 0x0A, 0x8F, 0x0A
+			DB 0x21, 0x41, 0x60, 0x8F, 0x03, 0x21, 0x42, 0x96
+			DB 0x41, 0x60, 0x95
+; x x
+			DB 0x86, 0x60, 0x8D, 0x40, 0x8F, 0x00, 0x60, 0x8B
+			DB 0x40, 0x00, 0x8F, 0x01, 0x40, 0x88, 0x60, 0x20
+			DB 0x01, 0x8F, 0x02, 0x20, 0x60, 0x85, 0x60, 0x20
+			DB 0x02, 0x8F, 0x20, 0x02, 0x20, 0x60, 0x83, 0x40
+			DB 0x03, 0x60, 0x90, 0x40, 0x03, 0x40, 0x81, 0x40
+			DB 0x02, 0x20, 0x60, 0x92, 0x60, 0x20, 0x02, 0x40
+			DB 0x20, 0x02, 0x40, 0x95, 0x60, 0x20, 0x05, 0x40
+			DB 0x98, 0x40, 0x03, 0x60, 0x98, 0x60, 0x20, 0x04
+			DB 0x60, 0x96, 0x40, 0x02, 0x20, 0x03, 0x40, 0x94
+			DB 0x40, 0x02, 0x20, 0x61, 0x20, 0x02, 0x20, 0x60
+			DB 0x90, 0x60, 0x20, 0x02, 0x40, 0x83, 0x20, 0x02
+			DB 0x20, 0x60, 0x8F, 0x03, 0x60, 0x85, 0x40, 0x03
+			DB 0x8F, 0x01, 0x20, 0x60, 0x87, 0x60, 0x02, 0x8F
+			DB 0x00, 0x40, 0x8A, 0x60, 0x20, 0x00, 0x8F, 0x40
+			DB 0x8D, 0x20, 0xA8
+; y y
+			DB 0x86, 0x60, 0x9E, 0x00, 0x20, 0x40, 0x91, 0x60
+			DB 0x20, 0x40, 0x60, 0x86, 0x03, 0x40, 0x60, 0x8E
+			DB 0x40, 0x01, 0x60, 0x86, 0x05, 0x20, 0x40, 0x8C
+			DB 0x01, 0x20, 0x87, 0x60, 0x20, 0x06, 0x40, 0x60
+			DB 0x88, 0x20, 0x01, 0x40, 0x8A, 0x40, 0x20, 0x05
+			DB 0x20, 0x40, 0x84, 0x60, 0x20, 0x01, 0x20, 0x8D
+			DB 0x60, 0x40, 0x06, 0x40, 0x61, 0x40, 0x03, 0x60
+			DB 0x90, 0x60, 0x20, 0x09, 0x20, 0x60, 0x94, 0x40
+			DB 0x20, 0x05, 0x40, 0x94, 0x60, 0x20, 0x04, 0x20
+			DB 0x40, 0x93, 0x60, 0x40, 0x05, 0x20, 0x60, 0x93
+			DB 0x40, 0x20, 0x04, 0x20, 0x40, 0x60, 0x92, 0x60
+			DB 0x20, 0x05, 0x20, 0x60, 0x94, 0x20, 0x05, 0x40
+			DB 0x60, 0x96, 0x03, 0x20, 0x40, 0x99, 0x01, 0x40
+			DB 0x60, 0x9B, 0x40, 0xB7
+; z z
+			DB 0xC6, 0x21, 0x60, 0x89, 0x20, 0x01, 0x8F, 0x01
+			DB 0x40, 0x87, 0x60, 0x20, 0x02, 0x8F, 0x01, 0x40
+			DB 0x86, 0x60, 0x04, 0x8F, 0x01, 0x40, 0x85, 0x40
+			DB 0x05, 0x8F, 0x01, 0x40, 0x83, 0x60, 0x20, 0x02
+			DB 0x21, 0x01, 0x8F, 0x01, 0x40, 0x82, 0x60, 0x20
+			DB 0x02, 0x40, 0x80, 0x40, 0x01, 0x8F, 0x01, 0x40
+			DB 0x81, 0x40, 0x03, 0x40, 0x81, 0x40, 0x01, 0x8F
+			DB 0x01, 0x40, 0x80, 0x40, 0x02, 0x20, 0x60, 0x82
+			DB 0x40, 0x01, 0x8F, 0x01, 0x40, 0x20, 0x02, 0x20
+			DB 0x60, 0x83, 0x40, 0x01, 0x8F, 0x05, 0x40, 0x85
+			DB 0x40, 0x01, 0x8F, 0x04, 0x40, 0x86, 0x40, 0x01
+			DB 0x8F, 0x02, 0x20, 0x60, 0x87, 0x40, 0x01, 0x8F
+			DB 0x01, 0x20, 0x89, 0x40, 0x01, 0x9C, 0x60, 0x41
+			DB 0xC8
+; { lbrace
+			DB 0xCC, 0x01, 0x9C, 0x60, 0x01, 0x60, 0x9B, 0x40
+			DB 0x01, 0x40, 0x9B, 0x20, 0x01, 0x20, 0x94, 0x45
+			DB 0x20, 0x00, 0x20, 0x01, 0x20, 0x46, 0x60, 0x88
+			DB 0x60, 0x20, 0x08, 0x41, 0x0A, 0x40, 0x85, 0x60
+			DB 0x09, 0x20, 0x61, 0x20, 0x0A, 0x40, 0x84, 0x20
+			DB 0x02, 0x45, 0x60, 0x83, 0x60, 0x46, 0x20, 0x02
+			DB 0x60, 0x83, 0x01, 0x20, 0x94, 0x60, 0x01, 0x40
+			DB 0x82, 0x60, 0x01, 0x60, 0x95, 0x20, 0x00, 0x20
+			DB 0x82, 0x40, 0x00, 0x20, 0x96, 0x40, 0x00, 0x20
+			DB 0x82, 0x40, 0x00, 0x20, 0x96, 0x40, 0x00, 0x20
+			DB 0x82, 0x60, 0x41, 0x96, 0x60, 0x41, 0xE2
+; | bar
+			DB 0xFF, 0xDF, 0x5D, 0x81, 0x1C, 0x20, 0x81, 0x3D
+			DB 0xFF, 0xFF, 0x81
+; } rbrace
+			DB 0xBF, 0x60, 0x40, 0x60, 0x96, 0x60, 0x40, 0x60
+			DB 0x82, 0x40, 0x00, 0x20, 0x96, 0x40, 0x00, 0x20
+			DB 0x82, 0x40, 0x00, 0x20, 0x96, 0x40, 0x00, 0x20
+			DB 0x82, 0x60, 0x01, 0x96, 0x40, 0x00, 0x20, 0x83
+			DB 0x01, 0x40, 0x94, 0x60, 0x01, 0x40, 0x83, 0x20
+			DB 0x01, 0x20, 0x44, 0x60, 0x85, 0x47, 0x20, 0x01
+			DB 0x60, 0x83, 0x60, 0x09, 0x40, 0x81, 0x40, 0x0A
+			DB 0x20, 0x85, 0x40, 0x09, 0x41, 0x0A, 0x20, 0x60
+			DB 0x87, 0x46, 0x01, 0x21, 0x00, 0x20, 0x47, 0x60
+			DB 0x90, 0x60, 0x20, 0x01, 0x20, 0x9B, 0x40, 0x01
+			DB 0x40, 0x9B, 0x60, 0x01, 0x60, 0x9C, 0x01, 0x9D
+			DB 0x41, 0xD0
+; ~ tilde
+			DB 0xA5, 0x60, 0x41, 0x9B, 0x40, 0x02, 0x9A, 0x40
+			DB 0x02, 0x20, 0x9A, 0x20, 0x00, 0x20, 0x60, 0x9B
+			DB 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x20, 0x01
+			DB 0x40, 0x9B, 0x60, 0x20, 0x01, 0x40, 0x9B, 0x60
+			DB 0x20, 0x01, 0x40, 0x9B, 0x60, 0x20, 0x00, 0x20
+			DB 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x20, 0x00, 0x20
+			DB 0x99, 0x60, 0x40, 0x02, 0x40, 0x99, 0x40, 0x02
+			DB 0x40, 0x9A, 0x60, 0x20, 0x40, 0x60, 0xD7
+;  7F
+			DB 0xC2, 0x60, 0x42, 0x60, 0x98, 0x60, 0x20, 0x04
+			DB 0x20, 0x60, 0x96, 0x20, 0x06, 0x20, 0x95, 0x40
+			DB 0x01, 0x40, 0x60, 0x80, 0x60, 0x20, 0x01, 0x40
+			DB 0x94, 0x01, 0x40, 0x84, 0x20, 0x00, 0x20, 0x94
+			DB 0x01, 0x85, 0x40, 0x01, 0x94, 0x00, 0x20, 0x85
+			DB 0x40, 0x01, 0x94, 0x01, 0x85, 0x40, 0x00, 0x20
+			DB 0x94, 0x01, 0x40, 0x84, 0x20, 0x00, 0x20, 0x94
+			DB 0x20, 0x01, 0x40, 0x60, 0x80, 0x60, 0x20, 0x01
+			DB 0x60, 0x94, 0x60, 0x07, 0x40, 0x96, 0x60, 0x05
+			DB 0x40, 0x99, 0x43, 0x60, 0xF7
+; € 80
+			DB 0xAA, 0x40, 0x21, 0x02, 0x21, 0x60, 0x94, 0x60
+			DB 0x20, 0x08, 0x20, 0x8A, 0x60, 0x21, 0x60, 0x83
+			DB 0x60, 0x0B, 0x20, 0x89, 0x20, 0x02, 0x83, 0x20
+			DB 0x01, 0x20, 0x40, 0x60, 0x81, 0x60, 0x40, 0x20
+			DB 0x02, 0x40, 0x88, 0x20, 0x02, 0x82, 0x40, 0x01
+			DB 0x40, 0x87, 0x40, 0x01, 0x20, 0x88, 0x60, 0x01
+			DB 0x40, 0x82, 0x20, 0x00, 0x20, 0x89, 0x40, 0x01
+			DB 0x8F, 0x01, 0x60, 0x89, 0x60, 0x01, 0x60, 0x8D
+			DB 0x40, 0x01, 0x8B, 0x01, 0x40, 0x8D, 0x60, 0x01
+			DB 0x60, 0x89, 0x60, 0x01, 0x60, 0x87, 0x60, 0x21
+			DB 0x60, 0x82, 0x01, 0x40, 0x89, 0x40, 0x01, 0x88
+			DB 0x20, 0x02, 0x82, 0x20, 0x01, 0x60, 0x87, 0x60
+			DB 0x01, 0x40, 0x88, 0x20, 0x02, 0x82, 0x40, 0x02
+			DB 0x40, 0x60, 0x83, 0x60, 0x40, 0x02, 0x60, 0x88
+			DB 0x60, 0x01, 0x40, 0x83, 0x20, 0x03, 0x22, 0x04
+			DB 0x60, 0x91, 0x60, 0x20, 0x09, 0x40, 0x94, 0x40
+			DB 0x20, 0x04, 0x20, 0x40, 0x60, 0x98, 0x60, 0x41
+			DB 0xAF
+;  81
+			DB 0xB0, 0x40, 0x21, 0x40, 0x60, 0x90, 0x60, 0x20
+			DB 0x40, 0x60, 0x84, 0x20, 0x04, 0x60, 0x88, 0x60
+			DB 0x21, 0x60, 0x82, 0x40, 0x01, 0x60, 0x83, 0x20
+			DB 0x05, 0x20, 0x88, 0x20, 0x02, 0x82, 0x20, 0x00
+			DB 0x20, 0x83, 0x60, 0x01, 0x20, 0x41, 0x02, 0x88
+			DB 0x20, 0x02, 0x82, 0x01, 0x40, 0x83, 0x40, 0x00
+			DB 0x20, 0x82, 0x40, 0x01, 0x60, 0x87, 0x60, 0x01
+			DB 0x40, 0x82, 0x01, 0x60, 0x83, 0x20, 0x00, 0x40
+			DB 0x82, 0x60, 0x01, 0x60, 0x8D, 0x60, 0x01, 0x84
+			DB 0x01, 0x60, 0x82, 0x60, 0x01, 0x8E, 0x40, 0x01
+			DB 0x84, 0x01, 0x83, 0x40, 0x00, 0x20, 0x8E, 0x60
+			DB 0x01, 0x40, 0x82, 0x60, 0x00, 0x20, 0x83, 0x20
+			DB 0x00, 0x40, 0x88, 0x60, 0x21, 0x60, 0x82, 0x01
+			DB 0x20, 0x82, 0x40, 0x00, 0x20, 0x81, 0x60, 0x20
+			DB 0x00, 0x20, 0x89, 0x20, 0x02, 0x82, 0x20, 0x01
+			DB 0x20, 0x42, 0x00, 0x20, 0x41, 0x01, 0x20, 0x8A
+			DB 0x20, 0x02, 0x82, 0x40, 0x0E, 0x88, 0x60, 0x01
+			DB 0x40, 0x83, 0x40, 0x0D, 0x91, 0x60, 0x40, 0x2B
+			DB 0xE8
+; ‚ 82
+			DB 0xC6, 0x0C, 0x20, 0x60, 0x89, 0x60, 0x21, 0x60
+			DB 0x82, 0x0E, 0x60, 0x88, 0x20, 0x02, 0x82, 0x0E
+			DB 0x20, 0x88, 0x20, 0x02, 0x8E, 0x40, 0x02, 0x88
+			DB 0x60, 0x01, 0x40, 0x8F, 0x40, 0x01, 0x60, 0x9C
+			DB 0x01, 0x60, 0x9B, 0x60, 0x01, 0x9C, 0x20, 0x00
+			DB 0x20, 0x88, 0x60, 0x21, 0x60, 0x8E, 0x40, 0x01
+			DB 0x60, 0x88, 0x20, 0x02, 0x8C, 0x40, 0x20, 0x01
+			DB 0x60, 0x89, 0x20, 0x02, 0x82, 0x28, 0x03, 0x20
+			DB 0x41, 0x88, 0x60, 0x01, 0x40, 0x82, 0x0F, 0x8F
+			DB 0x0F, 0x8F, 0x4F, 0xC8
+; ƒ 83
+			DB 0xA3, 0x60, 0x51, 0x8A, 0x40, 0x13, 0x89, 0x20
+			DB 0x14, 0x88, 0x40, 0x02, 0x20, 0x51, 0x88, 0x01
+			DB 0x20, 0x60, 0x9B, 0x01, 0x60, 0x9C, 0x00, 0x20
+			DB 0x85, 0x60, 0x40, 0x21, 0x40, 0x86, 0x40, 0x01
+			DB 0x88, 0x00, 0x20, 0x84, 0x60, 0x04, 0x20, 0x60
+			DB 0x84, 0x40, 0x01, 0x88, 0x00, 0x20, 0x83, 0x60
+			DB 0x06, 0x20, 0x85, 0x01, 0x60, 0x87, 0x01, 0x40
+			DB 0x81, 0x60, 0x20, 0x01, 0x42, 0x02, 0x40, 0x84
+			DB 0x01, 0x60, 0x87, 0x02, 0x20, 0x40, 0x02, 0x40
+			DB 0x82, 0x40, 0x02, 0x60, 0x82, 0x40, 0x01, 0x88
+			DB 0x20, 0x05, 0x40, 0x84, 0x20, 0x01, 0x20, 0x82
+			DB 0x20, 0x01, 0x89, 0x20, 0x03, 0x20, 0x85, 0x60
+			DB 0x02, 0x20, 0x40, 0x20, 0x01, 0x40, 0x8A, 0x60
+			DB 0x41, 0x60, 0x87, 0x40, 0x06, 0x60, 0x97, 0x20
+			DB 0x03, 0x20, 0x60, 0x99, 0x60, 0x42, 0xAB
+; „ 84
+			DB 0xAA, 0x60, 0x40, 0x23, 0x40, 0x60, 0x95, 0x60
+			DB 0x20, 0x07, 0x20, 0x60, 0x92, 0x60, 0x0B, 0x40
+			DB 0x90, 0x60, 0x20, 0x01, 0x20, 0x40, 0x01, 0x42
+			DB 0x03, 0x60, 0x8F, 0x40, 0x01, 0x40, 0x81, 0x01
+			DB 0x83, 0x20, 0x01, 0x40, 0x8B, 0x40, 0x60, 0x81
+			DB 0x01, 0x40, 0x82, 0x01, 0x84, 0x20, 0x01, 0x8A
+			DB 0x40, 0x00, 0x20, 0x80, 0x60, 0x01, 0x60, 0x82
+			DB 0x01, 0x84, 0x40, 0x01, 0x89, 0x40, 0x01, 0x40
+			DB 0x80, 0x40, 0x01, 0x83, 0x01, 0x84, 0x60, 0x01
+			DB 0x60, 0x87, 0x60, 0x01, 0x20, 0x81, 0x40, 0x01
+			DB 0x60, 0x82, 0x01, 0x85, 0x01, 0x40, 0x87, 0x20
+			DB 0x01, 0x60, 0x81, 0x60, 0x01, 0x40, 0x82, 0x01
+			DB 0x85, 0x01, 0x60, 0x87, 0x01, 0x40, 0x83, 0x20
+			DB 0x01, 0x60, 0x81, 0x01, 0x84, 0x40, 0x01, 0x88
+			DB 0x00, 0x20, 0x84, 0x40, 0x02, 0x20, 0x40, 0x01
+			DB 0x84, 0x40, 0x00, 0x20, 0x88, 0x61, 0x85, 0x40
+			DB 0x05, 0x84, 0x20, 0x00, 0x20, 0x91, 0x40, 0x20
+			DB 0x03, 0x83, 0x60, 0x21, 0x40, 0x93, 0x60, 0x42
+			DB 0xD0
+; … 85
+			DB 0xAA, 0x60, 0x40, 0x23, 0x40, 0x60, 0x95, 0x60
+			DB 0x20, 0x07, 0x20, 0x60, 0x8A, 0x61, 0x85, 0x60
+			DB 0x0B, 0x40, 0x89, 0x00, 0x20, 0x84, 0x60, 0x20
+			DB 0x01, 0x20, 0x40, 0x01, 0x42, 0x03, 0x60, 0x88
+			DB 0x01, 0x40, 0x83, 0x40, 0x01, 0x40, 0x81, 0x01
+			DB 0x83, 0x20, 0x01, 0x40, 0x88, 0x20, 0x01, 0x60
+			DB 0x82, 0x01, 0x40, 0x82, 0x01, 0x84, 0x20, 0x01
+			DB 0x88, 0x60, 0x01, 0x20, 0x81, 0x60, 0x01, 0x60
+			DB 0x82, 0x01, 0x84, 0x40, 0x01, 0x89, 0x40, 0x01
+			DB 0x40, 0x80, 0x40, 0x01, 0x83, 0x01, 0x84, 0x60
+			DB 0x01, 0x60, 0x89, 0x40, 0x00, 0x20, 0x80, 0x40
+			DB 0x01, 0x60, 0x82, 0x01, 0x85, 0x01, 0x40, 0x8A
+			DB 0x40, 0x60, 0x80, 0x60, 0x01, 0x40, 0x82, 0x01
+			DB 0x85, 0x01, 0x60, 0x8E, 0x20, 0x01, 0x60, 0x81
+			DB 0x01, 0x84, 0x40, 0x01, 0x8F, 0x40, 0x02, 0x20
+			DB 0x40, 0x01, 0x84, 0x40, 0x00, 0x20, 0x90, 0x40
+			DB 0x05, 0x84, 0x20, 0x00, 0x20, 0x91, 0x40, 0x20
+			DB 0x03, 0x83, 0x60, 0x21, 0x40, 0x93, 0x60, 0x42
+			DB 0xD0
+; † 86
+			DB 0xAA, 0x60, 0x40, 0x23, 0x40, 0x60, 0x95, 0x60
+			DB 0x20, 0x07, 0x20, 0x60, 0x8D, 0x60, 0x83, 0x60
+			DB 0x0B, 0x40, 0x8B, 0x60, 0x00, 0x20, 0x81, 0x60
+			DB 0x20, 0x01, 0x20, 0x40, 0x01, 0x42, 0x03, 0x60
+			DB 0x8A, 0x20, 0x00, 0x40, 0x81, 0x40, 0x01, 0x40
+			DB 0x81, 0x01, 0x83, 0x20, 0x01, 0x40, 0x89, 0x20
+			DB 0x00, 0x20, 0x82, 0x01, 0x40, 0x82, 0x01, 0x84
+			DB 0x20, 0x01, 0x88, 0x40, 0x01, 0x60, 0x81, 0x60
+			DB 0x01, 0x60, 0x82, 0x01, 0x84, 0x40, 0x01, 0x88
+			DB 0x01, 0x40, 0x82, 0x40, 0x01, 0x83, 0x01, 0x84
+			DB 0x60, 0x01, 0x60, 0x87, 0x20, 0x01, 0x60, 0x81
+			DB 0x40, 0x01, 0x60, 0x82, 0x01, 0x85, 0x01, 0x40
+			DB 0x87, 0x60, 0x01, 0x20, 0x81, 0x60, 0x01, 0x40
+			DB 0x82, 0x01, 0x85, 0x01, 0x60, 0x88, 0x60, 0x01
+			DB 0x40, 0x81, 0x20, 0x01, 0x60, 0x81, 0x01, 0x84
+			DB 0x40, 0x01, 0x8A, 0x40, 0x00, 0x20, 0x81, 0x40
+			DB 0x02, 0x20, 0x40, 0x01, 0x84, 0x40, 0x00, 0x20
+			DB 0x8B, 0x40, 0x60, 0x82, 0x40, 0x05, 0x84, 0x20
+			DB 0x00, 0x20, 0x91, 0x40, 0x20, 0x03, 0x83, 0x60
+			DB 0x21, 0x40, 0x93, 0x60, 0x42, 0xD0
+; ‡ 87
+			DB 0xAD, 0x60, 0x41, 0x60, 0x97, 0x60, 0x40, 0x20
+			DB 0x04, 0x20, 0x40, 0x60, 0x93, 0x60, 0x09, 0x20
+			DB 0x60, 0x91, 0x60, 0x04, 0x21, 0x04, 0x20, 0x91
+			DB 0x02, 0x20, 0x40, 0x83, 0x60, 0x20, 0x02, 0x40
+			DB 0x8F, 0x40, 0x01, 0x20, 0x87, 0x40, 0x01, 0x20
+			DB 0x85, 0x60, 0x88, 0x20, 0x00, 0x20, 0x89, 0x20
+			DB 0x01, 0x84, 0x40, 0x00, 0x40, 0x87, 0x01, 0x40
+			DB 0x89, 0x40, 0x01, 0x60, 0x40, 0x20, 0x40, 0x20
+			DB 0x01, 0x40, 0x86, 0x60, 0x01, 0x60, 0x89, 0x60
+			DB 0x01, 0x41, 0x03, 0x20, 0x87, 0x40, 0x01, 0x8B
+			DB 0x01, 0x61, 0x02, 0x20, 0x60, 0x87, 0x60, 0x01
+			DB 0x60, 0x89, 0x60, 0x01, 0x81, 0x60, 0x40, 0x60
+			DB 0x8A, 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F, 0x01
+			DB 0x20, 0x89, 0x20, 0x00, 0x20, 0x8F, 0x20, 0x00
+			DB 0x20, 0x89, 0x20, 0x00, 0x20, 0x8F, 0x60, 0x8C
+			DB 0x61, 0xC8
+; ˆ 88
+			DB 0xB0, 0x40, 0x21, 0x40, 0x60, 0x90, 0x60, 0x20
+			DB 0x40, 0x60, 0x84, 0x20, 0x04, 0x60, 0x88, 0x61
+			DB 0x84, 0x40, 0x01, 0x60, 0x83, 0x20, 0x05, 0x20
+			DB 0x88, 0x00, 0x20, 0x84, 0x20, 0x00, 0x20, 0x83
+			DB 0x60, 0x01, 0x20, 0x41, 0x02, 0x88, 0x01, 0x40
+			DB 0x83, 0x01, 0x40, 0x83, 0x40, 0x00, 0x20, 0x82
+			DB 0x40, 0x01, 0x60, 0x87, 0x20, 0x01, 0x60, 0x82
+			DB 0x01, 0x60, 0x83, 0x20, 0x00, 0x40, 0x82, 0x60
+			DB 0x01, 0x60, 0x87, 0x60, 0x01, 0x20, 0x81, 0x60
+			DB 0x01, 0x84, 0x01, 0x60, 0x82, 0x60, 0x01, 0x89
+			DB 0x40, 0x01, 0x40, 0x80, 0x40, 0x01, 0x84, 0x01
+			DB 0x83, 0x40, 0x00, 0x20, 0x8A, 0x40, 0x00, 0x20
+			DB 0x80, 0x60, 0x01, 0x40, 0x82, 0x60, 0x00, 0x20
+			DB 0x83, 0x20, 0x00, 0x40, 0x8B, 0x40, 0x60, 0x81
+			DB 0x01, 0x20, 0x82, 0x40, 0x00, 0x20, 0x81, 0x60
+			DB 0x20, 0x00, 0x20, 0x90, 0x20, 0x01, 0x20, 0x42
+			DB 0x00, 0x20, 0x41, 0x01, 0x20, 0x91, 0x40, 0x0E
+			DB 0x90, 0x40, 0x0D, 0x91, 0x60, 0x40, 0x2B, 0xE8
+; ‰ 89
+			DB 0xB0, 0x40, 0x21, 0x40, 0x60, 0x90, 0x60, 0x20
+			DB 0x40, 0x60, 0x84, 0x20, 0x04, 0x60, 0x8F, 0x40
+			DB 0x01, 0x60, 0x83, 0x20, 0x05, 0x20, 0x8F, 0x20
+			DB 0x00, 0x20, 0x83, 0x60, 0x01, 0x20, 0x41, 0x02
+			DB 0x8F, 0x01, 0x40, 0x83, 0x40, 0x00, 0x20, 0x82
+			DB 0x40, 0x01, 0x60, 0x8A, 0x40, 0x60, 0x81, 0x01
+			DB 0x60, 0x83, 0x20, 0x00, 0x40, 0x82, 0x60, 0x01
+			DB 0x60, 0x89, 0x40, 0x00, 0x20, 0x80, 0x60, 0x01
+			DB 0x84, 0x01, 0x60, 0x82, 0x60, 0x01, 0x89, 0x40
+			DB 0x01, 0x40, 0x80, 0x40, 0x01, 0x84, 0x01, 0x83
+			DB 0x40, 0x00, 0x20, 0x88, 0x60, 0x01, 0x20, 0x81
+			DB 0x60, 0x01, 0x40, 0x82, 0x60, 0x00, 0x20, 0x83
+			DB 0x20, 0x00, 0x40, 0x88, 0x20, 0x01, 0x60, 0x82
+			DB 0x01, 0x20, 0x82, 0x40, 0x00, 0x20, 0x81, 0x60
+			DB 0x20, 0x00, 0x20, 0x89, 0x01, 0x40, 0x83, 0x20
+			DB 0x01, 0x20, 0x42, 0x00, 0x20, 0x41, 0x01, 0x20
+			DB 0x8A, 0x00, 0x20, 0x84, 0x40, 0x0E, 0x88, 0x61
+			DB 0x85, 0x40, 0x0D, 0x91, 0x60, 0x40, 0x2B, 0xE8
+; Š 8A
+			DB 0xB3, 0x60, 0x41, 0x8F, 0x21, 0x60, 0x89, 0x40
+			DB 0x01, 0x8F, 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F
+			DB 0x01, 0x40, 0x89, 0x40, 0x01, 0x8F, 0x01, 0x40
+			DB 0x89, 0x40, 0x01, 0x8B, 0x40, 0x60, 0x81, 0x01
+			DB 0x40, 0x89, 0x40, 0x01, 0x8A, 0x40, 0x00, 0x20
+			DB 0x81, 0x01, 0x4B, 0x01, 0x89, 0x40, 0x01, 0x40
+			DB 0x81, 0x0F, 0x88, 0x60, 0x01, 0x20, 0x82, 0x0F
+			DB 0x88, 0x20, 0x01, 0x60, 0x82, 0x2D, 0x01, 0x88
+			DB 0x01, 0x40, 0x90, 0x40, 0x01, 0x88, 0x00, 0x20
+			DB 0x91, 0x40, 0x01, 0x88, 0x61, 0x91, 0x40, 0x01
+			DB 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0xC8
+; ‹ 8B
+			DB 0xAA, 0x40, 0x21, 0x02, 0x21, 0x60, 0x94, 0x60
+			DB 0x20, 0x08, 0x20, 0x92, 0x60, 0x0B, 0x20, 0x91
+			DB 0x20, 0x01, 0x20, 0x40, 0x60, 0x81, 0x60, 0x40
+			DB 0x20, 0x02, 0x40, 0x8F, 0x40, 0x01, 0x40, 0x87
+			DB 0x40, 0x01, 0x20, 0x8B, 0x40, 0x60, 0x81, 0x20
+			DB 0x00, 0x20, 0x89, 0x40, 0x01, 0x8A, 0x40, 0x00
+			DB 0x20, 0x81, 0x01, 0x60, 0x89, 0x60, 0x01, 0x60
+			DB 0x88, 0x40, 0x01, 0x40, 0x80, 0x40, 0x01, 0x8B
+			DB 0x01, 0x40, 0x87, 0x60, 0x01, 0x20, 0x81, 0x60
+			DB 0x01, 0x60, 0x89, 0x60, 0x01, 0x60, 0x87, 0x20
+			DB 0x01, 0x60, 0x82, 0x01, 0x40, 0x89, 0x40, 0x01
+			DB 0x88, 0x01, 0x40, 0x83, 0x20, 0x01, 0x60, 0x87
+			DB 0x60, 0x01, 0x40, 0x88, 0x00, 0x20, 0x84, 0x40
+			DB 0x02, 0x40, 0x60, 0x83, 0x60, 0x40, 0x02, 0x60
+			DB 0x88, 0x61, 0x85, 0x20, 0x03, 0x22, 0x04, 0x60
+			DB 0x91, 0x60, 0x20, 0x09, 0x40, 0x94, 0x40, 0x20
+			DB 0x04, 0x20, 0x40, 0x60, 0x98, 0x60, 0x41, 0xAF
+; Π8C
+			DB 0xC6, 0x0C, 0x20, 0x60, 0x90, 0x0E, 0x60, 0x8F
+			DB 0x0E, 0x20, 0x9B, 0x40, 0x02, 0x8B, 0x40, 0x60
+			DB 0x8E, 0x40, 0x01, 0x60, 0x89, 0x40, 0x00, 0x20
+			DB 0x8F, 0x01, 0x60, 0x88, 0x40, 0x01, 0x40, 0x8E
+			DB 0x60, 0x01, 0x88, 0x60, 0x01, 0x20, 0x8F, 0x20
+			DB 0x00, 0x20, 0x88, 0x20, 0x01, 0x60, 0x8E, 0x40
+			DB 0x01, 0x60, 0x88, 0x01, 0x40, 0x8D, 0x40, 0x20
+			DB 0x01, 0x60, 0x89, 0x00, 0x20, 0x84, 0x28, 0x03
+			DB 0x20, 0x41, 0x88, 0x61, 0x84, 0x0F, 0x8F, 0x0F
+			DB 0x8F, 0x4F, 0xC8
+;  8D
+			DB 0xC6, 0x0F, 0x89, 0x60, 0x20, 0x60, 0x82, 0x0F
+			DB 0x88, 0x40, 0x01, 0x20, 0x82, 0x22, 0x05, 0x26
+			DB 0x88, 0x20, 0x00, 0x20, 0x84, 0x60, 0x20, 0x01
+			DB 0x40, 0x60, 0x91, 0x01, 0x40, 0x83, 0x60, 0x01
+			DB 0x20, 0x94, 0x20, 0x00, 0x20, 0x83, 0x20, 0x00
+			DB 0x20, 0x95, 0x40, 0x01, 0x40, 0x82, 0x01, 0x40
+			DB 0x96, 0x40, 0x01, 0x81, 0x60, 0x01, 0x98, 0x01
+			DB 0x40, 0x80, 0x40, 0x01, 0x60, 0x96, 0x40, 0x01
+			DB 0x82, 0x01, 0x20, 0x60, 0x94, 0x40, 0x01, 0x40
+			DB 0x82, 0x20, 0x02, 0x2B, 0x88, 0x60, 0x20, 0x40
+			DB 0x83, 0x40, 0x0E, 0x90, 0x40, 0x0D, 0x92, 0x60
+			DB 0x4B, 0xC8
+; Ž 8E
+			DB 0xFF, 0xC6, 0x60, 0x41, 0x9C, 0x02, 0x20, 0x80
+			DB 0x60, 0x44, 0x28, 0x01, 0x20, 0x87, 0x40, 0x03
+			DB 0x80, 0x40, 0x0F, 0x20, 0x87, 0x60, 0x02, 0x20
+			DB 0x80, 0x40, 0x0F, 0x20, 0x88, 0x40, 0x21, 0x60
+			DB 0x86, 0x60, 0x4A, 0xFF, 0xE1
+;  8F
+			DB 0xF4, 0x40, 0x20, 0x01, 0x20, 0x60, 0x98, 0x20
+			DB 0x05, 0x60, 0x96, 0x20, 0x07, 0x60, 0x94, 0x20
+			DB 0x02, 0x42, 0x02, 0x40, 0x8A, 0x40, 0x60, 0x86
+			DB 0x20, 0x01, 0x20, 0x60, 0x82, 0x60, 0x02, 0x89
+			DB 0x20, 0x01, 0x40, 0x80, 0x60, 0x42, 0x20, 0x02
+			DB 0x60, 0x84, 0x20, 0x01, 0x60, 0x87, 0x40, 0x03
+			DB 0x80, 0x40, 0x05, 0x60, 0x85, 0x60, 0x01, 0x40
+			DB 0x87, 0x60, 0x02, 0x20, 0x80, 0x40, 0x04, 0x60
+			DB 0x87, 0x01, 0x40, 0x88, 0x40, 0x21, 0x60, 0x80
+			DB 0x60, 0x40, 0x21, 0x40, 0x89, 0x20, 0x00, 0x20
+			DB 0x9C, 0x20, 0x00, 0x20, 0x9C, 0x41, 0x60, 0xFF
+			DB 0x81
+;  90
+			DB 0xFF, 0x99, 0x40, 0x20, 0x00, 0x9A, 0x60, 0x20
+			DB 0x01, 0x20, 0x8C, 0x40, 0x8B, 0x40, 0x01, 0x20
+			DB 0x00, 0x60, 0x8B, 0x60, 0x00, 0x40, 0x88, 0x60
+			DB 0x01, 0x21, 0x00, 0x60, 0x8B, 0x60, 0x01, 0x20
+			DB 0x86, 0x60, 0x40, 0x00, 0x40, 0x21, 0x00, 0x20
+			DB 0x8C, 0x00, 0x20, 0x60, 0x00, 0x84, 0x60, 0x40
+			DB 0x01, 0x40, 0x22, 0x00, 0x60, 0x8B, 0x60, 0x00
+			DB 0x61, 0x00, 0x40, 0x81, 0x60, 0x40, 0x01, 0x20
+			DB 0x40, 0x22, 0x00, 0x40, 0x8C, 0x20, 0x00, 0x61
+			DB 0x00, 0x20, 0x60, 0x20, 0x01, 0x20, 0x41, 0x22
+			DB 0x00, 0x20, 0x8C, 0x60, 0x00, 0x40, 0x61, 0x40
+			DB 0x02, 0x20, 0x42, 0x23, 0x00, 0x60, 0x8C, 0x40
+			DB 0x00, 0x63, 0x45, 0x23, 0x00, 0x20, 0x8D, 0x00
+			DB 0x20, 0x64, 0x43, 0x24, 0x00, 0x60, 0x8C, 0x60
+			DB 0x00, 0x40, 0x64, 0x42, 0x24, 0x00, 0x20, 0x8D
+			DB 0x60, 0x00, 0x66, 0x40, 0x25, 0x00, 0x60, 0x8D
+			DB 0x20, 0x00, 0x65, 0x41, 0x26, 0x89
+; ‘ 91
+			DB 0x84, 0x20, 0x00, 0x64, 0x43, 0x23, 0x00, 0x40
+			DB 0x8E, 0x00, 0x40, 0x64, 0x44, 0x22, 0x00, 0x60
+			DB 0x8E, 0x00, 0x64, 0x46, 0x21, 0x00, 0x40, 0x8E
+			DB 0x00, 0x63, 0x48, 0x21, 0x01, 0x60, 0x8C, 0x00
+			DB 0x62, 0x4B, 0x21, 0x00, 0x20, 0x40, 0x8A, 0x00
+			DB 0x61, 0x4D, 0x20, 0x01, 0x40, 0x8A, 0x00, 0x60
+			DB 0x4C, 0x20, 0x01, 0x40, 0x60, 0x8B, 0x00, 0x4A
+			DB 0x20, 0x02, 0x20, 0x60, 0x8D, 0x02, 0x25, 0x03
+			DB 0x20, 0x40, 0x60, 0x8F, 0x60, 0x40, 0x20, 0x05
+			DB 0x20, 0x41, 0x60, 0xFF, 0xFF, 0x8D
+; ’ 92
+			DB 0x8C, 0x04, 0x9A, 0x04, 0x9A, 0x04, 0x9A, 0x04
+			DB 0x9A, 0x04, 0x9A, 0x04, 0x92, 0x20, 0x12, 0x20
+			DB 0x8B, 0x20, 0x10, 0x20, 0x8D, 0x20, 0x0E, 0x20
+			DB 0x8F, 0x20, 0x0C, 0x20, 0x91, 0x20, 0x0A, 0x20
+			DB 0x93, 0x20, 0x08, 0x20, 0x95, 0x20, 0x06, 0x20
+			DB 0x97, 0x20, 0x04, 0x20, 0x99, 0x20, 0x02, 0x20
+			DB 0x9B, 0x20, 0x00, 0x20, 0x9D, 0x20, 0xAF
+; “ 93
+			DB 0x8C, 0x01, 0x40, 0x83, 0x20, 0x01, 0x40, 0x94
+			DB 0x01, 0x40, 0x83, 0x40, 0x02, 0x40, 0x93, 0x01
+			DB 0x40, 0x84, 0x40, 0x02, 0x40, 0x92, 0x01, 0x40
+			DB 0x85, 0x40, 0x02, 0x40, 0x91, 0x01, 0x40, 0x86
+			DB 0x60, 0x02, 0x40, 0x90, 0x01, 0x40, 0x87, 0x60
+			DB 0x02, 0x40, 0x8F, 0x01, 0x40, 0x88, 0x60, 0x02
+			DB 0x40, 0x8E, 0x01, 0x2A, 0x03, 0x60, 0x8D, 0x11
+			DB 0x60, 0x8C, 0x2C, 0x03, 0x60, 0x99, 0x60, 0x02
+			DB 0x40, 0x99, 0x60, 0x02, 0x40, 0x99, 0x60, 0x02
+			DB 0x40, 0x99, 0x40, 0x02, 0x40, 0x99, 0x40, 0x02
+			DB 0x40, 0x99, 0x40, 0x02, 0x40, 0x9A, 0x20, 0x01
+			DB 0x40, 0x9B, 0x60, 0x20, 0x40, 0x88
+; ” 94
+			DB 0x86, 0x60, 0x20, 0x01, 0x40, 0x82, 0x20, 0x01
+			DB 0x93, 0x60, 0x20, 0x01, 0x20, 0x60, 0x82, 0x20
+			DB 0x01, 0x92, 0x60, 0x20, 0x01, 0x20, 0x60, 0x83
+			DB 0x20, 0x01, 0x91, 0x60, 0x20, 0x01, 0x20, 0x60
+			DB 0x84, 0x20, 0x01, 0x90, 0x60, 0x20, 0x01, 0x20
+			DB 0x86, 0x20, 0x01, 0x8F, 0x60, 0x20, 0x01, 0x20
+			DB 0x87, 0x20, 0x01, 0x8F, 0x20, 0x01, 0x20, 0x88
+			DB 0x20, 0x01, 0x8E, 0x20, 0x02, 0x2A, 0x01, 0x8D
+			DB 0x40, 0x10, 0x8E, 0x20, 0x02, 0x2C, 0x8F, 0x20
+			DB 0x01, 0x20, 0x9B, 0x60, 0x20, 0x01, 0x20, 0x9B
+			DB 0x60, 0x20, 0x01, 0x20, 0x9B, 0x60, 0x20, 0x01
+			DB 0x20, 0x60, 0x9A, 0x60, 0x20, 0x01, 0x20, 0x60
+			DB 0x9A, 0x60, 0x20, 0x01, 0x20, 0x60, 0x9A, 0x60
+			DB 0x20, 0x01, 0x40, 0x9B, 0x60, 0x20, 0x40, 0x94
+; • 95
+			DB 0x8C, 0x40, 0x00, 0x60, 0x9B, 0x60, 0x01, 0x20
+			DB 0x9B, 0x20, 0x02, 0x20, 0x98, 0x60, 0x20, 0x04
+			DB 0x20, 0x60, 0x95, 0x40, 0x01, 0x21, 0x00, 0x21
+			DB 0x01, 0x40, 0x94, 0x20, 0x00, 0x40, 0x80, 0x20
+			DB 0x00, 0x20, 0x80, 0x40, 0x00, 0x20, 0x94, 0x61
+			DB 0x81, 0x20, 0x00, 0x20, 0x81, 0x61, 0x98, 0x20
+			DB 0x00, 0x20, 0x9C, 0x20, 0x00, 0x20, 0x9C, 0x20
+			DB 0x00, 0x20, 0x9C, 0x20, 0x00, 0x20, 0x98, 0x41
+			DB 0x81, 0x20, 0x00, 0x20, 0x81, 0x41, 0x94, 0x20
+			DB 0x00, 0x20, 0x60, 0x20, 0x00, 0x20, 0x60, 0x20
+			DB 0x00, 0x20, 0x94, 0x60, 0x20, 0x01, 0x20, 0x00
+			DB 0x20, 0x01, 0x20, 0x60, 0x96, 0x40, 0x04, 0x40
+			DB 0x99, 0x40, 0x02, 0x40, 0x9B, 0x20, 0x00, 0x20
+			DB 0x9C, 0x40, 0x00, 0x60, 0x8F
+; – 96
+			DB 0xA3, 0x41, 0x8C, 0x41, 0x8D, 0x60, 0x01, 0x40
+			DB 0x83, 0x60, 0x41, 0x83, 0x40, 0x01, 0x60, 0x8C
+			DB 0x40, 0x02, 0x20, 0x60, 0x40, 0x04, 0x20, 0x40
+			DB 0x20, 0x02, 0x40, 0x8D, 0x40, 0x0E, 0x40, 0x8F
+			DB 0x60, 0x20, 0x02, 0x20, 0x42, 0x20, 0x02, 0x20
+			DB 0x60, 0x91, 0x60, 0x01, 0x40, 0x84, 0x40, 0x01
+			DB 0x60, 0x92, 0x40, 0x01, 0x86, 0x01, 0x40, 0x92
+			DB 0x40, 0x00, 0x20, 0x86, 0x20, 0x00, 0x40, 0x92
+			DB 0x40, 0x01, 0x86, 0x01, 0x40, 0x92, 0x60, 0x01
+			DB 0x40, 0x84, 0x40, 0x01, 0x60, 0x92, 0x40, 0x02
+			DB 0x20, 0x42, 0x20, 0x02, 0x40, 0x90, 0x60, 0x20
+			DB 0x0C, 0x20, 0x60, 0x8D, 0x40, 0x03, 0x40, 0x20
+			DB 0x04, 0x41, 0x03, 0x40, 0x8C, 0x40, 0x01, 0x20
+			DB 0x60, 0x82, 0x41, 0x60, 0x82, 0x60, 0x20, 0x01
+			DB 0x40, 0x8D, 0x40, 0x20, 0x60, 0x8A, 0x60, 0x20
+			DB 0x40, 0xCA
+; TOTAL COMPRESSED SIZE = 11471
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font34_idx.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,128 @@
+;==========================================================================
+; Font index exported mar. nov. 20 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font34_chars		EQU	.119
+aa_font34_firstChar	EQU	' '
+aa_font34_lastChar	EQU	'–'
+;
+aa_font34_idx:
+			DW	aa_font34_bits + 0x0000	;   Space
+			DW	aa_font34_bits + 0x0005	; ! mark
+			DW	aa_font34_bits + 0x0031	; " dquote
+			DW	aa_font34_bits + 0x0077	; # sharp
+			DW	aa_font34_bits + 0x0104	; $ dolar
+			DW	aa_font34_bits + 0x019B	; % percent
+			DW	aa_font34_bits + 0x025C	; & and
+			DW	aa_font34_bits + 0x02F6	; ' quote
+			DW	aa_font34_bits + 0x0321	; ( lparent
+			DW	aa_font34_bits + 0x0376	; ) rparent
+			DW	aa_font34_bits + 0x03CD	; * star
+			DW	aa_font34_bits + 0x042E	; + plus
+			DW	aa_font34_bits + 0x0472	; , comma
+			DW	aa_font34_bits + 0x04A0	; - minus
+			DW	aa_font34_bits + 0x04C1	; . dot
+			DW	aa_font34_bits + 0x04DE	; / slash
+			DW	aa_font34_bits + 0x0532	; 0 0
+			DW	aa_font34_bits + 0x05A7	; 1 1
+			DW	aa_font34_bits + 0x05F3	; 2 2
+			DW	aa_font34_bits + 0x066D	; 3 3
+			DW	aa_font34_bits + 0x06F9	; 4 4
+			DW	aa_font34_bits + 0x0763	; 5 5
+			DW	aa_font34_bits + 0x07E5	; 6 6
+			DW	aa_font34_bits + 0x0872	; 7 7
+			DW	aa_font34_bits + 0x08DC	; 8 8
+			DW	aa_font34_bits + 0x0986	; 9 9
+			DW	aa_font34_bits + 0x0A19	; : colon
+			DW	aa_font34_bits + 0x0A48	; ; semicolon
+			DW	aa_font34_bits + 0x0A89	; < less
+			DW	aa_font34_bits + 0x0AE8	; = equal
+			DW	aa_font34_bits + 0x0B4F	; > greater
+			DW	aa_font34_bits + 0x0BAB	; ? question
+			DW	aa_font34_bits + 0x0C0C	; @ arobas
+			DW	aa_font34_bits + 0x0CC9	; A A
+			DW	aa_font34_bits + 0x0D45	; B B
+			DW	aa_font34_bits + 0x0DCE	; C C
+			DW	aa_font34_bits + 0x0E3A	; D D
+			DW	aa_font34_bits + 0x0EAE	; E E
+			DW	aa_font34_bits + 0x0F18	; F F
+			DW	aa_font34_bits + 0x0F66	; G G
+			DW	aa_font34_bits + 0x0FE1	; H H
+			DW	aa_font34_bits + 0x1014	; I I
+			DW	aa_font34_bits + 0x1064	; J J
+			DW	aa_font34_bits + 0x10B3	; K K
+			DW	aa_font34_bits + 0x1112	; L L
+			DW	aa_font34_bits + 0x113A	; M M
+			DW	aa_font34_bits + 0x119A	; N N
+			DW	aa_font34_bits + 0x11DC	; O O
+			DW	aa_font34_bits + 0x125D	; P P
+			DW	aa_font34_bits + 0x12B3	; Q Q
+			DW	aa_font34_bits + 0x1343	; R R
+			DW	aa_font34_bits + 0x13B9	; S S
+			DW	aa_font34_bits + 0x143A	; T T
+			DW	aa_font34_bits + 0x1478	; U U
+			DW	aa_font34_bits + 0x14BE	; V V
+			DW	aa_font34_bits + 0x1526	; W W
+			DW	aa_font34_bits + 0x1586	; X X
+			DW	aa_font34_bits + 0x160F	; Y Y
+			DW	aa_font34_bits + 0x1663	; Z Z
+			DW	aa_font34_bits + 0x16E8	; [ lsqbracket
+			DW	aa_font34_bits + 0x1718	; \ backslash
+			DW	aa_font34_bits + 0x176A	; ] rsqbracket
+			DW	aa_font34_bits + 0x179A	; ^ caret
+			DW	aa_font34_bits + 0x17DD	; _ underline
+			DW	aa_font34_bits + 0x1813	; ` backquote
+			DW	aa_font34_bits + 0x1830	; a a
+			DW	aa_font34_bits + 0x18A5	; b b
+			DW	aa_font34_bits + 0x1901	; c c
+			DW	aa_font34_bits + 0x1966	; d d
+			DW	aa_font34_bits + 0x19C4	; e e
+			DW	aa_font34_bits + 0x1A3A	; f f
+			DW	aa_font34_bits + 0x1A95	; g g
+			DW	aa_font34_bits + 0x1B56	; h h
+			DW	aa_font34_bits + 0x1B89	; i i
+			DW	aa_font34_bits + 0x1BD7	; j j
+			DW	aa_font34_bits + 0x1C37	; k k
+			DW	aa_font34_bits + 0x1C85	; l l
+			DW	aa_font34_bits + 0x1CC3	; m m
+			DW	aa_font34_bits + 0x1D08	; n n
+			DW	aa_font34_bits + 0x1D3A	; o o
+			DW	aa_font34_bits + 0x1DA7	; p p
+			DW	aa_font34_bits + 0x1E00	; q q
+			DW	aa_font34_bits + 0x1E5B	; r r
+			DW	aa_font34_bits + 0x1EB4	; s s
+			DW	aa_font34_bits + 0x1F27	; t t
+			DW	aa_font34_bits + 0x1F74	; u u
+			DW	aa_font34_bits + 0x1FA4	; v v
+			DW	aa_font34_bits + 0x1FF3	; w w
+			DW	aa_font34_bits + 0x2046	; x x
+			DW	aa_font34_bits + 0x20B9	; y y
+			DW	aa_font34_bits + 0x2125	; z z
+			DW	aa_font34_bits + 0x218E	; { lbrace
+			DW	aa_font34_bits + 0x21E5	; | bar
+			DW	aa_font34_bits + 0x21F0	; } rbrace
+			DW	aa_font34_bits + 0x224A	; ~ tilde
+			DW	aa_font34_bits + 0x2289	;  7F
+			DW	aa_font34_bits + 0x22D6	; € 80
+			DW	aa_font34_bits + 0x235F	;  81
+			DW	aa_font34_bits + 0x23F0	; ‚ 82
+			DW	aa_font34_bits + 0x243C	; ƒ 83
+			DW	aa_font34_bits + 0x24B3	; „ 84
+			DW	aa_font34_bits + 0x2544	; … 85
+			DW	aa_font34_bits + 0x25D5	; † 86
+			DW	aa_font34_bits + 0x2673	; ‡ 87
+			DW	aa_font34_bits + 0x26ED	; ˆ 88
+			DW	aa_font34_bits + 0x277D	; ‰ 89
+			DW	aa_font34_bits + 0x280D	; Š 8A
+			DW	aa_font34_bits + 0x2864	; ‹ 8B
+			DW	aa_font34_bits + 0x28EC	; Π8C
+			DW	aa_font34_bits + 0x2937	;  8D
+			DW	aa_font34_bits + 0x2991	; Ž 8E
+			DW	aa_font34_bits + 0x29B6	;  8F
+			DW	aa_font34_bits + 0x2A0F	;  90
+			DW	aa_font34_bits + 0x2A95	; ‘ 91
+			DW	aa_font34_bits + 0x2AE3	; ’ 92
+			DW	aa_font34_bits + 0x2B1A	; “ 93
+			DW	aa_font34_bits + 0x2B78	; ” 94
+			DW	aa_font34_bits + 0x2BE8	; • 95
+			DW	aa_font34_bits + 0x2C55	; – 96
+			DW	aa_font34_bits + 0x2CCF	; END OF INDEX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font36.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,1741 @@
+;==========================================================================
+; Font data exported ven. nov. 16 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font36_height	EQU	.32
+aa_font36_width		EQU	.20
+aa_font36_nbbits	EQU	.3
+;
+aa_font36_bits:
+;   Space
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+; ! mark
+			DB 0xFF, 0xF8, 0x41, 0x86, 0x40, 0x02, 0x28, 0x45
+			DB 0x60, 0x81, 0x02, 0x20, 0x85, 0x40, 0x11, 0x40
+			DB 0x80, 0x40, 0x03, 0x60, 0x84, 0x40, 0x11, 0x40
+			DB 0x80, 0x40, 0x03, 0x60, 0x84, 0x40, 0x22, 0x49
+			DB 0x65, 0x81, 0x20, 0x01, 0x40, 0x9C, 0x61, 0xFF
+			DB 0xE4
+; " dquote
+			DB 0x8A, 0x60, 0x9E, 0x20, 0x00, 0x60, 0x9B, 0x60
+			DB 0x01, 0x94, 0x60, 0x21, 0x60, 0x82, 0x60, 0x01
+			DB 0x40, 0x93, 0x60, 0x03, 0x40, 0x60, 0x40, 0x01
+			DB 0x20, 0x94, 0x40, 0x08, 0x60, 0x94, 0x60, 0x07
+			DB 0x40, 0x96, 0x40, 0x04, 0x20, 0x60, 0x98, 0x60
+			DB 0x42, 0x60, 0xA2, 0x61, 0x9D, 0x20, 0x00, 0x60
+			DB 0x9B, 0x40, 0x00, 0x20, 0x94, 0x40, 0x01, 0x40
+			DB 0x82, 0x40, 0x01, 0x40, 0x93, 0x60, 0x03, 0x20
+			DB 0x40, 0x20, 0x01, 0x20, 0x94, 0x40, 0x07, 0x20
+			DB 0x95, 0x60, 0x06, 0x20, 0x97, 0x40, 0x03, 0x20
+			DB 0x40, 0x9A, 0x62, 0xD8
+; # sharp
+			DB 0x91, 0x60, 0x01, 0x93, 0x60, 0x01, 0x85, 0x60
+			DB 0x01, 0x93, 0x60, 0x01, 0x85, 0x60, 0x01, 0x93
+			DB 0x60, 0x01, 0x85, 0x60, 0x01, 0x83, 0x61, 0x40
+			DB 0x8C, 0x60, 0x01, 0x82, 0x62, 0x40, 0x01, 0x21
+			DB 0x04, 0x89, 0x61, 0x41, 0x01, 0x20, 0x0E, 0x86
+			DB 0x60, 0x10, 0x22, 0x42, 0x60, 0x86, 0x60, 0x07
+			DB 0x21, 0x42, 0x60, 0x40, 0x01, 0x8D, 0x60, 0x20
+			DB 0x42, 0x60, 0x40, 0x01, 0x85, 0x60, 0x01, 0x93
+			DB 0x60, 0x01, 0x85, 0x60, 0x01, 0x93, 0x60, 0x01
+			DB 0x85, 0x60, 0x01, 0x93, 0x60, 0x01, 0x85, 0x60
+			DB 0x01, 0x42, 0x21, 0x01, 0x8C, 0x40, 0x01, 0x41
+			DB 0x21, 0x0B, 0x86, 0x60, 0x40, 0x21, 0x11, 0x21
+			DB 0x40, 0x86, 0x60, 0x0A, 0x22, 0x40, 0x01, 0x61
+			DB 0x8B, 0x60, 0x01, 0x21, 0x41, 0x01, 0x60, 0x84
+			DB 0x60, 0x01, 0x93, 0x60, 0x01, 0x85, 0x60, 0x01
+			DB 0x93, 0x60, 0x01, 0x85, 0x60, 0x01, 0x93, 0x60
+			DB 0x01, 0x85, 0x60, 0x21, 0x93, 0x60, 0x21, 0x93
+; $ dolar
+			DB 0xA8, 0x62, 0x99, 0x60, 0x40, 0x03, 0x20, 0x60
+			DB 0x89, 0x41, 0x20, 0x40, 0x88, 0x60, 0x07, 0x40
+			DB 0x88, 0x40, 0x01, 0x20, 0x87, 0x60, 0x09, 0x60
+			DB 0x88, 0x02, 0x87, 0x40, 0x01, 0x20, 0x60, 0x81
+			DB 0x40, 0x02, 0x20, 0x88, 0x20, 0x01, 0x60, 0x86
+			DB 0x01, 0x20, 0x84, 0x40, 0x02, 0x40, 0x87, 0x40
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x40, 0x85, 0x20
+			DB 0x01, 0x20, 0x87, 0x40, 0x01, 0x40, 0x60, 0x41
+			DB 0x82, 0x40, 0x01, 0x40, 0x63, 0x41, 0x20, 0x02
+			DB 0x23, 0x0A, 0x21, 0x1F, 0x0F, 0x21, 0x44, 0x20
+			DB 0x01, 0x40, 0x60, 0x81, 0x42, 0x20, 0x01, 0x63
+			DB 0x83, 0x40, 0x02, 0x86, 0x20, 0x01, 0x86, 0x40
+			DB 0x01, 0x60, 0x86, 0x60, 0x02, 0x40, 0x84, 0x60
+			DB 0x01, 0x20, 0x86, 0x60, 0x01, 0x60, 0x87, 0x40
+			DB 0x02, 0x40, 0x60, 0x81, 0x40, 0x02, 0x60, 0x86
+			DB 0x60, 0x01, 0x40, 0x87, 0x60, 0x09, 0x20, 0x88
+			DB 0x41, 0x60, 0x88, 0x40, 0x07, 0x20, 0x96, 0x60
+			DB 0x20, 0x04, 0x40, 0x99, 0x60, 0x41, 0x60, 0xC8
+; % percent
+			DB 0x83, 0x40, 0x20, 0x02, 0x20, 0x40, 0x8E, 0x40
+			DB 0x60, 0x86, 0x20, 0x06, 0x40, 0x8B, 0x60, 0x20
+			DB 0x00, 0x20, 0x85, 0x20, 0x01, 0x23, 0x02, 0x60
+			DB 0x89, 0x40, 0x03, 0x60, 0x83, 0x60, 0x01, 0x60
+			DB 0x84, 0x20, 0x00, 0x40, 0x87, 0x60, 0x20, 0x02
+			DB 0x20, 0x60, 0x84, 0x40, 0x00, 0x40, 0x85, 0x60
+			DB 0x00, 0x20, 0x86, 0x40, 0x03, 0x40, 0x86, 0x40
+			DB 0x00, 0x40, 0x85, 0x60, 0x00, 0x20, 0x84, 0x60
+			DB 0x20, 0x02, 0x20, 0x60, 0x87, 0x60, 0x01, 0x60
+			DB 0x83, 0x60, 0x20, 0x00, 0x40, 0x83, 0x40, 0x03
+			DB 0x40, 0x8A, 0x02, 0x23, 0x02, 0x82, 0x60, 0x20
+			DB 0x02, 0x20, 0x60, 0x8B, 0x40, 0x07, 0x60, 0x81
+			DB 0x60, 0x03, 0x40, 0x8E, 0x60, 0x40, 0x20, 0x01
+			DB 0x20, 0x40, 0x82, 0x20, 0x02, 0x20, 0x60, 0x82
+			DB 0x62, 0x91, 0x60, 0x03, 0x40, 0x81, 0x60, 0x20
+			DB 0x04, 0x40, 0x8E, 0x20, 0x02, 0x20, 0x60, 0x81
+			DB 0x60, 0x07, 0x40, 0x8B, 0x60, 0x03, 0x40, 0x83
+			DB 0x01, 0x20, 0x40, 0x61, 0x40, 0x20, 0x01, 0x60
+			DB 0x89, 0x20, 0x02, 0x20, 0x60, 0x83, 0x60, 0x00
+			DB 0x20, 0x85, 0x20, 0x00, 0x40, 0x87, 0x60, 0x03
+			DB 0x40, 0x85, 0x40, 0x00, 0x40, 0x85, 0x20, 0x00
+			DB 0x40, 0x86, 0x20, 0x02, 0x20, 0x60, 0x86, 0x40
+			DB 0x00, 0x40, 0x85, 0x20, 0x00, 0x60, 0x84, 0x60
+			DB 0x03, 0x40, 0x88, 0x60, 0x01, 0x40, 0x82, 0x60
+			DB 0x20, 0x01, 0x85, 0x02, 0x20, 0x60, 0x8A, 0x08
+			DB 0x40, 0x85, 0x60, 0x00, 0x40, 0x8C, 0x60, 0x06
+			DB 0x40, 0x87, 0x60, 0x8F, 0x41, 0x21, 0x40, 0x60
+			DB 0x85
+; & and
+			DB 0x92, 0x60, 0x42, 0x60, 0x8D, 0x61, 0x88, 0x60
+			DB 0x20, 0x05, 0x40, 0x88, 0x60, 0x20, 0x03, 0x40
+			DB 0x85, 0x40, 0x08, 0x20, 0x86, 0x60, 0x07, 0x40
+			DB 0x82, 0x40, 0x03, 0x22, 0x03, 0x40, 0x85, 0x20
+			DB 0x08, 0x40, 0x80, 0x40, 0x02, 0x40, 0x60, 0x82
+			DB 0x60, 0x20, 0x01, 0x20, 0x84, 0x60, 0x01, 0x20
+			DB 0x60, 0x80, 0x60, 0x40, 0x03, 0x20, 0x02, 0x60
+			DB 0x86, 0x02, 0x60, 0x83, 0x40, 0x01, 0x84, 0x60
+			DB 0x20, 0x04, 0x60, 0x87, 0x40, 0x01, 0x60, 0x83
+			DB 0x20, 0x00, 0x20, 0x86, 0x20, 0x02, 0x40, 0x88
+			DB 0x40, 0x01, 0x60, 0x83, 0x20, 0x00, 0x20, 0x85
+			DB 0x60, 0x04, 0x60, 0x87, 0x40, 0x01, 0x84, 0x40
+			DB 0x01, 0x60, 0x83, 0x60, 0x06, 0x60, 0x86, 0x01
+			DB 0x20, 0x84, 0x40, 0x01, 0x20, 0x40, 0x60, 0x40
+			DB 0x20, 0x02, 0x40, 0x60, 0x03, 0x60, 0x84, 0x40
+			DB 0x01, 0x40, 0x85, 0x08, 0x40, 0x81, 0x60, 0x02
+			DB 0x20, 0x83, 0x40, 0x01, 0x20, 0x86, 0x40, 0x06
+			DB 0x40, 0x83, 0x60, 0x03, 0x61, 0x20, 0x02, 0x60
+			DB 0x87, 0x60, 0x20, 0x01, 0x20, 0x40, 0x60, 0x85
+			DB 0x40, 0x07, 0x40, 0x95, 0x60, 0x20, 0x04, 0x20
+			DB 0x60, 0x92, 0x40, 0x21, 0x08, 0x40, 0x60, 0x91
+			DB 0x20, 0x0D, 0x20, 0x8F, 0x20, 0x02, 0x20, 0x41
+			DB 0x60, 0x80, 0x40, 0x05, 0x8F, 0x62, 0x87, 0x40
+			DB 0x20, 0x02, 0x9D, 0x61, 0x83
+; ' quote
+			DB 0xEB, 0x00, 0x20, 0x60, 0x9B, 0x40, 0x01, 0x94
+			DB 0x61, 0x85, 0x20, 0x00, 0x40, 0x93, 0x40, 0x01
+			DB 0x20, 0x83, 0x40, 0x01, 0x60, 0x92, 0x60, 0x04
+			DB 0x41, 0x20, 0x01, 0x20, 0x93, 0x40, 0x09, 0x60
+			DB 0x93, 0x60, 0x08, 0x60, 0x95, 0x40, 0x05, 0x20
+			DB 0x60, 0x97, 0x60, 0x40, 0x21, 0x40, 0x60, 0xFF
+			DB 0xFF, 0x96
+; ( lparent
+			DB 0xED, 0x63, 0x96, 0x60, 0x40, 0x20, 0x07, 0x20
+			DB 0x40, 0x60, 0x8F, 0x40, 0x20, 0x0E, 0x40, 0x60
+			DB 0x8A, 0x40, 0x13, 0x40, 0x87, 0x60, 0x20, 0x04
+			DB 0x20, 0x40, 0x61, 0x83, 0x61, 0x40, 0x20, 0x05
+			DB 0x60, 0x84, 0x40, 0x03, 0x20, 0x40, 0x8C, 0x60
+			DB 0x40, 0x04, 0x40, 0x82, 0x20, 0x02, 0x20, 0x40
+			DB 0x91, 0x40, 0x03, 0x20, 0x80, 0x03, 0x40, 0x95
+			DB 0x20, 0x02, 0x20, 0x01, 0x20, 0x60, 0x97, 0x40
+			DB 0x03, 0x20, 0x9A, 0x60, 0x01, 0x40, 0x9C, 0x60
+			DB 0x00, 0x9E, 0x60, 0xFF, 0x9F
+; ) rparent
+			DB 0xDF, 0x60, 0x9E, 0x00, 0x60, 0x9B, 0x60, 0x20
+			DB 0x01, 0x60, 0x99, 0x60, 0x04, 0x40, 0x97, 0x40
+			DB 0x02, 0x20, 0x02, 0x20, 0x60, 0x93, 0x60, 0x20
+			DB 0x02, 0x20, 0x80, 0x20, 0x03, 0x40, 0x60, 0x8F
+			DB 0x60, 0x40, 0x03, 0x40, 0x82, 0x40, 0x04, 0x20
+			DB 0x40, 0x8B, 0x60, 0x20, 0x04, 0x60, 0x84, 0x60
+			DB 0x20, 0x05, 0x20, 0x41, 0x63, 0x41, 0x20, 0x05
+			DB 0x20, 0x60, 0x87, 0x40, 0x20, 0x11, 0x20, 0x60
+			DB 0x8B, 0x40, 0x20, 0x0D, 0x40, 0x60, 0x90, 0x60
+			DB 0x40, 0x21, 0x03, 0x21, 0x40, 0x60, 0xFF, 0xC9
+; * star
+			DB 0xAA, 0x40, 0x84, 0x40, 0x60, 0x96, 0x20, 0x00
+			DB 0x40, 0x83, 0x01, 0x40, 0x95, 0x20, 0x00, 0x20
+			DB 0x82, 0x40, 0x01, 0x60, 0x96, 0x01, 0x40, 0x81
+			DB 0x20, 0x00, 0x40, 0x97, 0x60, 0x00, 0x20, 0x80
+			DB 0x40, 0x00, 0x20, 0x99, 0x20, 0x00, 0x40, 0x20
+			DB 0x00, 0x60, 0x94, 0x62, 0x82, 0x02, 0x40, 0x81
+			DB 0x63, 0x8E, 0x60, 0x0E, 0x20, 0x8E, 0x60, 0x03
+			DB 0x21, 0x02, 0x22, 0x02, 0x20, 0x94, 0x60, 0x00
+			DB 0x20, 0x00, 0x20, 0x9A, 0x20, 0x00, 0x60, 0x20
+			DB 0x00, 0x60, 0x98, 0x40, 0x00, 0x20, 0x80, 0x60
+			DB 0x01, 0x97, 0x60, 0x01, 0x60, 0x81, 0x20, 0x00
+			DB 0x40, 0x96, 0x20, 0x00, 0x20, 0x82, 0x40, 0x01
+			DB 0x60, 0x95, 0x20, 0x00, 0x40, 0x83, 0x20, 0x00
+			DB 0x60, 0x96, 0x60, 0x84, 0x60, 0xED
+; + plus
+			DB 0x90, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20
+			DB 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C
+			DB 0x20, 0x01, 0x9C, 0x20, 0x01, 0x94, 0x40, 0x26
+			DB 0x02, 0x27, 0x8C, 0x40, 0x11, 0x8C, 0x40, 0x11
+			DB 0x8C, 0x67, 0x20, 0x01, 0x67, 0x94, 0x20, 0x01
+			DB 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20
+			DB 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C
+			DB 0x40, 0x21, 0xCB
+; , comma
+			DB 0xFC, 0x40, 0x00, 0x40, 0x9C, 0x20, 0x00, 0x40
+			DB 0x94, 0x60, 0x85, 0x40, 0x01, 0x60, 0x92, 0x60
+			DB 0x02, 0x40, 0x82, 0x60, 0x01, 0x20, 0x93, 0x20
+			DB 0x03, 0x20, 0x41, 0x02, 0x60, 0x93, 0x09, 0x40
+			DB 0x94, 0x20, 0x07, 0x20, 0x95, 0x60, 0x06, 0x40
+			DB 0x98, 0x41, 0x20, 0x41, 0x60, 0xFF, 0xFF, 0x84
+; - minus
+			DB 0xF0, 0x40, 0x21, 0x60, 0x9B, 0x20, 0x01, 0x60
+			DB 0x9B, 0x20, 0x01, 0x60, 0x9B, 0x20, 0x01, 0x60
+			DB 0x9B, 0x20, 0x01, 0x60, 0x9B, 0x20, 0x01, 0x60
+			DB 0x9B, 0x20, 0x01, 0x60, 0x9B, 0x20, 0x01, 0x60
+			DB 0x9B, 0x20, 0x01, 0x60, 0x9B, 0x20, 0x01, 0x60
+			DB 0x9B, 0x20, 0x01, 0x60, 0x9B, 0x42, 0x60, 0xFF
+			DB 0xAA
+; . dot
+			DB 0xFF, 0xB4, 0x41, 0x60, 0x9A, 0x60, 0x03, 0x40
+			DB 0x99, 0x20, 0x04, 0x99, 0x05, 0x60, 0x98, 0x20
+			DB 0x04, 0x99, 0x60, 0x03, 0x40, 0x9A, 0x60, 0x21
+			DB 0x40, 0xFF, 0xFF, 0x87
+; / slash
+			DB 0xD9, 0x60, 0x40, 0x9B, 0x40, 0x20, 0x01, 0x60
+			DB 0x97, 0x60, 0x40, 0x04, 0x40, 0x94, 0x60, 0x40
+			DB 0x20, 0x04, 0x20, 0x40, 0x60, 0x92, 0x60, 0x20
+			DB 0x05, 0x40, 0x60, 0x92, 0x60, 0x40, 0x20, 0x04
+			DB 0x20, 0x40, 0x93, 0x40, 0x20, 0x05, 0x40, 0x60
+			DB 0x92, 0x60, 0x40, 0x05, 0x20, 0x40, 0x93, 0x40
+			DB 0x20, 0x05, 0x40, 0x60, 0x92, 0x60, 0x40, 0x05
+			DB 0x20, 0x40, 0x95, 0x20, 0x04, 0x40, 0x60, 0x97
+			DB 0x40, 0x01, 0x20, 0x40, 0x9A, 0x60, 0x40, 0x60
+			DB 0xFF, 0xB9
+; 0 0
+			DB 0xAB, 0x61, 0x44, 0x61, 0x93, 0x40, 0x20, 0x0A
+			DB 0x20, 0x40, 0x8E, 0x60, 0x10, 0x40, 0x8B, 0x40
+			DB 0x12, 0x40, 0x89, 0x40, 0x03, 0x20, 0x40, 0x60
+			DB 0x85, 0x61, 0x40, 0x20, 0x03, 0x60, 0x88, 0x02
+			DB 0x20, 0x60, 0x8C, 0x60, 0x20, 0x01, 0x20, 0x87
+			DB 0x40, 0x01, 0x20, 0x8F, 0x60, 0x02, 0x87, 0x40
+			DB 0x01, 0x60, 0x90, 0x40, 0x01, 0x60, 0x86, 0x20
+			DB 0x01, 0x91, 0x40, 0x01, 0x60, 0x86, 0x20, 0x01
+			DB 0x91, 0x40, 0x01, 0x60, 0x86, 0x40, 0x01, 0x60
+			DB 0x90, 0x02, 0x87, 0x40, 0x01, 0x20, 0x8F, 0x20
+			DB 0x01, 0x40, 0x88, 0x03, 0x40, 0x8B, 0x40, 0x20
+			DB 0x02, 0x60, 0x88, 0x40, 0x04, 0x21, 0x45, 0x21
+			DB 0x04, 0x40, 0x8A, 0x40, 0x11, 0x40, 0x8C, 0x60
+			DB 0x20, 0x0D, 0x40, 0x90, 0x60, 0x41, 0x21, 0x03
+			DB 0x21, 0x40, 0x60, 0xC9
+; 1 1
+			DB 0xC6, 0x60, 0x90, 0x62, 0x89, 0x60, 0x01, 0x20
+			DB 0x8E, 0x02, 0x89, 0x40, 0x01, 0x40, 0x8E, 0x02
+			DB 0x89, 0x02, 0x60, 0x8E, 0x02, 0x88, 0x60, 0x01
+			DB 0x20, 0x8F, 0x02, 0x88, 0x20, 0x01, 0x40, 0x8F
+			DB 0x02, 0x88, 0x02, 0x90, 0x02, 0x87, 0x40, 0x16
+			DB 0x87, 0x40, 0x16, 0x87, 0x40, 0x16, 0x87, 0x74
+			DB 0x02, 0x9C, 0x02, 0x9C, 0x02, 0x9C, 0x02, 0x9C
+			DB 0x02, 0x9C, 0x22, 0xC3
+; 2 2
+			DB 0xC5, 0x20, 0x40, 0x60, 0x8E, 0x60, 0x02, 0x88
+			DB 0x40, 0x01, 0x20, 0x8D, 0x60, 0x03, 0x88, 0x02
+			DB 0x60, 0x8C, 0x60, 0x04, 0x87, 0x60, 0x01, 0x20
+			DB 0x8C, 0x60, 0x05, 0x87, 0x40, 0x01, 0x40, 0x8B
+			DB 0x60, 0x02, 0x20, 0x02, 0x87, 0x20, 0x01, 0x60
+			DB 0x8A, 0x60, 0x02, 0x20, 0x80, 0x02, 0x87, 0x20
+			DB 0x01, 0x60, 0x89, 0x60, 0x02, 0x20, 0x80, 0x60
+			DB 0x02, 0x87, 0x20, 0x01, 0x60, 0x88, 0x60, 0x02
+			DB 0x20, 0x81, 0x60, 0x02, 0x87, 0x40, 0x01, 0x40
+			DB 0x87, 0x60, 0x02, 0x20, 0x82, 0x60, 0x02, 0x87
+			DB 0x40, 0x02, 0x60, 0x85, 0x40, 0x03, 0x60, 0x82
+			DB 0x60, 0x02, 0x88, 0x03, 0x40, 0x60, 0x81, 0x60
+			DB 0x20, 0x02, 0x20, 0x60, 0x83, 0x60, 0x02, 0x88
+			DB 0x40, 0x0A, 0x20, 0x85, 0x60, 0x02, 0x89, 0x20
+			DB 0x08, 0x40, 0x86, 0x60, 0x02, 0x8A, 0x40, 0x05
+			DB 0x20, 0x60, 0x87, 0x60, 0x02, 0x8C, 0x60, 0x42
+			DB 0x60, 0x89, 0x60, 0x02, 0x9C, 0x62, 0xC3
+; 3 3
+			DB 0xD8, 0x60, 0x41, 0x88, 0x20, 0x00, 0x20, 0x60
+			DB 0x85, 0x62, 0x86, 0x01, 0x20, 0x88, 0x01, 0x20
+			DB 0x85, 0x60, 0x01, 0x60, 0x86, 0x20, 0x01, 0x87
+			DB 0x60, 0x01, 0x40, 0x85, 0x60, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x60, 0x86, 0x40, 0x01, 0x60, 0x85
+			DB 0x60, 0x01, 0x60, 0x86, 0x40, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x86, 0x40, 0x01, 0x60, 0x86, 0x40
+			DB 0x01, 0x60, 0x86, 0x20, 0x01, 0x86, 0x40, 0x01
+			DB 0x60, 0x86, 0x40, 0x01, 0x60, 0x86, 0x20, 0x01
+			DB 0x86, 0x20, 0x01, 0x40, 0x86, 0x20, 0x01, 0x87
+			DB 0x20, 0x01, 0x60, 0x85, 0x02, 0x40, 0x86, 0x20
+			DB 0x00, 0x20, 0x87, 0x40, 0x01, 0x40, 0x84, 0x40
+			DB 0x03, 0x85, 0x60, 0x01, 0x40, 0x87, 0x60, 0x02
+			DB 0x40, 0x82, 0x40, 0x01, 0x20, 0x01, 0x40, 0x84
+			DB 0x20, 0x01, 0x60, 0x88, 0x20, 0x02, 0x22, 0x01
+			DB 0x20, 0x60, 0x02, 0x20, 0x61, 0x40, 0x02, 0x20
+			DB 0x89, 0x60, 0x07, 0x60, 0x80, 0x20, 0x08, 0x60
+			DB 0x8A, 0x60, 0x20, 0x03, 0x20, 0x60, 0x81, 0x60
+			DB 0x07, 0x40, 0x8D, 0x60, 0x41, 0x60, 0x85, 0x40
+			DB 0x03, 0x20, 0x60, 0x9A, 0x61, 0xC9
+; 4 4
+			DB 0x92, 0x40, 0x20, 0x40, 0x60, 0x99, 0x60, 0x20
+			DB 0x02, 0x40, 0x98, 0x40, 0x04, 0x40, 0x96, 0x60
+			DB 0x20, 0x05, 0x40, 0x95, 0x40, 0x03, 0x41, 0x01
+			DB 0x40, 0x93, 0x60, 0x20, 0x02, 0x20, 0x60, 0x80
+			DB 0x40, 0x01, 0x40, 0x92, 0x40, 0x03, 0x40, 0x82
+			DB 0x40, 0x01, 0x40, 0x90, 0x60, 0x20, 0x02, 0x20
+			DB 0x60, 0x83, 0x40, 0x01, 0x40, 0x8F, 0x40, 0x03
+			DB 0x40, 0x85, 0x40, 0x01, 0x40, 0x8D, 0x60, 0x20
+			DB 0x02, 0x20, 0x60, 0x86, 0x40, 0x01, 0x40, 0x8C
+			DB 0x60, 0x03, 0x40, 0x88, 0x40, 0x01, 0x40, 0x8C
+			DB 0x40, 0x02, 0x40, 0x69, 0x40, 0x01, 0x40, 0x64
+			DB 0x87, 0x40, 0x16, 0x87, 0x40, 0x16, 0x87, 0x40
+			DB 0x16, 0x96, 0x40, 0x01, 0x40, 0x9B, 0x40, 0x01
+			DB 0x40, 0x9B, 0x40, 0x01, 0x40, 0x9B, 0x40, 0x01
+			DB 0x40, 0x9B, 0x63, 0x88
+; 5 5
+			DB 0xD8, 0x62, 0x87, 0x40, 0x2A, 0x40, 0x87, 0x02
+			DB 0x87, 0x40, 0x0A, 0x40, 0x87, 0x20, 0x01, 0x87
+			DB 0x40, 0x0A, 0x60, 0x87, 0x40, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x20, 0x64, 0x40, 0x01, 0x60, 0x87
+			DB 0x40, 0x01, 0x60, 0x86, 0x40, 0x01, 0x20, 0x84
+			DB 0x60, 0x01, 0x60, 0x87, 0x40, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x20, 0x84, 0x60, 0x01, 0x60, 0x87
+			DB 0x40, 0x01, 0x60, 0x86, 0x40, 0x01, 0x20, 0x84
+			DB 0x60, 0x01, 0x40, 0x87, 0x40, 0x01, 0x87, 0x40
+			DB 0x01, 0x20, 0x84, 0x60, 0x01, 0x40, 0x87, 0x20
+			DB 0x01, 0x87, 0x40, 0x01, 0x20, 0x85, 0x02, 0x86
+			DB 0x40, 0x01, 0x20, 0x87, 0x40, 0x01, 0x20, 0x85
+			DB 0x20, 0x01, 0x40, 0x84, 0x60, 0x02, 0x60, 0x87
+			DB 0x40, 0x01, 0x20, 0x85, 0x60, 0x02, 0x20, 0x40
+			DB 0x61, 0x40, 0x02, 0x20, 0x88, 0x40, 0x01, 0x20
+			DB 0x86, 0x20, 0x09, 0x60, 0x88, 0x40, 0x01, 0x20
+			DB 0x87, 0x20, 0x07, 0x60, 0x89, 0x63, 0x88, 0x40
+			DB 0x04, 0x40, 0x9A, 0x62, 0xC9
+; 6 6
+			DB 0xAD, 0x61, 0x43, 0x61, 0x94, 0x40, 0x20, 0x08
+			DB 0x20, 0x40, 0x90, 0x40, 0x0E, 0x60, 0x8D, 0x20
+			DB 0x04, 0x21, 0x09, 0x40, 0x8B, 0x20, 0x02, 0x20
+			DB 0x40, 0x60, 0x80, 0x40, 0x01, 0x40, 0x60, 0x80
+			DB 0x60, 0x40, 0x20, 0x02, 0x60, 0x89, 0x20, 0x02
+			DB 0x40, 0x82, 0x40, 0x01, 0x60, 0x85, 0x20, 0x01
+			DB 0x40, 0x88, 0x60, 0x02, 0x60, 0x83, 0x01, 0x40
+			DB 0x87, 0x02, 0x88, 0x20, 0x01, 0x40, 0x83, 0x40
+			DB 0x01, 0x88, 0x40, 0x01, 0x60, 0x86, 0x60, 0x01
+			DB 0x20, 0x84, 0x40, 0x00, 0x20, 0x88, 0x60, 0x01
+			DB 0x60, 0x86, 0x40, 0x01, 0x40, 0x84, 0x20, 0x00
+			DB 0x20, 0x88, 0x60, 0x01, 0x60, 0x86, 0x40, 0x01
+			DB 0x60, 0x84, 0x20, 0x00, 0x20, 0x88, 0x40, 0x01
+			DB 0x87, 0x20, 0x01, 0x85, 0x40, 0x01, 0x60, 0x87
+			DB 0x20, 0x00, 0x20, 0x87, 0x20, 0x01, 0x85, 0x40
+			DB 0x01, 0x20, 0x86, 0x40, 0x01, 0x40, 0x87, 0x20
+			DB 0x01, 0x85, 0x60, 0x02, 0x20, 0x60, 0x83, 0x40
+			DB 0x02, 0x60, 0x87, 0x20, 0x01, 0x86, 0x40, 0x03
+			DB 0x22, 0x03, 0x40, 0x88, 0x62, 0x87, 0x20, 0x08
+			DB 0x40, 0x95, 0x40, 0x05, 0x20, 0x60, 0x98, 0x60
+			DB 0x42, 0x60, 0xA8
+; 7 7
+			DB 0x83, 0x40, 0x21, 0x40, 0x9B, 0x40, 0x01, 0x20
+			DB 0x9B, 0x40, 0x01, 0x20, 0x9B, 0x40, 0x01, 0x20
+			DB 0x92, 0x60, 0x87, 0x40, 0x01, 0x20, 0x90, 0x40
+			DB 0x20, 0x00, 0x87, 0x40, 0x01, 0x20, 0x8D, 0x60
+			DB 0x40, 0x03, 0x87, 0x40, 0x01, 0x20, 0x8B, 0x60
+			DB 0x40, 0x05, 0x87, 0x40, 0x01, 0x20, 0x89, 0x60
+			DB 0x20, 0x06, 0x20, 0x87, 0x40, 0x01, 0x20, 0x87
+			DB 0x60, 0x20, 0x05, 0x20, 0x40, 0x60, 0x88, 0x40
+			DB 0x01, 0x20, 0x85, 0x60, 0x20, 0x05, 0x20, 0x60
+			DB 0x8B, 0x40, 0x01, 0x20, 0x83, 0x60, 0x20, 0x05
+			DB 0x40, 0x60, 0x8D, 0x40, 0x01, 0x20, 0x81, 0x60
+			DB 0x40, 0x05, 0x40, 0x90, 0x40, 0x01, 0x40, 0x80
+			DB 0x40, 0x05, 0x40, 0x92, 0x40, 0x01, 0x20, 0x05
+			DB 0x40, 0x94, 0x40, 0x06, 0x40, 0x96, 0x40, 0x04
+			DB 0x40, 0x98, 0x40, 0x02, 0x40, 0x9A, 0x63, 0xD7
+; 8 8
+			DB 0x93, 0x60, 0x42, 0x60, 0x8D, 0x60, 0x40, 0x01
+			DB 0x20, 0x40, 0x60, 0x84, 0x20, 0x04, 0x40, 0x8B
+			DB 0x40, 0x06, 0x60, 0x82, 0x20, 0x06, 0x40, 0x89
+			DB 0x60, 0x08, 0x60, 0x80, 0x20, 0x02, 0x21, 0x03
+			DB 0x60, 0x88, 0x20, 0x01, 0x20, 0x61, 0x40, 0x02
+			DB 0x20, 0x60, 0x01, 0x20, 0x60, 0x82, 0x20, 0x01
+			DB 0x40, 0x87, 0x60, 0x01, 0x20, 0x83, 0x40, 0x02
+			DB 0x20, 0x01, 0x85, 0x02, 0x87, 0x40, 0x01, 0x60
+			DB 0x84, 0x20, 0x03, 0x40, 0x85, 0x40, 0x01, 0x87
+			DB 0x40, 0x00, 0x20, 0x85, 0x60, 0x02, 0x20, 0x86
+			DB 0x40, 0x01, 0x60, 0x86, 0x20, 0x00, 0x20, 0x86
+			DB 0x20, 0x01, 0x40, 0x86, 0x60, 0x01, 0x60, 0x86
+			DB 0x20, 0x00, 0x20, 0x86, 0x20, 0x01, 0x20, 0x86
+			DB 0x60, 0x01, 0x60, 0x86, 0x40, 0x01, 0x85, 0x60
+			DB 0x03, 0x60, 0x85, 0x40, 0x01, 0x87, 0x40, 0x01
+			DB 0x40, 0x84, 0x20, 0x03, 0x20, 0x85, 0x20, 0x00
+			DB 0x20, 0x87, 0x60, 0x02, 0x60, 0x82, 0x40, 0x01
+			DB 0x40, 0x02, 0x40, 0x83, 0x40, 0x01, 0x40, 0x88
+			DB 0x20, 0x02, 0x21, 0x02, 0x20, 0x80, 0x40, 0x02
+			DB 0x40, 0x61, 0x40, 0x02, 0x60, 0x88, 0x60, 0x07
+			DB 0x60, 0x80, 0x60, 0x08, 0x40, 0x8A, 0x60, 0x20
+			DB 0x03, 0x20, 0x60, 0x82, 0x60, 0x06, 0x20, 0x8D
+			DB 0x60, 0x41, 0x60, 0x85, 0x60, 0x40, 0x20, 0x01
+			DB 0x20, 0x40, 0xE6
+; 9 9
+			DB 0x89, 0x60, 0x42, 0x60, 0x97, 0x60, 0x40, 0x05
+			DB 0x20, 0x60, 0x87, 0x62, 0x89, 0x60, 0x09, 0x40
+			DB 0x86, 0x20, 0x01, 0x88, 0x60, 0x03, 0x22, 0x04
+			DB 0x60, 0x85, 0x40, 0x01, 0x60, 0x87, 0x20, 0x01
+			DB 0x20, 0x60, 0x83, 0x40, 0x02, 0x20, 0x85, 0x40
+			DB 0x01, 0x60, 0x86, 0x60, 0x01, 0x20, 0x86, 0x60
+			DB 0x02, 0x60, 0x84, 0x40, 0x01, 0x60, 0x86, 0x40
+			DB 0x01, 0x60, 0x87, 0x40, 0x01, 0x40, 0x84, 0x40
+			DB 0x01, 0x60, 0x86, 0x40, 0x00, 0x20, 0x88, 0x60
+			DB 0x01, 0x40, 0x84, 0x20, 0x01, 0x87, 0x20, 0x00
+			DB 0x20, 0x88, 0x60, 0x01, 0x40, 0x84, 0x01, 0x20
+			DB 0x87, 0x20, 0x00, 0x20, 0x88, 0x40, 0x01, 0x60
+			DB 0x83, 0x40, 0x01, 0x40, 0x87, 0x40, 0x01, 0x60
+			DB 0x87, 0x40, 0x01, 0x83, 0x60, 0x02, 0x60, 0x87
+			DB 0x60, 0x01, 0x20, 0x86, 0x60, 0x01, 0x40, 0x82
+			DB 0x60, 0x02, 0x40, 0x89, 0x20, 0x01, 0x20, 0x60
+			DB 0x83, 0x40, 0x01, 0x20, 0x81, 0x40, 0x20, 0x02
+			DB 0x20, 0x8A, 0x60, 0x04, 0x21, 0x03, 0x21, 0x04
+			DB 0x20, 0x8C, 0x40, 0x0F, 0x40, 0x8E, 0x60, 0x20
+			DB 0x0A, 0x20, 0x40, 0x60, 0x91, 0x60, 0x41, 0x23
+			DB 0x41, 0x61, 0xEB
+; : colon
+			DB 0xFF, 0xC7, 0x40, 0x00, 0x20, 0x40, 0x86, 0x60
+			DB 0x20, 0x00, 0x40, 0x8F, 0x40, 0x03, 0x60, 0x84
+			DB 0x60, 0x03, 0x40, 0x8E, 0x04, 0x40, 0x84, 0x40
+			DB 0x04, 0x8E, 0x20, 0x03, 0x40, 0x84, 0x40, 0x03
+			DB 0x20, 0x8E, 0x60, 0x02, 0x20, 0x86, 0x20, 0x02
+			DB 0x60, 0x8F, 0x60, 0x41, 0x88, 0x41, 0x60, 0xFF
+			DB 0xFF, 0x88
+; ; semicolon
+			DB 0xFD, 0x20, 0x40, 0x9C, 0x60, 0x01, 0x9C, 0x20
+			DB 0x00, 0x20, 0x87, 0x40, 0x00, 0x20, 0x40, 0x87
+			DB 0x60, 0x21, 0x60, 0x83, 0x40, 0x01, 0x40, 0x86
+			DB 0x40, 0x03, 0x60, 0x85, 0x60, 0x03, 0x40, 0x81
+			DB 0x40, 0x01, 0x20, 0x87, 0x04, 0x40, 0x85, 0x40
+			DB 0x09, 0x60, 0x87, 0x20, 0x03, 0x40, 0x85, 0x40
+			DB 0x08, 0x40, 0x88, 0x60, 0x02, 0x20, 0x86, 0x60
+			DB 0x07, 0x40, 0x8A, 0x60, 0x41, 0x89, 0x40, 0x20
+			DB 0x01, 0x20, 0x40, 0x60, 0xFF, 0xFF, 0x83
+; < less
+			DB 0x91, 0x61, 0x9D, 0x00, 0x20, 0x9C, 0x20, 0x01
+			DB 0x20, 0x9A, 0x40, 0x03, 0x40, 0x98, 0x40, 0x05
+			DB 0x60, 0x96, 0x60, 0x02, 0x41, 0x02, 0x96, 0x20
+			DB 0x01, 0x40, 0x81, 0x20, 0x01, 0x20, 0x94, 0x20
+			DB 0x01, 0x20, 0x83, 0x02, 0x40, 0x92, 0x40, 0x02
+			DB 0x60, 0x83, 0x60, 0x02, 0x60, 0x90, 0x60, 0x02
+			DB 0x40, 0x85, 0x40, 0x02, 0x60, 0x8E, 0x60, 0x02
+			DB 0x40, 0x87, 0x20, 0x01, 0x20, 0x8E, 0x20, 0x01
+			DB 0x20, 0x88, 0x60, 0x02, 0x40, 0x8C, 0x40, 0x02
+			DB 0x60, 0x89, 0x40, 0x02, 0x40, 0x8A, 0x60, 0x02
+			DB 0x60, 0x8B, 0x20, 0x02, 0x8B, 0x40, 0x00, 0x40
+			DB 0x8D, 0x20, 0x00, 0x40, 0x8C, 0x40, 0x8E, 0x61
+			DB 0xFF, 0x83
+; = equal
+			DB 0x8D, 0x62, 0x83, 0x61, 0x96, 0x40, 0x01, 0x82
+			DB 0x60, 0x01, 0x60, 0x95, 0x40, 0x01, 0x82, 0x60
+			DB 0x01, 0x60, 0x95, 0x40, 0x01, 0x82, 0x60, 0x01
+			DB 0x60, 0x95, 0x40, 0x01, 0x82, 0x60, 0x01, 0x60
+			DB 0x95, 0x40, 0x01, 0x82, 0x60, 0x01, 0x60, 0x95
+			DB 0x40, 0x01, 0x82, 0x60, 0x01, 0x60, 0x95, 0x40
+			DB 0x01, 0x82, 0x60, 0x01, 0x60, 0x95, 0x40, 0x01
+			DB 0x82, 0x60, 0x01, 0x60, 0x95, 0x40, 0x01, 0x82
+			DB 0x60, 0x01, 0x60, 0x95, 0x40, 0x01, 0x82, 0x60
+			DB 0x01, 0x60, 0x95, 0x40, 0x01, 0x82, 0x60, 0x01
+			DB 0x60, 0x95, 0x40, 0x01, 0x82, 0x60, 0x01, 0x60
+			DB 0x95, 0x40, 0x01, 0x82, 0x60, 0x01, 0x60, 0x95
+			DB 0x40, 0x01, 0x82, 0x60, 0x01, 0x60, 0x95, 0x40
+			DB 0x01, 0x82, 0x60, 0x01, 0x60, 0x95, 0x40, 0x21
+			DB 0x82, 0x60, 0x21, 0x60, 0xE7
+; > greater
+			DB 0xA9, 0x40, 0x60, 0x8D, 0x60, 0x40, 0x8C, 0x20
+			DB 0x00, 0x20, 0x8C, 0x60, 0x01, 0x40, 0x8A, 0x60
+			DB 0x02, 0x40, 0x8B, 0x20, 0x01, 0x20, 0x8B, 0x40
+			DB 0x02, 0x60, 0x89, 0x40, 0x02, 0x60, 0x8C, 0x40
+			DB 0x02, 0x60, 0x87, 0x60, 0x02, 0x40, 0x8E, 0x20
+			DB 0x01, 0x20, 0x86, 0x60, 0x02, 0x40, 0x8F, 0x60
+			DB 0x02, 0x40, 0x85, 0x20, 0x01, 0x20, 0x91, 0x40
+			DB 0x02, 0x60, 0x83, 0x40, 0x02, 0x93, 0x40, 0x02
+			DB 0x82, 0x60, 0x02, 0x60, 0x94, 0x20, 0x01, 0x20
+			DB 0x80, 0x60, 0x02, 0x40, 0x95, 0x60, 0x02, 0x40
+			DB 0x20, 0x01, 0x20, 0x97, 0x60, 0x04, 0x20, 0x99
+			DB 0x40, 0x03, 0x60, 0x9A, 0x20, 0x01, 0x60, 0x9C
+			DB 0x00, 0x40, 0x9D, 0x60, 0xEC
+; ? question
+			DB 0xE1, 0x60, 0x41, 0x60, 0x9B, 0x20, 0x01, 0x60
+			DB 0x9B, 0x20, 0x01, 0x60, 0x8A, 0x43, 0x60, 0x81
+			DB 0x60, 0x20, 0x40, 0x60, 0x85, 0x40, 0x01, 0x40
+			DB 0x88, 0x60, 0x04, 0x40, 0x80, 0x60, 0x02, 0x20
+			DB 0x85, 0x40, 0x01, 0x40, 0x87, 0x40, 0x05, 0x40
+			DB 0x80, 0x40, 0x03, 0x60, 0x84, 0x60, 0x01, 0x20
+			DB 0x86, 0x60, 0x03, 0x22, 0x40, 0x80, 0x60, 0x03
+			DB 0x86, 0x02, 0x60, 0x84, 0x60, 0x02, 0x20, 0x60
+			DB 0x85, 0x40, 0x00, 0x20, 0x40, 0x86, 0x40, 0x01
+			DB 0x20, 0x83, 0x60, 0x20, 0x01, 0x20, 0x92, 0x60
+			DB 0x02, 0x20, 0x40, 0x60, 0x40, 0x02, 0x20, 0x94
+			DB 0x20, 0x08, 0x60, 0x95, 0x20, 0x06, 0x60, 0x97
+			DB 0x40, 0x03, 0x40, 0x9B, 0x61, 0xFF, 0x95
+; @ arobas
+			DB 0x89, 0x60, 0x40, 0x20, 0x06, 0x20, 0x40, 0x60
+			DB 0x90, 0x60, 0x40, 0x0C, 0x20, 0x60, 0x8D, 0x40
+			DB 0x04, 0x20, 0x44, 0x20, 0x04, 0x40, 0x8B, 0x40
+			DB 0x02, 0x20, 0x60, 0x88, 0x40, 0x20, 0x02, 0x60
+			DB 0x89, 0x40, 0x01, 0x20, 0x60, 0x8C, 0x40, 0x02
+			DB 0x88, 0x60, 0x01, 0x20, 0x83, 0x60, 0x40, 0x20
+			DB 0x02, 0x20, 0x40, 0x60, 0x82, 0x40, 0x01, 0x40
+			DB 0x87, 0x40, 0x01, 0x83, 0x20, 0x08, 0x60, 0x82
+			DB 0x20, 0x00, 0x20, 0x87, 0x01, 0x40, 0x82, 0x20
+			DB 0x01, 0x20, 0x43, 0x20, 0x01, 0x20, 0x82, 0x40
+			DB 0x01, 0x86, 0x60, 0x01, 0x82, 0x60, 0x01, 0x60
+			DB 0x85, 0x40, 0x00, 0x20, 0x82, 0x60, 0x01, 0x60
+			DB 0x85, 0x40, 0x00, 0x20, 0x82, 0x40, 0x00, 0x40
+			DB 0x85, 0x60, 0x20, 0x00, 0x60, 0x82, 0x60, 0x01
+			DB 0x60, 0x85, 0x40, 0x00, 0x20, 0x82, 0x40, 0x00
+			DB 0x40, 0x82, 0x60, 0x41, 0x01, 0x40, 0x83, 0x60
+			DB 0x01, 0x60, 0x85, 0x40, 0x00, 0x20, 0x82, 0x40
+			DB 0x08, 0x20, 0x60, 0x83, 0x60, 0x01, 0x86, 0x60
+			DB 0x01, 0x60, 0x81, 0x60, 0x0A, 0x60, 0x82, 0x40
+			DB 0x01, 0x87, 0x01, 0x40, 0x82, 0x42, 0x64, 0x40
+			DB 0x01, 0x40, 0x82, 0x40, 0x20, 0x40, 0x87, 0x40
+			DB 0x01, 0x40, 0x8A, 0x40, 0x00, 0x20, 0x8E, 0x02
+			DB 0x40, 0x89, 0x20, 0x00, 0x40, 0x8E, 0x60, 0x03
+			DB 0x41, 0x63, 0x41, 0x02, 0x60, 0x8F, 0x60, 0x20
+			DB 0x0B, 0x40, 0x92, 0x40, 0x20, 0x07, 0x40, 0x60
+			DB 0x96, 0x60, 0x42, 0x61, 0x8E
+; A A
+			DB 0x97, 0x60, 0x40, 0x01, 0x98, 0x60, 0x40, 0x04
+			DB 0x95, 0x60, 0x40, 0x20, 0x06, 0x92, 0x60, 0x40
+			DB 0x20, 0x06, 0x20, 0x40, 0x90, 0x60, 0x40, 0x20
+			DB 0x06, 0x20, 0x40, 0x91, 0x40, 0x20, 0x06, 0x20
+			DB 0x01, 0x60, 0x8F, 0x40, 0x20, 0x06, 0x20, 0x60
+			DB 0x80, 0x60, 0x01, 0x60, 0x8C, 0x40, 0x20, 0x06
+			DB 0x20, 0x40, 0x83, 0x60, 0x01, 0x60, 0x8B, 0x60
+			DB 0x05, 0x20, 0x40, 0x86, 0x60, 0x01, 0x60, 0x8B
+			DB 0x60, 0x02, 0x20, 0x40, 0x60, 0x88, 0x60, 0x01
+			DB 0x60, 0x8B, 0x60, 0x04, 0x40, 0x60, 0x87, 0x60
+			DB 0x01, 0x60, 0x8B, 0x60, 0x07, 0x40, 0x60, 0x84
+			DB 0x60, 0x01, 0x60, 0x8C, 0x60, 0x40, 0x20, 0x06
+			DB 0x20, 0x40, 0x60, 0x81, 0x60, 0x01, 0x60, 0x8F
+			DB 0x60, 0x40, 0x20, 0x06, 0x20, 0x41, 0x01, 0x60
+			DB 0x92, 0x60, 0x40, 0x20, 0x08, 0x40, 0x95, 0x60
+			DB 0x40, 0x07, 0x20, 0x40, 0x60, 0x95, 0x60, 0x40
+			DB 0x08, 0x40, 0x96, 0x60, 0x40, 0x06, 0x99, 0x40
+			DB 0x20, 0x03, 0x9C, 0x40, 0x20, 0x00, 0x83
+; B B
+			DB 0xC2, 0x60, 0x37, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x01, 0x47, 0x20, 0x00, 0x20
+			DB 0x47, 0x02, 0x86, 0x60, 0x01, 0x60, 0x86, 0x20
+			DB 0x00, 0x20, 0x87, 0x20, 0x01, 0x86, 0x60, 0x01
+			DB 0x60, 0x86, 0x20, 0x00, 0x20, 0x87, 0x20, 0x01
+			DB 0x86, 0x60, 0x01, 0x60, 0x86, 0x20, 0x00, 0x20
+			DB 0x87, 0x20, 0x01, 0x86, 0x60, 0x01, 0x60, 0x86
+			DB 0x20, 0x00, 0x20, 0x87, 0x20, 0x01, 0x86, 0x60
+			DB 0x01, 0x60, 0x86, 0x01, 0x20, 0x87, 0x20, 0x00
+			DB 0x20, 0x86, 0x60, 0x01, 0x40, 0x85, 0x60, 0x02
+			DB 0x60, 0x85, 0x60, 0x01, 0x20, 0x87, 0x01, 0x20
+			DB 0x85, 0x20, 0x02, 0x40, 0x85, 0x40, 0x01, 0x40
+			DB 0x87, 0x20, 0x01, 0x40, 0x83, 0x20, 0x01, 0x20
+			DB 0x01, 0x60, 0x83, 0x60, 0x02, 0x60, 0x87, 0x60
+			DB 0x03, 0x21, 0x02, 0x41, 0x02, 0x40, 0x61, 0x40
+			DB 0x02, 0x40, 0x89, 0x20, 0x06, 0x20, 0x81, 0x08
+			DB 0x20, 0x8B, 0x20, 0x04, 0x40, 0x82, 0x60, 0x06
+			DB 0x20, 0x60, 0x8C, 0x60, 0x42, 0x60, 0x84, 0x60
+			DB 0x40, 0x20, 0x01, 0x20, 0x40, 0xC7
+; C C
+			DB 0xAA, 0x60, 0x41, 0x23, 0x41, 0x60, 0x93, 0x40
+			DB 0x20, 0x0A, 0x20, 0x60, 0x8E, 0x60, 0x0F, 0x20
+			DB 0x8C, 0x40, 0x06, 0x23, 0x06, 0x20, 0x8A, 0x40
+			DB 0x03, 0x20, 0x40, 0x87, 0x40, 0x20, 0x03, 0x40
+			DB 0x89, 0x03, 0x60, 0x8B, 0x60, 0x03, 0x60, 0x87
+			DB 0x40, 0x02, 0x60, 0x8D, 0x60, 0x02, 0x40, 0x87
+			DB 0x02, 0x40, 0x8F, 0x40, 0x01, 0x20, 0x86, 0x60
+			DB 0x01, 0x20, 0x90, 0x60, 0x02, 0x86, 0x60, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x86, 0x60, 0x01, 0x20
+			DB 0x91, 0x01, 0x20, 0x87, 0x02, 0x90, 0x40, 0x01
+			DB 0x40, 0x87, 0x40, 0x20, 0x40, 0x60, 0x8F, 0x40
+			DB 0x01, 0x60, 0xC3
+; D D
+			DB 0xA3, 0x17, 0x86, 0x60, 0x17, 0x60, 0x85, 0x60
+			DB 0x17, 0x60, 0x85, 0x60, 0x01, 0x40, 0x71, 0x20
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x40, 0x91, 0x40
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x40, 0x91, 0x40
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x40, 0x91, 0x40
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x40, 0x91, 0x40
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x40, 0x91, 0x20
+			DB 0x01, 0x87, 0x01, 0x20, 0x91, 0x01, 0x20, 0x87
+			DB 0x20, 0x01, 0x60, 0x8F, 0x40, 0x01, 0x40, 0x87
+			DB 0x40, 0x01, 0x20, 0x8F, 0x02, 0x60, 0x87, 0x60
+			DB 0x02, 0x40, 0x8D, 0x20, 0x01, 0x20, 0x89, 0x20
+			DB 0x02, 0x20, 0x60, 0x89, 0x40, 0x20, 0x02, 0x60
+			DB 0x89, 0x60, 0x04, 0x20, 0x41, 0x63, 0x41, 0x20
+			DB 0x03, 0x40, 0x8B, 0x60, 0x10, 0x40, 0x8D, 0x60
+			DB 0x20, 0x0C, 0x20, 0x60, 0x90, 0x60, 0x40, 0x20
+			DB 0x06, 0x20, 0x40, 0x60, 0x96, 0x64, 0x8D
+; E E
+			DB 0xE2, 0x60, 0x37, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x01, 0x20, 0x46, 0x20, 0x00
+			DB 0x20, 0x47, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40
+			DB 0x86, 0x20, 0x00, 0x20, 0x87, 0x20, 0x01, 0x86
+			DB 0x60, 0x01, 0x40, 0x86, 0x20, 0x00, 0x20, 0x87
+			DB 0x20, 0x01, 0x86, 0x60, 0x01, 0x40, 0x86, 0x20
+			DB 0x00, 0x20, 0x87, 0x20, 0x01, 0x86, 0x60, 0x01
+			DB 0x40, 0x86, 0x20, 0x00, 0x20, 0x87, 0x20, 0x01
+			DB 0x86, 0x60, 0x01, 0x40, 0x86, 0x20, 0x00, 0x20
+			DB 0x87, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40, 0x86
+			DB 0x20, 0x00, 0x20, 0x87, 0x20, 0x01, 0x86, 0x60
+			DB 0x01, 0x40, 0x86, 0x20, 0x00, 0x20, 0x87, 0x20
+			DB 0x01, 0x86, 0x60, 0x01, 0x40, 0x86, 0x20, 0x00
+			DB 0x20, 0x87, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40
+			DB 0x86, 0x20, 0x00, 0x20, 0x87, 0x20, 0x01, 0x86
+			DB 0x60, 0x41, 0x60, 0x86, 0x62, 0x87, 0x42, 0xE3
+; F F
+			DB 0xE2, 0x60, 0x37, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x01, 0x20, 0x46, 0x20, 0x01
+			DB 0x4A, 0x86, 0x60, 0x01, 0x40, 0x86, 0x40, 0x01
+			DB 0x91, 0x60, 0x01, 0x40, 0x86, 0x40, 0x01, 0x91
+			DB 0x60, 0x01, 0x40, 0x86, 0x40, 0x01, 0x91, 0x60
+			DB 0x01, 0x40, 0x86, 0x40, 0x01, 0x91, 0x60, 0x01
+			DB 0x40, 0x86, 0x40, 0x01, 0x91, 0x60, 0x01, 0x40
+			DB 0x86, 0x40, 0x01, 0x91, 0x60, 0x01, 0x40, 0x86
+			DB 0x40, 0x01, 0x91, 0x60, 0x01, 0x40, 0x86, 0x40
+			DB 0x01, 0x91, 0x60, 0x01, 0x40, 0x86, 0x40, 0x01
+			DB 0x91, 0x60, 0x41, 0x60, 0xF8
+; G G
+			DB 0x88, 0x60, 0x20, 0x0A, 0x40, 0x60, 0x8F, 0x20
+			DB 0x0E, 0x40, 0x8C, 0x60, 0x06, 0x23, 0x06, 0x40
+			DB 0x8B, 0x03, 0x20, 0x40, 0x60, 0x85, 0x60, 0x40
+			DB 0x20, 0x03, 0x60, 0x89, 0x20, 0x02, 0x40, 0x8B
+			DB 0x40, 0x03, 0x88, 0x60, 0x02, 0x60, 0x8D, 0x40
+			DB 0x02, 0x40, 0x87, 0x20, 0x01, 0x40, 0x8F, 0x20
+			DB 0x01, 0x20, 0x87, 0x02, 0x90, 0x60, 0x02, 0x86
+			DB 0x60, 0x01, 0x40, 0x91, 0x02, 0x60, 0x85, 0x40
+			DB 0x01, 0x40, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40
+			DB 0x01, 0x60, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40
+			DB 0x01, 0x60, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40
+			DB 0x01, 0x60, 0x91, 0x20, 0x01, 0x60, 0x85, 0x40
+			DB 0x01, 0x40, 0x91, 0x02, 0x86, 0x60, 0x01, 0x40
+			DB 0x87, 0x60, 0x48, 0x01, 0x20, 0x87, 0x02, 0x87
+			DB 0x40, 0x0A, 0x40, 0x87, 0x20, 0x01, 0x60, 0x86
+			DB 0x40, 0x0A, 0x60, 0x87, 0x62, 0x87, 0x40, 0x2A
+			DB 0xC4
+; H H
+			DB 0x82, 0x60, 0x37, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x49, 0x01, 0x20, 0x4A, 0x91
+			DB 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x01, 0x20
+			DB 0x9C, 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x01
+			DB 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C
+			DB 0x01, 0x20, 0x9C, 0x01, 0x20, 0x91, 0x60, 0x17
+			DB 0x86, 0x60, 0x17, 0x86, 0x60, 0x17, 0x87, 0x77
+			DB 0xC3
+; I I
+			DB 0xA2, 0x60, 0x41, 0x60, 0x91, 0x42, 0x86, 0x60
+			DB 0x01, 0x40, 0x91, 0x20, 0x01, 0x86, 0x60, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40
+			DB 0x91, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40, 0x91
+			DB 0x20, 0x01, 0x86, 0x60, 0x01, 0x40, 0x91, 0x20
+			DB 0x01, 0x86, 0x60, 0x01, 0x32, 0x02, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x17, 0x86, 0x60, 0x01, 0x20
+			DB 0x51, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40, 0x91
+			DB 0x20, 0x01, 0x86, 0x60, 0x01, 0x40, 0x91, 0x20
+			DB 0x01, 0x86, 0x60, 0x01, 0x40, 0x91, 0x20, 0x01
+			DB 0x86, 0x60, 0x01, 0x40, 0x91, 0x20, 0x01, 0x86
+			DB 0x60, 0x01, 0x40, 0x91, 0x20, 0x01, 0x87, 0x62
+			DB 0x91, 0x62, 0xE3
+; J J
+			DB 0xC2, 0x60, 0x41, 0x60, 0x91, 0x22, 0x86, 0x60
+			DB 0x01, 0x40, 0x91, 0x20, 0x01, 0x86, 0x60, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x60, 0x85, 0x60, 0x01
+			DB 0x40, 0x91, 0x40, 0x01, 0x60, 0x85, 0x60, 0x01
+			DB 0x40, 0x91, 0x40, 0x01, 0x60, 0x85, 0x60, 0x01
+			DB 0x40, 0x91, 0x40, 0x01, 0x60, 0x85, 0x60, 0x01
+			DB 0x40, 0x91, 0x20, 0x01, 0x86, 0x60, 0x01, 0x40
+			DB 0x90, 0x60, 0x01, 0x20, 0x86, 0x60, 0x01, 0x40
+			DB 0x8F, 0x60, 0x02, 0x40, 0x86, 0x60, 0x01, 0x20
+			DB 0x4E, 0x20, 0x03, 0x87, 0x60, 0x15, 0x60, 0x87
+			DB 0x60, 0x13, 0x20, 0x60, 0x88, 0x60, 0x31, 0x40
+			DB 0x60, 0xFF, 0xA7
+; K K
+			DB 0xA2, 0x60, 0x37, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x4A, 0x00, 0x20, 0x4A, 0x90
+			DB 0x60, 0x02, 0x40, 0x99, 0x40, 0x04, 0x20, 0x97
+			DB 0x20, 0x07, 0x60, 0x93, 0x60, 0x20, 0x02, 0x20
+			DB 0x60, 0x20, 0x03, 0x40, 0x91, 0x40, 0x03, 0x40
+			DB 0x82, 0x40, 0x03, 0x20, 0x60, 0x8E, 0x40, 0x03
+			DB 0x60, 0x84, 0x60, 0x04, 0x60, 0x8B, 0x60, 0x20
+			DB 0x02, 0x20, 0x60, 0x86, 0x60, 0x20, 0x03, 0x40
+			DB 0x89, 0x40, 0x03, 0x20, 0x8A, 0x40, 0x03, 0x20
+			DB 0x60, 0x86, 0x60, 0x03, 0x40, 0x8C, 0x40, 0x04
+			DB 0x86, 0x60, 0x02, 0x40, 0x8E, 0x60, 0x03, 0x86
+			DB 0x60, 0x00, 0x20, 0x60, 0x91, 0x20, 0x01, 0x86
+			DB 0x60, 0x20, 0x94, 0x40, 0x00, 0x9E, 0x40, 0xC3
+; L L
+			DB 0xC2, 0x60, 0x57, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x34, 0x02, 0x9C, 0x20, 0x01
+			DB 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20
+			DB 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C
+			DB 0x20, 0x01, 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01
+			DB 0x9C, 0x20, 0x01, 0x9C, 0x40, 0x21, 0xE3
+; M M
+			DB 0x83, 0x60, 0x44, 0x23, 0x0D, 0x86, 0x60, 0x17
+			DB 0x86, 0x60, 0x04, 0x25, 0x44, 0x64, 0x89, 0x60
+			DB 0x02, 0x20, 0x40, 0x60, 0x98, 0x60, 0x20, 0x05
+			DB 0x40, 0x60, 0x97, 0x60, 0x40, 0x20, 0x05, 0x40
+			DB 0x60, 0x97, 0x60, 0x40, 0x20, 0x04, 0x20, 0x40
+			DB 0x60, 0x97, 0x60, 0x40, 0x05, 0x20, 0x99, 0x60
+			DB 0x20, 0x03, 0x97, 0x60, 0x40, 0x04, 0x20, 0x94
+			DB 0x60, 0x40, 0x20, 0x04, 0x40, 0x60, 0x93, 0x40
+			DB 0x20, 0x04, 0x20, 0x40, 0x93, 0x60, 0x40, 0x04
+			DB 0x20, 0x40, 0x60, 0x94, 0x60, 0x03, 0x20, 0x40
+			DB 0x60, 0x97, 0x60, 0x02, 0x20, 0x44, 0x63, 0x91
+			DB 0x60, 0x10, 0x23, 0x42, 0x86, 0x60, 0x17, 0x8B
+			DB 0x62, 0x43, 0x23, 0x08, 0x9A, 0x62, 0x41, 0xA3
+; N N
+			DB 0x82, 0x60, 0x57, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x17, 0x86, 0x60, 0x03, 0x20, 0x40, 0x60, 0x50
+			DB 0x86, 0x60, 0x05, 0x40, 0x60, 0x98, 0x40, 0x05
+			DB 0x40, 0x60, 0x97, 0x60, 0x40, 0x05, 0x40, 0x60
+			DB 0x97, 0x60, 0x40, 0x05, 0x40, 0x60, 0x97, 0x60
+			DB 0x40, 0x05, 0x40, 0x60, 0x97, 0x60, 0x40, 0x05
+			DB 0x40, 0x60, 0x97, 0x60, 0x40, 0x05, 0x40, 0x60
+			DB 0x97, 0x60, 0x40, 0x05, 0x40, 0x60, 0x97, 0x60
+			DB 0x40, 0x05, 0x40, 0x60, 0x97, 0x60, 0x40, 0x05
+			DB 0x86, 0x60, 0x2F, 0x42, 0x04, 0x86, 0x60, 0x17
+			DB 0x86, 0x60, 0x17, 0x87, 0x77, 0xC3
+; O O
+			DB 0x87, 0x60, 0x20, 0x0C, 0x40, 0x60, 0x8D, 0x40
+			DB 0x10, 0x40, 0x8B, 0x20, 0x04, 0x20, 0x44, 0x21
+			DB 0x05, 0x40, 0x89, 0x20, 0x02, 0x20, 0x40, 0x89
+			DB 0x40, 0x20, 0x03, 0x60, 0x87, 0x60, 0x02, 0x40
+			DB 0x8D, 0x40, 0x02, 0x40, 0x87, 0x20, 0x01, 0x40
+			DB 0x8F, 0x40, 0x01, 0x20, 0x86, 0x60, 0x02, 0x91
+			DB 0x02, 0x60, 0x85, 0x40, 0x01, 0x40, 0x91, 0x20
+			DB 0x01, 0x60, 0x85, 0x40, 0x01, 0x40, 0x91, 0x20
+			DB 0x01, 0x60, 0x85, 0x40, 0x01, 0x40, 0x91, 0x20
+			DB 0x01, 0x60, 0x85, 0x40, 0x01, 0x40, 0x91, 0x02
+			DB 0x86, 0x60, 0x02, 0x90, 0x40, 0x01, 0x20, 0x87
+			DB 0x02, 0x20, 0x8E, 0x40, 0x02, 0x40, 0x87, 0x40
+			DB 0x02, 0x20, 0x60, 0x8B, 0x40, 0x02, 0x20, 0x89
+			DB 0x20, 0x03, 0x20, 0x40, 0x61, 0x83, 0x60, 0x41
+			DB 0x04, 0x60, 0x89, 0x60, 0x20, 0x11, 0x60, 0x8C
+			DB 0x40, 0x0E, 0x40, 0x8F, 0x60, 0x40, 0x20, 0x08
+			DB 0x20, 0x40, 0x60, 0x93, 0x61, 0x44, 0x60, 0xAC
+; P P
+			DB 0xC2, 0x60, 0x57, 0x86, 0x40, 0x17, 0x86, 0x40
+			DB 0x17, 0x86, 0x40, 0x01, 0x29, 0x02, 0x28, 0x86
+			DB 0x40, 0x01, 0x60, 0x88, 0x20, 0x01, 0x8F, 0x40
+			DB 0x01, 0x60, 0x88, 0x20, 0x01, 0x8F, 0x40, 0x01
+			DB 0x60, 0x88, 0x20, 0x01, 0x8F, 0x40, 0x01, 0x60
+			DB 0x88, 0x20, 0x01, 0x8F, 0x40, 0x01, 0x40, 0x88
+			DB 0x01, 0x20, 0x8F, 0x60, 0x01, 0x40, 0x87, 0x60
+			DB 0x01, 0x40, 0x90, 0x02, 0x87, 0x20, 0x01, 0x60
+			DB 0x90, 0x20, 0x01, 0x20, 0x85, 0x40, 0x01, 0x20
+			DB 0x91, 0x60, 0x02, 0x20, 0x40, 0x61, 0x40, 0x20
+			DB 0x02, 0x60, 0x92, 0x40, 0x09, 0x40, 0x94, 0x40
+			DB 0x07, 0x40, 0x96, 0x60, 0x40, 0x20, 0x01, 0x20
+			DB 0x40, 0xD1
+; Q Q
+			DB 0x89, 0x60, 0x41, 0x20, 0x03, 0x21, 0x41, 0x91
+			DB 0x60, 0x20, 0x0C, 0x40, 0x60, 0x8D, 0x40, 0x10
+			DB 0x40, 0x8B, 0x20, 0x04, 0x20, 0x44, 0x21, 0x05
+			DB 0x40, 0x89, 0x20, 0x02, 0x20, 0x40, 0x89, 0x40
+			DB 0x20, 0x03, 0x60, 0x87, 0x60, 0x02, 0x40, 0x8D
+			DB 0x40, 0x02, 0x40, 0x87, 0x20, 0x01, 0x40, 0x8F
+			DB 0x40, 0x01, 0x20, 0x86, 0x60, 0x02, 0x91, 0x02
+			DB 0x60, 0x85, 0x40, 0x01, 0x40, 0x91, 0x20, 0x01
+			DB 0x60, 0x85, 0x40, 0x01, 0x40, 0x90, 0x03, 0x60
+			DB 0x85, 0x40, 0x01, 0x40, 0x8F, 0x40, 0x04, 0x85
+			DB 0x40, 0x01, 0x40, 0x90, 0x05, 0x40, 0x83, 0x60
+			DB 0x02, 0x90, 0x40, 0x05, 0x40, 0x83, 0x02, 0x20
+			DB 0x8E, 0x40, 0x02, 0x40, 0x03, 0x83, 0x40, 0x02
+			DB 0x20, 0x60, 0x8B, 0x40, 0x02, 0x20, 0x81, 0x02
+			DB 0x84, 0x20, 0x03, 0x20, 0x40, 0x61, 0x83, 0x60
+			DB 0x41, 0x04, 0x60, 0x81, 0x41, 0x00, 0x84, 0x60
+			DB 0x20, 0x11, 0x60, 0x84, 0x60, 0x86, 0x40, 0x0E
+			DB 0x40, 0x8F, 0x60, 0x40, 0x20, 0x08, 0x20, 0x40
+			DB 0x60, 0x93, 0x61, 0x44, 0x60, 0x8C
+; R R
+			DB 0xC2, 0x60, 0x17, 0x86, 0x40, 0x17, 0x86, 0x40
+			DB 0x17, 0x86, 0x40, 0x01, 0x40, 0x66, 0x40, 0x01
+			DB 0x40, 0x69, 0x86, 0x40, 0x01, 0x60, 0x86, 0x60
+			DB 0x01, 0x20, 0x60, 0x8F, 0x40, 0x01, 0x60, 0x86
+			DB 0x60, 0x03, 0x60, 0x8E, 0x40, 0x01, 0x60, 0x86
+			DB 0x60, 0x04, 0x40, 0x8D, 0x40, 0x01, 0x60, 0x86
+			DB 0x40, 0x05, 0x40, 0x8C, 0x40, 0x01, 0x40, 0x86
+			DB 0x40, 0x00, 0x20, 0x60, 0x03, 0x20, 0x60, 0x8A
+			DB 0x60, 0x01, 0x20, 0x85, 0x60, 0x01, 0x40, 0x81
+			DB 0x20, 0x03, 0x60, 0x8A, 0x02, 0x40, 0x84, 0x20
+			DB 0x01, 0x60, 0x82, 0x40, 0x03, 0x40, 0x89, 0x40
+			DB 0x02, 0x40, 0x61, 0x40, 0x20, 0x01, 0x20, 0x84
+			DB 0x40, 0x03, 0x40, 0x88, 0x60, 0x09, 0x60, 0x85
+			DB 0x60, 0x03, 0x20, 0x88, 0x60, 0x07, 0x60, 0x88
+			DB 0x20, 0x02, 0x89, 0x60, 0x40, 0x20, 0x01, 0x20
+			DB 0x40, 0x8B, 0x40, 0x01, 0x9D, 0x40, 0x00, 0x9E
+			DB 0x60, 0xA3
+; S S
+			DB 0xC7, 0x60, 0x41, 0x60, 0x8B, 0x60, 0x40, 0x20
+			DB 0x40, 0x89, 0x60, 0x20, 0x04, 0x40, 0x89, 0x60
+			DB 0x01, 0x20, 0x88, 0x40, 0x07, 0x40, 0x89, 0x02
+			DB 0x87, 0x60, 0x03, 0x21, 0x03, 0x40, 0x88, 0x20
+			DB 0x01, 0x87, 0x40, 0x01, 0x20, 0x82, 0x60, 0x03
+			DB 0x88, 0x40, 0x01, 0x60, 0x86, 0x02, 0x84, 0x40
+			DB 0x02, 0x40, 0x87, 0x40, 0x01, 0x60, 0x85, 0x60
+			DB 0x01, 0x40, 0x85, 0x20, 0x01, 0x20, 0x87, 0x40
+			DB 0x01, 0x60, 0x85, 0x40, 0x01, 0x60, 0x85, 0x40
+			DB 0x02, 0x40, 0x86, 0x40, 0x01, 0x60, 0x85, 0x40
+			DB 0x01, 0x60, 0x86, 0x02, 0x20, 0x86, 0x20, 0x01
+			DB 0x86, 0x40, 0x01, 0x60, 0x86, 0x40, 0x02, 0x60
+			DB 0x85, 0x01, 0x20, 0x86, 0x40, 0x01, 0x60, 0x86
+			DB 0x60, 0x02, 0x20, 0x84, 0x40, 0x01, 0x40, 0x86
+			DB 0x40, 0x01, 0x40, 0x87, 0x40, 0x02, 0x20, 0x60
+			DB 0x81, 0x40, 0x02, 0x60, 0x86, 0x60, 0x01, 0x40
+			DB 0x87, 0x60, 0x09, 0x40, 0x87, 0x60, 0x01, 0x40
+			DB 0x88, 0x60, 0x07, 0x20, 0x96, 0x60, 0x20, 0x04
+			DB 0x40, 0x99, 0x60, 0x41, 0x60, 0xC8
+; T T
+			DB 0xA2, 0x60, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x40
+			DB 0x9B, 0x60, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x40
+			DB 0x9B, 0x60, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x40
+			DB 0x9B, 0x60, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x35
+			DB 0x86, 0x60, 0x17, 0x86, 0x60, 0x17, 0x86, 0x60
+			DB 0x01, 0x20, 0x54, 0x86, 0x60, 0x01, 0x40, 0x9B
+			DB 0x60, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x40, 0x9B
+			DB 0x60, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x40, 0x9B
+			DB 0x60, 0x01, 0x40, 0x9B, 0x60, 0x21, 0x40, 0xB8
+; U U
+			DB 0xA2, 0x60, 0x10, 0x21, 0x40, 0x60, 0x89, 0x60
+			DB 0x14, 0x40, 0x88, 0x60, 0x15, 0x40, 0x88, 0x70
+			DB 0x41, 0x03, 0x60, 0x9A, 0x60, 0x20, 0x01, 0x40
+			DB 0x9B, 0x60, 0x02, 0x9C, 0x20, 0x01, 0x60, 0x9B
+			DB 0x40, 0x01, 0x60, 0x9B, 0x40, 0x01, 0x60, 0x9B
+			DB 0x40, 0x01, 0x60, 0x9B, 0x20, 0x01, 0x9C, 0x01
+			DB 0x20, 0x9B, 0x40, 0x01, 0x40, 0x99, 0x60, 0x20
+			DB 0x02, 0x60, 0x86, 0x60, 0x30, 0x04, 0x40, 0x87
+			DB 0x60, 0x14, 0x40, 0x88, 0x60, 0x12, 0x40, 0x60
+			DB 0x89, 0x60, 0x50, 0x60, 0xA9
+; V V
+			DB 0x82, 0x60, 0x00, 0x20, 0x40, 0x60, 0x9A, 0x60
+			DB 0x03, 0x20, 0x40, 0x60, 0x97, 0x60, 0x06, 0x20
+			DB 0x40, 0x60, 0x95, 0x40, 0x20, 0x07, 0x20, 0x40
+			DB 0x60, 0x95, 0x40, 0x20, 0x07, 0x20, 0x40, 0x60
+			DB 0x95, 0x41, 0x07, 0x20, 0x40, 0x60, 0x95, 0x60
+			DB 0x40, 0x07, 0x20, 0x40, 0x60, 0x95, 0x60, 0x40
+			DB 0x20, 0x06, 0x20, 0x40, 0x96, 0x60, 0x40, 0x20
+			DB 0x05, 0x99, 0x60, 0x40, 0x20, 0x02, 0x98, 0x60
+			DB 0x40, 0x20, 0x03, 0x95, 0x60, 0x40, 0x06, 0x20
+			DB 0x92, 0x60, 0x40, 0x06, 0x20, 0x40, 0x60, 0x90
+			DB 0x40, 0x20, 0x06, 0x20, 0x40, 0x60, 0x90, 0x40
+			DB 0x20, 0x07, 0x40, 0x60, 0x90, 0x40, 0x20, 0x07
+			DB 0x40, 0x60, 0x90, 0x60, 0x20, 0x07, 0x40, 0x60
+			DB 0x93, 0x60, 0x05, 0x20, 0x40, 0x96, 0x60, 0x02
+			DB 0x20, 0x40, 0x99, 0x60, 0x20, 0x40, 0x99
+; W W
+			DB 0x82, 0x60, 0x0B, 0x22, 0x43, 0x63, 0x87, 0x60
+			DB 0x17, 0x87, 0x61, 0x44, 0x23, 0x0C, 0x97, 0x62
+			DB 0x40, 0x03, 0x97, 0x60, 0x40, 0x20, 0x04, 0x94
+			DB 0x60, 0x40, 0x20, 0x04, 0x20, 0x40, 0x92, 0x60
+			DB 0x40, 0x20, 0x04, 0x20, 0x40, 0x93, 0x40, 0x20
+			DB 0x04, 0x20, 0x40, 0x96, 0x03, 0x20, 0x60, 0x99
+			DB 0x05, 0x40, 0x60, 0x97, 0x60, 0x40, 0x20, 0x05
+			DB 0x40, 0x60, 0x97, 0x60, 0x40, 0x20, 0x04, 0x20
+			DB 0x40, 0x60, 0x97, 0x60, 0x40, 0x05, 0x20, 0x40
+			DB 0x98, 0x60, 0x40, 0x04, 0x93, 0x63, 0x43, 0x20
+			DB 0x02, 0x86, 0x60, 0x42, 0x23, 0x10, 0x86, 0x60
+			DB 0x15, 0x21, 0x86, 0x60, 0x07, 0x23, 0x42, 0x63
+			DB 0x8B, 0x60, 0x40, 0x63, 0xB6
+; X X
+			DB 0x82, 0x60, 0x00, 0x20, 0x60, 0x90, 0x60, 0x20
+			DB 0x01, 0x86, 0x60, 0x02, 0x40, 0x8E, 0x40, 0x03
+			DB 0x86, 0x60, 0x03, 0x20, 0x60, 0x8A, 0x60, 0x20
+			DB 0x03, 0x20, 0x87, 0x40, 0x04, 0x40, 0x88, 0x40
+			DB 0x04, 0x40, 0x89, 0x60, 0x20, 0x03, 0x20, 0x60
+			DB 0x84, 0x60, 0x20, 0x03, 0x20, 0x60, 0x8C, 0x60
+			DB 0x20, 0x03, 0x20, 0x60, 0x80, 0x60, 0x20, 0x03
+			DB 0x20, 0x60, 0x90, 0x40, 0x04, 0x40, 0x04, 0x40
+			DB 0x93, 0x60, 0x20, 0x06, 0x40, 0x97, 0x40, 0x04
+			DB 0x40, 0x97, 0x40, 0x06, 0x40, 0x94, 0x60, 0x20
+			DB 0x08, 0x20, 0x60, 0x91, 0x40, 0x03, 0x20, 0x60
+			DB 0x80, 0x40, 0x04, 0x20, 0x60, 0x8D, 0x40, 0x04
+			DB 0x40, 0x83, 0x60, 0x20, 0x04, 0x40, 0x8A, 0x60
+			DB 0x20, 0x03, 0x20, 0x60, 0x86, 0x60, 0x04, 0x20
+			DB 0x60, 0x87, 0x60, 0x04, 0x40, 0x8A, 0x40, 0x04
+			DB 0x40, 0x86, 0x60, 0x02, 0x40, 0x8D, 0x60, 0x20
+			DB 0x03, 0x86, 0x60, 0x00, 0x20, 0x60, 0x90, 0x40
+			DB 0x02, 0x86, 0x60, 0x40, 0x93, 0x60, 0x20, 0x00
+			DB 0x9E, 0x40, 0xA3
+; Y Y
+			DB 0x82, 0x60, 0x02, 0x40, 0x9A, 0x60, 0x04, 0x40
+			DB 0x99, 0x40, 0x04, 0x20, 0x60, 0x99, 0x40, 0x04
+			DB 0x20, 0x60, 0x99, 0x40, 0x04, 0x40, 0x60, 0x98
+			DB 0x60, 0x20, 0x04, 0x40, 0x99, 0x60, 0x20, 0x04
+			DB 0x40, 0x99, 0x60, 0x20, 0x0C, 0x92, 0x60, 0x0B
+			DB 0x91, 0x40, 0x20, 0x0B, 0x8F, 0x40, 0x04, 0x20
+			DB 0x68, 0x8D, 0x60, 0x20, 0x03, 0x20, 0x60, 0x95
+			DB 0x60, 0x20, 0x04, 0x40, 0x96, 0x40, 0x04, 0x40
+			DB 0x96, 0x40, 0x04, 0x20, 0x60, 0x95, 0x60, 0x20
+			DB 0x03, 0x20, 0x60, 0x97, 0x60, 0x03, 0x40, 0x99
+			DB 0x60, 0x01, 0x40, 0x9B, 0x60, 0x20, 0x60, 0xB9
+; Z Z
+			DB 0x83, 0x62, 0x91, 0x42, 0x86, 0x60, 0x01, 0x20
+			DB 0x8F, 0x60, 0x20, 0x02, 0x86, 0x60, 0x01, 0x20
+			DB 0x8E, 0x40, 0x04, 0x86, 0x60, 0x01, 0x20, 0x8C
+			DB 0x60, 0x20, 0x05, 0x86, 0x60, 0x01, 0x20, 0x8B
+			DB 0x40, 0x03, 0x20, 0x02, 0x86, 0x60, 0x01, 0x20
+			DB 0x89, 0x60, 0x20, 0x03, 0x40, 0x80, 0x02, 0x86
+			DB 0x60, 0x01, 0x20, 0x88, 0x40, 0x03, 0x20, 0x60
+			DB 0x81, 0x02, 0x86, 0x60, 0x01, 0x20, 0x86, 0x60
+			DB 0x20, 0x03, 0x40, 0x83, 0x02, 0x86, 0x60, 0x01
+			DB 0x20, 0x85, 0x40, 0x03, 0x20, 0x60, 0x84, 0x02
+			DB 0x86, 0x60, 0x01, 0x20, 0x83, 0x60, 0x20, 0x03
+			DB 0x40, 0x86, 0x02, 0x86, 0x60, 0x01, 0x20, 0x82
+			DB 0x40, 0x03, 0x20, 0x60, 0x87, 0x02, 0x86, 0x60
+			DB 0x01, 0x20, 0x80, 0x60, 0x20, 0x03, 0x40, 0x89
+			DB 0x02, 0x86, 0x60, 0x01, 0x20, 0x40, 0x03, 0x20
+			DB 0x60, 0x8A, 0x02, 0x86, 0x60, 0x06, 0x40, 0x8C
+			DB 0x02, 0x86, 0x60, 0x04, 0x20, 0x60, 0x8D, 0x02
+			DB 0x86, 0x60, 0x03, 0x40, 0x8F, 0x02, 0x86, 0x60
+			DB 0x01, 0x20, 0x60, 0x90, 0x02, 0x9C, 0x62, 0xC3
+; [ lsqbracket
+			DB 0xFF, 0x5F, 0x20, 0x1D, 0x40, 0x20, 0x1D, 0x40
+			DB 0x20, 0x00, 0x20, 0x59, 0x01, 0x40, 0x20, 0x00
+			DB 0x20, 0x98, 0x40, 0x01, 0x40, 0x20, 0x00, 0x20
+			DB 0x98, 0x40, 0x01, 0x40, 0x20, 0x00, 0x20, 0x98
+			DB 0x40, 0x01, 0x40, 0x20, 0x00, 0x20, 0x98, 0x40
+			DB 0x01, 0x40, 0x20, 0x00, 0x20, 0x98, 0x40, 0x01
+			DB 0x41, 0x20, 0x40, 0x98, 0x43, 0xFF, 0xBF
+; \ backslash
+			DB 0xC2, 0x41, 0x60, 0x9C, 0x20, 0x01, 0x20, 0x40
+			DB 0x9A, 0x05, 0x40, 0x60, 0x98, 0x40, 0x20, 0x04
+			DB 0x20, 0x60, 0x98, 0x60, 0x20, 0x04, 0x20, 0x40
+			DB 0x98, 0x60, 0x40, 0x05, 0x40, 0x60, 0x98, 0x40
+			DB 0x20, 0x04, 0x20, 0x60, 0x98, 0x60, 0x20, 0x04
+			DB 0x20, 0x40, 0x98, 0x60, 0x40, 0x05, 0x40, 0x60
+			DB 0x98, 0x40, 0x20, 0x04, 0x20, 0x60, 0x98, 0x60
+			DB 0x20, 0x04, 0x20, 0x40, 0x98, 0x60, 0x40, 0x03
+			DB 0x20, 0x9B, 0x40, 0x20, 0x00, 0x40, 0x9D, 0x60
+			DB 0xFF, 0x83
+; ] rsqbracket
+			DB 0xDF, 0x42, 0x98, 0x43, 0x20, 0x00, 0x20, 0x98
+			DB 0x40, 0x01, 0x40, 0x20, 0x00, 0x20, 0x98, 0x40
+			DB 0x01, 0x40, 0x20, 0x00, 0x20, 0x98, 0x40, 0x01
+			DB 0x40, 0x20, 0x00, 0x20, 0x98, 0x40, 0x01, 0x40
+			DB 0x20, 0x00, 0x20, 0x98, 0x40, 0x01, 0x40, 0x20
+			DB 0x00, 0x20, 0x78, 0x40, 0x01, 0x40, 0x20, 0x1D
+			DB 0x40, 0x20, 0x1D, 0x41, 0x3D, 0x40, 0xFF, 0xDF
+; ^ caret
+			DB 0xAC, 0x60, 0x40, 0x9C, 0x40, 0x01, 0x60, 0x99
+			DB 0x40, 0x03, 0x40, 0x97, 0x60, 0x20, 0x02, 0x20
+			DB 0x60, 0x96, 0x60, 0x20, 0x02, 0x20, 0x60, 0x97
+			DB 0x40, 0x02, 0x20, 0x40, 0x97, 0x60, 0x03, 0x40
+			DB 0x99, 0x60, 0x01, 0x40, 0x9B, 0x60, 0x02, 0x40
+			DB 0x9B, 0x40, 0x03, 0x40, 0x9A, 0x60, 0x20, 0x02
+			DB 0x20, 0x60, 0x9A, 0x60, 0x20, 0x02, 0x20, 0x60
+			DB 0x9A, 0x40, 0x03, 0x40, 0x9A, 0x60, 0x20, 0x02
+			DB 0x40, 0x9B, 0x60, 0x20, 0x00, 0x9E, 0x60, 0xF0
+; _ underline
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+; ` backquote
+			DB 0xFF, 0x81, 0x60, 0x20, 0x9C, 0x40, 0x01, 0x40
+			DB 0x9B, 0x60, 0x01, 0x20, 0x9C, 0x40, 0x01, 0x40
+			DB 0x9C, 0x01, 0x20, 0x9C, 0x40, 0x01, 0x40, 0x9C
+			DB 0x20, 0x00, 0x20, 0x9C, 0x60, 0x00, 0x20, 0x9D
+			DB 0x60, 0xFF, 0xF9
+; a a
+			DB 0xB6, 0x61, 0x91, 0x60, 0x87, 0x60, 0x20, 0x03
+			DB 0x40, 0x8E, 0x60, 0x01, 0x40, 0x84, 0x60, 0x06
+			DB 0x60, 0x8D, 0x40, 0x01, 0x85, 0x20, 0x01, 0x21
+			DB 0x02, 0x20, 0x8D, 0x20, 0x00, 0x20, 0x84, 0x60
+			DB 0x01, 0x40, 0x82, 0x20, 0x01, 0x60, 0x8C, 0x01
+			DB 0x40, 0x84, 0x40, 0x00, 0x20, 0x83, 0x40, 0x01
+			DB 0x60, 0x8B, 0x60, 0x01, 0x60, 0x84, 0x01, 0x60
+			DB 0x83, 0x60, 0x01, 0x60, 0x8B, 0x60, 0x01, 0x60
+			DB 0x83, 0x60, 0x01, 0x84, 0x60, 0x01, 0x8C, 0x60
+			DB 0x01, 0x60, 0x83, 0x60, 0x01, 0x84, 0x40, 0x00
+			DB 0x20, 0x8C, 0x60, 0x01, 0x40, 0x83, 0x40, 0x00
+			DB 0x20, 0x84, 0x01, 0x40, 0x8D, 0x01, 0x20, 0x83
+			DB 0x40, 0x00, 0x20, 0x83, 0x20, 0x00, 0x20, 0x8E
+			DB 0x20, 0x01, 0x40, 0x82, 0x40, 0x00, 0x20, 0x81
+			DB 0x40, 0x20, 0x00, 0x20, 0x8F, 0x40, 0x03, 0x22
+			DB 0x01, 0x20, 0x02, 0x20, 0x42, 0x8E, 0x20, 0x0F
+			DB 0x8E, 0x60, 0x20, 0x0E, 0x90, 0x60, 0x4D, 0xE3
+; b b
+			DB 0xC0, 0x60, 0x58, 0x60, 0x84, 0x60, 0x18, 0x20
+			DB 0x84, 0x60, 0x19, 0x84, 0x60, 0x29, 0x40, 0x20
+			DB 0x03, 0x26, 0x02, 0x8F, 0x20, 0x01, 0x40, 0x60
+			DB 0x87, 0x40, 0x01, 0x60, 0x8D, 0x20, 0x00, 0x20
+			DB 0x60, 0x89, 0x60, 0x01, 0x60, 0x8C, 0x40, 0x00
+			DB 0x20, 0x8B, 0x60, 0x01, 0x60, 0x8C, 0x01, 0x40
+			DB 0x8B, 0x60, 0x01, 0x60, 0x8B, 0x60, 0x01, 0x60
+			DB 0x8B, 0x40, 0x01, 0x8C, 0x60, 0x01, 0x60, 0x8B
+			DB 0x20, 0x00, 0x20, 0x8C, 0x60, 0x01, 0x20, 0x8A
+			DB 0x40, 0x01, 0x40, 0x8D, 0x02, 0x40, 0x88, 0x40
+			DB 0x02, 0x60, 0x8D, 0x40, 0x02, 0x20, 0x40, 0x60
+			DB 0x82, 0x60, 0x40, 0x20, 0x02, 0x40, 0x8F, 0x20
+			DB 0x0C, 0x40, 0x90, 0x60, 0x20, 0x0A, 0x40, 0x93
+			DB 0x40, 0x20, 0x05, 0x20, 0x40, 0x98, 0x63, 0xAB
+; c c
+			DB 0xCE, 0x60, 0x40, 0x20, 0x02, 0x20, 0x41, 0x94
+			DB 0x60, 0x20, 0x08, 0x20, 0x60, 0x91, 0x40, 0x0C
+			DB 0x60, 0x8F, 0x40, 0x03, 0x20, 0x40, 0x62, 0x40
+			DB 0x04, 0x8F, 0x02, 0x20, 0x60, 0x86, 0x40, 0x02
+			DB 0x40, 0x8D, 0x40, 0x01, 0x20, 0x89, 0x20, 0x01
+			DB 0x20, 0x8D, 0x20, 0x01, 0x60, 0x8A, 0x02, 0x8D
+			DB 0x01, 0x20, 0x8B, 0x20, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x20, 0x8B, 0x20, 0x01, 0x8D, 0x01, 0x20
+			DB 0x8B, 0x20, 0x00, 0x20, 0x8D, 0x20, 0x01, 0x60
+			DB 0x89, 0x60, 0x01, 0x20, 0x8D, 0x40, 0x20, 0x40
+			DB 0x60, 0x89, 0x60, 0x20, 0x00, 0x40, 0xE3
+; d d
+			DB 0xAF, 0x60, 0x40, 0x22, 0x41, 0x60, 0x95, 0x40
+			DB 0x08, 0x20, 0x60, 0x91, 0x60, 0x20, 0x0B, 0x40
+			DB 0x8F, 0x60, 0x03, 0x21, 0x42, 0x21, 0x03, 0x60
+			DB 0x8E, 0x20, 0x01, 0x20, 0x60, 0x86, 0x40, 0x02
+			DB 0x20, 0x8D, 0x40, 0x01, 0x20, 0x89, 0x60, 0x02
+			DB 0x8D, 0x20, 0x01, 0x8B, 0x40, 0x01, 0x60, 0x8C
+			DB 0x01, 0x40, 0x8B, 0x60, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x60, 0x8B, 0x60, 0x01, 0x8C, 0x60, 0x01
+			DB 0x60, 0x8B, 0x40, 0x00, 0x20, 0x8C, 0x60, 0x01
+			DB 0x60, 0x8A, 0x60, 0x01, 0x40, 0x8C, 0x60, 0x01
+			DB 0x40, 0x89, 0x40, 0x01, 0x40, 0x8E, 0x01, 0x40
+			DB 0x86, 0x60, 0x40, 0x20, 0x01, 0x40, 0x86, 0x60
+			DB 0x15, 0x23, 0x84, 0x60, 0x19, 0x84, 0x60, 0x19
+			DB 0x85, 0x79, 0xC3
+; e e
+			DB 0xAF, 0x60, 0x43, 0x61, 0x96, 0x40, 0x20, 0x06
+			DB 0x20, 0x60, 0x92, 0x60, 0x20, 0x0A, 0x40, 0x90
+			DB 0x60, 0x06, 0x21, 0x04, 0x40, 0x8F, 0x02, 0x20
+			DB 0x60, 0x80, 0x01, 0x60, 0x81, 0x60, 0x20, 0x02
+			DB 0x60, 0x8D, 0x40, 0x01, 0x40, 0x82, 0x01, 0x60
+			DB 0x83, 0x20, 0x01, 0x40, 0x8D, 0x01, 0x20, 0x83
+			DB 0x01, 0x60, 0x84, 0x01, 0x20, 0x8C, 0x60, 0x01
+			DB 0x40, 0x83, 0x01, 0x60, 0x84, 0x40, 0x01, 0x8C
+			DB 0x60, 0x01, 0x60, 0x83, 0x01, 0x60, 0x84, 0x60
+			DB 0x01, 0x60, 0x8B, 0x60, 0x01, 0x60, 0x83, 0x01
+			DB 0x60, 0x84, 0x60, 0x01, 0x60, 0x8B, 0x60, 0x01
+			DB 0x40, 0x83, 0x01, 0x60, 0x84, 0x60, 0x01, 0x60
+			DB 0x8C, 0x20, 0x01, 0x60, 0x82, 0x01, 0x60, 0x84
+			DB 0x40, 0x01, 0x8D, 0x40, 0x02, 0x60, 0x81, 0x01
+			DB 0x60, 0x84, 0x40, 0x01, 0x8E, 0x20, 0x03, 0x20
+			DB 0x01, 0x60, 0x84, 0x20, 0x00, 0x20, 0x8F, 0x20
+			DB 0x05, 0x60, 0x84, 0x01, 0x40, 0x90, 0x40, 0x04
+			DB 0x60, 0x83, 0x60, 0x21, 0x60, 0x92, 0x60, 0x42
+			DB 0x60, 0xCB
+; f f
+			DB 0xAA, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x60
+			DB 0x97, 0x63, 0x40, 0x01, 0x40, 0x6C, 0x87, 0x60
+			DB 0x20, 0x15, 0x86, 0x40, 0x17, 0x85, 0x60, 0x18
+			DB 0x85, 0x20, 0x01, 0x20, 0x60, 0x83, 0x60, 0x01
+			DB 0x60, 0x91, 0x60, 0x01, 0x20, 0x85, 0x60, 0x01
+			DB 0x60, 0x91, 0x40, 0x01, 0x60, 0x85, 0x60, 0x01
+			DB 0x60, 0x91, 0x40, 0x01, 0x86, 0x60, 0x01, 0x60
+			DB 0x91, 0x40, 0x01, 0x86, 0x60, 0x01, 0x60, 0x91
+			DB 0x40, 0x01, 0x86, 0x60, 0x01, 0x60, 0x91, 0x60
+			DB 0x01, 0x60, 0x85, 0x60, 0x01, 0x60, 0x91, 0x60
+			DB 0x01, 0x40, 0x85, 0x60, 0x21, 0x60, 0x92, 0x61
+			DB 0x9B
+; g g
+			DB 0x8C, 0x60, 0x41, 0x21, 0x40, 0x60, 0x88, 0x40
+			DB 0x01, 0x8B, 0x40, 0x06, 0x40, 0x80, 0x60, 0x20
+			DB 0x01, 0x40, 0x80, 0x20, 0x02, 0x8A, 0x40, 0x08
+			DB 0x40, 0x20, 0x03, 0x20, 0x03, 0x89, 0x60, 0x02
+			DB 0x20, 0x42, 0x0A, 0x20, 0x60, 0x8A, 0x20, 0x01
+			DB 0x40, 0x84, 0x20, 0x02, 0x41, 0x02, 0x20, 0x8B
+			DB 0x60, 0x01, 0x20, 0x86, 0x01, 0x40, 0x81, 0x20
+			DB 0x01, 0x60, 0x8B, 0x40, 0x01, 0x60, 0x86, 0x20
+			DB 0x00, 0x20, 0x81, 0x40, 0x01, 0x60, 0x8B, 0x40
+			DB 0x01, 0x87, 0x40, 0x00, 0x20, 0x81, 0x40, 0x01
+			DB 0x60, 0x8B, 0x40, 0x01, 0x87, 0x40, 0x00, 0x20
+			DB 0x81, 0x40, 0x01, 0x60, 0x8B, 0x40, 0x01, 0x60
+			DB 0x86, 0x20, 0x00, 0x40, 0x81, 0x40, 0x01, 0x60
+			DB 0x8B, 0x60, 0x01, 0x40, 0x85, 0x60, 0x01, 0x40
+			DB 0x81, 0x40, 0x01, 0x60, 0x8C, 0x02, 0x40, 0x83
+			DB 0x60, 0x20, 0x01, 0x60, 0x81, 0x40, 0x01, 0x60
+			DB 0x8C, 0x03, 0x20, 0x42, 0x02, 0x40, 0x82, 0x40
+			DB 0x01, 0x40, 0x8C, 0x09, 0x20, 0x83, 0x60, 0x02
+			DB 0x40, 0x8B, 0x01, 0x21, 0x04, 0x40, 0x85, 0x20
+			DB 0x04, 0x89, 0x01, 0x40, 0x80, 0x60, 0x41, 0x60
+			DB 0x87, 0x60, 0x04, 0x89, 0x01, 0x40, 0x8D, 0x60
+			DB 0x20, 0x02, 0x89, 0x41, 0x60, 0x8F, 0x62, 0xBF
+; h h
+			DB 0xA0, 0x60, 0x59, 0x84, 0x60, 0x19, 0x84, 0x60
+			DB 0x19, 0x84, 0x60, 0x29, 0x40, 0x20, 0x03, 0x29
+			DB 0x8E, 0x60, 0x20, 0x01, 0x40, 0x60, 0x98, 0x60
+			DB 0x01, 0x20, 0x60, 0x9A, 0x20, 0x01, 0x9B, 0x60
+			DB 0x01, 0x40, 0x9B, 0x40, 0x01, 0x60, 0x9B, 0x40
+			DB 0x01, 0x60, 0x9B, 0x40, 0x01, 0x20, 0x9B, 0x60
+			DB 0x02, 0x20, 0x40, 0x6C, 0x8D, 0x20, 0x10, 0x8D
+			DB 0x60, 0x10, 0x8F, 0x40, 0x20, 0x0D, 0xFF, 0x83
+; i i
+			DB 0xA9, 0x62, 0x8B, 0x40, 0x21, 0x8D, 0x01, 0x40
+			DB 0x8B, 0x40, 0x01, 0x8D, 0x01, 0x40, 0x8B, 0x40
+			DB 0x01, 0x8D, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x8D
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x87, 0x60, 0x84
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x85, 0x60, 0x02
+			DB 0x40, 0x82, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x85
+			DB 0x20, 0x03, 0x82, 0x11, 0x85, 0x04, 0x60, 0x81
+			DB 0x11, 0x85, 0x20, 0x03, 0x82, 0x11, 0x86, 0x20
+			DB 0x00, 0x20, 0x60, 0x82, 0x6E, 0x40, 0x01, 0x9C
+			DB 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01
+			DB 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x62
+			DB 0xC3
+; j j
+			DB 0xA9, 0x41, 0x60, 0x9C, 0x01, 0x40, 0x9C, 0x01
+			DB 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C
+			DB 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40
+			DB 0x95, 0x60, 0x40, 0x60, 0x83, 0x01, 0x40, 0x94
+			DB 0x60, 0x02, 0x40, 0x82, 0x01, 0x40, 0x71, 0x40
+			DB 0x81, 0x20, 0x03, 0x60, 0x81, 0x15, 0x81, 0x04
+			DB 0x60, 0x81, 0x15, 0x81, 0x40, 0x02, 0x20, 0x82
+			DB 0x14, 0x20, 0x82, 0x40, 0x20, 0x40, 0xFF, 0xB9
+; k k
+			DB 0xA0, 0x60, 0x59, 0x84, 0x60, 0x19, 0x84, 0x60
+			DB 0x19, 0x84, 0x60, 0x2F, 0x00, 0x28, 0x94, 0x20
+			DB 0x00, 0x40, 0x9B, 0x20, 0x02, 0x40, 0x99, 0x20
+			DB 0x04, 0x20, 0x97, 0x20, 0x02, 0x20, 0x02, 0x20
+			DB 0x60, 0x94, 0x20, 0x02, 0x60, 0x80, 0x40, 0x03
+			DB 0x60, 0x91, 0x60, 0x03, 0x60, 0x82, 0x40, 0x03
+			DB 0x40, 0x8F, 0x60, 0x03, 0x60, 0x84, 0x40, 0x03
+			DB 0x40, 0x8E, 0x03, 0x60, 0x86, 0x60, 0x03, 0x40
+			DB 0x8D, 0x02, 0x60, 0x88, 0x60, 0x03, 0x8D, 0x01
+			DB 0x60, 0x8A, 0x60, 0x20, 0x01, 0x8D, 0x00, 0x60
+			DB 0x8D, 0x20, 0x00, 0x8D, 0x60, 0x8F, 0x20, 0xE3
+; l l
+			DB 0xA0, 0x60, 0x01, 0x60, 0x93, 0x40, 0x01, 0x84
+			DB 0x60, 0x01, 0x60, 0x93, 0x40, 0x01, 0x84, 0x60
+			DB 0x01, 0x60, 0x93, 0x40, 0x01, 0x84, 0x60, 0x01
+			DB 0x60, 0x93, 0x40, 0x01, 0x84, 0x60, 0x01, 0x60
+			DB 0x93, 0x40, 0x01, 0x84, 0x60, 0x01, 0x60, 0x93
+			DB 0x40, 0x01, 0x84, 0x60, 0x01, 0x54, 0x20, 0x01
+			DB 0x84, 0x60, 0x19, 0x84, 0x60, 0x19, 0x84, 0x60
+			DB 0x37, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01
+			DB 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40
+			DB 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x62, 0xC3
+; m m
+			DB 0x89, 0x11, 0x8D, 0x11, 0x8D, 0x61, 0x40, 0x20
+			DB 0x01, 0x20, 0x4A, 0x8E, 0x40, 0x01, 0x40, 0x9A
+			DB 0x40, 0x00, 0x20, 0x9C, 0x01, 0x60, 0x9B, 0x60
+			DB 0x01, 0x40, 0x9B, 0x60, 0x02, 0x20, 0x4D, 0x8D
+			DB 0x40, 0x10, 0x8E, 0x40, 0x21, 0x0D, 0x8F, 0x40
+			DB 0x01, 0x20, 0x41, 0x69, 0x8D, 0x60, 0x01, 0x20
+			DB 0x60, 0x9A, 0x20, 0x00, 0x20, 0x9B, 0x60, 0x01
+			DB 0x60, 0x9B, 0x60, 0x01, 0x20, 0x60, 0x9B, 0x11
+			DB 0x8D, 0x60, 0x10, 0x8F, 0x41, 0x2D, 0xC3
+; n n
+			DB 0xA9, 0x51, 0x8D, 0x11, 0x8D, 0x11, 0x8D, 0x42
+			DB 0x20, 0x02, 0x2A, 0x8E, 0x60, 0x20, 0x01, 0x40
+			DB 0x60, 0x99, 0x20, 0x00, 0x20, 0x60, 0x9A, 0x40
+			DB 0x01, 0x9C, 0x01, 0x40, 0x9B, 0x60, 0x01, 0x60
+			DB 0x9B, 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x20
+			DB 0x9C, 0x02, 0x20, 0x40, 0x6C, 0x8D, 0x40, 0x10
+			DB 0x8E, 0x20, 0x0F, 0x8F, 0x40, 0x20, 0x0D, 0xFF
+			DB 0x83
+; o o
+			DB 0x8E, 0x60, 0x41, 0x22, 0x41, 0x95, 0x60, 0x40
+			DB 0x08, 0x40, 0x92, 0x60, 0x0B, 0x20, 0x60, 0x8F
+			DB 0x60, 0x03, 0x20, 0x43, 0x20, 0x03, 0x20, 0x8F
+			DB 0x02, 0x20, 0x60, 0x85, 0x60, 0x20, 0x02, 0x40
+			DB 0x8D, 0x40, 0x01, 0x20, 0x89, 0x40, 0x01, 0x20
+			DB 0x8D, 0x20, 0x01, 0x60, 0x8A, 0x02, 0x8D, 0x01
+			DB 0x20, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60, 0x01
+			DB 0x40, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60, 0x01
+			DB 0x40, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60, 0x01
+			DB 0x20, 0x8B, 0x20, 0x01, 0x8D, 0x02, 0x60, 0x89
+			DB 0x60, 0x01, 0x20, 0x8D, 0x20, 0x01, 0x20, 0x88
+			DB 0x60, 0x02, 0x40, 0x8D, 0x60, 0x02, 0x20, 0x40
+			DB 0x84, 0x60, 0x40, 0x02, 0x20, 0x8F, 0x40, 0x04
+			DB 0x23, 0x03, 0x20, 0x91, 0x40, 0x0A, 0x20, 0x93
+			DB 0x60, 0x20, 0x06, 0x20, 0x40, 0x96, 0x61, 0x42
+			DB 0x61, 0xC9
+; p p
+			DB 0xC9, 0x55, 0x89, 0x15, 0x89, 0x15, 0x89, 0x42
+			DB 0x20, 0x03, 0x26, 0x02, 0x23, 0x8A, 0x60, 0x20
+			DB 0x01, 0x40, 0x60, 0x87, 0x40, 0x01, 0x8E, 0x20
+			DB 0x00, 0x20, 0x60, 0x89, 0x40, 0x01, 0x60, 0x8C
+			DB 0x40, 0x00, 0x20, 0x8B, 0x60, 0x01, 0x60, 0x8C
+			DB 0x01, 0x40, 0x8B, 0x60, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x60, 0x8B, 0x40, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x60, 0x8B, 0x20, 0x01, 0x8C, 0x60, 0x01
+			DB 0x20, 0x8A, 0x60, 0x01, 0x40, 0x8D, 0x02, 0x40
+			DB 0x88, 0x60, 0x02, 0x60, 0x8D, 0x40, 0x02, 0x20
+			DB 0x40, 0x60, 0x82, 0x60, 0x40, 0x20, 0x02, 0x40
+			DB 0x8F, 0x20, 0x0C, 0x20, 0x90, 0x60, 0x20, 0x0A
+			DB 0x40, 0x93, 0x40, 0x20, 0x05, 0x20, 0x40, 0x60
+			DB 0x97, 0x63, 0xAB
+; q q
+			DB 0xAF, 0x60, 0x40, 0x23, 0x40, 0x60, 0x95, 0x40
+			DB 0x08, 0x20, 0x60, 0x91, 0x60, 0x20, 0x0B, 0x40
+			DB 0x8F, 0x60, 0x03, 0x21, 0x42, 0x21, 0x03, 0x60
+			DB 0x8E, 0x20, 0x01, 0x20, 0x60, 0x86, 0x40, 0x02
+			DB 0x20, 0x8D, 0x60, 0x01, 0x20, 0x89, 0x60, 0x02
+			DB 0x8D, 0x20, 0x01, 0x8B, 0x40, 0x01, 0x60, 0x8C
+			DB 0x01, 0x40, 0x8B, 0x60, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x60, 0x8B, 0x60, 0x01, 0x8C, 0x60, 0x01
+			DB 0x60, 0x8B, 0x40, 0x00, 0x20, 0x8C, 0x60, 0x01
+			DB 0x60, 0x8A, 0x60, 0x01, 0x40, 0x8C, 0x60, 0x01
+			DB 0x60, 0x89, 0x40, 0x01, 0x40, 0x8E, 0x01, 0x40
+			DB 0x86, 0x60, 0x40, 0x20, 0x01, 0x40, 0x8F, 0x0D
+			DB 0x21, 0x05, 0x89, 0x15, 0x89, 0x20, 0x14, 0x89
+			DB 0x75, 0xBF
+; r r
+			DB 0xA9, 0x21, 0x40, 0x8B, 0x40, 0x21, 0x8D, 0x01
+			DB 0x40, 0x8B, 0x40, 0x01, 0x8D, 0x01, 0x40, 0x8B
+			DB 0x40, 0x01, 0x8D, 0x01, 0x40, 0x8B, 0x40, 0x01
+			DB 0x8D, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x8D, 0x01
+			DB 0x20, 0x4B, 0x20, 0x01, 0x8D, 0x11, 0x8D, 0x11
+			DB 0x8D, 0x43, 0x20, 0x02, 0x22, 0x43, 0x20, 0x01
+			DB 0x8F, 0x40, 0x02, 0x40, 0x60, 0x86, 0x40, 0x01
+			DB 0x8E, 0x40, 0x01, 0x20, 0x89, 0x40, 0x01, 0x8D
+			DB 0x40, 0x01, 0x40, 0x8A, 0x40, 0x01, 0x8D, 0x02
+			DB 0x8B, 0x40, 0x01, 0x8C, 0x60, 0x01, 0x40, 0x8B
+			DB 0x40, 0x21, 0x8C, 0x40, 0x01, 0x40, 0x9B, 0x40
+			DB 0x01, 0x40, 0x9B, 0x40, 0x01, 0x20, 0x9B, 0x60
+			DB 0x00, 0x20, 0x40, 0xB2
+; s s
+			DB 0xCD, 0x61, 0x88, 0x61, 0x40, 0x8F, 0x40, 0x03
+			DB 0x40, 0x85, 0x60, 0x01, 0x20, 0x8E, 0x20, 0x05
+			DB 0x40, 0x85, 0x20, 0x01, 0x8D, 0x40, 0x07, 0x60
+			DB 0x84, 0x40, 0x01, 0x60, 0x8C, 0x20, 0x01, 0x40
+			DB 0x60, 0x40, 0x02, 0x40, 0x84, 0x60, 0x01, 0x40
+			DB 0x8B, 0x60, 0x01, 0x40, 0x82, 0x40, 0x01, 0x20
+			DB 0x85, 0x01, 0x40, 0x8B, 0x60, 0x01, 0x60, 0x82
+			DB 0x60, 0x02, 0x85, 0x01, 0x40, 0x8B, 0x40, 0x01
+			DB 0x84, 0x20, 0x01, 0x60, 0x84, 0x01, 0x40, 0x8B
+			DB 0x40, 0x01, 0x84, 0x40, 0x01, 0x40, 0x83, 0x60
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x84, 0x40, 0x01
+			DB 0x20, 0x83, 0x40, 0x01, 0x60, 0x8B, 0x40, 0x01
+			DB 0x60, 0x84, 0x02, 0x40, 0x82, 0x20, 0x01, 0x8C
+			DB 0x60, 0x01, 0x60, 0x84, 0x20, 0x02, 0x41, 0x20
+			DB 0x01, 0x40, 0x8C, 0x60, 0x01, 0x40, 0x84, 0x60
+			DB 0x07, 0x60, 0x8D, 0x20, 0x41, 0x85, 0x40, 0x05
+			DB 0x40, 0x98, 0x40, 0x20, 0x01, 0x20, 0x60, 0xE5
+; t t
+			DB 0x89, 0x41, 0x60, 0x9C, 0x01, 0x40, 0x9C, 0x01
+			DB 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C
+			DB 0x01, 0x40, 0x96, 0x40, 0x24, 0x01, 0x2B, 0x40
+			DB 0x8A, 0x15, 0x40, 0x87, 0x60, 0x16, 0x60, 0x86
+			DB 0x60, 0x45, 0x01, 0x20, 0x49, 0x20, 0x02, 0x20
+			DB 0x8D, 0x01, 0x40, 0x8A, 0x40, 0x02, 0x8D, 0x01
+			DB 0x40, 0x8B, 0x20, 0x01, 0x60, 0x8C, 0x01, 0x40
+			DB 0x8B, 0x40, 0x01, 0x60, 0x8C, 0x01, 0x40, 0x8B
+			DB 0x40, 0x01, 0x60, 0x8C, 0x01, 0x40, 0x8B, 0x40
+			DB 0x01, 0x60, 0x8C, 0x01, 0x40, 0x8B, 0x40, 0x01
+			DB 0x8D, 0x01, 0x40, 0x8B, 0x20, 0x00, 0x20, 0x8D
+			DB 0x62, 0x8B, 0x60, 0x41, 0xC3
+; u u
+			DB 0xC9, 0x4D, 0x60, 0x90, 0x0F, 0x40, 0x8E, 0x10
+			DB 0x60, 0x8D, 0x2D, 0x02, 0x20, 0x9B, 0x60, 0x02
+			DB 0x60, 0x9B, 0x40, 0x01, 0x60, 0x9B, 0x60, 0x01
+			DB 0x60, 0x9B, 0x60, 0x01, 0x9C, 0x20, 0x00, 0x20
+			DB 0x9B, 0x40, 0x01, 0x60, 0x99, 0x60, 0x20, 0x01
+			DB 0x40, 0x8E, 0x69, 0x40, 0x20, 0x01, 0x20, 0x60
+			DB 0x8F, 0x11, 0x8D, 0x11, 0x8D, 0x11, 0xE3
+; v v
+			DB 0xA9, 0x00, 0x40, 0x60, 0x9C, 0x02, 0x20, 0x40
+			DB 0x9A, 0x05, 0x40, 0x60, 0x97, 0x40, 0x06, 0x20
+			DB 0x40, 0x97, 0x40, 0x20, 0x06, 0x40, 0x60, 0x96
+			DB 0x60, 0x40, 0x20, 0x05, 0x20, 0x40, 0x97, 0x60
+			DB 0x40, 0x06, 0x20, 0x60, 0x97, 0x40, 0x20, 0x05
+			DB 0x99, 0x60, 0x40, 0x20, 0x02, 0x98, 0x60, 0x40
+			DB 0x20, 0x03, 0x96, 0x40, 0x20, 0x05, 0x20, 0x93
+			DB 0x60, 0x40, 0x06, 0x40, 0x60, 0x91, 0x60, 0x40
+			DB 0x20, 0x05, 0x20, 0x40, 0x92, 0x40, 0x20, 0x06
+			DB 0x40, 0x60, 0x93, 0x06, 0x20, 0x40, 0x96, 0x04
+			DB 0x40, 0x60, 0x98, 0x01, 0x20, 0x60, 0x9B, 0x40
+			DB 0x60, 0xB3
+; w w
+			DB 0x89, 0x08, 0x20, 0x41, 0x61, 0x91, 0x0E, 0x21
+			DB 0x40, 0x8E, 0x61, 0x41, 0x21, 0x0A, 0x95, 0x61
+			DB 0x41, 0x21, 0x03, 0x98, 0x60, 0x40, 0x20, 0x03
+			DB 0x96, 0x40, 0x20, 0x04, 0x20, 0x40, 0x93, 0x40
+			DB 0x20, 0x04, 0x20, 0x40, 0x60, 0x93, 0x40, 0x05
+			DB 0x40, 0x60, 0x96, 0x40, 0x03, 0x60, 0x99, 0x40
+			DB 0x04, 0x20, 0x40, 0x98, 0x40, 0x20, 0x05, 0x40
+			DB 0x60, 0x97, 0x60, 0x40, 0x05, 0x20, 0x40, 0x60
+			DB 0x97, 0x40, 0x20, 0x05, 0x99, 0x60, 0x40, 0x03
+			DB 0x93, 0x61, 0x41, 0x21, 0x05, 0x8D, 0x41, 0x21
+			DB 0x0D, 0x8D, 0x0B, 0x20, 0x41, 0x61, 0x8E, 0x04
+			DB 0x21, 0x41, 0x60, 0x95, 0x20, 0x40, 0x61, 0xB1
+; x x
+			DB 0x89, 0x20, 0x8E, 0x60, 0x00, 0x8D, 0x00, 0x20
+			DB 0x60, 0x8B, 0x40, 0x01, 0x8D, 0x02, 0x40, 0x89
+			DB 0x40, 0x02, 0x8D, 0x03, 0x40, 0x87, 0x20, 0x02
+			DB 0x20, 0x8D, 0x60, 0x03, 0x20, 0x84, 0x60, 0x03
+			DB 0x40, 0x8F, 0x60, 0x20, 0x03, 0x60, 0x81, 0x40
+			DB 0x03, 0x40, 0x92, 0x40, 0x03, 0x41, 0x02, 0x20
+			DB 0x60, 0x94, 0x60, 0x06, 0x40, 0x97, 0x60, 0x20
+			DB 0x03, 0x40, 0x99, 0x20, 0x03, 0x20, 0x60, 0x96
+			DB 0x60, 0x20, 0x06, 0x40, 0x94, 0x40, 0x03, 0x41
+			DB 0x03, 0x40, 0x92, 0x40, 0x02, 0x20, 0x60, 0x81
+			DB 0x60, 0x03, 0x20, 0x60, 0x8E, 0x60, 0x20, 0x02
+			DB 0x20, 0x84, 0x60, 0x20, 0x03, 0x60, 0x8D, 0x03
+			DB 0x40, 0x87, 0x20, 0x03, 0x8D, 0x02, 0x60, 0x89
+			DB 0x40, 0x02, 0x8D, 0x00, 0x20, 0x8C, 0x60, 0x01
+			DB 0x8D, 0x40, 0x8E, 0x60, 0x20, 0xC3
+; y y
+			DB 0x89, 0x20, 0x40, 0x9D, 0x02, 0x40, 0x60, 0x9A
+			DB 0x04, 0x20, 0x40, 0x98, 0x20, 0x06, 0x40, 0x60
+			DB 0x96, 0x60, 0x40, 0x06, 0x20, 0x40, 0x97, 0x40
+			DB 0x20, 0x06, 0x40, 0x60, 0x85, 0x60, 0x8F, 0x60
+			DB 0x40, 0x20, 0x05, 0x20, 0x40, 0x81, 0x40, 0x20
+			DB 0x00, 0x92, 0x60, 0x40, 0x0A, 0x95, 0x41, 0x07
+			DB 0x94, 0x60, 0x40, 0x20, 0x04, 0x20, 0x40, 0x93
+			DB 0x40, 0x20, 0x05, 0x40, 0x60, 0x92, 0x60, 0x40
+			DB 0x05, 0x20, 0x40, 0x92, 0x60, 0x40, 0x20, 0x05
+			DB 0x20, 0x60, 0x92, 0x40, 0x20, 0x05, 0x20, 0x40
+			DB 0x60, 0x93, 0x06, 0x20, 0x60, 0x96, 0x03, 0x20
+			DB 0x40, 0x60, 0x98, 0x01, 0x20, 0x60, 0x9B, 0x40
+			DB 0x60, 0xD3
+; z z
+			DB 0xA9, 0x62, 0x8B, 0x60, 0x41, 0x8D, 0x01, 0x20
+			DB 0x8A, 0x40, 0x02, 0x8D, 0x01, 0x20, 0x89, 0x20
+			DB 0x03, 0x8D, 0x01, 0x20, 0x87, 0x60, 0x20, 0x04
+			DB 0x8D, 0x01, 0x20, 0x86, 0x40, 0x06, 0x8D, 0x01
+			DB 0x20, 0x85, 0x40, 0x03, 0x40, 0x20, 0x01, 0x8D
+			DB 0x01, 0x20, 0x84, 0x20, 0x02, 0x20, 0x60, 0x80
+			DB 0x02, 0x8D, 0x01, 0x20, 0x82, 0x60, 0x20, 0x02
+			DB 0x20, 0x82, 0x02, 0x8D, 0x01, 0x20, 0x81, 0x40
+			DB 0x03, 0x40, 0x83, 0x02, 0x8D, 0x01, 0x20, 0x80
+			DB 0x40, 0x03, 0x60, 0x84, 0x02, 0x8D, 0x01, 0x21
+			DB 0x02, 0x20, 0x60, 0x85, 0x02, 0x8D, 0x05, 0x20
+			DB 0x87, 0x02, 0x8D, 0x04, 0x40, 0x88, 0x02, 0x8D
+			DB 0x03, 0x60, 0x89, 0x02, 0x8D, 0x01, 0x20, 0x60
+			DB 0x8A, 0x02, 0x9C, 0x62, 0xE3
+; { lbrace
+			DB 0xAC, 0x40, 0x20, 0x40, 0x9C, 0x40, 0x00, 0x20
+			DB 0x9C, 0x20, 0x01, 0x9C, 0x20, 0x01, 0x60, 0x9A
+			DB 0x60, 0x00, 0x20, 0x00, 0x20, 0x93, 0x65, 0x40
+			DB 0x01, 0x40, 0x01, 0x20, 0x68, 0x86, 0x60, 0x20
+			DB 0x09, 0x60, 0x20, 0x0B, 0x40, 0x83, 0x40, 0x0A
+			DB 0x40, 0x80, 0x60, 0x0C, 0x20, 0x81, 0x60, 0x03
+			DB 0x25, 0x40, 0x60, 0x82, 0x60, 0x40, 0x28, 0x02
+			DB 0x40, 0x80, 0x40, 0x01, 0x40, 0x96, 0x60, 0x02
+			DB 0x80, 0x20, 0x00, 0x20, 0x98, 0x60, 0x01, 0x60
+			DB 0x01, 0x40, 0x99, 0x01, 0x40, 0x01, 0x60, 0x99
+			DB 0x20, 0x00, 0x40, 0x01, 0x60, 0x99, 0x20, 0x00
+			DB 0x40, 0x61, 0x9A, 0x62, 0xFF
+; | bar
+			DB 0xFF, 0xFF, 0x1F, 0x1F, 0x5F, 0xFF, 0xFF, 0x9F
+; } rbrace
+			DB 0xBF, 0x41, 0x60, 0x99, 0x41, 0x60, 0x01, 0x60
+			DB 0x99, 0x20, 0x00, 0x40, 0x01, 0x60, 0x99, 0x20
+			DB 0x00, 0x40, 0x01, 0x40, 0x99, 0x01, 0x40, 0x20
+			DB 0x00, 0x20, 0x98, 0x40, 0x01, 0x60, 0x40, 0x01
+			DB 0x20, 0x60, 0x94, 0x60, 0x40, 0x02, 0x81, 0x09
+			DB 0x20, 0x40, 0x82, 0x60, 0x20, 0x0B, 0x40, 0x81
+			DB 0x60, 0x0A, 0x40, 0x80, 0x40, 0x0C, 0x40, 0x83
+			DB 0x60, 0x40, 0x20, 0x08, 0x60, 0x0B, 0x20, 0x40
+			DB 0x8D, 0x60, 0x20, 0x00, 0x20, 0x01, 0x40, 0x99
+			DB 0x60, 0x02, 0x40, 0x9B, 0x20, 0x01, 0x9C, 0x20
+			DB 0x00, 0x20, 0x9C, 0x40, 0x00, 0x20, 0x9C, 0x60
+			DB 0x41, 0xEF
+; ~ tilde
+			DB 0x8A, 0x60, 0x9B, 0x60, 0x20, 0x01, 0x60, 0x99
+			DB 0x40, 0x03, 0x60, 0x99, 0x02, 0x40, 0x60, 0x99
+			DB 0x40, 0x01, 0x60, 0x9B, 0x40, 0x01, 0x9C, 0x40
+			DB 0x01, 0x60, 0x9C, 0x02, 0x60, 0x9B, 0x40, 0x02
+			DB 0x40, 0x9B, 0x40, 0x02, 0x60, 0x9B, 0x60, 0x01
+			DB 0x20, 0x9C, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9B
+			DB 0x60, 0x01, 0x20, 0x99, 0x40, 0x20, 0x02, 0x60
+			DB 0x99, 0x20, 0x02, 0x40, 0x9A, 0x40, 0x20, 0x40
+			DB 0x60, 0xF4
+;  7F
+			DB 0xC4, 0x40, 0x20, 0x01, 0x20, 0x40, 0x60, 0x97
+			DB 0x20, 0x06, 0x40, 0x95, 0x20, 0x08, 0x60, 0x93
+			DB 0x40, 0x01, 0x20, 0x60, 0x81, 0x60, 0x20, 0x01
+			DB 0x20, 0x93, 0x20, 0x00, 0x20, 0x85, 0x20, 0x01
+			DB 0x60, 0x91, 0x60, 0x01, 0x40, 0x85, 0x60, 0x01
+			DB 0x40, 0x91, 0x60, 0x01, 0x60, 0x86, 0x01, 0x40
+			DB 0x91, 0x60, 0x01, 0x60, 0x86, 0x01, 0x40, 0x91
+			DB 0x60, 0x01, 0x40, 0x85, 0x40, 0x01, 0x60, 0x92
+			DB 0x20, 0x01, 0x60, 0x83, 0x60, 0x01, 0x20, 0x93
+			DB 0x40, 0x02, 0x20, 0x41, 0x20, 0x02, 0x60, 0x94
+			DB 0x40, 0x07, 0x40, 0x96, 0x40, 0x05, 0x40, 0x99
+			DB 0x60, 0x41, 0x60, 0xFF, 0x95
+; € 80
+			DB 0xAE, 0x60, 0x41, 0x22, 0x41, 0x95, 0x60, 0x40
+			DB 0x08, 0x40, 0x8A, 0x60, 0x86, 0x60, 0x0B, 0x20
+			DB 0x60, 0x86, 0x60, 0x01, 0x20, 0x84, 0x60, 0x03
+			DB 0x20, 0x43, 0x20, 0x03, 0x20, 0x86, 0x20, 0x02
+			DB 0x40, 0x83, 0x02, 0x20, 0x60, 0x85, 0x60, 0x20
+			DB 0x02, 0x40, 0x85, 0x40, 0x02, 0x40, 0x82, 0x40
+			DB 0x01, 0x20, 0x89, 0x40, 0x01, 0x20, 0x86, 0x20
+			DB 0x00, 0x40, 0x83, 0x20, 0x01, 0x60, 0x8A, 0x02
+			DB 0x8D, 0x01, 0x20, 0x8B, 0x40, 0x01, 0x60, 0x8B
+			DB 0x60, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x60, 0x8B
+			DB 0x60, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x60, 0x85
+			DB 0x60, 0x40, 0x60, 0x82, 0x60, 0x01, 0x20, 0x8B
+			DB 0x20, 0x01, 0x85, 0x60, 0x02, 0x60, 0x82, 0x02
+			DB 0x60, 0x89, 0x60, 0x01, 0x20, 0x85, 0x20, 0x02
+			DB 0x40, 0x82, 0x20, 0x01, 0x20, 0x88, 0x60, 0x02
+			DB 0x40, 0x85, 0x40, 0x02, 0x60, 0x82, 0x60, 0x02
+			DB 0x20, 0x40, 0x84, 0x60, 0x40, 0x02, 0x20, 0x87
+			DB 0x40, 0x20, 0x60, 0x84, 0x40, 0x04, 0x23, 0x03
+			DB 0x20, 0x91, 0x40, 0x0A, 0x20, 0x93, 0x60, 0x20
+			DB 0x06, 0x20, 0x40, 0x96, 0x61, 0x42, 0x61, 0xA9
+;  81
+			DB 0xB6, 0x61, 0x91, 0x60, 0x87, 0x60, 0x20, 0x03
+			DB 0x40, 0x88, 0x60, 0x84, 0x60, 0x01, 0x40, 0x84
+			DB 0x60, 0x06, 0x60, 0x85, 0x60, 0x01, 0x20, 0x83
+			DB 0x40, 0x01, 0x85, 0x20, 0x01, 0x21, 0x02, 0x20
+			DB 0x85, 0x20, 0x02, 0x40, 0x82, 0x20, 0x00, 0x20
+			DB 0x84, 0x60, 0x01, 0x40, 0x82, 0x20, 0x01, 0x60
+			DB 0x84, 0x40, 0x02, 0x40, 0x82, 0x01, 0x40, 0x84
+			DB 0x40, 0x00, 0x20, 0x83, 0x40, 0x01, 0x60, 0x85
+			DB 0x20, 0x00, 0x40, 0x82, 0x60, 0x01, 0x60, 0x84
+			DB 0x01, 0x60, 0x83, 0x60, 0x01, 0x60, 0x8B, 0x60
+			DB 0x01, 0x60, 0x83, 0x60, 0x01, 0x84, 0x60, 0x01
+			DB 0x8C, 0x60, 0x01, 0x60, 0x83, 0x60, 0x01, 0x84
+			DB 0x40, 0x00, 0x20, 0x8C, 0x60, 0x01, 0x40, 0x83
+			DB 0x40, 0x00, 0x20, 0x84, 0x01, 0x40, 0x86, 0x60
+			DB 0x40, 0x60, 0x83, 0x01, 0x20, 0x83, 0x40, 0x00
+			DB 0x20, 0x83, 0x20, 0x00, 0x20, 0x86, 0x60, 0x02
+			DB 0x60, 0x82, 0x20, 0x01, 0x40, 0x82, 0x40, 0x00
+			DB 0x20, 0x81, 0x40, 0x20, 0x00, 0x20, 0x87, 0x20
+			DB 0x02, 0x40, 0x82, 0x40, 0x03, 0x22, 0x01, 0x20
+			DB 0x02, 0x20, 0x42, 0x85, 0x40, 0x02, 0x60, 0x83
+			DB 0x20, 0x0F, 0x86, 0x40, 0x20, 0x60, 0x84, 0x60
+			DB 0x20, 0x0E, 0x90, 0x60, 0x4D, 0xE3
+; ‚ 82
+			DB 0xC9, 0x4D, 0x60, 0x8A, 0x60, 0x84, 0x0F, 0x40
+			DB 0x86, 0x60, 0x01, 0x20, 0x83, 0x10, 0x60, 0x85
+			DB 0x20, 0x02, 0x40, 0x82, 0x2D, 0x02, 0x20, 0x85
+			DB 0x40, 0x02, 0x40, 0x90, 0x60, 0x02, 0x60, 0x85
+			DB 0x20, 0x00, 0x40, 0x92, 0x40, 0x01, 0x60, 0x9B
+			DB 0x60, 0x01, 0x60, 0x9B, 0x60, 0x01, 0x9C, 0x20
+			DB 0x00, 0x20, 0x86, 0x60, 0x40, 0x60, 0x91, 0x40
+			DB 0x01, 0x60, 0x85, 0x60, 0x02, 0x60, 0x8E, 0x60
+			DB 0x20, 0x01, 0x40, 0x86, 0x20, 0x02, 0x40, 0x82
+			DB 0x69, 0x40, 0x20, 0x01, 0x20, 0x60, 0x87, 0x40
+			DB 0x02, 0x60, 0x82, 0x11, 0x86, 0x40, 0x20, 0x60
+			DB 0x83, 0x11, 0x8D, 0x11, 0xE3
+; ƒ 83
+			DB 0xC4, 0x60, 0x40, 0x20, 0x13, 0x87, 0x40, 0x16
+			DB 0x86, 0x20, 0x17, 0x85, 0x40, 0x02, 0x20, 0x40
+			DB 0x73, 0x85, 0x20, 0x01, 0x60, 0x9A, 0x60, 0x01
+			DB 0x40, 0x9B, 0x40, 0x01, 0x60, 0x86, 0x40, 0x21
+			DB 0x40, 0x60, 0x87, 0x20, 0x01, 0x84, 0x40, 0x01
+			DB 0x86, 0x20, 0x04, 0x40, 0x86, 0x40, 0x01, 0x60
+			DB 0x83, 0x40, 0x01, 0x85, 0x20, 0x06, 0x40, 0x85
+			DB 0x60, 0x01, 0x60, 0x83, 0x40, 0x01, 0x60, 0x83
+			DB 0x40, 0x01, 0x20, 0x41, 0x03, 0x60, 0x84, 0x60
+			DB 0x01, 0x60, 0x83, 0x60, 0x01, 0x20, 0x82, 0x40
+			DB 0x01, 0x20, 0x82, 0x60, 0x02, 0x20, 0x84, 0x60
+			DB 0x01, 0x60, 0x84, 0x20, 0x02, 0x21, 0x02, 0x84
+			DB 0x60, 0x02, 0x60, 0x83, 0x40, 0x01, 0x85, 0x60
+			DB 0x06, 0x60, 0x85, 0x20, 0x02, 0x60, 0x81, 0x60
+			DB 0x01, 0x20, 0x86, 0x40, 0x04, 0x40, 0x86, 0x60
+			DB 0x03, 0x21, 0x02, 0x40, 0x87, 0x60, 0x42, 0x89
+			DB 0x40, 0x06, 0x20, 0x97, 0x40, 0x04, 0x40, 0x9A
+			DB 0x42, 0x60, 0xA6
+; „ 84
+			DB 0xAF, 0x60, 0x43, 0x61, 0x96, 0x40, 0x20, 0x06
+			DB 0x20, 0x60, 0x92, 0x60, 0x20, 0x0A, 0x40, 0x90
+			DB 0x60, 0x06, 0x21, 0x04, 0x40, 0x8F, 0x02, 0x20
+			DB 0x60, 0x80, 0x01, 0x60, 0x81, 0x60, 0x20, 0x02
+			DB 0x60, 0x8D, 0x40, 0x01, 0x40, 0x82, 0x01, 0x60
+			DB 0x83, 0x20, 0x01, 0x40, 0x88, 0x20, 0x60, 0x82
+			DB 0x01, 0x20, 0x83, 0x01, 0x60, 0x84, 0x01, 0x20
+			DB 0x87, 0x40, 0x01, 0x81, 0x60, 0x01, 0x40, 0x83
+			DB 0x01, 0x60, 0x84, 0x40, 0x01, 0x87, 0x01, 0x40
+			DB 0x81, 0x60, 0x01, 0x60, 0x83, 0x01, 0x60, 0x84
+			DB 0x60, 0x01, 0x60, 0x85, 0x40, 0x01, 0x60, 0x81
+			DB 0x60, 0x01, 0x60, 0x83, 0x01, 0x60, 0x84, 0x60
+			DB 0x01, 0x60, 0x85, 0x01, 0x40, 0x82, 0x60, 0x01
+			DB 0x40, 0x83, 0x01, 0x60, 0x84, 0x60, 0x01, 0x60
+			DB 0x84, 0x40, 0x01, 0x60, 0x83, 0x20, 0x01, 0x60
+			DB 0x82, 0x01, 0x60, 0x84, 0x40, 0x01, 0x84, 0x60
+			DB 0x01, 0x20, 0x84, 0x40, 0x02, 0x60, 0x81, 0x01
+			DB 0x60, 0x84, 0x40, 0x01, 0x84, 0x60, 0x20, 0x00
+			DB 0x60, 0x85, 0x20, 0x03, 0x20, 0x01, 0x60, 0x84
+			DB 0x20, 0x00, 0x20, 0x86, 0x60, 0x87, 0x20, 0x05
+			DB 0x60, 0x84, 0x01, 0x40, 0x90, 0x40, 0x04, 0x60
+			DB 0x83, 0x60, 0x21, 0x60, 0x92, 0x60, 0x42, 0x60
+			DB 0xCB
+; … 85
+			DB 0xAF, 0x60, 0x43, 0x61, 0x96, 0x40, 0x20, 0x06
+			DB 0x20, 0x60, 0x92, 0x60, 0x20, 0x0A, 0x40, 0x87
+			DB 0x60, 0x20, 0x86, 0x60, 0x06, 0x21, 0x04, 0x40
+			DB 0x85, 0x40, 0x01, 0x40, 0x85, 0x02, 0x20, 0x60
+			DB 0x80, 0x01, 0x60, 0x81, 0x60, 0x20, 0x02, 0x60
+			DB 0x84, 0x60, 0x01, 0x20, 0x84, 0x40, 0x01, 0x40
+			DB 0x82, 0x01, 0x60, 0x83, 0x20, 0x01, 0x40, 0x85
+			DB 0x40, 0x01, 0x40, 0x83, 0x01, 0x20, 0x83, 0x01
+			DB 0x60, 0x84, 0x01, 0x20, 0x86, 0x01, 0x20, 0x82
+			DB 0x60, 0x01, 0x40, 0x83, 0x01, 0x60, 0x84, 0x40
+			DB 0x01, 0x86, 0x40, 0x01, 0x40, 0x81, 0x60, 0x01
+			DB 0x60, 0x83, 0x01, 0x60, 0x84, 0x60, 0x01, 0x60
+			DB 0x86, 0x20, 0x00, 0x20, 0x81, 0x60, 0x01, 0x60
+			DB 0x83, 0x01, 0x60, 0x84, 0x60, 0x01, 0x60, 0x86
+			DB 0x60, 0x00, 0x20, 0x81, 0x60, 0x01, 0x40, 0x83
+			DB 0x01, 0x60, 0x84, 0x60, 0x01, 0x60, 0x87, 0x60
+			DB 0x83, 0x20, 0x01, 0x60, 0x82, 0x01, 0x60, 0x84
+			DB 0x40, 0x01, 0x8D, 0x40, 0x02, 0x60, 0x81, 0x01
+			DB 0x60, 0x84, 0x40, 0x01, 0x8E, 0x20, 0x03, 0x20
+			DB 0x01, 0x60, 0x84, 0x20, 0x00, 0x20, 0x8F, 0x20
+			DB 0x05, 0x60, 0x84, 0x01, 0x40, 0x90, 0x40, 0x04
+			DB 0x60, 0x83, 0x60, 0x21, 0x60, 0x92, 0x60, 0x42
+			DB 0x60, 0xCB
+; † 86
+			DB 0xAF, 0x60, 0x43, 0x61, 0x96, 0x40, 0x20, 0x06
+			DB 0x20, 0x60, 0x92, 0x60, 0x20, 0x0A, 0x40, 0x8A
+			DB 0x40, 0x84, 0x60, 0x06, 0x21, 0x04, 0x40, 0x88
+			DB 0x40, 0x01, 0x83, 0x02, 0x20, 0x60, 0x80, 0x01
+			DB 0x60, 0x81, 0x60, 0x20, 0x02, 0x60, 0x87, 0x01
+			DB 0x40, 0x82, 0x40, 0x01, 0x40, 0x82, 0x01, 0x60
+			DB 0x83, 0x20, 0x01, 0x40, 0x86, 0x40, 0x01, 0x83
+			DB 0x01, 0x20, 0x83, 0x01, 0x60, 0x84, 0x01, 0x20
+			DB 0x85, 0x60, 0x01, 0x40, 0x82, 0x60, 0x01, 0x40
+			DB 0x83, 0x01, 0x60, 0x84, 0x40, 0x01, 0x85, 0x20
+			DB 0x00, 0x20, 0x83, 0x60, 0x01, 0x60, 0x83, 0x01
+			DB 0x60, 0x84, 0x60, 0x01, 0x60, 0x84, 0x40, 0x01
+			DB 0x60, 0x82, 0x60, 0x01, 0x60, 0x83, 0x01, 0x60
+			DB 0x84, 0x60, 0x01, 0x60, 0x85, 0x01, 0x20, 0x82
+			DB 0x60, 0x01, 0x40, 0x83, 0x01, 0x60, 0x84, 0x60
+			DB 0x01, 0x60, 0x85, 0x40, 0x01, 0x60, 0x82, 0x20
+			DB 0x01, 0x60, 0x82, 0x01, 0x60, 0x84, 0x40, 0x01
+			DB 0x87, 0x20, 0x00, 0x20, 0x82, 0x40, 0x02, 0x60
+			DB 0x81, 0x01, 0x60, 0x84, 0x40, 0x01, 0x87, 0x60
+			DB 0x00, 0x20, 0x83, 0x20, 0x03, 0x20, 0x01, 0x60
+			DB 0x84, 0x20, 0x00, 0x20, 0x88, 0x60, 0x85, 0x20
+			DB 0x05, 0x60, 0x84, 0x01, 0x40, 0x90, 0x40, 0x04
+			DB 0x60, 0x83, 0x60, 0x21, 0x60, 0x92, 0x60, 0x42
+			DB 0x60, 0xCB
+; ‡ 87
+			DB 0xAE, 0x60, 0x40, 0x20, 0x02, 0x20, 0x41, 0x94
+			DB 0x60, 0x20, 0x08, 0x20, 0x60, 0x91, 0x40, 0x0C
+			DB 0x60, 0x8F, 0x40, 0x03, 0x20, 0x40, 0x62, 0x40
+			DB 0x04, 0x8F, 0x02, 0x20, 0x60, 0x86, 0x40, 0x02
+			DB 0x40, 0x8D, 0x40, 0x01, 0x20, 0x89, 0x20, 0x01
+			DB 0x20, 0x8D, 0x20, 0x01, 0x60, 0x8A, 0x20, 0x00
+			DB 0x20, 0x80, 0x60, 0x00, 0x60, 0x89, 0x01, 0x20
+			DB 0x89, 0x61, 0x02, 0x40, 0x01, 0x40, 0x88, 0x60
+			DB 0x01, 0x40, 0x89, 0x60, 0x40, 0x04, 0x20, 0x89
+			DB 0x60, 0x01, 0x40, 0x89, 0x60, 0x40, 0x04, 0x60
+			DB 0x89, 0x60, 0x01, 0x40, 0x89, 0x61, 0x40, 0x01
+			DB 0x40, 0x8B, 0x60, 0x01, 0x20, 0x8B, 0x20, 0x01
+			DB 0x8D, 0x01, 0x20, 0x8B, 0x20, 0x00, 0x20, 0x8D
+			DB 0x20, 0x01, 0x60, 0x89, 0x60, 0x01, 0x20, 0x8D
+			DB 0x40, 0x20, 0x40, 0x60, 0x89, 0x60, 0x20, 0x00
+			DB 0x40, 0xFF, 0x83
+; ˆ 88
+			DB 0x96, 0x61, 0x91, 0x60, 0x87, 0x60, 0x20, 0x03
+			DB 0x40, 0x8E, 0x60, 0x01, 0x40, 0x84, 0x60, 0x06
+			DB 0x60, 0x85, 0x60, 0x20, 0x85, 0x40, 0x01, 0x85
+			DB 0x20, 0x01, 0x21, 0x02, 0x20, 0x84, 0x40, 0x01
+			DB 0x40, 0x84, 0x20, 0x00, 0x20, 0x84, 0x60, 0x01
+			DB 0x40, 0x82, 0x20, 0x01, 0x60, 0x83, 0x60, 0x01
+			DB 0x20, 0x84, 0x01, 0x40, 0x84, 0x40, 0x00, 0x20
+			DB 0x83, 0x40, 0x01, 0x60, 0x84, 0x40, 0x01, 0x40
+			DB 0x82, 0x60, 0x01, 0x60, 0x84, 0x01, 0x60, 0x83
+			DB 0x60, 0x01, 0x60, 0x85, 0x01, 0x20, 0x82, 0x60
+			DB 0x01, 0x60, 0x83, 0x60, 0x01, 0x84, 0x60, 0x01
+			DB 0x86, 0x40, 0x01, 0x40, 0x81, 0x60, 0x01, 0x60
+			DB 0x83, 0x60, 0x01, 0x84, 0x40, 0x00, 0x20, 0x87
+			DB 0x20, 0x00, 0x20, 0x81, 0x60, 0x01, 0x40, 0x83
+			DB 0x40, 0x00, 0x20, 0x84, 0x01, 0x40, 0x87, 0x60
+			DB 0x00, 0x20, 0x82, 0x01, 0x20, 0x83, 0x40, 0x00
+			DB 0x20, 0x83, 0x20, 0x00, 0x20, 0x89, 0x60, 0x83
+			DB 0x20, 0x01, 0x40, 0x82, 0x40, 0x00, 0x20, 0x81
+			DB 0x40, 0x20, 0x00, 0x20, 0x8F, 0x40, 0x03, 0x22
+			DB 0x01, 0x20, 0x02, 0x20, 0x42, 0x8E, 0x20, 0x0F
+			DB 0x8E, 0x60, 0x20, 0x0E, 0x90, 0x60, 0x4D, 0xFF
+			DB 0x83
+; ‰ 89
+			DB 0x96, 0x61, 0x91, 0x60, 0x87, 0x60, 0x20, 0x03
+			DB 0x40, 0x8E, 0x60, 0x01, 0x40, 0x84, 0x60, 0x06
+			DB 0x60, 0x8D, 0x40, 0x01, 0x85, 0x20, 0x01, 0x21
+			DB 0x02, 0x20, 0x8D, 0x20, 0x00, 0x20, 0x84, 0x60
+			DB 0x01, 0x40, 0x82, 0x20, 0x01, 0x60, 0x8C, 0x01
+			DB 0x40, 0x84, 0x40, 0x00, 0x20, 0x83, 0x40, 0x01
+			DB 0x60, 0x87, 0x20, 0x60, 0x81, 0x60, 0x01, 0x60
+			DB 0x84, 0x01, 0x60, 0x83, 0x60, 0x01, 0x60, 0x86
+			DB 0x40, 0x01, 0x81, 0x60, 0x01, 0x60, 0x83, 0x60
+			DB 0x01, 0x84, 0x60, 0x01, 0x87, 0x01, 0x40, 0x81
+			DB 0x60, 0x01, 0x60, 0x83, 0x60, 0x01, 0x84, 0x40
+			DB 0x00, 0x20, 0x86, 0x40, 0x01, 0x60, 0x81, 0x60
+			DB 0x01, 0x40, 0x83, 0x40, 0x00, 0x20, 0x84, 0x01
+			DB 0x40, 0x86, 0x01, 0x40, 0x83, 0x01, 0x20, 0x83
+			DB 0x40, 0x00, 0x20, 0x83, 0x20, 0x00, 0x20, 0x86
+			DB 0x40, 0x01, 0x60, 0x83, 0x20, 0x01, 0x40, 0x82
+			DB 0x40, 0x00, 0x20, 0x81, 0x40, 0x20, 0x00, 0x20
+			DB 0x86, 0x60, 0x01, 0x20, 0x84, 0x40, 0x03, 0x22
+			DB 0x01, 0x20, 0x02, 0x20, 0x42, 0x84, 0x60, 0x20
+			DB 0x00, 0x60, 0x85, 0x20, 0x0F, 0x86, 0x60, 0x86
+			DB 0x60, 0x20, 0x0E, 0x90, 0x60, 0x4D, 0xFF, 0x83
+; Š 8A
+			DB 0xA9, 0x62, 0x8B, 0x40, 0x21, 0x8D, 0x01, 0x40
+			DB 0x8B, 0x40, 0x01, 0x8D, 0x01, 0x40, 0x8B, 0x40
+			DB 0x01, 0x8D, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x8D
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x88, 0x20, 0x60
+			DB 0x82, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x87, 0x40
+			DB 0x01, 0x82, 0x01, 0x40, 0x8B, 0x40, 0x01, 0x87
+			DB 0x01, 0x40, 0x82, 0x11, 0x86, 0x40, 0x01, 0x60
+			DB 0x82, 0x11, 0x86, 0x01, 0x40, 0x83, 0x11, 0x85
+			DB 0x40, 0x01, 0x60, 0x83, 0x6E, 0x40, 0x01, 0x84
+			DB 0x60, 0x01, 0x20, 0x93, 0x40, 0x01, 0x84, 0x60
+			DB 0x20, 0x00, 0x60, 0x93, 0x40, 0x01, 0x86, 0x60
+			DB 0x94, 0x40, 0x01, 0x9C, 0x40, 0x01, 0x9C, 0x40
+			DB 0x01, 0x9C, 0x62, 0xC3
+; ‹ 8B
+			DB 0x8E, 0x60, 0x41, 0x22, 0x41, 0x95, 0x60, 0x40
+			DB 0x08, 0x40, 0x92, 0x60, 0x0B, 0x20, 0x60, 0x8F
+			DB 0x60, 0x03, 0x20, 0x43, 0x20, 0x03, 0x20, 0x8F
+			DB 0x02, 0x20, 0x60, 0x85, 0x60, 0x20, 0x02, 0x40
+			DB 0x8D, 0x40, 0x01, 0x20, 0x89, 0x40, 0x01, 0x20
+			DB 0x88, 0x20, 0x60, 0x82, 0x20, 0x01, 0x60, 0x8A
+			DB 0x02, 0x87, 0x40, 0x01, 0x82, 0x01, 0x20, 0x8B
+			DB 0x40, 0x01, 0x60, 0x86, 0x01, 0x40, 0x81, 0x60
+			DB 0x01, 0x40, 0x8B, 0x40, 0x01, 0x60, 0x85, 0x40
+			DB 0x01, 0x60, 0x81, 0x60, 0x01, 0x40, 0x8B, 0x40
+			DB 0x01, 0x60, 0x85, 0x01, 0x40, 0x82, 0x60, 0x01
+			DB 0x20, 0x8B, 0x20, 0x01, 0x85, 0x40, 0x01, 0x60
+			DB 0x83, 0x02, 0x60, 0x89, 0x60, 0x01, 0x20, 0x84
+			DB 0x60, 0x01, 0x20, 0x84, 0x20, 0x01, 0x20, 0x88
+			DB 0x60, 0x02, 0x40, 0x84, 0x60, 0x20, 0x00, 0x60
+			DB 0x84, 0x60, 0x02, 0x20, 0x40, 0x84, 0x60, 0x40
+			DB 0x02, 0x20, 0x87, 0x60, 0x86, 0x40, 0x04, 0x23
+			DB 0x03, 0x20, 0x91, 0x40, 0x0A, 0x20, 0x93, 0x60
+			DB 0x20, 0x06, 0x20, 0x40, 0x96, 0x61, 0x42, 0x61
+			DB 0xC9
+; Π8C
+			DB 0xA9, 0x4D, 0x60, 0x90, 0x0F, 0x40, 0x8E, 0x10
+			DB 0x60, 0x8D, 0x2D, 0x02, 0x20, 0x9B, 0x60, 0x02
+			DB 0x60, 0x87, 0x20, 0x60, 0x91, 0x40, 0x01, 0x60
+			DB 0x86, 0x40, 0x01, 0x91, 0x60, 0x01, 0x60, 0x86
+			DB 0x01, 0x40, 0x91, 0x60, 0x01, 0x86, 0x40, 0x01
+			DB 0x60, 0x91, 0x20, 0x00, 0x20, 0x86, 0x01, 0x40
+			DB 0x91, 0x40, 0x01, 0x60, 0x85, 0x40, 0x01, 0x60
+			DB 0x8F, 0x60, 0x20, 0x01, 0x40, 0x85, 0x60, 0x01
+			DB 0x20, 0x84, 0x69, 0x40, 0x20, 0x01, 0x20, 0x60
+			DB 0x86, 0x60, 0x20, 0x00, 0x60, 0x84, 0x11, 0x86
+			DB 0x60, 0x85, 0x11, 0x8D, 0x11, 0xFF, 0x83
+;  8D
+			DB 0xA9, 0x51, 0x8D, 0x11, 0x86, 0x60, 0x21, 0x83
+			DB 0x11, 0x86, 0x02, 0x60, 0x82, 0x42, 0x20, 0x02
+			DB 0x2A, 0x85, 0x40, 0x01, 0x60, 0x84, 0x60, 0x20
+			DB 0x01, 0x40, 0x60, 0x90, 0x20, 0x00, 0x20, 0x85
+			DB 0x20, 0x00, 0x20, 0x60, 0x92, 0x40, 0x00, 0x20
+			DB 0x84, 0x40, 0x01, 0x94, 0x60, 0x01, 0x40, 0x83
+			DB 0x01, 0x40, 0x95, 0x40, 0x01, 0x60, 0x81, 0x60
+			DB 0x01, 0x60, 0x96, 0x01, 0x40, 0x81, 0x60, 0x01
+			DB 0x60, 0x96, 0x01, 0x40, 0x81, 0x60, 0x01, 0x20
+			DB 0x95, 0x40, 0x01, 0x60, 0x82, 0x02, 0x20, 0x40
+			DB 0x6C, 0x85, 0x40, 0x01, 0x40, 0x83, 0x40, 0x10
+			DB 0x86, 0x20, 0x40, 0x85, 0x20, 0x0F, 0x8F, 0x40
+			DB 0x20, 0x0D, 0xFF, 0x83
+; Ž 8E
+			DB 0xFF, 0xC6, 0x61, 0x9C, 0x20, 0x01, 0x40, 0x81
+			DB 0x63, 0x4A, 0x23, 0x40, 0x84, 0x40, 0x03, 0x60
+			DB 0x80, 0x20, 0x11, 0x40, 0x84, 0x40, 0x03, 0x60
+			DB 0x80, 0x20, 0x11, 0x40, 0x85, 0x20, 0x01, 0x40
+			DB 0x81, 0x64, 0x49, 0x23, 0x40, 0x86, 0x61, 0xFF
+			DB 0xFF, 0x96
+;  8F
+			DB 0xD6, 0x60, 0x41, 0x60, 0x99, 0x60, 0x04, 0x20
+			DB 0x60, 0x96, 0x40, 0x07, 0x60, 0x94, 0x40, 0x08
+			DB 0x20, 0x93, 0x40, 0x02, 0x20, 0x60, 0x80, 0x60
+			DB 0x20, 0x02, 0x40, 0x87, 0x61, 0x87, 0x60, 0x02
+			DB 0x40, 0x84, 0x20, 0x01, 0x20, 0x86, 0x20, 0x01
+			DB 0x40, 0x81, 0x60, 0x81, 0x60, 0x40, 0x02, 0x20
+			DB 0x85, 0x60, 0x02, 0x85, 0x40, 0x03, 0x60, 0x80
+			DB 0x20, 0x05, 0x20, 0x87, 0x20, 0x01, 0x60, 0x84
+			DB 0x40, 0x03, 0x60, 0x80, 0x20, 0x04, 0x20, 0x88
+			DB 0x40, 0x01, 0x40, 0x85, 0x02, 0x20, 0x81, 0x20
+			DB 0x03, 0x40, 0x89, 0x40, 0x01, 0x40, 0x86, 0x41
+			DB 0x83, 0x62, 0x8B, 0x60, 0x01, 0x20, 0x9B, 0x60
+			DB 0x01, 0x20, 0x9C, 0x61, 0xFF, 0xA0
+;  90
+			DB 0xFF, 0xD9, 0x40, 0x20, 0x00, 0x9A, 0x60, 0x20
+			DB 0x01, 0x20, 0x8C, 0x40, 0x8B, 0x40, 0x01, 0x20
+			DB 0x00, 0x60, 0x8B, 0x60, 0x00, 0x40, 0x88, 0x60
+			DB 0x01, 0x21, 0x00, 0x60, 0x8B, 0x60, 0x01, 0x20
+			DB 0x86, 0x60, 0x40, 0x00, 0x40, 0x21, 0x00, 0x20
+			DB 0x8C, 0x00, 0x20, 0x60, 0x00, 0x84, 0x60, 0x40
+			DB 0x01, 0x40, 0x22, 0x00, 0x60, 0x8B, 0x60, 0x00
+			DB 0x61, 0x00, 0x40, 0x81, 0x60, 0x40, 0x01, 0x20
+			DB 0x40, 0x22, 0x00, 0x40, 0x8C, 0x20, 0x00, 0x61
+			DB 0x00, 0x20, 0x60, 0x20, 0x01, 0x20, 0x41, 0x22
+			DB 0x00, 0x20, 0x8C, 0x60, 0x00, 0x40, 0x61, 0x40
+			DB 0x02, 0x20, 0x42, 0x23, 0x00, 0x60, 0x8C, 0x40
+			DB 0x00, 0x63, 0x45, 0x23, 0x00, 0x20, 0x8D, 0x00
+			DB 0x20, 0x64, 0x43, 0x24, 0x00, 0x60, 0x8C, 0x60
+			DB 0x00, 0x40, 0x64, 0x42, 0x24, 0x00, 0x20, 0x8D
+			DB 0x60, 0x00, 0x66, 0x40, 0x25, 0x00, 0x60, 0x8D
+			DB 0x20, 0x00, 0x65, 0x41, 0x26, 0x89
+; ‘ 91
+			DB 0x84, 0x20, 0x00, 0x64, 0x43, 0x23, 0x00, 0x40
+			DB 0x8E, 0x00, 0x40, 0x64, 0x44, 0x22, 0x00, 0x60
+			DB 0x8E, 0x00, 0x64, 0x46, 0x21, 0x00, 0x40, 0x8E
+			DB 0x00, 0x63, 0x48, 0x21, 0x01, 0x60, 0x8C, 0x00
+			DB 0x62, 0x4B, 0x21, 0x00, 0x20, 0x40, 0x8A, 0x00
+			DB 0x61, 0x4D, 0x20, 0x01, 0x40, 0x8A, 0x00, 0x60
+			DB 0x4C, 0x20, 0x01, 0x40, 0x60, 0x8B, 0x00, 0x4A
+			DB 0x20, 0x02, 0x20, 0x60, 0x8D, 0x02, 0x25, 0x03
+			DB 0x20, 0x40, 0x60, 0x8F, 0x60, 0x40, 0x20, 0x05
+			DB 0x20, 0x41, 0x60, 0xFF, 0xFF, 0xCD
+; ’ 92
+			DB 0xAC, 0x04, 0x9A, 0x04, 0x9A, 0x04, 0x9A, 0x04
+			DB 0x9A, 0x04, 0x9A, 0x04, 0x92, 0x20, 0x12, 0x20
+			DB 0x8B, 0x20, 0x10, 0x20, 0x8D, 0x20, 0x0E, 0x20
+			DB 0x8F, 0x20, 0x0C, 0x20, 0x91, 0x20, 0x0A, 0x20
+			DB 0x93, 0x20, 0x08, 0x20, 0x95, 0x20, 0x06, 0x20
+			DB 0x97, 0x20, 0x04, 0x20, 0x99, 0x20, 0x02, 0x20
+			DB 0x9B, 0x20, 0x00, 0x20, 0x9D, 0x20, 0xCF
+; “ 93
+			DB 0xCC, 0x01, 0x40, 0x9C, 0x01, 0x40, 0x9C, 0x01
+			DB 0x40, 0x87, 0x41, 0x92, 0x01, 0x40, 0x87, 0x40
+			DB 0x00, 0x40, 0x91, 0x01, 0x40, 0x88, 0x20, 0x00
+			DB 0x40, 0x90, 0x01, 0x41, 0x87, 0x60, 0x01, 0x40
+			DB 0x8F, 0x01, 0x4A, 0x20, 0x01, 0x40, 0x8E, 0x11
+			DB 0x60, 0x8C, 0x40, 0x0F, 0x40, 0x9A, 0x20, 0x00
+			DB 0x20, 0x60, 0x9A, 0x40, 0x00, 0x20, 0x9B, 0x60
+			DB 0x00, 0x20, 0x9C, 0x40, 0x00, 0x60, 0xFF, 0xA4
+; ” 94
+			DB 0xEC, 0x40, 0x01, 0x94, 0x41, 0x85, 0x40, 0x01
+			DB 0x93, 0x60, 0x00, 0x40, 0x85, 0x40, 0x01, 0x92
+			DB 0x60, 0x01, 0x60, 0x85, 0x40, 0x01, 0x91, 0x60
+			DB 0x01, 0x40, 0x85, 0x41, 0x01, 0x90, 0x40, 0x02
+			DB 0x48, 0x01, 0x8F, 0x0F, 0x8F, 0x40, 0x20, 0x0C
+			DB 0x40, 0x91, 0x40, 0x01, 0x60, 0x9C, 0x40, 0x00
+			DB 0x20, 0x9D, 0x20, 0x00, 0x40, 0x9D, 0x00, 0x20
+			DB 0xFF, 0xB8
+; • 95
+			DB 0x8D, 0x40, 0x9D, 0x40, 0x00, 0x60, 0x9B, 0x60
+			DB 0x01, 0x20, 0x9B, 0x20, 0x02, 0x20, 0x98, 0x60
+			DB 0x20, 0x04, 0x20, 0x60, 0x95, 0x40, 0x01, 0x21
+			DB 0x00, 0x21, 0x01, 0x40, 0x94, 0x20, 0x00, 0x40
+			DB 0x80, 0x20, 0x00, 0x20, 0x80, 0x40, 0x00, 0x20
+			DB 0x94, 0x61, 0x81, 0x20, 0x00, 0x20, 0x81, 0x61
+			DB 0x98, 0x20, 0x00, 0x20, 0x9C, 0x20, 0x00, 0x20
+			DB 0x9C, 0x20, 0x00, 0x20, 0x9C, 0x20, 0x00, 0x20
+			DB 0x98, 0x41, 0x81, 0x20, 0x00, 0x20, 0x81, 0x41
+			DB 0x94, 0x20, 0x00, 0x20, 0x60, 0x20, 0x00, 0x20
+			DB 0x60, 0x20, 0x00, 0x20, 0x94, 0x60, 0x20, 0x01
+			DB 0x20, 0x00, 0x20, 0x01, 0x20, 0x60, 0x96, 0x40
+			DB 0x04, 0x40, 0x99, 0x40, 0x02, 0x40, 0x9B, 0x20
+			DB 0x00, 0x20, 0x9C, 0x40, 0x00, 0x60, 0x9D, 0x60
+			DB 0x90
+; – 96
+			DB 0xC6, 0x60, 0x20, 0x60, 0x8C, 0x20, 0x40, 0x8D
+			DB 0x20, 0x01, 0x40, 0x81, 0x40, 0x20, 0x01, 0x20
+			DB 0x40, 0x60, 0x80, 0x60, 0x20, 0x01, 0x60, 0x8B
+			DB 0x60, 0x20, 0x02, 0x40, 0x20, 0x06, 0x20, 0x03
+			DB 0x40, 0x8D, 0x20, 0x0D, 0x20, 0x60, 0x8F, 0x40
+			DB 0x02, 0x20, 0x60, 0x81, 0x60, 0x40, 0x02, 0x20
+			DB 0x92, 0x01, 0x20, 0x85, 0x60, 0x01, 0x40, 0x91
+			DB 0x60, 0x01, 0x60, 0x86, 0x20, 0x00, 0x40, 0x91
+			DB 0x40, 0x01, 0x87, 0x20, 0x00, 0x20, 0x91, 0x40
+			DB 0x01, 0x87, 0x20, 0x00, 0x40, 0x91, 0x60, 0x01
+			DB 0x40, 0x85, 0x60, 0x01, 0x60, 0x92, 0x02, 0x60
+			DB 0x83, 0x40, 0x02, 0x92, 0x20, 0x03, 0x22, 0x05
+			DB 0x60, 0x8E, 0x60, 0x0F, 0x40, 0x8C, 0x60, 0x03
+			DB 0x60, 0x40, 0x20, 0x03, 0x20, 0x60, 0x80, 0x20
+			DB 0x02, 0x40, 0x8C, 0x20, 0x00, 0x20, 0x60, 0x83
+			DB 0x61, 0x84, 0x40, 0x00, 0x20, 0x8E, 0x40, 0x8D
+			DB 0x40, 0x60, 0xC6
+; TOTAL COMPRESSED SIZE = 12529
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font36_idx.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,128 @@
+;==========================================================================
+; Font index exported ven. nov. 16 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font36_chars		EQU	.119
+aa_font36_firstChar	EQU	' '
+aa_font36_lastChar	EQU	'–'
+;
+aa_font36_idx:
+			DW	aa_font36_bits + 0x0000	;   Space
+			DW	aa_font36_bits + 0x0005	; ! mark
+			DW	aa_font36_bits + 0x002E	; " dquote
+			DW	aa_font36_bits + 0x0082	; # sharp
+			DW	aa_font36_bits + 0x010A	; $ dolar
+			DW	aa_font36_bits + 0x019A	; % percent
+			DW	aa_font36_bits + 0x0273	; & and
+			DW	aa_font36_bits + 0x0330	; ' quote
+			DW	aa_font36_bits + 0x0362	; ( lparent
+			DW	aa_font36_bits + 0x03AF	; ) rparent
+			DW	aa_font36_bits + 0x03FF	; * star
+			DW	aa_font36_bits + 0x046D	; + plus
+			DW	aa_font36_bits + 0x04A8	; , comma
+			DW	aa_font36_bits + 0x04D8	; - minus
+			DW	aa_font36_bits + 0x0509	; . dot
+			DW	aa_font36_bits + 0x0525	; / slash
+			DW	aa_font36_bits + 0x056F	; 0 0
+			DW	aa_font36_bits + 0x05E3	; 1 1
+			DW	aa_font36_bits + 0x061F	; 2 2
+			DW	aa_font36_bits + 0x06A6	; 3 3
+			DW	aa_font36_bits + 0x0744	; 4 4
+			DW	aa_font36_bits + 0x07B8	; 5 5
+			DW	aa_font36_bits + 0x0845	; 6 6
+			DW	aa_font36_bits + 0x08E8	; 7 7
+			DW	aa_font36_bits + 0x0960	; 8 8
+			DW	aa_font36_bits + 0x0A1B	; 9 9
+			DW	aa_font36_bits + 0x0ABE	; : colon
+			DW	aa_font36_bits + 0x0AF0	; ; semicolon
+			DW	aa_font36_bits + 0x0B37	; < less
+			DW	aa_font36_bits + 0x0B99	; = equal
+			DW	aa_font36_bits + 0x0C0E	; > greater
+			DW	aa_font36_bits + 0x0C73	; ? question
+			DW	aa_font36_bits + 0x0CDA	; @ arobas
+			DW	aa_font36_bits + 0x0DA7	; A A
+			DW	aa_font36_bits + 0x0E36	; B B
+			DW	aa_font36_bits + 0x0ECC	; C C
+			DW	aa_font36_bits + 0x0F47	; D D
+			DW	aa_font36_bits + 0x0FC6	; E E
+			DW	aa_font36_bits + 0x1046	; F F
+			DW	aa_font36_bits + 0x109B	; G G
+			DW	aa_font36_bits + 0x111C	; H H
+			DW	aa_font36_bits + 0x1155	; I I
+			DW	aa_font36_bits + 0x11B8	; J J
+			DW	aa_font36_bits + 0x1213	; K K
+			DW	aa_font36_bits + 0x127B	; L L
+			DW	aa_font36_bits + 0x12AA	; M M
+			DW	aa_font36_bits + 0x1312	; N N
+			DW	aa_font36_bits + 0x1368	; O O
+			DW	aa_font36_bits + 0x13F0	; P P
+			DW	aa_font36_bits + 0x1452	; Q Q
+			DW	aa_font36_bits + 0x14E8	; R R
+			DW	aa_font36_bits + 0x156A	; S S
+			DW	aa_font36_bits + 0x1600	; T T
+			DW	aa_font36_bits + 0x1648	; U U
+			DW	aa_font36_bits + 0x1695	; V V
+			DW	aa_font36_bits + 0x170C	; W W
+			DW	aa_font36_bits + 0x1771	; X X
+			DW	aa_font36_bits + 0x1804	; Y Y
+			DW	aa_font36_bits + 0x185C	; Z Z
+			DW	aa_font36_bits + 0x18F4	; [ lsqbracket
+			DW	aa_font36_bits + 0x192B	; \ backslash
+			DW	aa_font36_bits + 0x1975	; ] rsqbracket
+			DW	aa_font36_bits + 0x19AD	; ^ caret
+			DW	aa_font36_bits + 0x19F5	; _ underline
+			DW	aa_font36_bits + 0x1A45	; ` backquote
+			DW	aa_font36_bits + 0x1A68	; a a
+			DW	aa_font36_bits + 0x1AF0	; b b
+			DW	aa_font36_bits + 0x1B60	; c c
+			DW	aa_font36_bits + 0x1BCF	; d d
+			DW	aa_font36_bits + 0x1C3A	; e e
+			DW	aa_font36_bits + 0x1CCC	; f f
+			DW	aa_font36_bits + 0x1D35	; g g
+			DW	aa_font36_bits + 0x1DE5	; h h
+			DW	aa_font36_bits + 0x1E25	; i i
+			DW	aa_font36_bits + 0x1E7E	; j j
+			DW	aa_font36_bits + 0x1EBE	; k k
+			DW	aa_font36_bits + 0x1F16	; l l
+			DW	aa_font36_bits + 0x1F65	; m m
+			DW	aa_font36_bits + 0x1FAC	; n n
+			DW	aa_font36_bits + 0x1FE5	; o o
+			DW	aa_font36_bits + 0x205F	; p p
+			DW	aa_font36_bits + 0x20CA	; q q
+			DW	aa_font36_bits + 0x2134	; r r
+			DW	aa_font36_bits + 0x2198	; s s
+			DW	aa_font36_bits + 0x2220	; t t
+			DW	aa_font36_bits + 0x227D	; u u
+			DW	aa_font36_bits + 0x22B4	; v v
+			DW	aa_font36_bits + 0x230E	; w w
+			DW	aa_font36_bits + 0x236E	; x x
+			DW	aa_font36_bits + 0x23E4	; y y
+			DW	aa_font36_bits + 0x2446	; z z
+			DW	aa_font36_bits + 0x24B3	; { lbrace
+			DW	aa_font36_bits + 0x2510	; | bar
+			DW	aa_font36_bits + 0x2518	; } rbrace
+			DW	aa_font36_bits + 0x2572	; ~ tilde
+			DW	aa_font36_bits + 0x25B4	;  7F
+			DW	aa_font36_bits + 0x2611	; € 80
+			DW	aa_font36_bits + 0x26B1	;  81
+			DW	aa_font36_bits + 0x275F	; ‚ 82
+			DW	aa_font36_bits + 0x27BC	; ƒ 83
+			DW	aa_font36_bits + 0x2847	; „ 84
+			DW	aa_font36_bits + 0x28F8	; … 85
+			DW	aa_font36_bits + 0x29AA	; † 86
+			DW	aa_font36_bits + 0x2A64	; ‡ 87
+			DW	aa_font36_bits + 0x2ADF	; ˆ 88
+			DW	aa_font36_bits + 0x2B88	; ‰ 89
+			DW	aa_font36_bits + 0x2C30	; Š 8A
+			DW	aa_font36_bits + 0x2C94	; ‹ 8B
+			DW	aa_font36_bits + 0x2D2D	; Π8C
+			DW	aa_font36_bits + 0x2D84	;  8D
+			DW	aa_font36_bits + 0x2DE8	; Ž 8E
+			DW	aa_font36_bits + 0x2E12	;  8F
+			DW	aa_font36_bits + 0x2E78	;  90
+			DW	aa_font36_bits + 0x2EFE	; ‘ 91
+			DW	aa_font36_bits + 0x2F4C	; ’ 92
+			DW	aa_font36_bits + 0x2F83	; “ 93
+			DW	aa_font36_bits + 0x2FC3	; ” 94
+			DW	aa_font36_bits + 0x2FFD	; • 95
+			DW	aa_font36_bits + 0x306E	; – 96
+			DW	aa_font36_bits + 0x30F1	; END OF INDEX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font48.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,266 @@
+;==========================================================================
+; Font data exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font48_height	EQU	.32
+aa_font48_width		EQU	.24
+aa_font48_nbbits	EQU	.3
+;
+aa_font48_bits:
+; . dot
+			DB 0xD9, 0x40, 0x21, 0x40, 0x9A, 0x40, 0x03, 0x40
+			DB 0x98, 0x60, 0x05, 0x60, 0x97, 0x40, 0x05, 0x40
+			DB 0x97, 0x40, 0x05, 0x40, 0x98, 0x05, 0x99, 0x60
+			DB 0x20, 0x01, 0x20, 0x60, 0x9B, 0x61, 0xC2
+; / slash
+			DB 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF
+; 0 0
+			DB 0xEB, 0x60, 0x40, 0x21, 0x03, 0x22, 0x40, 0x60
+			DB 0x8F, 0x60, 0x40, 0x0E, 0x40, 0x8C, 0x40, 0x12
+			DB 0x60, 0x89, 0x40, 0x14, 0x60, 0x87, 0x40, 0x03
+			DB 0x20, 0x40, 0x61, 0x85, 0x61, 0x40, 0x20, 0x04
+			DB 0x86, 0x60, 0x02, 0x20, 0x60, 0x8D, 0x60, 0x20
+			DB 0x02, 0x40, 0x85, 0x40, 0x01, 0x20, 0x91, 0x20
+			DB 0x01, 0x20, 0x85, 0x20, 0x01, 0x60, 0x91, 0x60
+			DB 0x01, 0x20, 0x85, 0x02, 0x93, 0x02, 0x85, 0x02
+			DB 0x93, 0x02, 0x85, 0x20, 0x01, 0x60, 0x91, 0x60
+			DB 0x01, 0x20, 0x85, 0x20, 0x01, 0x20, 0x91, 0x20
+			DB 0x01, 0x40, 0x85, 0x40, 0x02, 0x20, 0x60, 0x8D
+			DB 0x60, 0x20, 0x02, 0x87, 0x20, 0x03, 0x20, 0x40
+			DB 0x61, 0x85, 0x61, 0x40, 0x20, 0x03, 0x40, 0x87
+			DB 0x60, 0x14, 0x40, 0x89, 0x60, 0x12, 0x40, 0x8C
+			DB 0x40, 0x0E, 0x40, 0x60, 0x8F, 0x60, 0x40, 0x22
+			DB 0x03, 0x21, 0x40, 0x60, 0xE7
+; 1 1
+			DB 0xFF, 0x86, 0x40, 0x21, 0x40, 0x8F, 0x60, 0x02
+			DB 0x87, 0x20, 0x01, 0x20, 0x8F, 0x60, 0x02, 0x87
+			DB 0x02, 0x40, 0x8F, 0x60, 0x02, 0x86, 0x40, 0x02
+			DB 0x90, 0x60, 0x02, 0x86, 0x20, 0x01, 0x40, 0x90
+			DB 0x60, 0x02, 0x85, 0x60, 0x02, 0x60, 0x90, 0x60
+			DB 0x02, 0x85, 0x40, 0x01, 0x20, 0x91, 0x60, 0x02
+			DB 0x85, 0x20, 0x18, 0x85, 0x19, 0x85, 0x19, 0x85
+			DB 0x36, 0x02, 0x9B, 0x60, 0x02, 0x9B, 0x60, 0x02
+			DB 0x9B, 0x60, 0x02, 0x9B, 0x60, 0x02, 0x9B, 0x60
+			DB 0x02, 0x9B, 0x60, 0x02, 0xE0
+; 2 2
+			DB 0xDB, 0x62, 0x86, 0x60, 0x20, 0x40, 0x60, 0x90
+			DB 0x40, 0x02, 0x86, 0x40, 0x01, 0x20, 0x8F, 0x40
+			DB 0x03, 0x86, 0x02, 0x60, 0x8E, 0x40, 0x04, 0x85
+			DB 0x40, 0x01, 0x20, 0x8E, 0x40, 0x05, 0x85, 0x40
+			DB 0x01, 0x40, 0x8D, 0x40, 0x06, 0x85, 0x20, 0x01
+			DB 0x60, 0x8C, 0x40, 0x02, 0x20, 0x40, 0x02, 0x85
+			DB 0x02, 0x60, 0x8B, 0x40, 0x02, 0x20, 0x80, 0x40
+			DB 0x02, 0x85, 0x02, 0x60, 0x8A, 0x40, 0x02, 0x20
+			DB 0x81, 0x40, 0x02, 0x85, 0x02, 0x40, 0x89, 0x40
+			DB 0x03, 0x82, 0x40, 0x02, 0x85, 0x20, 0x01, 0x20
+			DB 0x88, 0x40, 0x03, 0x60, 0x82, 0x40, 0x02, 0x85
+			DB 0x40, 0x02, 0x40, 0x86, 0x20, 0x03, 0x60, 0x83
+			DB 0x40, 0x02, 0x85, 0x60, 0x03, 0x20, 0x60, 0x81
+			DB 0x60, 0x40, 0x04, 0x60, 0x84, 0x40, 0x02, 0x86
+			DB 0x20, 0x0C, 0x60, 0x85, 0x40, 0x02, 0x87, 0x0A
+			DB 0x20, 0x87, 0x40, 0x02, 0x88, 0x20, 0x07, 0x40
+			DB 0x88, 0x40, 0x02, 0x89, 0x40, 0x21, 0x01, 0x20
+			DB 0x40, 0x8A, 0x40, 0x02, 0x9B, 0x40, 0x02, 0xFF
+			DB 0x80
+; 3 3
+			DB 0xFA, 0x61, 0x40, 0x60, 0x86, 0x63, 0x90, 0x20
+			DB 0x01, 0x40, 0x86, 0x02, 0x60, 0x85, 0x42, 0x60
+			DB 0x86, 0x40, 0x01, 0x20, 0x85, 0x60, 0x01, 0x20
+			DB 0x86, 0x20, 0x01, 0x87, 0x60, 0x01, 0x20, 0x85
+			DB 0x40, 0x01, 0x40, 0x86, 0x20, 0x01, 0x88, 0x02
+			DB 0x85, 0x20, 0x01, 0x60, 0x86, 0x20, 0x01, 0x88
+			DB 0x02, 0x85, 0x20, 0x01, 0x87, 0x20, 0x01, 0x88
+			DB 0x02, 0x85, 0x02, 0x87, 0x02, 0x88, 0x01, 0x20
+			DB 0x85, 0x02, 0x86, 0x60, 0x02, 0x60, 0x86, 0x60
+			DB 0x01, 0x20, 0x85, 0x02, 0x60, 0x85, 0x40, 0x02
+			DB 0x60, 0x86, 0x40, 0x01, 0x40, 0x85, 0x20, 0x01
+			DB 0x40, 0x85, 0x20, 0x02, 0x20, 0x86, 0x20, 0x01
+			DB 0x40, 0x85, 0x40, 0x01, 0x20, 0x84, 0x40, 0x04
+			DB 0x40, 0x84, 0x40, 0x02, 0x86, 0x60, 0x02, 0x20
+			DB 0x60, 0x81, 0x40, 0x01, 0x40, 0x20, 0x02, 0x40
+			DB 0x81, 0x60, 0x40, 0x02, 0x40, 0x87, 0x20, 0x08
+			DB 0x60, 0x40, 0x0A, 0x88, 0x60, 0x07, 0x40, 0x81
+			DB 0x20, 0x08, 0x60, 0x89, 0x40, 0x05, 0x40, 0x83
+			DB 0x20, 0x06, 0x60, 0x8C, 0x40, 0x21, 0x40, 0x60
+			DB 0x85, 0x40, 0x20, 0x01, 0x20, 0x40, 0xFF, 0x85
+; 4 4
+			DB 0xB5, 0x61, 0x9B, 0x60, 0x20, 0x02, 0x99, 0x40
+			DB 0x04, 0x97, 0x60, 0x20, 0x05, 0x96, 0x40, 0x03
+			DB 0x20, 0x02, 0x94, 0x60, 0x20, 0x03, 0x40, 0x60
+			DB 0x02, 0x93, 0x40, 0x03, 0x20, 0x60, 0x80, 0x60
+			DB 0x02, 0x91, 0x60, 0x20, 0x03, 0x40, 0x82, 0x60
+			DB 0x02, 0x90, 0x40, 0x03, 0x20, 0x60, 0x83, 0x60
+			DB 0x02, 0x8E, 0x60, 0x20, 0x03, 0x40, 0x85, 0x60
+			DB 0x02, 0x8D, 0x40, 0x03, 0x20, 0x60, 0x86, 0x60
+			DB 0x02, 0x8B, 0x60, 0x20, 0x03, 0x40, 0x88, 0x60
+			DB 0x02, 0x8B, 0x03, 0x20, 0x60, 0x89, 0x60, 0x02
+			DB 0x8B, 0x03, 0x4C, 0x02, 0x45, 0x85, 0x19, 0x85
+			DB 0x19, 0x85, 0x19, 0x95, 0x60, 0x02, 0x9B, 0x60
+			DB 0x02, 0x9B, 0x60, 0x02, 0x9B, 0x60, 0x02, 0x9B
+			DB 0x60, 0x22, 0xA6
+; 5 5
+			DB 0xFF, 0x84, 0x6C, 0x88, 0x40, 0x21, 0x40, 0x85
+			DB 0x0C, 0x60, 0x87, 0x40, 0x01, 0x20, 0x85, 0x0C
+			DB 0x88, 0x60, 0x01, 0x20, 0x85, 0x0C, 0x88, 0x60
+			DB 0x02, 0x85, 0x02, 0x40, 0x85, 0x20, 0x01, 0x89
+			DB 0x02, 0x85, 0x02, 0x40, 0x85, 0x20, 0x01, 0x89
+			DB 0x02, 0x85, 0x02, 0x40, 0x85, 0x20, 0x01, 0x89
+			DB 0x02, 0x85, 0x02, 0x40, 0x85, 0x20, 0x01, 0x60
+			DB 0x87, 0x60, 0x01, 0x20, 0x85, 0x02, 0x40, 0x85
+			DB 0x40, 0x01, 0x40, 0x87, 0x40, 0x01, 0x40, 0x85
+			DB 0x02, 0x40, 0x85, 0x40, 0x01, 0x20, 0x87, 0x20
+			DB 0x01, 0x40, 0x85, 0x02, 0x40, 0x85, 0x60, 0x02
+			DB 0x40, 0x85, 0x40, 0x02, 0x86, 0x02, 0x40, 0x86
+			DB 0x20, 0x02, 0x40, 0x60, 0x81, 0x60, 0x20, 0x02
+			DB 0x40, 0x86, 0x02, 0x40, 0x86, 0x40, 0x0A, 0x20
+			DB 0x87, 0x02, 0x40, 0x87, 0x20, 0x09, 0x60, 0x87
+			DB 0x02, 0x40, 0x88, 0x20, 0x06, 0x20, 0x60, 0x96
+			DB 0x40, 0x20, 0x01, 0x21, 0x40, 0xFF, 0x85
+; 6 6
+			DB 0xED, 0x41, 0x21, 0x03, 0x20, 0x40, 0x60, 0x91
+			DB 0x60, 0x20, 0x0C, 0x40, 0x8E, 0x20, 0x0F, 0x20
+			DB 0x60, 0x8A, 0x60, 0x20, 0x04, 0x22, 0x09, 0x20
+			DB 0x8A, 0x20, 0x03, 0x40, 0x60, 0x80, 0x40, 0x01
+			DB 0x20, 0x40, 0x81, 0x60, 0x40, 0x20, 0x02, 0x20
+			DB 0x88, 0x20, 0x02, 0x40, 0x82, 0x60, 0x01, 0x20
+			DB 0x86, 0x40, 0x02, 0x60, 0x86, 0x40, 0x02, 0x40
+			DB 0x83, 0x20, 0x01, 0x88, 0x20, 0x01, 0x40, 0x86
+			DB 0x20, 0x01, 0x40, 0x83, 0x60, 0x01, 0x40, 0x88
+			DB 0x60, 0x01, 0x20, 0x85, 0x60, 0x02, 0x84, 0x40
+			DB 0x01, 0x60, 0x89, 0x20, 0x01, 0x85, 0x40, 0x01
+			DB 0x40, 0x84, 0x20, 0x01, 0x8A, 0x20, 0x01, 0x85
+			DB 0x20, 0x01, 0x60, 0x84, 0x20, 0x01, 0x8A, 0x20
+			DB 0x01, 0x85, 0x20, 0x01, 0x60, 0x84, 0x20, 0x01
+			DB 0x60, 0x88, 0x60, 0x01, 0x20, 0x85, 0x02, 0x85
+			DB 0x40, 0x01, 0x20, 0x88, 0x40, 0x01, 0x40, 0x85
+			DB 0x02, 0x85, 0x60, 0x02, 0x40, 0x86, 0x40, 0x02
+			DB 0x60, 0x85, 0x02, 0x86, 0x20, 0x02, 0x20, 0x60
+			DB 0x82, 0x60, 0x20, 0x02, 0x40, 0x86, 0x20, 0x01
+			DB 0x60, 0x85, 0x60, 0x0B, 0x20, 0x87, 0x62, 0x87
+			DB 0x40, 0x09, 0x20, 0x60, 0x93, 0x40, 0x07, 0x40
+			DB 0x97, 0x41, 0x21, 0x41, 0xC6
+; 7 7
+			DB 0xE4, 0x02, 0x40, 0x9B, 0x02, 0x40, 0x9B, 0x02
+			DB 0x40, 0x9B, 0x02, 0x40, 0x9B, 0x02, 0x40, 0x92
+			DB 0x60, 0x40, 0x00, 0x85, 0x02, 0x40, 0x90, 0x40
+			DB 0x20, 0x02, 0x85, 0x02, 0x40, 0x8D, 0x60, 0x40
+			DB 0x05, 0x85, 0x02, 0x40, 0x8B, 0x60, 0x40, 0x07
+			DB 0x85, 0x02, 0x40, 0x89, 0x60, 0x20, 0x07, 0x40
+			DB 0x60, 0x85, 0x02, 0x40, 0x87, 0x60, 0x20, 0x06
+			DB 0x20, 0x40, 0x88, 0x02, 0x40, 0x85, 0x60, 0x20
+			DB 0x06, 0x40, 0x60, 0x8A, 0x02, 0x40, 0x83, 0x60
+			DB 0x40, 0x06, 0x40, 0x8D, 0x02, 0x40, 0x81, 0x60
+			DB 0x40, 0x05, 0x20, 0x40, 0x8F, 0x02, 0x40, 0x80
+			DB 0x40, 0x05, 0x20, 0x40, 0x91, 0x02, 0x20, 0x05
+			DB 0x20, 0x40, 0x93, 0x07, 0x20, 0x40, 0x95, 0x05
+			DB 0x20, 0x40, 0x97, 0x04, 0x40, 0x99, 0x22, 0x40
+			DB 0xD6
+; 8 8
+			DB 0xE8, 0x60, 0x40, 0x21, 0x40, 0x86, 0x60, 0x40
+			DB 0x20, 0x01, 0x40, 0x60, 0x8B, 0x20, 0x05, 0x40
+			DB 0x83, 0x40, 0x06, 0x40, 0x89, 0x20, 0x07, 0x60
+			DB 0x81, 0x60, 0x08, 0x60, 0x87, 0x40, 0x09, 0x81
+			DB 0x03, 0x21, 0x04, 0x86, 0x60, 0x02, 0x40, 0x60
+			DB 0x80, 0x60, 0x20, 0x02, 0x41, 0x01, 0x20, 0x60
+			DB 0x82, 0x40, 0x02, 0x40, 0x85, 0x40, 0x01, 0x20
+			DB 0x84, 0x20, 0x05, 0x60, 0x84, 0x40, 0x01, 0x40
+			DB 0x85, 0x20, 0x01, 0x60, 0x84, 0x60, 0x04, 0x40
+			DB 0x85, 0x60, 0x01, 0x20, 0x85, 0x20, 0x01, 0x86
+			DB 0x40, 0x02, 0x20, 0x87, 0x02, 0x85, 0x01, 0x20
+			DB 0x86, 0x60, 0x02, 0x40, 0x87, 0x20, 0x01, 0x85
+			DB 0x01, 0x20, 0x87, 0x02, 0x40, 0x87, 0x20, 0x01
+			DB 0x85, 0x02, 0x86, 0x40, 0x02, 0x20, 0x87, 0x20
+			DB 0x00, 0x20, 0x85, 0x20, 0x01, 0x60, 0x85, 0x04
+			DB 0x40, 0x85, 0x60, 0x01, 0x20, 0x85, 0x40, 0x01
+			DB 0x20, 0x84, 0x40, 0x01, 0x20, 0x02, 0x85, 0x40
+			DB 0x01, 0x40, 0x85, 0x60, 0x02, 0x40, 0x60, 0x80
+			DB 0x60, 0x40, 0x01, 0x20, 0x60, 0x02, 0x20, 0x60
+			DB 0x82, 0x40, 0x02, 0x60, 0x86, 0x20, 0x08, 0x60
+			DB 0x80, 0x40, 0x03, 0x22, 0x02, 0x40, 0x87, 0x60
+			DB 0x07, 0x40, 0x82, 0x09, 0x89, 0x40, 0x05, 0x40
+			DB 0x83, 0x60, 0x07, 0x60, 0x8A, 0x60, 0x40, 0x21
+			DB 0x40, 0x60, 0x86, 0x40, 0x20, 0x01, 0x20, 0x40
+			DB 0xE4
+; 9 9
+			DB 0xC9, 0x60, 0x40, 0x21, 0x41, 0x60, 0x96, 0x60
+			DB 0x20, 0x06, 0x40, 0x88, 0x63, 0x87, 0x60, 0x09
+			DB 0x20, 0x87, 0x60, 0x01, 0x20, 0x86, 0x60, 0x0B
+			DB 0x40, 0x86, 0x60, 0x02, 0x86, 0x20, 0x02, 0x40
+			DB 0x60, 0x81, 0x60, 0x40, 0x03, 0x60, 0x86, 0x02
+			DB 0x85, 0x60, 0x02, 0x60, 0x85, 0x40, 0x02, 0x40
+			DB 0x86, 0x02, 0x85, 0x40, 0x01, 0x40, 0x87, 0x40
+			DB 0x01, 0x20, 0x86, 0x02, 0x85, 0x20, 0x01, 0x88
+			DB 0x60, 0x02, 0x85, 0x60, 0x01, 0x20, 0x85, 0x01
+			DB 0x20, 0x89, 0x02, 0x85, 0x60, 0x01, 0x20, 0x85
+			DB 0x01, 0x20, 0x89, 0x02, 0x85, 0x40, 0x01, 0x40
+			DB 0x85, 0x01, 0x20, 0x89, 0x01, 0x20, 0x84, 0x60
+			DB 0x02, 0x60, 0x85, 0x20, 0x01, 0x60, 0x87, 0x60
+			DB 0x01, 0x40, 0x84, 0x20, 0x01, 0x20, 0x86, 0x40
+			DB 0x01, 0x40, 0x87, 0x20, 0x01, 0x60, 0x83, 0x40
+			DB 0x02, 0x60, 0x86, 0x40, 0x02, 0x40, 0x85, 0x40
+			DB 0x01, 0x40, 0x82, 0x60, 0x20, 0x02, 0x20, 0x88
+			DB 0x20, 0x02, 0x40, 0x60, 0x81, 0x60, 0x40, 0x01
+			DB 0x20, 0x80, 0x60, 0x40, 0x20, 0x03, 0x20, 0x89
+			DB 0x60, 0x0A, 0x20, 0x06, 0x20, 0x8B, 0x40, 0x10
+			DB 0x40, 0x8D, 0x60, 0x20, 0x0C, 0x40, 0x60, 0x90
+			DB 0x60, 0x40, 0x21, 0x03, 0x21, 0x40, 0x60, 0xE9
+; : colon
+			DB 0xCC, 0x61, 0x8A, 0x61, 0x8F, 0x20, 0x01, 0x20
+			DB 0x60, 0x86, 0x40, 0x02, 0x40, 0x8D, 0x40, 0x03
+			DB 0x20, 0x85, 0x60, 0x04, 0x40, 0x8C, 0x05, 0x60
+			DB 0x84, 0x40, 0x04, 0x20, 0x8C, 0x05, 0x60, 0x84
+			DB 0x40, 0x04, 0x20, 0x8C, 0x40, 0x03, 0x20, 0x86
+			DB 0x04, 0x60, 0x8D, 0x40, 0x01, 0x40, 0x87, 0x60
+			DB 0x20, 0x00, 0x20, 0x60, 0xE2
+; ; semicolon
+			DB 0x8C, 0x61, 0x9D, 0x20, 0x00, 0x40, 0x9B, 0x60
+			DB 0x01, 0x40, 0x93, 0x60, 0x86, 0x20, 0x01, 0x92
+			DB 0x40, 0x01, 0x20, 0x60, 0x83, 0x40, 0x01, 0x40
+			DB 0x91, 0x60, 0x04, 0x40, 0x61, 0x40, 0x02, 0x60
+			DB 0x91, 0x40, 0x0A, 0x40, 0x92, 0x40, 0x09, 0x20
+			DB 0x94, 0x08, 0x20, 0x95, 0x60, 0x20, 0x05, 0x40
+			DB 0x98, 0x60, 0x42, 0x60, 0xB6
+; < less
+			DB 0xAB, 0x60, 0x40, 0x9D, 0x40, 0x00, 0x20, 0x9B
+			DB 0x60, 0x01, 0x40, 0x92, 0x40, 0x20, 0x40, 0x60
+			DB 0x83, 0x60, 0x01, 0x20, 0x92, 0x40, 0x03, 0x40
+			DB 0x60, 0x80, 0x40, 0x02, 0x60, 0x92, 0x0A, 0x40
+			DB 0x93, 0x09, 0x40, 0x94, 0x40, 0x07, 0x40, 0x96
+			DB 0x40, 0x20, 0x03, 0x40, 0x60, 0x99, 0x62, 0xA4
+			DB 0x60, 0x20, 0x60, 0x9C, 0x20, 0x00, 0x20, 0x9B
+			DB 0x40, 0x01, 0x40, 0x92, 0x40, 0x00, 0x20, 0x40
+			DB 0x83, 0x40, 0x01, 0x20, 0x92, 0x40, 0x03, 0x20
+			DB 0x40, 0x60, 0x40, 0x02, 0x60, 0x92, 0x0A, 0x40
+			DB 0x93, 0x20, 0x08, 0x40, 0x94, 0x40, 0x07, 0x60
+			DB 0x96, 0x60, 0x21, 0x00, 0x21, 0x40, 0xFF, 0x96
+; = equal
+			DB 0xCA, 0x13, 0x8B, 0x13, 0x8B, 0x24, 0x0E, 0x8D
+			DB 0x40, 0x01, 0x20, 0x40, 0x60, 0x98, 0x20, 0x01
+			DB 0x60, 0x9A, 0x40, 0x01, 0x60, 0x9B, 0x01, 0x20
+			DB 0x9C, 0x02, 0x40, 0x60, 0x9A, 0x20, 0x12, 0x8C
+			DB 0x20, 0x11, 0x8D, 0x60, 0x40, 0x20, 0x0E, 0x8D
+			DB 0x40, 0x02, 0x40, 0x61, 0x97, 0x40, 0x01, 0x20
+			DB 0x60, 0x99, 0x60, 0x01, 0x40, 0x9B, 0x20, 0x00
+			DB 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x02, 0x40, 0x60
+			DB 0x9A, 0x40, 0x12, 0x8B, 0x60, 0x20, 0x11, 0x8D
+			DB 0x40, 0x21, 0x0E, 0xC0
+; > greater
+			DB 0x8B, 0x01, 0x20, 0x9C, 0x01, 0x20, 0x9C, 0x01
+			DB 0x20, 0x97, 0x64, 0x01, 0x20, 0x6E, 0x85, 0x40
+			DB 0x20, 0x17, 0x83, 0x60, 0x20, 0x19, 0x83, 0x20
+			DB 0x1A, 0x82, 0x40, 0x03, 0x20, 0x44, 0x02, 0x4E
+			DB 0x82, 0x02, 0x20, 0x86, 0x02, 0x90, 0x60, 0x01
+			DB 0x20, 0x87, 0x02, 0x90, 0x60, 0x01, 0x40, 0x87
+			DB 0x02, 0x90, 0x40, 0x01, 0x60, 0x87, 0x02, 0x90
+			DB 0x40, 0x01, 0x60, 0x87, 0x02, 0x90, 0x40, 0x01
+			DB 0x60, 0x80, 0x40, 0x14, 0x20, 0x40, 0x82, 0x60
+			DB 0x01, 0x40, 0x80, 0x40, 0x17, 0x60, 0x80, 0x60
+			DB 0x01, 0x40, 0x80, 0x19, 0x60, 0x80, 0x20, 0x41
+			DB 0x60, 0x26, 0x02, 0x2A, 0x04, 0x40, 0x8B, 0x01
+			DB 0x20, 0x8B, 0x40, 0x03, 0x8B, 0x01, 0x20, 0x8C
+			DB 0x40, 0x02, 0x8B, 0x01, 0x20, 0x8D, 0x02, 0x8B
+			DB 0x01, 0x20, 0x8D, 0x20, 0x01, 0x8B, 0x01, 0x20
+			DB 0x8D, 0x20, 0x01, 0x8B, 0x01, 0x20, 0x8D, 0x20
+			DB 0x01, 0x8B, 0x01, 0x20, 0x8D, 0x02
+; ? question
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+; TOTAL COMPRESSED SIZE = 1859
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font48_idx.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,27 @@
+;==========================================================================
+; Font index exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font48_chars		EQU	.18
+aa_font48_firstChar	EQU	'.'
+aa_font48_lastChar	EQU	'?'
+;
+aa_font48_idx:
+			DW	aa_font48_bits + 0x0000	; . dot
+			DW	aa_font48_bits + 0x001F	; / slash
+			DW	aa_font48_bits + 0x0025	; 0 0
+			DW	aa_font48_bits + 0x00A2	; 1 1
+			DW	aa_font48_bits + 0x00EF	; 2 2
+			DW	aa_font48_bits + 0x0180	; 3 3
+			DW	aa_font48_bits + 0x0220	; 4 4
+			DW	aa_font48_bits + 0x028B	; 5 5
+			DW	aa_font48_bits + 0x0312	; 6 6
+			DW	aa_font48_bits + 0x03BF	; 7 7
+			DW	aa_font48_bits + 0x0430	; 8 8
+			DW	aa_font48_bits + 0x04F1	; 9 9
+			DW	aa_font48_bits + 0x05A1	; : colon
+			DW	aa_font48_bits + 0x05D6	; ; semicolon
+			DW	aa_font48_bits + 0x060B	; < less
+			DW	aa_font48_bits + 0x066B	; = equal
+			DW	aa_font48_bits + 0x06B7	; > greater
+			DW	aa_font48_bits + 0x073D	; ? question
+			DW	aa_font48_bits + 0x0743	; END OF INDEX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font90.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,364 @@
+;==========================================================================
+; Font data exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font90_height	EQU	.58
+aa_font90_width		EQU	.40
+aa_font90_nbbits	EQU	.3
+;
+aa_font90_bits:
+; . dot
+			DB 0xFF, 0xFF, 0x94, 0x60, 0x20, 0x03, 0x20, 0xB1
+			DB 0x60, 0x06, 0x20, 0xB0, 0x20, 0x07, 0x60, 0xAF
+			DB 0x09, 0xAF, 0x09, 0xAF, 0x09, 0xAF, 0x09, 0xAF
+			DB 0x20, 0x07, 0x60, 0xAF, 0x60, 0x06, 0x20, 0xB1
+			DB 0x60, 0x20, 0x02, 0x20, 0x60, 0xFF, 0xFF, 0xA7
+; / slash
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+			DB 0xFF, 0xFF, 0x8F
+; 0 0
+			DB 0xFF, 0xFF, 0xFF, 0xE6, 0x60, 0x41, 0x22, 0x06
+			DB 0x22, 0x42, 0x60, 0xA1, 0x60, 0x40, 0x20, 0x15
+			DB 0x20, 0x40, 0x60, 0x9B, 0x40, 0x20, 0x1C, 0x40
+			DB 0x60, 0x96, 0x40, 0x1F, 0x01, 0x40, 0x94, 0x20
+			DB 0x1F, 0x03, 0x20, 0x60, 0x90, 0x60, 0x1F, 0x07
+			DB 0x60, 0x8E, 0x60, 0x09, 0x20, 0x41, 0x61, 0x89
+			DB 0x62, 0x41, 0x20, 0x09, 0x20, 0x8E, 0x20, 0x06
+			DB 0x20, 0x60, 0x96, 0x60, 0x40, 0x20, 0x06, 0x40
+			DB 0x8C, 0x40, 0x05, 0x20, 0x60, 0x9B, 0x40, 0x06
+			DB 0x8C, 0x05, 0x40, 0x9E, 0x60, 0x05, 0x40, 0x8A
+			DB 0x60, 0x04, 0x40, 0xA0, 0x60, 0x04, 0x40, 0x8A
+			DB 0x40, 0x03, 0x20, 0xA2, 0x20, 0x03, 0x20, 0x8A
+			DB 0x20, 0x03, 0x40, 0xA2, 0x40, 0x04, 0x8A, 0x04
+			DB 0x60, 0xA2, 0x60, 0x04, 0x8A, 0x04, 0x60, 0xA2
+			DB 0x60, 0x04, 0x8A, 0x04, 0x40, 0xA2, 0x40, 0x03
+			DB 0x20, 0x8A, 0x20, 0x03, 0x20, 0xA2, 0x20, 0x03
+			DB 0x40, 0x8A, 0x40, 0x04, 0x60, 0xA0, 0x40, 0x04
+			DB 0x60, 0x8A, 0x40, 0x05, 0x60, 0x9E, 0x40, 0x04
+			DB 0x20, 0x8C, 0x06, 0x40, 0x9B, 0x60, 0x20, 0x05
+			DB 0x60, 0x8C, 0x40, 0x06, 0x20, 0x40, 0x60, 0x95
+			DB 0x60, 0x40, 0x20, 0x06, 0x20, 0x8E, 0x20, 0x09
+			DB 0x20, 0x41, 0x61, 0x89, 0x61, 0x41, 0x21, 0x08
+			DB 0x20, 0x90, 0x20, 0x1F, 0x05, 0x20, 0x92, 0x20
+			DB 0x1F, 0x03, 0x40, 0x94, 0x40, 0x1F, 0x00, 0x20
+			DB 0x60, 0x97, 0x40, 0x1C, 0x40, 0x60, 0x9B, 0x60
+			DB 0x40, 0x20, 0x14, 0x20, 0x41, 0xA2, 0x60, 0x41
+			DB 0x23, 0x05, 0x22, 0x41, 0x61, 0xFF, 0xF7
+; 1 1
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xD1, 0x60, 0x41, 0x61
+			DB 0x9D, 0x40, 0x24, 0x90, 0x40, 0x04, 0x40, 0x9B
+			DB 0x20, 0x04, 0x90, 0x05, 0x60, 0x9B, 0x20, 0x04
+			DB 0x8F, 0x40, 0x04, 0x40, 0x9C, 0x20, 0x04, 0x8F
+			DB 0x20, 0x04, 0x60, 0x9C, 0x20, 0x04, 0x8E, 0x60
+			DB 0x04, 0x20, 0x9D, 0x20, 0x04, 0x8E, 0x40, 0x04
+			DB 0x40, 0x9D, 0x20, 0x04, 0x8E, 0x04, 0x20, 0x9E
+			DB 0x20, 0x04, 0x8D, 0x40, 0x04, 0x40, 0x9E, 0x20
+			DB 0x04, 0x8D, 0x20, 0x04, 0x9F, 0x20, 0x04, 0x8C
+			DB 0x60, 0x04, 0x40, 0x9F, 0x20, 0x04, 0x8C, 0x40
+			DB 0x1F, 0x0B, 0x8C, 0x1F, 0x0C, 0x8C, 0x1F, 0x0C
+			DB 0x8C, 0x1F, 0x0C, 0x8C, 0x1F, 0x0C, 0x8C, 0x3F
+			DB 0x26, 0x05, 0xB3, 0x20, 0x04, 0xB3, 0x20, 0x04
+			DB 0xB3, 0x20, 0x04, 0xB3, 0x20, 0x04, 0xB3, 0x20
+			DB 0x04, 0xB3, 0x20, 0x04, 0xB3, 0x20, 0x04, 0xB3
+			DB 0x20, 0x04, 0xB3, 0x20, 0x04, 0xB3, 0x65, 0xFF
+			DB 0xB0
+; 2 2
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0x95, 0x61, 0xA2, 0x60
+			DB 0x24, 0x8E, 0x20, 0x00, 0x20, 0x41, 0x60, 0x9D
+			DB 0x40, 0x05, 0x8D, 0x40, 0x04, 0x20, 0x9C, 0x40
+			DB 0x06, 0x8D, 0x05, 0x60, 0x9B, 0x40, 0x07, 0x8C
+			DB 0x40, 0x04, 0x40, 0x9B, 0x40, 0x08, 0x8C, 0x20
+			DB 0x04, 0x9B, 0x20, 0x09, 0x8B, 0x60, 0x04, 0x40
+			DB 0x99, 0x60, 0x20, 0x0A, 0x8B, 0x40, 0x04, 0x60
+			DB 0x98, 0x60, 0x0C, 0x8B, 0x20, 0x04, 0x98, 0x60
+			DB 0x06, 0x40, 0x20, 0x04, 0x8B, 0x20, 0x03, 0x20
+			DB 0x97, 0x40, 0x06, 0x60, 0x80, 0x05, 0x8B, 0x04
+			DB 0x20, 0x96, 0x40, 0x06, 0x60, 0x81, 0x05, 0x8B
+			DB 0x04, 0x20, 0x95, 0x40, 0x06, 0x60, 0x82, 0x05
+			DB 0x8B, 0x04, 0x20, 0x94, 0x20, 0x05, 0x20, 0x84
+			DB 0x05, 0x8B, 0x05, 0x92, 0x60, 0x20, 0x05, 0x20
+			DB 0x85, 0x05, 0x8B, 0x20, 0x04, 0x40, 0x90, 0x60
+			DB 0x06, 0x20, 0x86, 0x05, 0x8B, 0x40, 0x04, 0x20
+			DB 0x8F, 0x40, 0x06, 0x40, 0x87, 0x05, 0x8B, 0x40
+			DB 0x05, 0x20, 0x8C, 0x60, 0x20, 0x06, 0x40, 0x88
+			DB 0x05, 0x8C, 0x06, 0x20, 0x60, 0x88, 0x60, 0x40
+			DB 0x07, 0x40, 0x89, 0x05, 0x8C, 0x40, 0x07, 0x41
+			DB 0x60, 0x82, 0x60, 0x40, 0x20, 0x08, 0x40, 0x8A
+			DB 0x05, 0x8D, 0x20, 0x16, 0x20, 0x60, 0x8B, 0x05
+			DB 0x8D, 0x60, 0x15, 0x20, 0x8D, 0x05, 0x8E, 0x60
+			DB 0x13, 0x60, 0x8E, 0x05, 0x8F, 0x60, 0x20, 0x0F
+			DB 0x40, 0x90, 0x05, 0x91, 0x40, 0x20, 0x0B, 0x40
+			DB 0x60, 0x91, 0x05, 0x93, 0x60, 0x40, 0x21, 0x02
+			DB 0x21, 0x40, 0x60, 0x94, 0x05, 0xB3, 0x05, 0xB3
+			DB 0x45, 0xFF, 0xEA
+; 3 3
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xCE, 0x60, 0x41, 0x61
+			DB 0xA0, 0x40, 0x22, 0x01, 0x8D, 0x04, 0x40, 0x9F
+			DB 0x40, 0x04, 0x60, 0x8B, 0x40, 0x04, 0x60, 0x8B
+			DB 0x04, 0x8E, 0x60, 0x04, 0x40, 0x8B, 0x20, 0x03
+			DB 0x40, 0x8C, 0x04, 0x8F, 0x04, 0x40, 0x8B, 0x04
+			DB 0x60, 0x8C, 0x03, 0x20, 0x8F, 0x20, 0x03, 0x20
+			DB 0x8A, 0x60, 0x04, 0x8D, 0x03, 0x20, 0x8F, 0x40
+			DB 0x03, 0x20, 0x8A, 0x40, 0x03, 0x20, 0x8D, 0x03
+			DB 0x20, 0x8F, 0x40, 0x04, 0x8A, 0x20, 0x03, 0x40
+			DB 0x8C, 0x60, 0x03, 0x20, 0x8F, 0x60, 0x04, 0x8A
+			DB 0x20, 0x03, 0x40, 0x8C, 0x60, 0x03, 0x20, 0x8F
+			DB 0x60, 0x04, 0x8A, 0x04, 0x60, 0x8C, 0x40, 0x03
+			DB 0x20, 0x8F, 0x60, 0x04, 0x8A, 0x04, 0x60, 0x8C
+			DB 0x40, 0x03, 0x20, 0x8F, 0x40, 0x03, 0x20, 0x8A
+			DB 0x04, 0x60, 0x8C, 0x20, 0x04, 0x8F, 0x40, 0x03
+			DB 0x20, 0x8A, 0x04, 0x40, 0x8B, 0x60, 0x05, 0x60
+			DB 0x8E, 0x20, 0x03, 0x40, 0x8A, 0x20, 0x03, 0x20
+			DB 0x8B, 0x40, 0x05, 0x40, 0x8D, 0x60, 0x04, 0x60
+			DB 0x8A, 0x40, 0x04, 0x60, 0x89, 0x60, 0x06, 0x20
+			DB 0x8D, 0x40, 0x04, 0x8B, 0x40, 0x04, 0x20, 0x89
+			DB 0x20, 0x07, 0x40, 0x8B, 0x60, 0x04, 0x20, 0x8B
+			DB 0x60, 0x05, 0x40, 0x87, 0x20, 0x03, 0x20, 0x04
+			DB 0x60, 0x8A, 0x20, 0x04, 0x40, 0x8C, 0x20, 0x05
+			DB 0x20, 0x40, 0x60, 0x81, 0x60, 0x40, 0x04, 0x20
+			DB 0x40, 0x05, 0x60, 0x87, 0x60, 0x20, 0x04, 0x20
+			DB 0x8D, 0x60, 0x11, 0x61, 0x06, 0x20, 0x40, 0x60
+			DB 0x82, 0x60, 0x40, 0x06, 0x60, 0x8E, 0x40, 0x0F
+			DB 0x20, 0x81, 0x40, 0x13, 0x40, 0x90, 0x20, 0x0D
+			DB 0x20, 0x82, 0x60, 0x12, 0x20, 0x92, 0x20, 0x0B
+			DB 0x20, 0x84, 0x60, 0x10, 0x20, 0x94, 0x40, 0x20
+			DB 0x07, 0x20, 0x60, 0x86, 0x60, 0x20, 0x0D, 0x40
+			DB 0x97, 0x60, 0x40, 0x22, 0x41, 0x60, 0x8A, 0x40
+			DB 0x0A, 0x20, 0x60, 0xAD, 0x40, 0x21, 0x02, 0x21
+			DB 0x40, 0x60, 0xFF, 0xFF, 0xAC
+; 4 4
+			DB 0xFF, 0xFF, 0xC8, 0x41, 0x62, 0xB2, 0x60, 0x20
+			DB 0x04, 0x20, 0xAF, 0x60, 0x20, 0x06, 0x20, 0xAE
+			DB 0x40, 0x08, 0x20, 0xAC, 0x60, 0x20, 0x09, 0x20
+			DB 0xAA, 0x60, 0x20, 0x0B, 0x20, 0xA9, 0x40, 0x07
+			DB 0x21, 0x03, 0x20, 0xA7, 0x60, 0x20, 0x06, 0x20
+			DB 0x60, 0x80, 0x20, 0x03, 0x20, 0xA5, 0x60, 0x20
+			DB 0x07, 0x40, 0x82, 0x20, 0x03, 0x20, 0xA4, 0x40
+			DB 0x07, 0x20, 0x60, 0x83, 0x20, 0x03, 0x20, 0xA2
+			DB 0x40, 0x07, 0x20, 0x60, 0x85, 0x04, 0x20, 0xA0
+			DB 0x60, 0x20, 0x07, 0x40, 0x87, 0x04, 0x20, 0x9F
+			DB 0x40, 0x07, 0x20, 0x60, 0x88, 0x04, 0x20, 0x9D
+			DB 0x40, 0x07, 0x20, 0x60, 0x8A, 0x04, 0x20, 0x9B
+			DB 0x60, 0x20, 0x07, 0x40, 0x8C, 0x04, 0x20, 0x9A
+			DB 0x40, 0x07, 0x20, 0x60, 0x8D, 0x04, 0x20, 0x98
+			DB 0x40, 0x07, 0x20, 0x60, 0x8F, 0x04, 0x20, 0x96
+			DB 0x60, 0x20, 0x07, 0x40, 0x91, 0x04, 0x20, 0x96
+			DB 0x07, 0x20, 0x60, 0x92, 0x04, 0x20, 0x96, 0x05
+			DB 0x20, 0x60, 0x94, 0x04, 0x20, 0x96, 0x1F, 0x0C
+			DB 0x8C, 0x1F, 0x0C, 0x8C, 0x1F, 0x0C, 0x8C, 0x1F
+			DB 0x0C, 0x8C, 0x1F, 0x0C, 0x8C, 0x5C, 0x04, 0x20
+			DB 0x49, 0xA9, 0x04, 0x20, 0xB3, 0x04, 0x20, 0xB3
+			DB 0x04, 0x20, 0xB3, 0x04, 0x20, 0xB3, 0x04, 0x20
+			DB 0xB3, 0x04, 0x20, 0xB3, 0x45, 0xFF, 0x80
+; 5 5
+			DB 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x40, 0x24, 0x60
+			DB 0x8B, 0x15, 0x40, 0x8F, 0x60, 0x04, 0x60, 0x8B
+			DB 0x15, 0x60, 0x90, 0x04, 0x40, 0x8B, 0x15, 0x60
+			DB 0x90, 0x20, 0x03, 0x20, 0x8B, 0x15, 0x60, 0x90
+			DB 0x40, 0x03, 0x20, 0x8B, 0x15, 0x91, 0x40, 0x03
+			DB 0x20, 0x8B, 0x05, 0x6A, 0x20, 0x03, 0x91, 0x40
+			DB 0x04, 0x8B, 0x05, 0x8A, 0x04, 0x91, 0x60, 0x04
+			DB 0x8B, 0x05, 0x8A, 0x04, 0x91, 0x60, 0x04, 0x8B
+			DB 0x05, 0x8A, 0x04, 0x91, 0x60, 0x04, 0x8B, 0x05
+			DB 0x8A, 0x04, 0x91, 0x40, 0x03, 0x20, 0x8B, 0x05
+			DB 0x8A, 0x04, 0x60, 0x90, 0x40, 0x03, 0x20, 0x8B
+			DB 0x05, 0x8A, 0x20, 0x03, 0x40, 0x90, 0x20, 0x03
+			DB 0x40, 0x8B, 0x05, 0x8A, 0x20, 0x03, 0x20, 0x8F
+			DB 0x60, 0x04, 0x40, 0x8B, 0x05, 0x8A, 0x40, 0x04
+			DB 0x60, 0x8E, 0x40, 0x04, 0x8C, 0x05, 0x8A, 0x40
+			DB 0x04, 0x20, 0x8D, 0x60, 0x04, 0x20, 0x8C, 0x05
+			DB 0x8B, 0x05, 0x40, 0x8B, 0x60, 0x05, 0x40, 0x8C
+			DB 0x05, 0x8B, 0x20, 0x05, 0x40, 0x89, 0x40, 0x05
+			DB 0x20, 0x8D, 0x05, 0x8B, 0x60, 0x07, 0x40, 0x60
+			DB 0x83, 0x60, 0x40, 0x20, 0x06, 0x60, 0x8D, 0x05
+			DB 0x8C, 0x20, 0x15, 0x40, 0x8E, 0x05, 0x8D, 0x20
+			DB 0x13, 0x40, 0x8F, 0x05, 0x8D, 0x60, 0x12, 0x40
+			DB 0x90, 0x05, 0x8E, 0x60, 0x20, 0x0E, 0x20, 0x60
+			DB 0x91, 0x45, 0x90, 0x40, 0x20, 0x0A, 0x20, 0x40
+			DB 0xAC, 0x60, 0x40, 0x20, 0x03, 0x21, 0x40, 0x60
+			DB 0xFF, 0xFF, 0xE7
+; 6 6
+			DB 0xFF, 0xFF, 0xFF, 0xB0, 0x60, 0x41, 0x22, 0x05
+			DB 0x21, 0x41, 0x60, 0xA4, 0x60, 0x40, 0x20, 0x12
+			DB 0x40, 0x60, 0x9E, 0x60, 0x40, 0x18, 0x20, 0x40
+			DB 0x9A, 0x60, 0x40, 0x1C, 0x20, 0x60, 0x97, 0x40
+			DB 0x1F, 0x00, 0x40, 0x94, 0x60, 0x20, 0x0A, 0x21
+			DB 0x41, 0x20, 0x12, 0x40, 0x92, 0x60, 0x08, 0x20
+			DB 0x40, 0x60, 0x82, 0x60, 0x05, 0x40, 0x60, 0x82
+			DB 0x60, 0x40, 0x20, 0x07, 0x40, 0x90, 0x60, 0x07
+			DB 0x40, 0x60, 0x84, 0x40, 0x04, 0x40, 0x88, 0x60
+			DB 0x40, 0x06, 0x60, 0x8F, 0x20, 0x05, 0x20, 0x60
+			DB 0x85, 0x60, 0x04, 0x60, 0x8B, 0x60, 0x05, 0x20
+			DB 0x8E, 0x20, 0x05, 0x40, 0x87, 0x04, 0x60, 0x8D
+			DB 0x60, 0x05, 0x60, 0x8C, 0x60, 0x05, 0x60, 0x87
+			DB 0x40, 0x03, 0x40, 0x8F, 0x40, 0x04, 0x40, 0x8C
+			DB 0x20, 0x04, 0x60, 0x88, 0x04, 0x91, 0x20, 0x03
+			DB 0x20, 0x8B, 0x40, 0x04, 0x40, 0x88, 0x40, 0x03
+			DB 0x40, 0x91, 0x40, 0x03, 0x20, 0x8B, 0x20, 0x03
+			DB 0x20, 0x89, 0x20, 0x03, 0x60, 0x91, 0x60, 0x04
+			DB 0x8B, 0x04, 0x40, 0x89, 0x20, 0x03, 0x60, 0x91
+			DB 0x60, 0x04, 0x8A, 0x60, 0x04, 0x8A, 0x04, 0x60
+			DB 0x91, 0x60, 0x04, 0x8A, 0x40, 0x03, 0x20, 0x8A
+			DB 0x04, 0x40, 0x91, 0x40, 0x03, 0x20, 0x8A, 0x20
+			DB 0x03, 0x40, 0x8A, 0x04, 0x40, 0x91, 0x40, 0x03
+			DB 0x20, 0x8A, 0x20, 0x03, 0x40, 0x8A, 0x20, 0x04
+			DB 0x90, 0x60, 0x04, 0x40, 0x8A, 0x04, 0x60, 0x8A
+			DB 0x40, 0x04, 0x40, 0x8F, 0x20, 0x04, 0x60, 0x8A
+			DB 0x04, 0x60, 0x8A, 0x60, 0x05, 0x40, 0x8D, 0x40
+			DB 0x04, 0x40, 0x8B, 0x04, 0x60, 0x8B, 0x20, 0x05
+			DB 0x40, 0x8A, 0x60, 0x20, 0x05, 0x60, 0x8B, 0x04
+			DB 0x60, 0x8B, 0x40, 0x06, 0x20, 0x40, 0x60, 0x85
+			DB 0x60, 0x40, 0x06, 0x40, 0x8C, 0x20, 0x03, 0x40
+			DB 0x8C, 0x20, 0x09, 0x23, 0x08, 0x20, 0x8D, 0x20
+			DB 0x03, 0x40, 0x8C, 0x60, 0x15, 0x20, 0x8E, 0x65
+			DB 0x8D, 0x60, 0x20, 0x12, 0x40, 0xA5, 0x20, 0x0F
+			DB 0x20, 0x60, 0xA7, 0x60, 0x20, 0x0B, 0x20, 0x40
+			DB 0xAB, 0x60, 0x41, 0x20, 0x03, 0x20, 0x41, 0x60
+			DB 0xFF, 0xF3
+; 7 7
+			DB 0xFF, 0xFF, 0xFF, 0x9F, 0x05, 0x60, 0xB2, 0x05
+			DB 0x60, 0xB2, 0x05, 0x60, 0xB2, 0x05, 0x60, 0xB2
+			DB 0x05, 0x60, 0xB2, 0x05, 0x60, 0xB2, 0x05, 0x60
+			DB 0xA2, 0x40, 0x20, 0x00, 0x8C, 0x05, 0x60, 0x9F
+			DB 0x40, 0x20, 0x03, 0x8C, 0x05, 0x60, 0x9C, 0x60
+			DB 0x40, 0x06, 0x8C, 0x05, 0x60, 0x9A, 0x40, 0x20
+			DB 0x08, 0x8C, 0x05, 0x60, 0x97, 0x60, 0x40, 0x0B
+			DB 0x8C, 0x05, 0x60, 0x95, 0x40, 0x20, 0x0D, 0x8C
+			DB 0x05, 0x60, 0x92, 0x60, 0x40, 0x0E, 0x20, 0x40
+			DB 0x8C, 0x05, 0x60, 0x90, 0x60, 0x20, 0x0D, 0x20
+			DB 0x40, 0x60, 0x8E, 0x05, 0x60, 0x8E, 0x40, 0x20
+			DB 0x0C, 0x20, 0x40, 0x60, 0x91, 0x05, 0x60, 0x8C
+			DB 0x40, 0x20, 0x0C, 0x40, 0x60, 0x94, 0x05, 0x8A
+			DB 0x60, 0x40, 0x0C, 0x20, 0x40, 0x97, 0x05, 0x88
+			DB 0x60, 0x40, 0x0C, 0x40, 0x60, 0x99, 0x05, 0x86
+			DB 0x60, 0x20, 0x0B, 0x20, 0x40, 0x9C, 0x05, 0x84
+			DB 0x60, 0x20, 0x0B, 0x40, 0x60, 0x9E, 0x05, 0x82
+			DB 0x60, 0x20, 0x0A, 0x20, 0x40, 0xA1, 0x05, 0x80
+			DB 0x40, 0x20, 0x0A, 0x20, 0x40, 0xA3, 0x05, 0x20
+			DB 0x0A, 0x40, 0x60, 0xA5, 0x0F, 0x40, 0x60, 0xA7
+			DB 0x0D, 0x40, 0xAA, 0x0A, 0x20, 0x40, 0xAC, 0x08
+			DB 0x20, 0x40, 0xAE, 0x06, 0x20, 0x60, 0xB0, 0x25
+			DB 0x60, 0xFF, 0xFF, 0x90
+; 8 8
+			DB 0xFF, 0xFF, 0xFF, 0xBD, 0x60, 0x41, 0x22, 0x40
+			DB 0x60, 0x9A, 0x60, 0x41, 0x21, 0x41, 0x60, 0x8C
+			DB 0x60, 0x20, 0x08, 0x40, 0x60, 0x95, 0x40, 0x20
+			DB 0x07, 0x20, 0x40, 0x89, 0x40, 0x0C, 0x40, 0x92
+			DB 0x60, 0x20, 0x0B, 0x20, 0x60, 0x86, 0x40, 0x0E
+			DB 0x40, 0x90, 0x60, 0x0F, 0x60, 0x84, 0x40, 0x10
+			DB 0x40, 0x8E, 0x60, 0x11, 0x83, 0x40, 0x12, 0x8E
+			DB 0x20, 0x11, 0x20, 0x81, 0x60, 0x05, 0x20, 0x60
+			DB 0x82, 0x60, 0x40, 0x06, 0x40, 0x8C, 0x40, 0x05
+			DB 0x20, 0x60, 0x82, 0x60, 0x20, 0x06, 0x40, 0x80
+			DB 0x20, 0x04, 0x60, 0x86, 0x60, 0x20, 0x05, 0x8C
+			DB 0x20, 0x04, 0x40, 0x86, 0x60, 0x05, 0x20, 0x40
+			DB 0x04, 0x60, 0x89, 0x05, 0x60, 0x8A, 0x60, 0x04
+			DB 0x40, 0x88, 0x60, 0x0A, 0x60, 0x8A, 0x40, 0x04
+			DB 0x40, 0x8A, 0x40, 0x03, 0x20, 0x8A, 0x40, 0x08
+			DB 0x40, 0x8C, 0x20, 0x03, 0x20, 0x8A, 0x20, 0x03
+			DB 0x40, 0x8B, 0x20, 0x07, 0x8D, 0x40, 0x03, 0x20
+			DB 0x8A, 0x20, 0x03, 0x60, 0x8B, 0x60, 0x06, 0x40
+			DB 0x8D, 0x40, 0x04, 0x8A, 0x04, 0x8D, 0x20, 0x05
+			DB 0x8E, 0x60, 0x04, 0x8A, 0x04, 0x8D, 0x60, 0x04
+			DB 0x20, 0x8E, 0x60, 0x04, 0x8A, 0x04, 0x8D, 0x40
+			DB 0x05, 0x60, 0x8D, 0x60, 0x04, 0x8A, 0x04, 0x60
+			DB 0x8C, 0x20, 0x05, 0x40, 0x8D, 0x60, 0x03, 0x20
+			DB 0x8A, 0x20, 0x03, 0x40, 0x8B, 0x40, 0x07, 0x60
+			DB 0x8C, 0x40, 0x03, 0x20, 0x8A, 0x20, 0x03, 0x20
+			DB 0x8A, 0x60, 0x08, 0x20, 0x8C, 0x20, 0x03, 0x40
+			DB 0x8A, 0x40, 0x04, 0x60, 0x89, 0x20, 0x09, 0x60
+			DB 0x8A, 0x60, 0x04, 0x60, 0x8A, 0x60, 0x05, 0x60
+			DB 0x87, 0x20, 0x04, 0x40, 0x05, 0x60, 0x89, 0x20
+			DB 0x04, 0x8C, 0x20, 0x05, 0x40, 0x60, 0x82, 0x60
+			DB 0x40, 0x05, 0x40, 0x80, 0x06, 0x60, 0x86, 0x60
+			DB 0x20, 0x04, 0x40, 0x8C, 0x60, 0x11, 0x20, 0x81
+			DB 0x40, 0x06, 0x20, 0x60, 0x82, 0x60, 0x40, 0x06
+			DB 0x8E, 0x40, 0x10, 0x83, 0x20, 0x12, 0x40, 0x8F
+			DB 0x20, 0x0E, 0x60, 0x83, 0x60, 0x11, 0x40, 0x91
+			DB 0x20, 0x0B, 0x20, 0x60, 0x85, 0x40, 0x0F, 0x20
+			DB 0x93, 0x60, 0x20, 0x07, 0x20, 0x40, 0x88, 0x60
+			DB 0x0D, 0x40, 0x96, 0x60, 0x41, 0x21, 0x41, 0x60
+			DB 0x8C, 0x40, 0x09, 0x20, 0x60, 0xAE, 0x60, 0x41
+			DB 0x22, 0x41, 0xFF, 0xF2
+; 9 9
+			DB 0xFF, 0xFF, 0xFF, 0xA8, 0x60, 0x40, 0x21, 0x02
+			DB 0x21, 0x40, 0x60, 0xAB, 0x60, 0x40, 0x0C, 0x40
+			DB 0x60, 0xA7, 0x40, 0x10, 0x40, 0x8F, 0x04, 0x40
+			DB 0x8E, 0x60, 0x13, 0x40, 0x8E, 0x20, 0x03, 0x20
+			DB 0x8D, 0x60, 0x15, 0x40, 0x8D, 0x40, 0x03, 0x20
+			DB 0x8C, 0x60, 0x08, 0x20, 0x43, 0x20, 0x08, 0x60
+			DB 0x8C, 0x40, 0x04, 0x8C, 0x20, 0x05, 0x20, 0x60
+			DB 0x87, 0x40, 0x06, 0x20, 0x8C, 0x60, 0x04, 0x8B
+			DB 0x40, 0x05, 0x60, 0x8B, 0x20, 0x05, 0x40, 0x8B
+			DB 0x60, 0x04, 0x8B, 0x20, 0x04, 0x60, 0x8D, 0x20
+			DB 0x04, 0x20, 0x8B, 0x60, 0x04, 0x8A, 0x60, 0x04
+			DB 0x60, 0x8F, 0x05, 0x8B, 0x60, 0x03, 0x20, 0x8A
+			DB 0x40, 0x03, 0x20, 0x90, 0x40, 0x04, 0x60, 0x8A
+			DB 0x40, 0x03, 0x20, 0x8A, 0x20, 0x03, 0x40, 0x90
+			DB 0x60, 0x04, 0x60, 0x8A, 0x40, 0x03, 0x40, 0x8A
+			DB 0x04, 0x60, 0x91, 0x04, 0x60, 0x8A, 0x20, 0x03
+			DB 0x40, 0x8A, 0x04, 0x60, 0x91, 0x04, 0x60, 0x89
+			DB 0x60, 0x04, 0x60, 0x8A, 0x04, 0x60, 0x91, 0x04
+			DB 0x8A, 0x20, 0x03, 0x20, 0x8B, 0x04, 0x40, 0x90
+			DB 0x60, 0x03, 0x20, 0x89, 0x60, 0x04, 0x40, 0x8B
+			DB 0x20, 0x03, 0x20, 0x90, 0x40, 0x03, 0x40, 0x88
+			DB 0x60, 0x05, 0x8C, 0x40, 0x04, 0x60, 0x8F, 0x04
+			DB 0x60, 0x87, 0x60, 0x05, 0x40, 0x8C, 0x40, 0x04
+			DB 0x20, 0x8E, 0x40, 0x03, 0x20, 0x87, 0x60, 0x05
+			DB 0x20, 0x8E, 0x05, 0x20, 0x8C, 0x40, 0x04, 0x60
+			DB 0x85, 0x60, 0x20, 0x06, 0x60, 0x8E, 0x40, 0x05
+			DB 0x20, 0x60, 0x89, 0x40, 0x04, 0x60, 0x84, 0x40
+			DB 0x20, 0x07, 0x40, 0x90, 0x20, 0x06, 0x20, 0x40
+			DB 0x60, 0x83, 0x60, 0x40, 0x05, 0x60, 0x80, 0x60
+			DB 0x41, 0x20, 0x09, 0x40, 0x91, 0x60, 0x14, 0x21
+			DB 0x0C, 0x20, 0x60, 0x93, 0x60, 0x1F, 0x01, 0x40
+			DB 0x96, 0x60, 0x20, 0x1D, 0x20, 0x60, 0x99, 0x40
+			DB 0x20, 0x19, 0x40, 0x60, 0x9D, 0x40, 0x20, 0x13
+			DB 0x20, 0x40, 0x60, 0xA3, 0x60, 0x41, 0x21, 0x06
+			DB 0x21, 0x42, 0x60, 0xFF, 0xFF, 0xB5
+; : colon
+			DB 0xFF, 0xFF, 0xB5, 0x1F, 0x02, 0x96, 0x1F, 0x02
+			DB 0x96, 0x1F, 0x02, 0x96, 0x1F, 0x02, 0x96, 0x42
+			DB 0x61, 0x41, 0x07, 0x33, 0x99, 0x40, 0x05, 0x41
+			DB 0x60, 0xAD, 0x60, 0x04, 0x40, 0x60, 0xB0, 0x40
+			DB 0x03, 0x20, 0x60, 0xB1, 0x60, 0x03, 0x20, 0xB3
+			DB 0x40, 0x03, 0x60, 0xB3, 0x04, 0xB4, 0x04, 0x40
+			DB 0xB3, 0x05, 0x41, 0x60, 0xB0, 0x40, 0x1F, 0x02
+			DB 0x96, 0x1F, 0x02, 0x97, 0x20, 0x1F, 0x00, 0x98
+			DB 0x60, 0x41, 0x21, 0x1B, 0x9A, 0x60, 0x40, 0x20
+			DB 0x05, 0x21, 0x53, 0x98, 0x60, 0x20, 0x04, 0x20
+			DB 0x40, 0x60, 0xAE, 0x40, 0x04, 0x40, 0x60, 0xB0
+			DB 0x40, 0x03, 0x20, 0x60, 0xB1, 0x60, 0x03, 0x20
+			DB 0xB3, 0x40, 0x03, 0x60, 0xB3, 0x04, 0xB4, 0x04
+			DB 0x60, 0xB3, 0x05, 0x40, 0x61, 0xB0, 0x20, 0x1F
+			DB 0x02, 0x95, 0x60, 0x1F, 0x02, 0x96, 0x60, 0x1F
+			DB 0x01, 0x98, 0x40, 0x1F, 0x9A, 0x60, 0x42, 0x3A
+			DB 0xFF, 0xEA
+; ; semicolon
+			DB 0x93, 0x04, 0xB4, 0x04, 0xB4, 0x04, 0xB4, 0x04
+			DB 0xB4, 0x04, 0xB4, 0x04, 0xB4, 0x04, 0xA8, 0x60
+			DB 0x41, 0x21, 0x1F, 0x06, 0x8B, 0x60, 0x20, 0x1F
+			DB 0x0B, 0x8A, 0x40, 0x1F, 0x0D, 0x89, 0x20, 0x1F
+			DB 0x0E, 0x88, 0x20, 0x1F, 0x0F, 0x87, 0x40, 0x07
+			DB 0x20, 0x47, 0x04, 0x5A, 0x87, 0x20, 0x04, 0x20
+			DB 0x40, 0x89, 0x04, 0xA1, 0x60, 0x04, 0x40, 0x8B
+			DB 0x04, 0xA1, 0x40, 0x03, 0x20, 0x8C, 0x04, 0xA1
+			DB 0x20, 0x03, 0x40, 0x8C, 0x04, 0xA1, 0x20, 0x03
+			DB 0x60, 0x8C, 0x04, 0xA1, 0x04, 0x8D, 0x04, 0xA1
+			DB 0x04, 0x8D, 0x04, 0xA1, 0x04, 0x8D, 0x04, 0xA1
+			DB 0x04, 0x8D, 0x04, 0xA1, 0x20, 0x03, 0x60, 0x8C
+			DB 0x04, 0xA1, 0x20, 0x03, 0x60, 0x8C, 0x04, 0xA1
+			DB 0x40, 0x03, 0x40, 0x8C, 0x04, 0xA1, 0x60, 0x03
+			DB 0x20, 0x80, 0x60, 0x4A, 0x04, 0x54, 0x61, 0x8A
+			DB 0x60, 0x20, 0x42, 0x60, 0x80, 0x40, 0x1F, 0x07
+			DB 0x20, 0x40, 0x8E, 0x20, 0x1F, 0x0A, 0x60, 0x8B
+			DB 0x60, 0x1F, 0x0C, 0x40, 0x8A, 0x40, 0x1F, 0x0D
+			DB 0x60, 0x89, 0x20, 0x1F, 0x0D, 0x20, 0x96, 0x04
+			DB 0x92, 0x61, 0x40, 0x07, 0x60, 0x95, 0x04, 0x96
+			DB 0x40, 0x05, 0x40, 0x95, 0x04, 0x97, 0x40, 0x04
+			DB 0x20, 0x95, 0x04, 0x98, 0x04, 0x20, 0x95, 0x04
+			DB 0x98, 0x40, 0x04, 0x95, 0x04, 0x98, 0x60, 0x04
+			DB 0x95, 0x04, 0x98, 0x60, 0x04, 0x95, 0x04, 0x98
+			DB 0x60, 0x03, 0x20, 0x95, 0x04, 0x98, 0x40, 0x03
+			DB 0x20, 0x81
+; TOTAL COMPRESSED SIZE = 2673
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Fonts/aa_font90_idx.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,23 @@
+;==========================================================================
+; Font index exported ven. janv. 13 2012 by FontIO.cpp 110 2011-06-07 11:26:40Z gascuel $ 
+;==========================================================================
+aa_font90_chars		EQU	.14
+aa_font90_firstChar	EQU	'.'
+aa_font90_lastChar	EQU	';'
+;
+aa_font90_idx:
+			DW	aa_font90_bits + 0x0000	; . dot
+			DW	aa_font90_bits + 0x0028	; / slash
+			DW	aa_font90_bits + 0x003B	; 0 0
+			DW	aa_font90_bits + 0x0112	; 1 1
+			DW	aa_font90_bits + 0x0193	; 2 2
+			DW	aa_font90_bits + 0x026E	; 3 3
+			DW	aa_font90_bits + 0x037B	; 4 4
+			DW	aa_font90_bits + 0x0432	; 5 5
+			DW	aa_font90_bits + 0x04FD	; 6 6
+			DW	aa_font90_bits + 0x061F	; 7 7
+			DW	aa_font90_bits + 0x06D3	; 8 8
+			DW	aa_font90_bits + 0x080F	; 9 9
+			DW	aa_font90_bits + 0x0925	; : colon
+			DW	aa_font90_bits + 0x09A7	; ; semicolon
+			DW	aa_font90_bits + 0x0A71	; END OF INDEX
Binary file src/Fonts/c16_aa.png has changed
Binary file src/Fonts/c16_aa.psd has changed
Binary file src/Fonts/c28_aa.png has changed
Binary file src/Fonts/c28_aa.psd has changed
Binary file src/Fonts/c34_aa.png has changed
Binary file src/Fonts/c34_aa.psd has changed
Binary file src/Fonts/c36_aa.png has changed
Binary file src/Fonts/c48_aa.png has changed
Binary file src/Fonts/c48_aa.psd has changed
Binary file src/Fonts/c90_aa.psd has changed
Binary file src/Fonts/c90_aal.png has changed
Binary file src/Icons/dive_warning.bmp has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Icons/dive_warning.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,239 @@
+; \file D:/Microchip/OSTC/Frog/src/Frog/Icons/dive_warning.inc
+; Generated 2012-01-15T23:08:46
+;
+dive_warning_version  equ .112
+dive_warning_width    equ .45
+dive_warning_height   equ .39
+;
+dive_warning_block:
+    db  .22, .39
+    db  .128, 0
+;
+    dw  0x0000 ; rgb=(0,0,0)
+    dw  0x1881 ; rgb=(25,16,8)
+    dw  0x3901 ; rgb=(58,33,8)
+    dw  0x1040 ; rgb=(16,8,0)
+    dw  0x2081 ; rgb=(33,16,8)
+    dw  0x9b01 ; rgb=(156,99,8)
+    dw  0xf4a1 ; rgb=(247,148,8)
+    dw  0xfce1 ; rgb=(255,156,8)
+    dw  0xd3c0 ; rgb=(214,123,4)
+    dw  0x82a1 ; rgb=(132,86,8)
+    dw  0xece1 ; rgb=(239,156,8)
+    dw  0xfd61 ; rgb=(255,173,8)
+    dw  0xfd21 ; rgb=(255,165,8)
+    dw  0xa2c1 ; rgb=(165,90,8)
+    dw  0x59c1 ; rgb=(90,58,8)
+    dw  0xfda0 ; rgb=(255,181,0)
+    dw  0xfd20 ; rgb=(255,165,0)
+    dw  0xfce0 ; rgb=(255,156,0)
+    dw  0x4980 ; rgb=(74,49,0)
+    dw  0xbbc1 ; rgb=(189,123,8)
+    dw  0xfd60 ; rgb=(255,173,0)
+    dw  0xdc20 ; rgb=(222,132,0)
+    dw  0x0840 ; rgb=(8,8,0)
+    dw  0x1880 ; rgb=(25,16,0)
+    dw  0xab81 ; rgb=(169,115,8)
+    dw  0xdce1 ; rgb=(222,156,8)
+    dw  0x51c1 ; rgb=(82,58,8)
+    dw  0xfde0 ; rgb=(255,189,0)
+    dw  0x3100 ; rgb=(49,33,0)
+    dw  0x1080 ; rgb=(16,16,0)
+    dw  0x9b41 ; rgb=(156,107,8)
+    dw  0x6281 ; rgb=(103,82,8)
+    dw  0xed21 ; rgb=(236,165,8)
+    dw  0xfe20 ; rgb=(255,197,0)
+    dw  0x9b81 ; rgb=(156,115,8)
+    dw  0xfde1 ; rgb=(255,189,8)
+    dw  0x9341 ; rgb=(148,107,8)
+    dw  0xf5e1 ; rgb=(247,189,8)
+    dw  0xfe21 ; rgb=(255,197,8)
+    dw  0x5201 ; rgb=(86,66,8)
+    dw  0xfe61 ; rgb=(255,206,8)
+    dw  0xfda1 ; rgb=(255,181,8)
+    dw  0x4141 ; rgb=(66,41,8)
+    dw  0xd4e1 ; rgb=(214,156,8)
+    dw  0xf5a1 ; rgb=(247,181,8)
+    dw  0x28c0 ; rgb=(41,25,0)
+    dw  0xfca1 ; rgb=(255,148,8)
+    dw  0xfca0 ; rgb=(255,148,0)
+    dw  0xfc60 ; rgb=(255,140,0)
+    dw  0xfc61 ; rgb=(255,140,8)
+    dw  0x1840 ; rgb=(25,8,0)
+    dw  0xfea1 ; rgb=(255,214,8)
+    dw  0xf421 ; rgb=(247,132,8)
+    dw  0xf464 ; rgb=(247,140,33)
+    dw  0xf423 ; rgb=(247,132,25)
+    dw  0xfbc0 ; rgb=(255,123,0)
+    dw  0x8301 ; rgb=(132,99,8)
+    dw  0xfe60 ; rgb=(255,206,0)
+    dw  0xf521 ; rgb=(247,165,8)
+    dw  0xfce6 ; rgb=(251,156,49)
+    dw  0xfdac ; rgb=(255,181,102)
+    dw  0xfdae ; rgb=(255,181,115)
+    dw  0xfd27 ; rgb=(251,165,62)
+    dw  0xf461 ; rgb=(247,140,8)
+    dw  0xf673 ; rgb=(247,206,156)
+    dw  0xffbe ; rgb=(255,247,247)
+    dw  0xff3b ; rgb=(252,230,222)
+    dw  0xe4aa ; rgb=(230,148,82)
+    dw  0xf420 ; rgb=(247,132,0)
+    dw  0xe420 ; rgb=(230,132,0)
+    dw  0xf5a0 ; rgb=(247,181,0)
+    dw  0xffff ; rgb=(255,255,255)
+    dw  0xfe72 ; rgb=(255,206,148)
+    dw  0xf651 ; rgb=(247,202,136)
+    dw  0xf77d ; rgb=(247,239,239)
+    dw  0xf4a5 ; rgb=(247,148,41)
+    dw  0xe421 ; rgb=(230,132,8)
+    dw  0x9461 ; rgb=(148,140,8)
+    dw  0xfea0 ; rgb=(255,214,0)
+    dw  0xf4a0 ; rgb=(247,148,0)
+    dw  0xf737 ; rgb=(247,230,189)
+    dw  0xfd6a ; rgb=(251,173,86)
+    dw  0x5a81 ; rgb=(90,82,8)
+    dw  0xfee1 ; rgb=(255,222,8)
+    dw  0xfd62 ; rgb=(255,173,16)
+    dw  0xfe73 ; rgb=(255,206,156)
+    dw  0xfeb6 ; rgb=(255,214,181)
+    dw  0xfeb5 ; rgb=(255,214,173)
+    dw  0xffbd ; rgb=(255,247,239)
+    dw  0x6301 ; rgb=(103,99,8)
+    dw  0xfee0 ; rgb=(255,222,0)
+    dw  0xf4e1 ; rgb=(247,156,8)
+    dw  0xf672 ; rgb=(247,206,148)
+    dw  0xff39 ; rgb=(255,230,206)
+    dw  0xdc21 ; rgb=(222,132,8)
+    dw  0xdde1 ; rgb=(222,189,8)
+    dw  0xf4e0 ; rgb=(247,156,0)
+    dw  0xf4c2 ; rgb=(247,152,21)
+    dw  0xdc61 ; rgb=(222,140,8)
+    dw  0x7341 ; rgb=(115,107,8)
+    dw  0xee41 ; rgb=(239,203,8)
+    dw  0x1900 ; rgb=(25,33,0)
+    dw  0xaca1 ; rgb=(173,148,8)
+    dw  0x2940 ; rgb=(41,41,0)
+    dw  0xbd21 ; rgb=(189,165,8)
+    dw  0x0040 ; rgb=(0,8,0)
+    dw  0xede0 ; rgb=(235,189,4)
+    dw  0x2941 ; rgb=(41,41,8)
+    dw  0xb4e1 ; rgb=(181,156,8)
+    dw  0x3981 ; rgb=(58,49,8)
+    dw  0xcd41 ; rgb=(200,168,8)
+    dw  0x0880 ; rgb=(8,16,0)
+    dw  0x7b81 ; rgb=(123,115,8)
+    dw  0xf661 ; rgb=(247,206,8)
+    dw  0x7b41 ; rgb=(123,107,8)
+    dw  0x2100 ; rgb=(33,33,0)
+    dw  0x8b81 ; rgb=(140,115,8)
+    dw  0xf621 ; rgb=(247,197,8)
+    dw  0x3181 ; rgb=(49,49,8)
+    dw  0x5241 ; rgb=(82,74,8)
+    dw  0xdd41 ; rgb=(218,169,8)
+    dw  0xd421 ; rgb=(214,132,8)
+    dw  0x0800 ; rgb=(8,0,0)
+    dw  0xb341 ; rgb=(181,107,8)
+    dw  0x7b01 ; rgb=(123,99,8)
+    dw  0xf561 ; rgb=(247,173,8)
+    dw  0xcc21 ; rgb=(206,132,8)
+    dw  0x20c1 ; rgb=(33,25,8)
+;
+    db  0xc8, 0x00, 0x01, 0x02, 0x03, 0xa1, 0x00, 0x04
+    db  0x05, 0x06, 0x07, 0x08, 0x04, 0x9e, 0x00, 0x01
+    db  0x09, 0x0a, 0x0b, 0x82, 0x0c, 0x0d, 0x9d, 0x00
+    db  0x0e, 0x0a, 0x0f, 0x81, 0x10, 0x07, 0x81, 0x11
+    db  0x08, 0x9b, 0x00, 0x12, 0x13, 0x81, 0x14, 0x81
+    db  0x10, 0x81, 0x0c, 0x81, 0x11, 0x15, 0x16, 0x98
+    db  0x00, 0x17, 0x18, 0x14, 0x0f, 0x14, 0x83, 0x10
+    db  0x82, 0x11, 0x15, 0x03, 0x96, 0x00, 0x17, 0x09
+    db  0x19, 0x0f, 0x81, 0x14, 0x84, 0x10, 0x82, 0x11
+    db  0x15, 0x03, 0x95, 0x00, 0x1a, 0x19, 0x1b, 0x0f
+    db  0x82, 0x14, 0x84, 0x10, 0x82, 0x11, 0x15, 0x03
+    db  0x93, 0x00, 0x1c, 0x18, 0x81, 0x1b, 0x81, 0x0f
+    db  0x82, 0x14, 0x83, 0x10, 0x83, 0x11, 0x15, 0x03
+    db  0x91, 0x00, 0x1d, 0x1e, 0x0f, 0x1b, 0x83, 0x0f
+    db  0x83, 0x14, 0x82, 0x10, 0x83, 0x11, 0x15, 0x03
+    db  0x8f, 0x00, 0x03, 0x1f, 0x20, 0x1b, 0x85, 0x0f
+    db  0x83, 0x14, 0x82, 0x10, 0x83, 0x11, 0x15, 0x03
+    db  0x8e, 0x00, 0x1a, 0x19, 0x21, 0x1b, 0x85, 0x0f
+    db  0x82, 0x14, 0x0b, 0x14, 0x82, 0x10, 0x83, 0x11
+    db  0x15, 0x03, 0x8c, 0x00, 0x1c, 0x22, 0x23, 0x21
+    db  0x1b, 0x86, 0x0f, 0x81, 0x14, 0x81, 0x0b, 0x14
+    db  0x82, 0x10, 0x83, 0x11, 0x15, 0x03, 0x8a, 0x00
+    db  0x17, 0x24, 0x25, 0x26, 0x81, 0x23, 0x85, 0x0f
+    db  0x82, 0x14, 0x82, 0x0b, 0x14, 0x82, 0x10, 0x83
+    db  0x11, 0x15, 0x03, 0x88, 0x00, 0x03, 0x27, 0x19
+    db  0x28, 0x81, 0x23, 0x29, 0x84, 0x0f, 0x84, 0x14
+    db  0x84, 0x0b, 0x81, 0x0c, 0x81, 0x07, 0x81, 0x11
+    db  0x15, 0x03, 0x87, 0x00, 0x2a, 0x2b, 0x26, 0x25
+    db  0x2c, 0x81, 0x23, 0x83, 0x29, 0x0f, 0x86, 0x14
+    db  0x0b, 0x14, 0x81, 0x0b, 0x0c, 0x82, 0x07, 0x81
+    db  0x11, 0x15, 0x03, 0x85, 0x00, 0x2d, 0x22, 0x81
+    db  0x23, 0x81, 0x20, 0x86, 0x29, 0x0b, 0x83, 0x14
+    db  0x83, 0x10, 0x0c, 0x0b, 0x0c, 0x07, 0x82, 0x2e
+    db  0x07, 0x11, 0x15, 0x03, 0x83, 0x00, 0x16, 0x24
+    db  0x81, 0x26, 0x29, 0x84, 0x10, 0x81, 0x0b, 0x10
+    db  0x81, 0x0c, 0x84, 0x10, 0x11, 0x83, 0x10, 0x14
+    db  0x0c, 0x2f, 0x81, 0x30, 0x31, 0x2f, 0x11, 0x15
+    db  0x32, 0x82, 0x00, 0x1a, 0x2b, 0x33, 0x28, 0x29
+    db  0x10, 0x92, 0x2f, 0x11, 0x10, 0x11, 0x34, 0x35
+    db  0x36, 0x37, 0x30, 0x11, 0x15, 0x32, 0x81, 0x00
+    db  0x38, 0x81, 0x39, 0x28, 0x1b, 0x3a, 0x2f, 0x3b
+    db  0x3c, 0x8e, 0x3d, 0x3c, 0x3e, 0x11, 0x10, 0x3f
+    db  0x40, 0x41, 0x42, 0x43, 0x44, 0x11, 0x45, 0x17
+    db  0x00, 0x27, 0x33, 0x39, 0x26, 0x28, 0x46, 0x0c
+    db  0x2f, 0x3d, 0x42, 0x8f, 0x47, 0x48, 0x81, 0x2f
+    db  0x49, 0x82, 0x47, 0x4a, 0x4b, 0x2f, 0x4c, 0x17
+    db  0x00, 0x4d, 0x4e, 0x21, 0x81, 0x26, 0x1b, 0x0b
+    db  0x2f, 0x3d, 0x42, 0x8f, 0x47, 0x48, 0x2e, 0x4f
+    db  0x50, 0x83, 0x47, 0x51, 0x2f, 0x4c, 0x17, 0x00
+    db  0x52, 0x53, 0x39, 0x81, 0x21, 0x1b, 0x54, 0x11
+    db  0x51, 0x55, 0x8e, 0x56, 0x57, 0x3c, 0x2e, 0x4f
+    db  0x49, 0x82, 0x47, 0x58, 0x3b, 0x2f, 0x4c, 0x17
+    db  0x81, 0x00, 0x59, 0x5a, 0x39, 0x21, 0x1b, 0x0b
+    db  0x10, 0x81, 0x2f, 0x90, 0x30, 0x2f, 0x10, 0x5b
+    db  0x5c, 0x58, 0x5d, 0x3e, 0x2f, 0x07, 0x5e, 0x17
+    db  0x82, 0x00, 0x52, 0x5f, 0x4e, 0x21, 0x0f, 0x14
+    db  0x82, 0x10, 0x8f, 0x11, 0x10, 0x0b, 0x10, 0x60
+    db  0x81, 0x61, 0x2f, 0x07, 0x0c, 0x62, 0x32, 0x83
+    db  0x00, 0x16, 0x63, 0x64, 0x28, 0x29, 0x0f, 0x82
+    db  0x14, 0x82, 0x0b, 0x81, 0x14, 0x0b, 0x81, 0x0f
+    db  0x84, 0x14, 0x81, 0x0b, 0x81, 0x14, 0x0b, 0x0c
+    db  0x10, 0x83, 0x0c, 0x62, 0x03, 0x85, 0x00, 0x65
+    db  0x66, 0x21, 0x0f, 0x82, 0x14, 0x84, 0x0b, 0x0c
+    db  0x0b, 0x29, 0x0f, 0x81, 0x14, 0x81, 0x10, 0x0c
+    db  0x82, 0x14, 0x82, 0x0b, 0x83, 0x0c, 0x62, 0x03
+    db  0x87, 0x00, 0x67, 0x68, 0x39, 0x1b, 0x81, 0x14
+    db  0x0b, 0x14, 0x81, 0x0b, 0x0c, 0x14, 0x82, 0x0f
+    db  0x14, 0x82, 0x10, 0x82, 0x14, 0x83, 0x0b, 0x82
+    db  0x0c, 0x62, 0x03, 0x88, 0x00, 0x69, 0x1f, 0x6a
+    db  0x28, 0x23, 0x29, 0x82, 0x0b, 0x0c, 0x0f, 0x1b
+    db  0x83, 0x0f, 0x84, 0x14, 0x82, 0x0b, 0x83, 0x0c
+    db  0x5e, 0x03, 0x8a, 0x00, 0x1d, 0x59, 0x64, 0x28
+    db  0x29, 0x0f, 0x81, 0x14, 0x0f, 0x81, 0x1b, 0x84
+    db  0x0f, 0x83, 0x14, 0x81, 0x0b, 0x81, 0x0c, 0x81
+    db  0x10, 0x62, 0x03, 0x8c, 0x00, 0x6b, 0x6c, 0x28
+    db  0x21, 0x0f, 0x82, 0x1b, 0x81, 0x23, 0x83, 0x0f
+    db  0x85, 0x14, 0x82, 0x10, 0x0c, 0x62, 0x03, 0x8e
+    db  0x00, 0x6d, 0x6e, 0x39, 0x81, 0x1b, 0x83, 0x23
+    db  0x83, 0x0f, 0x83, 0x14, 0x83, 0x10, 0x0c, 0x62
+    db  0x03, 0x90, 0x00, 0x63, 0x6a, 0x39, 0x83, 0x23
+    db  0x83, 0x0f, 0x83, 0x14, 0x82, 0x10, 0x81, 0x0c
+    db  0x62, 0x03, 0x91, 0x00, 0x6f, 0x70, 0x71, 0x28
+    db  0x81, 0x23, 0x29, 0x0f, 0x81, 0x29, 0x0f, 0x83
+    db  0x14, 0x83, 0x0c, 0x62, 0x03, 0x93, 0x00, 0x6b
+    db  0x6c, 0x28, 0x26, 0x83, 0x29, 0x0f, 0x83, 0x14
+    db  0x0b, 0x82, 0x0c, 0x62, 0x03, 0x95, 0x00, 0x6d
+    db  0x6e, 0x33, 0x23, 0x81, 0x29, 0x81, 0x0f, 0x81
+    db  0x14, 0x81, 0x0b, 0x82, 0x0c, 0x62, 0x03, 0x96
+    db  0x00, 0x16, 0x72, 0x64, 0x26, 0x82, 0x29, 0x0b
+    db  0x14, 0x81, 0x0b, 0x82, 0x0c, 0x62, 0x03, 0x98
+    db  0x00, 0x73, 0x74, 0x75, 0x23, 0x29, 0x81, 0x0b
+    db  0x81, 0x14, 0x82, 0x0c, 0x62, 0x03, 0x9a, 0x00
+    db  0x76, 0x6e, 0x26, 0x29, 0x0b, 0x81, 0x14, 0x82
+    db  0x0c, 0x62, 0x03, 0x9b, 0x00, 0x16, 0x77, 0x78
+    db  0x26, 0x81, 0x0b, 0x82, 0x10, 0x79, 0x7a, 0x9d
+    db  0x00, 0x16, 0x72, 0x23, 0x29, 0x14, 0x10, 0x14
+    db  0x7b, 0xa0, 0x00, 0x73, 0x7c, 0x78, 0x7d, 0x7e
+    db  0x2d, 0xa2, 0x00, 0x16, 0x7f, 0x16, 0xa8, 0x00
+
Binary file src/Icons/ostc3_logo.PNG has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Icons/ostc3_logo.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,232 @@
+; \file C:/hw/ostc3_code/OSTC3/Icons/ostc3_logo.inc
+; Generated 2013-02-09T13:21:27
+;
+ostc3_logo_version  equ .112
+ostc3_logo_width    equ .170
+ostc3_logo_height   equ .47
+;
+ostc3_logo_block:
+    db  .85, .47
+    db  .9, 0
+;
+    dw  0x0000 ; rgb=(0,0,0)
+    dw  0xffff ; rgb=(255,255,255)
+    dw  0xce79 ; rgb=(204,204,204)
+    dw  0xcff9 ; rgb=(204,255,204)
+    dw  0xfe7f ; rgb=(255,204,255)
+    dw  0xcfff ; rgb=(204,255,255)
+    dw  0xfff9 ; rgb=(255,255,204)
+    dw  0xce7f ; rgb=(204,204,255)
+    dw  0xfe79 ; rgb=(255,204,204)
+;
+    db  0x99, 0x00, 0x87, 0x01, 0xa1, 0x00, 0x90, 0x01
+    db  0x9a, 0x00, 0x95, 0x01, 0x96, 0x00, 0x82, 0x01
+    db  0x02, 0x85, 0x01, 0x02, 0x86, 0x01, 0x02, 0x85
+    db  0x01, 0x93, 0x00, 0x9b, 0x01, 0x90, 0x00, 0x9e
+    db  0x01, 0x8e, 0x00, 0xa0, 0x01, 0x8c, 0x00, 0x89
+    db  0x01, 0x02, 0x84, 0x01, 0x02, 0x86, 0x01, 0x02
+    db  0x86, 0x01, 0x02, 0x81, 0x01, 0x8a, 0x00, 0xa3
+    db  0x01, 0x89, 0x00, 0xa5, 0x01, 0x87, 0x00, 0x9e
+    db  0x01, 0x02, 0x86, 0x01, 0x86, 0x00, 0x87, 0x01
+    db  0x02, 0x88, 0x01, 0x87, 0x00, 0x8d, 0x01, 0x85
+    db  0x00, 0x8e, 0x01, 0x8d, 0x00, 0x8b, 0x01, 0x84
+    db  0x00, 0x8c, 0x01, 0x02, 0x91, 0x00, 0x84, 0x01
+    db  0x02, 0x83, 0x01, 0x03, 0x83, 0x00, 0x84, 0x01
+    db  0x02, 0x85, 0x01, 0x93, 0x00, 0x8a, 0x01, 0x82
+    db  0x00, 0x8b, 0x01, 0x95, 0x00, 0x88, 0x01, 0x04
+    db  0x82, 0x00, 0x8a, 0x01, 0x96, 0x00, 0x88, 0x01
+    db  0x03, 0x81, 0x00, 0x81, 0x01, 0x02, 0x87, 0x01
+    db  0x97, 0x00, 0x86, 0x01, 0x04, 0x81, 0x01, 0x81
+    db  0x00, 0x89, 0x01, 0x98, 0x00, 0x85, 0x01, 0x03
+    db  0x82, 0x01, 0x00, 0x88, 0x01, 0x02, 0x99, 0x00
+    db  0x89, 0x01, 0x00, 0x89, 0x01, 0x99, 0x00, 0x89
+    db  0x01, 0x00, 0x82, 0x01, 0x02, 0x84, 0x01, 0x9a
+    db  0x00, 0x86, 0x01, 0x04, 0x01, 0x81, 0x00, 0x87
+    db  0x01, 0x02, 0x9a, 0x00, 0x88, 0x01, 0x00, 0x89
+    db  0x01, 0x99, 0x00, 0x83, 0x01, 0x03, 0x83, 0x01
+    db  0x03, 0x00, 0x89, 0x01, 0x99, 0x00, 0x89, 0x01
+    db  0x00, 0x88, 0x01, 0x99, 0x00, 0x88, 0x01, 0x04
+    db  0x81, 0x00, 0x85, 0x01, 0x02, 0x82, 0x01, 0x97
+    db  0x00, 0x8a, 0x01, 0x81, 0x00, 0x89, 0x01, 0x96
+    db  0x00, 0x86, 0x01, 0x03, 0x83, 0x01, 0x81, 0x00
+    db  0x89, 0x01, 0x95, 0x00, 0x8b, 0x01, 0x82, 0x00
+    db  0x89, 0x01, 0x94, 0x00, 0x84, 0x01, 0x04, 0x86
+    db  0x01, 0x82, 0x00, 0x85, 0x01, 0x02, 0x83, 0x01
+    db  0x91, 0x00, 0x02, 0x84, 0x01, 0x03, 0x86, 0x01
+    db  0x84, 0x00, 0x8a, 0x01, 0x8e, 0x00, 0x8d, 0x01
+    db  0x03, 0x85, 0x00, 0x8a, 0x01, 0x02, 0x01, 0x88
+    db  0x00, 0x92, 0x01, 0x85, 0x00, 0x9f, 0x01, 0x03
+    db  0x81, 0x01, 0x04, 0x83, 0x01, 0x86, 0x00, 0x84
+    db  0x01, 0x02, 0x92, 0x01, 0x04, 0x8c, 0x01, 0x88
+    db  0x00, 0x98, 0x01, 0x03, 0x8a, 0x01, 0x89, 0x00
+    db  0x88, 0x01, 0x02, 0x85, 0x01, 0x03, 0x04, 0x90
+    db  0x01, 0x04, 0x8b, 0x00, 0x9a, 0x01, 0x04, 0x84
+    db  0x01, 0x8e, 0x00, 0x92, 0x01, 0x03, 0x86, 0x01
+    db  0x03, 0x82, 0x01, 0x8f, 0x00, 0x8a, 0x01, 0x03
+    db  0x04, 0x86, 0x01, 0x04, 0x88, 0x01, 0x92, 0x00
+    db  0x99, 0x01, 0x95, 0x00, 0x95, 0x01, 0x9a, 0x00
+    db  0x90, 0x01, 0xa1, 0x00, 0x83, 0x01, 0x04, 0x81
+    db  0x01, 0x03, 0x04, 0xef, 0x00, 0x85, 0x01, 0xa5
+    db  0x00, 0x88, 0x01, 0xa5, 0x00, 0x88, 0x01, 0xa5
+    db  0x00, 0x89, 0x01, 0x8a, 0x00, 0x04, 0x86, 0x01
+    db  0x02, 0x90, 0x00, 0x85, 0x01, 0x04, 0x82, 0x01
+    db  0x88, 0x00, 0x01, 0x04, 0x8a, 0x01, 0x8e, 0x00
+    db  0x86, 0x01, 0x03, 0x81, 0x01, 0x86, 0x00, 0x03
+    db  0x8d, 0x01, 0x03, 0x8e, 0x00, 0x88, 0x01, 0x85
+    db  0x00, 0x87, 0x01, 0x03, 0x88, 0x01, 0x8d, 0x00
+    db  0x88, 0x01, 0x84, 0x00, 0x8b, 0x01, 0x04, 0x85
+    db  0x01, 0x04, 0x8c, 0x00, 0x84, 0x01, 0x04, 0x82
+    db  0x01, 0x83, 0x00, 0x93, 0x01, 0x03, 0x01, 0x8b
+    db  0x00, 0x85, 0x01, 0x03, 0x81, 0x01, 0x82, 0x00
+    db  0x8f, 0x01, 0x03, 0x85, 0x01, 0x8b, 0x00, 0x88
+    db  0x01, 0x82, 0x00, 0x88, 0x01, 0x02, 0x86, 0x01
+    db  0x04, 0x84, 0x01, 0x04, 0x89, 0x00, 0x03, 0x88
+    db  0x01, 0x81, 0x00, 0x84, 0x01, 0x02, 0x93, 0x01
+    db  0x88, 0x00, 0x85, 0x01, 0x04, 0x81, 0x01, 0x82
+    db  0x00, 0x94, 0x01, 0x03, 0x83, 0x01, 0x88, 0x00
+    db  0x85, 0x01, 0x03, 0x81, 0x01, 0x81, 0x00, 0x95
+    db  0x01, 0x04, 0x83, 0x01, 0x04, 0x86, 0x00, 0x89
+    db  0x01, 0x81, 0x00, 0x89, 0x01, 0x02, 0x83, 0x00
+    db  0x8d, 0x01, 0x84, 0x00, 0x04, 0x88, 0x01, 0x04
+    db  0x81, 0x00, 0x88, 0x01, 0x86, 0x00, 0x86, 0x01
+    db  0x03, 0x84, 0x01, 0x02, 0x01, 0x04, 0x03, 0x8a
+    db  0x01, 0x82, 0x00, 0x88, 0x01, 0x87, 0x00, 0x95
+    db  0x01, 0x04, 0x83, 0x01, 0x81, 0x00, 0x87, 0x01
+    db  0x02, 0x88, 0x00, 0x86, 0x01, 0x04, 0x8d, 0x01
+    db  0x03, 0x82, 0x01, 0x82, 0x00, 0x88, 0x01, 0x89
+    db  0x00, 0x8c, 0x01, 0x03, 0x8a, 0x01, 0x82, 0x00
+    db  0x88, 0x01, 0x8a, 0x00, 0x83, 0x01, 0x03, 0x91
+    db  0x01, 0x83, 0x00, 0x87, 0x01, 0x02, 0x8a, 0x00
+    db  0x8b, 0x01, 0x04, 0x84, 0x01, 0x04, 0x82, 0x01
+    db  0x03, 0x83, 0x00, 0x88, 0x01, 0x8b, 0x00, 0x85
+    db  0x01, 0x04, 0x01, 0x03, 0x86, 0x01, 0x03, 0x83
+    db  0x01, 0x84, 0x00, 0x88, 0x01, 0x8c, 0x00, 0x92
+    db  0x01, 0x85, 0x00, 0x88, 0x01, 0x8d, 0x00, 0x8f
+    db  0x01, 0x87, 0x00, 0x87, 0x01, 0x02, 0x8e, 0x00
+    db  0x86, 0x01, 0x04, 0x84, 0x01, 0x04, 0x88, 0x00
+    db  0x88, 0x01, 0x90, 0x00, 0x84, 0x01, 0x03, 0x83
+    db  0x01, 0x8a, 0x00, 0x89, 0x01, 0x93, 0x00, 0x81
+    db  0x01, 0x8f, 0x00, 0x87, 0x01, 0xa6, 0x00, 0x83
+    db  0x01, 0x81, 0xbb, 0x00, 0x01, 0x02, 0x82, 0x01
+    db  0xa5, 0x00, 0x02, 0x87, 0x01, 0xa5, 0x00, 0x88
+    db  0x01, 0xa5, 0x00, 0x87, 0x01, 0x02, 0xa1, 0x00
+    db  0x05, 0x04, 0x81, 0x00, 0x83, 0x01, 0x02, 0x83
+    db  0x01, 0x9c, 0x00, 0x01, 0x06, 0x84, 0x01, 0x81
+    db  0x00, 0x88, 0x01, 0x97, 0x00, 0x81, 0x01, 0x06
+    db  0x88, 0x01, 0x81, 0x00, 0x87, 0x01, 0x02, 0x92
+    db  0x00, 0x03, 0x8e, 0x01, 0x07, 0x81, 0x00, 0x88
+    db  0x01, 0x8d, 0x00, 0x8f, 0x01, 0x05, 0x84, 0x01
+    db  0x81, 0x00, 0x01, 0x02, 0x86, 0x01, 0x87, 0x00
+    db  0x91, 0x01, 0x04, 0x83, 0x01, 0x06, 0x83, 0x01
+    db  0x81, 0x00, 0x87, 0x01, 0x02, 0x82, 0x00, 0x05
+    db  0x08, 0x8a, 0x01, 0x05, 0x91, 0x01, 0x07, 0x81
+    db  0x00, 0x97, 0x01, 0x06, 0x86, 0x01, 0x06, 0x81
+    db  0x01, 0x05, 0x83, 0x01, 0x04, 0x83, 0x01, 0x81
+    db  0x00, 0x98, 0x01, 0x04, 0x84, 0x01, 0x04, 0x84
+    db  0x01, 0x06, 0x86, 0x01, 0x81, 0x00, 0x01, 0x02
+    db  0x90, 0x01, 0x04, 0x05, 0x97, 0x01, 0x81, 0x00
+    db  0x87, 0x01, 0x08, 0x01, 0x05, 0x82, 0x01, 0x06
+    db  0x84, 0x01, 0x06, 0x86, 0x01, 0x03, 0x8d, 0x01
+    db  0x03, 0x82, 0x00, 0xa5, 0x01, 0x06, 0x07, 0x86
+    db  0x00, 0x8e, 0x01, 0x04, 0x84, 0x01, 0x05, 0x04
+    db  0x89, 0x01, 0x07, 0x8c, 0x00, 0x01, 0x02, 0x86
+    db  0x01, 0x05, 0x91, 0x01, 0x06, 0x91, 0x00, 0x87
+    db  0x01, 0x08, 0x8a, 0x01, 0x06, 0x82, 0x01, 0x96
+    db  0x00, 0x8f, 0x01, 0x06, 0x01, 0x07, 0x9b, 0x00
+    db  0x8b, 0x01, 0x03, 0x01, 0xa0, 0x00, 0x01, 0x02
+    db  0x85, 0x01, 0x05, 0xa5, 0x00, 0x87, 0x01, 0x08
+    db  0xa5, 0x00, 0x88, 0x01, 0xa5, 0x00, 0x87, 0x01
+    db  0x05, 0xa5, 0x00, 0x01, 0x02, 0x85, 0x01, 0x08
+    db  0xa5, 0x00, 0x88, 0x01, 0xa5, 0x00, 0x87, 0x01
+    db  0x05, 0xa5, 0x00, 0x87, 0x01, 0x08, 0xa5, 0x00
+    db  0x01, 0x02, 0x86, 0x01, 0x8d, 0x00, 0x83, 0x01
+    db  0x04, 0x84, 0x01, 0x05, 0x01, 0x8b, 0x00, 0x88
+    db  0x01, 0x89, 0x00, 0x91, 0x01, 0x02, 0x88, 0x00
+    db  0x87, 0x01, 0x08, 0x86, 0x00, 0x01, 0x05, 0x94
+    db  0x01, 0x87, 0x00, 0x83, 0x01, 0x08, 0x05, 0x87
+    db  0x00, 0x8d, 0x01, 0x05, 0x08, 0x85, 0x01, 0x08
+    db  0x82, 0x01, 0x08, 0x91, 0x00, 0x95, 0x01, 0x05
+    db  0x86, 0x01, 0x8f, 0x00, 0x8c, 0x01, 0x04, 0x90
+    db  0x01, 0x8d, 0x00, 0x8e, 0x01, 0x05, 0x8d, 0x01
+    db  0x05, 0x82, 0x01, 0x8b, 0x00, 0x88, 0x01, 0x08
+    db  0x01, 0x05, 0x88, 0x01, 0x06, 0x81, 0x01, 0x04
+    db  0x84, 0x01, 0x06, 0x04, 0x82, 0x01, 0x05, 0x89
+    db  0x00, 0x96, 0x01, 0x05, 0x8c, 0x01, 0x88, 0x00
+    db  0x90, 0x01, 0x04, 0x93, 0x01, 0x87, 0x00, 0x88
+    db  0x01, 0x05, 0x95, 0x01, 0x03, 0x83, 0x01, 0x05
+    db  0x01, 0x04, 0x85, 0x00, 0x89, 0x01, 0x08, 0x88
+    db  0x01, 0x05, 0x01, 0x82, 0x00, 0x89, 0x01, 0x04
+    db  0x84, 0x01, 0x85, 0x00, 0x8f, 0x01, 0x8c, 0x00
+    db  0x8b, 0x01, 0x84, 0x00, 0x83, 0x01, 0x02, 0x88
+    db  0x01, 0x02, 0x8f, 0x00, 0x88, 0x01, 0x05, 0x01
+    db  0x84, 0x00, 0x8b, 0x01, 0x02, 0x92, 0x00, 0x89
+    db  0x01, 0x83, 0x00, 0x89, 0x01, 0x02, 0x01, 0x94
+    db  0x00, 0x83, 0x01, 0x08, 0x84, 0x01, 0x83, 0x00
+    db  0x8a, 0x01, 0x96, 0x00, 0x82, 0x01, 0x05, 0x85
+    db  0x01, 0x81, 0x00, 0x82, 0x01, 0x02, 0x86, 0x01
+    db  0x97, 0x00, 0x89, 0x01, 0x81, 0x00, 0x88, 0x01
+    db  0x04, 0x98, 0x00, 0x84, 0x01, 0x06, 0x82, 0x01
+    db  0x82, 0x00, 0x89, 0x01, 0x98, 0x00, 0x88, 0x01
+    db  0x81, 0x00, 0x88, 0x01, 0x02, 0x99, 0x00, 0x84
+    db  0x01, 0x07, 0x82, 0x01, 0x81, 0x00, 0x83, 0x01
+    db  0x03, 0x84, 0x01, 0x99, 0x00, 0x88, 0x01, 0x81
+    db  0x00, 0x82, 0x01, 0x04, 0x84, 0x01, 0x9a, 0x00
+    db  0x84, 0x01, 0x06, 0x82, 0x01, 0x81, 0x00, 0x88
+    db  0x01, 0x9a, 0x00, 0x88, 0x01, 0x81, 0x00, 0x81
+    db  0x01, 0x03, 0x85, 0x01, 0x9a, 0x00, 0x86, 0x01
+    db  0x07, 0x06, 0x81, 0x00, 0x87, 0x01, 0x02, 0x9a
+    db  0x00, 0x88, 0x01, 0x81, 0x00, 0x82, 0x01, 0x04
+    db  0x84, 0x01, 0x99, 0x00, 0x88, 0x01, 0x82, 0x00
+    db  0x88, 0x01, 0x99, 0x00, 0x83, 0x01, 0x02, 0x83
+    db  0x01, 0x82, 0x00, 0x88, 0x01, 0x99, 0x00, 0x81
+    db  0x01, 0x89, 0x00, 0x86, 0x01, 0x03, 0x01, 0xa5
+    db  0x00, 0x81, 0x01, 0x03, 0x04, 0x84, 0x01, 0xa5
+    db  0x00, 0x89, 0x01, 0xa4, 0x00, 0x89, 0x01, 0xa4
+    db  0x00, 0x85, 0x01, 0x03, 0x81, 0x01, 0x04, 0x9f
+    db  0x00, 0x01, 0x02, 0x01, 0x81, 0x00, 0x83, 0x01
+    db  0x04, 0x01, 0xa0, 0x00, 0x85, 0x01, 0x82, 0x00
+    db  0x81, 0x01, 0xa0, 0x00, 0x88, 0x01, 0xa5, 0x00
+    db  0x88, 0x01, 0xa6, 0x00, 0x87, 0x01, 0x03, 0xa5
+    db  0x00, 0x87, 0x01, 0x04, 0x95, 0x00, 0x84, 0x01
+    db  0x8a, 0x00, 0x84, 0x01, 0x03, 0x82, 0x01, 0x92
+    db  0x00, 0x87, 0x01, 0x8a, 0x00, 0x83, 0x01, 0x04
+    db  0x83, 0x01, 0x82, 0x00, 0x04, 0x81, 0x01, 0x03
+    db  0x04, 0x81, 0x01, 0x88, 0x00, 0x87, 0x01, 0x8a
+    db  0x00, 0x88, 0x01, 0x81, 0x00, 0x87, 0x01, 0x88
+    db  0x00, 0x82, 0x01, 0x02, 0x83, 0x01, 0x8a, 0x00
+    db  0x88, 0x01, 0x81, 0x00, 0x87, 0x01, 0x88, 0x00
+    db  0x87, 0x01, 0x8a, 0x00, 0x81, 0x01, 0x03, 0x84
+    db  0x01, 0x81, 0x00, 0x87, 0x01, 0x89, 0x00, 0x87
+    db  0x01, 0x89, 0x00, 0x84, 0x01, 0x04, 0x82, 0x01
+    db  0x81, 0x00, 0x83, 0x01, 0x03, 0x82, 0x01, 0x89
+    db  0x00, 0x87, 0x01, 0x89, 0x00, 0x88, 0x01, 0x81
+    db  0x00, 0x85, 0x01, 0x04, 0x01, 0x89, 0x00, 0x85
+    db  0x01, 0x02, 0x01, 0x89, 0x00, 0x84, 0x01, 0x03
+    db  0x82, 0x01, 0x81, 0x00, 0x87, 0x01, 0x88, 0x00
+    db  0x89, 0x01, 0x87, 0x00, 0x89, 0x01, 0x81, 0x00
+    db  0x87, 0x01, 0x88, 0x00, 0x89, 0x01, 0x86, 0x00
+    db  0x84, 0x01, 0x04, 0x83, 0x01, 0x81, 0x00, 0x85
+    db  0x01, 0x03, 0x81, 0x01, 0x87, 0x00, 0x02, 0x87
+    db  0x01, 0x04, 0x81, 0x01, 0x83, 0x00, 0x03, 0x8a
+    db  0x01, 0x81, 0x00, 0x86, 0x01, 0x04, 0x01, 0x87
+    db  0x00, 0x87, 0x01, 0x03, 0x83, 0x01, 0x04, 0x01
+    db  0x03, 0x88, 0x01, 0x03, 0x81, 0x01, 0x81, 0x00
+    db  0x89, 0x01, 0x85, 0x00, 0x04, 0x99, 0x01, 0x04
+    db  0x82, 0x00, 0x87, 0x01, 0x03, 0x81, 0x01, 0x82
+    db  0x00, 0x88, 0x01, 0x04, 0x8d, 0x01, 0x04, 0x83
+    db  0x01, 0x83, 0x00, 0x87, 0x01, 0x04, 0x9b, 0x01
+    db  0x03, 0x84, 0x01, 0x83, 0x00, 0x9c, 0x01, 0x03
+    db  0x82, 0x01, 0x04, 0x86, 0x01, 0x03, 0x85, 0x00
+    db  0x93, 0x01, 0x03, 0x85, 0x01, 0x04, 0x8b, 0x01
+    db  0x86, 0x00, 0x83, 0x01, 0x04, 0x81, 0x01, 0x03
+    db  0x82, 0x01, 0x04, 0x81, 0x01, 0x03, 0x82, 0x01
+    db  0x04, 0x01, 0x00, 0x90, 0x01, 0x04, 0x87, 0x00
+    db  0x92, 0x01, 0x82, 0x00, 0x89, 0x01, 0x03, 0x84
+    db  0x01, 0x88, 0x00, 0x92, 0x01, 0x83, 0x00, 0x88
+    db  0x01, 0x04, 0x83, 0x01, 0x8a, 0x00, 0x86, 0x01
+    db  0x04, 0x88, 0x01, 0x85, 0x00, 0x04, 0x89, 0x01
+    db  0x8d, 0x00, 0x84, 0x01, 0x03, 0x85, 0x01, 0x02
+    db  0x81, 0x01, 0x88, 0x00, 0x81, 0x01, 0x02, 0x01
+    db  0x03, 0x01, 0x90, 0x00, 0x04, 0x8c, 0x01, 0xa2
+    db  0x00, 0x89, 0x01, 0xa6, 0x00, 0x84, 0x01, 0xa2
+    db  0x00
Binary file src/Icons/warning.bmp has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Icons/warning.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,110 @@
+; \file C:/hw/ostc3/src/OSTC3/Icons/warning.inc
+; Generated 2012-08-25T08:45:08
+;
+warning_version  equ .112
+warning_width    equ .25
+warning_height   equ .22
+;
+warning_block:
+    db  .12, .22
+    db  .59, 0
+;
+    dw  0x0000 ; rgb=(0,0,0)
+    dw  0x2081 ; rgb=(33,16,8)
+    dw  0xf4a1 ; rgb=(247,148,8)
+    dw  0xd3c0 ; rgb=(214,123,4)
+    dw  0x59c1 ; rgb=(90,58,8)
+    dw  0xfda0 ; rgb=(255,181,0)
+    dw  0xfd20 ; rgb=(255,165,0)
+    dw  0xfce1 ; rgb=(255,156,8)
+    dw  0xfce0 ; rgb=(255,156,0)
+    dw  0x1880 ; rgb=(25,16,0)
+    dw  0xfd60 ; rgb=(255,173,0)
+    dw  0x1040 ; rgb=(16,8,0)
+    dw  0x51c1 ; rgb=(82,58,8)
+    dw  0xdce1 ; rgb=(222,156,8)
+    dw  0x3100 ; rgb=(49,33,0)
+    dw  0xfde0 ; rgb=(255,189,0)
+    dw  0xed21 ; rgb=(236,165,8)
+    dw  0xfde1 ; rgb=(255,189,8)
+    dw  0xfe20 ; rgb=(255,197,0)
+    dw  0xfd61 ; rgb=(255,173,8)
+    dw  0xfda1 ; rgb=(255,181,8)
+    dw  0xfd21 ; rgb=(255,165,8)
+    dw  0x28c0 ; rgb=(41,25,0)
+    dw  0xfca1 ; rgb=(255,148,8)
+    dw  0x0840 ; rgb=(8,8,0)
+    dw  0xfe21 ; rgb=(255,197,8)
+    dw  0xfca0 ; rgb=(255,148,0)
+    dw  0xfc60 ; rgb=(255,140,0)
+    dw  0xfc61 ; rgb=(255,140,8)
+    dw  0x1840 ; rgb=(25,8,0)
+    dw  0x8301 ; rgb=(132,99,8)
+    dw  0xfe60 ; rgb=(255,206,0)
+    dw  0xfce6 ; rgb=(251,156,49)
+    dw  0xfdae ; rgb=(255,181,115)
+    dw  0xfd27 ; rgb=(251,165,62)
+    dw  0xf673 ; rgb=(247,206,156)
+    dw  0xffbe ; rgb=(255,247,247)
+    dw  0xe4aa ; rgb=(230,148,82)
+    dw  0xfea0 ; rgb=(255,214,0)
+    dw  0xffff ; rgb=(255,255,255)
+    dw  0xfe72 ; rgb=(255,206,148)
+    dw  0xf4a0 ; rgb=(247,148,0)
+    dw  0x6301 ; rgb=(103,99,8)
+    dw  0xf672 ; rgb=(247,206,148)
+    dw  0xffbd ; rgb=(255,247,239)
+    dw  0xee41 ; rgb=(239,203,8)
+    dw  0x1900 ; rgb=(25,33,0)
+    dw  0x0040 ; rgb=(0,8,0)
+    dw  0xede0 ; rgb=(235,189,4)
+    dw  0x2941 ; rgb=(41,41,8)
+    dw  0xfe61 ; rgb=(255,206,8)
+    dw  0x3981 ; rgb=(58,49,8)
+    dw  0xcd41 ; rgb=(200,168,8)
+    dw  0x2100 ; rgb=(33,33,0)
+    dw  0xf621 ; rgb=(247,197,8)
+    dw  0x5241 ; rgb=(82,74,8)
+    dw  0x0800 ; rgb=(8,0,0)
+    dw  0xdd41 ; rgb=(218,169,8)
+    dw  0xcc21 ; rgb=(206,132,8)
+;
+    db  0xa7, 0x00, 0x01, 0x02, 0x03, 0x90, 0x00, 0x04
+    db  0x05, 0x06, 0x07, 0x08, 0x8e, 0x00, 0x09, 0x81
+    db  0x0a, 0x81, 0x06, 0x81, 0x08, 0x0b, 0x8b, 0x00
+    db  0x0c, 0x0d, 0x05, 0x0a, 0x82, 0x06, 0x81, 0x08
+    db  0x0b, 0x8a, 0x00, 0x0e, 0x81, 0x0f, 0x05, 0x0a
+    db  0x82, 0x06, 0x81, 0x08, 0x0b, 0x88, 0x00, 0x0b
+    db  0x10, 0x83, 0x05, 0x81, 0x0a, 0x81, 0x06, 0x81
+    db  0x08, 0x0b, 0x86, 0x00, 0x0e, 0x11, 0x12, 0x83
+    db  0x05, 0x0a, 0x13, 0x0a, 0x81, 0x06, 0x81, 0x08
+    db  0x0b, 0x84, 0x00, 0x0b, 0x0d, 0x11, 0x14, 0x82
+    db  0x05, 0x82, 0x0a, 0x81, 0x13, 0x81, 0x15, 0x07
+    db  0x08, 0x0b, 0x82, 0x00, 0x16, 0x81, 0x11, 0x10
+    db  0x83, 0x14, 0x82, 0x0a, 0x81, 0x06, 0x13, 0x07
+    db  0x81, 0x17, 0x08, 0x0b, 0x81, 0x00, 0x18, 0x19
+    db  0x14, 0x82, 0x06, 0x13, 0x06, 0x15, 0x84, 0x06
+    db  0x0a, 0x1a, 0x1b, 0x1c, 0x08, 0x1d, 0x00, 0x1e
+    db  0x1f, 0x0f, 0x1a, 0x20, 0x88, 0x21, 0x22, 0x06
+    db  0x23, 0x24, 0x25, 0x08, 0x09, 0x00, 0x26, 0x19
+    db  0x0f, 0x1a, 0x21, 0x88, 0x27, 0x28, 0x29, 0x82
+    db  0x27, 0x1a, 0x09, 0x00, 0x2a, 0x1f, 0x0f, 0x06
+    db  0x1a, 0x89, 0x1b, 0x06, 0x2b, 0x2c, 0x22, 0x07
+    db  0x09, 0x81, 0x00, 0x18, 0x2d, 0x14, 0x05, 0x0a
+    db  0x81, 0x13, 0x0a, 0x13, 0x05, 0x82, 0x0a, 0x13
+    db  0x0a, 0x15, 0x06, 0x81, 0x15, 0x0b, 0x82, 0x00
+    db  0x2e, 0x12, 0x05, 0x0a, 0x82, 0x13, 0x15, 0x14
+    db  0x81, 0x0a, 0x06, 0x81, 0x0a, 0x81, 0x13, 0x81
+    db  0x15, 0x0b, 0x84, 0x00, 0x2f, 0x30, 0x11, 0x81
+    db  0x13, 0x15, 0x0f, 0x81, 0x05, 0x82, 0x0a, 0x81
+    db  0x13, 0x81, 0x15, 0x0b, 0x86, 0x00, 0x31, 0x32
+    db  0x12, 0x81, 0x0f, 0x11, 0x81, 0x05, 0x83, 0x0a
+    db  0x06, 0x15, 0x0b, 0x89, 0x00, 0x30, 0x82, 0x11
+    db  0x81, 0x05, 0x81, 0x0a, 0x81, 0x06, 0x15, 0x0b
+    db  0x8a, 0x00, 0x31, 0x32, 0x19, 0x81, 0x14, 0x82
+    db  0x0a, 0x81, 0x15, 0x0b, 0x8b, 0x00, 0x33, 0x34
+    db  0x11, 0x14, 0x05, 0x0a, 0x13, 0x81, 0x15, 0x0b
+    db  0x8d, 0x00, 0x35, 0x36, 0x14, 0x13, 0x0a, 0x81
+    db  0x15, 0x0b, 0x8f, 0x00, 0x37, 0x19, 0x13, 0x81
+    db  0x06, 0x38, 0x91, 0x00, 0x35, 0x39, 0x3a, 0x96
+    db  0x00
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/aa_fonts.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,170 @@
+;=============================================================================
+;
+;   File aa_fonts.asm
+;
+;   Font-data for the anti-aliased word processor
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2010-11-23 : [jDG] Creation for OSTC 1.72, with the original fonts repacked.
+;  2010-12-01 : [jDG] Adding 3bits antialiased fonts.
+;=============================================================================
+
+;---- TINY font description and data ----------------------------------------
+fonts_data	CODE_PACK
+
+
+            global  aa_font16_block
+aa_font16_block:
+			DB	'°', 0x7F               ; Remap a few ASCII chars, to avoid
+			DB	'ö', 0x80               ; holes in the character table...
+			DB	'ä', 0x81
+			DB	'ü', 0x82
+			DB	'ß', 0x83
+			DB	'é', 0x84               ; French accents
+			DB	'è', 0x85
+			DB	'ê', 0x86
+			DB	'ç', 0x87
+			DB	'á', 0x88               ; Spanish accents
+			DB	'í', 0x89
+			DB	'ó', 0x8A
+			DB	'ú', 0x8B
+			DB	'ñ', 0x8C
+			DB	'Ħ', 0x8D
+			DB	'ż', 0x8E
+			DB	0				; End of translation table
+			DB	aa_font16_firstChar			; To be substracted
+			DB	aa_font16_chars				; Max value
+			DB	'ż'-aa_font16_firstChar     ; replace by ż when unknown.
+			DB	aa_font16_height + 0x80
+;
+#include	"../OSTC3/Fonts/aa_font16_idx.inc"				; SHOULD FOLLOW !
+#include	"../OSTC3/Fonts/aa_font16.inc"
+aa_font16_end:
+; Make sure this is coherent...
+	if aa_font16_nbbits != 3
+		error TINY fount should be encoded with anti-aliasing...
+	endif
+
+;---- SMALL font description and data ----------------------------------------
+            global  aa_font28_block
+aa_font28_block:
+			DB	'°', 0x7F               ; Remap a few ASCII chars, to avoid
+			DB	'ö', 0x80               ; holes in the character table...
+			DB	'ä', 0x81
+			DB	'ü', 0x82
+			DB	'ß', 0x83
+			DB	'é', 0x84               ; French accents
+			DB	'è', 0x85
+			DB	'ê', 0x86
+			DB	'ç', 0x87
+			DB	'á', 0x88               ; Spanish accents
+			DB	'í', 0x89
+			DB	'ó', 0x8A
+			DB	'ú', 0x8B
+			DB	'ñ', 0x8C
+			DB	'Ħ', 0x8D
+			DB	'ż', 0x8E
+			DB	'¤', 0x8F               ; Unused
+			; 90, 91 are the logo.
+			DB	0xB7,0x92		        ; Cursor
+			DB	0xB8,0x93		        ; Dimmed cursor.
+			DB	0				; End of translation table
+			DB	aa_font28_firstChar			; To be substracted
+			DB	aa_font28_chars				; Max value
+			DB	0x83-aa_font28_firstChar; replace by ¤ when unknown.
+			DB	aa_font28_height + 0x80
+;
+#include	"../OSTC3/Fonts/aa_font28_idx.inc"				; SHOULD FOLLOW !
+#include	"../OSTC3/Fonts/aa_font28.inc"
+aa_font28_end:
+; Make sure this is coherent...
+	if aa_font28_nbbits != 3
+		error SMALL fount should be encoded with anti-aliasing...
+	endif
+
+;---- STD font description and data ------------------------------------------
+            global  aa_font36_block
+aa_font36_block:
+			DB	'°', 0x7F               ; Remap a few ASCII chars, to avoid
+			DB	'ö', 0x80               ; holes in the character table...
+			DB	'ä', 0x81
+			DB	'ü', 0x82
+			DB	'ß', 0x83
+			DB	'é', 0x84               ; French accents
+			DB	'è', 0x85
+			DB	'ê', 0x86
+			DB	'ç', 0x87
+			DB	'à', 0x88               ; Spanish accents
+			DB	'á', 0x89               ; Spanish accents
+			DB	'í', 0x8A
+			DB	'ó', 0x8B
+			DB	'ú', 0x8C
+			DB	'ñ', 0x8D
+			DB	'Ħ', 0x8E
+			DB	'ż', 0x8F
+			; 90, 91 are the logo.
+			DB	0xB7,0x92		        ; Cursor
+            ; 93 is down arrow (dive start)
+            ; 94 is up arrow (dive end)
+            ; 95 is left-right arrow (dive duration)
+			DB	'¤', 0x96               ; Unused
+			DB	0				; End of translation table
+			DB	aa_font34_firstChar			; To be substracted
+			DB	aa_font34_chars				; Max value
+			DB	0x87-aa_font34_firstChar; replace by ¤ when unknown.
+			DB	aa_font34_height + 0x80
+;
+#include	"../OSTC3/Fonts/aa_font34_idx.inc"				; SHOULD FOLLOW !
+#include	"../OSTC3/Fonts/aa_font34.inc"
+aa_font36_end:
+; Make sure this is coherent...
+	if aa_font34_nbbits != 3
+		error STANDARD fount should be encoded with anti-aliasing...
+	endif
+
+;---- MEDIUM font description and data ---------------------------------------
+            global  aa_font48_block
+aa_font48_block:
+			DB	0x27, 0x3B					; ' char
+			DB	'"', 0x3C
+			DB	'm', 0x3D
+			DB	'f', 0x3E
+			DB	' ', 0x3F
+			DB	0
+			DB	aa_font48_firstChar
+			DB	aa_font48_chars
+			DB	0x3E-aa_font48_firstChar
+			DB	aa_font48_height + 0x80		; AA flag.
+;
+#include	"../OSTC3/Fonts/aa_font48_idx.inc"
+#include	"../OSTC3/Fonts/aa_font48.inc"
+aa_font48_end:
+; Make sure this is coherent...
+	if aa_font48_nbbits != 3
+		error MEDIUM fount should be encoded with 3bits anti-aliasing...
+	endif
+
+;---- LARGE font description and data ----------------------------------------
+            global aa_font90_block
+aa_font90_block:
+			DB	' ', 0x2F
+			DB	'm', 0x3A
+			DB	'f', 0x3B
+			DB	0
+			DB	aa_font90_firstChar
+			DB	aa_font90_chars
+			DB	0x2F-aa_font90_firstChar
+			DB	aa_font90_height + 0x80		; AA flag.
+;
+#include	"../OSTC3/Fonts/aa_font90_idx.inc"
+#include	"../OSTC3/Fonts/aa_font90.inc"
+aa_font90_end:
+; Make sure this is coherent...
+	if aa_font90_nbbits != 3
+		error SMALL fount should be encoded with 3bits anti-aliasing...
+	endif
+
+;=============================================================================
+            END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/aa_wordprocessor.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,459 @@
+;=============================================================================
+;
+;   File aa_wordprocessor.asm
+;
+;   Anti-aliased word processor
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2010-11-22 : [jDG] Creation.
+;  2010-12-01 : [jDG] Adding 3bits antialiased fonts.
+;  2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0
+;  2012-08-12 : [mH]  Moved font28 into bootloader section 0x1C000
+;
+; BUGS :
+;  * If the three fonts are not in the same half of the PROM memory, TBLPTRU
+;    will be badly set, and font48 or font90 will display giberish...
+;=============================================================================
+;
+; MEMORY FOOTPRINT:
+;------------------
+;
+; wp_wordprocessor : 8KB, including fonts.
+; aa_wordprocessor : 0.5KB code
+;                  + 3.5KB aa_font28 (reduced to 99 chars)
+;                  + 1.6KB aa_font48
+;                  + 2.2KB aa_font90
+;                  = 7.9 KB including fonts...
+;
+; Input registers:
+;	buffer:26				String to print.
+;	win_font				Font size (0=tiny, 1=small, 2=medium, 3=large)
+;	win_color1:2			16bits unpacked color
+;	win_top, win_leftx2		Position on screen
+;	win_inverse				Inverse video mode.
+;
+; Available general purpose registers:
+;   PRODH, PRODL	(needed for array indexing)
+;   FSRx            12bits. Usefull as RAM pointers.
+;=============================================================================
+
+#include "ostc3.inc"
+#include "tft.inc"
+
+        extern  aa_font16_block
+        extern  aa_font28_block
+        extern  aa_font36_block
+        extern  aa_font48_block
+        extern  aa_font90_block
+
+;=============================================================================
+; Temporary variables are overlayed in Bank 1, used also by C-code
+; (p2_deco), MPLAB math and stdlib libraries.
+
+        CBLOCK  tmp                     ; Data overlay in reserved tmp area.
+            aa_flags:1                  ; Various flags for aa_wordprocessor
+            aa_bitlen:1                 ; Count of pixels when decoding bitmaps.
+            aa_start:2                  ; PROM ptr to start of encoded bitmap
+            aa_end:2                    ; and end of it.
+            aa_temp:2                   ; Current color, divided by 2 or 4
+            ; Reserved to tmp+0x07...
+        ENDC
+; Flags allocation:
+#define		aa_antialias	aa_flags,0
+#define		aa_color_quart	aa_flags,1
+#define		aa_color_half	aa_flags,2
+
+;------------------------------------------------------------------------------
+; Setup pointers for a char:
+; Inputs	WREG = char to draw, win_font
+; Output	aa_start, aa_end, win_height, aa_flags
+; Trashed	PRODH, PRODL, TBLPTR, TABLAT
+;
+basic   CODE
+aa_char_setup:
+		movwf	PRODL				    ; save char into PROD for now.
+
+		movf	win_font,W,BANKED	    ; Get font number (updates Z flag)
+		bnz		aa_char_1
+
+		; TINY font ---------------------------------------------------------
+		; Font TINY character folding...
+aa_char_0:
+		movlw	LOW aa_font16_block
+		movwf	TBLPTRL
+		movlw	HIGH aa_font16_block
+		movwf	TBLPTRH
+		movlw	UPPER aa_font16_block
+		movwf	TBLPTRU
+		bra		aa_char_99
+
+		; SMALL font ---------------------------------------------------------
+		; Font SMALL character folding...
+aa_char_1:
+		decfsz	WREG				    ; This is small font ???
+		bra		aa_char_2
+
+		movlw	LOW aa_font28_block
+		movwf	TBLPTRL
+		movlw	HIGH aa_font28_block
+		movwf	TBLPTRH
+		movlw	UPPER aa_font28_block
+		movwf	TBLPTRU
+		bra		aa_char_99
+
+		; STD font -----------------------------------------------------------
+		; Font SMALL character folding...
+aa_char_2:
+		decfsz	WREG				    ; This is small font ???
+		bra		aa_char_3
+
+		movlw	LOW aa_font36_block
+		movwf	TBLPTRL
+		movlw	HIGH aa_font36_block
+		movwf	TBLPTRH
+		movlw	UPPER aa_font36_block
+		movwf	TBLPTRU
+		bra		aa_char_99
+
+		; MEDIUM font --------------------------------------------------------
+aa_char_3:
+		decfsz	WREG				    ; This is medium font ???
+		bra		aa_char_4
+
+		; Font MEDIUM block:
+		movlw	LOW aa_font48_block
+		movwf	TBLPTRL
+		movlw	HIGH aa_font48_block
+		movwf	TBLPTRH
+		movlw	UPPER aa_font48_block
+		movwf	TBLPTRU
+		bra		aa_char_99
+
+		; LARGE font ---------------------------------------------------------
+aa_char_4:
+		; Font LARGE block:
+		movlw	LOW aa_font90_block
+		movwf	TBLPTRL
+		movlw	HIGH aa_font90_block
+		movwf	TBLPTRH
+		movlw	UPPER aa_font90_block
+		movwf	TBLPTRU
+
+		; Execute font block -------------------------------------------------
+aa_char_99:
+        ; This is safe if the three fonts are in the same code segment
+        ; (and that segment do not span the 64K edge...)
+		movlw	UPPER aa_font16_block
+		movwf	TBLPTRU
+
+        ; Proceed to character substitutions
+aa_char_30:
+		tblrd*+						    ; Read FROM char
+		movf	TABLAT,W			    ; Get it, and set Z,N
+		bz		aa_char_32			    ; Break at end of translations
+		
+		tblrd*+						    ; Read TO char
+		cpfseq	PRODL				    ; FROM == current char ? 
+		bra		aa_char_30		    	; Different: loop
+		movff	TABLAT, PRODL		    ; make substitution
+		bra		aa_char_30			    ; Loop.
+
+        ; Make sure char is in the available range
+aa_char_32:
+		tblrd*+						    ; Read first char
+		movf	TABLAT,W			    ; get it.
+		subwf	PRODL,F				    ; (char - first) --> PRODL
+
+		tblrd*+						    ; Read nb chars
+		movf	TABLAT,W			    ; nbchars --> WREG
+		tblrd*+						    ; Read default char
+		cpfslt	PRODL				    ; if char > WREG ?
+		movff	TABLAT,PRODL		    ; replace PRODL
+
+        ; Decode font height and anti-aliasing mode
+		clrf	aa_flags                ; Default to no AA
+		tblrd*+						    ; Read font height + AA flag
+		movf	TABLAT,W			    ; into WREG
+		bnn		aa_char_34			    ; High bit set ?
+		bsf		aa_antialias            ; YES : then the font is AA.
+aa_char_34:
+		andlw	0x7F				    ; Keep just font height,
+		movwf	win_height,BANKED	    ; then save it (its a register)
+
+        ; Set PROM pointer to the char index
+		movf	PRODL,W				    ; Read back char
+		mullw	2					    ; PROD = 2*(char - base), TBLPTR=idx
+		movf	PRODL,W
+		addwf	TBLPTRL,F			    ; Add into TBLPTR (low byte)
+		movf	PRODH,W
+		addwfc	TBLPTRH,F			    ; and high byte.
+
+        ; Read start and stop pointers
+		tblrd*+						    ; aa_start = PROM16(*tblptr++)
+		movff	TABLAT,aa_start+0       ; Read low byte
+		tblrd*+
+		movff	TABLAT,aa_start+1       ; and high byte
+
+		tblrd*+						    ; aa_end = PROM16(*tblptr++)
+		movff	TABLAT,aa_end+0         ; Read low byte
+		tblrd*+
+		movff	TABLAT,aa_end+1         ; and high byte
+
+		return
+
+;------------------------------------------------------------------------------
+; Character width
+; Inputs	aa_start, aa_end, win_width, win_height, aa_flags
+; Output	width added to win_width
+; Trashed	aa_bitlen, TBLPTR, TABLAT
+;
+aa_char_width:
+		movff	aa_start+0, TBLPTRL     ;	TBLPTR = aa_start
+		movff	aa_start+1, TBLPTRH
+		clrf	aa_bitlen               ; clear reminders...
+
+		; Read bitmap byte, and decode length:
+aa_char_width_1:
+    ifdef AA_BYTE_SWAP
+		btg		TBLPTRL,0  			    ; Toggle low ptr bit.
+		tblrd*
+		movf	TABLAT,W  			    ; Store to WREG
+		btg		TBLPTRL,0  			    ; Get is back
+		tblrd*+						    ; then increment (but trash TABLAT)
+		movwf	TABLAT  			    ; Then restore copy to TABLAT.
+    else
+		tblrd*+						    ; Normal read...
+		movf	TABLAT,W 			    ; Store copy to WREG
+    endif
+		btfss	aa_antialias            ; Antialiased font ?
+		bra		aa_char_width_10	    ; No: always 7 bits count
+
+		bn		aa_char_width_10	    ; Non-white pixels ?
+		andlw	0x1F				    ; Yes : 5 bits count.
+aa_char_width_10:
+		andlw	0x7F				    ; No: 7 bit count.
+		incf	WREG 				    ; WREG = repetition count
+		addwf	aa_bitlen,F             ; Add remaining pixels from last code.
+		
+		movf	win_height,W,BANKED	    ; WREG = - height
+		negf	WREG
+
+		; This is a hand-made division by successive substraction of height
+aa_char_width_2:
+		addwf	aa_bitlen,F             ; Try to substract win_height
+		bn		aa_char_width_3		    ; If neg it was a bad idea...
+
+		infsnz	win_width+0,F           ; Succeded: do a 16bit increment
+		incf	win_width+1,F           ; on the win_width counter.
+		bra		aa_char_width_2		    ; and loop.
+
+aa_char_width_3:
+		negf	WREG 				    ; WREG = +height
+		addwf	aa_bitlen,F             ; Restore true reminder.
+
+		; Are we done ?
+		movf	TBLPTRL,W 			    ; Compare TBLPTR to aa_end
+		cpfseq	aa_end+0  
+		bra		aa_char_width_1		    ; Loop if LOW is different
+		movf	TBLPTRH,W
+		cpfseq	aa_end+1                ; Loop to if HIGH is different
+		bra		aa_char_width_1
+
+		return
+
+;------------------------------------------------------------------------------
+; String width
+; Inputs	buffer (SHOULD BE NULL TERMINATED)
+; Output	win_width, win_height
+; Trashed	PROD, TBLPTR, FSR2, aa_bitlen, aa_start, aa_end, aa_flags
+;
+aa_string_width:
+		lfsr	FSR2, buffer		    ; FSR2 pointer to start of string.
+
+		clrf	win_width+0             ; Clear width sum.
+		clrf	win_width+1             ; (16 bit counter)
+
+aa_string_width_1:
+		movf	POSTINC2,W  		    ; WREG = *FSR2++
+		bz		aa_string_width99	    ; Exit if null byte encountered.
+
+		rcall	aa_char_setup		    ; setup aa_start / aa_end
+		rcall	aa_char_width		    ; sum-up width into win_width
+		bra		aa_string_width_1	    ; and loop.
+
+aa_string_width99:
+		return
+
+;------------------------------------------------------------------------------
+; Decode a compressed char.
+; Inputs	aa_start, aa_end, win_height, win_invert, win_color1, win_color2
+; Output	none
+; Trashed	TBLPTR, TABLAT, PROD, aa_bitlen, aa_flags, aa_colorDir:2
+;
+aa_decode_char:
+		movff	aa_start+0, TBLPTRL     ; TBLPTR = aa_start
+		movff	aa_start+1, TBLPTRH
+
+		; Read bitmap byte, and decode color & length
+aa_decode_1:
+    ifdef AA_BYTE_SWAP
+		btg		TBLPTRL,0 			    ; Toggle low ptr bit.
+		tblrd*
+		movf	TABLAT,W 			    ; Store to WREG
+		btg		TBLPTRL,0 			    ; Get is back
+		tblrd*+						    ; then increment (but trash TABLAT)
+		movwf	TABLAT  			    ; Then restore copy to TABLAT.
+    else
+		tblrd*+						    ; Normal read...
+		movf	TABLAT,W			    ; Store copy to WREG
+    endif
+		btfss	aa_antialias            ; Antialiased font ?
+		bra		aa_decode_10		    ; No: always 7 bits count
+		bn		aa_decode_10		    ; Non-white pixels ?
+		andlw	0x1F				    ; Yes : 5 bits count.
+aa_decode_10:
+		andlw	0x7F				    ; No: 7 bit count.
+		incf	WREG				
+		movwf	aa_bitlen               ; repetition count --> aa_bitlen
+
+		;---- COLOR DECODING -------------------------------------------------
+		;
+		;   Code    Normal    Inverse
+		;   1xx        0%      100%	: Managed by aa_decode_13
+		;   011       25%       75%
+		;   010       50%       50%
+		;   001       75%       25%
+		;   000      100%        0% : Managed by aa_decode_13 too.
+		;
+		movf	TABLAT,W  			    ; Get back code
+		btfss	aa_antialias            ; Antialiased font ?
+		bra		aa_decode_13		    ; NO: 1bit case
+
+		; Asymetry test: 1xx code is another case for 1bit color.
+		; This have to be done before inverse video, because
+		; of the asymetric processing !
+		bn		aa_decode_13		    ; decode as not-aa
+
+		; Manage 000 special case too:
+		andlw	0xE0				    ; Select color bits
+		bz		aa_decode_13		    ; That's a 000 !
+
+		; Apply reverse video, in a reversed way
+		btfss	win_invert,0		    ; Inverse video mode ?
+		sublw	0x80
+
+		; Move the two bits to aa_color_half and aa_color_quarter:
+		swapf	WREG				    ; --> 0000.0LL0 byte
+		iorlw	b'001'				    ; We are in AA mode, don't forget it !
+		movwf	aa_flags                ; save that to aa_color_(half/quad)/AA flags.
+
+		;---- 2 bit x RGB(16bits) computation --------------------------------
+		clrf	PRODL				    ; We will accumulate result here...
+		clrf	PRODH
+
+		; Take color div 2 into aa_temp. Max red = 15/31
+		rrcf	win_color1,W,BANKED	    ; xRRRRxGG
+		andlw	b'01111011'			    ; 0RRRR0GG (don't change C)
+		movwf	aa_temp+0
+		rrcf	win_color2,W,BANKED	    ; GGGxBBBB
+		andlw	b'11101111'			    ; GGG0BBBB
+		movwf	aa_temp+1
+
+		btfss	aa_color_half
+		bra		aa_decode_12
+
+		movff	aa_temp+0,PRODH         ; Add color/2 if bit set.
+		movff	aa_temp+1,PRODL         ; TFT is big endian, so swap here.
+aa_decode_12:
+		btfss	aa_color_quart
+		bra		aa_decode_3
+
+		; Divide it once again by 2. Max red = 7/31.
+		rrcf	aa_temp+0,W             ; xxRRRxxG
+		andlw	b'00111001'             ; 00RRR00G (don't change C)
+		movwf	aa_temp+0
+		rrcf	aa_temp+1,W             ; GGGxxBBB
+		andlw	b'11100111'             ; GGG00BBB
+		movwf	aa_temp+1
+
+		movf	aa_temp+1,W             ; Add color/4
+		addwf	PRODL,F				    ; NOTE: 7/31+15/31=22/31,
+		movf	aa_temp+0,W             ; hence composants won't overlap.
+		addwfc	PRODH,F				    ; In right order, to propagate carry.
+
+		bra		aa_decode_3			    ; Done.
+
+		; ---- Simple BLACK and WHITE cases ------------------------------
+aa_decode_13:							; Got a 1xx or a 000 code...
+		btfsc	win_invert,0		    ; Inverse video mode ?
+		xorlw	0x80				    ; YES: invert levels.
+		bn		aa_decode_2			    ; Then test high bit.
+
+		; WHITE pixel (ie. full color)
+        bsf     tft_rs,0    ; RS_H				; Data
+		movff	win_color1,PORTA	    ; current draw color
+		movff	win_color2,PORTH	    ; (rem: TFT is big endian)
+		bra		aa_decode_4
+
+aa_decode_2:
+        bsf     tft_rs,0    ; RS_H				; Data
+		clrf	PORTA 				    ; BLACK pixel
+		clrf	PORTH
+        bra		aa_decode_4
+
+aa_decode_3:
+        bsf     tft_rs,0    ; RS_H				; Data
+    	movff	PRODH,PORTA	; Move high byte to PORTA
+        movff	PRODL,PORTH	; Move low byte to PORTH
+aa_decode_4:
+		;---- PIXEL WRITE LOOP -----------------------------------------------
+    	bcf     tft_nwr,0       ; WR_L
+        bsf     tft_nwr,0       ; WR_H                ; Tick
+
+		decf	aa_bitlen,F
+		bnz		aa_decode_4
+
+		;---- BYTE-CODE LOOP -------------------------------------------------
+		; Are we done ?
+		movf	TBLPTRL,W 			    ; Compare TBLPTR to aa_end
+		cpfseq	aa_end+0
+		bra		aa_decode_1             ; Loop if LOW is different
+		movf	TBLPTRH,W
+		cpfseq	aa_end+1                ; Loop to if HIGH is different
+		bra		aa_decode_1
+		
+		return
+
+;------------------------------------------------------------------------------
+; Setup pointers for a char:
+; Inputs : buffer : string to print (SHOULD BE NULL TERMINATED)
+; Output : TFT commands on port D + clocks.
+; 
+        global  aa_wordprocessor        ; Callable from C-code.
+aa_wordprocessor:
+        banksel win_font                ; Bank1, just to be sure.
+		rcall	aa_string_width		    ; Set win_height, compute win_width
+		call	TFT_box_write		    ; Use that for the box.
+
+		; Restart the loop for each char to print
+		lfsr	FSR2, buffer		    ; FSR2 pointer to start of string.
+
+		; DATA bloc commande:
+		Index_out	0x22
+
+aa_wordprocessor_1:
+		movf	POSTINC2,W  		    ; WREG = *FSR2++
+		bz		aa_wordprocessor_99	    ; Exit if null byte encountered.
+
+		rcall	aa_char_setup		    ; setup aa_start / aa_end
+		rcall	aa_decode_char		    ; write pixels to screen
+		bra		aa_wordprocessor_1	    ; and loop.
+
+aa_wordprocessor_99:
+		; END of bloc commande
+		Index_out	0x00
+
+        return
+        END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/adc_lightsensor.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,253 @@
+;=============================================================================
+;
+;   File adc.asm
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-08 : [mH] moving from OSTC code
+
+#include "ostc3.inc"
+#include "math.inc"
+#include "wait.inc"
+#include "eeprom_rs232.inc"
+
+sensors CODE
+
+wait_adc:
+	movwf	ADCON0
+    nop
+	bsf		ADCON0,1			; start ADC
+wait_adc2:
+	btfsc	ADCON0,1            ; Wait...
+	bra		wait_adc2
+    return
+
+	global	get_battery_voltage
+get_battery_voltage:			; starts ADC and waits until fnished
+    bsf     adc_running         ; =1: The ADC is in use
+	movlw	b'00100000'			; 2.048V Vref+ -> 1LSB = 500µV
+	movwf	ADCON1
+	movlw	b'00011001'			; power on ADC, select AN6
+	rcall   wait_adc
+
+	movff	ADRESH,batt_voltage+1	; store value
+	movff	ADRESL,batt_voltage+0	; store value
+	bcf		ADCON0,0			; power off ADC
+
+; Multiply with 2,006 to be excact here...
+;	bcf		STATUS,C
+;	rlcf	xA+0,F
+;
+;	rlcf	xA+1,F              ; x2
+
+;	movff	xA+0,batt_voltage+0	; store value
+;	movff	xA+1,batt_voltage+1
+
+	movlw	LOW		lithium_36v_low
+	movwf	sub_a+0
+	movlw	HIGH	lithium_36v_low
+	movwf	sub_a+1
+	movff	batt_voltage+0,sub_b+0
+	movff	batt_voltage+1,sub_b+1
+	call	subU16				; sub_c = sub_a - sub_b
+; Battery is 3,6V (>lithium_36v_low?)
+	btfss	neg_flag
+    bra     get_battery_voltage4    ; No, use 1,5V
+
+	bsf		battery_is_36v	; Yes, set flag (Cleared in power-on reset only!)
+
+; Check if the battery is near-dead already
+	movlw	LOW		lithium_36v_empty
+	movwf	sub_a+0
+	movlw	HIGH	lithium_36v_empty
+	movwf	sub_a+1
+	call	subU16				; sub_c = sub_a - sub_b
+; Battery is not dead yet (>lithium_36v_empty?)
+	btfsc	neg_flag
+    bra     get_battery_voltage2    ; Yes, battery is still ok
+
+    ; Battery is probably dead very soon
+    ; Set ">=24Ah used" into battery gauge registers
+    movlw   .128
+    movff   WREG,battery_gauge+5
+
+get_battery_voltage2:
+    ; Use 3,6V battery gauging mode
+	movff	battery_gauge+5,xC+3
+	movff	battery_gauge+4,xC+2
+	movff	battery_gauge+3,xC+1
+	movff	battery_gauge+2,xC+0
+	; battery_gauge:6 is nAs
+	; devide through 65536
+	; devide through 364
+	; Result is in percent of a 2,4Ah Battery
+	movlw	LOW		.364
+	movwf	xB+0
+	movlw	HIGH	.364
+	movwf	xB+1
+	call	div32x16	  ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+    ; Limit to 100
+    movlw   .100
+    cpfslt  lo
+    movwf   lo
+	; lo will be between 0 (Full) and 100 (empty)
+	movf	lo,W
+	sublw	.100
+	movwf	lo
+get_battery_voltage3:
+	movlw	.100
+	cpfslt	lo
+	movwf	lo
+	; lo will be between 100 (Full) and 0 (empty)
+    movf    batt_percent,W
+    cpfsgt  lo                      ; keep batt_percent on the lowest value found
+    movff   lo,batt_percent         ; store value
+    btfsc   battery_is_36v          ; but always use computed value for 3,6V battery
+    movff   lo,batt_percent         ; store value
+    bcf     adc_running              ; =1: The ADC is in use
+	return
+
+get_battery_voltage4:
+    ; Use 1,5V battery voltage mode
+    ; Use approximation (batt_voltage:2-aa_15v_low)/4 = lo
+	movff	batt_voltage+0,sub_a+0
+	movff	batt_voltage+1,sub_a+1
+   	movlw	LOW		aa_15v_low
+    movwf	sub_b+0
+	movlw	HIGH	aa_15v_low
+	movwf	sub_b+1
+	call	subU16				; sub_c = sub_a - sub_b
+    bcf     STATUS,C
+    rrcf    sub_c+1
+    rrcf    sub_c+0             ; /2
+    bcf     STATUS,C
+    rrcf    sub_c+1
+    rrcf    sub_c+0             ; /4
+    movff   sub_c+0,lo
+    bra     get_battery_voltage3    ; Check limits and return
+
+	global	get_ambient_level
+get_ambient_level:              ; starts ADC and waits until finished
+    btfsc   adc_running         ; ADC in use?
+    return                      ; Yes, return
+
+	movlw	b'00000000'         ; Vref+ = Vdd
+	movwf	ADCON1
+	movlw	b'00011101'			; power on ADC, select AN7
+	rcall   wait_adc
+
+	movff	ADRESH,ambient_light+1
+	movff	ADRESL,ambient_light+0
+	bcf		ADCON0,0			; power off ADC
+
+	; ambient_light:2 is between 4096 (direct sunlight) and about 200 (darkness)
+	; First: Devide through 16
+	bcf		STATUS,C
+	rrcf	ambient_light+1
+	rrcf	ambient_light+0
+	bcf		STATUS,C
+	rrcf	ambient_light+1
+	rrcf	ambient_light+0
+	bcf		STATUS,C
+	rrcf	ambient_light+1
+	rrcf	ambient_light+0
+	bcf		STATUS,C
+	rrcf	ambient_light+1
+	rrcf	ambient_light+0
+	; Result: ambient_light:2/16
+	; Now, make sure to have value between ambient_light_low and ambient_light_max
+
+    movlw   .254
+    tstfsz  ambient_light+1         ; >255?
+    movwf   ambient_light+0         ; avoid ADC clipping
+
+    incfsz  ambient_light+0,W       ; =255?
+    bra     get_ambient_level2      ; No, continue
+
+    movlw   .254
+    movwf   ambient_light+0         ; avoid ADC clipping
+
+get_ambient_level2:
+  	banksel isr_backup              ; Back to Bank0 ISR data
+	movff	opt_brightness,isr1_temp
+
+	btfsc	RCSTA1,7				; UART module on?
+	clrf	isr1_temp				; Yes, set temporally to eco mode
+
+	incf	isr1_temp,F				; adjust 0-2 to 1-3
+
+    banksel common                  ; flag is in bank1
+	movlw	ambient_light_max_high	; brightest setting
+	btfsc	battery_is_36v          ; 3,6V battery in use?
+	movlw	ambient_light_max_high_36V	; Yes...
+	banksel isr_backup              ; Back to Bank0 ISR data
+
+	dcfsnz	isr1_temp,F
+	movlw	ambient_light_max_eco	; brightest setting	
+	dcfsnz	isr1_temp,F
+	movlw	ambient_light_max_medium; brightest setting		
+
+	banksel common                  ; ambient_light is in Bank1
+    incf    ambient_light+0,F       ; +1
+	cpfslt	ambient_light+0			; smaller then WREG?
+	movwf	ambient_light+0			; No, set to max.
+
+	banksel isr_backup              ; Back to Bank0 ISR data
+	movff	opt_brightness,isr1_temp
+	incf	isr1_temp,F				; adjust 0-2 to 1-3
+	movlw	ambient_light_min_high	; darkest setting
+
+	dcfsnz	isr1_temp,F
+	movlw	ambient_light_min_eco	; darkest setting
+	dcfsnz	isr1_temp,F
+	movlw	ambient_light_min_medium; darkest setting
+	dcfsnz	isr1_temp,F
+	movlw	ambient_light_min_high	; darkest setting
+	
+	banksel common                  ; ambient_light is in Bank1
+	cpfsgt	ambient_light+0			; bigger then WREG?
+	movwf	ambient_light+0			; No, set to min
+	
+	movff	ambient_light+0,max_CCPR1L	; Store value for dimming in TMR7 interrupt
+	return
+
+	global	get_rssi_level
+get_rssi_level:			; starts ADC and waits until fnished
+    bsf     adc_running         ; =1: The ADC is in use
+	movlw	b'00100000'			; 2.048V Vref+
+	movwf	ADCON1
+	movlw	b'01000101'			; power on ADC, select AN17
+	rcall   wait_adc
+
+	movff	ADRESL,rssi_value
+	bcf		ADCON0,0			; power off ADC
+    bcf     adc_running         ; =1: The ADC is in use
+    return
+
+    global  reset_battery_pointer
+reset_battery_pointer:       ; Resets battery pointer 0x07-0x0C and battery_gauge:5
+	clrf	EEADRH
+	clrf	EEDATA					; Delete to zero
+	write_int_eeprom 0x07
+	write_int_eeprom 0x08
+	write_int_eeprom 0x09
+	write_int_eeprom 0x0A
+	write_int_eeprom 0x0B
+	write_int_eeprom 0x0C
+    banksel battery_gauge+0
+    clrf    battery_gauge+0
+    clrf    battery_gauge+1
+    clrf    battery_gauge+2
+    clrf    battery_gauge+3
+    clrf    battery_gauge+4
+    clrf    battery_gauge+5
+    banksel common
+    movlw   .100
+    movwf   batt_percent
+    return
+
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/adc_lightsensor.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,15 @@
+;=============================================================================
+;
+;   File adc.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-08 : [mH] moving from OSTC code
+
+	extern	get_battery_voltage     ; And percent...
+    extern	get_ambient_level
+    extern  get_rssi_level
+    extern  reset_battery_pointer   ; Resets battery pointer 0x07-0x0C and battery_gauge:5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/color_processor.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,175 @@
+;=============================================================================
+;
+;   File File color_processor.asm
+;
+;   Decompress and draw an image.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2010-12-13 : [jDG] Creation.
+;  2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0
+;
+; RATIONALS: The OSTC have a nice color screen, and a std geek attitude impose
+;            to show off ... ;-)
+;
+; Inputs: TBLPTR points to the image description block.
+;         win_top, win_leftx2 the Top/Leftx2 corner here to put the image.
+; Ouputs: None.
+; Trashed: TBLPTR, TABLAT, FSR2, PROD, win_width, win_height
+;
+; ImageBloc:
+;       db  widthx2, height
+;       db  nbColors, 0     ; Unused yet... Should be 0 to keep packing happy.
+;       dw  color0, color1, color2, color3, ...
+;       db  ...packed pixels...
+;
+; Limitations:
+; * nbColors should be <= 15.
+; * image width should be even.
+; * image left border should be on even position too.
+; Compressed format:
+; - Upper nibble = color, lower nibble = count-1.
+; - All bytes F* accumulates to make count larger than 16.
+; Eg. 00          is 1 pixel  color 0
+;     07          is 8 pixels color 0
+;     70          is 1 pixel  color 7
+;     bf          is 16 pixels of color .11
+;     F1 F2 F3 04 is 0x1235 pixels of color 0.
+;
+;-----------------------------------------------------------------------------
+
+#include "ostc3.inc"
+#include "tft.inc"
+
+;-----------------------------------------------------------------------------
+; Temporary overlay (in bank 1).
+
+        CBLOCK  tmp                     ; Data overlay in reserved tmp area.
+            img_colors:1
+            img_pixels:3
+            img_count:2
+            ; Reserved to tmp+0x07...
+        ENDC
+
+;-----------------------------------------------------------------------------
+;
+; Note: Some variables (win_width, win_height) are in BANK0 !
+basic   CODE
+        global  color_image
+color_image:
+        banksel win_width               ; Bank1, just to be sure...
+
+        ;---- Get image parameters -------------------------------------------
+        tblrd*+                     
+        movff   TABLAT,win_width
+        tblrd*+
+        movff   TABLAT,win_height
+        tblrd*+
+        movff   TABLAT,img_colors
+        tblrd*+                         ; Skip one byte (future flags ?)
+        ;---- Copy color table -----------------------------------------------
+        movf    img_colors,W
+        lfsr    FSR2,buffer
+get_colors_loop:                    
+        tblrd*+
+        movff   TABLAT,POSTINC2
+        tblrd*+
+        movff   TABLAT,POSTINC2
+        decfsz  WREG
+        bra     get_colors_loop
+
+        ; Compute width * height * 2 : the number of pixels to write.
+        clrf    img_pixels+2
+        movf    win_width,W             ; Compute number of pixels to draw
+        mulwf   win_height              ; 0 .. 160x240
+        bcf     STATUS,C                ; BEWARE: mulwf does not reset carry flag !
+        rlcf    PRODL                   ; x2 --> 0 .. 320x240, might be > 0xFFFF
+        rlcf    PRODH
+        movff   PRODL, img_pixels+0
+        movff   PRODH, img_pixels+1
+        rlcf    img_pixels+2            ; Get the upper bit in place.
+        
+        clrf    WREG                    ; Decrement count to ease end detection.
+        decf    img_pixels+0,F
+        subwfb  img_pixels+1,F
+        subwfb  img_pixels+2,F
+
+        ;---- Send window command --------------------------------------------
+        clrf    win_width+1             ; x2 on width, for the true box size.
+        rlcf    win_width+0
+        rlcf    win_width+1
+        call    TFT_box_write
+        Index_out 0x22
+
+        ;---- Decode pixels --------------------------------------------------
+color_image_loop_xy:
+        ; Get pixel count
+        clrf    img_count+0
+        clrf    img_count+1
+
+        ;---- Decode repetition count
+color_image_decode_1:
+        tblrd*+                         ; Get one byte
+
+        btfss   TABLAT,7                ; High bit cleared ?
+        bra     color_image_decode_2    ; YES: this is a color byte.
+        
+        rlcf    TABLAT,F                ; Drop high bit.
+        movlw   .7                      ; Move 7 bits
+color_image_decode_3:
+        rlcf    TABLAT,F                ; Get bit into carry
+        rlcf    img_count+0,F           ; Push into pixel count
+        rlcf    img_count+1,F
+        decfsz  WREG
+        bra     color_image_decode_3    ; and loop foreach 7 bits.
+        
+        bra     color_image_decode_1    ; Decode next byte.
+
+color_image_decode_2:
+        ;---- Get pixel color into PROD
+        movf    TABLAT,W                ; Get color index.
+        addwf   WREG                    ; *2
+        lfsr    FSR2,buffer             ; Reinitialize color table.
+        movff   WREG,FSR2L              ; LOW(buffer) == 0
+        movff   POSTINC2,PRODL
+        movff   POSTINC2,PRODH
+        
+        ; Substract count-1 from the number of pixel we should do.
+        movf    img_count+0,W           ; Make a 24bit substraction.
+        subwf   img_pixels+0,F
+        movf    img_count+1,W
+        subwfb  img_pixels+1,F
+        movlw   0
+        subwfb  img_pixels+2,F
+
+color_image_not_over:
+        infsnz  img_count+0             ; Increment count.
+        incf    img_count+1
+
+        ; Loop sending pixel color
+        incf    img_count+1             ; Because we decrement first, should add one here !
+        bsf     tft_rs,0    ; RS_H				; Data
+    	movff	PRODH,PORTA	; Move high byte to PORTA
+        movff	PRODL,PORTH	; Move low byte to PORTH
+color_image_loop_pixel:
+    	bcf     tft_nwr,0       ; WR_L
+        bsf     tft_nwr,0       ; WR_H                ; Tick
+        decfsz  img_count+0
+        bra     color_image_loop_pixel
+        decfsz  img_count+1
+        bra     color_image_loop_pixel
+        
+        ; And count (on a 24bit counter)
+        clrf    WREG                    ; Make a 24bit decrement.
+        decf    img_pixels+0
+        subwfb  img_pixels+1,F
+        subwfb  img_pixels+2,F
+
+        bnn     color_image_loop_xy     ; Not finished ? loop...
+
+        ;---- Closeup --------------------------------------------------------        
+        Index_out 0x00
+        return
+
+        end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/comm.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,836 @@
+;=============================================================================
+;
+;   File comm.asm
+;
+;   RS232 via USB
+;
+;   Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-22 : [mH] Creation
+;  2012-02-11 : [jDG] Added "c" set custom text, and "i" identify.
+
+#include "ostc3.inc"
+#include "eeprom_rs232.inc"
+#include "tft.inc"
+#include "wait.inc"
+#include "strings.inc"
+#include "convert.inc"
+#include "external_flash.inc"
+#include "tft_outputs.inc"
+#include "surfmode.inc"
+#include "rtc.inc"
+#include "adc_lightsensor.inc"
+
+	extern  testloop,do_main_menu,new_battery_menu,restart,option_reset_all
+
+#DEFINE timeout_comm_pre_mode   .120        ; Pre-loop
+#DEFINE timeout_comm_mode       .120        ; Download mode
+#DEFINE timeout_service_mode    .120        ; Service mode
+
+#DEFINE	comm_title_row		.0
+#DEFINE	comm_title_column	.50
+
+#DEFINE	comm_string_row	.30
+#DEFINE	comm_string_column	.40
+
+
+#DEFINE	comm_status1_row		.70
+#DEFINE	comm_status1_column	.10
+#DEFINE	comm_status2_row		.100
+#DEFINE	comm_status2_column	comm_status1_column
+#DEFINE	comm_status3_row		.130
+#DEFINE	comm_status3_column	comm_status1_column
+
+#DEFINE	comm_warning_row		.160
+#DEFINE	comm_warning_column     .65
+
+comm code
+
+	; test for comm
+	global	comm_mode
+comm_mode:
+    call    TFT_ClearScreen
+    WIN_COLOR   color_greenish
+	WIN_SMALL	comm_title_column, comm_title_row
+	STRCPY_TEXT_PRINT	tUsbTitle		; comm Mode
+    call	TFT_standard_color
+    WIN_TOP     .10
+    WIN_LEFT    .1
+    movlw   0xDE
+    movwf   TBLPTRL
+    movlw   0xEE
+    movwf   TBLPTRH
+    movlw   0x01
+    movwf   TBLPTRU
+    call    color_image                 ; Show usb logo
+	WIN_SMALL	comm_status1_column, comm_status1_row
+	STRCPY_TEXT_PRINT	tUsbStarting	; Starting...
+    call	TFT_serial                  ; Show serial and firmware version
+    bcf     enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+	bcf		switch_right
+    bcf     comm_service_enabled
+    bsf     menubit
+    bcf     battery_removed_in_usb      ; =1: The battery has been removed in USB
+    movlw   timeout_comm_pre_mode
+	movwf	timeout_counter
+	WIN_SMALL	comm_status1_column+.80, comm_status1_row
+	STRCPY_TEXT_PRINT	tUsbStartDone	; Done...
+	call	enable_rs232				; Also sets to speed_normal ...
+comm_mode1:
+	bcf		onesecupdate
+	bcf		LEDr
+	dcfsnz 	timeout_counter,F
+	bra		comm_service_exit           ; Timeout -> Exit
+comm_mode2:
+	call	get_battery_voltage			; gets battery voltage
+    movlw   .3
+    cpfslt  batt_voltage+1              ; Batt Voltage less then 3*256mV?
+    bra     comm_mode3                  ; No
+    ; Set flag
+    bsf     battery_removed_in_usb      ; =1: The battery has been removed in USB
+    bra     comm_mode4
+
+comm_mode3:
+    ; Voltage ok. Do we have a new battery now?
+    btfsc   battery_removed_in_usb      ; =1: The battery has been removed in USB
+    goto	new_battery_menu            ; show "New battery dialog"
+
+comm_mode4:
+	call	rs232_get_byte
+
+    btfss   vusb_in                     ; USB plugged in?
+    bra     comm_service_exit_nousb     ; Disconnected -> Exit
+
+	btfsc	switch_right				; Abort with right
+	bra		comm_service_exit
+
+	btfsc	onesecupdate
+	bra		comm_mode1
+
+	movlw	0xAA						; start byte=0xAA?
+	cpfseq	RCREG1
+	bra		comm_mode2a
+	bra		comm_mode2b             ; Startbyte for service mode found
+comm_mode2a:
+	movlw	0xBB						; start byte=0xBB?
+	cpfseq	RCREG1
+	bra		comm_mode2				; Cycle
+	bra		comm_download_mode		; Startbyte for download mode found
+
+comm_mode2b:
+	; Startbyte found
+	call	rs232_wait_tx			; Wait for UART
+	movlw	0x4B
+	movwf	TXREG1					; Send Answer
+	; Now, check comm command
+
+	call	rs232_get_byte				; first byte
+	call	rs232_wait_tx               ; Wait for UART
+    movff   RCREG1,TXREG1                 ; Echo
+	movlw	UPPER comm_service_key
+	cpfseq	RCREG1
+    bra     comm_mode1               ; Wrong -> Restart
+	call	rs232_get_byte				; second byte
+	call	rs232_wait_tx			; Wait for UART
+    movff   RCREG1,TXREG1                 ; Echo
+	movlw	HIGH (comm_service_key & 0xFFFF)
+	cpfseq	RCREG1
+    bra     comm_mode1               ; Wrong -> Restart
+	call	rs232_get_byte				; third byte
+	call	rs232_wait_tx			; Wait for UART
+    movff   RCREG1,TXREG1                 ; Echo
+	movlw	LOW comm_service_key
+	cpfseq	RCREG1
+    bra     comm_mode1               ; Wrong -> Restart
+
+	; Enable comm service mode
+	WIN_SMALL	comm_status2_column, comm_status2_row
+	STRCPY_TEXT_PRINT	tUsbServiceMode	; Service mode enabled
+    bsf     comm_service_enabled
+	bra		comm_download_mode0		; Startbyte for download mode found
+
+comm_service_exit_nousb:                ; Disconnected -> Exit
+	WIN_SMALL	comm_status3_column, comm_status3_row
+	STRCPY_TEXT_PRINT	tUsbClosed      ; Port closed
+    bra     comm_service_exit_common
+
+comm_service_exit:
+	WIN_SMALL	comm_status3_column, comm_status3_row
+	STRCPY_TEXT_PRINT	tUsbExit        ; Exited
+
+comm_service_exit_common:
+	call	rs232_wait_tx				; Wait for UART
+	movlw	0xFF                        ; Reply FF
+	movwf	TXREG1						; Send Answer
+
+	; Wait 1 second
+	bcf		onesecupdate
+	btfss	onesecupdate
+	bra		$-2
+	; Wait 1 second
+	bcf		onesecupdate
+	btfss	onesecupdate
+	bra		$-2
+
+	call	disable_rs232
+	bcf		LEDr
+    goto    restart
+
+;-----------------------------------------------------------------------------
+
+comm_service_ll_bootloader:
+    bsf     LEDr
+	WIN_SMALL	comm_status3_column, comm_status3_row
+	STRCPY_TEXT_PRINT	tUsbLlBld               ; Low Level Bootloader started
+    WIN_TOP  	comm_warning_row
+	WIN_LEFT 	comm_warning_column
+    TFT_WRITE_PROM_IMAGE dive_warning_block 	; Show Warning icon
+    goto    0x1FF0C
+
+;-----------------------------------------------------------------------------
+; Sends external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm
+;
+comm_send_firmware:
+    movlw   0x50                            ; send echo
+    movwf   TXREG1
+    call    rs232_wait_tx                   ; Wait for UART
+
+    ; Read 5 bytes into buffer.
+	lfsr	FSR2,buffer
+	movlw	.5								; counter
+	movwf	lo
+	movlw   0x55                            ; 5'ft byte checksum.
+	movwf   hi
+
+comm_send_firmware_loop:
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	bra		comm_send_firmware_abort   ; No, abort!
+	movf	RCREG1,W
+	movwf   POSTINC2                        ; Store checksum byte.
+	xorwf   hi,F                            ; Also xor into checksum
+	rlncf   hi,F                            ; And rotate it.
+	decfsz	lo,F
+	bra		comm_send_firmware_loop
+	
+	; Check that 5ft byte checksum's checksum
+	movf    hi,W
+	bnz     comm_send_firmware_failed
+
+    movlw   0x4C                            ; send OK
+    movwf   TXREG1
+    call    rs232_wait_tx                   ; Wait for UART
+
+	; Passed: goto second stage verification.
+	; NOTE: Bootloader is Bank0. With buffer at address 0x200.
+	goto    0x1FDF0                         ; And pray...
+
+comm_send_firmware_failed:
+	WIN_SMALL	comm_string_column, comm_string_row
+	TFT_WARNINGS_COLOR
+	STRCPY_PRINT    "Checksum failed"
+
+comm_send_firmware_abort:
+
+    movlw   0xFF                            ; send ABORTED byte.
+	movwf	TXREG1
+	call	rs232_wait_tx                   ; Wait for UART
+	bra		comm_download_mode0				; Done.
+
+;-----------------------------------------------------------------------------
+; Reset to Dive 1 in logbook
+
+comm_reset_logbook_pointers:
+	clrf    EEADRH                      ; Make sure to select eeprom bank 0
+	clrf	EEDATA
+	write_int_eeprom	.4
+	write_int_eeprom	.5
+	write_int_eeprom	.6
+	write_int_eeprom	.2				; Also, delete total dive counter
+	write_int_eeprom	.3				
+	call	ext_flash_erase_logbook		; And complete logbook (!)
+	bra		comm_download_mode0			; Done.
+
+;-----------------------------------------------------------------------------
+comm_reset_battery_gauge:           ; Resets battery gauge registers
+    call    reset_battery_pointer   ; Resets battery pointer 0x07-0x0C and battery_gauge:5
+    bra		comm_download_mode0		; Done.
+
+;-----------------------------------------------------------------------------
+; erases range in 4kB steps
+
+comm_erase_range4kb:
+    movlw   0x42                        ; send echo
+    movwf   TXREG1
+    call    rs232_wait_tx               ; Wait for UART
+
+    bcf     INTCON,GIE	; All interrups off!
+
+    rcall   comm_get_flash_address		; Get three bytes address or return
+    btfsc   rs232_recieve_overflow      ; Got Data?
+    bra     comm_download_mode0         ; No, Done.
+
+    call    rs232_get_byte
+    btfsc   rs232_recieve_overflow      ; Got byte?
+    bra     comm_download_mode0         ; No, Done.
+    movff   RCREG1,lo
+; Got 4bytes: 3bytes address and 1 bytes (lo) amount of 4kB blocks
+
+comm_erase_range4kb1:
+    call    ext_flash_erase4kB          ; Erase block!
+
+    movlw   0x10
+    addwf   ext_flash_address+1,F
+    movlw   .0
+    addwfc  ext_flash_address+2,F       ; Increase address by .4096, or 0x1000
+    decfsz  lo,F
+    bra     comm_erase_range4kb1        ; Loop until lo=zero
+
+    bra     comm_download_mode0         ; Done (Sends the 4C OK too).
+
+;-----------------------------------------------------------------------------
+
+comm_erase_4kb:				; Get 3 bytes start address
+	bcf		INTCON,GIE	; All interrups off!	
+
+	rcall	comm_get_flash_address		; Get three bytes address or return
+	btfsc	rs232_recieve_overflow      ; Got Data?
+	bra		comm_download_mode0         ; No, Done.
+
+	call	ext_flash_erase4kB          ; Erase one block
+	bra		comm_download_mode0 		; Done.
+
+;-----------------------------------------------------------------------------
+
+comm_write_range:				; Get 3 bytes start address
+    movlw   0x30                        ; send echo
+	movwf	TXREG1
+	call	rs232_wait_tx               ; Wait for UART
+
+	bcf		INTCON,GIE                  ; All interrups off!
+
+	rcall	comm_get_flash_address		; Get three bytes address or return
+	btfsc	rs232_recieve_overflow      ; Got Data?
+	bra		comm_download_mode0  		; No, Done.
+
+comm_write_range_loop:
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow      ; Got byte?
+	bra		comm_download_mode0         ; No, Done (and send OK byte too).
+	movf	RCREG1,W
+	call	ext_flash_byte_write        ; write one byte
+	call	incf_ext_flash_address_p1   ; increase address+1
+	bra		comm_write_range_loop
+
+;-----------------------------------------------------------------------------
+
+comm_send_range:				; Get 3 bytes start address and 3 bytes amount
+    movlw   0x20                        ; send echo
+    movwf   TXREG1
+	call	rs232_wait_tx               ; Wait for UART
+
+	bcf		INTCON,GIE	; All interrups off!	
+
+	rcall	comm_get_flash_address		; Get three bytes address or return
+	btfsc	rs232_recieve_overflow			; Got Data?
+	bra		comm_download_mode0				; No, Done.
+
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	bra		comm_download_mode0				; No, Done.
+	movff	RCREG1,up
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	bra		comm_download_mode0				; No, Done.
+	movff	RCREG1,hi
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	bra		comm_download_mode0				; No, Done.
+	movff	RCREG1,lo
+
+    ; If lo==0, we must precondition hi because there is to many bytes send !
+    movf    lo,W    
+    bnz     $+4
+    decf    hi,F
+
+; 6bytes received, send data
+comm_send_range2:						; needs ext_flash_address:3 start address and up:hi:lo amount
+	call	ext_flash_read_block_start
+	movwf	TXREG1
+
+	bra		comm_send_range24		; counter 24bit
+comm_send_range24_loop:
+	call	ext_flash_read_block		; Read one byte
+	movwf	TXREG1						; Start new transmit
+comm_send_range24:
+	call	rs232_wait_tx				; Wait for UART
+	decfsz	lo,F
+	bra		comm_send_range24_loop
+	decf	hi,F
+	movlw	0xFF
+	cpfseq	hi
+	bra		comm_send_range24_loop
+	decf	up,F
+	movlw	0xFF
+	cpfseq	up
+	bra		comm_send_range24_loop
+	call	ext_flash_read_block_stop
+
+	bra		comm_download_mode0			; Done.
+
+;-----------------------------------------------------------------------------
+
+comm_get_flash_address:
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return									; No, return
+	movff	RCREG1,ext_flash_address+2
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return									; No, return
+	movff	RCREG1,ext_flash_address+1
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return									; No, return
+	movff	RCREG1,ext_flash_address+0
+	return
+
+;-----------------------------------------------------------------------------
+
+comm_download_mode:
+	; Enable comm download mode
+	WIN_SMALL	comm_status2_column, comm_status2_row
+	STRCPY_TEXT_PRINT	tUsbDownloadMode; Download mode enabled
+	bsf		INTCON,GIE					; All interrups on
+	call	rs232_wait_tx				; Wait for UART
+	movlw	0xBB                        ; Command Echo
+	movwf	TXREG1						; Send Answer
+comm_download_mode0:
+    bsf		INTCON,GIE					; All interrups on
+	call	rs232_wait_tx				; Wait for UART
+    movlw   0x4C                        ; 4C in service mode
+    btfss   comm_service_enabled
+	movlw	0x4D                        ; 4D in download mode
+	movwf	TXREG1						; Send Answer
+	movlw	timeout_service_mode
+	movwf	timeout_counter 			; Timeout
+	bcf		switch_right
+comm_download_mode1:
+	bcf		onesecupdate
+	dcfsnz 	timeout_counter,F
+	bra		comm_service_exit           ; Timeout -> Exit
+comm_download_mode2:
+	call	rs232_get_byte              ; Check for a byte
+    btfsc   comm_service_enabled
+	btg     LEDr                        ; Blink in Service mode
+    btfss   vusb_in                     ; USB plugged in?
+    bra     comm_service_exit_nousb     ; Disconnected -> Exit
+	btfsc	switch_right				; Abort with right
+	bra		comm_service_exit
+	btfsc	onesecupdate
+	bra		comm_download_mode1
+	btfsc	rs232_recieve_overflow
+	bra		comm_download_mode2	; Wait for command byte
+
+	; command received!
+	bcf		LEDr
+	movlw	0xFF
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_service_exit			; exit
+	movlw	"a"
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_send_headers			; Send all 256 dive headers
+	movlw	"b"
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_set_time				; Read time and date from the PC and set clock
+	movlw	"c"
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_set_custom_text		; Send a opt_name_length byte string of custom text.
+	movlw	"f"
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_send_dive				; Send header and profile for one dive
+	movlw	"i"
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_identify               ; Send firmware, serial, etc.
+	movlw	"n"
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_send_string			; Send a 15byte string to the screen
+	movlw	"l"
+	cpfseq	RCREG1
+	bra		$+4
+    call	TFT_dump_screen             ; Dump the screen contents
+
+    btfss   comm_service_enabled        ; Done for Download mode
+	bra		comm_download_mode0         ; Loop with timeout reset
+
+	movlw	0x20
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_send_range             ; send hi:lo:temp1 bytes starting from ext_flash_address:3
+	movlw	0x22
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_reset_logbook_pointers	; Resets all logbook pointers and the logbook (!)
+	movlw	0x23
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_reset_battery_gauge    ; Resets battery gauge registers
+	movlw	0x30
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_write_range            ; write bytes starting from ext_flash_address:3 (Stop when timeout)
+	movlw	0x40
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_erase_4kb              ; erases 4kB block from ext_flash_address:3 (Warning: No confirmation or built-in security here...)
+	movlw	0x42
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_erase_range4kb         ; erases range in 4kB steps (Get 3 bytes address and 1byte amount of 4kB blocks)
+	movlw	0x50
+	cpfseq	RCREG1
+	bra		$+4
+	bra		comm_send_firmware          ; sends firmware from external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm
+	movlw	"t"
+	cpfseq	RCREG1
+	bra		$+4
+    goto    testloop                    ; Start raw-data testloop
+	movlw	"r"
+	cpfseq	RCREG1
+	bra		$+4
+    call	option_reset_all        	; Reset all options to factory default.
+	movlw	0xC1
+	cpfseq	RCREG1
+	bra		$+4
+	bra 	comm_service_ll_bootloader  ; Start low-level bootloader
+    bra		comm_download_mode0         ; Loop with timeout reset
+
+;-----------------------------------------------------------------------------
+
+comm_send_headers:
+	movlw	"a"								; send echo
+	movwf	TXREG1
+	; Send 256 bytes/dive (Header)
+	; 1st: 200000h-2000FFh
+	; 2nd: 201000h-2010FFh
+	; 3rd: 202000h-2020FFh
+	; 100: 264000h-2640FFh
+	; 256: 2FF000h-2FF0FFh
+	movlw	0x1F
+	movwf	ext_flash_address+2
+	movlw	0xF0
+	movwf	ext_flash_address+1
+
+comm_send_headers2:
+	movlw	0x00
+	movwf	ext_flash_address+0
+	; Adjust address for next dive
+	movlw	0x10
+	addwf	ext_flash_address+1
+	movlw	0x00
+	addwfc	ext_flash_address+2
+
+	movlw	0x30
+	cpfseq	ext_flash_address+2				; All 256 dive send?
+	bra		comm_send_headers4			; No, continue
+	bra		comm_download_mode0		; Done. Loop with timeout reset
+
+comm_send_headers4:
+	clrf	lo							; Counter	
+	call	rs232_wait_tx				; Wait for UART
+	call	ext_flash_read_block_start	; 1st byte
+	movwf	TXREG1
+	bra		comm_send_headers3		; counter 24bit
+comm_send_headers_loop:
+	call	ext_flash_read_block		; Read one byte
+	movwf	TXREG1						; Start new transmit
+comm_send_headers3:
+	call	rs232_wait_tx				; Wait for UART
+	decfsz	lo,F
+	bra		comm_send_headers_loop
+	call	ext_flash_read_block_stop
+	bra		comm_send_headers2		; continue
+
+;-----------------------------------------------------------------------------
+;
+
+comm_set_time:
+	movlw	"b"								; send echo
+	movwf	TXREG1
+
+	call	rs232_wait_tx					; wait for UART
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return                          		; No, abort!
+	movff	RCREG1, hours
+	movlw	d'24'
+	cpfslt	hours
+	clrf	hours
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return                          		; No, abort!
+	movff	RCREG1, mins
+	movlw	d'60'
+	cpfslt	mins
+	clrf	mins
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return                          		; No, abort!
+	movff	RCREG1, secs
+	movlw	d'60'
+	cpfslt	secs
+	clrf	secs
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return                          		; No, abort!
+	movff	RCREG1, month
+	movlw	d'13'
+	cpfslt	month
+	movwf	month
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return                          		; No, abort!
+	rcall	comm_check_day                  ; Check day
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	return                          		; No, abort!
+	movff	RCREG1, year
+	movlw	d'100'
+	cpfslt	year
+	clrf	year
+	; All ok, set RTCC
+	call	rtc_set_rtc                     ; writes mins,sec,hours,day,month and year to rtc module
+    bra		comm_download_mode0             ; Done. back to loop with timeout reset
+
+;-----------------------------------------------------------------------------
+; Set OSTC3 custom text string (opt_name_length ascii chars).
+;
+
+comm_set_custom_text:
+    movlw	"c"								; send echo
+    movwf	TXREG1
+    call	rs232_wait_tx					; wait for UART
+    lfsr	FSR2,opt_name
+    movlw	opt_name_length
+    movwf	lo								; counter
+comm_set_ctext_loop:
+    call	rs232_get_byte
+    btfsc	rs232_recieve_overflow          ; Got byte?
+    return                                  ; No, abort!
+    movff	RCREG1,POSTINC2                  ; Store character
+    decfsz	lo,F
+    bra		comm_set_ctext_loop
+    bra		comm_download_mode0        ; Done. Loop with timeout reset
+
+;-----------------------------------------------------------------------------
+; Reply Serial (2 bytes low:high), firmware (major.minor) and custom text.
+;
+  
+comm_identify:
+    movlw	"i"								; send echo
+    movwf	TXREG1
+    call	rs232_wait_tx					; wait for UART
+
+    ;---- Read serial from internal EEPROM address 0000
+	clrf	EEADRH
+	clrf	EEADR                       ; Get Serial number LOW
+	call	read_eeprom                 ; read byte
+	movff	EEDATA,lo
+	incf	EEADR,F                     ; Get Serial number HIGH
+	call	read_eeprom                 ; read byte
+	movff	EEDATA,hi
+
+    ;---- Emit serial number
+	movff   lo,TXREG1
+	call	rs232_wait_tx
+	movff   hi,TXREG1
+	call	rs232_wait_tx
+
+	;---- Emit fiwmware hi.lo
+	movlw   softwareversion_x
+	movwf   TXREG1
+	call	rs232_wait_tx
+	movlw   softwareversion_y
+	movwf   TXREG1
+	call	rs232_wait_tx
+
+	;---- Emit custom text
+	movlw   opt_name_length
+	movwf   hi
+	lfsr    FSR2,opt_name
+
+common_identify_loop:
+    movff   POSTINC2,TXREG1
+	call	rs232_wait_tx
+	decfsz	hi,F
+	bra		common_identify_loop
+
+    bra     comm_download_mode0             ; Done.
+
+
+;-----------------------------------------------------------------------------
+
+comm_send_dive:
+	movlw	"f"								; send echo
+	movwf	TXREG1
+	
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	bra		comm_download_mode0		; No, abort!
+	movff	RCREG1,lo						; Store dive number (0-255)
+; First, send the header (again)
+	; Set ext_flash_address:3 to TOC entry of this dive
+	; 1st: 200000h-200FFFh -> lo=0
+	; 2nd: 201000h-201FFFh -> lo=1
+	; 3rd: 202000h-202FFFh -> lo=2
+	; 256: 2FF000h-2FFFFFh -> lo=255
+	clrf	ext_flash_address+0
+	clrf	ext_flash_address+1
+	movlw	0x20
+	movwf	ext_flash_address+2
+	movlw	.16
+	mulwf	lo				; lo*16 = offset to 0x2000 (up:hi)
+	movf	PRODL,W
+	addwf	ext_flash_address+1,F
+	movf	PRODH,W
+	addwfc	ext_flash_address+2,F
+
+	incf_ext_flash_address	d'2'				; Skip 0xFA, 0xFA
+	call		ext_flash_byte_read_plus		; Read start address of profile
+	movff		temp1,ext_flash_log_pointer+0
+	call		ext_flash_byte_read_plus		; Read start address of profile
+	movff		temp1,ext_flash_log_pointer+1
+	call		ext_flash_byte_read_plus		; Read start address of profile
+	movff		temp1,ext_flash_log_pointer+2
+	call		ext_flash_byte_read_plus		; Read end address of profile
+	movff		temp1,convert_value_temp+0
+	call		ext_flash_byte_read_plus		; Read end address of profile
+	movff		temp1,convert_value_temp+1
+	call		ext_flash_byte_read_plus		; Read end address of profile
+	movff		temp1,convert_value_temp+2
+	decf_ext_flash_address	d'8'				; Back again to first 0xFA in header
+
+    movf        ext_flash_log_pointer+0,W
+    cpfseq      convert_value_temp+0            ; Equal?
+    bra         comm_send_dive1                 ; No, Send header
+
+    movf        ext_flash_log_pointer+1,W
+    cpfseq      convert_value_temp+1            ; Equal?
+    bra         comm_send_dive1                 ; No, Send header
+
+    movf        ext_flash_log_pointer+2,W
+    cpfseq      convert_value_temp+2            ; Equal?
+    bra         comm_send_dive1                 ; No, Send header
+
+    ; Start=End -> Not good, abort
+    bra		comm_download_mode0                 ; Done. Loop with timeout reset
+
+comm_send_dive1:
+	; Send header
+	clrf	hi							; Counter	
+	call	rs232_wait_tx				; Wait for UART
+	call	ext_flash_read_block_start	; 1st byte
+	movwf	TXREG1
+	bra		comm_send_dive_header
+comm_send_dive_header2:
+	call	ext_flash_read_block		; Read one byte
+	movwf	TXREG1						; Start new transmit
+comm_send_dive_header:
+	call	rs232_wait_tx				; Wait for UART
+	decfsz	hi,F
+	bra		comm_send_dive_header2
+	call	ext_flash_read_block_stop
+
+	; Set address for profile
+	movff	ext_flash_log_pointer+0,ext_flash_address+0
+	movff	ext_flash_log_pointer+1,ext_flash_address+1
+	movff	ext_flash_log_pointer+2,ext_flash_address+2
+
+	movlw	.6								; Skip 6byte short header in profile - only for internal use
+	call	incf_ext_flash_address0_0x20	; increases bytes in ext_flash_address:3 with 0x200000 bank switching
+
+comm_send_dive_profile:
+	call	ext_flash_byte_read_plus_0x20	; Read one byte into temp1, takes care of banking at 0x200000
+	call	rs232_wait_tx					; Wait for UART
+	movff	temp1,TXREG1						; Send a byte
+	
+	; 24bit compare with end address
+	movff	convert_value_temp+0,WREG
+	cpfseq	ext_flash_address+0
+	bra		comm_send_dive_profile
+	movff	convert_value_temp+1,WREG
+	cpfseq	ext_flash_address+1
+	bra		comm_send_dive_profile
+	movff	convert_value_temp+2,WREG
+	cpfseq	ext_flash_address+2
+	bra		comm_send_dive_profile
+	
+	call	rs232_wait_tx					; Wait for UART
+	bra		comm_download_mode0		; Done. Loop with timeout reset
+
+;-----------------------------------------------------------------------------
+
+comm_send_string:
+	movlw	"n"								; send echo
+	movwf	TXREG1
+	call	rs232_wait_tx					; Wait for UART
+	WIN_SMALL	comm_string_column, comm_string_row
+	lfsr	FSR2,buffer
+	movlw	.16
+	movwf	lo								; counter
+comm_send_string_loop:
+	call	rs232_get_byte
+	btfsc	rs232_recieve_overflow			; Got byte?
+	bra		comm_send_string_abort          ; No, abort!
+	movff	RCREG1,POSTINC2					; Store character
+	decfsz	lo,F
+	bra		comm_send_string_loop
+comm_send_string_abort:
+	STRCAT_PRINT ""							; Show the text
+    bra		comm_download_mode0             ; Done. Loop with timeout reset
+
+;-----------------------------------------------------------------------------
+
+comm_check_day:
+	movff	RCREG1, day
+	movff	month,lo		; new month
+	dcfsnz	lo,F
+	movlw	.31
+	dcfsnz	lo,F
+	movlw	.28
+	dcfsnz	lo,F
+	movlw	.31
+	dcfsnz	lo,F
+	movlw	.30
+	dcfsnz	lo,F
+	movlw	.31
+	dcfsnz	lo,F
+	movlw	.30
+	dcfsnz	lo,F
+	movlw	.31
+	dcfsnz	lo,F
+	movlw	.31
+	dcfsnz	lo,F
+	movlw	.30
+	dcfsnz	lo,F
+	movlw	.31
+	dcfsnz	lo,F
+	movlw	.30
+	dcfsnz	lo,F
+	movlw	.31
+	cpfsgt	day						; day ok?
+	return							; OK
+	movlw	.1						; not OK, set to 1st
+	movwf	day
+	return	
+
+;----------------------------------------------------------------------------
+        END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/comm.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,11 @@
+;=============================================================================
+;
+;   File comm.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-22 : [mH] creation
+
+	extern	comm_mode
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/compass.c	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,244 @@
+//////////////////////////////////////////////////////////////////////////////
+// HISTORY
+//  2012-12-01  [jDG] Creation
+//  2012-12-23  [jDG] Added filtering.
+//  2012-12-30  [jDG] Added calibration (spherical best fit).
+
+#include "compass.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// mH: Crude work-around, needs to be made right
+#ifndef UNIX
+#   pragma udata overlay bank8=0x800
+    static char	  C_STACK[256];  // Overlay C-code data stack here.
+#       define RESET_C_STACK    \
+        _asm                    \
+            LFSR    1, 0x800    \
+            LFSR    2, 0x800    \
+        _endasm
+#   pragma udata overlay bank9_compass
+#else
+#       define RESET_C_STACK
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// fifth order of polynomial approximation of atan(), giving 0.05 deg max error
+//
+#define K1  (5701)  // Needs K1/2**16
+#define K2  (1645)  // Needs K2/2**48  WAS NEGATIV
+#define K3  ( 446)  // Needs K3/2**80
+
+//////////////////////////////////////////////////////////////////////////////
+// Interface to assembleur multiplies
+Int16 umul(PARAMETER Int16 a, PARAMETER Int16 b)
+{
+    extern Int16 compass_umul(void);
+    extern Int16 compass_a, compass_b;
+    compass_a = a;
+    compass_b = b;
+    return compass_umul();
+}
+
+Int16 imul(PARAMETER Int16 a, PARAMETER Int16 b)
+{
+    extern Int16 compass_imul(void);
+    extern Int16 compass_a, compass_b;
+    compass_a = a;
+    compass_b = b;
+    return compass_imul();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Returns a / b * 2**16
+///
+/// A 16/16 -> 16 bits divide, returning a scalled result.
+/// Used to multiply fractional numbers in the range 0..1,
+/// represented as 0..32767.
+Int16 udiv(PARAMETER Int16 a, PARAMETER Int16 b)
+{
+    OVERLAY Int16 d, r;
+
+    //---- Pre-scale both numerator and denominator --------------------------
+    while( (((a>>8) | (b>>8)) & 0xC0) == 0 )
+    {
+        a <<= 1;
+        b <<= 1;
+    }
+
+    //---- Make division trials ----------------------------------------------
+    d = 0x4000;             // Starts with 0.5, because 1.0 is sign bit.
+    b >>= 1;                // Hence pre-shift b.
+    r = 0;
+    do {
+        if( a >= b ) {      // a is big enough ?
+            a -= b;         // then count d times b out of it.
+            r |= d;         // and accumulate that bit.
+        }
+        b >>= 1;            // then loop trying twice smaller.
+        d >>= 1;
+    } while( b );
+    return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Computes atan(y/x) in Angle, for x, y in range 0..32767
+///
+/// Results a single quadrant Angle, in the range 0 .. Q_PI/2
+Angle utan(PARAMETER Int16 y, PARAMETER Int16 x)
+{
+    OVERLAY Int16 ratio, angle, x2, x3;
+
+    //---- Handle zero divisor -----------------------------------------------
+    if( x == 0 )
+        return (y == 0) ? 0 : Q_PIO2;
+
+    //---- Make it half-quadrant : 0 .. 45 deg -------------------------------
+    ratio = (x > y) ? udiv(y, x) : udiv(x, y);
+
+    //---- Then apply the polynomial approximation ---------------------------
+    angle = umul(K1, ratio);            // r*K1 / 2**16
+    x2 = umul(ratio, ratio);            // r**2 / 2**16
+    x3 = umul(x2, ratio);               // r**3 / 2**32
+    angle -= umul(x3, K2);              // K2*r**3 / 2**48: NEGATIV.
+
+    x3 = umul(x3, x2);                  // r**5 / 2**64
+    angle += umul(x3, K3);              // K3*r**5 / 2**80
+
+    //---- Recover the full quadrant -----------------------------------------
+    return (x < y) ? (Angle)(Q_PIO2 - angle)
+                   : (Angle)(angle);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Computes atan2(y/x) in Angle, for x, y in range -32768 to 32767
+///
+/// Results a four quadrant Angle, in the range -Q_PI .. +Q_PI
+Angle itan(PARAMETER Int16 y, PARAMETER Int16 x)
+{
+    // Beware: -32768 is not properly handled (sgn error).
+    if( x == -32768 ) x = -32767;
+    if( y == -32768 ) y = -32767;
+
+    if( x >= 0 )
+        if( y >= 0 )    // First quadrant: 0..90 deg.
+            return utan(y,x);
+        else            // Fourth quadrant: 0..-90 deg
+            return -utan(-y,x);
+    else
+        if( y >= 0 )    // Second quadrant: 90..180 deg
+            return Q_PI - utan(y, -x);
+        else            // Third quadrant: -90..-180 deg;
+            return -Q_PI + utan(-y, -x);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Computes cos(theta) = sqrtf(x2/h2),
+/// when theta = atan(y/x) and h2=x*x+y*y
+///
+Int16 cosxh(PARAMETER Int16 x2, PARAMETER Int16 h2)
+{
+    OVERLAY Int16 r = 0;
+    OVERLAY Int16 d = 0x4000;
+
+    do {
+        OVERLAY Int16 a = r + d;
+        a = umul(a, a);
+        a = umul(a, h2);
+        if( a <= x2 ) r += d;
+        d >>= 1;
+    } while( d );
+
+    return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/// Computes both sin and cos of angle y/x,
+/// with h = sqrt(x**2+y**2).
+///
+void sincos(PARAMETER Int16 x, PARAMETER Int16 y, Int16* sin, Int16* cos)
+{
+    OVERLAY Int16 x2, y2, h2;
+
+    //---- Fold into one quadant ---------------------------------------------
+    OVERLAY char neg = 0;
+    if( x < 0 )
+    {
+        neg |= 1;
+        x = -x;
+    }
+    if( y < 0 )
+    {
+        neg |= 2;
+        y = -y;
+    }
+
+    //---- Pre-scale both numerator and denominator ----------------------
+    while( (((x>>8) | (y>>8)) & 0xE0) == 0 )
+    {
+        x <<= 1;
+        y <<= 1;
+    }
+
+    //---- Uses trig() to do the stuff one on quadrant -------------------
+    x2 = umul(x,x);
+    y2 = umul(y,y);
+    h2 = x2 + y2;
+    x2 = cosxh(x2, h2);
+
+    //---- Results back in four quadrants --------------------------------
+    *cos = (neg & 1) ? -x2 : x2;
+    y2 = cosxh(y2, h2);
+    *sin = (neg & 2) ? -y2 : y2;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+void compass(void)
+{
+    OVERLAY Int16 sin, cos;
+    OVERLAY Int16 iBfx, iBfy, Gz;
+    OVERLAY Int16 iBpx, iBpy, iBpz;
+    RESET_C_STACK;
+
+    //---- Make hard iron correction -----------------------------------------
+    // Measured magnetometer orientation, measured ok.
+    // From matthias drawing: (X,Y,Z) --> (X,Y,Z) : no rotation.
+    iBpx = compass_DX_f - compass_CX_f; // X
+    iBpy = compass_DY_f - compass_CY_f; // Y
+    iBpz = compass_DZ_f - compass_CZ_f; // Z
+
+    //---- Calculate sine and cosine of roll angle Phi -----------------------
+    sincos(accel_DZ_f, accel_DY_f, &sin, &cos);
+    compass_roll = itan(sin, cos) / 100;
+
+    //---- rotate by roll angle (-Phi) ---------------------------------------
+    iBfy = imul(iBpy, cos) - imul(iBpz, sin);
+    iBpz = imul(iBpy, sin) + imul(iBpz, cos);
+    Gz = imul(accel_DY_f, sin) + imul(accel_DZ_f, cos);
+
+    //---- calculate sin and cosine of pitch angle Theta ---------------------
+    sincos(Gz, -accel_DX_f, &sin, &cos);     // NOTE: changed sin sign.
+    compass_pitch = itan(sin, cos) / 100;
+
+    /* correct cosine if pitch not in range -90 to 90 degrees */
+    if( cos < 0 ) cos = -cos;
+
+    ///---- de-rotate by pitch angle Theta -----------------------------------
+    iBfx = imul(iBpx, cos) + imul(iBpz, sin);
+
+    //---- Detect uncalibrated compass ---------------------------------------
+    if( !compass_CX_f && !compass_CY_f && !compass_CZ_f )
+    {
+        compass_heading = -1;
+        return;
+    }
+
+    //---- calculate current yaw = e-compass angle Psi -----------------------
+    // Result in degree (no need of 0.01 deg precision...
+    compass_heading = itan(-iBfy, iBfx) / 100;
+
+    // Result in 0..360 range:
+    if( compass_heading < 0 )
+        compass_heading += 360;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/compass.h	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,52 @@
+//////////////////////////////////////////////////////////////////////////////
+// HISTORY
+//  2013-03-29  [jDG] Creation for tests.
+
+//---- Storage classes -------------------------------------------------------
+// Declaring PIC18 and VC++/G++ functions.
+#ifdef UNIX
+#   define PARAMETER
+#   define OVERLAY
+#else
+//---- Bank 9 parameters -----------------------------------------------------
+#   pragma udata overlay bank9_compass = 0x900
+#   define PARAMETER    static
+#   define OVERLAY      overlay
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define Q_PI    (18000)
+#define Q_PIO2  (9000)
+
+typedef short int Int16;
+typedef signed char Int8;
+typedef Int16 Angle;
+
+// The (filtered) components of the magnetometer sensor:
+extern Int16 compass_DX_f;
+extern Int16 compass_DY_f;
+extern Int16 compass_DZ_f;
+
+// Found soft-iron calibration values, deduced from already filtered values.
+extern Int16 compass_CX_f;
+extern Int16 compass_CY_f;
+extern Int16 compass_CZ_f;
+
+// The (filtered) components of the accelerometer sensor:
+extern Int16 accel_DX_f;
+extern Int16 accel_DY_f;
+extern Int16 accel_DZ_f;
+
+// The compass result value.
+extern Int16 compass_heading;
+extern Int16 compass_roll;
+extern Int16 compass_pitch;
+
+extern Int16 umul(PARAMETER Int16 a, PARAMETER Int16 b);
+extern Int16 imul(PARAMETER Int16 a, PARAMETER Int16 b);
+extern Int16 udiv(PARAMETER Int16 a, PARAMETER Int16 b);
+extern Angle utan(PARAMETER Int16 a, PARAMETER Int16 b);
+extern Angle itan(PARAMETER Int16 a, PARAMETER Int16 b);
+extern Angle cosxh(PARAMETER Int16 a, PARAMETER Int16 b);
+extern void  sincos(PARAMETER Int16 a, PARAMETER Int16 b, Int16* sin, Int16* cos);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/compass_calib.c	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,229 @@
+#include "compass.h"
+
+static unsigned short int compass_N;
+
+static float Su, Sv, Sw;
+static float Suu, Svv, Sww, Suv, Suw, Svw;
+static float Suuu, Svvv, Swww;
+static float Suuv, Suuw, Svvu, Svvw, Swwu, Swwv;
+
+//////////////////////////////////////////////////////////////////////////////
+// mH: Crude work-around, needs to be made right
+#ifndef UNIX
+#   pragma udata overlay bank8=0x800
+    static char	  C_STACK[256];  // Overlay C-code data stack here.
+#       define RESET_C_STACK    \
+        _asm                    \
+            LFSR    1, 0x800    \
+            LFSR    2, 0x800    \
+        _endasm
+#   pragma udata overlay bank9_compass
+#else
+#       define RESET_C_STACK
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+void compass_reset_calibration()
+{
+    RESET_C_STACK;
+
+    compass_N = 0;
+    Su = Sv = Sw = 0.0;
+    Suu = Svv = Sww = Suv = Suw = Svw = 0.0;
+    Suuu = Svvv = Swww = 0.0;
+    Suuv = Suuw = Svvu = Svvw = Swwu = Swwv = 0.0;
+}
+
+void compass_add_calibration()
+{
+    OVERLAY float u, v, w;
+    RESET_C_STACK;
+
+    u = (compass_DX_f - compass_CX_f) / 32768.0f;
+    v = (compass_DY_f - compass_CY_f) / 32768.0f;
+    w = (compass_DZ_f - compass_CZ_f) / 32768.0f;
+
+    compass_N++;
+    Su += u;
+    Sv += v;
+    Sw += w;
+    Suv += u*v;
+    Suw += u*w;
+    Svw += v*w;
+    Suu  += u*u;
+    Suuu += u*u*u;
+    Suuv += v*u*u;
+    Suuw += w*u*u;
+    Svv  += v*v;
+    Svvv += v*v*v;
+    Svvu += u*v*v;
+    Svvw += w*v*v;
+    Sww  += w*w;
+    Swww += w*w*w;
+    Swwu += u*w*w;
+    Swwv += v*w*w;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void compass_solve_calibration()
+{
+    OVERLAY float yu, yv, yw;
+    OVERLAY float delta;
+    OVERLAY float uc, vc, wc;
+    RESET_C_STACK;
+
+    //---- Normalize partial sums --------------------------------------------
+    //
+    // u, v, w should be centered on the mean value um, vm, wm:
+    // x = u + um, with um = Sx/N
+    //
+    // So:
+    // (u + um)**2 = u**2 + 2u*um + um**2
+    // Su = 0, um = Sx/N
+    // Sxx = Suu + 2 um Su + N*(Sx/N)**2 = Suu + Sx**2/N
+    // Suu = Sxx - Sx**2/N
+    yu = Su/compass_N;
+    yv = Sv/compass_N;
+    yw = Sw/compass_N;
+
+    Suu -= Su*yu;
+    Svv -= Sv*yv;
+    Sww -= Sw*yw;
+
+    // (u + um)(v + vm) = uv + u vm + v um + um vm
+    // Sxy = Suv + N * um vm
+    // Suv = Sxy - N * (Sx/N)(Sy/N);
+    Suv -= Su*yv;
+    Suw -= Su*yw;
+    Svw -= Sv*yw;
+
+    // (u + um)**3 = u**3 + 3 u**2 um + 3 u um**2 + um**3
+    // Sxxx = Suuu + 3 um Suu + 3 um**2 Su + N.um**3
+    // Su = 0, um = Sx/N:
+    // Suuu = Sxxx - 3 Sx*Suu/N - N.(Sx/N)**3
+    //      = Sxxx - 3 Sx*Suu/N - Sx**3/N**2
+
+    // (u + um)**2 (v + vm) = (u**2 + 2 u um + um**2)(v + vm)
+    // Sxxy = Suuv + vm Suu + 2 um (Suv + vm Su) + um**2 (Sv + N.vm)
+    //
+    // Su = 0, Sv = 0, vm = Sy/N:
+    // Sxxy = Suuv + vm Suu + 2 um Suv + N um**2 vm
+    //
+    // Suuv = Sxxy - (Sy/N) Suu - 2 (Sx/N) Suv - (Sx/N)**2 Sy
+    //      = Sxxy - Suu*Sy/N - 2 Suv*Sx/N - Sx*Sx*Sy/N/N
+    //      = Sxxy - (Suu + Sx*Sx/N)*Sy/N - 2 Suv*Sx/N
+    Suuu -= (3*Suu + Su*yu)*yu;
+    Suuv -= (Suu + Su*yu)*yv + 2*Suv*yu;
+    Suuw -= (Suu + Su*yu)*yw + 2*Suw*yu;
+
+    Svvu -= (Svv + Sv*yv)*yu + 2*Suv*yv;
+    Svvv -= (3*Svv + Sv*yv)*yv;
+    Svvw -= (Svv + Sv*yv)*yw + 2*Svw*yv;
+
+    Swwu -= (Sww + Sw*yw)*yu + 2*Suw*yw;
+    Swwv -= (Sww + Sw*yw)*yv + 2*Svw*yw;
+    Swww -= (3*Sww + Sw*yw)*yw;
+
+    //---- Solve the system --------------------------------------------------
+    // uc Suu + vc Suv + wc Suw = (Suuu + Svvu + Swwu) / 2
+    // uc Suv + vc Svv + wc Svw = (Suuv + Svvv + Swwv) / 2
+    // uc Suw + vc Svw + wc Sww = (Suuw + Svvw + Swww) / 2
+    // Note this is symetric, with a positiv diagonal, hence
+    // it always have a uniq solution.
+    yu = 0.5f * (Suuu + Svvu + Swwu);
+    yv = 0.5f * (Suuv + Svvv + Swwv);
+    yw = 0.5f * (Suuw + Svvw + Swww);
+    delta = Suu * (Svv * Sww - Svw * Svw)
+          - Suv * (Suv * Sww - Svw * Suw)
+          + Suw * (Suv * Svw - Svv * Suw);
+
+    uc = (yu  * (Svv * Sww - Svw * Svw)
+       -  yv  * (Suv * Sww - Svw * Suw)
+       +  yw  * (Suv * Svw - Svv * Suw) )/delta;
+    vc = (Suu * ( yv * Sww -  yw * Svw)
+       -  Suv * ( yu * Sww -  yw * Suw)
+       +  Suw * ( yu * Svw -  yv * Suw) )/delta;
+    wc = (Suu * (Svv * yw  - Svw * yv )
+       -  Suv * (Suv * yw  - Svw * yu )
+       +  Suw * (Suv * yv  - Svv * yu ) )/delta;
+
+    // Back to uncentered coordinates:
+    // xc = um + uc
+    uc = Su/compass_N + compass_CX_f/32768.0f + uc;
+    vc = Sv/compass_N + compass_CY_f/32768.0f + vc;
+    wc = Sw/compass_N + compass_CZ_f/32768.0f + wc;
+
+    // Then save the new calibrated center:
+    compass_CX_f = (short)(32768 * uc);
+    compass_CY_f = (short)(32768 * vc);
+    compass_CZ_f = (short)(32768 * wc);
+}
+
+////////////////////////////// TEST CODE /////////////////////////////////////
+
+#ifdef TEST_COMPASS_CALIBRATION
+
+#include <QtDebug>
+#include <stdio.h>
+
+#include <math.h>
+#include <stdlib.h>
+
+short compass_DX_f, compass_DY_f, compass_DZ_f;
+short compass_CX_f, compass_CY_f, compass_CZ_f;
+
+inline float uniform() {
+    return (rand() & 0xFFFF) / 65536.0f;
+}
+inline float sqr(float x) {
+    return x*x;
+}
+
+static const float radius = 0.21f;
+static const float cx = 0.79f, cy = -0.46f, cz = 0.24f;
+// const float cx = 0, cy = 0, cz = 0;
+
+void check_compass_calib()
+{
+
+    // Starts with no calibration at all:
+    compass_CX_f = compass_CY_f = compass_CZ_f = 0;
+
+    // Try 10 recalibration passes:
+    for(int p=0; p<10; ++p)
+    {
+        compass_reset_calibration();
+
+        //---- Generates random points on a sphere -------------------------------
+        // of radius,center (cx, cy, cz):
+        for(int i=0; i<100; ++i)
+        {
+            float theta = uniform()*360.0f;
+            float phi   = uniform()*180.0f - 90.0f;
+
+            float x = cx + radius * cosf(phi)*cosf(theta);
+            float y = cy + radius * cosf(phi)*sinf(theta);
+            float z = cz + radius * sinf(phi);
+
+            compass_DX_f = short(32768 * x);
+            compass_DY_f = short(32768 * y);
+            compass_DZ_f = short(32768 * z);
+            compass_add_calibration();
+        }
+
+        compass_solve_calibration();
+        qDebug() << "Center ="
+                 << compass_CX_f/32768.0f
+                 << compass_CY_f/32768.0f
+                 << compass_CZ_f/32768.0f;
+
+        float r2 = sqr(compass_CX_f/32768.0f - cx)
+                 + sqr(compass_CY_f/32768.0f - cy)
+                 + sqr(compass_CZ_f/32768.0f - cz);
+        if( r2 > 0.01f*0.01f )
+            qWarning() << "    calibration error: " << sqrtf(r2);
+    }
+}
+#endif // TEST_COMPASS_CALIBRATION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/compass_ops.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,171 @@
+#include "ostc3.inc"
+
+; Make sure symbols from the .inc are available to the C code:
+    ; Filtered data
+    global compass_DX_f, compass_DY_f, compass_DZ_f
+    global accel_DX_f,   accel_DY_f,   accel_DZ_f
+
+    ; Calibration data
+    global compass_CX_f
+    global compass_CY_f
+    global compass_CZ_f
+
+    ; Tmp values to pass Q15 arithmetics around
+    global compass_a
+    global compass_b
+
+    ; Result
+    global compass_heading, compass_roll, compass_pitch
+
+compass code
+;-----------------------------------------------------------------------------
+; Filter compass values
+;
+; Apply linear filtering to input parameters.
+    global compass_filter
+
+; Apply filtering formula:
+;   reg_f += (reg - reg_f) / 4
+FILTER16 MACRO   reg, reg_f
+        movf    reg_f+0,W
+        subwf   reg+0,W
+        movwf   PRODL
+        movf    reg_f+1,W
+        subwfb  reg+1,W
+        movwf   PRODH
+
+        bcf     STATUS,C        ; Copy sign bit into carry
+        btfsc   PRODH,7
+        bsf     STATUS,C
+        rrcf    PRODH,F         ; 16bit shift right
+        rrcf    PRODL,F
+
+        bcf     STATUS,C        ; Copy sign bit into carry
+        btfsc   PRODH,7
+        bsf     STATUS,C
+        rrcf    PRODH,F         ; 16bit shift right
+        rrcf    PRODL,W
+
+        addwf   reg_f+0,F
+        movf    PRODH,W
+        addwfc  reg_f+1,F
+        ENDM
+
+compass_filter:
+        banksel   compass_DX
+
+        FILTER16  compass_DX, compass_DX_f
+        FILTER16  compass_DY, compass_DY_f
+        FILTER16  compass_DZ, compass_DZ_f
+        FILTER16  accel_DX,   accel_DX_f
+        FILTER16  accel_DY,   accel_DY_f
+        FILTER16  accel_DZ,   accel_DZ_f
+        banksel   common
+        return
+
+;-----------------------------------------------------------------------------
+
+        global compass_filter_init
+compass_filter_init:
+        movff   compass_DX+0, compass_DX_f+0
+        movff   compass_DX+1, compass_DX_f+1
+        movff   compass_DY+0, compass_DY_f+0
+        movff   compass_DY+1, compass_DY_f+1
+        movff   compass_DZ+0, compass_DZ_f+0
+        movff   compass_DZ+1, compass_DZ_f+1
+        movff   accel_DX+0,   accel_DX_f+0
+        movff   accel_DX+1,   accel_DX_f+1
+        movff   accel_DY+0,   accel_DY_f+0
+        movff   accel_DY+1,   accel_DY_f+1
+        movff   accel_DZ+0,   accel_DZ_f+0
+        movff   accel_DZ+1,   accel_DZ_f+1
+        return
+
+;-----------------------------------------------------------------------------
+; Q15 fractional numbers: a * b / 2**16 (UNSIGNED)
+;
+; Uses 16x16->16 multiply, for positiv integers, keeping only the most
+; revelant bits.
+;
+; Used to multiply two Q15 numbers, in the range 0..1,
+; represented as 0..32767, that is a / 2**15.
+;
+; (a/2**15) * (b/2**15) = a*b / 2**30 = (a*b/2**16) / 2**14.
+; So to get back a Q15 number, we need a shift-left...
+    global compass_umul
+compass_umul:
+        rcall   compass_mul_16
+
+; The 2x time, by left-shifting inserting the missing bit:
+compass_mul_2:
+        rlcf    compass_r+2,F           ; Missing bit into carry
+        rlcf    compass_r+0,F
+        rlcf    compass_r+1,F
+        movff   compass_r+0,PRODL      ; return value into ProdH:L
+        movff   compass_r+1,PRODH
+        return
+
+; The 16x16-> multiply:
+compass_mul_16:
+        banksel compass_a
+
+        movf    compass_a+1,W           ; Block ah*bh
+        mulwf   compass_b+1
+        movff   PRODL,compass_r+0       ; and copy
+        movff   PRODH,compass_r+1
+
+        movf    compass_a+0,W           ; Block al*bl
+        mulwf   compass_b+0
+        movff   PRODH,compass_r+2       ; Into fraction byte
+
+        movf    compass_a+1,W           ; Block ah*bl
+        mulwf   compass_b+0
+        movf    PRODL,W
+        addwf   compass_r+2,F           ; Fraction part to carry.
+        movf    PRODH,W                 ; and add16
+        addwfc  compass_r+0,F
+        movlw   0
+        addwfc  compass_r+1,F
+
+        movf    compass_a+0,W           ; Block al*bh
+        mulwf   compass_b+1
+        movf    PRODL,W
+        addwf   compass_r+2,F           ; Fraction part to carry.
+        movf    PRODH,W                 ; and add16
+        addwfc  compass_r+0,F
+        movlw   0
+        addwfc  compass_r+1,F
+
+        return
+
+;-----------------------------------------------------------------------------
+; Q15 fractional numbers: a * b / 2**16 (SIGNED)
+
+        global compass_imul
+compass_imul:
+        rcall   compass_mul_16
+
+        btfss   compass_b+1,7
+        bra     compass_mul_3
+
+        movf    compass_a+0,W
+        subwf   compass_r+0,F
+        movf    compass_a+1,W
+        subwfb  compass_r+1,F
+
+compass_mul_3:
+        btfss   compass_a+1,7
+        bra     compass_mul_4
+
+        movf    compass_b+0,W
+        subwf   compass_r+0,F
+        movf    compass_b+1,W
+        subwfb  compass_r+1,F
+
+compass_mul_4:
+        bcf     compass_r+1,6           ; Copy bit 7 to 6, so keep it after 2x
+        btfsc   compass_r+1,7
+        bsf     compass_r+1,6
+        bra     compass_mul_2
+
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/convert.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,260 @@
+;=============================================================================
+;
+;   File convert.asm
+;
+;   Converts register values to string
+;
+;   Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2007-10-07 : [MH]  Creation for OSTC sources
+;   2010-12-10 : [jDG] Optimize macro size
+;
+
+#include    "ostc3.inc"                  ; Mandatory header
+
+;=============================================================================
+
+        CBLOCK  tmp+0x08                ; space for aa_wordprocessor
+        	temp3
+        	temp4
+        	cvt_flags2
+            ; Reserved to tmp+0x10...
+        ENDC
+
+#define pre_zero_flag   cvt_flags2,0
+#define all_zeros_flag  cvt_flags2,1
+#define DP_done         cvt_flags2,2
+#define DP_done2        cvt_flags2,3
+#define show_last3      cvt_flags2,4
+#define leading_zeros   cvt_flags2,5
+
+basic   CODE
+
+;=============================================================================
+    global  output99_call
+output99_call:
+	clrf	ignore_digits
+	incf	ignore_digits,F
+	clrf	temp4
+
+    global  output99
+output99:
+	movlw	d'99'
+	cpfslt	lo
+	movwf	lo							; Limit to 99
+	movff	lo,lo_temp		
+	clrf	hi_temp
+	bcf		pre_zero_flag	; do not display leading zeros
+
+LCD_val99_2:	
+	movlw	b'00001010'	; 10
+	movwf	temp2		
+	clrf	temp3		
+	rcall	DEC2ASCII
+
+	movlw	b'00000001'	; 1
+	movwf	temp2		
+	clrf	temp3		
+	bsf		pre_zero_flag ; last figure, display zero (0)
+	rcall	DEC2ASCII
+	RETURN
+
+	global	output99x_call
+
+output99x_call:
+	clrf	ignore_digits
+	incf	ignore_digits,F
+	clrf	temp4
+
+	movlw	d'99'
+	cpfslt	lo
+	movwf	lo							; Limit to 99
+	movff	lo, lo_temp		
+	clrf	hi_temp
+	bsf		pre_zero_flag		; display leading zeros
+	bra		LCD_val99_2			
+	
+	global	output8_call
+
+output8_call:	
+    clrf	ignore_digits
+	incf	ignore_digits,F
+	clrf	temp4
+
+output8:
+	movff	lo, lo_temp		
+	clrf	hi_temp
+	bcf		pre_zero_flag	; do not display leading zeros
+	
+	movlw	b'01100100'	; 100
+	movwf	temp2		
+	clrf	temp3		
+	rcall	DEC2ASCII
+	bra		LCD_val99_2			
+
+	global	output16_3_call
+	global	output16_call
+	global	output16
+output16_3_call:
+	bsf		show_last3	
+output16_call:
+	clrf	ignore_digits
+	incf	ignore_digits,F
+	clrf	WREG
+output16:
+	movwf	temp4           ; Passed from output16dp macro, cleared by others.
+
+	bcf		all_zeros_flag	; do not display any zero from here unless there was at least one figure /zero
+
+	bsf		leading_zeros
+	tstfsz	temp4			; Display leading zeros at all?
+	bcf		leading_zeros
+
+	bsf		DP_done2		
+	tstfsz	temp4
+	bcf		DP_done2		; decimal point not yet set
+	
+	movff	lo, lo_temp		
+	movff	hi, hi_temp		
+	bcf		pre_zero_flag	; do not display leading zeros
+	
+	movlw	b'00010000'	; 10000s
+	movwf	temp2		 
+	movlw	b'00100111'
+	movwf	temp3		 
+	btfss	show_last3		; display only last three figures?
+	rcall	DEC2ASCII		; No, show all. Here: 5th order digit
+	
+	movlw	b'11101000'	; 1000s
+	movwf	temp2		 
+	movlw	b'00000011'
+	movwf	temp3		 
+	btfsc	DP_done2			; Is there a decimal point at all?
+	bra		output16_2			; no, use normal display mode
+
+	btfsc	all_zeros_flag		; display any zero from here
+	bra		output16_1			; there was a figure /zero already
+
+	bsf		pre_zero_flag		; display figure if zero?
+	decfsz	temp4,W		
+	bcf		pre_zero_flag		; No
+
+output16_1:
+	btfsc	DP_done				; Decimal point set already?
+	bsf		pre_zero_flag		; Yes, so display the rest
+output16_2:
+	btfss	show_last3			; display only last three figures?
+	rcall	DEC2ASCII			; No, show all. Here: 4th order digit
+	bcf		show_last3			; Yes, so display the rest
+
+	movlw	b'01100100'	; 100s
+	movwf	temp2		 
+	clrf	temp3		
+
+	btfsc	ignore_digit3		; Ignore 3rd-5th digit?
+	bra		output16_5			; Yes, skip the rest
+
+	btfsc	DP_done2			; Is there a decimal point at all?
+	bra		output16_3			; no, use normal display mode
+
+	btfsc	all_zeros_flag		; display any zero from here
+	bra		output16_2_1		; there was a figure /zero already
+
+	bsf		pre_zero_flag		; display figure if zero?
+	decfsz	temp4,W		
+	bcf		pre_zero_flag		; No
+
+output16_2_1:
+	btfsc	DP_done				; Decimal point set already?
+	bsf		pre_zero_flag		; Yes, so display the rest
+	btfsc	DP_done2			; Is there a decimal point at all?
+	bsf		pre_zero_flag		; No, so display the rest
+output16_3:
+	rcall	DEC2ASCII			;3th order digit...
+
+	movlw	b'00001010'	; 10s
+	movwf	temp2		
+	clrf	temp3		
+	btfsc	DP_done2	
+	bra		output16_4	
+
+	btfsc	all_zeros_flag		; display any zero from here
+	bra		output16_3_1		; there was a figure /zero already
+
+	bsf		pre_zero_flag
+	decfsz	temp4,W		
+	bcf		pre_zero_flag
+
+output16_3_1:
+	btfsc	DP_done		
+	bsf		pre_zero_flag
+	btfsc	DP_done2	
+	bsf		pre_zero_flag		
+output16_4:
+	btfsc	ignore_digit4		; Ignore 4-5th digit?
+	bra		output16_5			; Yes, skip the rest
+	rcall	DEC2ASCII			; 2nd order digit
+
+	movlw	b'00000001'	; 1s
+	movwf	temp2		
+	clrf	temp3		 
+	bsf		pre_zero_flag
+	btfss	ignore_digit5		; Ignore 5th digit?
+	rcall	DEC2ASCII			; 1st order digit
+	bcf		ignore_digit5		; yes, and clear flag
+output16_5:
+    bcf     ignore_digit4		; Clear flag
+	bcf		ignore_digit3		; Clear flag
+	clrf	ignore_digits
+	incf	ignore_digits,F
+	bcf		DP_done
+	RETURN						; Done with convert.asm...
+	
+DEC2ASCII	clrf	temp1		; converts into ASCII code
+DEC2ASCII_2	movf	temp3,W
+	subwf	hi_temp,W
+	btfss	STATUS,C	
+	bra		DEC2ASCII_4	
+	bnz		DEC2ASCII_3		
+
+	movf	temp2,W	
+	subwf	lo_temp,W
+	btfss	STATUS,C
+	bra		DEC2ASCII_4
+	
+DEC2ASCII_3	movf	temp3,W
+	subwf	hi_temp,F
+	movf	temp2,W
+	subwf	lo_temp,F
+	btfss	STATUS,C
+	decf	hi_temp,F
+	incf	temp1,F	
+	bsf		pre_zero_flag
+	bra		DEC2ASCII_2
+
+DEC2ASCII_4
+	decfsz	ignore_digits,F
+	return
+	incf	ignore_digits,F	; so ignore_digits stays zero for the test above
+	movlw	'0'				; Offset for Ascii-value
+	addwf	temp1,W
+	btfsc	pre_zero_flag	; is this a leading zero?
+	bra		DEC2ASCII_4_1	; no
+	btfsc	leftbind
+	bra		DEC2ASCII_6
+	movlw	' '				; instead of leading zeros a space!
+	bra		DEC2ASCII_5
+DEC2ASCII_4_1:
+	bsf		all_zeros_flag	; display any zero from here
+DEC2ASCII_5
+	movwf	POSTINC2
+DEC2ASCII_6	
+	decfsz	temp4,F			; Set decimal point?
+	RETURN					; No
+	movlw	"."				; Yes
+	movwf	POSTINC2
+	bsf		DP_done
+	RETURN
+	
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/convert.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,43 @@
+;=============================================================================
+;
+;   File convert.inc
+;
+;   Converts register values to string
+;
+;   Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2007-10-07 : [MH]  Creation for OSTC sources
+;   2010-12-10 : [jDG] Optimize macro size
+;
+
+    extern  output16_3_call
+output_16_3 macro			; displays only last three figures from a 16Bit value (0-999)
+	call 	output16_3_call
+	endm
+
+    extern  output16
+output_16dp macro temp4		; 16Bit with decimal point
+	movlw	temp4			; Temp4 stores position for decimal point
+	call 	output16
+	endm					
+
+    extern  output16_call
+output_16 macro				; 16Bit Normal
+	call 	output16_call
+	endm
+
+   extern  output8_call
+output_8 macro				; 8 Bit Normal
+ 	call    output8_call
+	endm
+
+	extern  output99_call
+output_99 macro				; displays only last two figures from a 8Bit value (0-99)
+	call 	output99_call
+	endm
+
+	extern  output99x_call
+output_99x macro			; displays only last two figures from a 8Bit value with leading zero (00-99) 
+	call 	output99x_call
+	endm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/customview.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,425 @@
+;=============================================================================
+;
+;   File customview.asm
+;
+;   Customview in Surfacemode and Divemode
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-10 : [mH] moving from OSTC code
+
+;=============================================================================
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include	"tft_outputs.inc"
+#include 	"strings.inc"
+#include 	"tft.inc"
+#include	"isr.inc"
+#include	"wait.inc"
+#include	"surfmode.inc"
+#include	"convert.inc"
+#include	"divemode.inc"
+#include    "i2c.inc"
+
+gui     CODE
+
+;=============================================================================
+; Do every-second tasks for the custom view area (Dive mode)
+
+	global	customview_second
+customview_second:
+	movff	menupos3,WREG               ; copy
+	dcfsnz	WREG,F
+	bra		customview_1sec_view1
+	dcfsnz	WREG,F
+	bra		customview_1sec_view2
+	dcfsnz	WREG,F
+	bra		customview_1sec_view3
+	dcfsnz	WREG,F
+	bra		customview_1sec_view4
+	dcfsnz	WREG,F
+	bra		customview_1sec_view5
+	; Menupos3=0, do nothing
+	return
+
+customview_1sec_view3:
+    call    TFT_decoplan                    ; Show decoplan
+    return
+customview_1sec_view2:
+    call    TFT_update_avr_stopwatch        ; Update average depth and stopwatch
+    return
+customview_1sec_view1:
+    call    TFT_update_hud                  ; Update HUD data
+    return
+customview_1sec_view4:
+    call    TFT_ead_end_tissues_clock       ; Update EAD/END, Tissues and clock
+    return
+customview_1sec_view5:
+    call    TFT_gf_info                     ; Update GF informations
+    return
+
+;=============================================================================
+; Do every-minute tasks for the custom view area
+
+	global	customview_minute
+customview_minute:
+    return
+;	movff	menupos3,WREG               ; copy
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view1
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view2
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view3
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view4
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view5
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view6
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view7
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view8
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view9
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view10
+;	dcfsnz	WREG,F
+;	bra		customview_1min_view11
+;	; Menupos3=0, do nothing
+;	return
+;
+;customview_1min_view1:
+;customview_1min_view2:
+;customview_1min_view3:
+;customview_1min_view4:
+;customview_1min_view5:
+;customview_1min_view6:
+;customview_1min_view7:
+;customview_1min_view8:
+;customview_1min_view9:
+;customview_1min_view10:
+;customview_1min_view11:
+;	return
+
+    global  surf_customview_toggle
+surf_customview_toggle:
+	bcf		switch_right
+	incf	menupos3,F			            ; Number of customview to show
+	movlw	d'6'							; Max number of customsviews in surface mode
+	cpfsgt	menupos3			            ; Max reached?
+	bra		surf_customview_mask		    ; No, show
+    movlw   .1
+	movwf   menupos3			            ; Reset to one (Always one custom view visible)
+
+    global  surf_customview_mask
+surf_customview_mask:
+    WIN_BOX_BLACK    batt_voltage_row+.16,surf_warning1_row-1, .0, surf_decotype_column-.1	; top, bottom, left, right
+	call	TFT_standard_color
+	movff	menupos3,WREG                   ; Menupos3 holds number of customview function
+	dcfsnz	WREG,F
+	bra		surf_customview_init_view1      ; OC Gas list
+	dcfsnz	WREG,F
+	bra		surf_customview_init_view2      ; CC Dil list
+	dcfsnz	WREG,F
+	bra		surf_customview_init_view3      ; CC SP list
+	dcfsnz	WREG,F
+	bra		surf_customview_init_view4      ; Custom Text
+	dcfsnz	WREG,F
+	bra		surf_customview_init_view5      ; Tissue Diagram
+	dcfsnz	WREG,F
+	bra		surf_customview_init_view6      ; Compass
+
+    call    I2C_sleep_accelerometer         ; Stop accelerometer
+    call    I2C_sleep_compass               ; Stop compass
+
+    movlw   .1
+	movwf   menupos3			            ; Reset to one (Always one custom view visible)
+
+surf_customview_init_view1:                 ; View1: OC Gas list
+    btfsc   FLAG_ccr_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_gauge_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_apnoe_mode
+    bra     surf_customview_toggle
+    call	TFT_gaslist_surfmode            ; Show gas list
+    bra		customview_toggle_exit          ; Done.
+
+surf_customview_init_view2:                 ; View2: CC Dil list
+    btfss   FLAG_ccr_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_gauge_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_apnoe_mode
+    bra     surf_customview_toggle
+    call	TFT_dillist_surfmode            ; Show diluent list
+    bra		customview_toggle_exit          ; Done.
+
+surf_customview_init_view3:                 ; View3: CC SP list
+    btfss   FLAG_ccr_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_gauge_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_apnoe_mode
+    bra     surf_customview_toggle
+    call	TFT_splist_surfmode             ; Show Setpoint list
+    bra		customview_toggle_exit          ; Done.
+
+surf_customview_init_view4:                 ; View4: Custom text
+    call	TFT_custom_text                 ; Show the custom text
+    bra		customview_toggle_exit          ; Done.
+
+surf_customview_init_view5:                 ; View5: Tissue Diagram
+    btfsc   FLAG_gauge_mode
+    bra     surf_customview_toggle
+    btfsc   FLAG_apnoe_mode
+    bra     surf_customview_toggle
+    call	TFT_surface_tissues             ; Show Tissue diagram
+    bra		customview_toggle_exit          ; Done.
+
+surf_customview_init_view6:                 ; View6: Compass
+    call    I2C_init_accelerometer          ; Start accelerometer
+    call    I2C_init_compass                ; Start compass
+    call	TFT_surface_compass_mask        ; Show compass
+    bra		customview_toggle_exit          ; Done.
+
+
+    global  menuview_toggle
+menuview_toggle:            ; Show Menu or the simulator tasks
+    movlw   divemode_menuview_timeout
+    movwf   timeout_counter3
+    bsf     menuview
+	bcf		switch_left
+	incf	menupos2,F			            ; Number of options to show
+	movlw	d'6'							; Max number of options in divemode
+	cpfsgt	menupos2			            ; Max reached?
+	bra		menuview_mask		            ; No, show
+    global  menuview_toggle_reset
+menuview_toggle_reset:                      ; Timeout occured
+	clrf	menupos2
+    bcf     menuview
+menuview_mask:
+    WIN_BOX_BLACK   divemode_simtext_row, divemode_simtext_row+.24, divemode_simtext_column, divemode_simtext_column+.49    ; top, bottom, left, right
+    btfss   FLAG_gauge_mode
+    bra     menuview_mask2
+    ; Clear some more in gauge mode
+    WIN_BOX_BLACK   divemode_simtext_row, divemode_simtext_row+.24, divemode_simtext_column+.50, divemode_simtext_column+.70    ; top, bottom, left, right
+menuview_mask2:
+    movlw   color_yellow
+    call	TFT_set_color
+    WIN_SMALL_INVERT    divemode_simtext_column,divemode_simtext_row
+	movff	menupos2,WREG                   ; Menupos2 holds number of menu option to show
+	dcfsnz	WREG,F
+	bra		menuview_view1
+	dcfsnz	WREG,F
+	bra		menuview_view2
+	dcfsnz	WREG,F
+	bra		menuview_view3
+	dcfsnz	WREG,F
+	bra		menuview_view4
+	dcfsnz	WREG,F
+	bra		menuview_view5
+	dcfsnz	WREG,F
+	bra		menuview_view6
+menuview_exit:
+    call	TFT_standard_color
+    WIN_INVERT  .0
+	return                                  ; Menupos2 = 0, Show nothing
+menuview_view1:
+	btfsc	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		menuview_toggle 				; Call next option
+	btfsc	FLAG_gauge_mode					; In Gauge mode?
+	bra		menuview_toggle 				; Call next option
+	STRCPY_TEXT_PRINT tDivePreMenu			; "Menu?"
+    bra     menuview_exit                   ; Done.
+menuview_view2:
+    btfss  	simulatormode_active			; View only for simulator mode
+	bra		menuview_toggle 				; Call next option
+	STRCPY_TEXT_PRINT tQuitSim				;"Quit Simulation?"
+    bra     menuview_exit                   ; Done.
+menuview_view3:
+    btfss  	simulatormode_active			; View only for simulator mode
+	bra		menuview_toggle 				; Call next option
+	STRCPY_TEXT_PRINT tDescent1m			; "Descent 1m"
+    bra     menuview_exit                   ; Done.
+menuview_view4:
+    btfss  	simulatormode_active			; View only for simulator mode
+	bra		menuview_toggle 				; Call next option
+	STRCPY_TEXT_PRINT tAscent1m				; "Ascend 1m"
+    bra     menuview_exit                   ; Done.
+menuview_view5:
+	btfss	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		menuview_toggle 				; No, call next option
+	btfsc	FLAG_active_descent				; Are we descending?
+	bra		menuview_toggle 				; Yes
+; We are at the surface:
+	STRCPY_TEXT_PRINT	tQuitApnea			; "Quit Apnea mode?"
+	bra     menuview_exit                   ; Done.
+menuview_view6:
+	btfss	FLAG_gauge_mode					; In Gauge mode?
+	bra		menuview_toggle 				; No, call next option
+	STRCPY_TEXT_PRINT	tDivemenu_ResetAvr  ; "Reset Avr."
+	bra     menuview_exit                   ; Done.
+
+
+;=============================================================================
+; Show next customview (and delete this flag)
+	global	customview_toggle
+customview_toggle:
+	bcf		switch_right
+	incf	menupos3,F			            ; Number of customview to show
+	movlw	d'6'							; Max number of customsviews in divemode
+	cpfsgt	menupos3			            ; Max reached?
+	bra		customview_mask		            ; No, show
+customview_toggle_reset:					; Timeout occured
+	clrf	menupos3			            ; Reset to zero (Zero=no custom view)
+customview_mask:	
+	call	TFT_clear_customview_divemode	
+	WIN_SMALL	divemode_customview_column,divemode_customview_row
+	call	TFT_standard_color
+	movff	menupos3,WREG                   ; Menupos3 holds number of customview function
+	dcfsnz	WREG,F
+	bra		customview_init_view1
+	dcfsnz	WREG,F
+	bra		customview_init_view2
+	dcfsnz	WREG,F
+	bra		customview_init_view3
+	dcfsnz	WREG,F
+	bra		customview_init_view4
+	dcfsnz	WREG,F
+	bra		customview_init_view5           ; GF informations
+	dcfsnz	WREG,F
+	bra		customview_init_view6           ; Compass
+customview_init_nocustomview:
+    call    I2C_sleep_accelerometer         ; Stop accelerometer
+    call    I2C_sleep_compass               ; Stop compass
+	bra		customview_toggle_exit	
+
+customview_init_view1:
+	btfsc	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		customview_toggle				; yes, Call next view...
+	btfss	FLAG_ccr_mode					; In CC mode?
+	bra		customview_toggle				; no, Call next view...
+
+    bsf     dive_hud1_displayed         ; Set display flag
+    bsf     dive_hud2_displayed         ; Set display flag
+    bsf     dive_hud3_displayed         ; Set display flag
+    call    TFT_hud_mask                ; Setup HUD mask
+    call    TFT_update_hud              ; Update HUD data
+	bra		customview_toggle_exit	
+
+customview_init_view2:
+	btfsc	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		customview_toggle				; Yes, Call next view...
+    call    TFT_mask_avr_stopwatch     ; Show mask for average depth and stopwatch
+    call    TFT_update_avr_stopwatch   ; Update average depth and stopwatch
+    bra		customview_toggle_exit
+
+customview_init_view3:
+	btfsc	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		customview_toggle				; Yes, Call next view...
+	btfsc	FLAG_gauge_mode					; In Gauge mode?
+	bra		customview_toggle				; Yes, Call next view...
+    call    TFT_decoplan                    ; Show decoplan
+    bra		customview_toggle_exit
+
+customview_init_view4:
+	btfsc	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		customview_toggle				; Yes, Call next view...
+	btfsc	FLAG_gauge_mode					; In Gauge mode?
+	bra		customview_toggle				; Yes, Call next view...
+    call    TFT_ead_end_tissues_clock_mask  ; Setup Mask
+    call    TFT_ead_end_tissues_clock       ; Show EAD/END, Tissues and clock
+    bra		customview_toggle_exit
+
+customview_init_view5:
+	btfsc	FLAG_apnoe_mode					; In Apnoe mode?
+	bra		customview_toggle				; Yes, Call next view...
+	btfsc	FLAG_gauge_mode					; In Gauge mode?
+	bra		customview_toggle				; Yes, Call next view...
+    call    TFT_gf_mask                     ; Setup Mask
+    call    TFT_gf_info                     ; Show GF informations
+    bra		customview_toggle_exit
+
+customview_init_view6:                      ; Compass (View 6)
+    call    I2C_init_accelerometer          ; Start accelerometer
+    call    I2C_init_compass                ; Start compass
+    call	TFT_dive_compass_mask           ; Show compass
+    bra		customview_toggle_exit
+
+customview_toggle_exit:
+	call	TFT_standard_color
+	bcf		toggle_customview			; Clear flag
+	return
+
+	global 	customview_show_change_depth
+customview_show_change_depth:       ; Put " lom" or " loft" into Postinc2
+    PUTC    " "
+    TSTOSS  opt_units   			; 0=m, 1=ft
+	bra		customview_show_mix_metric
+    movf    lo,W
+    mullw   .100                    ; convert meters to mbar
+    movff   PRODL,lo
+    movff   PRODH,hi
+    call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+    bsf     leftbind
+    output_16						; Change depth in lo:hi
+    bcf     leftbind
+    STRCAT_TEXT		tFeets
+    return
+customview_show_mix_metric:
+    output_99						; Change depth in lo
+    STRCAT_TEXT		tMeters
+    return
+
+
+	global 	customview_show_mix
+customview_show_mix:                ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+    tstfsz  hi                      ; He=0?
+    bra     customview_show_mix5    ; No, Show a TX
+	movlw	.21
+	cpfseq	lo								; Air?
+	bra		customview_show_mix2	; No
+	STRCAT_TEXT		tSelectAir				; Yes, show "Air"
+    bra     customview_show_mix4b
+customview_show_mix2:
+	movlw	.100
+	cpfseq	lo								; O2?
+	bra		customview_show_mix3	; No
+	STRCAT_TEXT		tSelectO2				; Yes, show "O2"
+    bra     customview_show_mix4b
+
+customview_show_mix3:
+	movlw	.21
+	cpfslt	lo								; < Nx21?
+	bra		customview_show_mix4    ; No
+	STRCAT_TEXT		tGasErr        	; Yes, show "Err"
+	output_99						; O2 ratio is still in "lo"
+    bra     customview_show_mix4c
+
+customview_show_mix4:
+	STRCAT_TEXT		tSelectNx		; Show "Nx"
+	output_99						; O2 ratio is still in "lo"
+customview_show_mix4b:
+    STRCAT  " "
+customview_show_mix4c:
+    btfsc   divemode                ; In divemode
+	return                          ; Yes
+    STRCAT  "  "
+    return
+
+customview_show_mix5:
+    btfsc   divemode
+    bra     customview_show_mix6
+    STRCAT_TEXT		tSelectTx   	; Show "Tx"
+customview_show_mix6:
+    output_99						; O2 ratio is still in "lo"
+    PUTC    "/"
+    movff   hi,lo
+    output_99						; He ratio
+    return
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/customview.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,25 @@
+;=============================================================================
+;
+;   File customview.inc
+;
+;   Customview for divemode and surfacemode
+;
+;   Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-08-10 : [mH] Import into OSTC3 sources
+
+    ; Dive mode
+	extern	customview_toggle
+	extern	customview_second
+	extern	customview_minute
+    extern  customview_show_mix             ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+    extern  customview_show_change_depth    ; Put " in lo m" or " in lo ft" into Postinc2
+    extern  menuview_toggle
+    extern  menuview_toggle_reset
+
+    ; Surface mode
+    extern  surf_customview_toggle
+
+;	extern	surf_customview_second
+;	extern	surf_customview_minute
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/divemenu_tree.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,219 @@
+;=============================================================================
+;
+;   File divemenu_tree.asm
+;
+;   OSTC3 dive mode menu
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2013-02-02 : [mH] Made out of menu_tree.asm
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include    "menu_processor.inc"
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include    "tft_outputs.inc"
+#include    "customview.inc"
+#include    "strings.inc"
+
+divegui     CODE
+;=============================================================================
+; Main Menu
+        global  do_main_divemenu
+do_main_divemenu:
+		call    menu_processor_reset    ; restart from first icon.
+
+do_continue_main_divemenu:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; drop exit line.
+
+        btfsc   FLAG_ccr_mode
+        bra     main_divemenu_ccr       ; CCR Menu
+
+        bcf     ccr_diluent_setup      ; For OC gases
+        bcf     is_bailout_menu
+        movlw   .1
+        movwf   menupos                 ; Set to first option in divemode menu
+    MENU_BEGIN  tMainMenu, .4
+        MENU_CALL   tDivemenu_Gaslist,  do_divemode_gaslist
+        MENU_CALL   tDivemenu_ResetAvr, do_divemode_resetavr
+        MENU_CALL   tDivemenu_ToggleGF, do_divemode_togglegf
+        MENU_CALL   tExit,              do_exit_divemode_menu
+    MENU_END
+
+main_divemenu_ccr:
+    bsf     ccr_diluent_setup      ; For diluents
+    movlw   .1
+    movwf   menupos                 ; Set to first option in divemode menu
+    MENU_BEGIN  tMainMenu, .6
+        MENU_CALL   tDiveBailout,       do_divemode_gaslist_bail
+        MENU_CALL   tDivemenu_Setpoint, do_divemode_splist
+        MENU_CALL   tDivemenu_Gaslist,  do_divemode_gaslist
+        MENU_CALL   tDivemenu_ResetAvr, do_divemode_resetavr
+        MENU_CALL   tDivemenu_ToggleGF, do_divemode_togglegf
+        MENU_CALL   tExit,              do_exit_divemode_menu
+    MENU_END
+
+
+do_togglegf:
+    TSTOSS  opt_enable_aGF          ; =1: aGF can be selected underwater
+    bra     do_exit_divemode_menu   ; exit
+    bsf     toggle_gf               ; Set flag...
+    bra     do_exit_divemode_menu   ; ...and exit
+
+do_switch_to_sensor:
+    movlw   .1                      ; Switch to Sensor
+    movff   WREG,opt_ccr_mode       ; =0: Fixed SP, =1: Sensor
+    bra     do_switch_sp2
+
+do_divemode_resetavr:
+    bsf     reset_average_depth     ; Set Flag
+    bra     do_exit_divemode_menu   ; And exit
+
+    extern  diveloop_loop4
+    extern  timeout_divemode_menu2
+do_switch_gas:
+    bsf     divemode_gaschange      ; Set flag
+do_switch_gasX:
+    btfsc   is_bailout_menu         ; Bailout confirmed?
+    bsf     is_bailout              ; =1: Bailout
+do_exit_divemode_menu:
+    call    timeout_divemode_menu2
+    clrf    STKPTR
+    goto    diveloop_loop4
+
+do_switch_sp:
+    decf    menupos,W               ; 1-5 -> 0-4
+    lfsr    FSR1,char_I_setpoint_cbar
+    movff   PLUSW1,char_I_const_ppO2; Setup fixed Setpoint
+    bsf     setpoint_changed        ; Set flag (For profile)
+
+    clrf    WREG                    ; Switch to fixed SP
+    movff   WREG,opt_ccr_mode       ; =0: Fixed SP, =1: Sensor
+    clrf    WREG
+    movff   WREG,char_O_deco_status ; Restart decoplan computation
+
+do_switch_sp2:
+    ; Clear some flags in case we were in bailout before...
+    bcf     is_bailout              ; =1: Bailout
+    bcf     is_bailout_menu         ;
+    bcf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
+    bcf     blinking_better_gas     ; Clear blinking flag
+    bra     do_exit_divemode_menu   ; And exit
+
+do_divemode_gaslist_bail:
+    bcf     ccr_diluent_setup       ; For OC gases
+    bsf     is_bailout_menu         ; =1: Bailout
+do_divemode_gaslist:
+    btfsc   is_bailout              ; In Bailout case?
+    bcf     ccr_diluent_setup       ; Yes, use OC gases
+    bsf     short_gas_decriptions
+    movlw   .1
+    movwf   menupos                 ; Set to first option in divemode menu
+    MENU_BEGIN  tGaslist, .6
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_switch_gas
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_switch_gas
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_switch_gas
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_switch_gas
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_switch_gas
+        MENU_CALL       tMore,                  do_divemode_gaslist_more0
+    MENU_END
+
+do_divemode_gaslist_more0:
+    movlw   .1
+    movwf   menupos                 ; Set to first option in divemode menu
+do_divemode_gaslist_more:
+    MENU_BEGIN  tGaslist, .6
+        MENU_DYNAMIC    gaslist_strcat_gasx,    do_dive_nothing
+        MENU_CALL       tO2Plus,                do_dive_pO2
+        MENU_CALL       tO2Minus,               do_dive_mO2
+        MENU_CALL       tHePlus,                do_dive_pHe
+        MENU_CALL       tHeMinus,               do_dive_mHe
+        MENU_CALL       tEnter,                 do_switch_gasX
+    MENU_END
+
+do_dive_nothing:
+        bra     do_divemode_gaslist_more
+
+do_dive_pO2:
+        banksel char_I_O2_ratio
+        incf    char_I_O2_ratio,F            ; O2++
+        movf    char_I_He_ratio,W
+        addwf   char_I_O2_ratio,W
+        movwf   temp_bankx400
+        movlw   .101
+        cpfslt  temp_bankx400                ; O2+He<101?
+        decf    char_I_O2_ratio,F            ; O2-- (Unchanged)
+;        bra     do_divemode_gaslist_more_common
+do_divemode_gaslist_more_common:
+        banksel common
+        bsf     gas6_changed                ; Set flag
+        bra     do_divemode_gaslist_more
+
+do_dive_mO2:
+        banksel char_I_O2_ratio
+        decf    char_I_O2_ratio,F           ; O2--
+        movlw   gaslist_min_o2
+        cpfslt  char_I_O2_ratio
+        bra     do_divemode_gaslist_more_common
+        movlw   gaslist_min_o2
+        movwf   char_I_O2_ratio
+        bra     do_divemode_gaslist_more_common
+
+
+do_dive_pHe:
+        banksel char_I_O2_ratio
+        incf    char_I_He_ratio,F            ; He++
+        movf    char_I_He_ratio,W
+        addwf   char_I_O2_ratio,W
+        movwf   lo
+        movlw   .101
+        cpfslt  lo                           ; O2+He<101?
+        decf    char_I_He_ratio,F            ; Yes, He-- (Unchanged)
+        banksel common
+        bra     do_divemode_gaslist_more_common
+
+do_dive_mHe:
+        banksel char_I_O2_ratio
+        decf    char_I_He_ratio,F           ; He--
+        bnn     do_divemode_gaslist_more_common
+        clrf    char_I_He_ratio
+        bra     do_divemode_gaslist_more_common
+
+do_divemode_splist:
+    bsf     short_gas_decriptions
+    movlw   .1
+    movwf   menupos                 ; Set to first option in divemode menu
+    MENU_BEGIN  tGaslist, .6
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_switch_sp
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_switch_sp
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_switch_sp
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_switch_sp
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_switch_sp
+        MENU_CALL   tCCRSensor,         do_divemode_sensor
+  MENU_END
+
+do_divemode_sensor:
+    ; Set customview to 1 (HUD Data)
+    clrf    menupos3                    ; customview to come-1
+    bsf     toggle_customview			; Set flag, the customview will be toggled very soon now...
+    movlw   .1
+    movwf   menupos                 ; Set to first option in divemode menu
+    MENU_BEGIN  tGaslist, .2
+        MENU_CALL       tDivemenu_UseSensor,    do_switch_to_sensor
+        MENU_CALL       tExit,                  do_continue_main_divemenu
+    MENU_END
+
+do_divemode_togglegf:
+    ; Set customview to 5 (GF informations)
+    movlw   .4
+    movwf   menupos3                    ; Customview to come-1
+    bsf     toggle_customview			; Set flag, the customview will be toggled very soon now...
+    movlw   .1
+    movwf   menupos                 ; Set to first option in divemode menu
+    MENU_BEGIN  tDivemenu_ToggleGF, .2
+        MENU_CALL       tDivemenu_ToggleGF,     do_togglegf
+        MENU_CALL       tExit,                  do_continue_main_divemenu
+    MENU_END
+
+    END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/divemode.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,1385 @@
+;=============================================================================
+;
+;   File divemode.asm
+;
+;   Divemode
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-15 : [mH] moving from OSTC code
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include 	"shared_definitions.h"         ; Mailbox from/to p2_deco.c
+#include	"tft_outputs.inc"
+#include 	"strings.inc"
+#include 	"tft.inc"
+#include	"eeprom_rs232.inc"
+#include	"isr.inc"
+#include	"math.inc"
+#include	"wait.inc"
+#include	"customview.inc"
+#include	"start.inc"
+#include	"adc_lightsensor.inc"
+#include	"ghostwriter.inc"
+#include    "i2c.inc"
+
+gui     CODE
+
+	global	diveloop
+diveloop:
+    banksel common
+	call	speed_normal
+	call	diveloop_boot			; Boot tasks for all modes
+
+; Startup Tasks for all modes
+	call	TFT_ClearScreen			; clean up TFT
+	call	TFT_divemode_mask		; Display mask
+	call	TFT_temp_divemode		; Displays temperature
+
+	btfsc	FLAG_apnoe_mode
+	bsf		realdive					; Set Realdive flag in Apnoe mode
+
+	btfsc	FLAG_apnoe_mode             ; Done for Apnoe or Gauge mode
+    bra     diveloop_loop
+	btfsc	FLAG_gauge_mode             ; Done for Apnoe or Gauge mode
+	bra     diveloop_loop
+
+	call	TFT_active_gas_divemode     ; Display gas/Setpoint
+	call	TFT_display_ndl_mask		; display "NDL"
+
+	; +@5 init
+    setf        WREG                    ; WAIT marker: display "---"
+    movff       WREG,int_O_extra_ascenttime+0
+    movff       WREG,int_O_extra_ascenttime+1
+	movlw       1
+    movwf       apnoe_mins              ; Start compute after next cycle.
+
+;--------------------------------------------------------------------------------------------------------
+diveloop_loop:		; The diveloop starts here
+	btfss	onesecupdate					
+	bra		diveloop_loop3
+
+; tasks any new second...
+	btfsc	FLAG_apnoe_mode					; Only in apnoe mode
+	bra		diveloop_loop1b					; One Second Tasks in Apnoe mode
+
+	call	TFT_divemins					; Display (new) divetime!
+	call	customview_second				; Do every-second tasks for the custom view area
+
+; Tasks only for deco modes
+	call	calc_deko_divemode				; calculate decompression and display result (any two seconds)
+	bra		diveloop_loop1x					; Common Tasks
+
+diveloop_loop1b:
+; Tasks only for Apnoe mode
+	call	divemode_apnoe_tasks			; 1 sec. Apnoe tasks
+	bra		diveloop_loop1x					; Common Tasks
+
+diveloop_loop1x:
+; Common 1sec. tasks for all modes
+	call	timeout_divemode				; dive finished? This routine sets the required flags
+	call	set_dive_modes                  ; tests if depth>threshold
+	call	set_min_temp                    ; store min. temp if required
+
+	btfsc	store_sample					; store new sample?
+	call	store_dive_data					; Store profile data
+
+	btfss	divemode						; Dive finished?
+	goto	ghostwriter_end_dive    		; Dive finished!
+
+    btfsc   divemode_gaschange              ; Gas switch flag set?
+    rcall   gas_switched_common             ; Yes
+
+    btfsc   toggle_gf                       ; =1: Toggle GF/aGF
+    rcall   divemodemode_togglegf           ; Toggle aGF/GF
+
+;    btfsc   FLAG_ccr_mode                   ; In CCR mode
+;    call    TFT_active_gas_divemode         ; Update Setpoint every second
+
+	bcf		onesecupdate					; one seconds update done
+
+diveloop_loop3:
+	rcall	test_switches_divemode			; Check switches in divemode
+
+    global  diveloop_loop4
+diveloop_loop4:                             ; Menu-Exit returns here...
+	btfsc	toggle_customview				; Next view?
+	call	customview_toggle				; Yes, show next customview (and delete this flag)
+
+	btfsc	pressure_refresh				; new pressure available?
+	rcall	update_temp_and_or_depth        ; Yes, display new depth and clear 	"pressure_refresh" flag
+
+	btfsc	oneminupdate					; one minute tasks
+	rcall	update_divemode60				; Update clock, etc.
+
+    btfss   quarter_second_update
+    bra     diveloop_loop4a
+    bcf     quarter_second_update
+    movlw   .6
+    cpfseq  menupos3                    ; in compass view?
+    bra     diveloop_loop4a             ; No
+    call    TFT_dive_compass_heading    ; Yes, update compass heading value
+diveloop_loop4a:
+    btfsc   enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+    bra     diveloop_loop5
+    bra     diveloop_loop6
+diveloop_loop5:
+    btfss   vusb_in                     ; USB (still) plugged in?
+    bcf     enable_screen_dumps         ; No, clear flag
+    call    rs232_get_byte
+    btfsc   rs232_recieve_overflow
+    bra     diveloop_loop6
+    movlw   "l"
+    cpfseq	RCREG1
+    bra     diveloop_loop6
+    call    TFT_dump_screen             ; Dump the screen contents
+diveloop_loop6:
+
+	bra		diveloop_loop					; Loop the divemode
+;--------------------------------------------------------------------------------------------------------
+
+
+
+
+
+
+divemode_apnoe_tasks:                       ; 1 sec. Apnoe tasks
+	call	TFT_display_apnoe_descent		; Show descent timer
+	call	TFT_max_pressure				; use normal max. depth
+
+	btfsc	divemode2						; Time running?
+	bra		divemode_apnoe_tasks2			; New descent, reset data if flag is set
+
+	rcall	apnoe_calc_maxdepth
+	call	TFT_display_apnoe_surface
+	call	TFT_display_apnoe_last_max		; Show last max. depth
+	incf	apnoe_surface_secs,F
+	movlw	d'60'
+	cpfseq	apnoe_surface_secs
+	bra		divemode_apnoe_tasks1
+	clrf	apnoe_surface_secs
+	incf	apnoe_surface_mins,F
+
+divemode_apnoe_tasks1:	
+	bcf		FLAG_active_descent				; Clear flag
+	btfsc	divemode2						; Time running?
+	return									; Yes, return
+	bsf		FLAG_active_descent				; Set Flag
+	return
+
+divemode_apnoe_tasks2:
+	btfss	FLAG_active_descent				; Are we descending?
+	return									; No, We are at the surface
+	rcall	apnoe_calc_maxdepth				; Yes!
+	call	TFT_apnoe_clear_surface			; Clear Surface timer
+	clrf	apnoe_timeout_counter			; Delete timeout
+	clrf	apnoe_surface_secs
+	clrf	apnoe_surface_mins
+	clrf	apnoe_secs
+	clrf	apnoe_mins						; Reset Descent time
+	movlw	.0
+	movff	WREG,max_pressure+0
+	movff	WREG,max_pressure+1				; Reset Max. Depth
+	bcf		FLAG_active_descent				; Clear flag
+	return
+
+	global	apnoe_calc_maxdepth
+apnoe_calc_maxdepth:
+	movff	apnoe_max_pressure+0,sub_a+0
+	movff	apnoe_max_pressure+1,sub_a+1
+	movff	max_pressure+0,sub_b+0
+	movff	max_pressure+1,sub_b+1
+	call	subU16				; sub_c = sub_a - sub_b
+								; apnoe_max_pressure<max_pressure -> neg_flag=1
+								; max_pressure<=apnoe_max_pressure -> neg_flag=0
+	btfss	neg_flag	
+	return
+								;apnoe_max_pressure<max_pressure
+	movff	max_pressure+0,apnoe_max_pressure+0
+	movff	max_pressure+1,apnoe_max_pressure+1
+	return
+
+
+calc_deko_divemode:
+	btfsc	twosecupdate			; two seconds after the last call
+	bra		calc_deko_divemode2		; Yes, calculate and display deco data ("first second")
+
+	bsf		twosecupdate			; No, but next second!
+	; Routines used in the "other second"
+	call	calc_average_depth          ; calculate average depth
+	call	calc_velocity               ; calculate vertical velocity and display if > threshold (every two seconds)
+	call	divemode_check_for_warnings		; Check for any warnings
+	call	TFT_debug_output
+
+	btfsc	FLAG_apnoe_mode             ; Done for Apnoe or Gauge mode
+    return
+	btfsc	FLAG_gauge_mode             ; Done for Apnoe or Gauge mode
+	return
+
+; Calculate CNS
+    rcall   set_actual_ppo2             ; Set char_I_actual_ppO2
+    clrf    WREG
+    movff   WREG,char_I_step_is_1min    ; Make sure to be in 2sec mode.
+	call	deco_calc_CNS_fraction		; calculate CNS
+	movlb	b'00000001'					; rambank 1 selected
+
+; Check for a gas change
+	rcall	check_gas_change			; Checks if a better gas should be selected (by user)
+
+ 	return
+
+    global  set_actual_ppo2
+set_actual_ppo2:                        ; calculate ppO2 in 0.01bar (e.g. 150 = 1.50 bar ppO2)
+    SAFE_2BYTE_COPY amb_pressure, xA    ; P_amb in millibar (1000 = 1.00 bar).
+	movlw		d'10'
+	movwf		xB+0
+	clrf		xB+1
+	call		div16x16				; xC=p_amb/10 (100 = 1.00 bar).
+	movff		xC+0,xA+0
+	movff		xC+1,xA+1
+	movff		char_I_O2_ratio,xB+0
+	clrf		xB+1
+	call		mult16x16				; char_I_O2_ratio * (p_amb/10)
+	movff		xC+0,xA+0
+	movff		xC+1,xA+1
+	movlw		d'100'
+	movwf		xB+0
+	clrf		xB+1
+	call		div16x16				; xC=(char_I_O2_ratio * p_amb/10)/100
+
+; Copy ppO2 for CNS calculation
+    tstfsz      xC+1                    ; Is ppO2 > 2.55bar ?
+    setf        xC+0                    ; yes: bound to 2.55... better than wrap around.
+
+    movff		xC+0, char_I_actual_ppO2	; copy last ppO2 to buffer register
+    btfsc       is_bailout                  ; In Bailout?
+    return                                  ; Yes, done.
+    ; No Bailout, check for ccr mode
+    btfsc		FLAG_ccr_mode               ; If FLAG_ccr_mode=1...
+    movff		char_I_const_ppO2, char_I_actual_ppO2	; ...copy last ppO2 to buffer register
+    return
+
+
+calc_deko_divemode2:
+	bcf		twosecupdate		
+
+	btfsc	FLAG_apnoe_mode             ; Done for Apnoe or Gauge mode
+    return
+	btfsc	FLAG_gauge_mode             ; Done for Apnoe or Gauge mode
+	return
+
+	extern	deco_setup_dive
+	call	deco_setup_dive				;  Pass all parameters to the C code
+
+    TSTOSS  opt_ccr_mode                    ; =0: Fixed SP, =1: Sensor
+    bra     calc_deko_divemode2a
+    rcall   divemode_setup_sensor_values    ; Setup sensor values
+
+calc_deko_divemode2a:
+	SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; C-code needs the ambient pressure
+	clrf	WREG
+	movff	WREG,char_I_step_is_1min    ; Force 2 second deco mode
+
+    clrf    TMR5L
+    clrf    TMR5H                       ; 30,51757813µs/bit in TMR5L:TMR5H
+	call	deco_calc_hauptroutine		; calc_tissue
+    movlb   .1
+
+    movff   char_O_deco_status,WREG     ; Is a compute cycle finished ?
+    iorwf   WREG,F
+    btfss   STATUS,Z
+    return                              ; Return is status <> 0
+
+    ; Check if deco stops are necessary ?
+	movff	char_O_first_deco_depth,wait_temp	; copy ceiling to temp register
+	tstfsz	wait_temp							; Ceiling<0m?
+	bra		calc_deko_divemode3					; Yes!
+
+	btfsc	decostop_active             ; Already in nodeco mode ?
+	call	TFT_display_ndl_mask       	; No, Clear deco data, display nostop time
+	bcf		decostop_active             ; clear flag (again)
+
+	; Copy for profile recording
+	clrf	decodata+0
+	movff	char_O_nullzeit,decodata+1  ; NDL
+	
+	call	TFT_display_ndl            ; display no deco limit
+	return
+
+calc_deko_divemode3:
+	btfss	decostop_active            ; Already in deco mode ?
+	call	TFT_display_deko_mask      ; No, clear nostop time, display decodata
+	bsf		decostop_active            ; Set flag (again)
+
+	; Copy for profile recording
+	movff	char_O_first_deco_depth,decodata+0	; ceiling
+	movff	char_O_first_deco_time,decodata+1	; length of first stop in minues
+	call	TFT_display_deko            ; display decodata
+	call	TFT_show_TTS_divemode       ; display TTS
+
+    movff   char_I_extra_time,WREG
+    tstfsz  WREG                    ; extra time = 0?
+    bra     calc_deko_divemode4     ; No, compute it
+    return
+
+calc_deko_divemode4:
+    ; Check if extra cycles are needed to compute @5 variant:
+	decfsz  apnoe_mins,F                ; Reached count-down ?
+	return                              ; No: don't compute yet.
+	
+	movlw   .6
+	movff   WREG,char_O_deco_status     ; Stole next cycles for @5 variant.
+    
+    movlw   .2                          ; Restart countdown.
+    movwf   apnoe_mins
+ 	return                              ; done.
+   
+;-----------------------------------------------------------------------------
+
+divemodemode_togglegf:                  ; Toggle aGF/GF
+    bcf     toggle_gf                   ; clear flag    
+    btg     use_agf                     ; Toggle GF
+    call    TFT_gf_mask                 ; Setup Mask
+    clrf    WREG
+    movff   WREG,char_O_deco_status     ; Restart decoplan computation
+    return
+
+divemode_setup_sensor_values:
+    ; sum up sensor values (in xA:2) and active sensors in (xB:2)
+    clrf    xB+0
+    clrf    xB+1
+    clrf    xA+0
+    clrf    xA+1
+    btfss   hud_status_byte,3               ; Sensor1 active?
+    bra     divemode_setup_sensor_values2   ; No
+    movf    o2_ppo2_sensor1,W
+    addwf   xA+0
+    movlw   .0
+    addwfc  xA+1                            ; Add into xA:2
+    incf    xB+0,F                          ; Add a sensor
+divemode_setup_sensor_values2:
+    btfss   hud_status_byte,4               ; Sensor2 active?
+    bra     divemode_setup_sensor_values3   ; No
+    movf    o2_ppo2_sensor2,W
+    addwf   xA+0
+    movlw   .0
+    addwfc  xA+1                            ; Add into xA:2
+    incf    xB+0,F                          ; Add a sensor
+divemode_setup_sensor_values3:
+    btfss   hud_status_byte,5               ; Sensor3 active?
+    bra     divemode_setup_sensor_values4   ; No
+    movf    o2_ppo2_sensor3,W
+    addwf   xA+0
+    movlw   .0
+    addwfc  xA+1                            ; Add into xA:2
+    incf    xB+0,F                          ; Add a sensor
+divemode_setup_sensor_values4:
+    call    div16x16						; xA/xB=xC with xA+0 as remainder
+    movff   xC+0,sensor_setpoint            ; Copy result
+    movff   sensor_setpoint,char_I_const_ppO2 ; use sensor ppO2
+    return
+
+calc_velocity:								; called every two seconds
+	btfss	divemode						
+	bra		do_not_display_velocity			; display velocity only in divemode (Not at the surface after dive)
+
+calc_velocity2:
+    SAFE_2BYTE_COPY amb_pressure, sub_a
+	movff	last_pressure_velocity+0,sub_b+0
+	movff	last_pressure_velocity+1,sub_b+1
+	movff	sub_a+0,last_pressure_velocity+0	; store old value for velocity
+	movff	sub_a+1,last_pressure_velocity+1
+
+	call	subU16						; sub_c = amb_pressure - last_pressure
+
+	movff	sub_c+0,xA+0
+	movff	sub_c+1,xA+1
+	movlw	d'39'						; 77 when called every second....
+	movwf	xB+0
+	clrf	xB+1
+	call	mult16x16					; differential pressure in mbar*77...
+	movff	xC+0,divA+0
+	movff	xC+1,divA+1
+	movlw	d'7'
+	movwf	divB+0
+	call	div16						; devided by 2^7 equals velocity in m/min
+
+	movlw	d'99'
+	cpfsgt	divA+0                      ; limit to 99m/min
+	bra		calc_velocity3
+	movwf	divA+0						; divA=99
+
+calc_velocity3:
+	movlw	velocity_warning_level_1	; lowest threshold for display vertical velocity
+	subwf	divA+0,W					; 
+	btfss	STATUS,C
+	bra		do_not_display_velocity
+
+	bsf		display_velocity
+	call	TFT_display_velocity		; With divA+0 = m/min...
+	return
+
+do_not_display_velocity:
+	btfss	display_velocity			; Velocity was not displayed, do not delete
+	return
+	bcf		display_velocity			; Velocity was displayed, delete velocity now
+	call	TFT_display_velocity_clear
+	return
+
+;=============================================================================
+
+timeout_menuview:
+    decfsz  timeout_counter3,F          ; timeout for menuview
+    return                              ; No timeout, return
+    ; Timeout, clear e.g. "Menu?"
+    goto    menuview_toggle_reset       ; "returns"
+
+timeout_divemode_menu:
+    decfsz  timeout_counter3,F          ; timeout for divemode menu
+    return
+
+    global  timeout_divemode_menu2
+timeout_divemode_menu2:                 ; Called from divemenu_tree.asm
+    bcf     divemode_menu               ; Timeout! Clear flag
+    call    TFT_clear_divemode_menu     ; Clear menu
+    call    TFT_active_gas_divemode     ; Redraw gas/setpoint/diluent
+    bcf     blinking_better_gas         ; Clear flag to have temperature updated once
+    call	TFT_temp_divemode           ; Displays temperature
+
+    btfss   decostop_active             ; In deco mode ?
+    bra     timeout_divemode_menu_ndl   ; No, show NDL again
+    ; Show deco
+	call	TFT_display_deko_mask      ; clear nostop time, display decodata
+    call    TFT_display_deko
+    call    TFT_show_TTS_divemode
+    return
+timeout_divemode_menu_ndl:              ; Show NDL
+	call	TFT_display_ndl_mask       	; Clear deco data, display nostop time
+    call    TFT_display_ndl
+    return
+
+timeout_divemode:
+    btfsc   divemode_menu               ; Divemode menu active?
+    rcall   timeout_divemode_menu       ; Yes, check the timeout for it...
+
+    btfsc   menuview                    ; is a menuview shown?
+    rcall   timeout_menuview            ; Yes, check the timeout for it...
+
+	btfss	realdive					; Dive longer then one minute
+	return
+	
+	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
+	bra		timeout_divemode2			; Yes, use CF30 [min] for timeout
+
+    ifndef __DEBUG
+    	btfsc	simulatormode_active    ; In Simulator mode?
+    	bra		timeout_divemode3       ; Yes, use simulator timeout
+    endif
+	
+	bcf		divemode
+	incf	timeout_counter,F
+	movlw	d'0'
+	addwfc	timeout_counter2,F			; timeout is 15bits
+
+	movlw	LOW		divemode_timeout
+	movwf	sub_a+0
+	movlw	HIGH	divemode_timeout
+	movwf	sub_a+1
+
+	movff	timeout_counter, sub_b+0
+	movff	timeout_counter2, sub_b+1
+	call	subU16						;  sub_c = sub_a - sub_b
+	btfss	neg_flag					; Result negative?
+	bsf		divemode					; No, set flag
+	return
+
+timeout_divemode2:
+	incf	timeout_counter,F			; seconds...
+	movlw	d'60'
+	cpfseq	timeout_counter				; timeout_counter=60?
+	return								; No.
+; One minute timeout done.
+	clrf	timeout_counter
+	bcf		divemode
+	incf	apnoe_timeout_counter,F
+	movlw	apnoe_timeout				; apnoe timeout [min]
+	cpfseq	apnoe_timeout_counter
+	bsf		divemode
+	return
+
+timeout_divemode3:
+	bcf		divemode
+	incf	timeout_counter,F
+	movlw	simulator_timeout   		; simulator timeout
+	cpfsgt	timeout_counter
+	bsf		divemode
+	return
+
+update_temp_and_or_depth:			    ; New sensor data arrived...
+	btfsc	temp_changed	
+	call	TFT_temp_divemode		    ; Displays temperature
+
+	btfsc	pressure_refresh
+	call	TFT_depth					; Displays new depth
+
+	rcall	set_max_depth               ; update max. depth if required
+	bcf		pressure_refresh			; until new pressure is available
+	return
+
+update_divemode60:                      ; update any minute
+	call	get_battery_voltage			; gets battery voltage
+	call	set_powersafe				; Battery low?
+	call	TFT_max_pressure			; Update max. depth
+	call	customview_minute			; Do every-minute tasks for the custom view area
+	bcf		oneminupdate
+
+    btfss   simulatormode_active        ; in simulator mode?
+	return                              ; No
+	; Yes, quite dive mode simulation after 21*256s=89min:36s
+	movlw	.20
+	cpfsgt	total_divetime_seconds+1	; Timeout?
+	return                              ; No
+    ifdef __DEBUG
+    return                              ; No simulator timeout in debug mode
+    endif
+	bra		divemode_option1            ; Yes, set to 0m and "return"
+
+set_max_depth:
+	movff	max_pressure+0,sub_a+0
+	movff	max_pressure+1,sub_a+1
+    SAFE_2BYTE_COPY rel_pressure, sub_b
+	call	subU16                      ; sub_c = sub_a - sub_b
+                                        ; max_pressure<rel_pressure -> neg_flag=1
+                                        ; rel_pressure<=max_pressure -> neg_flag=0
+	btfss	neg_flag	
+	return
+                                        ; max_pressure<rel_pressure
+	movff	sub_b+0,max_pressure+0
+	movff	sub_b+1,max_pressure+1
+	call	TFT_max_pressure			; No, use normal max. depth
+	return
+
+set_min_temp:
+	movff	minimum_temperature+0,sub_a+0
+	movff	minimum_temperature+1,sub_a+1
+    SAFE_2BYTE_COPY temperature,sub_b
+	call	sub16                       ; sub_c = sub_a - sub_b
+                                        ; minimum_temperature<T -> neg_flag=1
+                                        ; T<=minimum_temperature -> neg_flag=0
+	btfsc	neg_flag	
+	return
+                                        ; minimum_temperature>=T
+	movff	sub_b+0,minimum_temperature+0
+	movff	sub_b+1,minimum_temperature+1
+	return
+
+	global	set_dive_modes
+set_dive_modes:
+	btfsc	high_altitude_mode		; In high altitude (Fly) mode?
+	bra		set_dive_modes3			; Yes!
+
+set_dive_modes0:
+	movlw	LOW		start_dive_threshold
+	movwf	sub_a+0					; dive_treshold is in cm
+	movlw	HIGH	start_dive_threshold
+	movwf	sub_a+1					; dive_treshold is in cm
+
+set_dive_modes1:
+    SAFE_2BYTE_COPY rel_pressure, sub_b
+	call	subU16					; sub_c = sub_a - sub_b
+
+	btfss	neg_flag	
+	bra		set_dive_modes2			; too shallow (rel_pressure<dive_threshold)
+
+	btfsc	realdive				; Dive longer than one minute?
+	clrf 	timeout_counter			; Yes, reset timout counter
+
+set_dive_modes_common:
+	bsf		divemode				; (Re-)Set divemode flag
+	bsf		divemode2				; displayed divetime is running
+	return
+
+set_dive_modes2:
+	bcf		divemode2				; Stop time
+	btfss	realdive				; dive longer then one minute?
+	bcf		divemode				; no -> this was no real dive
+	return							; No, return
+
+
+set_dive_modes3:					; High-altitude mode
+	btfsc	realdive				; dive longer then one minute?
+	bra		set_dive_modes0			; Yes -> this is a real dive -> Use start_dive_threshold or ascend
+
+	movlw	HIGH	high_altitude_dive_threshold
+	movwf	sub_a+1
+	movlw	LOW		high_altitude_dive_threshold
+	movwf	sub_a+0
+	bra		set_dive_modes1
+
+set_powersafe:
+    movlw   color_code_battery_low+1; [%]
+    cpfslt  batt_percent
+	return
+
+	movlw	d'7'					; Type of Alarm (Battery Low)
+	movwf	AlarmType				; Copy to Alarm Register
+	bsf		event_occured			; Set Event Flag
+    movlw   .0
+    movff   WREG,opt_brightness     ; Set Brightness to ECO
+	return							; return
+
+calc_average_depth:
+	btfsc	reset_average_depth		; Reset the Avewrage depth?
+	rcall	reset_average1			; Reset the resettable average depth
+
+	; 1. Add new 2xdepth to the Sum of depths registers
+    SAFE_2BYTE_COPY rel_pressure, xB	; Buffer...
+    bcf     STATUS,C
+    rlcf    xB+0,F
+    rlcf    xB+1,F                  ; x2
+
+	movf	xB+0,w
+	addwf	average_depth_hold+0,F
+	movf	xB+1,w
+	addwfc	average_depth_hold+1,F
+	movlw	d'0'
+	addwfc	average_depth_hold+2,F
+	addwfc	average_depth_hold+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
+
+; Do the same for the _total registers (Non-Resettable)
+	movf	xB+0,w
+	addwf	average_depth_hold_total+0,F
+	movf	xB+1,w
+	addwfc	average_depth_hold_total+1,F
+	movlw	d'0'
+	addwfc	average_depth_hold_total+2,F
+	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
+
+	; 2. Compute Average Depth on base of average_divesecs:2
+	movff	average_divesecs+0,xB+0
+	movff	average_divesecs+1,xB+1		; Copy
+	movff	average_depth_hold+0,xC+0
+	movff	average_depth_hold+1,xC+1
+	movff	average_depth_hold+2,xC+2
+	movff	average_depth_hold+3,xC+3
+
+	call	div32x16 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,avr_rel_pressure+0
+	movff	xC+1,avr_rel_pressure+1
+
+	; 3. Compute Total Average Depth on base of total_divetime_seconds:2
+	movff	total_divetime_seconds+0,xB+0
+	movff	total_divetime_seconds+1,xB+1		; Copy
+	movff	average_depth_hold_total+0,xC+0
+	movff	average_depth_hold_total+1,xC+1
+	movff	average_depth_hold_total+2,xC+2
+	movff	average_depth_hold_total+3,xC+3
+	call	div32x16 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,avr_rel_pressure_total+0
+	movff	xC+1,avr_rel_pressure_total+1
+
+;	; Compute Total Average Depth on base of divemins:2 and divesecs
+;	movff	divemins+0,xA+0
+;	movff	divemins+1,xA+1
+;	movlw	d'60'
+;	movwf	xB+0
+;	clrf	xB+1
+;	call	mult16x16				; xC:4=xA:2*xB:2
+;	movf	divesecs,W
+;	addwf	xC+0,F
+;	movlw	d'0'
+;	addwfc	xC+1,F					; xC:2 holds total dive seconds
+;	movlw	d'3'					; 2+1
+;	btfss	divesecs,0				; divesecs even?
+;	movlw	d'2'					; Yes, do not add +1
+;	addwf	xC+0,F
+;	movlw	d'0'
+;	addwfc	xC+1,F
+;	; Ignore xC+2 and xC+3. Total Average will only work up to divetime=1092:16
+;	movff	xC+0,xB+0
+;	movff	xC+1,xB+1		; Copy
+;	movff	average_depth_hold_total+0,xC+0
+;	movff	average_depth_hold_total+1,xC+1
+;	movff	average_depth_hold_total+2,xC+2
+;	movff	average_depth_hold_total+3,xC+3
+;
+;	call	div32x16 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+;	movff	xC+0,avr_rel_pressure_total+0
+;	movff	xC+1,avr_rel_pressure_total+1
+
+	return
+
+reset_average1:
+	clrf	average_depth_hold+0
+	clrf	average_depth_hold+1
+	clrf	average_depth_hold+2
+	clrf	average_depth_hold+3		; Clear average depth register
+	movlw	d'2'
+	movwf	average_divesecs+0
+	clrf	average_divesecs+1
+	bcf		reset_average_depth			; Clear flag
+	return
+
+test_switches_divemode:		; checks switches in divemode
+    btfsc   divemode_menu               ; Divemode menu shown?
+    bra     test_switches_divemode_menu ; Yes, use menu processor
+	btfsc	switch_left
+	bra		test_switches_divemode2		; Enter button pressed, check if we need to do something
+	btfss	switch_right
+	return                              ; No button press
+    tstfsz  menupos2                    ; any option shown?
+    bra     test_switches_divemode1     ; Yes, do option tasks
+	bsf		toggle_customview           ; No, toggle custom view
+    return
+
+test_switches_divemode_menu:
+	btfsc	switch_left
+	bra		test_switches_divemode_menu2    ; Move cursor
+	btfsc	switch_right
+    bra		test_switches_divemode_menu3    ; Enter submenu or do something
+    return                                  ; No button press
+
+test_switches_divemode_menu1:
+    clrf    menupos
+test_switches_divemode_menu2:
+    incf    menupos,F
+    incf    menupos4,W                  ; menupos4+1 -> WREG
+    cpfslt  menupos                     ; >menupos4 (Set in menu_processor.asm)?
+    bra     test_switches_divemode_menu1; > Yes, set to 1
+    call    TFT_divemode_menu_cursor    ; Update the cursor
+    bcf     switch_left
+	movlw	divemode_menu_timeout       ; Reload timeout
+	movwf	timeout_counter3            ; timeout for divemode menu
+    return
+
+test_switches_divemode_menu3:           ; Enter submenu or do something
+    bcf     switch_right
+;    decf    menupos,F                   ; menu_processor needs 0-5...
+    extern  do_line_menu
+    goto    do_line_menu                ; Warning! Trashes STKPTR and returns to diveloop_loop4:
+
+test_switches_divemode1:
+	bcf		switch_right
+    movlw   divemode_menuview_timeout
+    movwf   timeout_counter3            ; Reload timeout
+	movff	menupos2,WREG               ; Menupos3 holds number of customview/divemode menu function
+	dcfsnz	WREG,F
+    bra		divemode_option0			; Start/Setup Divemode menu
+	dcfsnz	WREG,F
+	bra		divemode_option1			; Quit Simulation?
+	dcfsnz	WREG,F
+	bra		divemode_option2			; Descent 1m
+	dcfsnz	WREG,F
+	bra		divemode_option3			; Ascend 1m
+	dcfsnz	WREG,F
+	bra		divemode_option4			; Quit Apnoe mode
+	dcfsnz	WREG,F
+	bra		divemode_option5			; Reset Stopwatch (In Gauge mode)
+    return
+
+test_switches_divemode2:
+	bcf		switch_left
+    call    menuview_toggle         ; Menu or Simulator tasks
+    return
+
+gas_switched_common:
+    decf    menupos,W               ; 1-5 -> 0-4
+    btfss   FLAG_ccr_mode           ; Choose OC Gases
+    rcall   setup_gas_registers     ; With WREG=Gas 0-4
+    btfsc   FLAG_ccr_mode           ; Choose CC Diluents
+    rcall   setup_dil_registers     ; With WREG=Gas 0-4
+
+    decf    menupos,W               ; 1-5 -> 0-4
+    btfsc   is_bailout              ; Choose OC Bailouts (OC Gases)
+    rcall   setup_gas_registers     ; With WREG=Gas 0-4
+
+    call	TFT_active_gas_divemode	; Display gas/Setpoint
+	bsf		event_occured			; Set global event byte
+	bsf		stored_gas_changed		; Set Flag for profile
+    bcf     divemode_gaschange      ; Clear flag
+    clrf    WREG
+    movff   WREG,char_O_deco_status ; Restart decoplan computation
+	return
+
+    global  setup_gas_registers
+setup_gas_registers:                ; With WREG=Gas 0-4
+    lfsr    FSR1,opt_gas_O2_ratio+0
+    movff   PLUSW1,char_I_O2_ratio  ; O2 (For ppO2 calculations)
+    lfsr    FSR1,opt_gas_He_ratio+0
+    movff   PLUSW1,char_I_He_ratio  ; He
+    incf    WREG,W                  ; Gas# 1-5
+	movff	WREG,char_I_current_gas	; Set gas
+	movff	WREG,active_gas			; Set for logbook and display
+    banksel char_I_O2_ratio
+	movf    char_I_O2_ratio,W       ; Add O2...
+    addwf   char_I_He_ratio,W       ; ...and He...
+	sublw   .100                    ; ...subtract both from 100
+	movwf   char_I_N2_ratio         ; -> N2!
+    banksel common
+    return
+
+    global  setup_dil_registers
+setup_dil_registers:                ; With WREG=dil 0-4
+    lfsr    FSR1,opt_dil_O2_ratio+0
+    movff   PLUSW1,char_I_O2_ratio  ; O2 (For ppO2 calculations)
+    lfsr    FSR1,opt_dil_He_ratio+0
+    movff   PLUSW1,char_I_He_ratio  ; He
+    incf    WREG,W                  ; Gas# 1-5
+	movff	WREG,char_I_current_gas	; Set gas
+	movff	WREG,active_gas			; Set for logbook and display
+    banksel char_I_O2_ratio
+	movf    char_I_O2_ratio,W       ; Add O2...
+    addwf   char_I_He_ratio,W       ; ...and He...
+	sublw   .100                    ; ...subtract both from 100
+	movwf   char_I_N2_ratio         ; -> N2!
+    banksel common
+    return
+
+divemode_option0:                   ; Start/Setup Divemode menu
+    call    TFT_clear_divemode_menu ; Clear menu area
+    bcf     menuview
+    extern  do_main_divemenu
+    call    do_main_divemenu
+    global  divemode_option0_return
+divemode_option0_return:
+;    movlw   .1
+;    movwf   menupos                 ; Set to first option in divemode menu
+    call    TFT_divemode_menu_cursor; Show the cursor
+	movlw	divemode_menu_timeout
+	movwf	timeout_counter3        ; timeout for divemode menu
+    bsf     divemode_menu           ; Set flag
+    clrf    menupos2                ; Clear option counter
+    bra     diveloop_loop4          ; Goto back to diveloop (Menuprocessor trashes STKPTR!)
+
+divemode_option4:
+	movlw	d'58'					; two seconds left
+	movwf	timeout_counter
+	movlw	apnoe_timeout-1			; apnoe timeout [min]
+	movwf	apnoe_timeout_counter
+    btfss   simulatormode_active	; in simulator mode?
+	return							; No
+divemode_option1:						; Quit simulation mode
+	banksel	isr_backup
+    movlw   low     .1000
+    movwf	sim_pressure+0
+    movlw   high    .1000
+	movwf   sim_pressure+1			; Set to 0m -> End of Dive
+	banksel common
+    call    menuview_toggle_reset   ; Reset to zero (Zero=no menuview)
+	
+	btfss	FLAG_apnoe_mode			; In Apnoe mode?
+	return							; No
+	movlw	d'58'					; two seconds left
+	movwf	timeout_counter
+	movlw	apnoe_timeout-1			; apnoe timeout [min]
+	movwf	apnoe_timeout_counter
+	return
+
+divemode_option3:			; minus 1m
+	banksel	isr_backup
+	movlw	d'100'
+	subwf	sim_pressure+0
+	movlw	.0
+	subwfb	sim_pressure+1
+	rcall	divemode_simulator_check_limits
+	banksel common
+	return
+
+divemode_option2:			; plus 1m
+	banksel	isr_backup
+	movlw	d'100'
+	addwf	sim_pressure+0
+	movlw	.0
+	addwfc	sim_pressure+1
+	rcall	divemode_simulator_check_limits
+	banksel common
+	return
+
+divemode_option5:
+    call    menuview_toggle_reset   ; Reset to zero (Zero=no menuview)
+    bsf     reset_average_depth     ; Set Flag
+    return
+
+divemode_simulator_check_limits:
+	; Check limits (150m and 0m)
+	movlw	LOW		d'16000'            ; Compare to 16bar=16000mbar (150m).
+	subwf   sim_pressure+0,W
+	movlw	HIGH	d'16000'
+	subwfb  sim_pressure+1,W
+	bnc     divemode_simulator_check_limits2 ; No-carry = borrow = not deeper
+
+	; Too deep, limit to 150m
+	movlw	LOW		d'16000'
+	movwf	sim_pressure+0
+	movlw	HIGH	d'16000'
+	movwf	sim_pressure+1
+	return
+divemode_simulator_check_limits2:
+	movlw	LOW		d'1000'             ; Compare to 1bar == 0m == 1000 mbar.
+	subwf   sim_pressure+0,W
+	movlw	HIGH	d'1000'
+	subwfb  sim_pressure+1,W
+	btfsc   STATUS,C                    ; No-carry = borrow = not deeper.
+	return                              ; Deeper than 0m == Ok.
+	; Too shallow, limit to 0m
+	movlw	LOW		d'1000'
+	movwf	sim_pressure+0
+	movlw	HIGH	d'1000'
+	movwf	sim_pressure+1
+	return
+
+;=============================================================================
+; Compare all enabled gas in list, to see if a better one is available.
+;
+; Output: better_gas_available, better_gas_number
+;
+check_gas_change:					; Checks if a better gas should be selected (by user)
+	bcf		better_gas_available    ;=1: A better gas is available and a gas change is advised in divemode
+	clrf	better_gas_number       ; Clear better gas register
+
+    SAFE_2BYTE_COPY rel_pressure,xA
+	movlw	d'100'
+	movwf	xB+0
+	clrf	xB+1
+	call	div16x16				; compute depth in full m -> result in xC+0
+
+    btfss   FLAG_ccr_mode           ; In CCR mode...
+    bra     check_gas_change_OC_bail; No, check for OC or bailout
+    btfsc   is_bailout              ; Bailout?
+    bra     check_gas_change_OC_bail; Yes, check for OC or bailout
+
+    ; Check Diluents
+    movlw   .0
+    rcall   check_dil_common        ; With Gas 0-4 in WREG
+    movlw   .1
+    rcall   check_dil_common        ; With Gas 0-4 in WREG
+    movlw   .2
+    rcall   check_dil_common        ; With Gas 0-4 in WREG
+    movlw   .3
+    rcall   check_dil_common        ; With Gas 0-4 in WREG
+    movlw   .4
+    rcall   check_dil_common        ; With Gas 0-4 in WREG
+    bra     check_gas_change_exit
+
+check_gas_change_OC_bail:
+    movlw   .0
+    rcall   check_gas_common        ; With Gas 0-4 in WREG
+    movlw   .1
+    rcall   check_gas_common        ; With Gas 0-4 in WREG
+    movlw   .2
+    rcall   check_gas_common        ; With Gas 0-4 in WREG
+    movlw   .3
+    rcall   check_gas_common        ; With Gas 0-4 in WREG
+    movlw   .4
+    rcall   check_gas_common        ; With Gas 0-4 in WREG
+;    bra     check_gas_change_exit
+check_gas_change_exit:
+    btfss	better_gas_available	; Is a better gas available
+    bcf     blinking_better_gas     ; No, Clear blinking flag
+    btfss	better_gas_available	; Is a better gas available
+    clrf    better_gas_number		; No, Clear better_gas_number (For gaslist display)
+    call    TFT_active_gas_divemode ; Display gas/Setpoint
+	return
+
+check_gas_common:                   ; With Gas 0-4 in WREG
+    btfsc   better_gas_available	; Better Gas already found?
+    return                          ; Yes, return
+    lfsr    FSR1,opt_gas_type       ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+    btfss   PLUSW1,0                ; Test for Bit0 and 1 -> type=3 -> Deco
+    return                          ; No
+    btfss   PLUSW1,1                ; Test for Bit0 and 1 -> type=3 -> Deco
+    return                          ; No
+    incf    WREG,W                  ; 1-5
+    cpfseq  active_gas				; is this gas currently selected?
+    bra     check_gas_common2       ; No
+    return                          ; Yes, skip test for active gas
+check_gas_common2:
+    decf    WREG,W                  ; 0-4
+    movwf   hi                      ; Save tested gas 0-4
+    lfsr    FSR1,char_I_deco_gas_change
+    movff   PLUSW1,lo               ; Change depth into lo
+	movlw	minimum_change_depth
+	cpfsgt	lo  					; Change depth>minimum_change_depth?
+	return                          ; No, Change depth not deep enough, skip!
+	movf	xC+0,W					; load depth in m into WREG
+	cpfsgt	lo  					; gas_change_depth < current depth?
+    return                          ; No, check next gas
+	incf    hi,W                    ; 1-5
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
+	movlw	better_gas_window
+	subwf	lo,W                    ; Change depth-better_gas_window
+	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
+	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
+    return
+
+check_dil_common:                   ; With Dil 0-4 in WREG
+    btfsc   better_gas_available	; Better Diluent already found?
+    return                          ; Yes, return
+    lfsr    FSR1,opt_dil_type       ; 0=Disabled, 1=First, 2=Normal
+    tstfsz  PLUSW1                  ; =0?
+    bra     check_dil_common1       ; No
+    return                          ; Yes, skip inactive diluents for test
+check_dil_common1:
+    incf    WREG,W                  ; 1-5
+    cpfseq  active_gas				; is this diluent currently selected?
+    bra     check_dil_common2       ; No
+    return                          ; Yes, skip test for active diluent
+check_dil_common2:
+    decf    WREG,W                  ; 0-4
+    movwf   hi                      ; Save tested diluent 0-4
+    lfsr    FSR1,char_I_dil_change
+    movff   PLUSW1,lo               ; Change depth into lo
+	movlw	minimum_change_depth
+	cpfsgt	lo  					; Change depth>minimum_change_depth?
+	return                          ; No, Change depth not deep enough, skip!
+	movf	xC+0,W					; load depth in m into WREG
+	cpfsgt	lo  					; gas_change_depth < current depth?
+    return                          ; No, check next gas
+	incf    hi,W                    ; 1-5
+    addlw   .5                      ; 6-10
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
+	movlw	better_gas_window
+	subwf	lo,W                    ; Change depth-better_gas_window
+	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
+	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
+    return
+
+;=============================================================================
+; Setup everything to enter divemode.
+;
+
+dive_boot_oc:
+    extern  get_first_gas_to_WREG
+    call    get_first_gas_to_WREG           ; Gets first gas (0-4) into WREG
+    movff   WREG,char_I_first_gas           ; Copy for compatibility
+	movff	WREG,active_gas                 ; Set for logbook and display
+    rcall   setup_gas_registers             ; With WREG=Gas 0-4
+    return
+
+dive_boot_cc:
+    rcall   divemode_setup_sensor_values    ; setup sensor values
+    TSTOSS  opt_ccr_mode                    ; =0: Fixed SP, =1: Sensor
+    movff   char_I_setpoint_cbar+0,char_I_const_ppO2    ; Setup fixed Setpoint (Always start with SP1)
+    extern  get_first_dil_to_WREG
+    call    get_first_dil_to_WREG           ; Gets first gas (0-4) into WREG
+    movff   WREG,char_I_first_gas           ; Copy for compatibility
+	movff	WREG,active_gas                 ; Set for logbook and display
+    rcall   setup_dil_registers             ; With WREG=Gas 0-4
+    return
+
+diveloop_boot:
+	call	restart_set_modes_and_flags
+
+    call    I2C_sleep_accelerometer          ; Stop accelerometer
+    call    I2C_sleep_compass                ; Stop compass
+
+	clrf	WREG
+	movff	WREG,max_pressure+0				; clear some variables
+	movff	WREG,max_pressure+1
+
+    bcf     use_agf                         ; Start with normal GF set
+    bcf     divemode_menu                   ; clear divemode menu flag
+	movlw	d'1'
+	movwf	apnoe_max_pressure+0
+	clrf	apnoe_max_pressure+1
+	clrf	apnoe_surface_mins			
+	clrf	apnoe_surface_secs		
+	clrf	apnoe_mins
+	clrf	apnoe_secs
+	clrf	divemins+0
+	clrf	divemins+1
+    bcf     no_more_divesecs                ; =1: Do no longer show seconds in divemode
+	bcf		divemode_menu_active
+    clrf    menupos
+    clrf	menupos3                        ; Reset to zero (Zero=no custom view)
+    clrf    menupos2                        ; Reset to zero (Zero=no premenu or simulator task)
+
+    bcf     is_bailout                      ; =1: Bailout
+    btfss   FLAG_ccr_mode
+    rcall   dive_boot_oc
+    btfsc   FLAG_ccr_mode
+    rcall   dive_boot_cc
+
+	bcf		better_gas_available        ;=1: A better gas is available and a gas change is advised in divemode
+	clrf	better_gas_number           ; Clear better gas register
+
+ 	clrf	samplesecs
+	clrf	apnoe_timeout_counter		; timeout in minutes
+	clrf 	timeout_counter				; takes care of the timeout (Low byte)
+	clrf 	timeout_counter2			; takes care of the timeout (High byte)
+	clrf	AlarmType					; Clear all alarms
+	bcf		event_occured				; clear flag
+	clrf 	total_divetime_seconds+1
+	clrf	average_depth_hold_total+0
+	clrf	average_depth_hold_total+1
+	clrf	average_depth_hold_total+2
+	clrf	average_depth_hold_total+3	; Clear Non-Resettable Average
+    rcall	reset_average1				; Reset the resettable average depth
+    bcf		decostop_active
+	bcf		better_gas_available        ;=1: A better gas is available and a gas change is advised in divemode
+	call	ghostwriter_short_header		; Write short header with divenumber into profile memory
+
+    btfsc   simulatormode_active
+    bra     diveloop_boot_1
+    ; Normal mode = Surface pressure is the pressure 30mn before dive.
+	SAFE_2BYTE_COPY last_surfpressure_30min, int_I_pres_surface	;copy surfacepressure to deco routine
+	SAFE_2BYTE_COPY last_surfpressure_30min, last_surfpressure	;copy surfacepressure to last_surfpressure for correct depth
+    bra     diveloop_boot_2
+
+diveloop_boot_1:
+    ; Simulator mode: Surface pressure is 1bar.
+    movlw   LOW .1000
+	movff	WREG,int_I_pres_surface+0   ; LOW copy surfacepressure to deco routine
+    movlw   HIGH .1000
+	movff	WREG,int_I_pres_surface+1   ; HIGH copy surfacepressure to deco routine
+
+diveloop_boot_2:
+	SAFE_2BYTE_COPY	temperature,minimum_temperature ; Reset Min-Temp registers
+
+; Init profile recording parameters	
+	movlw	samplingrate
+	movwf	samplesecs_value            ; to avoid EEPROM access in the ISR
+	movlw	div_temperature
+	movwf	divisor_temperature         ; load divisors for profile storage
+	movlw	div_deco
+	movwf	divisor_deco				
+	movlw	div_gf
+	movwf	divisor_gf
+	movlw	div_ppo2_sensors
+	movwf	divisor_ppo2_sensors
+	movlw	div_decoplan
+	movwf	divisor_decoplan
+	movlw	div_cns
+	movwf	divisor_cns
+	movlw	div_tank
+	movwf	divisor_tank
+
+	btfss	FLAG_apnoe_mode				; In Apnoe mode?
+	bra		divemode1
+; Overwrite some parameters in Apnoe mode....
+	movlw	samplingrate_apnoe
+	movwf	samplesecs_value			; to avoid EEPROM access in the ISR
+
+divemode1:
+	bcf		LEDg
+	bcf		LEDr
+	bcf		realdive
+	btfss	simulatormode_active		; do not disable in simulator mode!					
+	call	disable_rs232				; Disable RS232
+    btfsc   enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+    call	enable_rs232				; Also sets to speed_normal ...
+    movlw   .2
+	movwf   total_divetime_seconds+0
+	movwf   divesecs                    ; Start at 2seconds
+	bsf		divemode2                   ; displayed divetime is running (Divetime starts HERE)
+
+	movff	int_O_CNS_fraction+0,CNS_start+0
+    movff	int_O_CNS_fraction+1,CNS_start+1        ; Save CNS value at beginning of dive
+    movff   char_O_relative_gradient_GF,GF_start    ; Save GF value at  beginning of dive
+	return								; Done with divemode boot
+
+divemode_check_for_warnings:
+    btfss   secs,1                      ; Every four seconds
+    return
+
+	movf	warning_counter_backup,W
+	cpfseq	warning_counter						; warning_counter_backup = warning_counter?
+	call	TFT_clear_warning_text              ; No, clear all warnings
+	movff	warning_counter,warning_counter_backup	; copy warning_counter
+
+	bcf		warning_active				; Clear flag
+	clrf	warning_counter						; Clear counter
+
+    ; Warnings for all modes
+    call	check_warn_battery                  ; Check if the battery level should be displayed/warned
+
+	btfsc	FLAG_apnoe_mode             ; Done for Apnoe or Gauge mode
+    bra     divemode_check_for_warnings2
+	btfsc	FLAG_gauge_mode             ; Done for Apnoe or Gauge mode
+	bra     divemode_check_for_warnings2
+
+    ; Warnings only in deco modes
+    btfss   FLAG_ccr_mode                       ; Don't check in CCR mode
+	rcall	check_ppO2							; check ppO2 and displays warning, if required
+    btfsc   is_bailout                          ; But check in Bailout case...
+	rcall	check_ppO2							; check ppO2 and displays warning, if required
+	rcall	check_cns_violation					; Check CNS value and display it, if required
+	btfsc	decostop_active						; In deco mode?
+	rcall	check_and_store_gf_violation		; Yes, Sets warnings, if required
+	btfsc	decostop_active						; In deco mode?
+    call    TFT_ftts                            ; Show @+x time
+    btfsc   use_agf                             ; In aGF mode?
+    rcall   warn_agf                            ; Yes, show a warning for it
+
+divemode_check_for_warnings2:
+; Display the warning icon?
+	btfsc	warning_active				; Any warning active?
+	call	TFT_divemode_warning				; Yes
+	btfss	warning_active				; Any warning active?
+	call	TFT_divemode_warning_clear			; No, clear warning icon
+
+; Setup warning_page number
+    incf    warning_page,F
+    bcf     STATUS,C
+    rlcf    warning_page,W                      ; *2
+    cpfsgt  warning_counter                     ; > warning_counter
+    clrf    warning_page                        ; No, clear
+
+; Clear 2nd row of warnings if there is nothing to show (on this page)
+    btfss   second_row_warning                  ; =1: The second row contains a warning
+    call    TFT_clear_warning_text_2nd_row      ; No, clear this row
+    return                                      ; Done.
+
+    global  check_warn_battery
+check_warn_battery:
+    movff   batt_percent,lo
+	movlw	battery_show_level+1
+	cpfslt	lo
+    return                              ; No Display, no warning
+    ; Display Battery, but warn?
+	incf	warning_counter,F			; increase counter
+    call	TFT_update_batt_percent_divemode    ; Show percent
+
+	movlw	color_code_battery_low+1
+	cpfslt	lo                          ;
+	return                              ; No warning
+	bsf		warning_active		; Set Warning flag
+	return
+
+check_ppO2:							    ; check current ppO2 and display warning if required
+    SAFE_2BYTE_COPY amb_pressure, xA
+	movlw	d'10'
+	movwf	xB+0
+	clrf	xB+1
+	call	div16x16				; xC=p_amb/10
+
+	movff	xC+0,xA+0
+	movff	xC+1,xA+1
+    movff   char_I_O2_ratio,xB+0    ; =O2 ratio
+	clrf	xB+1
+	call	mult16x16               ; char_I_O2_ratio * p_amb/10
+
+    ; Check very high ppO2 manually
+	tstfsz	xC+2				; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
+	bra		check_ppO2_1		; Yes, display Value!
+    ; Check if ppO2>3,30bar
+	btfsc   xC+1,7
+	bra     check_ppO2_1		; Yes!
+
+    ; Check for low ppo2
+    movff	xC+0,sub_b+0
+	movff	xC+1,sub_b+1
+    movff   opt_ppO2_min,WREG
+	mullw	d'100'				; opt_ppO2_min*100
+	movff	PRODL,sub_a+0
+	movff	PRODH,sub_a+1
+	call	subU16
+	btfsc	neg_flag
+	bra     check_ppO2_0        ; Not too low
+    ; ppO2 low
+	incf	warning_counter,F	; increase counter
+	call	TFT_display_ppo2	; Show ppO2
+	movlw	d'4'				; Type of Alarm (ppO2 low)
+	movwf	AlarmType			; Copy to Alarm Register
+	bsf		event_occured		; Set Event Flag
+	bsf		warning_active		; Set Warning flag
+	return						; Done.
+
+check_ppO2_0:
+    ; Check if ppO2 should be displayed
+    movlw   ppo2_display_high
+	mullw	d'100'				; ppo2_display_high*100
+	movff	PRODL,sub_a+0
+	movff	PRODH,sub_a+1
+	call	subU16
+	btfss	neg_flag
+	return						; No Display, no warning
+    ; Display ppO2, but warn?
+	incf	warning_counter,F	; increase counter
+	call	TFT_display_ppo2	; Show ppO2
+
+;check if we are within our warning thresholds!
+	movff	xC+0,sub_b+0
+	movff	xC+1,sub_b+1
+	movff	opt_ppO2_max,WREG	; PPO2 Max for MOD calculation and color coding in divemode
+	mullw	d'100'				; opt_ppO2_max*100
+	movff	PRODL,sub_a+0
+	movff	PRODH,sub_a+1
+	call	subU16					
+	btfss	neg_flag
+	return						; Done. Not too high
+	movlw	d'5'				; Type of Alarm (ppO2 high)
+	movwf	AlarmType			; Copy to Alarm Register
+	bsf		event_occured		; Set Event Flag
+	bsf		warning_active		; Set Warning flag
+	return						; Done.
+
+check_ppO2_1:                   ; ppO2 very high
+	incf	warning_counter,F	; increase counter
+	call	TFT_display_ppo2	; Show ppO2
+	movlw	d'5'				; Type of Alarm
+	movwf	AlarmType			; Copy to Alarm Register
+	bsf		event_occured		; Set Event Flag
+	bsf		warning_active		; Set Warning flag
+	return						; Done.
+
+    global  check_cns_violation
+check_cns_violation:
+    ; Check if CNS should be displayed
+    movff   int_O_CNS_fraction+1,lo		; copy into bank1
+    tstfsz  lo                          ; >255% ?
+    bra     check_cns_violation2        ; Yes
+	movff	int_O_CNS_fraction+0,lo		; copy into bank1
+
+	movlw	cns_warning_high			; cns_warning_high
+	subwf	lo,W
+	btfsc	STATUS,C
+	bsf		warning_active              ; Set Warning flag
+
+	movlw	cns_display_high			; cns_display_high
+	subwf	lo,W
+	btfss	STATUS,C
+	return                              ; No Display, no warning
+    ; Display CNS
+	incf	warning_counter,F			; increase counter
+	call	TFT_display_cns				; Show CNS
+	return
+
+check_cns_violation2:
+	incf	warning_counter,F			; increase counter
+	call	TFT_display_cns				; Show CNS
+	bsf		warning_active		; Set Warning flag
+	return
+
+    global  check_and_store_gf_violation
+check_and_store_gf_violation:
+	movff	char_O_gradient_factor,lo			; gradient factor absolute (Non-GF model)
+	movff	char_I_deco_model,hi
+	decfsz	hi,F		; jump over next line if char_I_deco_model == 1
+	movff	char_O_relative_gradient_GF,lo		; gradient factor relative (GF model)
+
+	movlw	gf_warning_high
+	cpfsgt	lo
+	bra     check_and_store_gf_violation2   ; No warning
+	movlw	d'2'                        ; Type of Alarm
+	movwf	AlarmType                   ; Copy to Alarm Register
+	bsf		event_occured               ; Set Event Flag
+	bsf		warning_active              ; Set Warning flag
+check_and_store_gf_violation2:
+	movlw	gf_display_high
+	cpfsgt	lo
+    return                              ; No Display, no warning
+    ; Display GF
+	incf	warning_counter,F			; increase counter
+    call    TFT_warning_gf              ; Show GF Warning
+	return
+
+warn_agf:
+	incf	warning_counter,F			; increase counter
+	call	TFT_warning_agf             ; Show aGF warning
+	bsf		warning_active              ; Set Warning flag
+    return
+
+
+ END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/divemode.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,183 @@
+;=============================================================================
+;
+;   File divemode.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-15 : [mH] moving from OSTC code
+
+ 	extern 	set_dive_modes
+ 	extern	diveloop
+	extern	apnoe_calc_maxdepth
+
+; Divemode layout:
+; row=0...239
+; column=0...159 (x2)
+
+#DEFINE	depth_row			.14
+#DEFINE	depth_column		.0
+#DEFINE	depth_feet_row		depth_row
+#DEFINE	depth_feet_column	.0
+#DEFINE	depth_dm_row		depth_row+.25
+#DEFINE	depth_dm_column		.40
+
+#DEFINE	max_depth_row           depth_row
+#DEFINE	max_depth_column        .64
+#DEFINE	max_depth_feet_row		max_depth_row
+#DEFINE	max_depth_feet_column	.64
+
+#DEFINE	divetime_row            depth_row
+#DEFINE	divetime_column             .103        ; Mins:Secs
+#DEFINE divetime_minsonly_column    .100        ; Minutes only
+#DEFINE divetime_secs_column    .139
+#DEFINE divetime_secs_row       depth_row+.12
+#DEFINE	divetime_apnoe_row		depth_row
+#DEFINE	divetime_apnoe_column	.103
+
+#DEFINE divemode_mask_depth_row         .0
+#DEFINE divemode_mask_depth_column      .12
+#DEFINE divemode_mask_maxdepth_row      .0
+#DEFINE divemode_mask_maxdepth_column   .62
+#DEFINE divemode_mask_divetime_row      .0
+#DEFINE divemode_mask_divetime_column   .122
+
+#DEFINE surface_apnoe_text_row      .190
+#DEFINE surface_apnoe_text_column   .30
+#DEFINE	surface_time_apnoe_row		.204
+#DEFINE	surface_time_apnoe_column	.15
+
+#DEFINE last_max_apnoe_text_row     .190
+#DEFINE last_max_apnoe_text_column  .100
+#DEFINE apnoe_last_max_depth_row	.204
+#DEFINE	apnoe_last_max_depth_column	.100
+
+#DEFINE	dive_temp_row		.163
+#DEFINE	dive_temp_column	.0
+
+; TTS
+#DEFINE	tts_text_row		.211
+#DEFINE	tts_text_column     .85
+#DEFINE	tts_value_row		.207
+#DEFINE	tts_value_column	.118
+
+#DEFINE	ndl_text_row		tts_text_row
+#DEFINE	ndl_text_column     tts_text_column
+#DEFINE	ndl_value_row		tts_value_row
+#DEFINE	ndl_value_column	tts_value_column
+
+#DEFINE	active_gas_row		.210
+#DEFINE	active_gas_column	.0
+#DEFINE active_dil_row      .186
+#DEFINE active_dil_column   .0
+
+; Warnings
+#DEFINE	warning_icon_row	.55
+#DEFINE	warning_icon_column	.135
+#DEFINE	warning1_row		.50
+#DEFINE	warning1_column		.70
+#DEFINE	warning2_row		.74
+#DEFINE	warning2_column		warning1_column
+#DEFINE warning_length      .9                 ; total string length
+
+#DEFINE	velocity_text_row		.76
+#DEFINE	velocity_text_column	.0
+
+#DEFINE	divemode_customview_row		.101        ; Upper border
+#DEFINE	divemode_customview_column	.0
+
+#DEFINE dive_custom_hud_row         divemode_customview_row+.1
+#DEFINE dive_custom_hud_column1     .10
+#DEFINE dive_custom_hud_column2     .65
+#DEFINE dive_custom_hud_column3     .120
+#DEFINE dive_hud_data_row           divemode_customview_row+.16
+#DEFINE dive_hud_sensor1_column     .6
+#DEFINE dive_hud_sensor2_column     .62
+#DEFINE dive_hud_sensor3_column     .118
+
+; Customview GF
+#DEFINE dive_gf_text_row            divemode_customview_row+.1
+#DEFINE dive_gf_column1             .8
+#DEFINE dive_gf_column2             .62
+#DEFINE dive_gf_column3             .115
+#DEFINE dive_gf_row                 divemode_customview_row+.18
+#DEFINE dive_gf_column              .0
+#DEFINE dive_agf_row                dive_gf_row
+#DEFINE dive_agf_column             .60
+#DEFINE dive_currentgf_row          dive_gf_row
+#DEFINE dive_currentgf_column       .118
+
+; Customview clock/date, END/EAD and Tissues
+#DEFINE dive_clock_row              dive_hud_data_row
+#DEFINE dive_clock_column           .0
+#DEFINE dive_date_row               dive_clock_row+.23
+#DEFINE dive_date_column            dive_clock_column
+#DEFINE dive_ead_row                dive_hud_data_row
+#DEFINE dive_ead_column             .46
+#DEFINE dive_end_row                dive_ead_row+.23
+#DEFINE dive_end_column             dive_ead_column
+
+#DEFINE dive_tissue_N2_row          dive_ead_row+.5
+#DEFINE dive_tissue_N2_column       .105
+#DEFINE dive_tissue_He_row          dive_end_row+.5
+#DEFINE dive_tissue_He_column       dive_tissue_N2_column
+#DEFINE tissue_diagram_top          divemode_customview_row+.16
+#DEFINE tissue_diagram_bottom       .160
+#DEFINE tissue_diagram_left         .116
+#DEFINE tissue_diagram_frame_spacing    .8
+
+#DEFINE dive_custom_avr_stop_row        dive_custom_hud_row
+#DEFINE dive_custom_avr_stop_column1    .2
+#DEFINE dive_custom_avr_stop_column2    .57
+#DEFINE dive_custom_avr_stop_column3    .110
+#DEFINE dive_avr_stop_row               dive_hud_data_row
+#DEFINE dive_avr_stop_column1           .0
+#DEFINE dive_avr_stop_column2           .54
+#DEFINE dive_avr_stop_column3           .118
+
+#DEFINE	decostop_1st_stop_row		.171		; The big one...
+#DEFINE	decostop_1st_stop_column	.82			; The big one...
+
+#DEFINE decoplan_title_row          .101
+#DEFINE decoplan_title_column       .65
+
+#DEFINE	decostop_2nd_stop_row		divemode_customview_row+.15
+#DEFINE	decostop_2nd_stop_column	.0
+#DEFINE	decostop_3rd_stop_row		divemode_customview_row+.39
+#DEFINE	decostop_3rd_stop_column	decostop_2nd_stop_column
+#DEFINE	decostop_4th_stop_row		decostop_2nd_stop_row
+#DEFINE	decostop_4th_stop_column	.56
+#DEFINE	decostop_5th_stop_row		decostop_3rd_stop_row
+#DEFINE	decostop_5th_stop_column	decostop_4th_stop_column
+#DEFINE	decostop_6th_stop_row		decostop_2nd_stop_row
+#DEFINE	decostop_6th_stop_column	.112
+#DEFINE	decostop_7th_stop_row		decostop_3rd_stop_row
+#DEFINE	decostop_7th_stop_column	decostop_6th_stop_column
+
+#DEFINE divemode_simtext_row        .164
+#DEFINE divemode_simtext_column     .32
+
+; Divemode menu
+#DEFINE divemode_menu_row           .164        ; Upper row
+#DEFINE divemode_menu_lower         .239        ; Lower border
+#DEFINE divemode_menu_left          .0          ; Left
+#DEFINE divemode_menu_right         .159        ; Right
+
+#DEFINE divemode_menu_item1_row    .164
+#DEFINE divemode_menu_item1_column .9
+#DEFINE divemode_menu_item2_row    divemode_menu_item1_row+.24
+#DEFINE divemode_menu_item2_column divemode_menu_item1_column
+#DEFINE divemode_menu_item3_row    divemode_menu_item2_row+.24
+#DEFINE divemode_menu_item3_column divemode_menu_item1_column
+#DEFINE divemode_menu_item4_row    divemode_menu_item1_row
+#DEFINE divemode_menu_item4_column .90
+#DEFINE divemode_menu_item5_row    divemode_menu_item4_row+.24
+#DEFINE divemode_menu_item5_column divemode_menu_item4_column
+#DEFINE divemode_menu_item6_row    divemode_menu_item5_row+.24
+#DEFINE divemode_menu_item6_column divemode_menu_item4_column
+
+#DEFINE dive_compass_mask_row       decoplan_title_row
+#DEFINE dive_compass_mask_column    decoplan_title_column
+#DEFINE dive_compass_head_column    .65
+#DEFINE dive_compass_head_row       divemode_customview_row+.25
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eeprom_rs232.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,168 @@
+;=============================================================================
+;
+;   File eeprom_rs232.asm
+;
+;   Internal EEPROM, RS232
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-06 : [mH] moving from OSTC code
+
+#include "ostc3.inc"
+#include "start.inc"
+#include "tft.inc"
+#include "wait.inc"
+#include "strings.inc"
+#include "convert.inc"
+
+;=============================================================================
+eeprom   code    0xF00000+0x10
+; Skip SERIAL number. Should not be overwritten.
+    global eeprom_serial_save, eeprom_opt_backup
+eeprom_serial_save  res 2
+eeprom_opt_backup   res 0x3E
+
+;=============================================================================
+basic    CODE
+
+	global write_int_eeprom_1
+write_int_eeprom_1:
+	movwf	EEADR
+	bra		write_eeprom                ; writes and "returns" after write
+
+	global read_int_eeprom_1
+read_int_eeprom_1:
+	movwf	EEADR
+	bra		read_eeprom					; reads and "returns" after write
+
+;=============================================================================
+; reads from internal eeprom
+; Input:   EEADRH:EEADR = EEPROM address.
+; Output:  EEDATA.
+; Trashed: NONE.
+	global	read_eeprom
+read_eeprom: 							
+	bcf		EECON1,EEPGD
+	bcf		EECON1,CFGS
+	bsf		EECON1,RD
+	return
+
+;=============================================================================
+; writes into internal eeprom
+; Input:   EEADRH:EEADR = EEPROM address.
+;          EEDATA = byte to write.
+; Trashed: WREG.
+	global	write_eeprom
+write_eeprom:							
+	bcf		EECON1,EEPGD
+	bcf		EECON1,CFGS
+	bsf		EECON1,WREN
+
+	bcf		INTCON,GIE					; even the RTC will be delayed for the next 5 instructions...
+	movlw	0x55		
+	movwf	EECON2
+	movlw	0xAA
+	movwf	EECON2
+	bsf		EECON1,WR
+	bsf		INTCON,GIE					; ...but the flag for the ISR routines were still set, so they will interrupt now!
+
+write_eep2:
+	btfsc	EECON1,WR		
+	bra 	write_eep2					; wait about 4ms...
+	bcf		EECON1,WREN
+	return
+
+    global  disable_ir
+disable_ir:
+    banksel TXSTA2
+	clrf    TXSTA2
+	clrf    RCSTA2
+    banksel common
+    bcf     ir_power                ; IR off
+    return
+
+    global  enable_ir
+enable_ir:
+;init serial port2 (TRISG2)
+    banksel TXSTA2
+	movlw 	b'00100000'			; BRGH=0, SYNC=0
+	movwf 	TXSTA2
+	movlw 	.102                ; SPBRGH:SPBRG = .102  : 2403 BAUD @ 16MHz
+	movwf 	SPBRG2
+	clrf	SPBRGH2
+	movlw 	b'10010000'
+	movwf 	RCSTA2
+    banksel common
+    bsf     ir_power                  ; Power-up IR
+    btfss   ir_power
+    bra     $-6
+    return
+
+;=============================================================================
+	global	enable_rs232
+enable_rs232:
+	bcf		TRISC,6					; Output
+	bsf		TRISC,7					; Input
+	call	speed_normal			; 16MHz
+enable_rs232_2:
+    movlw	T2CON_NORMAL
+    cpfseq  T2CON
+    bra     enable_rs232_2          ; Wait until speed is normal
+;init serial port1 (TRISC6/7)
+	clrf	RCSTA1
+	clrf	TXSTA1
+	movlw	b'00001000'			; BRG16=1
+	movwf	BAUDCON1
+	movlw 	b'00100100'			; BRGH=1, SYNC=0
+	movwf 	TXSTA1
+	movlw 	.34					; SPBRGH:SPBRG =  .34 : 114285 BAUD @ 16MHz (+0,79% Error to 115200 BAUD)
+	movwf 	SPBRG1
+	clrf	SPBRGH1
+	movlw 	b'10010000'
+	movwf 	RCSTA1
+	return
+
+	global	disable_rs232
+disable_rs232:
+	clrf	RCSTA1
+	clrf	TXSTA1					; UART disable
+	bsf		TRISC,6					; Input
+	bsf		TRISC,7					; Input
+	return
+
+	global	rs232_wait_tx
+rs232_wait_tx:
+;	btfss	RCSTA1,SPEN			; Transmitter active?
+;	return						; No, return!
+
+	btfsc	TXSTA1,TRMT			; Transmit Shift Register empty?
+	return						; Yes, return!
+
+	btfss	TXSTA,TRMT			; RS232 Busy?
+	bra		rs232_wait_tx		; yes, wait...
+	return						; Done.
+
+	global	rs232_get_byte
+rs232_get_byte:
+ 	bcf		PIR1,RCIF		; clear flag
+	bcf		rs232_recieve_overflow		; clear flag
+	clrf 	uart1_temp
+	clrf 	uart2_temp
+rs232_get_byte2:
+	btfsc 	PIR1,RCIF		; data arrived?
+    return
+;	bra     rs232_get_byte3
+
+	decfsz 	uart2_temp,F
+	bra 	rs232_get_byte2
+	decfsz 	uart1_temp,F
+	bra		rs232_get_byte2
+						; timeout occoured (about 20ms)
+	bsf		rs232_recieve_overflow		; set flag
+;rs232_get_byte3:
+	bcf		RCSTA1,CREN		; Clear receiver status
+	bsf		RCSTA1,CREN
+	return				; and return anyway
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eeprom_rs232.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,30 @@
+;=============================================================================
+;
+;   File eeprom_rs232.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-03 : [mH] moving from OSTC code
+
+write_int_eeprom	macro	eeprom_address
+	movlw	eeprom_address
+	call	write_int_eeprom_1
+	endm
+
+read_int_eeprom	macro	eeprom_address
+	movlw	eeprom_address
+	call	read_int_eeprom_1
+	endm
+
+	extern	write_int_eeprom_1
+	extern	read_int_eeprom_1
+	extern	read_eeprom
+	extern	write_eeprom
+	extern	enable_rs232
+	extern	disable_rs232
+	extern	rs232_get_byte
+	extern	rs232_wait_tx
+    extern  enable_ir
+    extern  disable_ir
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/external_flash.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,279 @@
+;=============================================================================
+;
+;   File external_flash.asm
+;
+;   External flash
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-12 : [mH] creation
+
+	#include "ostc3.inc"
+	#include "wait.inc"
+
+basic    CODE
+;=============================================================================
+
+	global		incf_ext_flash_address_p1
+incf_ext_flash_address_p1:					; Increase by one
+	movlw		.1
+
+	global	incf_ext_flash_address0
+incf_ext_flash_address0:
+    addwf		ext_flash_address+0,F      ; increase address
+    movlw		d'0'
+    addwfc		ext_flash_address+1,F
+    addwfc		ext_flash_address+2,F
+
+	movlw		0x40
+	cpfseq		ext_flash_address+2			; at address 40FFFF?
+	return									; No, return
+	clrf		ext_flash_address+0			; Yes, rollover to 0x000000
+	clrf		ext_flash_address+1
+	clrf		ext_flash_address+2
+	return
+
+	global		incf_ext_flash_address0_p1_0x20
+incf_ext_flash_address0_p1_0x20:			; Increase by one
+	movlw		.1
+
+	global		incf_ext_flash_address0_0x20
+incf_ext_flash_address0_0x20:		 	; with roll-over at 0x200000 to 0x000000
+    addwf		ext_flash_address+0,F      ; increase address
+    movlw		d'0'
+    addwfc		ext_flash_address+1,F
+    addwfc		ext_flash_address+2,F
+
+	movlw		0x20
+	cpfseq		ext_flash_address+2			; at address 0x200000?
+	return									; No, return
+	clrf		ext_flash_address+0			; Yes, rollover to 0x000000
+	clrf		ext_flash_address+1
+	clrf		ext_flash_address+2
+	return
+
+	global	decf_ext_flash_address0
+decf_ext_flash_address0:
+    subwf		ext_flash_address+0,F      ; decrease address: do a 16-8bits substract.
+    movlw		d'0'
+    subwfb		ext_flash_address+1,F
+    movlw		d'0'
+    subwfb		ext_flash_address+2,F
+
+	btfss		ext_flash_address+2,7		; Rollover to 0xFFFFFF?
+	return									; No, return
+	clrf		ext_flash_address+2			; Set to 0x00FFFFF
+	setf		ext_flash_address+1
+	setf		ext_flash_address+0
+	return
+
+	global	ext_flash_power_down
+ext_flash_power_down:
+	movlw		0x04				; Write disable
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+	return
+
+	global	ext_flash_byte_read_plus	; Return data read in WREG and SSP2BUF and 
+ext_flash_byte_read_plus:				; increase address after read
+	rcall	ext_flash_byte_read
+	movwf	temp1						; store received data
+	bra		incf_ext_flash_address_p1	; +1 and return
+
+	global	ext_flash_byte_read_plus_0x20; Return data read in WREG and SSP2BUF and 
+ext_flash_byte_read_plus_0x20:			; increase address after read with banking at 0x200000
+	rcall	ext_flash_byte_read
+	movwf	temp1						; store received data
+	bra		incf_ext_flash_address0_p1_0x20 ;+1 and return
+
+
+	global	ext_flash_byte_read		; Return data read in WREG
+ext_flash_byte_read:
+	movlw		0x03				; Read command
+	rcall		write_spi
+    rcall       ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI
+	rcall		write_spi			; Dummy write to read data into WREG
+	bsf			flash_ncs			; CS=1
+	movwf		temp1
+	return							; Return data read in WREG and temp1
+
+ext_flash_write_address: ; Write 24bit address ext_flash_address:3 via SPI
+	movf		ext_flash_address+2,W	; 24Bit Address
+	rcall		write_spi
+	movf		ext_flash_address+1,W
+	rcall		write_spi
+	movf		ext_flash_address+0,W
+	bra 		write_spi               ; And return....
+
+	global	ext_flash_read_block_start		; Return data read in WREG
+ext_flash_read_block_start:
+	movlw		0x03				; Read command
+	rcall		write_spi
+    rcall       ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI
+	rcall		write_spi			; Dummy write to read data into WREG
+	return							; Return data read in WREG
+
+	global	ext_flash_read_block		; Return data read in WREG
+ext_flash_read_block:
+	rcall		incf_ext_flash_address_p1	; Increase address +1
+	bra			write_spi1			; Dummy write to read data into WREG and return
+
+	global	ext_flash_read_block_stop	; Return data read in WREG
+ext_flash_read_block_stop:
+	bsf			flash_ncs			; CS=1
+	return							; NO data in WREG
+
+	global	write_byte_ext_flash_plus_header
+write_byte_ext_flash_plus_header:		; Write from WREG and increase address after write
+	movwf		temp1					; store data
+	; test if write is done at first byte of 4kB block
+	; if yes -> delete 4kB block first
+	tstfsz		ext_flash_address+0			; at 0x00?
+	bra			write_byte_ext_flash_plus_h1	; No, normal Write
+
+	movf		ext_flash_address+1,W
+	andlw		0x0F						; Mask lower nibble
+	tstfsz		WREG						; at 0x.0?
+	bra			write_byte_ext_flash_plus_h1; No, normal Write
+	
+	; At beginning of 4kB block -> rease first!
+	rcall		ext_flash_erase4kB		; Erases 4kB sector @ext_flash_address:3
+write_byte_ext_flash_plus_h1:
+	movf		temp1,W
+	rcall		ext_flash_byte_write	; Write the byte
+	bra			incf_ext_flash_address_p1	; +1 and return
+
+	global	write_byte_ext_flash_plus	; Write from WREG and increase address after write with banking at 0x200000
+write_byte_ext_flash_plus:
+	movwf		temp1					; store data
+    
+    ; First, increase dive length counter
+    incf        ext_flash_dive_counter+0,F
+    movlw       .0
+    addwfc      ext_flash_dive_counter+1,F
+    addwfc      ext_flash_dive_counter+2,F  ; 24bit++
+
+	; Now test if write is done at first byte of 4kB block
+	; if yes -> delete 4kB block first
+	tstfsz		ext_flash_address+0			; at 0x00?
+	bra			write_byte_ext_flash_plus1	; No, normal Write
+
+	movf		ext_flash_address+1,W
+	andlw		0x0F						; Mask lower nibble
+	tstfsz		WREG						; at 0x.0?
+	bra			write_byte_ext_flash_plus1	; No, normal Write
+	
+	; At beginning of 4kB block -> erase first!
+	rcall		ext_flash_erase4kB		; Erases 4kB sector @ext_flash_address:3
+write_byte_ext_flash_plus1:
+	movf		temp1,W
+	rcall		ext_flash_byte_write	; Write the byte
+	bra			incf_ext_flash_address0_p1_0x20		 ; +1 and roll over at 0x200000 to 0x000000	and return
+
+	global	ext_flash_byte_write	; Write from WREG
+ext_flash_byte_write:
+	movwf		temp1				; store data byte
+	bsf			flash_ncs			; CS=1
+	movlw		0x06				; WREN command
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+	movlw		0x02				; Write command
+	rcall		write_spi
+    rcall       ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI
+	movf		temp1,W				; load data byte
+	rcall		write_spi			; write one byte of data!
+	bsf			flash_ncs			; CS=1
+	return
+	
+	global	ext_flash_disable_protection		; Disable write protection
+ext_flash_disable_protection:
+	bsf			flash_ncs			; CS=1
+	movlw		0x50				; EWSR command
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+
+	movlw		0x01				; WRSR command
+	rcall		write_spi
+	movlw		b'00000000'			; New status
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+	return
+
+	global	ext_flash_enable_protection
+ext_flash_enable_protection:
+	bsf			flash_ncs			; CS=1
+	movlw		0x50				; EWSR command
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+
+	movlw		0x01				; WRSR command
+	rcall		write_spi
+	movlw		b'00011100'			; New status (Write protect on)
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+	return
+
+
+	global	ext_flash_erase4kB		; Erases 4kB sector
+ext_flash_erase4kB:
+	bsf			flash_ncs			; CS=1
+	movlw		0x06				; WREN command
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+	movlw		0x20				; Sector erase command
+	rcall		write_spi
+    rcall       ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI
+	bsf			flash_ncs			; CS=1
+;	bra			ext_flash_wait_write	; Wait for write... and return
+ext_flash_wait_write:
+	WAITMS		d'1'				; TBE=25ms...
+	movlw		0x05				; RDSR command
+	rcall		write_spi			; Read status
+	rcall		write_spi			; Read status into WREG
+	bsf			flash_ncs			; CS=1
+	btfsc		SSP2BUF,0			; Write operation in process?
+	bra			ext_flash_wait_write	; Yes, wait more..
+	return
+
+	global	ext_flash_erase_logbook	; erases logbook memory (000000h -> 2FFFFFh -> 3MByte)
+ext_flash_erase_logbook:
+	bsf			flash_ncs			; CS=1
+	clrf		ext_flash_address+0
+	clrf		ext_flash_address+1
+	clrf		ext_flash_address+2
+
+	movlw		d'48'
+	movwf		temp1				; 48*64kB=917504 Bytes
+ext_flash_erase_logbook_loop:
+	movlw		0x06				; WREN command
+	rcall		write_spi
+	bsf			flash_ncs			; CS=1
+	movlw		0xD8				; 64kB erase command
+	rcall		write_spi
+    rcall       ext_flash_write_address ; Write 24bit address ext_flash_address:3 via SPI
+	bsf			flash_ncs			; CS=1
+	rcall		ext_flash_wait_write	; Wait for write...
+
+	incf		ext_flash_address+2,F	; 64kB ahead
+	decfsz		temp1,F
+	bra			ext_flash_erase_logbook_loop
+	return
+
+
+write_spi:		; With data in WREG...
+	bcf			flash_ncs			; CS
+	global	write_spi1
+write_spi1:		; With data in WREG...
+	bcf			SSP2STAT,WCOL		; Clear flag	
+	movwf		SSP2BUF				; Write to buffer
+	btfsc		SSP2STAT,WCOL		; Was buffer full?
+	bra			write_spi1			; Yes, try again
+
+write_spi2:	; Wait for write command
+	btfss		SSP2STAT, BF		; Buffer full?
+	bra			write_spi2			; No, wait.
+	movf		SSP2BUF,W			
+	return	; Returns RX data in WREG and SSP2BUF
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/external_flash.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,57 @@
+;=============================================================================
+;
+;   File external_flash.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-12 : [mH] creation
+
+; Misc
+ extern	ext_flash_power_down		; Put Flash in Deep Power Down
+ extern	incf_ext_flash_address_p1	; +1 for the ext_flash_address:3
+ extern ext_flash_disable_protection; Disables write protection
+ extern	ext_flash_enable_protection	; Enables write protection
+
+; Writes
+ extern	write_byte_ext_flash_plus	; Write from WREG and increase address after write with banking at 0x200000
+ extern write_byte_ext_flash_plus_header ; Write from WREG and increase address after write
+ extern ext_flash_byte_write		; Writes one byte from WREG @ext_flash_address:3
+ extern	write_spi1					; Just (dummy)write to read a byte
+
+; Delelte
+ extern ext_flash_erase_logbook		; erases logbook memory (000000h -> 2FFFFFh -> 3MByte)
+ extern ext_flash_erase4kB			; Erases 4kB sector @ext_flash_address:3
+ 
+; Reads
+ extern ext_flash_read_block_start	; Block read start and reads one byte@ext_flash_address:3 into WREG
+ extern ext_flash_read_block		; Read another byte into WREG
+ extern ext_flash_read_block_stop	; Stop block read
+ extern ext_flash_byte_read			; Reads one byte@ext_flash_address:3 into WREG and temp1 
+ extern	ext_flash_byte_read_plus	; Return data read in WREG and temp1 and increase address after read with banking at 0x200000
+ extern	ext_flash_byte_read_plus_0x20; Return data read in WREG and temp1
+
+; Will decrease ext_flash_address:2 with the 8Bit value "ext_flash_temp1"
+	extern	decf_ext_flash_address0
+decf_ext_flash_address	macro	ext_flash_temp1
+        movlw	ext_flash_temp1
+        call 	decf_ext_flash_address0
+    endm
+
+	extern	incf_ext_flash_address0
+; Will increase ext_flash_address:2 with the 8Bit value "ext_flash_temp1"
+incf_ext_flash_address	macro	ext_flash_temp1	
+    	movlw	ext_flash_temp1                
+    	call 	incf_ext_flash_address0
+	endm
+
+; With banking at 0x200000
+	extern	incf_ext_flash_address0_0x20
+; Will increase ext_flash_address:2 with the 8Bit value "ext_flash_temp1"
+incf_ext_flash_address_0x20	macro	ext_flash_temp1	
+    	movlw	ext_flash_temp1                
+    	call 	incf_ext_flash_address0_0x20
+	endm
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gaslist.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,632 @@
+;=============================================================================
+;
+;   File gaslist.asm
+;
+;   Managing OSTC3 gas list
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-08-11 : [jDG] Creation.
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include    "convert.inc"
+#include    "math.inc"                  ; div16x16 for MOD calculations
+#include    "strings.inc"
+#include    "tft.inc"
+#include    "tft_outputs.inc"
+
+#include    "shared_definitions.h"
+
+        CBLOCK  tmp+0x40                ; Keep space for menu processor
+            gaslist_gas
+            gaslist_O2
+            gaslist_He
+            gaslist_depth
+            gaslist_Type
+		; Reserved to tmp+0x5F
+        ENDC
+
+    extern	convert_mbar_to_feet
+
+gui     CODE
+;=============================================================================
+; Append gas description to current string.
+; Input: PRODL : gas number (0..4)
+;        FSR2 : Current string position.
+; Output: Text appended into buffer pointed by FSR2.
+        extern  customview_show_mix
+        global  gaslist_strcat_gas
+gaslist_strcat_gas:
+        rcall   gaslist_setgas          ; Sets gaslist_gas (0-4 for OC/Bailout, 5-9 for Diluents)
+        ; Retrieve gas definition:
+gaslist_strcat_gas_0:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_O2_ratio   ; Read opt_gas_O2_ratio[WREG]
+        movff   PLUSW1,gaslist_O2
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_He_ratio   ; Read opt_gas_He_ratio[WREG]
+        movff   PLUSW1,gaslist_He
+
+        movff   gaslist_O2,lo
+        movff   gaslist_He,hi
+        call    customview_show_mix     ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+        return
+
+
+;=============================================================================
+; Append current mix to current string (For divemode)
+; Input: FSR2 : Current string position.
+; Output: Text appended into buffer pointed by FSR2.
+    global  gaslist_strcat_gasx
+gaslist_strcat_gasx:        ; Show current O2/He mix
+        STRCAT_TEXT tGas
+        STRCAT  ": "
+        movff   char_I_O2_ratio,lo
+        movff   char_I_He_ratio,hi
+        call    customview_show_mix     ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+        return
+
+    global  gaslist_show_type
+    extern  tGasDisabled
+    extern  tDilDisabled
+gaslist_show_type:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_type       ; Read opt_gas_type[WREG]
+        movff   PLUSW1,gaslist_Type
+        STRCAT_TEXT tType
+        lfsr    FSR1,tGasDisabled       ; Base text number
+        btfsc   ccr_diluent_setup       ; In CCR setup?
+        lfsr    FSR1,tDilDisabled       ; Base text number
+        movff   gaslist_Type,WREG       ; 0-3
+        rlncf   WREG                    ; x2
+        addwf   FSR1L,F
+        movlw   .0
+        addwfc  FSR1H,F
+        call    strcat_text
+        return
+
+    global  gaslist_toggle_type
+gaslist_toggle_type:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_type       ; Read opt_gas_type[WREG]
+        movff   PLUSW1,gaslist_Type
+        incf    gaslist_Type,F          ; 0-3/0-2
+        btfsc   ccr_diluent_setup       ; In CCR setup?
+        bra     gaslist_toggle_type2    ; Yes
+        btfsc   gaslist_Type,2          ; >3?
+        clrf    gaslist_Type            ; Clear to zero
+        movff   gaslist_Type,PLUSW1     ; Copy back result
+        return
+
+gaslist_toggle_type2:
+        movlw   .3
+        cpfslt  gaslist_Type            ; >2?
+        clrf    gaslist_Type            ; Clear to zero
+        movf    gaslist_gas,W
+        movff   gaslist_Type,PLUSW1     ; Copy back result
+        return
+
+        global  gaslist_setSP
+gaslist_setSP:
+        movff   PRODL,gaslist_gas       ; 0-4
+        return
+
+        extern  tbar
+        global  gaslist_strcat_setpoint
+        global  gaslist_strcat_setpoint_0
+gaslist_strcat_setpoint:
+        call    gaslist_setSP
+gaslist_strcat_setpoint_0:
+        bsf     leftbind
+        btfsc   short_gas_decriptions       ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+        bra     gaslist_strcat_setpoint2    ; Short version
+        STRCAT_TEXT tSP
+        incf    gaslist_gas,W
+        movwf   lo
+        output_8
+        bcf     leftbind
+        PUTC    ":"
+gaslist_strcat_setpoint2:                   ; Short version
+        lfsr    FSR1,opt_gas_type
+        btfsc   divemode
+        bra     gaslist_strcat_setpoint4    ; no "*" in divemode
+        movf    gaslist_gas,W
+        decf    PLUSW1,W                    ; Type-1 into WREG
+        bnz     gaslist_strcat_setpoint3    ; Not "first"
+        PUTC    "*"
+        bra     gaslist_strcat_setpoint4
+gaslist_strcat_setpoint3:
+        PUTC    " "
+gaslist_strcat_setpoint4:
+        movf    gaslist_gas,W
+        lfsr    FSR1,char_I_setpoint_cbar
+        movf    PLUSW1,W
+        movwf   lo
+    	clrf	hi
+        bsf     leftbind
+    	output_16dp d'3'
+        btfsc   divemode
+        bra     gaslist_strcat_setpoint5        ; Skip text in divemode
+        STRCAT_TEXT	 tbar
+gaslist_strcat_setpoint5:
+        PUTC    " "
+       ; Read switch depth
+        movf    gaslist_gas,W
+        lfsr    FSR1,char_I_setpoint_change
+        movff   PLUSW1,lo
+        bra     gaslist_strcat_4        ; And return...
+
+;----------------------------------------------------------------------------
+; Append gas description to current string.
+; Input: PRODL : gas number (0..4)
+;        FSR2 : Current string position.
+; Output: Text appended into buffer pointed by FSR2.
+;
+; NOTE: used in the menu-tree for the MENU_CALLBACK entry.
+
+gaslist_strcat_gas_better:   ; Yes, check if this is a "better gas"
+        movlw   .0
+        movff   WREG,win_invert
+        incf    gaslist_gas,W               ; gaslist_gas+1 -> WREG
+        cpfseq  better_gas_number           ; 1-5 for OC/Bailout and 6-10 for diluents
+        return
+       	movlw	color_yellow                ; show in yellow
+        call	TFT_set_color
+        movlw   .1
+        movff   WREG,win_invert             ; and invert
+        return
+
+        global  gaslist_strcat_gas_mod
+gaslist_strcat_gas_mod:
+        rcall   gaslist_setgas          ; Sets gaslist_gas (0-4 for OC/Bailout, 5-9 for Diluents)
+
+        global  gaslist_gastitle
+gaslist_gastitle:
+        btfsc   short_gas_decriptions       ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+        bra     gaslist_gastitle2           ; Short version
+        STRCAT_TEXT tGas
+        incf    gaslist_gas,W
+        movwf   lo
+        bsf     leftbind
+        output_8
+        bcf     leftbind
+        PUTC    ":"
+
+gaslist_gastitle2:                          ; Short version
+        lfsr    FSR1,opt_gas_type
+        btfsc   divemode
+        bra     gaslist_gastitle3           ; no "*" in divemode
+        movf    gaslist_gas,W
+        decf    PLUSW1,W                    ; Type-1 into WREG
+        bnz     gaslist_gastitle1           ; Not "First"
+        PUTC    "*"
+        bra     gaslist_gastitle3
+gaslist_gastitle1:
+        PUTC    " "
+gaslist_gastitle3:                          ; Short version
+        call    TFT_standard_color
+
+        btfsc   divemode                    ; In divemode?
+        rcall   gaslist_strcat_gas_better   ; Yes, check if this is a "better gas"
+
+        movf    gaslist_gas,W           ; (0-4 for OC/Bailout, 5-9 for Diluents)
+        movf    PLUSW1,W
+        bnz     gaslist_strcat_3
+        call    TFT_disabled_color
+gaslist_strcat_3:
+        rcall   gaslist_strcat_gas_0
+		PUTC	" "
+        ; Read switch depth
+        movf    gaslist_gas,W           ; (0-4 for OC/Bailout, 5-9 for Diluents)
+        lfsr    FSR1,char_I_deco_gas_change
+        movff   PLUSW1,lo
+        rcall   gaslist_calc_mod        ; Compute MOD into WREG
+        cpfsgt  lo
+        bra		gaslist_strcat_4
+        TFT_WARNINGS_COLOR              ; Turn red if bigger
+gaslist_strcat_4:
+		TSTOSS	opt_units               ; 0=Meters, 1=Feets
+		bra		gaslist_strcat_3_metric
+;gaslist_strcat_3_imperial:
+        movf    lo,W
+        mullw   .100                    ; convert meters to mbar
+        movff   PRODL,lo
+        movff   PRODH,hi
+		call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+        bsf     leftbind
+        output_16_3
+        STRCAT_TEXT	 tFeets				; "ft"
+        return
+		
+gaslist_strcat_3_metric:
+        output_99
+        STRCAT_TEXT	tMeters				; "m"
+        return
+
+;----------------------------------------------------------------------------
+; Store current menu item, and display gas description later.
+; Input: PRODL : gas number (0..4)
+; NOTE: used in the menu-tree for the MENU_CALLBACK entry.
+        global  gaslist_setgas
+gaslist_setgas:
+        movff   PRODL,gaslist_gas
+        movlw   .5
+        btfsc   ccr_diluent_setup       ; in CCR menus?
+        addwf   gaslist_gas,F           ; Yes, offset to gases 5-9
+        return
+
+
+    global  gaslist_cleanup_list    ; Takes care that only one gas can be first and first has 0m change depth
+gaslist_cleanup_list:
+        bcf     ignore_last_edited_gas
+        movlw   .0
+        btfsc   ccr_diluent_setup       ; In CCR-Menu?
+        addlw   .5                      ; Yes, adjust offset
+        subwf   gaslist_gas,F
+gaslist_cleanup_list1:
+        clrf    lo
+        lfsr    FSR1,opt_gas_type       ; Read opt_gas_type[WREG]
+        movlw   .5                      ; Check 5 gases
+        movwf   hi
+gaslist_cleanup_list2:
+        decf    hi,w                    ; 0-4
+        btfsc   ccr_diluent_setup       ; In CCR-Menu?
+        addlw   .5                      ; Yes, adjust offset
+        movff   PLUSW1,hi_temp
+        movlw   .1
+        cpfseq  hi_temp                 ; gas = first ?
+        bra     gaslist_cleanup_list3   ; No
+        incf    lo,F                    ; Yes, count "first gases"
+
+        btfss   ignore_last_edited_gas  ; If we are not in the second-pass mode
+        bra     gaslist_cleanup_list2b
+
+        decf    hi,w                    ; 0-4
+        cpfseq  gaslist_gas             ; Do not disable last edited gas
+gaslist_cleanup_list2b:
+        movff   hi,lo_temp              ; Keep the last "first gas" found
+gaslist_cleanup_list3:
+        decfsz  hi,F
+        bra     gaslist_cleanup_list2   ; Loop
+
+        tstfsz  lo                      ; No gas active?
+        bra     gaslist_cleanup_list4   ; No, at least one is active
+
+        btfsc   ccr_diluent_setup       ; In CCR-Menu?
+        bra     gaslist_cleanup_list3a  ; Yes.
+        ; make gas1 first and zero
+        movlw   .1                      ; First
+        movwf   lo_temp
+        movwf   INDF1
+        bra     gaslist_cleanup_list5   ; Set change depth to zero
+
+gaslist_cleanup_list3a:
+        movlw   .5
+        addwf   FSR1L,F
+        movlw   .0
+        addwfc  FSR1H,F                 ; Setup to Diluents
+        ; make dil1 first and zero
+        movlw   .1                      ; First
+        movwf   lo_temp
+        movwf   INDF1
+        bra     gaslist_cleanup_list5   ; Set change depth to zero
+
+gaslist_cleanup_list4:
+        movlw   .1
+        cpfsgt  lo                      ; More then one "first gas"?
+        bra     gaslist_cleanup_list5   ; No, done.
+        ; More then one Gas is "first gas"
+        ; Disable last found "first gas" but keep it's change depth
+        decf    lo_temp,W               ; 0-4
+        cpfseq  gaslist_gas             ; Do not disable last edited gas
+        bra     gaslist_cleanup_list4b
+        ; Do not disable last edited gas
+        ; search again but ignore last edited gas
+        bsf     ignore_last_edited_gas
+        bra     gaslist_cleanup_list1   ; Loop until only one "first gas" is left
+
+gaslist_cleanup_list4b:
+        btfsc   ccr_diluent_setup       ; In CCR-Menu?
+        addlw   .5                      ; Yes, adjust offset
+        clrf    PLUSW1                  ; Disable gas
+        bra     gaslist_cleanup_list    ; Loop until only one "first gas" is left
+
+gaslist_cleanup_list5:
+        lfsr    FSR1,char_I_deco_gas_change
+        decf    lo_temp,W
+        btfsc   ccr_diluent_setup       ; In CCR-Menu?
+        addlw   .5                      ; Yes, adjust offset
+        clrf    PLUSW1                  ; Set First gas to zero m
+        return
+
+;----------------------------------------------------------------------------
+; Increment/Decrement O2 ratio
+        global  gaslist_pO2
+gaslist_pO2:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_He_ratio   ; Read opt_gas_He_ratio[WREG]
+        movff   PLUSW1,gaslist_He
+        lfsr    FSR1,opt_gas_O2_ratio   ; Read opt_gas_O2_ratio[WREG]
+        movff   PLUSW1,gaslist_O2
+
+        incf    gaslist_O2,F            ; O2++
+        movf    gaslist_He,W
+        addwf   gaslist_O2,W
+        movwf   lo
+        movlw   .101
+        cpfslt  lo                      ; O2+He<101?
+        decf    gaslist_O2,F            ; O2-- (Unchanged)
+     
+        movf    gaslist_gas,W
+        movff   gaslist_O2,PLUSW1       ; And write back to opt_gas_O2_ratio[WREG]
+        return
+        
+        global  gaslist_mO2
+gaslist_mO2:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_O2_ratio   ; Read opt_gas_O2_ratio[WREG]
+        movff   PLUSW1,gaslist_O2
+
+        decf    gaslist_O2,F
+        movlw   gaslist_min_o2
+        cpfslt  gaslist_O2
+        bra     gaslist_mO2_1
+        movlw   gaslist_min_o2
+        movwf   gaslist_O2
+gaslist_mO2_1:
+        movf    gaslist_gas,W
+        movff   gaslist_O2,PLUSW1       ; And write back to opt_gas_O2_ratio[WREG]
+        return
+
+;----------------------------------------------------------------------------
+; Increment/Decrement He ratio
+        global  gaslist_pHe
+gaslist_pHe:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_O2_ratio   ; Read opt_gas_O2_ratio[WREG]
+        movff   PLUSW1,gaslist_O2
+        lfsr    FSR1,opt_gas_He_ratio   ; Read opt_gas_He_ratio[WREG]
+        movff   PLUSW1,gaslist_He
+
+        incf    gaslist_He,F            ; He++
+        movf    gaslist_He,W
+        addwf   gaslist_O2,W
+        movwf   lo
+        movlw   .101
+        cpfslt  lo                      ; O2+He<101?
+        decf    gaslist_He,F            ; Yes, He-- (Unchanged)
+
+        movf    gaslist_gas,W
+        movff   gaslist_He,PLUSW1       ; And write back to opt_gas_He_ratio[WREG]
+        return
+
+        global  gaslist_mHe
+gaslist_mHe:
+        movf    gaslist_gas,W
+        lfsr    FSR1,opt_gas_He_ratio   ; Read opt_gas_He_ratio[WREG]
+        movff   PLUSW1,gaslist_He
+
+        decf    gaslist_He,F
+        bnn     gaslist_mHe_1
+        clrf    gaslist_He
+gaslist_mHe_1:
+        movf    gaslist_gas,W
+        movff   gaslist_He,PLUSW1       ; And write back to opt_gas_He_ratio[WREG]
+        return
+
+;----------------------------------------------------------------------------
+; Increment/Decrement switch depth
+        global  gaslist_pDepth
+gaslist_pDepth:
+        movf    gaslist_gas,W
+        lfsr    FSR1,char_I_deco_gas_change
+        movff   PLUSW1,gaslist_O2       ; Read char_I_deco_gas_change[WREG]
+
+        incf    gaslist_O2,F
+        movlw   gaslist_max_change_depth
+        cpfsgt  gaslist_O2
+        bra     gaslist_pDepth_1
+        movlw   gaslist_max_change_depth
+        movwf   gaslist_O2
+gaslist_pDepth_1:
+        movf    gaslist_gas,W
+        movff   gaslist_O2,PLUSW1       ; Write back to char_I_deco_gas_change[WREG]
+        return
+        
+        global  gaslist_mDepth
+gaslist_mDepth:
+        movf    gaslist_gas,W
+        lfsr    FSR1,char_I_deco_gas_change
+        movff   PLUSW1,gaslist_O2       ; Read char_I_deco_gas_change[WREG]
+
+        decf    gaslist_O2,F
+        btfsc   STATUS,N
+        clrf    gaslist_O2
+       
+        movf    gaslist_gas,W
+        movff   gaslist_O2,PLUSW1       ; And write back to char_I_deco_gas_change[WREG]
+        return
+
+    global  gaslist_spplus
+gaslist_spplus:
+        movf    gaslist_gas,W
+        lfsr    FSR1,char_I_setpoint_cbar
+        movff   PLUSW1,lo               ; Read char_I_setpoint_cbar[WREG]
+        movlw	gaslist_sp_stepsize
+        addwf	lo,F
+        movlw	gaslist_sp_max
+        cpfsgt	lo
+        bra     gaslist_spplus2
+        movlw	gaslist_sp_min
+        movwf	lo
+gaslist_spplus2:
+        movf    gaslist_gas,W
+        movff   lo,PLUSW1               ; Write back to char_I_setpoint_cbar
+        return
+    
+    global  gaslist_spdepthplus
+gaslist_spdepthplus:
+        movf    gaslist_gas,W
+        bz      gaslist_spdepthplus3    ; Setpoint 1 is always 0m
+        lfsr    FSR1,char_I_setpoint_change
+        movff   PLUSW1,gaslist_O2       ; Read char_I_deco_gas_change[WREG]
+        incf    gaslist_O2,F
+        movlw   gaslist_max_change_depth
+        cpfsgt  gaslist_O2
+        bra     gaslist_spdepthplus_1
+        movlw   gaslist_max_change_depth
+        movwf   gaslist_O2
+gaslist_spdepthplus_1:
+        movf    gaslist_gas,W
+        movff   gaslist_O2,PLUSW1       ; Write back to char_I_deco_gas_change[WREG]
+        return
+
+gaslist_spdepthplus3:
+        movlw   .0
+        movff   WREG,char_I_setpoint_change+0   ; Reset to 0m
+        return
+
+    global  gaslist_spdepthminus
+gaslist_spdepthminus:
+        movf    gaslist_gas,W
+        bz      gaslist_spdepthplus3    ; Setpoint 1 is always 0m
+        lfsr    FSR1,char_I_setpoint_change
+        movff   PLUSW1,gaslist_O2       ; Read opt_gas_O2_ratio[WREG]
+        decf    gaslist_O2,F
+        btfsc   STATUS,N
+        clrf    gaslist_O2
+        movf    gaslist_gas,W
+        movff   gaslist_O2,PLUSW1       ; And write back to opt_gas_O2_ratio[WREG]
+        return
+
+;----------------------------------------------------------------------------
+; Compute MOD from ppO2 Max and current O2 Ratio.
+;
+; Input:  gaslist_gas = current gas index.
+;         opt_gas_O2_ratio[gaslist_gas] = current O2 ratio
+; Output: WREG = MOD [m]
+;
+gaslist_calc_mod:
+        movf    gaslist_gas,W           ; Read current gas O2 ratio
+        lfsr    FSR1,opt_gas_O2_ratio   ; Read opt_gas_O2_ratio[WREG]
+        movf    PLUSW1,W
+
+        btfsc   divemode                ; In divemode?
+        bra     gaslist_calc_mod_divemode   ; Yes.
+
+        ; Pamb max = ppO2 Max / O2 ratio
+        movwf   xB+0
+        clrf    xB+1
+
+        movff   opt_ppO2_max,WREG
+        mullw   .10
+        movff   PRODL,xA+0
+        movff   PRODH,xA+1
+        call    div16x16
+        
+        ; Prof = Pamb - 1bar.
+        movf    xC+0,W
+        addlw   -.10
+        return
+
+gaslist_calc_mod_divemode:
+    extern  TFT_color_code1
+        movwf   hi                          ; Copy O2%
+        movlw	warn_gas_in_gaslist
+        call	TFT_color_code1             ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold
+        return
+;----------------------------------------------------------------------------
+        global  gaslist_MOD_END
+gaslist_MOD_END:
+        rcall   gaslist_calc_mod        ; Compute MOD into WREG
+        movwf   lo                      ; Copy to lo
+        STRCAT_TEXT tEAD                ; EAD:
+   		TSTOSS	opt_units               ; 0=Meters, 1=Feets
+		bra		gaslist_MOD_metric
+;gaslist_MOD_imperial:
+        movf    lo,W
+        mullw   .100                    ; convert meters to mbar
+        movff   PRODL,lo
+        movff   PRODH,hi
+		call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+        bsf     leftbind
+        output_16_3
+        STRCAT_TEXT	 tFeets				; "ft"
+        bra     gaslist_MOD_common
+gaslist_MOD_metric:
+        output_8
+        STRCAT_TEXT tMeters             ; m
+gaslist_MOD_common:
+        PUTC      "/"
+        STRCAT_TEXT tEND                ; END:
+        rcall    gaslist_calc_mod       ; Output: WREG = MOD [m]
+        addlw   .10                     ; MOD=MOD+10m
+        movwf   xB+0
+        clrf    xB+1
+    	movlw	d'100'
+    	movwf	xA+0
+    	movf	gaslist_He,W                ; He value in % -> WREG
+    	subwf	xA+0,F                      ; xA+0 = 100 - He Value in %
+    	clrf	xA+1
+    	call	mult16x16                   ; xA*xB=xC
+        movff	xC+0,xA+0
+        movff	xC+1,xA+1
+        movlw	d'100'
+        movwf	xB+0
+        clrf	xB+1
+        call	div16x16                    ; xA/xB=xC with xA as remainder
+        ;	xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
+        movlw	d'10'
+        subwf	xC+0,F				        ; Subtract 10m...
+        movff	xC+0,lo
+; END 8Bit only
+;    	movlw	d'0'
+;    	subwfb	xC+1,F
+;        movff	xC+1,hi
+   		TSTOSS	opt_units               ; 0=Meters, 1=Feets
+		bra		gaslist_END_metric
+;gaslist_END_imperial:
+        movf    lo,W
+        mullw   .100                    ; convert meters to mbar
+        movff   PRODL,lo
+        movff   PRODH,hi
+		call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+        bsf     leftbind
+        output_16_3
+        STRCAT_TEXT	 tFeets				; "ft"
+        return
+gaslist_END_metric:
+        output_8
+        STRCAT_TEXT tMeters             ; m
+        return
+
+;----------------------------------------------------------------------------
+        global  gaslist_reset_mod_title
+gaslist_reset_mod_title:
+        STRCAT_TEXT tDepthReset
+
+gaslist_reset_mod_title2:
+        rcall   gaslist_calc_mod        ; Compute MOD into WREG
+        movwf   lo                      ; Copy to lo
+
+        movf    gaslist_gas,W           ; Compare to switch depth
+        lfsr    FSR1,char_I_deco_gas_change
+        movf   	PLUSW1,W
+        cpfslt  lo
+        bra     gaslist_strcat_4        ; And return...
+        TFT_WARNINGS_COLOR              ; Turn red if bigger !
+        bra     gaslist_strcat_4        ; And return...
+
+;----------------------------------------------------------------------------
+        global  gaslist_reset_mod
+gaslist_reset_mod:
+        rcall   gaslist_calc_mod        ; Compute MOD
+        movwf   gaslist_depth
+
+        movf    gaslist_gas,W           ; Read current gas O2 ratio
+        lfsr    FSR1,char_I_deco_gas_change
+        movff   gaslist_depth,PLUSW1    ; And save new change depth
+        return
+;----------------------------------------------------------------------------
+        END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gaslist.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,33 @@
+;=============================================================================
+;
+;   File gaslist.inc
+;
+;   Interface to OSTC3 gas list management.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-08-11 : [jDG] Creation.
+
+    ; Utils
+    extern  gaslist_strcat_gas
+    extern  gaslist_strcat_gas_mod
+    extern  gaslist_strcat_setpoint
+
+    ;Setpoint Setup
+    extern  gaslist_spplus,gaslist_spdepthplus, gaslist_spdepthminus,gaslist_setSP
+
+    ; Select currently edited gas
+    extern  gaslist_setgas, gaslist_gastitle
+    
+    ; Main gaslist menu
+    extern  gaslist_pO2, gaslist_mO2
+    extern  gaslist_pHe, gaslist_mHe
+    extern  gaslist_show_type
+    extern  gaslist_toggle_type
+    extern  gaslist_cleanup_list    ; Takes care that only one gas can be first and first has 0m change depth
+
+    ; Depth submennu
+    extern  gaslist_pDepth, gaslist_mDepth
+    extern  gaslist_MOD_END
+    extern  gaslist_reset_mod_title,  gaslist_reset_mod
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ghostwriter.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,958 @@
+;=============================================================================
+;
+;   File ghostwriter.asm
+;
+;   Ghostwriter (Log profile recorder)
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-11-27 : [mH] Creation
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include 	"shared_definitions.h"         ; Mailbox from/to p2_deco.c
+#include	"external_flash.inc"
+#include	"surfmode.inc"
+#include	"eeprom_rs232.inc"
+#include 	"strings.inc"
+#include	"isr.inc"
+#include	"tft_outputs.inc"
+#include	"divemode.inc"
+
+ghostwriter	CODE
+
+	global	store_dive_data
+store_dive_data:						; 5 seconds gone
+	bcf		store_sample				; update only any 5 seconds
+
+    ifndef __DEBUG
+    	btfsc	simulatormode_active    ; Are we in simulator mode?
+    	return                          ; Yes, discard everything
+    endif
+
+    SAFE_2BYTE_COPY rel_pressure, lo
+	movf	lo,W				        ; store depth with every sample
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movf	hi,W
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+
+;First, find out how many bytes will append to this sample....
+	clrf	ProfileFlagByte					; clear number of bytes to append
+
+; Check Extented informations
+	decfsz	divisor_temperature,W	; Check divisor
+	bra		check_extended1		
+	movlw	infolength_temperature
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended1:
+	decfsz	divisor_deco,W		; Check divisor
+	bra		check_extended2		
+	movlw	infolength_deco
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended2:
+	decfsz	divisor_gf,W		; Check divisor
+	bra		check_extended3		
+	movlw	infolength_gf
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended3:
+	decfsz	divisor_ppo2_sensors,W		; Check divisor
+	bra		check_extended4		
+	movlw	infolength_ppo2_sensors
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended4:
+	decfsz	divisor_decoplan,W     ; Check divisor
+	bra		check_extended5		
+	movlw	infolength_decoplan
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended5:
+	decfsz	divisor_cns,W		; Check divisor
+	bra		check_extended6		
+	movlw	infolength_cns
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended6:
+	decfsz	divisor_tank,W		; Check divisor
+	bra		check_extended7
+	movlw	infolength_tank
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+check_extended7:
+
+; Second, check global event flag
+	btfss	event_occured		; Check global event flag
+	bra		store_dive_data3	; No Event
+	incf    ProfileFlagByte,F	; add one byte (The EventByte)
+
+	clrf	EventByte			; reset EventByte
+
+	movf	AlarmType,W			; Type of Alarm Bit 0-3
+	addwf	EventByte,F			; Copy to EventByte Bit 0-3
+	clrf	AlarmType			; Reset AlarmType
+	
+; Third, check events and add aditional bytes
+	btfss	gas6_changed    	; Check flag
+	bra		check_event2
+	movlw	d'2'				; Information length
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+	bsf		EventByte,4			; Also set Flag in EventByte!
+check_event2:
+	btfss	stored_gas_changed	; Check flag
+	bra		check_event3
+	movlw	d'1'				; Information length
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+	bsf		EventByte,5			; Also set Flag in EventByte!
+check_event3:
+    btfss	setpoint_changed	; Check flag
+	bra		check_event4
+	movlw	d'1'				; Information length
+	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
+	bsf		EventByte,6			; Also set Flag in EventByte!
+check_event4:
+	; more events?
+	bsf		ProfileFlagByte,7	; Set EventByte Flag in ProfileFlagByte
+
+store_dive_data3:
+	movf	ProfileFlagByte,W	; finally, write ProfileFlagByte!
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+
+	btfss	event_occured		; Check global event flag (again)
+	bra		store_dive_data4	; No Event
+
+; Store the EventByte + additional bytes now
+	movf	EventByte,W		
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+
+	btfss	gas6_changed       	; Check flag
+	bra		store_dive_data3b
+    movff   char_I_O2_ratio,WREG
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    movff   char_I_He_ratio,WREG
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	bcf		gas6_changed    	; Clear this event
+store_dive_data3b:
+	btfss	stored_gas_changed	; Check flag
+	bra		store_dive_data3c
+	movf	active_gas,W		; Store active gas
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	bcf		stored_gas_changed	; Clear this event
+store_dive_data3c:
+	btfss	setpoint_changed	; Check flag
+	bra		store_dive_data3d
+	movff	char_I_const_ppO2,WREG
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	bcf		setpoint_changed	; Clear this event
+store_dive_data3d:
+
+store_dive_data4:
+
+; Store extended informations
+	decfsz	divisor_temperature,F	; Check divisor
+	bra		store_extended1	
+	rcall	store_dive_temperature
+store_extended1:
+	decfsz	divisor_deco,F			; Check divisor
+	bra		store_extended2	
+	rcall	store_dive_decodata
+store_extended2:
+	decfsz	divisor_gf,F			; Check divisor
+	bra		store_extended3	
+	rcall	store_dive_gf
+store_extended3:
+	decfsz	divisor_ppo2_sensors,F	; Check divisor
+	bra		store_extended4	
+	rcall	store_dive_ppO2_sensors
+store_extended4:
+	decfsz	divisor_decoplan,F		; Check divisor
+	bra		store_extended5	
+	rcall	store_dive_decoplan
+store_extended5:
+	decfsz	divisor_cns,F			; Check divisor
+	bra		store_extended6	
+	rcall	store_dive_cns
+store_extended6:
+	decfsz	divisor_tank,F			; Check divisor
+	bra		store_extended7
+	rcall	store_dive_tank
+store_extended7:
+
+; The next block is required to take care of "store never"
+	btfsc	divisor_temperature,7	; Test highest Bit (Register must have been zero before the "decfsz" command!)
+	clrf	divisor_temperature		; And clear register again, so it will never reach zero...
+	btfsc	divisor_deco,7
+	clrf	divisor_deco
+	btfsc	divisor_gf,7
+	clrf	divisor_gf
+	btfsc	divisor_ppo2_sensors,7
+	clrf	divisor_ppo2_sensors
+	btfsc	divisor_decoplan,7
+	clrf	divisor_decoplan
+	btfsc	divisor_cns,7
+	clrf	divisor_cns
+	btfsc	divisor_tank,7
+	clrf	divisor_tank
+
+store_dive_data5:
+	bcf		event_occured		; Clear the global event flag
+	return						; Done. (Sample with all informations written to external flash)
+	
+store_dive_cns:
+	movff	int_O_CNS_fraction+0,WREG
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movff	int_O_CNS_fraction+1,WREG
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movlw	div_cns
+	movwf	divisor_cns						; Reload divisor from CF
+	return
+
+store_dive_tank:
+	movlw	div_tank
+	movwf	divisor_tank						; Reload divisor from CF
+	return
+
+store_dive_decoplan:
+    ; Store the decoplan
+    lfsr    FSR1,char_O_deco_time_for_log+.0
+    movlw   .15
+    movwf   lo
+store_dive_decoplan_loop:
+    movf    POSTINC1,W
+    rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    decfsz  lo,F
+    bra     store_dive_decoplan_loop
+	movlw	div_decoplan
+	movwf	divisor_decoplan             ; Reload divisor from CF
+	return
+
+store_dive_ppO2_sensors:
+    movf    o2_ppo2_sensor1,W            ; Sensor1 ppO2 (in 0.01bar steps)
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    SAFE_2BYTE_COPY o2_mv_sensor1,lo     ; o2_mv_sensor may be modifified via ISR during the two writes here...
+    movf    lo,W                         ; in 0.1mV steps
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    movf    hi,W                         ; in 0.1mV steps
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+
+    movf    o2_ppo2_sensor2,W            ; Sensor2 ppO2 (in 0.01bar steps)
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    SAFE_2BYTE_COPY o2_mv_sensor2,lo     ; o2_mv_sensor may be modifified via ISR during the two writes here...
+    movf    lo,W                         ; in 0.1mV steps
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    movf    hi,W                         ; in 0.1mV steps
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+
+    movf    o2_ppo2_sensor3,W            ; Sensor3 ppO2 (in 0.01bar steps)
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    SAFE_2BYTE_COPY o2_mv_sensor3,lo     ; o2_mv_sensor may be modifified via ISR during the two writes here...
+    movf    lo,W                         ; in 0.1mV steps
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+    movf    hi,W                         ; in 0.1mV steps
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+
+	movlw	div_ppo2_sensors
+	movwf	divisor_ppo2_sensors        ; Reload divisor
+	return
+
+store_dive_gf:
+	movff	char_O_gradient_factor,WREG		; gradient factor absolute
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movlw	div_gf
+	movwf	divisor_gf						; Reload divisor
+	return
+
+store_dive_decodata:
+	movf	decodata+0,W					; =0:no stop dive, if in deco mode: ceiling in m
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movf	decodata+1,W					; no stop time of length of first stop
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movlw	div_deco
+	movwf	divisor_deco					; Reload divisor
+	return
+
+store_dive_temperature:
+    SAFE_2BYTE_COPY temperature,lo
+	movf	lo,W			            	; append temperature to current sample!
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movf	hi,W
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movlw	div_temperature
+	movwf	divisor_temperature				; Reload divisor
+	return
+
+ghostwrite_byte_header:
+	goto	write_byte_ext_flash_plus_header	; (This call will also delete the 4kB TOC entry first)
+    ; returns...
+
+ghostwrite_byte_profile:
+    goto    write_byte_ext_flash_plus	; writes byte and increases address with banking at 0x200000
+    ; returns...
+
+	global	ghostwriter_end_dive
+ghostwriter_end_dive:
+	movff	ext_flash_address+0,ext_flash_log_pointer+0
+	movff	ext_flash_address+1,ext_flash_log_pointer+1
+	movff	ext_flash_address+2,ext_flash_log_pointer+2	; Save end-of-profile pointer to store in header
+
+	btfss	realdive					; dive longer then one minute
+	goto	ghostwriter_end_dive_common				; No, discard everything
+
+; In DEBUG compile, keep all simulated dives in logbook, Desat time, nofly, etc...
+    ifndef __DEBUG
+    	btfsc	simulatormode_active		; Are we in simulator mode?
+    	goto	ghostwriter_end_dive_common				; Yes, discard everything
+    endif
+
+	; Dive finished (and longer then one minute or Apnoe timeout occured)
+
+	btfsc	FLAG_apnoe_mode					; Calc max. depth (again) for very short apnoe dives
+	call	apnoe_calc_maxdepth
+
+	; calculate desaturation time
+	movff	last_surfpressure_30min+0,int_I_pres_surface+0          ; Pass surface to desat routine !
+	movff	last_surfpressure_30min+1,int_I_pres_surface+1
+
+	call	deco_calc_desaturation_time ; calculate desaturation time
+	movlb	b'00000001'                 ; select ram bank 1
+	movff	int_O_desaturation_time+0, desaturation_time+0
+	movff	int_O_desaturation_time+1, desaturation_time+1	; Buffer
+    call	calc_deko_surfmode
+	rcall	calculate_noflytime         ; Calc NoFly time
+
+										; store header and ...
+	movlw	0xFD						; .... End-of-Profile Bytes
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movlw	0xFD
+	rcall   ghostwrite_byte_profile      ; WREG -> Profile in ext. Flash
+	movff	ext_flash_address+0,ext_flash_log_pointer+0
+	movff	ext_flash_address+1,ext_flash_log_pointer+1
+	movff	ext_flash_address+2,ext_flash_log_pointer+2	; Save end-of-profile pointer to store in header
+
+    ; Set to first address again to store dive length ext_flash_dive_counter:3
+	clrf    EEADRH                      ; Make sure to select eeprom bank 0
+	read_int_eeprom	.4
+	movff	EEDATA,ext_flash_address+0
+	read_int_eeprom	.5
+	movff	EEDATA,ext_flash_address+1
+	read_int_eeprom	.6
+	movff	EEDATA,ext_flash_address+2
+
+    incf_ext_flash_address_0x20	d'6'        ; Skip internal "0xFA 0xFA #Divenumber:2 0xFA 0xFA" Header
+    ; Store dive length
+    movf   ext_flash_dive_counter+0,W
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+    movf   ext_flash_dive_counter+1,W
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+    movf   ext_flash_dive_counter+2,W
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+; profile recording done.
+
+	; Load total number of dives
+	read_int_eeprom .2
+	movff	EEDATA,lo
+	read_int_eeprom .3
+	movff	EEDATA,hi
+	; +1                        increase total dive counter
+	incf	lo,F
+	movlw	d'0'
+	addwfc	hi,F
+	; Store new number in EEPROM
+	movff	lo,EEDATA
+	write_int_eeprom	.2
+	movff	hi,EEDATA
+	write_int_eeprom	.3
+
+	decf	lo,F		; -1
+	; Set ext_flash_address:3 to TOC entry of this dive
+	; 1st: 200000h-200FFFh -> lo=0
+	; 2nd: 201000h-201FFFh -> lo=1
+	; 3rd: 202000h-202FFFh -> lo=2
+	; 255: 2FF000h-2FFFFFh -> lo=255
+
+	clrf	ext_flash_address+0
+	clrf	ext_flash_address+1
+	movlw	0x20
+	movwf	ext_flash_address+2
+	movlw	.16
+	mulwf	lo							; lo*16 = offset to 0x2000 (up:hi)
+	movf	PRODL,W
+	addwf	ext_flash_address+1,F
+	movf	PRODH,W
+	addwfc	ext_flash_address+2,F
+	
+; Now, write header
+
+	movlw	0xFA						; Header start
+    rcall   ghostwrite_byte_header  ; (This call will also delete the 4kB TOC entry first)
+	movlw	0xFA
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	; store pointer to begin of diveprofile
+	read_int_eeprom	.4
+	movf	EEDATA,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	read_int_eeprom	.5
+	movf	EEDATA,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	read_int_eeprom	.6
+	movf	EEDATA,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+		; store pointer to end of diveprofile
+	movf	ext_flash_log_pointer+0,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	ext_flash_log_pointer+1,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	ext_flash_log_pointer+2,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	; write rest of header
+	movlw	logbook_profile_version     ; Defined in ostc3.inc
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+    ; Store dive length
+    movf    ext_flash_dive_counter+0,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    movf    ext_flash_dive_counter+1,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    movf    ext_flash_dive_counter+2,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	movf	year,W                     ; Date
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	month,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	day,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	hours,W						; End of dive time
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	mins,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	btfss	FLAG_apnoe_mode				; Store apnoe max or normal max (Which is only max from the last descent)
+	bra		end_dive1					; Store normal depth
+
+	movff	apnoe_max_pressure+0,lo
+	movff	apnoe_max_pressure+1,hi
+	call	adjust_depth_with_salinity	; computes salinity setting into lo:hi [mbar]
+	movff	lo,apnoe_max_pressure+0
+	movff	hi,apnoe_max_pressure+1
+	
+	movf	apnoe_max_pressure+0,W		; Max. depth
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	apnoe_max_pressure+1,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	bra		end_dive2					; skip normal max. depth
+		
+end_dive1:
+	movff	max_pressure+0,lo
+	movff	max_pressure+1,hi
+	call	adjust_depth_with_salinity	; computes salinity setting into lo:hi [mbar]
+	movff	lo,max_pressure+0
+	movff	hi,max_pressure+1
+	
+	movff	max_pressure+0,WREG			; Max. depth
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	max_pressure+1,WREG
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+end_dive2:
+	movf	divemins+0,W            ; divetime minutes
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	divemins+1,W
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movf	divesecs,W				; divetime seconds
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	minimum_temperature+0,WREG			; minimum temperature
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	minimum_temperature+1,WREG		
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	last_surfpressure_30min+0,WREG		; airpressure before dive
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	last_surfpressure_30min+1,WREG		
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	int_O_desaturation_time+0,WREG		; desaturation time in minutes
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	int_O_desaturation_time+1,WREG
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+    btfss   FLAG_ccr_mode           ; In CCR mode...
+    bra     end_dive_oc_gaslist     ; No, write OC gases
+    ; Write Diluents...
+	movff	opt_dil_O2_ratio+0,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_dil_He_ratio+0,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_dil_change+0,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_dil_type+0,WREG                   
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2=Normal
+
+	movff	opt_dil_O2_ratio+1,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_dil_He_ratio+1,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_dil_change+1,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_dil_type+1,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2=Normal
+
+	movff	opt_dil_O2_ratio+2,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_dil_He_ratio+2,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_dil_change+2,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_dil_type+2,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2=Normal
+
+	movff	opt_dil_O2_ratio+3,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_dil_He_ratio+3,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_dil_change+3,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_dil_type+3,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2=Normal
+
+	movff	opt_dil_O2_ratio+4,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_dil_He_ratio+4,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_dil_change+4,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_dil_type+4,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2=Normal
+    bra     end_dive_oc_cc_common
+
+end_dive_oc_gaslist:            	; OC Gases...
+	movff	opt_gas_O2_ratio+0,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_gas_He_ratio+0,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_deco_gas_change+0,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_gas_type+0,WREG                   
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2= Travel, 3= Deco
+
+	movff	opt_gas_O2_ratio+1,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_gas_He_ratio+1,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_deco_gas_change+1,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_gas_type+1,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2= Travel, 3= Deco
+
+	movff	opt_gas_O2_ratio+2,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_gas_He_ratio+2,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_deco_gas_change+2,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_gas_type+2,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2= Travel, 3= Deco
+
+	movff	opt_gas_O2_ratio+3,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_gas_He_ratio+3,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_deco_gas_change+3,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_gas_type+3,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2= Travel, 3= Deco
+
+	movff	opt_gas_O2_ratio+4,WREG
+	rcall	ghostwrite_byte_header	; %O2
+	movff	opt_gas_He_ratio+4,WREG
+	rcall	ghostwrite_byte_header	; %He
+	movff	char_I_deco_gas_change+4,WREG
+	rcall	ghostwrite_byte_header	; Configured change depth in m
+    movff   opt_gas_type+4,WREG
+    rcall	ghostwrite_byte_header	; 0=Disabled, 1=First, 2= Travel, 3= Deco
+;    bra     end_dive_oc_cc_common
+
+end_dive_oc_cc_common:
+	movlw	softwareversion_x			; Firmware version
+	rcall	ghostwrite_byte_header
+	movlw	softwareversion_y
+	rcall	ghostwrite_byte_header
+	movf	batt_voltage+0,W			; Battery voltage 
+	rcall	ghostwrite_byte_header
+	movf	batt_voltage+1,W
+	rcall	ghostwrite_byte_header
+
+	movlw	samplingrate				; Sampling rate
+	btfsc	FLAG_apnoe_mode				; Apnoe mode?
+	movlw	samplingrate_apnoe			; Apnoe sampling rate
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+    ; CNS at gebinning of dive
+	movff	CNS_start+0,WREG
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    movff	CNS_start+1,WREG
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    ; Gradient factor
+    movff	GF_start,WREG
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    movff   char_O_relative_gradient_GF,WREG
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    ; Spares at Byte 57-60
+    movlw   0xFF
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    movlw   0xFF
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    movlw   0xFF
+    rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+    ; Store 5 Setpoints
+    movff   char_I_setpoint_cbar+0,WREG
+    rcall	ghostwrite_byte_header	; Setpoint in cbar
+    movff   char_I_setpoint_change+0,WREG
+    rcall	ghostwrite_byte_header	; Change depth
+    movff   char_I_setpoint_cbar+1,WREG
+    rcall	ghostwrite_byte_header	; Setpoint in cbar
+    movff   char_I_setpoint_change+1,WREG
+    rcall	ghostwrite_byte_header	; Change depth
+    movff   char_I_setpoint_cbar+2,WREG
+    rcall	ghostwrite_byte_header	; Setpoint in cbar
+    movff   char_I_setpoint_change+2,WREG
+    rcall	ghostwrite_byte_header	; Change depth
+    movff   char_I_setpoint_cbar+3,WREG
+    rcall	ghostwrite_byte_header	; Setpoint in cbar
+    movff   char_I_setpoint_change+3,WREG
+    rcall	ghostwrite_byte_header	; Change depth
+    movff   char_I_setpoint_cbar+4,WREG
+    rcall	ghostwrite_byte_header	; Setpoint in cbar
+    movff   char_I_setpoint_change+4,WREG
+    rcall	ghostwrite_byte_header	; Change depth
+
+    movff   opt_salinity,WREG       ; Salinity (0-5%)
+	rcall	ghostwrite_byte_header	; Store Salinity to Dive
+
+	movff	int_O_CNS_fraction+0,WREG		; copy into bank1
+    rcall	ghostwrite_byte_header; Stores CNS%
+    movff	int_O_CNS_fraction+1,WREG		; copy into bank1
+	rcall	ghostwrite_byte_header; Stores CNS%
+
+	movff	avr_rel_pressure_total+0,WREG	; Average Depth
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	avr_rel_pressure_total+1,WREG	; Average Depth
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	movff	total_divetime_seconds+0,WREG	; Total dive time (Regardless of start_dive_threshold)
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movff	total_divetime_seconds+1,WREG	; Total dive time (Regardless of start_dive_threshold)
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	movff	char_I_GF_Low_percentage,WREG	; GF_lo
+	movff	char_I_deco_model,lo
+	decfsz	lo,F							; jump over next line if char_I_deco_model == 1
+	movff	char_I_saturation_multiplier,WREG ; Saturation Multiplier
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	movff	char_I_GF_High_percentage,WREG	; GF_hi
+	movff	char_I_deco_model,lo
+	decfsz	lo,F							; jump over next line if char_I_deco_model == 1
+	movff	char_I_desaturation_multiplier,WREG ; Desaturation Multiplier
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+
+	movff	char_I_deco_model,WREG			; 0 = ZH-L16, 1 = ZH-L16-GF
+	rcall	ghostwrite_byte_header; writes byte and increases address (no banking)
+
+	read_int_eeprom	.2
+	movf	EEDATA,W
+	rcall	ghostwrite_byte_header  ; Total dive counter, low
+	read_int_eeprom	.3
+	movf	EEDATA,W
+	rcall	ghostwrite_byte_header  ; Total dive counter, high
+
+    movff   opt_dive_mode,WREG
+	rcall	ghostwrite_byte_header  ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
+
+;   Store all tissue data available
+    movlw   .16
+    movwf   lo
+    lfsr    FSR1,char_O_tissue_N2_saturation+0
+end_dive_store_tissues_N2:
+    movf    POSTINC1,W
+    rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    decfsz  lo,F
+    bra     end_dive_store_tissues_N2   ; No
+
+    movlw   .64
+    movwf   lo
+    lfsr    FSR1,0x700;pres_tissue_N2+0       ; 16*4Byte Float = 64Bytes
+end_dive_store_tissues_N2_2:
+    movf    POSTINC1,W
+    rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    decfsz  lo,F
+    bra     end_dive_store_tissues_N2_2 ; No
+
+    movlw   .16
+    movwf   lo
+    lfsr    FSR1,char_O_tissue_He_saturation+0
+end_dive_store_tissues_He:
+    movf    POSTINC1,W
+    rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    decfsz  lo,F
+    bra     end_dive_store_tissues_He   ; No
+
+    movlw   .64
+    movwf   lo
+    lfsr    FSR1,0x740;pres_tissue_He+0       ; 16*4Byte Float = 64Bytes
+end_dive_store_tissues_He_2:
+    movf    POSTINC1,W
+    rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    decfsz  lo,F
+    bra     end_dive_store_tissues_He_2 ; No
+
+    ; Some deco stuff
+    movff   char_I_depth_last_deco,WREG ; last stop [m]
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   char_I_deco_distance,WREG   ; assumed distance to shown stop
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+
+    ; Last HUD data
+    movff   hud_battery_mv+0,WREG       ; Last HUD battery value
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   hud_battery_mv+1,WREG       ; Last HUD battery value
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   hud_status_byte,WREG        ; Last HUD status
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+
+    ; Battery gauge registers [nAs]
+    movff   battery_gauge+0,WREG        ; Battery gauge register
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   battery_gauge+1,WREG        ; Battery gauge register
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   battery_gauge+2,WREG        ; Battery gauge register
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   battery_gauge+3,WREG        ; Battery gauge register
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   battery_gauge+4,WREG        ; Battery gauge register
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+    movff   battery_gauge+5,WREG        ; Battery gauge register
+	rcall	ghostwrite_byte_header      ; WREG -> Header in ext. flash
+
+    ; Header stop
+	movlw	0xFB
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	movlw	0xFB
+	rcall	ghostwrite_byte_header	; WREG -> Header in ext. flash
+	
+	call	divemode_store_statistics		; Store/update statistics for this unit
+
+	clrf	surface_interval+0
+	clrf	surface_interval+1				; Clear surface interval timer
+
+ghostwriter_end_dive_common:
+; Update ext_flash_log_pointer into EEPROM
+	clrf	EEADRH
+	movff	ext_flash_log_pointer+0,EEDATA
+	write_int_eeprom .4
+	movff	ext_flash_log_pointer+1,EEDATA
+	write_int_eeprom .5
+	movff	ext_flash_log_pointer+2,EEDATA
+	write_int_eeprom .6
+
+	bcf		simulatormode_active			; if we were in simulator mode
+
+; In DEBUG compile, keep all simulated dives in logbook, Desat time, nofly, etc...
+    ifndef __DEBUG
+		extern	deco_pull_tissues_from_vault
+		btfsc	restore_deco_data			; Restore decodata?
+	    call    deco_pull_tissues_from_vault
+        banksel common                  ; Bank1
+	endif
+	call	update_battery_registers	; update battery registers into EEPROM
+	goto	surfloop					; and return to surfaceloop
+
+	global	ghostwriter_short_header
+ghostwriter_short_header:	; Write short header with divenumber into profile memory
+
+	; load pointer for profile storing into RAM (Updated in EEPROM after the dive)
+	clrf    EEADRH                      ; Make sure to select eeprom bank 0
+	read_int_eeprom	.4
+	movff	EEDATA,ext_flash_address+0
+	read_int_eeprom	.5
+	movff	EEDATA,ext_flash_address+1
+	read_int_eeprom	.6
+	movff	EEDATA,ext_flash_address+2
+
+    ; Clear dive length counter
+    clrf    ext_flash_dive_counter+0
+    clrf    ext_flash_dive_counter+1
+    clrf    ext_flash_dive_counter+2
+
+	; Write short header with divenumber into profile memory
+	movlw	0xFA
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	0xFA
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	; Load total number of dives (low byte only)
+	read_int_eeprom .2
+	incf	EEDATA,W							;+1	
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	read_int_eeprom .3
+	movf	EEDATA,W
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	0xFA
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	0xFA
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+    ; Keep room for dive length ext_flash_dive_counter:3 (Stored at the end of the dive)
+    incf_ext_flash_address_0x20	d'3'        ; Skip Bytes in external flash (faster)
+
+	movlw	samplingrate				; Sampling rate
+	btfsc	FLAG_apnoe_mode				; Apnoe mode?
+	movlw	samplingrate_apnoe			; Apnoe sampling rate
+	rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .7                          ; Number of divisors
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .0                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_temperature
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_temperature             ; Divisor temperature
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .1                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_deco
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_deco                    ; Divisor decodata
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .2                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_gf
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_gf                      ; Divisor gf
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .3                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_ppo2_sensors
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_ppo2_sensors            ; Divisor ppO2
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .4                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_decoplan
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_decoplan                ; Divisor debug
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .5                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_cns
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_cns                     ; Divisor CNS
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+    movlw   .6                          ; Type
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	infolength_tank
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+	movlw	div_tank                    ; Divisor Tank
+    rcall	ghostwrite_byte_profile 	; WREG -> Profile in ext. flash
+
+	return
+
+calculate_noflytime:
+	; calculate nofly time
+	movff	int_O_desaturation_time+0,xA+0
+	movff	int_O_desaturation_time+1,xA+1
+
+    btfsc   xA+1,7                  ; Is desat time negative ?
+    bra     calculate_noflytime_3   ; Then surely not valid !
+
+	tstfsz	xA+0			; Desat=0?
+	bra		calculate_noflytime2
+	tstfsz	xA+1			; Desat=0?
+	bra		calculate_noflytime2
+
+calculate_noflytime_3:	
+	; Desaturation time = zero
+	clrf	nofly_time+0			; Clear nofly time
+	clrf	nofly_time+1			; Clear nofly time
+	return
+
+calculate_noflytime2:	
+	movff	xA+0,int_I_temp+0
+	movff	xA+1,int_I_temp+1
+	movlw	no_fly_time_ratio		; nofly_time_ratio                
+	movff	WREG,char_I_temp
+	call	deco_calc_percentage
+	movlb	b'00000001'				; select ram bank 1
+	movff	int_I_temp+0,xA+0
+	movff	int_I_temp+1,xA+1
+	tstfsz	xA+0			; Desat=0?
+	bra		calculate_noflytime_2_final
+	tstfsz	xA+1			; Desat=0?
+	bra		calculate_noflytime_2_final
+	bra     calculate_noflytime_3
+
+calculate_noflytime_2_final:
+	movff	xA+0,nofly_time+0
+	movff	xA+1,nofly_time+1
+	return
+
+
+divemode_store_statistics:	; Store/update statistics for this unit
+	rcall	do_logoffset_common_read	; Existing logbook offset into lo:hi
+	
+	tstfsz	lo							; lo=0?
+	bra		change_logbook_offset1		; No, adjust offset	
+	tstfsz	hi							; hi=0?
+	bra		change_logbook_offset1		; No, adjust offset
+	bra		change_logbook_offset2		; lo=0 and hi=0 -> skip Offset routine
+change_logbook_offset1:
+	movlw	d'1'
+	addwf	lo
+	movlw	d'0'
+	addwfc	hi
+	rcall	do_logoffset_common_write	; lo:hi -> EEPROM
+change_logbook_offset2:
+	; Add more here...
+	return	
+
+	global	do_logoffset_common_write
+do_logoffset_common_write:
+	movff	lo,EEDATA
+	write_int_eeprom	0x0D
+	movff	hi,EEDATA
+	write_int_eeprom	0x0E
+	return
+
+	global	do_logoffset_common_read
+do_logoffset_common_read:
+	clrf	EEADRH
+	read_int_eeprom		0x0D
+	movff	EEDATA,lo
+	read_int_eeprom		0x0E
+	movff	EEDATA,hi					; Existing logbook offset into lo:hi
+	return
+
+
+	global		update_battery_registers
+update_battery_registers:
+	; save battery_gauge:6 into EEPROM 0x07-0x0C
+	clrf	EEADRH
+	movff	battery_gauge+0,EEDATA
+	write_int_eeprom 0x07
+	movff	battery_gauge+1,EEDATA
+	write_int_eeprom 0x08
+	movff	battery_gauge+2,EEDATA
+	write_int_eeprom 0x09
+	movff	battery_gauge+3,EEDATA
+	write_int_eeprom 0x0A
+	movff	battery_gauge+4,EEDATA
+	write_int_eeprom 0x0B
+	movff	battery_gauge+5,EEDATA
+	write_int_eeprom 0x0C
+	bcf		onehourupdate	; Clear flag
+	return
+
+
+ END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ghostwriter.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,18 @@
+;=============================================================================
+;
+;   File ghostwriter.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-11-27 : [mH] Creation
+
+	extern 	store_dive_data
+	extern	ghostwriter_end_dive
+	extern	ghostwriter_short_header
+	extern	update_battery_registers
+	extern	do_logoffset_common_write
+	extern	do_logoffset_common_read
+
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/i2c.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,354 @@
+;=============================================================================
+;
+;   File i2c.asm
+;
+;   I2C Interface to HMC5883L and MMA8452Q
+;
+;   HMC5883L's read address (8-Bit):    0x3D
+;   HMC5883L's write address (8-Bit):   0x3C
+;
+;   MMA8452Q's read address (8-Bit):    0x39
+;   MMA8452Q's write address (8-Bit):   0x38
+;
+;   Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2012-08-22 : [mH] Creation
+
+
+#include "ostc3.inc"                ; Mandatory header
+#include "wait.inc"
+
+i2c    CODE
+
+WaitMSSP:
+	decfsz		i2c_temp,F          ; check for timeout during I2C action
+	bra			WaitMSSP2
+	bra			I2CFail             ; timeout occured
+WaitMSSP2:
+	btfss		PIR1,SSPIF
+	bra			WaitMSSP
+	clrf		i2c_temp
+	bcf			PIR1,SSPIF
+	nop
+	return
+
+I2C_WaitforACK:
+	btfss		SSPCON2,ACKSTAT     ; checks for ACK bit from slave
+    return
+I2CFail:
+	rcall		I2CReset            ; I2C Reset
+	bcf			PIR1,SSPIF
+	clrf		i2c_temp
+	return
+
+I2CReset:                           ; Something went wrong (Slave holds SDA low?)
+	clrf		SSP1CON1            ; wake-up slave and reset entire module
+	clrf		SSP1CON2
+	clrf		SSP1STAT
+	bcf			TRISC,3             ; SCL OUTPUT
+	bsf			TRISC,4             ; SDA Input
+	bcf			PORTC,3
+	movlw		d'9'
+	movwf		i2c_temp            ; clock-out 9 clock cycles manually
+I2CReset_1:
+	bsf			PORTC,3             ; SCL=1
+	nop
+	nop
+	nop
+	nop
+	btfsc		PORTC,4             ; SDA=1?
+	bra			I2CReset_2          ; =1, SDA has been released from slave
+	bcf			PORTC,3             ; SCL=0
+	nop
+	nop
+	bcf			PORTC,3
+	nop
+	nop
+	decfsz		i2c_temp,F
+	bra         I2CReset_1          ; check for nine clock cycles
+I2CReset_2:
+	bsf			TRISC,3             ; SCL Input
+	clrf		SSP1CON1            ; setup I²C Mode
+	WAITMS		d'10'               ; Reset-Timeout for I2C devices
+	movlw		b'00000000'         ; with slew rate control
+	movwf		SSPSTAT
+	movlw		b'00101000'
+	movwf		SSP1CON1
+	movlw		b'00000000'
+	movwf		SSP1CON2
+    movlw       0x27
+	movwf		SSP1ADD
+	return
+
+I2C_TX:
+	movwf		SSP1BUF
+	rcall		WaitMSSP
+	bra 		I2C_WaitforACK      ; Returns...
+
+I2C_TwoBytesRX_div16:       ; Get two bytes and devide lo:hi/16 (signed)
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,hi          ; Data Byte
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,lo          ; Data Byte
+I2C_TwoBytesRX_div16_2:     ; devide lo:hi/16 (signed) only
+    bcf			STATUS,C
+    btfsc       hi,7        ; Copy sign bit to carry
+    bsf         STATUS,C
+    rrcf		hi          ; /2
+	rrcf		lo
+    bcf			STATUS,C
+    btfsc       hi,7        ; Copy sign bit to carry
+    bsf         STATUS,C
+    rrcf		hi          ; /4
+	rrcf		lo
+    bcf			STATUS,C
+    btfsc       hi,7        ; Copy sign bit to carry
+    bsf         STATUS,C
+    rrcf		hi          ; /8
+	rrcf		lo
+    bcf			STATUS,C
+    btfsc       hi,7        ; Copy sign bit to carry
+    bsf         STATUS,C
+    rrcf		hi          ; /16
+	rrcf		lo
+    return
+
+    global  I2C_RX_accelerometer
+I2C_RX_accelerometer:
+   	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x38                ; address
+    rcall       I2C_TX
+	movlw		0x01
+    rcall       I2C_TX
+	bsf			SSP1CON2,RSEN		; Repeated start condition (!)
+	rcall		WaitMSSP
+	movlw		0x39                ; address
+    rcall       I2C_TX
+
+    ; Chip orientation on the PCB requires
+    ; Original = Corrected
+    ; x = -x
+    ; y = -y
+    ; z = -z
+
+
+    rcall       I2C_TwoBytesRX_div16 ; Get two bytes and devide /16 (signed)
+    comf        hi                    ; 16bit sign change.
+    negf        lo
+    btfsc       STATUS,C            ; Carry to propagate ?
+    incf        hi,F                ; YES: do it.
+    movff       lo,accel_DX+0
+    movff       hi,accel_DX+1       ; Copy result
+
+    rcall       I2C_TwoBytesRX_div16 ; Get two bytes and devide /16 (signed)
+    comf        hi                    ; 16bit sign change.
+    negf        lo
+    btfsc       STATUS,C            ; Carry to propagate ?
+    incf        hi,F                ; YES: do it.
+    movff       lo,accel_DY+0
+    movff       hi,accel_DY+1       ; Copy result
+
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,hi          ; Data Byte
+	bsf			SSP1CON2, RCEN      ; Enable recieve mode
+    rcall		WaitMSSP
+; According to datasheet there should be no Master Acknowlegde for the last Byte (accel_DZ+0)...
+	movff		SSP1BUF,lo          ; Data Byte
+
+    rcall       I2C_TwoBytesRX_div16_2; devide lo:hi/16 (signed) only
+    comf        hi                    ; 16bit sign change.
+    negf        lo
+    btfsc       STATUS,C            ; Carry to propagate ?
+    incf        hi,F                ; YES: do it.
+    movff       lo,accel_DZ+0
+    movff       hi,accel_DZ+1       ; Copy result
+
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+    return
+
+I2C_OneByteRX:
+	bsf			SSP1CON2, RCEN      ; Enable recieve mode
+	rcall		WaitMSSP
+	bsf			SSP1CON2,ACKEN		; Master acknowlegde
+	rcall		WaitMSSP
+    return
+
+    global  I2C_RX_compass
+I2C_RX_compass:
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x3C                ; address
+    rcall       I2C_TX
+	movlw		0x03
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+
+	bcf			PIR1,SSPIF
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x3D                ; address
+    rcall       I2C_TX
+
+    ; Compass IC sends data in following order:
+    ; x MSB
+    ; x LSB
+    ; z MSB
+    ; z LSB
+    ; y MSB
+    ; y LSB
+
+    ; Chip orientation on the PCB requires
+    ; Original = Corrected
+    ; x = -y
+    ; z = z
+    ; y = x
+
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,compass_DY+1; Data Byte
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,compass_DY+0; Data Byte
+    banksel compass_DY
+    comf        compass_DY+1        ; 16bit sign change.
+    negf        compass_DY+0
+    btfsc       STATUS,C            ; Carry to propagate ?
+    incf        compass_DY+1,F      ; YES: do it.
+    banksel common
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,compass_DZ+1; Data Byte
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,compass_DZ+0; Data Byte
+    rcall       I2C_OneByteRX       ; Get one byte
+	movff		SSP1BUF,compass_DX+1; Data Byte
+	bsf			SSP1CON2, RCEN      ; Enable recieve mode
+	rcall		WaitMSSP
+	movff		SSP1BUF,compass_DX+0; Data Byte
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+    return
+
+    global  I2C_init_compass
+I2C_init_compass:
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x3C                ; address
+    rcall       I2C_TX
+	movlw		0x00
+    rcall       I2C_TX
+;	movlw		b'01101001'        ; ConfigA:  3Hz, 8 Samples averaged, Test Mode (Positive Bias)
+	movlw		b'01101000'        ; ConfigA:  3Hz, 8 Samples averaged
+;    movlw		b'00111000'        ; ConfigA: 75Hz, 2 Samples averaged
+    rcall       I2C_TX
+	movlw		b'00100000'        ; ConfigB, 1090Gauss Gain
+;	movlw		b'10000000'        ; ConfigB,  440Gauss Gain
+    rcall       I2C_TX
+	movlw		b'00000000'        ; Continous Mode
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+    bsf         compass_enabled
+    return
+
+    global  I2C_init_compass_fast
+I2C_init_compass_fast:
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x3C                ; address
+    rcall       I2C_TX
+	movlw		0x00
+    rcall       I2C_TX
+    movlw		b'00111000'        ; ConfigA: 75Hz, 2 Samples averaged
+    rcall       I2C_TX
+	movlw		b'00100000'        ; ConfigB, 1090Gauss Gain
+    rcall       I2C_TX
+	movlw		b'00000000'        ; Continous Mode
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+    bsf         compass_enabled
+    return
+
+
+    global  I2C_sleep_compass
+I2C_sleep_compass:
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x3C                ; address
+    rcall       I2C_TX
+	movlw		0x00
+    rcall       I2C_TX
+	movlw		b'01101000'        ; ConfigA
+    rcall       I2C_TX
+	movlw		b'00100000'        ; ConfigB
+    rcall       I2C_TX
+	movlw		b'00000010'        ; Idle Mode
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+    bcf         compass_enabled
+    return
+
+
+   global  I2C_init_accelerometer
+I2C_init_accelerometer:
+    rcall       I2C_sleep_accelerometer ; Regs can only be changed in St.By mode
+
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x38                ; address
+    rcall       I2C_TX
+	movlw		0x0E                ; XYZ_DATA_CFG
+    rcall       I2C_TX
+	movlw		b'00000000'         ; High pass Filter=0 , +/- 2g range
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+
+
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x38                ; address
+    rcall       I2C_TX
+	movlw		0x2A                ; CTRL_REG1
+    rcall       I2C_TX
+;	movlw		b'00110000'         ; CTRL_REG1: 160ms data rate, St.By Mode
+	movlw		b'00110100'         ; CTRL_REG1: 160ms data rate, St.By Mode, reduced noise mode
+    rcall       I2C_TX
+	movlw		b'00000010'         ; CTRL_REG2: High Res in Active mode
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x38                ; address
+    rcall       I2C_TX
+	movlw		0x2A                ; CTRL_REG1
+    rcall       I2C_TX
+;	movlw		b'00110001'         ; CTRL_REG1: 160ms data rate, Active Mode
+	movlw		b'00110101'         ; CTRL_REG1: 160ms data rate, St.By Mode, reduced noise mode, Active Mode
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+
+    return
+
+    global  I2C_sleep_accelerometer
+I2C_sleep_accelerometer:
+	bsf			SSP1CON2,SEN		; Start condition
+	rcall		WaitMSSP
+	movlw		0x38                ; address
+    rcall       I2C_TX
+	movlw		0x2A                ; CTRL_REG1
+    rcall       I2C_TX
+	movlw		b'00000000'         ; St. By Mode
+    rcall       I2C_TX
+	bsf			SSP1CON2,PEN		; Stop condition
+	rcall		WaitMSSP
+    return
+
+
+    END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/i2c.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,17 @@
+;=============================================================================
+;
+;   File i2c.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2012-10-24 : [mH] Creation
+
+	extern	I2C_RX_accelerometer
+	extern 	I2C_init_accelerometer
+    extern  I2C_sleep_accelerometer
+    extern  I2C_init_compass
+    extern  I2C_init_compass_fast
+    extern  I2C_sleep_compass
+    extern  I2C_RX_compass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/icons.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,24 @@
+;=============================================================================
+;
+;   File icons.asm
+;
+;   Tables for all OSTC3 icons.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-05-24 : [jDG] Creation with icons for demo menus.
+
+icons_data   CODE
+
+; Dive mode warning icon
+	global	dive_warning_block
+#include "../OSTC3/Icons/dive_warning.inc"	;45x39 px
+; small warning icon
+;	global	warning_block
+;#include "../OSTC3/Icons/warning.inc"       ;25x22 px
+	global	ostc3_logo_block
+; OSTC3 scribble
+#include "../OSTC3/Icons/ostc3_logo.inc"    ;220x61 px
+
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/isr.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,865 @@
+;=============================================================================
+;
+;   File isr.asm
+;
+;   INTERUPT subroutines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-05-24 : [jDG] Cleanups from initial Matthias code.
+
+#include "ostc3.inc"
+#include "shared_definitions.h"         ; Mailbox from/to p2_deco.c
+#include "ms5541.inc"
+#include "adc_lightsensor.inc"
+
+;=============================================================================
+
+	extern start
+
+isr_high    CODE    0x0008              ;High Priority Interrups
+		bra		HighInt
+		nop	
+		nop
+		nop
+		nop
+		nop
+		nop
+		bra		HighInt
+
+isr_low     CODE    0x00018             ;Low Priority Interrups
+;	*** low priority interrupts not used
+		retfie FAST						; Restores BSR, STATUS and WREG
+
+HighInt:
+        movff   PRODL,isr_prod+0
+        movff   PRODH,isr_prod+1
+
+; Pressure sensor and others
+		btfsc	PIR5,TMR7IF				; Timer 7
+		rcall	isr_tmr7        		; Every 62,5ms
+
+; Timer0 for RX timing
+;		btfsc	INTCON,TMR0IF			; Timer0 INT (Button Debounce Timer)
+;		rcall	timer0int
+
+; Buttons
+		btfsc	PIR1,TMR1IF             ; Timer1 INT (Button hold-down Timer)
+		rcall	timer1int
+		btfsc	INTCON,INT0IF			; Buttons
+		rcall	isr_switch_right
+		btfsc	INTCON3,INT1IF			; Buttons
+		rcall	isr_switch_left
+
+; IR-Link
+		btfsc	PIR2,TMR3IF				; Timer 3
+		rcall	isr_timer3				; IR-Link Timeout
+        btfsc   PIR3,RC2IF              ; UART2
+        rcall   isr_uart2               ; IR-Link
+
+; RTCC
+		btfsc	PIR3,RTCCIF				; Real-time-clock interrupt
+		rcall	isr_rtcc                ; May return in bank common!
+
+        movff   isr_prod+1,PRODH
+        movff   isr_prod+0,PRODL
+		retfie FAST						; Restores BSR, STATUS and WREG
+
+;=============================================================================
+
+;timer0int:
+;		bcf		T0CON,TMR0ON			; Stop Timer 0
+;       return
+;
+;		movlw   .240
+;       movwf   TMR0H
+;		bcf		INTCON,TMR0IF			; Clear flag
+;		clrf	TMR0L
+;		return
+
+
+
+isr_uart2:               ; IR-Link
+        banksel RCREG2
+        movf    RCREG2,W
+    	bcf		RCSTA2,CREN		; Clear receiver status
+    	bsf		RCSTA2,CREN
+        banksel isr_backup
+        bcf     PIR3,RC2IF              ; Clear flag
+        incf    ir_counter,F            ; Increase counter
+        movff   ir_counter,isr1_temp    ; Copy
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.0
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.1
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.2
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.3
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.4
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.5
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.6
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.7
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.8
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.9
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.10
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.11
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.12
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.13
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.14
+        dcfsnz  isr1_temp,F
+        movwf    ir_buffer+.15
+        clrf    TMR3L                   ; Preload timer
+        movlw   .253
+        movwf   TMR3H
+        bsf     T3CON,TMR3ON            ; (Re)Start Timeout counter
+        return
+
+isr_timer3:             ; IR-Link Timeout
+		bcf		T3CON,TMR3ON			; Stop Timer3
+    	banksel isr_backup              ; Select Bank0 for ISR data.
+        movlw   .15
+        cpfseq  ir_counter              ; Got exact 15bytes?
+        bra     isr_timer3_1            ; No, test for 16bytes
+        bra     isr_timer3_2            ; Got 15 bytes, compute local checksum
+isr_timer3_1:
+        movlw   .16
+        cpfseq  ir_counter              ; Got exact 16bytes?
+        bra     isr_timer3_exit         ; No, exit
+        tstfsz  ir_buffer+.15           ; Last byte=0x00
+        bra     isr_timer3_exit         ; No, exit
+
+isr_timer3_2:
+        movff   ir_buffer+.0,PRODL
+        clrf    PRODH
+        movf    ir_buffer+.1,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.2,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.3,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.4,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.5,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.6,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.7,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.8,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.9,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.10,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.11,W
+        rcall   isr_timer3_checksum
+        movf    ir_buffer+.12,W
+        rcall   isr_timer3_checksum
+
+            ; Compare checksum
+        movf    ir_buffer+.13,W
+        cpfseq  PRODL                   ; Checksum ok?
+        bra     isr_timer3_exit         ; No, exit
+        movf    ir_buffer+.14,W
+        cpfseq  PRODH                   ; Checksum ok?
+        bra     isr_timer3_exit         ; No, exit
+
+           ; Checksum OK, copy results
+        movff   ir_buffer+.1,hud_status_byte
+        movff   ir_buffer+.2,o2_mv_sensor1+0
+        movff   ir_buffer+.3,o2_mv_sensor1+1
+        movff   ir_buffer+.4,o2_mv_sensor2+0
+        movff   ir_buffer+.5,o2_mv_sensor2+1
+        movff   ir_buffer+.6,o2_mv_sensor3+0
+        movff   ir_buffer+.7,o2_mv_sensor3+1
+        movff   ir_buffer+.8,o2_ppo2_sensor1
+        movff   ir_buffer+.9,o2_ppo2_sensor2
+        movff   ir_buffer+.10,o2_ppo2_sensor3
+        movff   ir_buffer+.11,hud_battery_mv+0
+        movff   ir_buffer+.12,hud_battery_mv+1
+
+        movlw   ir_timeout_value        ; multiples of 62,5ms
+        movwf   ir_timeout              ; Reload timeout
+ 
+isr_timer3_exit:
+        clrf    ir_counter              ; Clear pointer
+	    bcf		PIR2,TMR3IF				; Clear flag
+        return
+
+isr_timer3_checksum:
+        addwf   PRODL,F
+        movlw   .0
+        addwfc  PRODH,F
+        return
+
+;=============================================================================
+
+isr_tmr7:       						; each 62,5ms
+		bcf		PIR5,TMR7IF				; clear flag
+		banksel 0xF16					; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+		movlw	.248
+    	movwf	TMR7H					; -> Rollover after 2048 cycles -> 62,5ms
+
+        banksel	isr_backup
+	    movf	max_CCPR1L,W			; Dimm value
+		cpfseq	CCPR1L					; = current PWM value?
+		rcall	isr_dimm_tft			; No, adjust until max_CCPR1L=CCPR1L !
+
+        banksel isr_backup
+        decfsz  ir_timeout,F            ; IR Data still valid?
+        bra     isr_tmr7_2              ; Yes, continue
+        ; timeout, clear IR-Data
+
+        movlw   ir_timeout_value        ; multiples of 62,5ms
+        movwf   ir_timeout              ; Reload timeout
+
+        banksel common
+        clrf    o2_mv_sensor1+0
+        clrf    o2_mv_sensor1+1
+        clrf    o2_mv_sensor2+0
+        clrf    o2_mv_sensor2+1
+        clrf    o2_mv_sensor3+0
+        clrf    o2_mv_sensor3+1
+        clrf    hud_battery_mv+0
+        clrf    hud_battery_mv+1
+        clrf    hud_status_byte
+        clrf    o2_ppo2_sensor1
+        clrf    o2_ppo2_sensor2
+        clrf    o2_ppo2_sensor3
+
+isr_tmr7_2:
+        banksel common
+		btfss	no_sensor_int			; No sensor interrupt (because it's addressed during sleep)
+		bra		isr_sensor_state2		; No, continue
+		banksel isr_backup              ; Back to Bank0 ISR data
+		return						
+
+isr_set_speed_to_normal:
+	; Set Speed to normal
+		movlw	b'01110010'
+		movwf	OSCCON				; 16MHz INTOSC
+		movlw	b'00000000'			
+		movwf	OSCTUNE				; 4x PLL Disable (Bit6) - only works with 8 or 16MHz (=32 or 64MHz)
+		movlw	b'00001101'			; 1:2 Postscaler, 1:4 Prescaler, Timer 2 start -> 1960Hz (no-flicker)
+		movwf	T2CON
+		btfss	OSCCON,HFIOFS
+		bra		$-2					; Wait until clock is stable
+		return
+
+isr_sensor_state2:
+		banksel	common
+        movff   sensor_state_counter,WREG
+        btfss   WREG,0                  ; every 1/4 second
+        bsf     quarter_second_update   ; Set flag
+		movlw	d'2'
+		cpfseq	speed_setting           ; Set to normal in case it's not already in normal speed mode
+		rcall	isr_set_speed_to_normal
+		banksel isr_backup              ; Back to Bank0 ISR data
+
+		incf	sensor_state_counter,F	; counts to eight for state maschine
+
+; State 1: Clear flags and average registers, get temperature (51us) and start pressure integration (73,5us)
+; State 2: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us)
+; State 3: Get temperature (51us) and start pressure integration (73,5us)
+; State 4: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us)
+; State 5: Get temperature (51us) and start pressure integration (73,5us)
+; State 6: Get pressure (51us), start temperature integration (73,5us) and calculate temperature compensated pressure (233us)
+; State 7: Get temperature (51us) and start pressure integration (73,5us)
+; State 8: Get pressure (51us), start temperature integration (73,5us), calculate temperature compensated pressure (233us) and build average for half-second update of tempperature and pressure
+	
+		movff	sensor_state_counter,WREG		; WREG used as temp here...
+		dcfsnz	WREG,F
+		bra		sensor_int_state1_plus_restart	; Do State 1
+		dcfsnz	WREG,F
+		bra		sensor_int_state2				; Do State 2
+		dcfsnz	WREG,F
+		bra		sensor_int_state1				; Do State 3
+		dcfsnz	WREG,F
+		bra		sensor_int_state2				; Do State 4
+		dcfsnz	WREG,F
+		bra		sensor_int_state1				; Do State 5
+		dcfsnz	WREG,F
+		bra		sensor_int_state2				; Do State 6
+		dcfsnz	WREG,F
+		bra		sensor_int_state1				; Do State 7
+;		bra		sensor_int2_plus_average		; Do State 8
+;sensor_int2_plus_average:
+		; First, do state2:
+		call		get_pressure_value		; State2: Get pressure (51us)
+		call		get_temperature_start	; and start temperature integration (73,5us)
+		call		calculate_compensation	; calculate temperature compensated pressure (27us)
+; Build average
+		bcf			STATUS,C            ; clear carry bit.
+		rrcf		amb_pressure_avg+1  ; amb_pressure sum / 2
+		rrcf		amb_pressure_avg+0
+		bcf			STATUS,C            ; clear carry bit, twice.
+		rrcf		amb_pressure_avg+1  ; amb_pressure sum / 4
+		rrcf		amb_pressure_avg+0
+
+;        ; Even more averaging
+;        movf        amb_pressure_avg+0,W
+;        addwf       amb_pressure+0
+;        movf        amb_pressure_avg+1,W
+;        addwfc      amb_pressure+1
+;		bcf			STATUS,C            ; clear carry bit
+;		rrcf		amb_pressure+1      ; amb_pressure sum / 2
+;		rrcf		amb_pressure+0
+
+		movff		amb_pressure_avg+1,amb_pressure+1	; copy into actual register
+		movff		amb_pressure_avg+0,amb_pressure+0
+
+        bcf			STATUS,C
+        btfsc       temperature_avg+1,7 ; Copy sign bit to carry
+        bsf         STATUS,C
+		rrcf		temperature_avg+1   ; Signed temperature /2
+		rrcf		temperature_avg+0
+        bcf			STATUS,C
+        btfsc       temperature_avg+1,7 ; Copy sign bit to carry
+        bsf         STATUS,C
+		rrcf		temperature_avg+1   ; Signed temperature /4
+		rrcf		temperature_avg+0
+
+		movff		temperature_avg+1,temperature+1     ; copy into actual register
+		movff		temperature_avg+0,temperature+0
+
+		banksel 	common                  ; flag1 is in Bank1
+		bsf			pressure_refresh 		; Set flag! Temp and pressure were updated!
+        bcf         temp_changed			; Clear flag for temperature update
+        bcf         pressure_refresh        ; Clear flag for pressure update
+        banksel 	isr_backup              ; Back to Bank0 ISR data
+
+        ; Temp changed?
+        movf	temperature+0,W
+        cpfseq	last_temperature+0
+        bra     isr_sensor_state2_2         ; Yes
+        movf	temperature+1,W
+        cpfseq	last_temperature+1
+        bra     isr_sensor_state2_2         ; Yes
+
+        bra     isr_sensor_state2_3         ; no change
+
+isr_sensor_state2_2:
+        banksel 	common                  ; flag1 is in Bank1
+        bsf		temp_changed			    ; Yes
+        banksel 	isr_backup              ; Back to Bank0 ISR data
+isr_sensor_state2_3:
+        movff   temperature+0,last_temperature+0    ; Copy for compare
+        movff   temperature+1,last_temperature+1
+
+    	movf	amb_pressure+0,W
+    	cpfseq	last_pressure+0
+        bra     isr_sensor_state2_4         ; Yes
+    	movf	amb_pressure+1,W
+    	cpfseq	last_pressure+1
+        bra     isr_sensor_state2_4         ; Yes
+
+        bra     isr_sensor_state2_5         ; No change
+isr_sensor_state2_4:
+        banksel 	common                  ; flag1 is in Bank1
+    	bsf		pressure_refresh			; Yes
+        banksel 	isr_backup              ; Back to Bank0 ISR data
+isr_sensor_state2_5:
+        movff   amb_pressure+0,last_pressure+0    ; Copy for compare
+        movff   amb_pressure+1,last_pressure+1
+
+		clrf		sensor_state_counter	; Then reset State counter
+		btfss		simulatormode_active	; are we in simulator mode?
+		bra			comp_air_pressure		; no
+comp_air_pressure0:	
+		movlw		LOW		d'1000'			; yes, so simulate 1000mbar surface pressure
+		movwf		last_surfpressure+0
+		movlw		HIGH	d'1000'
+		movwf		last_surfpressure+1
+        ; Always set pressure_refresh flag in simulator mode
+        banksel 	common                  ; flag1 is in Bank1
+    	bsf         pressure_refresh        ; Yes
+        banksel 	isr_backup              ; Back to Bank0 ISR data
+
+comp_air_pressure:
+		movf		last_surfpressure+0,W		; compensate airpressure
+		subwf   	amb_pressure+0,W             
+		movwf   	rel_pressure+0				; rel_pressure stores depth!
+
+		movf		last_surfpressure+1,W
+		subwfb  	amb_pressure+1,W
+		movwf   	rel_pressure+1
+		btfss		STATUS,N					; result is below zero?
+		bra			sensor_int_state_exit
+		clrf		rel_pressure+0				; Yes, do not display negative depths
+		clrf		rel_pressure+1				; e.g. when surface air pressure dropped during the dive
+		bra			sensor_int_state_exit
+
+sensor_int_state1_plus_restart:
+		clrf		amb_pressure_avg+0  ; pressure average registers
+		clrf		amb_pressure_avg+1
+		clrf		temperature_avg+0
+		clrf		temperature_avg+1
+
+sensor_int_state1:
+		call		get_temperature_value	; State 1: Get temperature
+		call		get_pressure_start	 	; and start pressure integration.
+		bra			sensor_int_state_exit
+
+sensor_int_state2:
+		call		get_pressure_value		; State2: Get pressure (51us)
+		call		get_temperature_start	; and start temperature integration (73,5us)
+		call		calculate_compensation	; calculate temperature compensated pressure (233us)
+;		bra			sensor_int_state_exit
+sensor_int_state_exit:
+		rcall		isr_restore_clock		; Restore clock
+		return
+;=============================================================================
+
+isr_dimm_tft:				; Adjust until max_CCPR1L=CCPR1L !
+        banksel     common
+		btfsc		tft_is_dimming			; Ignore while dimming
+		return
+        banksel     isr_backup
+		movf		max_CCPR1L,W
+		cpfsgt		CCPR1L					; CCPR1L>max_CCPR1L?
+		bra			isr_dimm_tft2			; No, dimm up
+	; dimm down
+		decf		CCPR1L,F				; -1
+		return
+isr_dimm_tft2:
+		movf		max_CCPR1L,W
+		sublw		.20
+		cpfsgt		CCPR1L					; CCPR1L>max_CCPR1L-20?
+		bra			isr_dimm_tft3			; No, dimm up slow
+		; dimm up faster
+		movlw		.5
+		addwf		CCPR1L,F
+isr_dimm_tft3:
+		incf		CCPR1L,F				; +1
+		return
+
+
+isr_rtcc:								; each second
+		bcf		PIR3,RTCCIF				; clear flag
+		banksel 0xF16					; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+		bsf		RTCCFG,RTCPTR1
+		bsf		RTCCFG,RTCPTR0			; year
+		movff	RTCVALL,year			; format is BCD!
+		movff	RTCVALH,day				; dummy read
+		movff	RTCVALL,day				; format is BCD!
+		movff	RTCVALH,month			; format is BCD!
+		movff	RTCVALL,hours			; format is BCD!
+		movff	RTCVALH,secs			; format is BCD!
+		movff	RTCVALL,secs			; format is BCD!
+		movff	RTCVALH,mins			; format is BCD!
+        banksel isr_backup              ; Back to Bank0 ISR data
+        
+		; Convert BCD to DEC and set registers
+		movff	mins, isr1_temp
+		rcall	isr_rtcc_convert		; Converts to dec with result in WREG
+		movff	WREG,mins
+		movff	secs, isr1_temp
+		rcall	isr_rtcc_convert		; Converts to dec with result in WREG
+		movff	WREG,secs
+		movff	hours, isr1_temp
+		rcall	isr_rtcc_convert		; Converts to dec with result in WREG
+		movff	WREG,hours
+		movff	month, isr1_temp
+		rcall	isr_rtcc_convert		; Converts to dec with result in WREG
+		movff	WREG,month
+		movff	day, isr1_temp
+		rcall	isr_rtcc_convert		; Converts to dec with result in WREG
+		movff	WREG,day
+		movff	year, isr1_temp
+		rcall	isr_rtcc_convert		; Converts to dec with result in WREG
+		movff	WREG,year
+
+	; Place once/second tasks for ISR here (Be sure of the right bank!)
+		banksel common                  ; flag1 is in Bank1
+		btfss	sleepmode				; in Sleepmode?
+		call	get_ambient_level		; No, get ambient light level and set max_CCPR1L
+
+		rcall	isr_battery_gauge		; Add amount of battery consumption to battery_gauge:6
+
+		banksel common                  ; flag1 is in Bank1
+		bsf		onesecupdate			; A new second has begun
+		btfsc	divemode				; in divemode?
+		rcall	isr_divemode_1sec		; Yes, do some divemode stuff in bank common
+
+        tstfsz  secs                    ; Secs == 0 ?
+        return                          ; No, Done.
+
+;        banksel isr_backup              ; Back to Bank0 ISR data
+;		movff	secs,isr1_temp			; Copy to Bank0
+;		movlw	d'0'
+;		cpfseq	isr1_temp               ; Secs == 0 ?
+;        return                          ; Done.
+
+;		banksel common                  ; flag1 is in Bank1
+		bsf		oneminupdate			; A new minute has begun
+
+		btfss	divemode				; In Divemode?
+		rcall	check_nofly_desat_time	; No, so reduce NoFly and Desat and increase interval
+
+        ; Check if a new hour has just begun
+;		banksel common                  ; flag1 is in Bank1
+		tstfsz	mins					; mins=0?
+		bra		isr_rtcc2				; No
+		bsf		onehourupdate			; Yes, set flag
+		
+isr_rtcc2:
+		banksel isr_backup              ; Back to Bank0 ISR data
+		return							; Done.
+
+isr_battery_gauge:	
+	    banksel isr_backup              ; Bank0 ISR data
+		movlw	current_sleepmode		; 100µA/3600 -> nAs	(Sleepmode current)
+		movwf	isr1_temp				; Store value (low byte)
+		clrf	isr2_temp				; High byte
+		
+		banksel common                  ; flag1 is in Bank1
+		btfss	sleepmode				; in Sleepmode?
+		rcall	isr_battery_gauge2		; No, compute current consumtion value into isr1_temp and isr2_temp
+
+	    banksel isr_backup              ; Bank0 ISR data
+		movf	isr1_temp,W				; 48Bit add of isr1_temp and isr2_temp into battery_gauge:6
+		addwf	battery_gauge+0,F
+		movf	isr2_temp,W
+		addwfc	battery_gauge+1,F
+		movlw	.0
+		addwfc	battery_gauge+2,F
+		movlw	.0
+		addwfc	battery_gauge+3,F
+		movlw	.0
+		addwfc	battery_gauge+4,F
+		movlw	.0
+		addwfc	battery_gauge+5,F
+		return
+		
+isr_battery_gauge2:
+	; set consumtion rate in nAs for an one second interval
+	; Example:
+	; movlw	LOW		.55556			; 0,2A/3600*1e9s = nAs
+	; movwf	isr1_temp				; Low byte
+	; movlw	HIGH	.55556			; 0,2A/3600*1e9s = nAs
+	; movwf	isr2_temp				; High byte
+
+	; Current consumption for LED backlight is 47*CCPR1L+272
+		movf	CCPR1L,W
+		mullw	current_backlight_multi
+		movlw	LOW		current_backlight_offset
+		addwf	PRODL,F
+		movlw	HIGH	current_backlight_offset
+		addwfc	PRODH,F
+		movff	PRODL,isr1_temp
+		movff	PRODH,isr2_temp			; isr1_temp and isr2_temp hold value for backlight
+
+	; Add current for CPU and GPU 
+	; speed_setting=1: ECO (3,1mA -> 861nAs), =2: NORMAL (5,50mA -> 1528nAs) or =3: FASTEST (8,04mA -> 2233nAs)
+		movlw	.1
+		cpfseq	speed_setting
+		bra		isr_battery_gauge3
+		banksel isr_backup              ; Bank0 ISR data
+		movlw	LOW		current_speed_eco
+		addwf	isr1_temp,F
+		movlw	HIGH	current_speed_eco
+		addwfc	isr2_temp,F
+		bra		isr_battery_gauge5
+isr_battery_gauge3:
+		movlw	.2
+		cpfseq	speed_setting
+		bra		isr_battery_gauge4
+		banksel isr_backup              ; Bank0 ISR data
+		movlw	LOW		current_speed_normal
+		addwf	isr1_temp,F
+		movlw	HIGH	current_speed_normal
+		addwfc	isr2_temp,F
+		bra		isr_battery_gauge5
+isr_battery_gauge4:
+;		movlw	.3
+;		cpfseq	speed_setting
+;		bra		isr_battery_gauge5
+		banksel isr_backup              ; Bank0 ISR data
+		movlw	LOW		current_speed_fastest
+		addwf	isr1_temp,F
+		movlw	HIGH	current_speed_fastest
+		addwfc	isr2_temp,F
+isr_battery_gauge5:
+    ; Add current if IR reciever is on
+        btfss   ir_power                    ; IR enabled?
+        bra     isr_battery_gauge6          ; no
+		movlw	LOW		current_ir_reciever
+		addwf	isr1_temp,F
+		movlw	HIGH	current_ir_reciever
+		addwfc	isr2_temp,F
+isr_battery_gauge6:
+    ; Add current for compass/accelerometer
+        btfss   compass_enabled             ; compass active?
+        bra     isr_battery_gauge7          ; no
+		movlw	LOW		current_compass
+		addwf	isr1_temp,F
+		movlw	HIGH	current_compass
+		addwfc	isr2_temp,F
+isr_battery_gauge7:
+		return
+
+isr_divemode_1sec:
+		incf		samplesecs,F			; "samplingrate" diving seconds done 
+		decf		samplesecs_value,W		; holds "samplingrate" value  (minus 1 into WREG)
+		cpfsgt		samplesecs				; Done?
+		bra			isr_divemode_1sec2		; no
+
+		clrf		samplesecs				; clear counter...
+		bsf			store_sample			; ...and set bit for profile storage
+isr_divemode_1sec2:
+; Increase re-setable average depth divetime counter
+		incf		average_divesecs+0,F	; increase stopwatch registers
+		btfsc		STATUS,Z
+		incf		average_divesecs+1,F	; increase stopwatch registers
+; Increase total divetime (Regardless of start_dive_threshold)
+		incf		total_divetime_seconds+0,F
+		movlw		.0
+		addwfc		total_divetime_seconds+1,F	; Total dive time (Regardless of start_dive_threshold)
+	
+		btfss		divemode2				; displayed divetime is running?
+		return								; No (e.g. too shallow)
+
+; increase divetime registers (Displayed dive time)
+		incf		divesecs,F				
+		movlw		d'59'
+		cpfsgt		divesecs
+		bra			isr_divemode_1sec2a
+
+		clrf		divesecs
+		bsf			realdive				; this bit is always set (again) if the dive is longer then one minute
+		incf		divemins+0,F
+		movlw		.0
+		addwfc		divemins+1,F			; increase divemins
+		
+isr_divemode_1sec2a:	
+		btfss		FLAG_apnoe_mode			; Are we in Apnoe mode?
+		return								; No
+		
+		incf		apnoe_secs,F			; increase descent registers
+		movlw		d'59'
+		cpfsgt		apnoe_secs				; full minute?
+		return								; No
+		clrf		apnoe_secs
+		incf		apnoe_mins,F			; increase descent mins
+		return
+
+;=============================================================================
+; BCD to Binary convertion.
+; Input: isr1_temp = Value in BCD
+; Output WREG = value in binary.
+isr_rtcc_convert:
+        swapf   isr1_temp, W
+        andlw   0x0F           		  	; W= tens
+        rlncf   WREG, W         		; W= 2*tens
+        subwf   isr1_temp, F          	; 16*tens + ones - 2*tens
+        subwf   isr1_temp, F          	; 14*tens + ones - 2*tens
+        subwf   isr1_temp, W          	; 12*tens + ones - 2*tens
+		return
+
+;=============================================================================
+
+isr_switch_right:						; 
+        bcf     INTCON,INT0IE           ; Disable INT0
+;        bcf     power_sw2               ; Power-down switch circuity
+		banksel common                  ; flag1 is in Bank1
+		bsf		switch_right			; Set flag, button press is OK
+        bra     isr_switch_common       ; Continue...
+
+isr_switch_left:						; 
+        bcf     INTCON3,INT1IE          ; Disable INT1
+ ;       bcf     power_sw1               ; Power-down switch circuity
+		banksel common                  ; flag1 is in Bank1
+  		bsf		switch_left				; Set flag, button press is OK
+
+isr_switch_common:
+        ; load timer1 for first press
+        clrf    TMR1L
+        movlw   TMR1H_VALUE_FIRST       ; in steps of 7,8125ms
+        movwf   TMR1H
+        bsf     T1CON,TMR1ON            ; Start Timer 1
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+
+		banksel isr_backup              ; Select Bank0 for ISR data.
+;        bsf     power_sw1
+		bcf		INTCON3,INT1IF			; Clear flag
+;        bsf     power_sw2               ; Power-up switch circuity
+		bcf		INTCON,INT0IF			; Clear flag
+		return
+
+timer1int:
+   		bcf		PIR1,TMR1IF             ; Clear flag
+        banksel common                  ; flag1 is in Bank1
+        btfss   switch_left1            ; Left button hold-down?
+        bra     timer1int_left          ; Yes
+        btfss   switch_right2           ; Right button hold-down?
+        bra     timer1int_right         ; Yes
+
+        ; No button hold-down, stop Timer 1
+        bcf     T1CON,TMR1ON            ; Stop Timer 1
+        bsf     INTCON,INT0IE           ; Enable INT0
+        bsf     INTCON3,INT1IE          ; Enable INT1
+		bcf		INTCON,INT0IF			; Clear flag
+		bcf		INTCON3,INT1IF			; Clear flag
+;		bcf		switch_left
+;        bcf		switch_right
+		return
+
+timer1int_left:
+;        bcf     power_sw1               ; Power-down switch circuity
+		bsf		switch_left				; (Re-)Set flag
+        bra     timer1int_common        ; Continue
+timer1int_right:
+ ;       bcf     power_sw2               ; Power-down switch circuity
+		bsf		switch_right			; (Re-)Set flag
+timer1int_common:
+        ; load timer1 for next press
+        clrf    TMR1L
+        movlw   TMR1H_VALUE_CONT        ; Surface mode
+        btfsc   divemode
+        movlw   TMR1H_VALUE_CONT_DIVE   ; Dive mode
+        movwf   TMR1H
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        nop
+;        bsf     power_sw1
+		bcf		INTCON3,INT1IF			; Clear flag
+;        bsf     power_sw2               ; Power-up switch circuity
+		bcf		INTCON,INT0IF			; Clear flag
+        return                          ; Return from timer1int with timer1 kept running
+
+;=============================================================================
+
+check_nofly_desat_time:
+    	movf    nofly_time+0,W              ; Is nofly null ?
+    	iorwf   nofly_time+1,W
+    	bz     	check_nofly_desat_time2     ; yes...
+
+		movlw	d'1'
+		subwf	nofly_time+0,F
+		movlw	d'0'
+		subwfb	nofly_time+1,F               ; reduce by one
+
+check_nofly_desat_time2:
+    	movf    desaturation_time+0,W        ; Is Desat null ?
+    	iorwf   desaturation_time+1,W
+    	bz     	check_nofly_desat_time3      ; yes...
+
+		movlw	d'1'
+		subwf	desaturation_time+0,F
+		movlw	d'0'
+		subwfb	desaturation_time+1,F	   	; reduce by one...
+
+	; Increase surface interval timer 
+		movlw	d'1'
+		addwf	surface_interval+0,F
+		movlw	d'0'
+		addwfc	surface_interval+1,F
+		return								; Done
+
+check_nofly_desat_time3:
+		clrf	surface_interval+0
+		clrf	surface_interval+1			; Clear surface interval timer
+		return								; Done.
+
+;=============================================================================
+
+isr_restore_clock:
+		banksel	isr_backup
+		movff	speed_setting,isr1_temp			; Copy to Bank0
+		movlw	d'1'
+		cpfseq	isr1_temp
+		bra		isr_restore_speed2
+	; Reset to eco	
+		movlw	b'00000000'			
+		movwf	OSCTUNE				; 4x PLL Disable (Bit6) - only works with 8 or 16MHz (=32 or 64MHz)
+		movlw	b'00110010'
+		movwf	OSCCON				; 1MHz INTOSC
+		movlw	T2CON_ECO
+		movwf	T2CON
+		bra		isr_restore_exit
+isr_restore_speed2:
+		movlw	d'2'
+		cpfseq	isr1_temp
+		bra		isr_restore_speed3
+	; Reset to normal
+		movlw	b'01110010'
+		movwf	OSCCON				; 16MHz INTOSC
+		movlw	b'00000000'
+		movwf	OSCTUNE				; 4x PLL Disable (Bit6) - only works with 8 or 16MHz (=32 or 64MHz)
+		movlw	T2CON_NORMAL
+		movwf	T2CON
+		bra		isr_restore_exit
+
+isr_restore_speed3:
+	; Reset to fastest
+		movlw	b'01110010'			; 16MHz INTOSC
+		movwf	OSCCON				
+		movlw	b'01000000'			
+		movwf	OSCTUNE				; 4x PLL Enable (Bit6) - only works with 8 or 16MHz (=32 or 64MHz)
+		movlw	T2CON_FASTEST
+		movwf	T2CON
+;		bra		isr_restore_exit
+isr_restore_exit:
+		btfss	OSCCON,HFIOFS
+		bra		isr_restore_exit	; loop until PLL is stable
+		return
+
+		END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/isr.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,20 @@
+;=============================================================================
+;
+;   File isr.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-06 : [mH] moving from OSTC code
+
+SAFE_2BYTE_COPY MACRO  from, to
+        local   retry
+retry:
+        movff   from+1,WREG             ; High byte in W.
+        movff   WREG,to+1               ; and destination.
+        movff   from+0,to+0             ; Copy low byte.
+        movff   from+1,TABLAT           ; another bank-safe read.
+        xorwf   TABLAT,W                ; High byte changed ?
+        bnz     retry
+        ENDM
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/logbook.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,1712 @@
+;=============================================================================
+;
+;   File logbook.asm
+;
+;   Logbook
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-11-12 : [mH] moving from OSTC code
+
+;=============================================================================
+; Temp data, local to this module, moved to ACCES0 area.
+;
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include	"tft.inc"
+#include	"external_flash.inc"
+#include	"math.inc"
+#include	"strings.inc"
+#include	"convert.inc"
+#include	"tft_outputs.inc"
+#include	"eeprom_rs232.inc"
+#include 	"menu_processor.inc"
+#include	"wait.inc"
+#include	"start.inc"
+#include	"surfmode.inc"
+#include	"divemode.inc"
+#include	"ghostwriter.inc"
+
+   	extern   do_main_menu,comm_mode
+
+    CBLOCK tmp+0x40		        ; Keep space for menu processor.
+        count_temperature       ; Current sample count for temperature divisor
+        count_deco              ; Current sample count for deco (ceiling) divisor
+        logbook_cur_depth:2     ; Current depth, for drawing profile.
+        logbook_cur_tp:2        ; Current temperature, for drawing profile.
+        logbook_last_tp         ; Y of the last item in Tp° curve.
+        logbook_min_tp:2        ; Min temperature, for drawing profile.
+        logbook_max_tp:2        ; Maximum temperature, for drawing profile.
+        logbook_ceiling         ; Current ceiling, for drawing profile.
+		logbook_flags			; Flags only used in logbook.asm
+		logbook_page_number		; Page# in logbook
+		logbook_divenumber		; # of dive in list during search
+		logbook_divenumber_temp	; # of dive in list during search
+		logbook_menupos_temp	; Last position of cursor
+		profile_temp:2			; Temp for profile display
+		profile_temp2:2			; Temp for profile display
+		logbook_max_dive_counter	; Counts dive# to zero 
+		logbook_max_dive_counter_temp; Counts dive# to zero 
+		logbook_sample_counter:2	; Amount of read samples
+		divemins_backup				; Backup of divemins+0
+		y_scale:2					; y-scale (The horizontal lines)
+		x_scale:2					; x-scale (The vertical lines)
+		logbook_pixel_x_pos		; x2 position of current pixel in X-direction
+		; Reserved to tmp+0x5F
+    ENDC
+
+	#DEFINE	return_from_profileview	logbook_flags,0
+	#DEFINE	all_dives_shown			logbook_flags,1
+	#DEFINE	logbook_page_not_empty	logbook_flags,2
+	#DEFINE	end_of_profile			logbook_flags,3
+
+	
+; Logbook Coordinates
+	#DEFINE	logbook_list_left	.18			; Column of dive# in list
+	#DEFINE	logbook_row_offset	.28			; Distance between rows of list
+	#DEFINE	logbook_row_number	.6			; Amount of rows in the list
+
+; Profile display
+	#DEFINE	profile_height_pixels	.157	; Amount of pixels height for profile display
+	#DEFINE	profile_width_pixels	.156	; Amount of pixels width for profile display
+	#DEFINE	profile_left			.1		; Left border
+	#DEFINE	profile_top				.65		; Top border
+
+; Dive number
+	#DEFINE	logbook_divenumer_column	.1
+	#DEFINE	logbook_divenumer_row		.1
+; Date and Time
+	#DEFINE	logbook_date_column			.100
+	#DEFINE logbook_date_row			.7
+	#DEFINE	logbook_time_column			.120
+	#DEFINE logbook_time_row			.33
+; Max. Depth
+	#DEFINE	log_max_value_row		.38
+	#DEFINE	log_max_value_column	.1
+; Divetime 
+	#DEFINE	log_divetime_value_row		.38
+	#DEFINE	log_divetime_value_column	.65
+; Gaslist below profile
+	#DEFINE	log_gas_row			.225
+	#DEFINE	log_gas_column1		.0
+	#DEFINE	log_gas_column2		log_gas_column1+(.1*.32)
+	#DEFINE	log_gas_column3		log_gas_column1+(.2*.32)
+	#DEFINE	log_gas_column4		log_gas_column1+(.3*.32)
+	#DEFINE	log_gas_column5		log_gas_column1+(.4*.32)
+
+; Logbook Page2
+    ; Gaslist
+    #DEFINE     log2_title_row1     .20
+    #DEFINE     log2_title_column   .90
+    #DEFINE     log2_gas_column     log2_title_column
+    #DEFINE     log2_gas_row1       .36
+    #DEFINE     log2_gas_row2       1*.16+log2_gas_row1
+    #DEFINE     log2_gas_row3       2*.16+log2_gas_row1
+    #DEFINE     log2_gas_row4       3*.16+log2_gas_row1
+    #DEFINE     log2_gas_row5       4*.16+log2_gas_row1
+
+    ; Setpoint List
+    #DEFINE     log2_title_sp_row   .130
+    #DEFINE     log2_sp_row1        .146
+    #DEFINE     log2_sp_row2        1*.16+log2_sp_row1
+    #DEFINE     log2_sp_row3        2*.16+log2_sp_row1
+    #DEFINE     log2_sp_row4        3*.16+log2_sp_row1
+    #DEFINE     log2_sp_row5        4*.16+log2_sp_row1
+
+    ; Details list
+    #DEFINE     log2_salinity_row       .55
+    #DEFINE     log2_salinity_column    .2
+    #DEFINE     log2_cns_row            .1*.16+log2_salinity_row
+    #DEFINE     log2_cns_column         log2_salinity_column
+    #DEFINE     log2_avr_row            .2*.16+log2_salinity_row
+    #DEFINE     log2_avr_column         log2_salinity_column
+    #DEFINE     log2_decomodel2_row     .3*.16+log2_salinity_row
+    #DEFINE     log2_decomodel2_column  log2_salinity_column
+    #DEFINE     log2_decomodel3_row     .4*.16+log2_salinity_row
+    #DEFINE     log2_decomodel3_column  log2_salinity_column
+    #DEFINE     log2_decomodel_row      .5*.16+log2_salinity_row
+    #DEFINE     log2_decomodel_column   log2_salinity_column
+    #DEFINE     log2_firmware_row       .6*.16+log2_salinity_row
+    #DEFINE     log2_firmware_column    log2_salinity_column
+    #DEFINE     log2_battery_row        .7*.16+log2_salinity_row
+    #DEFINE     log2_battery_column     log2_salinity_column
+    #DEFINE     log2_divemode_row       .8*.16+log2_salinity_row
+    #DEFINE     log2_divemode_column    log2_salinity_column
+    #DEFINE     log2_lastdeco_row       .9*.16+log2_salinity_row
+    #DEFINE     log2_lastdeco_column    log2_salinity_column
+; Air pressure
+	#DEFINE     MBAR_row				.10*.16+log2_salinity_row
+	#DEFINE     MBAR_column				log2_salinity_column
+
+
+; Header coordinates
+    #DEFINE log_date            .12
+    #DEFINE log_time            .15
+    #DEFINE log_max_depth       .17
+    #DEFINE log_divetime        .19
+    #DEFINE log_min_temp        .22
+    #DEFINE log_surface_press   .24
+    #DEFINE log_desattime       .26
+    #DEFINE log_gas1            .28
+    #DEFINE log_gas2            .32
+    #DEFINE log_gas3            .36
+    #DEFINE log_gas4            .40
+    #DEFINE log_gas5            .44
+    #DEFINE log_firmware        .48
+    #DEFINE log_battery         .50
+    #DEFINE log_samplingrate    .52
+    #DEFINE log_cns_start       .53
+    #DEFINE log_gf_start        .55
+    #DEFINE log_gf_end          .56
+    #DEFINE log_sp1             .60
+    #DEFINE log_sp2             .62
+    #DEFINE log_sp3             .64
+    #DEFINE log_sp4             .66
+    #DEFINE log_sp5             .68
+    #DEFINE log_salinity        .70
+    #DEFINE log_cns_end         .71
+    #DEFINE log_avr_depth       .73
+    #DEFINE log_total_seconds   .75
+    #DEFINE log_gf_lo           .77
+    #DEFINE log_sat_mult        .77
+    #DEFINE log_gf_hi           .78
+    #DEFINE log_desat_mult      .78
+    #DEFINE log_decomodel       .79
+    #DEFINE log_total_dives     .80
+    #DEFINE log_divemode        .82
+    #DEFINE log_last_stop       .243
+
+LOG_POINT_TO    macro   address
+    movlw   address
+    movwf   ext_flash_address+0
+    endm
+
+;=============================================================================
+
+logbook code
+
+TFT_logbook_cursor:
+	call		speed_fastest
+    WIN_BOX_BLACK   .0, .239, logbook_list_left-.16, logbook_list_left-.1		;top, bottom, left, right
+
+	WIN_LEFT	logbook_list_left-.16
+	WIN_FONT 	FT_SMALL
+	WIN_INVERT	.0					; Init new Wordprocessor
+	call	TFT_standard_color
+
+	movff	menupos,temp1
+	dcfsnz	temp1,F
+	movlw	d'0'
+	dcfsnz	temp1,F
+	movlw	logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.2*logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.3*logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.4*logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.5*logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.6*logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.7*logbook_row_offset
+	dcfsnz	temp1,F
+	movlw	.8*logbook_row_offset
+
+	movff	WREG,win_top
+	STRCPY_PRINT "\xB7"
+	return
+
+	global	logbook
+logbook:
+	clrf		logbook_flags
+    clrf        CCP1CON                     ; stop PWM
+    bcf         PORTC,2                     ; Pull PWM out to GND
+    call		TFT_ClearScreen				; Clear screen
+	call		TFT_standard_color
+	clrf		menupos3					; Here: used rows on current logbook-page	
+	clrf		logbook_page_number			; Here: # of current displayed page
+	clrf		logbook_divenumber			; # of dive in list during search
+	clrf		divemins+0					; Here: used as temp variables
+	clrf		divemins+1
+	clrf		timeout_counter2			; For timeout
+	movlw		logbook_row_number
+	movwf		menupos						; Here: stores current position on display (logbook_row_number-x)
+	read_int_eeprom .2						; Get low-byte of total dives
+	movff		EEDATA,logbook_max_dive_counter
+
+;-----------------------------------------------------------------------------	
+; display dive headers backwards from read_int_eeprom .2 = lo-1
+; 1st: 200000h-200FFFh -> lo=0
+; 2nd: 201000h-201FFFh -> lo=1
+; 3rd: 202000h-202FFFh -> lo=2
+; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...)
+; Stop when
+; a) no dive is stored (no valid header found)
+; b) current dive has no valid header (Number of stored dives < 256)
+; c) when 255 dives are reached divemins+0 = 255
+
+logbook2:
+	call		speed_fastest
+	incf		divemins+0,F		; increase dive counter
+    incf        divemins+0,W        ; = 0x..FF ?
+    bz          logbook_reset      ; Yes: FF --> loop.
+
+	; Set ext_flash_address:3 to TOC entry of this dive
+	; 1st: 200000h-200FFFh -> logbook_max_dive_counter=0
+	; 2nd: 201000h-201FFFh -> logbook_max_dive_counter=1
+	; 3rd: 202000h-202FFFh -> logbook_max_dive_counter=2
+	; 256: 2FF000h-2FFFFFh -> logbook_max_dive_counter=255 (And hi>0...)
+
+	decf		logbook_max_dive_counter,F	; -1
+
+	clrf		ext_flash_address+0
+	clrf		ext_flash_address+1
+	movlw		0x20
+	movwf		ext_flash_address+2
+	movlw		.16
+	mulwf		logbook_max_dive_counter; logbook_max_dive_counter*16 = offset to 0x2000 (up:hi)
+	movf		PRODL,W
+	addwf		ext_flash_address+1,F
+	movf		PRODH,W
+	addwfc		ext_flash_address+2,F
+	; pointer at the first 0xFA of header
+
+	call		ext_flash_byte_read		; Reads one byte@ext_flash_address:3 into WREG and temp1
+	movwf		temp1
+	movlw		0xFA
+	cpfseq		temp1					; 0xFA found?
+	bra			logbook3b				; No, abort
+
+	incf		logbook_divenumber,F    ; new header found, increase logbook_divenumber
+	bra			logbook4           		; Done with searching, display the header!
+
+logbook3b:
+	btfss		logbook_page_not_empty	; Was there at least one dive?
+	goto		do_main_menu			; Not a single header was found, leave logbook.
+	bra			logbook_display_loop2
+
+logbook_reset:
+	tstfsz		logbook_divenumber		; Was there at least one dive?
+	bra			logbook_reset2
+	bra			logbook3b				; No, Nothing to do
+
+logbook_reset2:
+	bsf			all_dives_shown			; Yes
+	bra			logbook_display_loop2	; Continue
+
+logbook4:
+	btfsc		all_dives_shown			; All dives displayed?
+	bra			logbook_display_loop2	; Yes, but display first page again.
+
+	call 		display_listdive		; display short header for list on current list position
+
+	movlw		logbook_row_number
+	cpfseq		menupos					; first dive on list (top place)?
+	bra			logbook_display_loop1	; no, so skip saving of address
+
+; store all registered required to rebuilt the current logbookpage after the detail/profile view
+	movff		logbook_divenumber,logbook_divenumber_temp		; # of dive in list of the current page
+	movff		divemins+0,divemins_backup						; amount of dives drawn until now
+	movff		logbook_max_dive_counter,logbook_max_dive_counter_temp	; backup Counter
+
+logbook_display_loop1:
+	decfsz		menupos,F					; List full?
+	bra			logbook2					; no, search another dive for our current logbook page
+
+logbook_display_loop2:
+	btfss		logbook_page_not_empty		; Was there one dive at all?
+	bra			logbook						; Yes, so reload the first page
+
+	; TFT_mask...
+
+	WIN_LEFT	logbook_list_left
+	WIN_TOP		logbook_row_offset*logbook_row_number
+	STRCPY_TEXT_PRINT tNextLog				; "Next Page"
+	WIN_LEFT	logbook_list_left
+	WIN_TOP		logbook_row_offset*(logbook_row_number+.1)
+	STRCPY_TEXT_PRINT tExitLog				; "Exit Logbook"
+
+	movlw		d'1'						; Set cursor to position 1...
+	btfsc		return_from_profileview		; .. unless we are returning from a detail/profile view
+	movf		logbook_menupos_temp,W		; load last cursor position again
+	movwf		menupos						; and set menupos byte
+	bcf			return_from_profileview		; Do this only once while the page is loaded again!
+
+	bcf			logbook_page_not_empty			; Obviously the current page is NOT empty
+	call		TFT_logbook_cursor
+
+    call        logbook_preloop_tasks       ; Clear some flags and set to Speed_eco
+logbook_loop:
+    btfsc		switch_left					; SET/MENU?
+	goto		next_logbook3				; adjust cursor or create new page
+    btfsc		switch_right				; ENTER?
+	bra			display_profile_or_exit		; view details/profile or exit logbook
+
+    rcall       log_screendump_and_onesecond    ; Check if we need to make a screenshot and check for new second
+	btfsc		sleepmode					; Timeout?
+	goto		do_main_menu				; Yes
+
+	bra         logbook_loop                ; Wait for something to do
+
+display_profile_or_exit:
+	movlw		logbook_row_number+.2		; exit?
+	cpfseq		menupos
+	bra			display_profile_or_exit2	; No, check for "Next Page"
+	goto		do_main_menu
+
+display_profile_or_exit2:
+	movlw		logbook_row_number+.1		; Next page?
+	cpfseq		menupos
+	bra			display_profile				; No, show details/profile
+	goto		next_logbook2				; Next page!
+
+display_profile:	
+	call    	speed_fastest
+	movff		menupos,logbook_menupos_temp; store current cursor position
+	bsf			return_from_profileview		; tweak search routine to exit after found
+
+	movf		logbook_page_number,W		; Number of page
+	mullw		logbook_row_number
+	movf		PRODL,W						
+	addwf		menupos,W					; page*logbook_row_number+menupos=
+	movwf		divesecs					; # of dive to show
+
+display_profile2:
+	call		speed_fastest
+    clrf        CCP1CON                     ; stop PWM
+    bcf         PORTC,2                     ; Pull PWM out to GND
+    call		TFT_ClearScreen				; Clear screen
+; Set ext_flash pointer to "#divesecs-oldest" dive
+; compute read_int_eeprom .2 - divesecs
+; Read required header data for profile display
+; look in header for pointer to begin of diveprofile (Byte 2-4)
+; Set pointer (ext_flash_log_pointer:3) to this address, start drawing
+	
+	decf	divesecs,F		;-1
+	read_int_eeprom .2
+	movf	EEDATA,W
+	bcf		STATUS,C
+	subfwb	divesecs,W		; max. dives (low value) - divesecs
+	movwf	lo				; result
+	incf	divesecs,F		;+1
+	; Set ext_flash_address:3 to TOC entry of this dive
+	; 1st: 200000h-200FFFh -> lo=0
+	; 2nd: 201000h-201FFFh -> lo=1
+	; 3rd: 202000h-202FFFh -> lo=2
+	; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...)
+	clrf		ext_flash_address+0
+	clrf		ext_flash_address+1
+	movlw		0x20
+	movwf		ext_flash_address+2
+	movlw		.16
+	mulwf		lo					; lo*16 = offset to 0x2000 (up:hi)
+	movf		PRODL,W
+	addwf		ext_flash_address+1,F
+	movf		PRODH,W
+	addwfc		ext_flash_address+2,F
+	; pointer at the first 0xFA of header
+
+	; Now, show profile
+    LOG_POINT_TO    log_samplingrate
+	call	ext_flash_byte_read			; Read sampling rate
+	movff	temp1,samplesecs_value		; needed later...
+
+    LOG_POINT_TO    .2
+	call		ext_flash_byte_read_plus		; Read start address of profile
+	movff		temp1,ext_flash_log_pointer+0
+	call		ext_flash_byte_read_plus		; Read start address of profile
+	movff		temp1,ext_flash_log_pointer+1
+	call		ext_flash_byte_read_plus		; Read start address of profile
+	movff		temp1,ext_flash_log_pointer+2
+	
+
+	clrf		logbook_sample_counter+0
+	clrf		logbook_sample_counter+1				; holds amount of read samples
+
+	call		TFT_standard_color
+    call        logbook_show_divenumber             ; Show the dive number in medium font
+
+	WIN_SMALL	logbook_date_column, logbook_date_row
+	lfsr		FSR2,buffer
+    LOG_POINT_TO    log_date
+	call		ext_flash_byte_read_plus
+	movff		temp1,convert_value_temp+2		; Year
+	call		ext_flash_byte_read_plus
+	movff		temp1,convert_value_temp+0		; Month
+	call		ext_flash_byte_read_plus
+	movff		temp1,convert_value_temp+1		; Day
+	call		TFT_convert_date				; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
+	STRCAT_PRINT	""
+
+	WIN_SMALL	logbook_time_column, logbook_time_row
+	lfsr		FSR2,buffer
+	call		ext_flash_byte_read_plus		; hour
+	movff		temp1,lo
+	call		ext_flash_byte_read_plus		; Minutes
+	movf		lo,W
+	mullw		.60
+	movff		temp1,WREG
+	addwf		PRODL,F
+	movlw		.0
+	addwfc		PRODH,F					; PRODH:PRODL has end-of-dive time in minutes
+
+    LOG_POINT_TO    log_total_seconds
+	call		ext_flash_byte_read_plus	; Total sample time in seconds
+	movff		temp1,lo
+	call		ext_flash_byte_read_plus	; Total sample time in seconds
+	movff		temp1,hi
+	call		convert_time			; converts hi:lo in seconds to mins (hi) and seconds (lo)
+	clrf		sub_b+1
+	movff		hi,sub_b+0
+	movff		PRODL,sub_a+0
+	movff		PRODH,sub_a+1
+	call		subU16					; sub_c = sub_a - sub_b (with UNSIGNED values)
+	; sub_c:2 holds entry time in minutes
+	movff		sub_c+0,lo
+	movff		sub_c+1,hi
+	call		convert_time			; converts hi:lo in minutes to hours (hi) and minutes (lo)	
+	movff		lo,PRODL				; temp
+	movff		hi,lo
+	output_99x							; hour
+	PUTC		':'
+	movff		PRODL,lo			
+	output_99x							; minute
+	STRCAT_PRINT	""					; Display 1st row of details
+
+    LOG_POINT_TO    log_max_depth
+	call		ext_flash_byte_read_plus	; read max depth
+	movff		temp1,lo				
+	call		ext_flash_byte_read_plus	; read max depth
+	movff		temp1,hi
+	movff		lo,xA+0						; calculate y-scale for profile display
+	movff		hi,xA+1
+	movlw		profile_height_pixels		; pixel height available for profile
+	movwf		xB+0
+	clrf		xB+1
+	call		div16x16				; does xA/xB=xC
+	movff		xC+0,y_scale+0		; holds LOW byte of y-scale   (mbar/pixel!)
+	movff		xC+1,y_scale+1		; holds HIGH byte of y-scale  (mbar/pixel!)
+	incf		y_scale+0,F		; increase one, because there may be a remainder
+	movlw		d'0'
+	addwfc		y_scale+1,F
+	
+	movlw		LOW		((profile_height_pixels+1)*.1000)
+	movwf		xC+0
+	movlw		HIGH	(((profile_height_pixels+1)*.1000) & h'FFFF')
+	movwf		xC+1
+	movlw		UPPER	((profile_height_pixels+1)*.1000)
+	movwf		xC+2
+	clrf		xC+3
+
+	movff		lo,xB+0					; Max. Depth in mbar
+	movff		hi,xB+1					; Max. Depth in mbar
+	call		div32x16				; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+
+	movff		xC+0,x_scale+0	; 
+	movff		xC+1,x_scale+1	; = Pixels/10m (For scale, draw any xx rows a scale-line)
+
+	movf		x_scale+0,W
+	iorwf		x_scale+1,W		; x_scale:2 = Null?
+	bnz			display_profile_offset4		; No, continue
+	incf		x_scale+1,F		; Yes, make x_scale+1>1 to make "display_profile2e" working
+
+display_profile_offset4:
+	WIN_SMALL	log_max_value_column,log_max_value_row
+	lfsr		FSR2,buffer
+
+	TSTOSS		opt_units			; 0=Meters, 1=Feets
+	bra			display_profile_offset4_metric
+;display_profile_offset4_imperial:
+	call		convert_mbar_to_feet       	; convert value in lo:hi from mbar to feet
+	PUTC	' '
+	bsf			ignore_digit4
+	movlw		d'1'
+	movff		WREG,ignore_digits
+	bsf			leftbind	
+	output_16							; full feet
+	STRCAT_TEXT_PRINT    tFeets
+	bra			display_profile_offset4_common
+
+display_profile_offset4_metric:
+	bsf			leftbind
+	output_16dp	d'3'					; max. depth
+	STRCAT_TEXT_PRINT   tMeters
+
+display_profile_offset4_common:	
+	call		ext_flash_byte_read_plus				; divetime in minutes	
+	movff		temp1,lo
+	call		ext_flash_byte_read_plus	
+	movff		temp1,hi				; divetime in minutes
+
+	movff		lo,xA+0					; calculate x-scale for profile display
+	movff		hi,xA+1					; calculate total diveseconds first
+	movlw		d'60'					; 60seconds are one minute...
+	movwf		xB+0
+	clrf		xB+1
+	call		mult16x16				; result is in xC:2 !
+
+	WIN_SMALL	log_divetime_value_column,log_divetime_value_row
+	lfsr		FSR2,buffer
+	bsf			leftbind
+	output_16							; divetime minutes
+	movlw		LOW		d'600'
+	movwf		xA+0
+	movlw		HIGH	d'600'
+	movwf		xA+1					; A vertical line every 600 seconds
+	movff		samplesecs_value,xB+0		; Copy sampling rate
+	clrf		xB+1
+	call		div16x16				; xA/xB=xC with xA as remainder
+	movff		xC+0,average_depth_hold_total+0
+	movff		xC+1,average_depth_hold_total+1
+	;average_depth_hold_total:2 holds interval of samples for vertical 10min line
+
+; Restore divetime in minutes:
+; get real sample time
+    LOG_POINT_TO    log_total_seconds
+	call		ext_flash_byte_read_plus				; Total sample time in seconds
+	movff		temp1,xC+0
+	call		ext_flash_byte_read_plus				; Total sample time in seconds
+	movff		temp1,xC+1
+
+	PUTC		':'
+    LOG_POINT_TO    log_divetime+.2
+	call		ext_flash_byte_read_plus				; read divetime seconds
+	movff		temp1,lo
+	movff		xC+0,xA+0				; now calculate x-scale value
+	movff		xC+1,xA+1
+	movlw		profile_width_pixels					; pix width available
+	movwf		xB+0
+	clrf		xB+1
+	call		div16x16				; xA/xB=xC
+	movff		xC+0,xA+0	
+	movff		xC+1,xA+1
+	movf		samplesecs_value,W		; devide through sample interval!
+	movwf		xB+0
+	clrf		xB+1
+	call		div16x16				; xA/xB=xC
+	movff		xC+0,profile_temp+0		; store value (use any #xC sample, skip xC-1) into temp registers
+	movff		xC+1,profile_temp+1		; store value (use any #xC sample, skip xC-1) into temp registers
+	incf		profile_temp+0,F		; Increase by one, there might be a remainder
+	movlw		d'0'
+	addwfc		profile_temp+1,F
+
+	bsf			leftbind
+	output_99x							; divetime seconds
+	call	TFT_standard_color
+	STRCAT_PRINT    ""
+
+	call		ext_flash_byte_read_plus                ; Read min. Temperature
+	movff		temp1,logbook_min_tp+0
+	call		ext_flash_byte_read_plus                ; Read min. Temperature
+	movff		temp1,logbook_min_tp+1
+
+    ; Set pointer to Gas 1 Type.
+    LOG_POINT_TO    log_gas1+.3
+    call		ext_flash_byte_read_plus				; read Gas Type
+    decfsz      temp1,W                                 ; =1 (="First")?
+    bra         logbook_find_first_gas2                 ; No.
+    movlw       .1
+    movwf       temp1
+    bra         logbook_find_first_gas_done
+logbook_find_first_gas2:
+    ; Set pointer to Gas 2 Type.
+    LOG_POINT_TO    log_gas2+.3
+    call		ext_flash_byte_read_plus				; read Gas Type
+    decfsz      temp1,W                                 ; =1 (="First")?
+    bra         logbook_find_first_gas3                 ; No.
+    movlw       .2
+    movwf       temp1
+    bra         logbook_find_first_gas_done
+logbook_find_first_gas3:
+    ; Set pointer to Gas 3 Type.
+    LOG_POINT_TO    log_gas3+.3
+    call		ext_flash_byte_read_plus				; read Gas Type
+    decfsz      temp1,W                                 ; =1 (="First")?
+    bra         logbook_find_first_gas4                 ; No.
+    movlw       .3
+    movwf       temp1
+    bra         logbook_find_first_gas_done
+logbook_find_first_gas4:
+    ; Set pointer to Gas 4 Type.
+    LOG_POINT_TO    log_gas4+.3
+    call		ext_flash_byte_read_plus				; read Gas Type
+    decfsz      temp1,W                                 ; =1 (="First")?
+    bra         logbook_find_first_gas5                 ; No.
+    movlw       .4
+    movwf       temp1
+    bra         logbook_find_first_gas_done
+logbook_find_first_gas5:
+    movlw       .5                                      ; Must be Gas5
+    movwf       temp1
+logbook_find_first_gas_done:
+	movff		temp1,average_depth_hold_total+3; keep copy to restore color
+    rcall       profile_display_color       	; Back to normal profile color.
+    ; Pointer is now trashed!
+
+; Point to profile portion of this dive
+	movff		ext_flash_log_pointer+0,ext_flash_address+0
+	movff		ext_flash_log_pointer+1,ext_flash_address+1
+	movff		ext_flash_log_pointer+2,ext_flash_address+2
+
+	incf_ext_flash_address_0x20		d'2'	; Skip 0xFA 0xFA
+    call		ext_flash_byte_read_plus_0x20	; Read low byte of total dives into temp1 (at the time the dive was made)
+
+	; Load total number of dives (low byte only)
+	read_int_eeprom .2
+	incf		EEDATA,W					; +1
+	bsf			STATUS,C					; Set borrow
+	subfwb		divesecs,W	; total dives - dive# to show - 1 = low byte of total dives (at the time the dive was made)
+	cpfseq		temp1						; # of dive in logbook (Must be equal with low byte in short header)
+	bra			display_profile_no_profile	; Not equal, no profile for this dive available!
+
+	; Skip rest of short header: 3 Bytes
+	; Skip length of profile data: 3 Bytes
+    ; Skip sampling rate in profile section: 1Byte
+    ; Skip number of divisors: 1Byte
+	incf_ext_flash_address_0x20		d'8'
+
+; Divisor temp
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movf		temp1,W
+	movwf       divisor_temperature	        ; Store divisor
+	movwf       count_temperature           ; Store to tp° counter too.
+; Divisor Deco
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movf		temp1,W
+	movwf       divisor_deco      			; Store divisor
+	movwf		count_deco                  ; Store as temp, too
+; Divisor GF
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movff		temp1,divisor_gf			; Store divisor
+; Divisor ppO2 Sensors
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movff		temp1,divisor_ppo2_sensors	; Store divisor
+; Divisor decoplan
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movff		temp1,divisor_decoplan		; Store divisor
+; Divisor CNS
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movff		temp1,divisor_cns			; Store divisor
+; Divisor Tank data
+    incf_ext_flash_address_0x20		d'2'
+;    call		ext_flash_byte_read_plus_0x20	; Read information type
+;    call		ext_flash_byte_read_plus_0x20	; Read information Length
+    call		ext_flash_byte_read_plus_0x20	; Read information Divisor
+	movff		temp1,divisor_tank			; Store divisor
+
+	; Start Profile display
+    movlw       color_deepblue
+	call		TFT_set_color				; Make this configurable?
+    ; Draw a frame around profile area
+    WIN_FRAME_COLOR16 profile_top-1,profile_top+profile_height_pixels+1,profile_left-1,profile_left+profile_width_pixels+1
+
+	movlw		profile_top
+	movff		WREG,win_top
+	movlw		profile_left
+	movff		WREG,win_leftx2				; Left border (0-159)
+	movlw		d'1'
+	movff		WREG,win_height
+	movlw		profile_width_pixels+.1
+	movff		WREG,win_width				; Right border (0-159)
+	bra			display_profile2f			; No 0m line
+display_profile2e:
+	call		TFT_box						; Inputs:  win_top, win_leftx2, win_height, win_width, win_color1, win_color2
+display_profile2f:
+	movff		win_top,WREG				; Get row
+	addwf		x_scale+0,W					; Add line interval distance to win_top
+	tstfsz		x_scale+1					; >255?
+	movlw		d'255'						; Yes, make win_top>239 -> Abort here
+	btfsc		STATUS,C					; A Cary from the addwf above?
+	movlw		d'255'						; Yes, make win_top>239 -> Abort here
+	movff		WREG,win_top				; Result in win_top again
+	movff		win_top,lo					; Get win_top in Bank1...
+	movlw		profile_top+profile_height_pixels+.1 ; Limit
+	cpfsgt		lo							; >239?
+	bra			display_profile2e			; No, draw another line
+
+	clrf		timeout_counter2			; here: used as counter for depth readings
+	movlw		profile_width_pixels+profile_left-.1
+	movwf		ignore_digits				; here: used as counter for x-pixels
+	bcf			end_of_profile				; clear flag
+	movlw		profile_left
+	movwf		logbook_pixel_x_pos			; here: used as colum x2 (Start at Colum 5)
+	movlw		profile_top					; Zero-m row
+	movwf		apnoe_mins					; here: used for fill between rows
+    movwf       logbook_last_tp             ; Initialise for Tp° curve too.
+
+    movlw       LOW(-.100)                  ; Initialize max tp° to -10.0 °C.
+    movwf       logbook_max_tp+0
+    movlw       HIGH 0xFFFF & (-.100)
+    movwf       logbook_max_tp+1
+    
+    setf        logbook_cur_tp+0            ; Initialize Tp°, before the first recorded point.
+    setf        logbook_cur_tp+1
+    clrf        logbook_last_tp             ; Also reset previous Y for Tp°
+    clrf        logbook_ceiling             ; Ceiling = 0, correct value for no ceiling.
+
+    INIT_PIXEL_WROTE logbook_pixel_x_pos       ; pixel x2			(Also sets standard Color!)
+
+profile_display_loop:
+	movff		profile_temp+0,profile_temp2+0
+	movff		profile_temp+1,profile_temp2+1		; 16Bit x-scaler
+	incf		profile_temp2+1,F					
+	tstfsz		profile_temp2+0						; Must not be Zero
+	bra			profile_display_loop2				; Not Zero!
+	incf		profile_temp2+0,F					; Zero, Increase!
+
+profile_display_loop2:
+	rcall		profile_view_get_depth		; reads depth, temp and profile data
+
+	btfsc		end_of_profile					; end-of profile reached?
+	bra			profile_display_loop_done	; Yes, skip all remaining pixels
+
+
+    ;---- Draw Ceiling curve, if any ---------------------------------------------
+    movf        divisor_deco,W
+    bz          profile_display_skip_deco
+
+    movf        logbook_ceiling,W           ; Any deco ceiling ?
+    bz          profile_display_skip_deco
+
+	mullw       .100                        ; Yes: convert to mbar
+	movff       PRODL,sub_a+0
+	movff       PRODH,sub_a+1
+	movff       logbook_cur_depth+0,sub_b+0    ; Compare with UNSIGNED current depth (16bits)
+	movff       logbook_cur_depth+1,sub_b+1
+	call        subU16                      ; set (or not) neg_flag
+
+    movlw       color_dark_green            ; Dark green if Ok,
+    btfss       neg_flag
+    movlw       color_dark_red              ; Or dark red if ceiling overflown.
+    call        TFT_set_color
+    
+	movff       PRODL,xA+0
+	movff       PRODH,xA+1
+	movff		y_scale+0,xB+0			; devide pressure in mbar/quant for row offsett
+	movff		y_scale+1,xB+1
+	call		div16x16					; xA/xB=xC
+
+	movlw		profile_top+.1                  ; Starts right after the top greenish line.
+	movff		WREG,win_top
+	movff		logbook_pixel_x_pos,win_leftx2 ; Left border (0-159)
+	movff		xC+0,win_height				
+	call		half_vertical_line			; Inputs:  win_top, win_leftx2, win_height, win_color1, win_color2
+
+profile_display_skip_deco:
+    ;---- Draw Tp° curve, if any ---------------------------------------------
+    movf        divisor_temperature,W
+    bz          profile_display_skip_temp
+
+	movf        logbook_cur_tp+0,W          ; Did we had already a valid Tp°C record ?
+	andwf       logbook_cur_tp+1,W
+	incf        WREG
+	bz          profile_display_skip_temp   ; No: just skip drawing.
+
+    movlw       LOW(((profile_height_pixels-.10)*.256)/.370)         ; fixed tp° scale: (-2 .. +35°C * scale256 )/153pix
+ 	movwf		xB+0
+    movlw       HIGH(((profile_height_pixels-.10)*.256)/.370)
+ 	movwf		xB+1
+
+	movf        logbook_cur_tp+0,W          ; Current Tp° - (-2.0°C) == Tp° + 20.
+	addlw       LOW(.20)                    ; Low byte.
+	movwf       xA+0
+    movf		logbook_cur_tp+1,W
+    btfsc       STATUS,C                    ; Propagate carry, if any
+    incf        WREG
+    movwf       xA+1
+    call		mult16x16					; xA*xB=xC
+
+    ; scale: divide by 256, ie. take just high byte.
+    movf        xC+1,W
+    sublw       profile_top+profile_height_pixels-.10		; Upside-down: Y = .75 + (.153 - result)
+    movwf       xC+0
+
+	; Check limits
+	movlw		profile_top
+	movwf		xC+1
+	cpfsgt		xC+0
+	movff		xC+1,xC+0
+
+    movlw       color_orange
+    call        TFT_set_color
+
+    movf        logbook_last_tp,W           ; do we have a valid previous value ?
+    bz          profile_display_temp_1      ; No: skip the vertical line.
+    movwf       xC+1
+	call		profile_display_fill		; In this column between this row (xC+0) and the last row (xC+1)
+profile_display_temp_1:	
+    movff       xC+0,logbook_last_tp
+    PIXEL_WRITE logbook_pixel_x_pos,xC+0       ; Set col(0..159) x row (0..239), put a current color pixel.
+
+profile_display_skip_temp:
+    ;---- Draw depth curve ---------------------------------------------------
+	movff		y_scale+0,xB+0			; devide pressure in mbar/quant for row offsett
+	movff		y_scale+1,xB+1
+	movff		logbook_cur_depth+0,xA+0
+	movff		logbook_cur_depth+1,xA+1
+	call		div16x16					; xA/xB=xC
+	movlw		profile_top
+	addwf		xC+0,F						; add 75 pixel offset to result
+	
+	btfsc		STATUS,C                    ; Ignore potential profile errors
+	movff		apnoe_mins,xC+0
+
+    rcall       profile_display_color       ; Back to normal profile color.
+
+    movff       apnoe_mins,xC+1
+	call		profile_display_fill		; In this column between this row (xC+0) and the last row (xC+1)
+	movff		xC+0,apnoe_mins				; Store last row for fill routine
+
+    PIXEL_WRITE logbook_pixel_x_pos,xC+0     ; Set col(0..159) x row (0..239), put a std color pixel.
+	incf		logbook_pixel_x_pos,F		; Next row
+
+    ;---- Draw CNS curve, if any ---------------------------------------------
+    movf        divisor_cns,W
+    bz          profile_display_skip_cns
+    ;
+    ; TODO HERE 
+    ;
+profile_display_skip_cns:
+
+    ;---- Draw GF curve, if any ----------------------------------------------
+    movf        divisor_gf,W
+    bz          profile_display_skip_gf
+    ;
+    ; TODO HERE 
+    ;
+profile_display_skip_gf:
+
+    ;---- All curves done.
+    
+profile_display_skip_loop1:					; skips readings!
+	dcfsnz		profile_temp2+0,F
+	bra			profile_display_loop3		; check 16bit....
+
+	rcall		profile_view_get_depth		; reads depth, temp and profile data
+	bra			profile_display_skip_loop1
+
+profile_display_loop3:
+	decfsz		profile_temp2+1,F			; 16 bit x-scaler test
+	bra			profile_display_skip_loop1	; skips readings!
+
+	decfsz		ignore_digits,F				; counts drawn x-pixels to zero
+	bra			profile_display_loop		; Not ready yet
+; Done.
+
+display_profile_no_profile:					; No profile available for this dive!
+
+profile_display_loop_done:
+	decf	divesecs,F		;-1
+	read_int_eeprom .2
+	movf	EEDATA,W
+	bcf		STATUS,C
+	subfwb	divesecs,W		; max. dives (low value) - divesecs
+	movwf	lo				; result
+	incf	divesecs,F		;+1
+	; Set ext_flash_address:3 to TOC entry of this dive
+	; 1st: 200000h-200FFFh -> lo=0
+	; 2nd: 201000h-201FFFh -> lo=1
+	; 3rd: 202000h-202FFFh -> lo=2
+	; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...)
+	clrf		ext_flash_address+0
+	clrf		ext_flash_address+1
+	movlw		0x20
+	movwf		ext_flash_address+2
+	movlw		.16
+	mulwf		lo					; lo*16 = offset to 0x2000 (up:hi)
+	movf		PRODL,W
+	addwf		ext_flash_address+1,F
+	movf		PRODH,W
+	addwfc		ext_flash_address+2,F
+	; pointer at the first 0xFA of header
+
+    movlw   .2                              ; negative offset
+    addwf   logbook_last_tp,W
+    movff   WREG,win_top                    ; Line below temp
+    movff   logbook_pixel_x_pos,lo
+    movlw   .130
+    cpfslt  lo                              ; limit left border to 130
+    movwf   lo
+    movff   lo,win_leftx2
+    WIN_FONT   FT_TINY
+	movlw   color_orange            ; Use same color as tp° curve
+	call    TFT_set_color
+
+    movff   logbook_min_tp+0,lo
+	movff   logbook_min_tp+1,hi
+    lfsr	FSR2,buffer
+
+	TSTOSS	opt_units			; 0=°C, 1=°F
+	bra		logbook_show_temp_metric
+;logbook_show_temp_imperial:
+	call	TFT_convert_signed_16bit    	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	call	convert_celsius_to_fahrenheit	; convert value in lo:hi from celsius to fahrenheit
+	lfsr	FSR2,buffer						; Overwrite "-"
+	bsf		ignore_digit5		; Full degrees only
+	output_16
+	bcf		ignore_digit5
+	STRCAT_TEXT_PRINT  tLogTunitF
+	bra		logbook_show_temp_common
+
+logbook_show_temp_metric:
+	call		TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	movlw		d'3'
+	movwf		ignore_digits
+	bsf			leftbind
+	output_16dp	d'2'					; temperature
+	STRCAT_TEXT_PRINT    tLogTunitC
+
+logbook_show_temp_common:
+	bcf			leftbind
+	call        TFT_standard_color     ; Back to normal
+
+	; Get pointer to Gaslist
+    LOG_POINT_TO    log_gas1
+
+	movlw		color_white					; Color for Gas 1
+	call		TFT_set_color				; Set Color...
+	bsf			leftbind
+	WIN_TINY	log_gas_column1, log_gas_row
+    rcall       log_show_gas_common
+
+	movlw		color_green					; Color for Gas 2
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log_gas_column2, log_gas_row
+    rcall       log_show_gas_common
+
+	movlw		color_red					; Color for Gas 3
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log_gas_column3, log_gas_row
+    rcall       log_show_gas_common
+
+	movlw		color_yellow				; Color for Gas 4
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log_gas_column4, log_gas_row
+    rcall       log_show_gas_common
+
+	movlw		color_cyan                  ; Color for Gas 5
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log_gas_column5, log_gas_row
+    rcall       log_show_gas_common
+
+    rcall       logbook_preloop_tasks       ; Clear some flags and set to Speed_eco
+display_profile_loop:
+	btfsc		switch_left					; SET/MENU?
+	bra			logbook_page2   			; Show more information
+	btfsc		switch_right				; ENTER?
+	bra			exit_profileview			; back to list
+
+    rcall       log_screendump_and_onesecond    ; Check if we need to make a screenshot and check for new second
+	btfsc		sleepmode					; Timeout?
+	bra			exit_profileview			; back to list
+	bra			display_profile_loop		; wait for something to do
+
+    global  log_screendump_and_onesecond
+log_screendump_and_onesecond:    ; Check if we need to make a screenshot and check for new second
+	btfsc		onesecupdate
+	call		timeout_surfmode			; Timeout
+	btfsc		onesecupdate
+	call		set_dive_modes				; Check, if divemode must be entered
+	bcf			onesecupdate				; one second update
+	btfsc		divemode
+	goto		restart						; Enter Divemode if required
+
+    btfsc       enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+    bra         log_screendump_and_onesecond2
+    btfsc       vusb_in                     ; USB plugged in?
+    goto        comm_mode                   ; Start COMM mode
+    return
+log_screendump_and_onesecond2:
+    btfss       vusb_in                     ; USB (still) plugged in?
+    bcf         enable_screen_dumps         ; No, clear flag
+    call        rs232_get_byte
+    btfsc       rs232_recieve_overflow
+    return
+    movlw       "l"
+    cpfseq      RCREG1
+    return
+    call        TFT_dump_screen             ; Dump the screen contents
+    return
+
+log_show_gas_common:
+    extern  customview_show_mix
+	lfsr		FSR2,buffer
+	call		ext_flash_byte_read_plus					; Gas2 current O2
+	movff		temp1,lo
+	call		ext_flash_byte_read_plus					; Gas2 current He
+	movff		temp1,hi
+    call		customview_show_mix				; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+	STRCAT_PRINT	""
+	call		ext_flash_byte_read_plus					; Gas2 change depth
+    call		ext_flash_byte_read_plus					; Gas2 Type
+    return
+
+;=============================================================================
+profile_display_color:
+    movff       average_depth_hold_total+3,active_gas ; Restore gas color.
+	movlw		color_white					; Default color
+	dcfsnz		active_gas,F
+	movlw		color_white					; Color for Gas 1
+	dcfsnz		active_gas,F
+	movlw		color_green					; Color for Gas 2
+	dcfsnz		active_gas,F
+	movlw		color_red					; Color for Gas 3
+	dcfsnz		active_gas,F
+	movlw		color_yellow				; Color for Gas 4
+	dcfsnz		active_gas,F
+	movlw		color_cyan      			; Color for Gas 5
+	dcfsnz		active_gas,F
+	movlw		color_cyan					; Color for Gas 6
+	goto		TFT_set_color				; Set Color...
+
+;=============================================================================
+; Draw a vertical line between xC+1 and xC+0, at current X position.
+;
+; Note: should keep xC+0
+; Note: ascending or descending !
+;
+profile_display_fill:
+    ; First, check if xC+0>apnoe_mins or xC+0<aponoe_mins
+	movf	xC+0,W
+	cpfseq	xC+1				    ; xC+0 = apone_mins?
+	bra		profile_display_fill2	; No!
+	return
+
+profile_display_fill2:	
+    ; Make sure to init X position.
+    movf    logbook_pixel_x_pos,W
+    mullw   2
+    decf    PRODL,F
+    movlw   0
+    subwfb  PRODH,F
+    call    pixel_write_col320
+
+	movf	xC+0,W
+	cpfsgt	xC+1				    ; apnoe_mins>xC+0?
+	bra		profile_display_fill_up	; Yes!
+
+profile_display_fill_down2:			; Loop	
+	decf		xC+1,F
+
+    HALF_PIXEL_WRITE    xC+1        ; Updates just row (0..239)
+
+	movf		xC+0,W
+	cpfseq		xC+1				; Loop until xC+1=xC+0
+	bra			profile_display_fill_down2
+	return							; apnoe_mins and xC+0 are untouched
+
+profile_display_fill_up:			; Fill upwards from xC+0 to apone_mins!
+	incf		xC+1,F
+
+    HALF_PIXEL_WRITE    xC+1        ; Updates just row (0..239)
+
+	movf		xC+0,W
+	cpfseq		xC+1				; Loop until xC+1=apnoe_mins
+	bra			profile_display_fill_up
+	return							; apnoe_mins and xC+0 are untouched
+
+;=============================================================================
+
+
+profile_view_get_depth:
+	incf		logbook_sample_counter+0,F
+	movlw		d'0'
+	addwfc		logbook_sample_counter+1,F		; Count read pixels
+
+	movf		logbook_sample_counter+0,W
+	cpfseq		average_depth_hold_total+0
+	bra			profile_view_get_depth_no_line		; no need to draw a 10min line, continue
+	movf		logbook_sample_counter+1,W
+	cpfseq		average_depth_hold_total+1
+	bra			profile_view_get_depth_no_line		; no need to draw a 10min line, continue
+; draw a new 10min line here...
+	clrf		logbook_sample_counter+0
+	clrf		logbook_sample_counter+1					; clear counting registers for next line
+
+	; Vertical lines...
+	movlw       color_deepblue
+	call		TFT_set_color						; Make this configurable?
+	movlw		profile_top+.1
+	movff		WREG,win_top
+	incf		logbook_pixel_x_pos,W	; draw one line to right to make sure it's the background of the profile
+	movff		WREG,win_leftx2		; Left border (0-159)
+	movlw		profile_height_pixels
+	movff		WREG,win_height				
+	movlw		profile_height_pixels
+	movff		WREG,win_width				; "Window" height
+	call		half_horizontal_line        ; Inputs:  win_top, win_leftx2, win_width, win_color1, win_color2
+
+profile_view_get_depth_no_line:
+	call		ext_flash_byte_read_plus_0x20	; read depth first
+	movff		temp1,logbook_cur_depth+0   	; low value
+	call		ext_flash_byte_read_plus_0x20	; read depth first
+	movff		temp1,logbook_cur_depth+1   	; high value
+	call		ext_flash_byte_read_plus_0x20	; read Profile Flag Byte
+	movff		temp1,timeout_counter2			; Read Profile Flag Byte
+
+	bcf			event_occured				; clear flag
+	btfsc		timeout_counter2,7
+	bsf			event_occured				; We also have an Event byte!
+	bcf			timeout_counter2,7			; Clear Event Byte Flag (If any)
+	; timeout_counter2 now holds the number of additional bytes to ignore (0-127)
+	movlw		0xFD						; end of profile bytes?
+	cpfseq		logbook_cur_depth+0
+	bra			profile_view_get_depth_new1	; no 1st. 0xFD
+	cpfseq		logbook_cur_depth+1
+	bra			profile_view_get_depth_new1	; no 2nd. 0xFD
+	bsf			end_of_profile				; End found! Set Flag! Skip remaining pixels!
+	return
+
+profile_view_get_depth_new1:
+	btfsc		event_occured				; Was there an event attached to this sample?
+	rcall		profile_view_get_depth_new2	; Yes, get information about this event
+    
+    ;---- Read Tp°, if any AND divisor reached AND bytes available -----------
+    movf        divisor_temperature,W       ; Is Tp° divisor null ?
+    bz          profile_view_get_depth_no_tp; Yes: no Tp° curve.
+    decf        count_temperature,F         ; Decrement tp° counter
+    bnz         profile_view_get_depth_no_tp; No temperature this time
+    
+    call		ext_flash_byte_read_plus_0x20				; Tp° low
+	decf        timeout_counter2,F
+	movff		temp1,logbook_cur_tp+0
+    call		ext_flash_byte_read_plus_0x20				; Tp° high
+	decf        timeout_counter2,F
+	movff		temp1,logbook_cur_tp+1
+	movff       divisor_temperature,count_temperature   ; Restart counter.
+    
+    ; Compute Tp° max on the fly...
+    movff       logbook_cur_tp+0,sub_a+0    ; Compare cur_tp > max_tp ?
+    movff       logbook_cur_tp+1,sub_a+1
+    movff       logbook_max_tp+0,sub_b+0
+    movff       logbook_max_tp+1,sub_b+1
+    call        sub16                       ; SIGNED sub_a - sub_b
+    btfsc       neg_flag
+    bra         profile_view_get_depth_no_tp
+    
+    movff       logbook_cur_tp+0,logbook_max_tp+0
+    movff       logbook_cur_tp+1,logbook_max_tp+1
+    
+    ;---- Read deco, if any AND divisor=0 AND bytes available ----------------
+profile_view_get_depth_no_tp:
+    movf        divisor_deco,W
+    bz          profile_view_get_depth_no_deco
+    decf        count_deco,F
+    bnz         profile_view_get_depth_no_deco
+    
+    call		ext_flash_byte_read_plus_0x20
+	decf        timeout_counter2,F
+	movff		temp1,logbook_ceiling
+	movff       divisor_deco,count_deco     ; Restart counter.
+
+    ;---- Read GF, if any AND divisor=0 AND bytes available ------------------
+profile_view_get_depth_no_deco:
+    movf        timeout_counter2,W          ; No more extra bytes ?
+    btfsc       STATUS,Z
+    return                                  ; No: done.
+    
+    ; Then skip remaining bytes...
+	movf		timeout_counter2,W			; number of additional bytes to ignore (0-127)
+	call		incf_ext_flash_address0_0x20; increases bytes in ext_flash_address:3 with 0x200000 bank switching
+	return
+
+profile_view_get_depth_new2:
+	call		ext_flash_byte_read_plus_0x20			; Read Event byte
+	movff		temp1,EventByte				; store EventByte
+	decf		timeout_counter2,F			; reduce counter
+; Check Event flags in the EventByte
+	btfsc		EventByte,4					; Manual Gas Changed?
+	bra			logbook_event1				; Yes!
+	btfss		EventByte,5					; Stored Gas Changed?
+	return									; No, return
+; Stored Gas changed!
+	call		ext_flash_byte_read_plus_0x20		; Read Gas#
+	decf		timeout_counter2,F			; reduce counter
+	movff		temp1,average_depth_hold_total+3
+    rcall       profile_display_color       ; Change profile color according to gas number
+	return
+
+logbook_event1:
+    movlw       6                           ; Just color backup to 6
+    movwf       average_depth_hold_total+3
+    rcall       profile_display_color       ; Back to normal profile color.
+	return		;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...)
+
+exit_profileview:
+	call		speed_fastest
+	bcf			sleepmode
+	clrf		timeout_counter2				; restore all registers to build same page again
+	movff		divemins_backup,divemins+0
+	movff		logbook_divenumber_temp, logbook_divenumber
+	movff		logbook_max_dive_counter_temp,logbook_max_dive_counter
+	incf		logbook_max_dive_counter,F
+	decf		logbook_divenumber,F
+	bcf			all_dives_shown
+	clrf		menupos3					; here: used row on current page
+	movlw		logbook_row_number
+	movwf		menupos						; here: active row on current page
+    clrf        CCP1CON                     ; stop PWM
+    bcf         PORTC,2                     ; Pull PWM out to GND
+	call		TFT_ClearScreen				; clear details/profile
+	goto		logbook2					; start search
+
+next_logbook2:
+	btfsc		all_dives_shown				; all shown
+	goto		logbook 					; all reset
+	clrf		menupos3	
+	movlw		logbook_row_number
+	movwf		menupos
+	incf		logbook_page_number,F		; start new screen
+    clrf        CCP1CON                     ; stop PWM
+    bcf         PORTC,2                     ; Pull PWM out to GND
+	call		TFT_ClearScreen
+	goto		logbook2					; start search
+
+next_logbook3:
+	incf		menupos,F				; +1
+	movlw		logbook_row_number+.2
+	cpfsgt		menupos					; =logbook_row_number+.3?
+	bra			next_logbook3a			; No
+	movlw		.1
+	movwf		menupos
+	bra			next_logbook3b
+
+next_logbook3a:
+	incf		menupos3,W				; last entry in current page +1
+	cpfseq		menupos					; same as cursor pos.?
+	bra			next_logbook3b			; No
+	movlw		logbook_row_number+.1	; Yes, ...
+	movwf		menupos					; ... jump directly to "next page" if page is not full
+
+	movlw		logbook_row_number
+	cpfseq		menupos3				; Last dive was row logbook_row_number?
+	bsf			all_dives_shown			; No, set flag to load first page again (full reset)
+
+next_logbook3b:
+	clrf		timeout_counter2
+	call		TFT_logbook_cursor
+
+	bcf			switch_left
+	goto		logbook_loop
+
+display_listdive:
+	bsf			logbook_page_not_empty		; Page not empty
+	incf		menupos3,F					
+
+	bsf			leftbind
+	WIN_FONT	FT_SMALL
+	WIN_LEFT	logbook_list_left
+	
+	decf		menupos3,W		; -1 into wreg
+	mullw		logbook_row_offset
+	movff		PRODL,win_top
+
+	lfsr		FSR2,buffer
+	movff		logbook_divenumber,lo
+	output_8								; # of dive
+	PUTC		' '
+    LOG_POINT_TO    log_date+1              ; Point to month
+	call		ext_flash_byte_read_plus	
+	movff		temp1,lo					; read month
+
+display_listdive2:
+	movff		lo,convert_value_temp+0		; Month (in lo, see above)
+	call		ext_flash_byte_read_plus	; Day 
+	movff		temp1,convert_value_temp+1	
+	call		TFT_convert_date_short		; converts into "DD/MM" or "MM/DD" or "MM/DD" into buffer
+	PUTC	' '
+
+    LOG_POINT_TO    log_max_depth           ; Point to max. depth
+	call		ext_flash_byte_read_plus	; max. Depth
+	movff		temp1,lo
+	call		ext_flash_byte_read_plus
+	movff		temp1,hi
+
+	TSTOSS      opt_units			; 0=Meters, 1=Feets
+	bra			display_listdive2_metric
+;display_listdive2_imperial:
+	call		convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+	PUTC	' '
+	bsf			ignore_digit4
+	movlw		d'1'
+	movff		WREG,ignore_digits
+	bcf			leftbind	
+	output_16							; full feet
+	STRCAT_TEXT tFeets1
+	bra			display_listdive3
+
+display_listdive2_metric:
+    bsf     ignore_digit5               ; no cm...
+	movlw		d'1'					; +1
+	movff		WREG,ignore_digits		; no 1000m
+	bcf			leftbind
+	output_16dp .3  					; xxx.y
+	STRCAT_TEXT tMeters
+	PUTC	' '
+
+display_listdive3:
+	call		ext_flash_byte_read_plus
+	movff		temp1,lo					; read divetime minutes
+	call		ext_flash_byte_read_plus
+	movff		temp1,hi
+	output_16_3								; Divetime minutes (0-999min)
+	STRCAT_TEXT_PRINT tMinutes             	; Display header-row in list
+	return
+
+logbook_show_divenumber:
+	call		do_logoffset_common_read	; Read into lo:hi
+	tstfsz		lo							; lo=0?
+	bra			logbook_show_divenumber2	; No, adjust offset
+	tstfsz		hi							; hi=0?
+	bra			logbook_show_divenumber2	; No, adjust offset
+	movff		divesecs,lo					; lo=0 and hi=0 -> skip Offset routine
+	bra			logbook_show_divenumber3	; Display now
+
+logbook_show_divenumber2:
+	movlw		d'1'
+	addwf		lo,F
+	movlw		d'0'
+	addwfc		hi,F						; hi:lo = hi:lo + 1
+	movff		lo,sub_a+0
+	movff		hi,sub_a+1
+	movff		divesecs,sub_b+0
+	clrf		sub_b+1
+	call		subU16						;  sub_c = sub_a - sub_b
+	movff		sub_c+0,lo
+	movff		sub_c+1,hi
+
+logbook_show_divenumber3:
+	WIN_MEDIUM	logbook_divenumer_column, logbook_divenumer_row
+	lfsr		FSR2,buffer
+	bsf			leftbind
+	output_16									; # of dive in logbook
+	bcf			leftbind
+	STRCAT_PRINT	""
+    return
+
+
+logbook_page2: ; Show more info
+	call		speed_fastest
+    clrf        CCP1CON                     ; stop PWM
+    bcf         PORTC,2                     ; Pull PWM out to GND
+    call		TFT_ClearScreen				; Clear screen
+
+; Set ext_flash pointer to "#divesecs-oldest" dive
+; compute read_int_eeprom .2 - divesecs
+; Read required header data for profile display
+; look in header for pointer to begin of diveprofile (Byte 2-4)
+; Set pointer (ext_flash_log_pointer:3) to this address, start drawing
+
+	decf	divesecs,F		;-1
+	read_int_eeprom .2
+	movf	EEDATA,W
+	bcf		STATUS,C
+	subfwb	divesecs,W		; max. dives (low value) - divesecs
+	movwf	lo				; result
+	incf	divesecs,F		;+1
+	; Set ext_flash_address:3 to TOC entry of this dive
+	; 1st: 200000h-200FFFh -> lo=0
+	; 2nd: 201000h-201FFFh -> lo=1
+	; 3rd: 202000h-202FFFh -> lo=2
+	; 256: 2FF000h-2FFFFFh -> lo=255 (And hi>0...)
+	clrf		ext_flash_address+0
+	clrf		ext_flash_address+1
+	movlw		0x20
+	movwf		ext_flash_address+2
+	movlw		.16
+	mulwf		lo					; lo*16 = offset to 0x2000 (up:hi)
+	movf		PRODL,W
+	addwf		ext_flash_address+1,F
+	movf		PRODH,W
+	addwfc		ext_flash_address+2,F
+	; pointer at the first 0xFA of header
+    call        logbook_show_divenumber             ; Show the dive number in medium font
+
+
+    LOG_POINT_TO    log_surface_press
+    ; surface pressure in mbar
+    call		ext_flash_byte_read_plus	; read surface pressure
+    movff       temp1,lo
+    call		ext_flash_byte_read_plus	; read surface pressure
+    movff       temp1,hi
+    WIN_TINY    MBAR_column,MBAR_row
+    lfsr        FSR2,buffer
+	bsf			leftbind
+	output_16							; Air pressure before dive
+	STRCAT_TEXT_PRINT    tMBAR
+
+    ; OC Gas List
+    LOG_POINT_TO    log_gas1
+    WIN_TINY	log2_title_column,log2_title_row1
+    WIN_COLOR   color_greenish
+    STRCPY_TEXT_PRINT   tGaslist
+    WIN_FRAME_STD   log2_title_row1-2, log2_gas_row5+.15, log2_title_column-2, .159    ; Top, Bottom, Left, Right
+    bcf		leftbind
+	movlw		color_white					; Color for Gas 1
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log2_gas_column, log2_gas_row1
+    rcall       log_show_gas_common2
+	movlw		color_green					; Color for Gas 2
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log2_gas_column, log2_gas_row2
+    rcall       log_show_gas_common2
+	movlw		color_red					; Color for Gas 3
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log2_gas_column, log2_gas_row3
+    rcall       log_show_gas_common2
+	movlw		color_yellow				; Color for Gas 4
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log2_gas_column, log2_gas_row4
+    rcall       log_show_gas_common2
+	movlw		color_cyan  				; Color for Gas 5
+	call		TFT_set_color				; Set Color...
+	WIN_TINY	log2_gas_column, log2_gas_row5
+    rcall       log_show_gas_common2
+
+    ; Firmware
+	call		TFT_standard_color
+    WIN_TINY    log2_firmware_column,log2_firmware_row
+    STRCPY_TEXT tFirmware
+    call		ext_flash_byte_read_plus	; read firmware xx
+    movff       temp1,lo
+    bsf         leftbind
+    output_8
+    PUTC        "."
+    call		ext_flash_byte_read_plus	; read firmware yy
+    movff       temp1,lo
+    output_99x
+    STRCAT_PRINT	""
+
+    ; Battery
+    WIN_TINY    log2_battery_column,log2_battery_row
+    STRCPY      "Batt:"
+    call		ext_flash_byte_read_plus	; read battery low
+    movff       temp1,lo
+    call		ext_flash_byte_read_plus	; read battery high
+    movff       temp1,hi
+    output_16dp  .2
+    STRCAT_PRINT	"V"
+
+    ; Setpoint list
+    LOG_POINT_TO    log_sp1
+    WIN_TINY	log2_title_column,log2_title_sp_row
+    WIN_COLOR   color_greenish
+    STRCPY_TEXT_PRINT   tFixedSetpoints
+    WIN_FRAME_STD   log2_title_sp_row-2, log2_sp_row5+.15, log2_title_column-2, .159    ; Top, Bottom, Left, Right
+	WIN_TINY	log2_gas_column, log2_sp_row1
+    rcall       log_show_sp_common
+	WIN_TINY	log2_gas_column, log2_sp_row2
+    rcall       log_show_sp_common
+	WIN_TINY	log2_gas_column, log2_sp_row3
+    rcall       log_show_sp_common
+	WIN_TINY	log2_gas_column, log2_sp_row4
+    rcall       log_show_sp_common
+	WIN_TINY	log2_gas_column, log2_sp_row5
+    rcall       log_show_sp_common
+
+    ; Salinity
+    WIN_TINY    log2_salinity_column,log2_salinity_row
+    STRCPY_TEXT tDvSalinity
+    bsf         leftbind
+    call		ext_flash_byte_read_plus	; read salinity
+    movff       temp1,lo
+    output_8
+    STRCAT_PRINT	"%"
+
+    ; CNS
+    LOG_POINT_TO    log_cns_start
+    WIN_TINY    log2_cns_column,log2_cns_row
+    STRCPY_TEXT tCNS2
+    call		ext_flash_byte_read_plus	; read cns low
+    movff       temp1,lo
+    call		ext_flash_byte_read_plus	; read cns high
+    movff       temp1,hi
+    output_16
+    LOG_POINT_TO    log_cns_end
+    STRCAT      "->"
+    call		ext_flash_byte_read_plus	; read CNS low
+    movff       temp1,lo
+    call		ext_flash_byte_read_plus	; read CNS high
+    movff       temp1,hi
+    output_16
+    STRCAT_PRINT	"%"
+
+    ; Average depth
+    WIN_TINY    log2_avr_column,log2_avr_row
+    STRCPY_TEXT tAVR
+    call		ext_flash_byte_read_plus	; read avr low
+    movff       temp1,lo
+    call		ext_flash_byte_read_plus	; read avr high
+    movff       temp1,hi
+    output_16dp .3
+    STRCAT_PRINT    "m"
+
+    ; Deco model
+    LOG_POINT_TO    log_decomodel
+    WIN_TINY    log2_decomodel_column,log2_decomodel_row
+    STRCPY_TEXT tDkMode
+    call		ext_flash_byte_read_plus	; read deco model
+    movff       temp1,lo
+    decfsz      temp1,F
+    bra         logbook_decomodel1
+    ; Deco model GF Version
+    STRCAT_TEXT_PRINT    tZHL16GF
+    LOG_POINT_TO    log_gf_lo
+    WIN_TINY    log2_decomodel2_column,log2_decomodel2_row
+    STRCPY_TEXT tGF_low
+    call		ext_flash_byte_read_plus            ; Read GF lo
+    movff       temp1,lo
+    output_8
+    STRCAT_PRINT	"%"
+    WIN_TINY    log2_decomodel3_column,log2_decomodel3_row
+    STRCPY_TEXT tGF_high
+    call		ext_flash_byte_read_plus            ; Read GF hi
+    movff       temp1,lo
+    output_8
+    STRCAT_PRINT	"%"
+    bra         logbook_decomodel2
+logbook_decomodel1:
+    ; Deco model NON-GF Version
+    STRCAT_TEXT_PRINT    tZHL16
+    LOG_POINT_TO    log_sat_mult
+    WIN_TINY    log2_decomodel2_column,log2_decomodel2_row
+    STRCPY_TEXT tSaturationMult
+    call		ext_flash_byte_read_plus            ; Read sat_mult
+    movff       temp1,lo
+    output_8
+    STRCAT_PRINT	"%"
+    WIN_TINY    log2_decomodel3_column,log2_decomodel3_row
+    STRCPY_TEXT tDesaturationMult
+    call		ext_flash_byte_read_plus            ; Read desat_mult
+    movff       temp1,lo
+    output_8
+    STRCAT_PRINT	"%"
+logbook_decomodel2:
+    ; Dive mode
+    LOG_POINT_TO    log_divemode
+    WIN_TINY    log2_divemode_column,log2_divemode_row
+    STRCPY_TEXT tDvMode
+    call		ext_flash_byte_read_plus            ; Read divemode
+    movff       temp1,lo
+    call        TFT_display_decotype_surface1       ; "strcat_print"s divemode (OC, CC, APNEA or GAUGE)
+
+    ; Last deco
+    LOG_POINT_TO    log_last_stop
+    WIN_TINY    log2_lastdeco_column,log2_lastdeco_row
+    STRCPY_TEXT tLastDecostop
+    call		ext_flash_byte_read_plus            ; Read last stop
+    movff       temp1,lo
+    output_8
+    STRCAT_PRINT	"m"
+
+    ; A frame around the details
+    WIN_TINY	log2_lastdeco_column,log2_salinity_row-.16
+    WIN_COLOR   color_greenish
+    STRCPY_TEXT_PRINT   tLogbook
+    WIN_FRAME_STD   log2_salinity_row-.18, MBAR_row+.15, 0, .85    ; Top, Bottom, Left, Right
+
+    rcall       logbook_preloop_tasks       ; Clear some flags and set to Speed_eco
+display_details_loop:
+    btfsc		switch_left					; SET/MENU?
+	goto		display_profile2            ; Show the profile view again
+    btfsc		switch_right				; ENTER?
+	bra			exit_profileview			; back to list
+    rcall       log_screendump_and_onesecond    ; Check if we need to make a screenshot and check for new second
+	btfsc		sleepmode					; Timeout?
+	bra			exit_profileview			; back to list
+
+	bra			display_details_loop        ; wait for something to do
+
+    global  logbook_preloop_tasks
+logbook_preloop_tasks:
+	movlw       CCP1CON_VALUE               ; See ostc3.inc
+	movwf       CCP1CON                     ; Power-on backlight
+	call		TFT_standard_color
+	bcf			sleepmode					; clear some flags
+	bcf			switch_right
+	bcf			switch_left
+	clrf		timeout_counter2
+	call    	speed_normal
+    return
+
+log_show_sp_common:
+    lfsr		FSR2,buffer
+	call		ext_flash_byte_read_plus					; Read setpoint
+    movff       temp1,lo
+   	clrf        hi
+    bsf         leftbind
+    output_16dp d'3'
+    bcf         leftbind
+    STRCAT_TEXT tbar
+    PUTC        " "
+    call		ext_flash_byte_read_plus					; change depth
+    movff		temp1,lo
+
+	TSTOSS	opt_units               ; 0=Meters, 1=Feets
+	bra		log_show_sp_common_metric
+    movf    lo,W
+    mullw   .100                    ; convert meters to mbar
+    movff   PRODL,lo
+    movff   PRODH,hi
+	call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+    output_16
+    STRCAT_TEXT	 tFeets				; "ft"
+    bra     log_show_sp_common_common
+log_show_sp_common_metric:
+    output_8
+    STRCAT_TEXT	tMeters				; "m"
+log_show_sp_common_common:
+	STRCAT_PRINT	""
+    return
+
+log_show_gas_common2:   ; as log_show_gas_common but with change depth
+	lfsr		FSR2,buffer
+	call		ext_flash_byte_read_plus					; current O2
+	movff		temp1,lo
+	call		ext_flash_byte_read_plus					; current He
+	movff		temp1,hi
+    call		customview_show_mix                         ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+	call		ext_flash_byte_read_plus					; change depth
+    movff		temp1,lo
+
+	TSTOSS	opt_units               ; 0=Meters, 1=Feets
+	bra		log_show_gas_common2_metric
+    movf    lo,W
+    mullw   .100                    ; convert meters to mbar
+    movff   PRODL,lo
+    movff   PRODH,hi
+	call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+    output_16
+    STRCAT_TEXT	 tFeets				; "ft"
+    bra     log_show_gas_common2_common
+log_show_gas_common2_metric:
+    output_8
+    STRCAT_TEXT	tMeters				; "m"
+log_show_gas_common2_common:
+	bcf		leftbind
+    call	ext_flash_byte_read_plus	; Gas Type
+	STRCAT_PRINT	""
+    return
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/logbook.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,12 @@
+;=============================================================================
+;
+;   File logbook.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-11-12 : [mH] moving from OSTC code
+
+	extern	logbook
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/math.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,325 @@
+;=============================================================================
+;
+;   File math.asm
+;
+;   Math subroutines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-03 : [mH] moving from OSTC code
+
+
+#include    "ostc3.inc"                  ; Mandatory header
+
+basic   CODE
+;=============================================================================
+	global	convert_time
+convert_time:							; converts hi:lo in minutes to hours (hi) and minutes (lo)
+	movff	lo,xA+0						; divide by 60...
+	movff	hi,xA+1						; 
+	movlw	d'60'						; 
+	movwf	xB+0						; 
+	clrf	xB+1						; 
+	rcall	div16x16					; xA/xB=xC with xA as remainder
+	movff	xC+0,hi						; Hours
+	movff	xA+0,lo						; =remaining minutes (0.....59)
+	return
+
+	global	div16
+div16:
+; divA=divA/2^divB (divB: 8Bit only!)
+	bcf		STATUS,C
+	rrcf	divA+1
+	rrcf	divA+0
+	decfsz	divB
+	bra		div16
+	return
+
+	global	sub16
+sub16:
+;  sub_c = sub_a - sub_b (with signed values)
+	bcf		neg_flag
+	movf   	sub_b+0, W             	; Get Value to be subtracted
+	subwf  	sub_a+0, W             	; Do the High Byte
+	movwf  	sub_c+0
+	movf   	sub_b+1, W              ; Get the Value to be Subbed
+	subwfb 	sub_a+1, W
+	movwf  	sub_c+1
+
+	btfss	STATUS,N                ; Negativ result ?
+	return							; NO: result positive done.
+
+	bsf		neg_flag				; MARK result negative
+
+    comf    sub_c+1                 ; 16bit sign change.
+    negf    sub_c+0
+    btfsc   STATUS,C                ; Carry to propagate ?
+    incf    sub_c+1,F               ; YES: do it.
+
+    return        
+
+	global	subU16
+subU16:
+;  sub_c = sub_a - sub_b (with UNSIGNED values)
+	bcf		neg_flag
+	movf   	sub_b+0, W             	; Get Value to be subtracted
+	subwf  	sub_a+0, W             	; Do the High Byte
+	movwf  	sub_c+0
+	movf   	sub_b+1, W              ; Get the Value to be Subbed
+	subwfb 	sub_a+1, W
+	movwf  	sub_c+1
+	btfsc	STATUS,C                ; Borrow to propagate ? (B == /CARRY)
+	return							; NO: result positive done.
+	bsf		neg_flag				; MARK result negative
+    comf    sub_c+1                 ; 16bit sign change.
+    negf    sub_c+0
+    btfsc   STATUS,C                ; Carry to propagate ?
+    incf    sub_c+1,F               ; YES: do it.
+    return        
+
+	global	mult16x16
+mult16x16:		;xA*xB=xC
+	clrf    xC+2        	  ;  Clear the High-Order Bits
+	clrf    xC+3
+	movf    xA, w               ;  Do the "L" Multiplication first
+	mulwf   xB
+	movf    PRODL, w            ;  Save result
+	movwf   xC
+	movf    PRODH, w
+	movwf   xC+1
+	movf    xA, w               ;  Do the "I" Multiplication
+	mulwf   xB+1
+	movf    PRODL, w            ;  Save the Most Significant Byte First
+	addwf   xC+1, f
+	movf    PRODH, w
+	addwfc  xC+2, f    	 		 ;  Add to the Last Result
+	movf    xA+1, w               ;  Do the "O" Multiplication
+	mulwf   xB
+	movf    PRODL, w            ;  Add the Lower Byte Next
+	addwf   xC+1, f
+	movf    PRODH, w            ;  Add the High Byte First
+	addwfc  xC+2, f
+	btfsc   STATUS, C           ;  Add the Carry
+	incf    xC+3, f
+	movf    xA+1, w               ;  Do the "F" Multiplication
+	mulwf   xB+1
+	movf    PRODL, w
+	addwf   xC+2, f
+	movf    PRODH, w
+	addwfc  xC+3, f
+	return
+
+	global	div16x16
+div16x16:						;xA/xB=xC with xA+0 as remainder 	
+								;uses divB as temp variable
+		clrf	xC+0
+		clrf	xC+1
+        MOVF    xB+0,W       	; Check for zero
+        IORWF   xB+1,W     		; 
+        BTFSC   STATUS,Z        ; Check for zero
+        RETLW   H'FF'           ; return 0xFF if illegal
+        MOVLW   1               ; Start count at 1
+        MOVWF   divB	       ; Clear Count
+div16x16_1:
+    	BTFSC   xB+1,7     		; High bit set ?
+        bra	    div16x16_2      ; Yes then continue
+        INCF    divB,F     		; Increment count
+
+		bcf		STATUS,C
+		rlcf	xB+0,F
+		rlcf	xB+1,F
+        bra	    div16x16_1
+div16x16_2:
+								; Shift result left
+		bcf		STATUS,C
+		rlcf	xC+0,F
+		rlcf	xC+1,F
+
+ 			; Reduce Divisor		
+
+        MOVF    xB,W         ; Get low byte of subtrahend
+        SUBWF   xA,F         ; Subtract DST(low) - SRC(low)
+        MOVF    xB+1,W       ; Now get high byte of subtrahend
+        BTFSS   STATUS,C     ; If there was a borrow, rather than
+        INCF    xB+1,W       ; decrement high byte of dst we inc src
+        SUBWF   xA+1,F       ; Subtract the high byte and we're done
+
+
+        BTFSC   STATUS, C       ; Did it reduce?        
+        bra	    div16x16_3      ; No, so it was less than
+
+		movf	xB+0,W			; Reverse subtraction
+		addwf	xA+0,F
+		movf	xB+1,W
+		addwfc	xA+1,F
+
+        bra	    div16x16_4      ; Continue the process
+div16x16_3:
+	     BSF     xC+0,0        	; Yes it did, this gets a 1 bit
+div16x16_4:
+	     DECF    divB,F 		    ; Decrement N_COUNT
+        BTFSC   STATUS,Z        ; If its not zero then continue
+        return
+
+		bcf		STATUS,C
+		rrcf	xB+1,F
+		rrcf	xB+0,F
+
+        bra    div16x16_2              ; Next bit.
+
+	global	div32x16
+div32x16:  ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	; Setup
+	movlw		.32		; setup shift counter
+	movwf		divB
+	movff		xC+3,xA+1		; move ACCb to ACCf
+	movff		xC+2,xA+0
+	movff		xC+1,sub_a+1	; move ACCc to ACCe
+	movff		xC+0,sub_a+0
+	clrf		xC+3
+	clrf		xC+2
+	clrf		xC+1
+	clrf		xC+0
+	clrf		sub_b+1
+	clrf		sub_b+0
+div32x16_2:
+	bcf			STATUS,C
+	rlcf		sub_a+0,F
+	rlcf		sub_a+1,F
+	rlcf		xA+0,F
+	rlcf		xA+1,F
+	rlcf		sub_b+0,F
+	rlcf		sub_b+1,F
+	movf		xB+1,W
+	subwf		sub_b+1,W	; check if a>d
+	btfss		STATUS,Z
+	bra			div32x16_3
+	movf		xB+0,W
+	subwf		sub_b+0,W	; if msb equal then check lsb
+div32x16_3:
+	btfss		STATUS,C	; carry set if d>a
+	bra			div32x16_4
+	movf		xB+0,W		; d-a into d
+	subwf		sub_b+0,F
+	btfss		STATUS,C
+	decf		sub_b+1,F
+	movf		xB+1,W
+	subwf		sub_b+1,F
+	bsf			STATUS,C	; shift a 1 into b (result)
+div32x16_4:
+	rlcf		xC+0,F
+	rlcf		xC+1,F
+	rlcf		xC+2,F
+	rlcf		xC+3,F
+	decfsz		divB,F	; loop until all bits checked
+	bra			div32x16_2
+	return
+
+;;=============================================================================
+;; u16 * u16 --> 32bit multiply (xA * xB --> xC)
+;; Used in interupt service routines, to compute temperature and pressure.
+;;
+;	global	isr_mult16x16
+;isr_mult16x16:
+;	clrf    isr_xC+2        	  ;  Clear the High-Order Bits
+;	clrf    isr_xC+3
+;	movf    isr_xA, w               ;  Do the "L" Multiplication first
+;	mulwf   isr_xB
+;	movf    PRODL, w            ;  Save result
+;	movwf   isr_xC+0
+;	movf    PRODH, w
+;	movwf   isr_xC+1
+;	movf    isr_xA+0, w               ;  Do the "I" Multiplication
+;	mulwf   isr_xB+1
+;	movf    PRODL, w            ;  Save the Most Significant Byte First
+;	addwf   isr_xC+1, f
+;	movf    PRODH, w
+;	addwfc  isr_xC+2, f    	 		 ;  Add to the Last Result
+;	movf    isr_xA+1, w               ;  Do the "O" Multiplication
+;	mulwf   isr_xB
+;	movf    PRODL, w            ;  Add the Lower Byte Next
+;	addwf   isr_xC+1, f
+;	movf    PRODH, w            ;  Add the High Byte First
+;	addwfc  isr_xC+2, f
+;	btfsc   STATUS, C           ;  Add the Carry
+;	incf    isr_xC+3, f
+;	movf    isr_xA+1, w               ;  Do the "F" Multiplication
+;	mulwf   isr_xB+1
+;	movf    PRODL, w
+;	addwf   isr_xC+2, f
+;	movf    PRODH, w
+;	addwfc  isr_xC+3, f
+;	return
+
+;=============================================================================
+; 24bit shift, repeted WREG times.
+; Because we shift less than 8bits, and keep only C[2:1], we don't care what
+; bit is inserted...
+;
+	global	isr_shift_C31
+isr_shift_C31:
+	rrcf    isr_xC+3,F                  ; Shift the three bytes...
+	rrcf    isr_xC+2,F
+	rrcf    isr_xC+1,F
+	decfsz  WREG
+	bra     isr_shift_C31
+	return
+
+;=============================================================================
+; s16 * s16 --> 32bit multiply (xA * xB --> xC)
+; Signed multiplication.
+; Code from... the Pic18F documentation ;-)
+	global	isr_unsigned_mult16x16
+isr_unsigned_mult16x16:
+        MOVF    isr_xA+0, W             ; Lowest is simply a[0] * b[0]
+        MULWF   isr_xB+0
+        MOVFF   PRODL, isr_xC+0
+        MOVFF   PRODH, isr_xC+1
+        ;
+        MOVF    isr_xA+1, W             ; And highest a[1] * b[1]
+        MULWF   isr_xB+1
+        MOVFF   PRODL, isr_xC+2
+        MOVFF   PRODH, isr_xC+3
+        ;
+        MOVF    isr_xA+0, W             ; Intermediates do propagate:
+        MULWF   isr_xB+1
+        MOVF    PRODL, W
+        ADDWF   isr_xC+1, F             ; Add cross products
+        MOVF    PRODH, W
+        ADDWFC  isr_xC+2, F             ; with propagated carry
+        CLRF    WREG
+        ADDWFC  isr_xC+3, F             ; on the three bytes.
+        ;
+        MOVF    isr_xA+1, W             ; And the second one, similarly.
+        MULWF   isr_xB+0
+        MOVF    PRODL, W
+        ADDWF   isr_xC+1, F             ; Add cross products
+        MOVF    PRODH, W
+        ADDWFC  isr_xC+2, F
+        CLRF    WREG
+        ADDWFC  isr_xC+3, F
+        return
+
+	global	isr_signed_mult16x16
+isr_signed_mult16x16:
+        rcall   isr_unsigned_mult16x16
+
+        ; Manage sign extension of operand B
+        BTFSS   isr_xB+1,7              ; Is B negatif ?
+        BRA     isr_signed_mult_checkA  ; No: check ARG1
+        MOVF    isr_xA+0, W             ; Yes: add -65536 * A
+        SUBWF   isr_xC+2, F
+        MOVF    isr_xA+1, W
+        SUBWFB  isr_xC+3, F
+        ; And of operand A
+isr_signed_mult_checkA
+        BTFSS   isr_xA+1, 7             ; Is A negatif ?
+        RETURN                          ; No: done
+        MOVF    isr_xB+0, W
+        SUBWF   isr_xC+2, F
+        MOVF    isr_xB+1, W
+        SUBWFB  isr_xC+3, F
+        RETURN
+
+ END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/math.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,21 @@
+;=============================================================================
+;
+;   File math.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-03 : [mH] moving from OSTC code
+
+	extern	convert_time
+	extern	div16
+	extern	sub16
+	extern	subU16
+	extern	mult16x16
+	extern	div16x16
+	extern	div32x16
+;	extern	isr_mult16x16
+	extern	isr_shift_C31
+	extern	isr_unsigned_mult16x16
+	extern	isr_signed_mult16x16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mcp.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,270 @@
+;=============================================================================
+;
+;   File mcp.asm
+;
+;   Basic routines for RX circuity
+;
+;   Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2012-08-12 : [mH] Creation
+
+
+#include "ostc3.inc"
+#include "wait.inc"
+
+mcp_writebyte_1st macro char
+	movlw 		char
+	rcall		mcp_write_one_byte
+	endm
+
+mcp_writebyte_2nd macro char
+	movlw 		char
+	rcall		mcp_write_one_byte2
+	endm
+
+	; Writes mcp_temp+0 to config reg
+mcp_write_config macro	char
+	movlw		char
+	rcall		mcp_write_config_reg
+	endm
+
+mcp code
+
+mcp_write_one_byte:
+	movwf		mcp_temp+0				; save one byte
+	bcf			TRISG,0					; CLK output
+	nop
+	bcf			mcp_clk					; clk=0
+	bsf			mcp_ncs					; cs=1
+	nop
+	bcf			mcp_ncs					; cs=0
+	bcf			TRISB,3					; mcp_lf_data output
+	movlw		.8
+	movwf		mcp_temp+1				; Bit counter
+mcp_write_one_byte_loop:
+	btfss		mcp_temp+0,7
+	bcf			mcp_lf_data
+	btfsc		mcp_temp+0,7
+	bsf			mcp_lf_data
+	bsf			mcp_clk					; clk=1
+	rlncf		mcp_temp+0,F			; shift byte left no carry
+	bcf			mcp_clk					; clk=0
+	decfsz		mcp_temp+1,F			; 8Bit done?
+	bra			mcp_write_one_byte_loop	; Not yet...
+	return
+
+mcp_write_one_byte2:
+	movwf		mcp_temp+0				; save one byte
+	movlw		.8
+	movwf		mcp_temp+1				; Bit counter
+mcp_write_one_byte_loop2:
+	btfss		mcp_temp+0,7
+	bcf			mcp_lf_data
+	btfsc		mcp_temp+0,7
+	bsf			mcp_lf_data
+	bsf			mcp_clk					; clk=1
+	rlncf		mcp_temp+0,F			; shift byte left no carry
+	bcf			mcp_clk					; clk=0
+	decfsz		mcp_temp+1,F			; 8Bit done?
+	bra			mcp_write_one_byte_loop2; Not yet...
+	bsf			TRISB,3					; mcp_lf_data input again
+	bsf			mcp_ncs					; cs=1
+	bsf			TRISG,0					; CLK input
+	return
+
+mcp_readbyte:
+	bcf			TRISG,0					; CLK output
+	nop
+	bcf			mcp_clk					; clk=0
+	bcf			mcp_ncs					; cs=0
+	movlw		.7
+	movwf		mcp_temp+1				; Bit counter
+	nop
+	nop
+mcp_readloop:
+	bsf			mcp_clk					; clk=1
+	bcf			mcp_clk					; clk=0
+	decfsz		mcp_temp+1,F			; 7 Bit done?
+	bra			mcp_readloop			; Not yet...
+
+	movlw		.8
+	movwf		mcp_temp+1				; Bit counter
+mcp_readloop2:
+	bsf			mcp_clk					; clk=1
+	bcf			mcp_clk					; clk=0
+	btfss		mcp_lf_data
+	bcf			mcp_temp+0,7
+	btfsc		mcp_lf_data
+	bsf			mcp_temp+0,7
+	rlncf		mcp_temp+0				; MSB first
+	decfsz		mcp_temp+1,F			; 8 Bit done?
+	bra			mcp_readloop2			; Not yet...
+
+; Dummy clk for parity bit
+	bsf			mcp_clk					; clk=1
+	nop
+	bcf			mcp_clk					; clk=0
+	bsf			mcp_ncs					; cs=1
+	bsf			TRISG,0					; CLK input
+	return
+
+mcp_write_config_reg:					; Writes mcp_temp+0 to config #WREG
+	movwf		mcp_temp+2				; Save config#
+	bcf			TRISG,0					; CLK output
+	clrf		mcp_temp+3				; for parity
+	bcf			mcp_clk					; clk=0
+	bsf			mcp_ncs					; cs=1
+	nop
+	bcf			mcp_ncs					; cs=0
+	bcf			TRISB,3					; mcp_lf_data output
+	bsf			mcp_lf_data
+	bsf			mcp_clk					; clk=1
+	bcf			mcp_clk					; clk=0
+	bsf			mcp_clk					; clk=1
+	bcf			mcp_clk					; clk=0
+	bsf			mcp_clk					; clk=1
+	bcf			mcp_clk					; clk=0			; Write command done.
+
+	; Now, 4Bit register address
+	movlw		.4
+	movwf		mcp_temp+1				; Bit counter
+mcp_write_config_reg1:
+	btfss		mcp_temp+2,3
+	bcf			mcp_lf_data
+	btfsc		mcp_temp+2,3
+	bsf			mcp_lf_data
+	bsf			mcp_clk					; clk=1
+	rlncf		mcp_temp+2,F			; shift byte left no carry
+	bcf			mcp_clk					; clk=0
+	decfsz		mcp_temp+1,F			; 4Bit done?
+	bra			mcp_write_config_reg1		; Not yet...
+
+	; 8Bit data
+	movlw		.8
+	movwf		mcp_temp+1				; Bit counter
+mcp_write_config_reg2:
+	btfss		mcp_temp+0,7
+	bcf			mcp_lf_data
+	btfsc		mcp_temp+0,7
+	bsf			mcp_lf_data
+	btfsc		mcp_temp+0,7
+	incf		mcp_temp+3,F			; count 1's...
+	bsf			mcp_clk					; clk=1
+	rlncf		mcp_temp+0,F			; shift byte left no carry
+	bcf			mcp_clk					; clk=0
+	decfsz		mcp_temp+1,F			; 8Bit done?
+	bra			mcp_write_config_reg2		; Not yet...
+
+	; 1bit parity
+	btfss		mcp_temp+3,0
+	bsf			mcp_lf_data				; Set row parity bit
+	btfsc		mcp_temp+3,0
+	bcf			mcp_lf_data				; clear row parity bit
+	bsf			mcp_clk					; clk=1
+	bcf			mcp_clk					; clk=0			; Parity bit done.
+
+	bsf			TRISB,3					; mcp_lf_data input again
+	bsf			mcp_ncs					; cs=1
+	bsf			TRISG,0					; CLK input
+	return
+
+    global  mcp_reset
+mcp_reset:                              ; reset RX chip# (Normal mode)
+; Make sure row parity bit is correct
+; yyyaaaa01234567P
+; yyy: Command
+; aaaa: Address
+; 0-7: Data
+; P: Parity bit. Set/Clear that 0-7+P are odd number of ones
+; Current config:
+	banksel	buffer
+	movlw	b'10100100'			; Config0: LCZ disabled, Wakeup => High = 2ms, Low = 2ms
+	movwf	buffer+0
+    movlw	b'00000000'			; Config1: +20pF LCX Normal mode
+;    movlw	b'01000000'			; Config1: +20pF LCX carrier out mode
+	movwf	buffer+1
+ 	movlw	b'00000000'         ; Config2: +25pF LCY
+	movwf	buffer+2
+	movlw	b'00000000'			; Config3
+	movwf	buffer+3
+	movlw	b'00000000'			; Config4
+	movwf	buffer+4
+;	movlw	b'00001111'			; Config5 33%
+;	movlw	b'00101111'			; Config5 14%
+	movlw	b'10011111'			; Config5 60%
+	movwf	buffer+5
+    bra     mcp_reset_common
+
+    global  mcp_reset_rssi
+mcp_reset_rssi:							; reset RX chip# for RSSI mode
+; Make sure row parity bit is correct
+; yyyaaaa01234567P
+; yyy: Command
+; aaaa: Address
+; 0-7: Data
+; P: Parity bit. Set/Clear that 0-7+P are odd number of ones
+; Current config:
+	banksel	buffer
+	movlw	b'10101000'			; Config0: LCZ disabled, Wakeup => High = 2ms, Low = 2ms
+	movwf	buffer+0
+    movlw	b'10000000'			; Config1: +20pF LCX and RSSI Mode
+	movwf	buffer+1
+	movlw	b'00000000'			; Config2: +25pF LCY
+	movwf	buffer+2
+	movlw	b'00000000'			; Config3
+	movwf	buffer+3
+	movlw	b'00000000'			; Config4
+	movwf	buffer+4
+	movlw	b'11010000'			; Config5 60%
+	movwf	buffer+5
+mcp_reset_common:
+    banksel TRISB
+    bcf     TRISB,2
+    bcf     mcp_ncs             ; CS=1
+    nop
+    bsf     mcp_power           ; Power-up
+    nop
+    btfss   mcp_power
+    bra     mcp_reset_common
+    WAITMS .10
+; Compute column parity byte
+    banksel buffer
+	movf	buffer+0,W
+	xorwf	buffer+1,W
+	xorwf	buffer+2,W
+	xorwf	buffer+3,W
+	xorwf	buffer+4,W
+	xorwf	buffer+5,W
+	xorlw	0xFF
+	movwf	buffer+6			; <- Column parity byte
+	banksel mcp_temp+0
+
+	mcp_writebyte_1st	b'10100000'	; Reset Command
+	mcp_writebyte_2nd	b'00000000'	; Dummy byte
+
+	mcp_writebyte_1st	b'00100000'	; Clamp off
+	mcp_writebyte_2nd	b'00000000'	; Dummy byte
+
+	movff	buffer+0,mcp_temp+0		; Data byte
+	mcp_write_config	.0
+	movff	buffer+1,mcp_temp+0		; Data byte
+	mcp_write_config	.1
+	movff	buffer+2,mcp_temp+0		; Data byte
+	mcp_write_config	.2
+	movff	buffer+3,mcp_temp+0		; Data byte
+	mcp_write_config	.3
+	movff	buffer+4,mcp_temp+0		; Data byte
+	mcp_write_config	.4
+	movff	buffer+5,mcp_temp+0		; Data byte
+	mcp_write_config	.5
+	movff	buffer+6,mcp_temp+0		; Data byte (Column parity byte)
+	mcp_write_config	.6
+
+;	mcp_writebyte_1st	b'11000000'	; Read from Config0
+;	mcp_writebyte_2nd	b'00000000'	; Dummy clks + Odd Parity Bit (Bit0)
+;	call	mcp_readbyte			; read into mcp_temp+0
+	return
+
+
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mcp.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,13 @@
+;=============================================================================
+;
+;   File mcp.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2012-09-03 : [mH] creation
+
+ extern  mcp_reset_rssi          ; Setup RX for RSSI mode
+ extern  mcp_reset               ; Setup RX (Normal mode)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/menu_processor.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,567 @@
+;=============================================================================
+;
+;   File menu_processor.asm
+;
+;   Routines to handle all OSTC3 graphic/text menus.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2012-11-02 : [jDG] Cleanup for OSTC3: removed icons. Added scrolling.
+;                      But need a font with lower/upper alpha chars...
+
+#include "convert.inc"
+#include "ostc3.inc"
+#include "strings.inc"
+#include "tft.inc"
+#include "varargs.inc"
+#include "wait.inc"
+#include "start.inc"
+#include "surfmode.inc"
+#include "divemode.inc"
+#include "tft_outputs.inc"
+#include "eeprom_rs232.inc"
+
+;NOTE: should be idenric in .inc and .asm !
+#define MENU_LINES_MAX  .7              ; Number of lines per screen?
+#define MENU_TITLE_FONT WIN_STD         ; Font should contains lower/UPPER alpha
+#define MENU_LINE_FONT  WIN_SMALL       ; Font should contains lower/UPPER alpha
+#define MENU_LEFT       .20             ; Position of first menu item
+#define MENU_HEIGHT     .27             ; Spacing between menu lines.
+#define MENU_VCENTER    .125            ; Position on screen.
+#define MENU_LINE_MAX_LENGTH    .20     ; Length in characters
+
+; Other needed references
+    extern  aa_wordprocessor,option_inc,option_draw,comm_mode
+
+
+;=============================================================================
+; Temporary data.
+
+        CBLOCK  tmp+0x20                ; Reserved space for options.asm
+            menu_flags                  ; Various flags for menu:
+                                        ;   bit 0 :dynamic menu
+            menu_item                   ; Index of the current item.
+            start_item                  ; Index of the first item (scrolling)
+            item_max                    ; Number of items in menu.
+            selected_item               ; Index of the current item.
+            value_type                  ; Type for vertical menu.
+            dynamic_item:3              ; Callback addr
+            menu_block:3                ; Address of the menu block (ie. item 0)
+            menu_title:3                ; text or proc for dynamic menu.
+            menu_center                 ; centering for line menu.
+            proc_item:3                 ; Address of the current proc.
+            text_item:2                 ; Address of the current text.
+        ; Reserved to tmp+0x35
+        ENDC
+
+#define option_item proc_item
+
+basic       CODE
+;=============================================================================
+; menu handler.
+;
+; Input:    TBLPTR = addr of menu block.
+        global  menu_processor
+menu_processor:
+        banksel common                  ; Bank1
+        btfss   divemode                ; Not in divemode
+        call    speed_fastest           ; Make it quick !
+		
+		;---- Read menu block ------------------------------------------------
+        VARARGS_BEGIN                   ; Read inline PROM data
+		clrf	STKPTR                  ; Never return, anyway...
+        VARARGS_GET8    item_max        ; Get number of items
+        VARARGS_GET8    menu_flags      ; Get flags
+        VARARGS_GET24   menu_title      ; Get pointer to menu title
+        VARARGS_GET8    menu_center     ; Vertical position
+        movff   TBLPTRL, menu_block+0   ; Save base address for menu_read_item
+        movff   TBLPTRH, menu_block+1
+        movff   TBLPTRU, menu_block+2
+
+    extern  TFT_clear_divemode_menu
+        btfss   divemode                ; In divemode?
+        bra     menu_processor0         ; No
+
+        movlw   .1
+        cpfsgt  menupos                 ; only if menupos=1...
+        call    TFT_clear_divemode_menu ; ... Clear the menu!
+        bra     menu_processor1         ; Yes, skip some lines here
+
+menu_processor0:
+        ;---- draw menu title ------------------------------------------------
+		clrf	CCP1CON					; stop PWM
+		bcf		PORTC,2					; Pull PWM out to GND
+		call    TFT_ClearScreen
+        rcall   menu_processor_title
+
+        ;---- Draw bottomline ------------------------------------------------
+        TEXT_TINY 	.5,       .240-.16, tNext
+        TEXT_TINY	.160-6*5, .240-.16, tEnter
+
+menu_processor1:
+		movlw	FT_SMALL
+        movff	WREG, win_font    
+        
+        ;---- Select menu type -----------------------------------------------
+        bra     menu_vertical
+
+;=============================================================================
+; (re-)draw menu title.
+;
+menu_processor_title:        
+        btfss   menu_flags,0            ; Static or dynmic title ?
+        bra     menu_processor_static_title
+
+        lfsr    FSR2,buffer
+        rcall   menu_processor_call_title ; add gas, detail and color.
+        bra     menu_processor_title_1
+
+menu_processor_static_title:                
+        movff   menu_title+0,FSR1L      ; Just copy string.
+        movff   menu_title+1,FSR1H
+        call    strcpy_text
+
+menu_processor_title_1:
+        WIN_BOX_BLACK  .2,.23,.0,.160	; Clear Menu title
+        MENU_TITLE_FONT	.0, .2        	; Menu title positionning
+        WIN_COLOR   color_greenish
+        movf    FSR2L,W                 ; Get title length
+        mullw   .9                      ; Convert to half pixels
+		bcf		STATUS,C				; Clear carry
+		rrcf	PRODL					; /2
+        movf    PRODL,W                 ; Back to WREG
+        sublw   .80                    	; 80 - width
+        movwf   win_leftx2              ; Aligned to center.
+        
+        call    aa_wordprocessor
+        TFT_STD_COLOR
+        return
+
+;=============================================================================
+; Call dynamic proc for menu title:
+
+menu_processor_call_title:
+        movff   menu_title+2,PCLATU     ; Just execute computed goto.
+        movff   menu_title+1,PCLATH
+        movf    menu_title+0,W
+        movwf   PCL
+        
+;=============================================================================
+; Restart with first icon/line selected.
+        global  menu_processor_reset
+menu_processor_reset:
+        banksel common
+        lfsr    FSR2,menustack
+        clrf    POSTINC2
+        clrf    POSTINC2
+        clrf    POSTINC2
+        clrf    POSTINC2
+        clrf    POSTINC2
+        clrf    selected_item
+        return
+
+        global  menu_processor_pop
+menu_processor_pop:
+        movff   menustack+0,selected_item
+        movff   menustack+1,menustack+0
+        movff   menustack+2,menustack+1
+        movff   menustack+3,menustack+2
+        movff   menustack+4,menustack+3
+        return
+
+menu_processor_push:
+        movff   menustack+3,menustack+4
+        movff   menustack+2,menustack+3
+        movff   menustack+1,menustack+2
+        movff   menustack+0,menustack+1
+        movff   selected_item,menustack+0
+        clrf    selected_item
+        return
+
+;---- Execute menu selection -------------------------------------------------
+do_menu_item:
+        bcf     switch_right            ; Avoid loops.
+        call    speed_normal            ; Back to normal speed.
+        
+        movf    selected_item,W         ; Reread proc address from table.
+        rcall   menu_read_item          ; (destroy PROD)
+    
+        movff   selected_item,PRODL     ; Pass along selected line
+    
+        rcall   menu_processor_push     ; Remember where we get from. (clears selected_item)
+    
+        movff   proc_item+2,PCLATU      ; Then execute computed goto.
+        movff   proc_item+1,PCLATH
+        movf    proc_item+0,W
+        movwf   PCL
+
+;=============================================================================
+; Get current item from table.
+;
+; Input : Item number in WREG, menu_block.
+;
+; Output: icon_large, text_item, proc_item 16bits pointers.
+;
+; Trashed: PROD, WREG
+menu_read_item:
+        mullw   .10                     ; 10 bytes per item.
+        movf    PRODL,W                 ; Then do a 24bits add
+        addwf   menu_block+0,W          ; with menu_block, and
+        movwf   TBLPTRL                 ; setup TBLPTR
+        movf    PRODH,W
+        addwfc  menu_block+1,W
+        movwf   TBLPTRH
+        movlw   0
+        addwfc  menu_block+2,W
+        movwf   TBLPTRU
+
+        VARARGS_GET8    value_type      ; Read 10 bytes of item data
+        VARARGS_GET24   dynamic_item
+        VARARGS_GET24   proc_item
+        VARARGS_GET8    WREG            ; Skip dummy byte
+        VARARGS_GET16   text_item
+
+        return
+
+;=============================================================================
+; Vertical menu : set of line/value to choose from.
+; Entry point to update lines already shown.
+;
+        global   menu_vertical
+menu_vertical:
+        btfss   divemode                ; Not in divemode
+		clrf	timeout_counter2		; Reset timeout
+
+menu_vertical_2:
+        rcall   menu_draw_lines			; Always re-draw whole menu
+
+		movlw	CCP1CON_VALUE			; See ostc3.inc
+        btfss   divemode                ; Not in divemode
+		movwf	CCP1CON                 ; Power-on backlight
+
+menu_vertical_1:
+        movf    selected_item,W         ; Get current item data
+        rcall   menu_read_item
+        movf    proc_item+0,W           ; Check if pro address is NULL ?
+        iorwf   proc_item+1,W
+        bz      next_line_menu          ; YES: not selectable !
+
+        btfss   divemode                ; Not in divemode
+        rcall   menu_draw_selected_line
+
+		extern	rtc_set_rtc
+		btfss	settime_setdate			; In the Set Time or Set Date menu?
+		bra		menu_line_loop_pre2		; no, skip all following
+		
+		movff	month,lo		; new month
+		dcfsnz	lo,F
+		movlw	.31
+		dcfsnz	lo,F
+		movlw	.28
+		dcfsnz	lo,F
+		movlw	.31
+		dcfsnz	lo,F
+		movlw	.30
+		dcfsnz	lo,F
+		movlw	.31
+		dcfsnz	lo,F
+		movlw	.30
+		dcfsnz	lo,F
+		movlw	.31
+		dcfsnz	lo,F
+		movlw	.31
+		dcfsnz	lo,F
+		movlw	.30
+		dcfsnz	lo,F
+		movlw	.31
+		dcfsnz	lo,F
+		movlw	.30
+		dcfsnz	lo,F
+		movlw	.31
+		cpfsgt	day						; day ok?
+		bra		menu_line_loop_pre1		; OK!
+		movlw	.1						; not OK, set to 1st
+		movwf	day
+
+menu_line_loop_pre1:
+		btfsc	switch_right			; Enter pressed?
+		call	rtc_set_rtc				; Yes, update mins,sec,hours,day,month and year to rtc module
+		call	TFT_show_time_date_menu	; Update clock
+
+menu_line_loop_pre2:
+        bcf     switch_right
+        bcf     switch_left
+        btfss   divemode                ; Not in Divemode
+        call    speed_normal
+
+menu_line_loop_pre3:
+    extern  divemode_option0_return
+        btfsc   divemode                ; In divemode?
+        goto    divemode_option0_return ; Yes, return to it
+
+menu_line_loop:
+        btfsc   switch_right
+        bra     do_line_menu            ; Type dependent
+        btfsc   switch_left
+        bra     next_line_menu
+
+		btfss	onesecupdate			; New second
+		bra		menu_line_loop2			; not yet...
+
+		call	timeout_surfmode		; timeout
+		call	set_dive_modes			; check, if divemode must be entered
+		
+		btfsc	settime_setdate			; In the Set Time or Set Date menu?
+		call	TFT_show_time_date_menu	; Yes, update clock
+        btfsc   menu_show_sensors       ; In the "Sensors" menu?
+        call    TFT_menu_hud            ; Yes, update HUD data
+
+		bcf		onesecupdate			; one second updates done
+
+menu_line_loop2:
+		btfsc	sleepmode				; Timeout?
+		goto	restart					; Yes, back to surfacemode
+		btfsc	divemode
+		goto	restart					; Enter Divemode if required
+
+        btfsc   enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+        bra     menu_line_loop3
+        btfsc   vusb_in                     ; USB plugged in?
+        goto    comm_mode                   ; Start COMM mode
+        bra     menu_line_loop4
+menu_line_loop3:
+        btfss   vusb_in                     ; USB (still) plugged in?
+        bcf     enable_screen_dumps         ; No, clear flag
+        call    rs232_get_byte
+        btfsc   rs232_recieve_overflow
+        bra     menu_line_loop4
+        movlw   "l"
+        cpfseq	RCREG1
+        bra     menu_line_loop4
+        call    TFT_dump_screen             ; Dump the screen contents
+menu_line_loop4:
+
+        bra     menu_line_loop
+
+;---- Move to menu's next line
+next_line_menu:
+        btfss   divemode                ; not in divemode
+        call    speed_fastest
+        bcf     switch_left             ; Avoid looping.
+
+        incf    selected_item,F         ; Select next item.
+        movf    selected_item,W         ; Index == max ?
+        cpfseq  item_max
+        bra     menu_vertical_1         ; NO: redraw cursor.
+
+        clrf    selected_item           ; YES: restart for item 0.
+        bra     menu_vertical_1         ; Then redraw cursor.
+
+        global  do_line_menu
+do_line_menu:
+        btfss   divemode                ; not in divemode
+        call    speed_fastest
+;        bcf     switch_right            ; Avoid looping.
+
+        decf    menupos,W               ; menu_processor needs 0-5...
+        btfsc   divemode                ; only in divemode
+        movwf   selected_item
+
+        movf    selected_item,W         ; Read selected descriptor
+        rcall   menu_read_item
+
+        movf    value_type,W            ; Switch on data type
+        bz      menu_do_line_call       ; CALL
+        dcfsnz  WREG
+        bra     menu_do_line_call       ; STRING: do as call
+        dcfsnz  WREG
+        bra     menu_do_line_option     ; OPTION
+        dcfsnz  WREG
+        bra     menu_do_line_call       ; DYNAMIC: do as call
+        bra     menu_line_loop_pre3     ; else do nothing...
+
+;---- CALL
+menu_do_line_call:
+        rcall   do_menu_item            ; Same as icon menu: calculated goto.
+        rcall   menu_processor_pop      ; Back to same line,
+        bra     menu_vertical           ; Then continue into menu...
+
+;---- Call option specific increment subroutine
+menu_do_line_option:
+        movff   option_item+0,FSR0L     ; Get option handle
+        movff   option_item+1,FSR0H
+        call    option_inc              ; increment
+        
+        movff   selected_item,PRODL     ; Pass selection to callback.
+        rcall   menu_text_call        
+        bra     menu_vertical_2         ; redraw all lines...
+
+;-----------------------------------------------------------------------------
+
+menu_draw_lines_divemode:
+        movlw   divemode_menu_item1_row
+        movff   WREG,win_top
+        movlw   divemode_menu_item1_column
+        movff   WREG,win_leftx2
+        clrf    start_item
+        movff   item_max,menupos4           ; Copy item_max for divemode cursor routine
+        bra     menu_draw_lines_2
+
+menu_draw_lines:
+        btfsc   divemode                    ; in divemode?
+        bra     menu_draw_lines_divemode    ; Yes
+
+        btfsc   menu_flags,0            ; Dynamic title ?
+        rcall   menu_processor_title    ; YES: redraw it then.
+
+        MENU_LINE_FONT  MENU_LEFT, 0    ; Init start position/font
+        movff   menu_center,win_top     ; computed in menu block.
+
+        ; Does the menu have more than 6 lines ?
+        movf    item_max,W
+        addlw   -(MENU_LINES_MAX+1)     ; (max - 7)
+        bnn     menu_draw_long_menu     ; bra if (max >= 7)
+
+        clrf    start_item
+        bra     menu_draw_lines_2
+
+menu_draw_long_menu:
+        movf    selected_item,W         ; Start at selected-6
+        addlw   -(MENU_LINES_MAX-1)
+        btfsc   STATUS,N                ; This is <0 ?
+        clrf    WREG                    ; YES: start from top instead.
+        movwf   start_item
+
+menu_draw_lines_2:
+        movff   start_item, menu_item
+
+menu_draw_lines_1:
+        TFT_STD_COLOR                   ; Restore color after disabled lines.
+        
+        movf    menu_item,W
+        rcall   menu_read_item
+        
+        movf    value_type,W            ; Switch on data type
+        bz      menu_draw_line_call
+        dcfsnz  WREG
+        bra     menu_draw_line_string
+        dcfsnz  WREG
+        bra     menu_draw_line_option
+        dcfsnz  WREG
+        bra     menu_draw_line_dynamic
+        bra     menu_draw_line_none
+
+menu_draw_line_string:
+        movff   text_item+0,TBLPTRL     ; Read not-translated string from PROM.
+        movff   text_item+1,TBLPTRH
+        call    strcpy_prom             ; Copy in buffer
+        bra     menu_draw_line_none
+        
+menu_draw_line_call:
+        movff   text_item+0,FSR1L       ; Read string from PROM.
+        movff   text_item+1,FSR1H
+        call    strcpy_text             ; Copy in buffer
+
+        bra     menu_draw_line_none
+        
+menu_draw_line_option:
+        movff   text_item+0,FSR1L       ; Read string from PROM.
+        movff   text_item+1,FSR1H
+        call    strcpy_text             ; Copy in buffer
+
+        movff   option_item+0,FSR0L     ; Retrieve option handle.
+        movff   option_item+1,FSR0H
+        call    option_draw
+        bra     menu_draw_line_none
+
+menu_draw_line_dynamic:
+        lfsr    FSR2,buffer
+        movff   menu_item,PRODL         ; Pass item to callback.
+        rcall   menu_text_call          ; Push return address.
+        bra     menu_draw_line_none
+
+; Computed goto to pointer inside dynamic_item:
+menu_text_call:
+        movf    dynamic_item+0,W        ; Check if callback is NULL
+        iorwf   dynamic_item+1,W
+        iorwf   dynamic_item+2,W
+        btfsc   STATUS,Z
+        return                          ; YES: don't call it.
+
+        movff   dynamic_item+2,PCLATU   ; Prepare...
+        movff   dynamic_item+1,PCLATH
+        movf    dynamic_item+0,W
+        movwf   PCL                     ; And jump !
+
+menu_draw_line_none:
+        extern  TFT_fillup_with_spaces
+
+        btfsc   divemode                        ; In divemode?
+        bra     menu_draw_line_none_divemode    ; Yes
+        
+        movlw   MENU_LINE_MAX_LENGTH
+        call    TFT_fillup_with_spaces  ; Fillup FSR2 with spaces (Total string length in #WREG)
+        clrf    WREG
+        movff   WREG,buffer+MENU_LINE_MAX_LENGTH;No   ; Make sure won't be longer than MENU_LINE_MAX_LENGTH ch
+        call    aa_wordprocessor
+        movlw   MENU_HEIGHT             ; No, Move to next line
+        addwf   win_top,F
+        incf    menu_item,F             ; inc loop counter
+
+        movf    start_item,W            ; First line (scrolled)
+        subwf   menu_item,W             ; current - first
+        xorlw   MENU_LINES_MAX          ; Already done 6 lines ?
+        btfsc   STATUS,Z
+        return                          ; YES
+menu_draw_line_none2:
+        movf    menu_item,W             ; Done item_max lines ?
+        xorwf   item_max,W
+        btfss   STATUS,Z
+        bra     menu_draw_lines_1       ; No: loop...
+        return
+
+menu_draw_line_none_divemode:
+        movlw   .10
+        call    TFT_fillup_with_spaces  ; Fillup FSR2 with spaces (Total string length in #WREG)
+        clrf    WREG
+        movff   WREG,buffer+.10
+
+        call    aa_wordprocessor        ; Draw the line!
+
+        movlw   .0
+        movff   WREG,win_invert         ; Reset invert flag
+
+        movlw   .24                     ; Divemode menu spacing
+        addwf   win_top,F
+        incf    menu_item,F             ; inc loop counter
+
+        movlw   .3
+        cpfseq  menu_item               ; At pos 4?
+        bra     menu_draw_line_none2    ; No
+
+        movlw   divemode_menu_item4_row
+        movff   WREG,win_top            ; Reset row
+        movlw   divemode_menu_item4_column
+        movff   WREG,win_leftx2         ; New column
+        bra     menu_draw_line_none2    ; Done.
+
+;-----------------------------------------------------------------------------
+; Put a mark in front of the current line
+menu_draw_selected_line:
+		clrf	timeout_counter2		; Reset timeout
+        WIN_BOX_BLACK .34,.221,MENU_LEFT-8,MENU_LEFT-2  ; Clear left column
+        
+        TFT_STD_COLOR
+        WIN_SMALL  MENU_LEFT-8, 0       ; Arrow symbol only in small font
+        movf    start_item,W            ; First line (scrolled)
+        subwf   selected_item,W         ; selected - first
+        mullw   MENU_HEIGHT             ; 30 pixel by line
+        movf    PRODL,W                 ; result
+        addwf   menu_center,W           ; added to first line
+        movwf   win_top                 ; and stored to pos.
+        STRCPY_PRINT    "\xb7"          ; print cursor
+
+        return
+
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/menu_processor.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,88 @@
+;=============================================================================
+;
+;   File menu_processor.asm
+;
+;   Routines to handle all OSTC3 graphic/text menus.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-05-30 : [jDG] Creation.
+
+    ; Restart menu-system from first icon/line:
+    extern  menu_processor_reset
+    
+    ; Recal last (automatically) saved icon/line when returning from submenu.
+    extern  menu_processor_pop
+
+    ; Rexecute the menu block
+    extern  menu_processor
+
+;=============================================================================
+; Menus parameters
+
+;NOTE: should be idenric in .inc and .asm !
+#define MENU_LINES_MAX  .7              ; Number of lines per screen?
+#define MENU_HEIGHT     .27             ; Spacing on screen.
+#define MENU_VCENTER    .125            ; Position on screen.
+
+;=============================================================================
+
+COMMON_BEGIN_MENU  MACRO    dynamic, txt, nb_items
+        local center
+        If nb_items > MENU_LINES_MAX
+center      set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX
+        Else
+center      set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items
+        Endif
+        If nb_items <= 0
+            Error "Zero items in menu ", x
+        Endif
+
+        extern  txt
+        call    menu_processor
+        ; Push 6 bytes of menu header data.
+        db      nb_items, dynamic
+        db      LOW(txt), HIGH(txt)
+        db      UPPER(txt), center
+    ENDM
+
+;=============================================================================
+; Macro to generat (and check) menu vertical menu blocks with data.
+;
+MENU_BEGIN  MACRO   menu_title, nb_items
+        COMMON_BEGIN_MENU    0, menu_title, nb_items
+    ENDM
+
+MENU_BEGIN_DYNAMIC macro title_proc, nb_items
+        COMMON_BEGIN_MENU    1, title_proc, nb_items
+    ENDM
+
+;=============================================================================
+
+; Submenu
+MENU_CALL   MACRO   txt, proc
+        extern  txt
+        db      0, 0, 0, 0
+        db      LOW(proc),  HIGH(proc), UPPER(proc),     0
+        db      LOW(txt),   HIGH(txt)
+    ENDM
+
+; Generic option menu
+MENU_OPTION MACRO   txt, option, callback
+        extern  txt
+        extern  option
+        db      2, LOW(callback), HIGH(callback), UPPER(callback)
+        db      LOW(option),HIGH(option),UPPER(option), 0
+        db      LOW(txt),   HIGH(txt)
+    ENDM
+
+MENU_DYNAMIC MACRO  callback, proc
+        extern  callback
+        db      3, LOW(callback), HIGH(callback), UPPER(callback)
+        db      LOW(proc),     HIGH(proc),      UPPER(proc),    0
+        db      0, 0
+    ENDM
+
+MENU_END    MACRO
+    ENDM
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/menu_tree.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,511 @@
+;=============================================================================
+;
+;   File menu_tree.asm
+;
+;   OSTC3 menus
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-07-11 : [jDG] Creation.
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include    "gaslist.inc"
+#include    "menu_processor.inc"
+#include	"start.inc"
+#include	"comm.inc"
+#include	"logbook.inc"
+#include	"tft.inc"
+#include	"eeprom_rs232.inc"
+#include	"external_flash.inc"
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include	"isr.inc"
+#include	"ghostwriter.inc"
+#include    "adc_lightsensor.inc"
+
+gui     CODE
+;=============================================================================
+; Main Menu
+        global  do_main_menu
+do_main_menu:
+		bcf		sleepmode				; for timeout
+		call    menu_processor_reset    ; restart from first icon.
+
+do_continue_main_menu:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to last icon.
+
+        extern  do_demo_divemode, restart
+    MENU_BEGIN  tMainMenu, .7
+        MENU_CALL   tLogbook,       logbook
+        MENU_CALL   tGasSetup,      do_gas_menu
+        MENU_CALL   tCCRSetup,      do_ccr_menu
+        MENU_CALL   tPlan,          do_planner_menu_reset
+        MENU_CALL   tDiveModeMenu,  do_divemode_menu
+        MENU_CALL   tSystSets,      do_settings_menu
+        MENU_CALL   tExit,          restart
+    MENU_END
+
+do_info_menu:
+	MENU_BEGIN  tInfoMenu, .4
+	    MENU_DYNAMIC    info_menu_serial,       0
+	    MENU_DYNAMIC    info_menu_firmware,     0
+	    MENU_DYNAMIC    info_menu_total_dives,  0
+        MENU_CALL       tExit,                  do_return_settings
+    MENU_END
+
+;=============================================================================
+; CCR Setup
+
+return_ccr_menu:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to last gas.
+
+do_ccr_menu:
+    bcf     menu_show_sensors           ; Set flag
+    MENU_BEGIN  tCCRSetup, .5
+        MENU_OPTION     tCCRMode,    oCCRMode,    0
+        MENU_CALL       tCCRSensor,             do_ccr_sensor
+        MENU_CALL       tDiluentSetup,          do_diluent_setup
+        MENU_CALL       tFixedSetpoints,        do_fixed_setpoints
+        MENU_CALL       tExit,                  do_continue_main_menu
+    MENU_END
+
+do_ccr_sensor:
+    call    enable_ir                   ; Enable IR-Port
+    bsf     menu_show_sensors           ; Set flag
+	MENU_BEGIN  tCCRSensor, .4
+	    MENU_CALL       tDiveHudMask1,       0
+        MENU_CALL       tDiveHudMask2,       0
+        MENU_CALL       tDiveHudMask3,       0
+        MENU_CALL       tExit,               return_ccr_menu
+    MENU_END
+
+do_diluent_setup:
+       bsf     ccr_diluent_setup       ; =1: Setting up Diluents ("Gas6-10")
+       call    gaslist_cleanup_list    ; Takes care that only one gas can be first and first has 0m change depth
+     MENU_BEGIN  tDiluentSetup, .6
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_CALL       tExit,                  return_ccr_menu
+    MENU_END
+
+do_return_fixed_setpoints:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to last gas.
+
+do_fixed_setpoints:
+     MENU_BEGIN  tFixedSetpoints, .6
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
+        MENU_DYNAMIC    gaslist_strcat_setpoint, do_edit_sp_menu
+        MENU_CALL       tExit,                   return_ccr_menu
+    MENU_END
+
+do_edit_sp_menu:
+        call    gaslist_setSP              ; Save current item.
+    MENU_BEGIN  tFixedSetpoints, .5
+        MENU_DYNAMIC    gaslist_strcat_setpoint_0,0
+        MENU_CALL       tSPPlus,                gaslist_spplus
+        MENU_CALL       tDepthPlus,             gaslist_spdepthplus
+        MENU_CALL       tDepthMinus,            gaslist_spdepthminus
+        MENU_CALL       tExit,                  do_return_fixed_setpoints
+    MENU_END
+
+;=============================================================================
+; OC Gas Setup
+
+return_gas_menu:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to last gas.
+
+        btfsc   ccr_diluent_setup       ; Return to CCR-Menu?
+        bra     do_diluent_setup        ; Yes.
+do_gas_menu:
+        bcf     ccr_diluent_setup       ; =1: Setting up Diluents ("Gas6-10")
+        call    gaslist_cleanup_list    ; Takes care that only one gas can be first and first has 0m change depth
+    MENU_BEGIN  tGaslist, .6
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_DYNAMIC    gaslist_strcat_gas_mod, do_edit_gas_menu
+        MENU_CALL       tExit,                  do_continue_main_menu
+    MENU_END
+
+return_gas_depth:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to last gas.
+        bra     do_edit_gas_menu_1
+
+do_edit_gas_menu:
+    call    gaslist_setgas              ; Save current item.
+do_edit_gas_menu_1:                     ; Keep current gas.
+    MENU_BEGIN          tGasEdit, .6
+        MENU_DYNAMIC    gaslist_gastitle,       0
+        MENU_DYNAMIC    gaslist_MOD_END,        0
+        MENU_DYNAMIC    gaslist_show_type,      gaslist_toggle_type
+        MENU_CALL       tSetup_mix,             do_setup_mix
+        MENU_CALL       tGasDepth,              do_gas_depth_menu
+        MENU_CALL       tExit,                  return_gas_menu
+    MENU_END
+
+do_setup_mix:
+    MENU_BEGIN          tGasEdit, .7
+        MENU_DYNAMIC    gaslist_gastitle,       0
+        MENU_DYNAMIC    gaslist_MOD_END,        0
+        MENU_CALL       tO2Plus,                gaslist_pO2
+        MENU_CALL       tO2Minus,               gaslist_mO2
+        MENU_CALL       tHePlus,                gaslist_pHe
+        MENU_CALL       tHeMinus,               gaslist_mHe
+        MENU_CALL       tExit,                  return_gas_depth
+    MENU_END
+
+    global  do_gas_depth_menu
+do_gas_depth_menu:
+    MENU_BEGIN  tGasEdit, .6
+        MENU_DYNAMIC    gaslist_gastitle,       0
+        MENU_DYNAMIC    gaslist_MOD_END,        0
+        MENU_CALL       tDepthPlus,             gaslist_pDepth
+        MENU_CALL       tDepthMinus,            gaslist_mDepth
+        MENU_DYNAMIC    gaslist_reset_mod_title,gaslist_reset_mod
+        MENU_CALL       tExit,                  return_gas_depth
+    MENU_END
+
+;=============================================================================
+; Simulator menus
+
+        global  do_planner_menu
+
+do_planner_menu_reset:
+		extern	option_save_all
+		call	option_save_all
+        ;---- Reset dive time/depth to default values
+        extern  option_reset
+        lfsr    FSR0,odiveInterval
+        call    option_reset
+        lfsr    FSR0,obottomTime
+        call    option_reset
+        lfsr    FSR0,obottomDepth
+        call    option_reset
+
+do_planner_menu:
+    extern  do_demo_planner
+    MENU_BEGIN  tPlan, .6
+		MENU_CALL       tInter,                 do_demo_divemode
+        MENU_OPTION     tIntvl, odiveInterval,  0
+        MENU_OPTION     tBtTm,  obottomTime,    0
+        MENU_OPTION     tMxDep, obottomDepth,   0
+        MENU_CALL       tDeco,                  do_demo_planner
+        MENU_CALL       tExit,                  do_continue_main_menu
+    MENU_END
+
+;=============================================================================
+; Divemode menu
+
+do_return_divemode_menu:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to last gas.
+
+do_divemode_menu:
+    MENU_BEGIN  tDiveModeMenu, .7
+        MENU_OPTION  tDvMode,    oDiveMode,     0
+        MENU_OPTION  tDkMode,    oDecoMode,     0
+		MENU_DYNAMIC divesets_ppo2_max,         do_toggle_ppo2_max
+		MENU_DYNAMIC divesets_ppo2_min,         do_toggle_ppo2_min
+        MENU_OPTION  tFTTSMenu,                 oExtraTime,0
+        MENU_CALL    tDecoparameters,          	do_decoparameters_menu
+        MENU_CALL    tExit,                  	do_continue_main_menu
+    MENU_END
+
+do_return_decoparameters_menu:
+        call    menu_processor_pop      ; drop exit line.
+        call    menu_processor_pop      ; back to setting
+do_decoparameters_menu:
+    MENU_BEGIN  tDecoparameters, .7
+        MENU_OPTION  tGF_low,   oGF_low,        0
+        MENU_OPTION  tGF_high,  oGF_high,       0
+        MENU_CALL    taGFMenu,                  do_aGF_menu
+        MENU_OPTION  tSaturationMult,osatmult,  0
+        MENU_OPTION  tDesaturationMult,odesatmult,0
+        MENU_OPTION  tLastDecostop,oLastDeco,   0
+        MENU_CALL    tExit,                  	do_return_divemode_menu
+    MENU_END
+
+do_aGF_menu:
+    MENU_BEGIN  taGFMenu, .4
+        MENU_OPTION  taGF_enable,oEnable_aGF,    0
+        MENU_OPTION  taGF_low,   oaGF_low,       0
+        MENU_OPTION  taGF_high,  oaGF_high,      0
+        MENU_CALL    tExit,                  	do_return_decoparameters_menu
+    MENU_END
+;=============================================================================
+; Setup Menu
+
+do_return_settings:
+		bcf		settime_setdate					; Clear flag
+        call    menu_processor_pop              ; Drop exit entry
+        call    menu_processor_pop              ; Pop return line.
+        
+        extern  compass_calibration_loop
+do_settings_menu:
+    MENU_BEGIN  tSystSets, .7
+        MENU_CALL   tInfoMenu,      do_info_menu
+        MENU_CALL   tSetTimeDate,   do_date_time_menu
+        MENU_CALL   tDispSets,      do_dispsets_menu
+        MENU_OPTION tLanguage,      oLanguage,       0
+        MENU_CALL   tCompassMenu,   compass_calibration_loop
+        MENU_CALL   tResetMenu,     do_reset_menu
+        MENU_CALL   tExit,          do_continue_main_menu
+    MENU_END
+
+;=============================================================================
+; Reset and confirmation menu.
+
+do_reset_menu:
+    MENU_BEGIN  tResetMenu, .5
+        MENU_CALL       tExit,                  do_return_settings
+        MENU_CALL       tReboot,	            do_reset_menu2			; Confirm
+		MENU_CALL       tResetDeco,	            do_reset_menu3			; Confirm
+		MENU_CALL       tResetSettings,	        do_reset_menu4			; Confirm
+        MENU_CALL       tResetBattery,          new_battery_menu        ; New Battery submenu
+    MENU_END
+
+do_reset_menu2:
+    MENU_BEGIN  tResetMenu2, .2
+        MENU_CALL       tAbort,                 do_continue_menu_3stack
+        MENU_CALL       tReboot,                do_reboot               ; Reboot
+    MENU_END
+
+do_reset_menu3:
+    MENU_BEGIN  tResetMenu2, .2
+        MENU_CALL       tAbort,                 do_continue_menu_3stack
+        MENU_CALL       tResetDeco,             do_reset_deco			; Reset Deco
+    MENU_END
+
+do_reset_menu4:
+    MENU_BEGIN  tResetMenu2, .2
+        MENU_CALL       tAbort,                 do_continue_menu_3stack
+        MENU_CALL       tResetSettings,         do_reset_settings		; Reset all settings
+    MENU_END
+
+
+do_reset_deco:
+	movlw	d'79'							; 79% N2
+	movff	WREG,char_I_N2_ratio
+	movlw	d'0'
+	movff	WREG,char_I_step_is_1min		; 2 second deco mode
+    SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine
+	movff	int_I_pres_respiration+0,int_I_pres_surface+0     ; copy for desat routine
+	movff	int_I_pres_respiration+1,int_I_pres_surface+1		
+
+	extern	deco_reset
+	call	deco_reset
+	call	deco_calc_desaturation_time     ; calculate desaturation time
+	banksel common
+	call	deco_calc_wo_deco_step_1_min	; calculate deco in surface mode 
+	banksel common
+  	clrf	nofly_time+0	              	; Reset NoFly
+  	clrf	nofly_time+1
+	clrf	desaturation_time+0				; Reset Desat
+	clrf	desaturation_time+1
+	goto	do_return_settings				; back to menu
+
+do_reset_settings:
+	extern	option_reset_all
+    call	option_reset_all        	; Reset all options to factory default.
+	goto	do_continue_main_menu		; back to menu
+
+do_continue_menu_3stack:			; Return three levels deep
+    call    menu_processor_pop
+	goto	do_return_settings
+
+do_reboot:
+	call	ext_flash_enable_protection			; Enables write protection
+	reset
+
+
+do_date_time_menu:
+    MENU_BEGIN  tSetTimeDate, .4
+        MENU_CALL	tSetTime,               do_time_menu
+        MENU_CALL   tSetDate,	            do_date_menu
+		MENU_OPTION tDateFormat,oDateFormat,    0
+        MENU_CALL   tExit,                  do_return_settings
+    MENU_END
+
+do_date_menu:
+	bsf		settime_setdate
+    MENU_BEGIN  tSetDate, .4
+        MENU_OPTION tSetDay,	oSetDay,		0
+		MENU_OPTION	tSetMonth,	oSetMonth,	0
+        MENU_OPTION tSetYear,	oSetYear,		0
+        MENU_CALL   tExit,                      do_continue_menu_3stack
+    MENU_END
+
+
+do_reset_seconds:
+	clrf	secs
+	extern	rtc_set_rtc
+	call	rtc_set_rtc				; writes mins,sec,hours,day,month and year to rtc module
+do_time_menu:
+	bsf		settime_setdate
+    MENU_BEGIN  tSetTime, .4
+        MENU_OPTION tSetHours,	oSetHours,		0
+		MENU_OPTION	tSetMinutes,oSetMinutes,	0
+		MENU_CALL   tSetSeconds,                do_reset_seconds
+        MENU_CALL   tExit,                      do_continue_menu_3stack
+    MENU_END
+
+
+do_toggle_ppo2_max:             ; add 0.1bar, with hard-coded max.
+    movff   opt_ppO2_max,lo     ; banksafe
+    movlw	.10
+	addwf	lo,F
+	movlw	ppo2_highest_setting
+	cpfsgt	lo
+    bra     do_toggle_ppo2_max2
+	movlw	.120
+	movwf	lo
+do_toggle_ppo2_max2:
+    movff   lo,opt_ppO2_max
+    return
+
+do_toggle_ppo2_min:             ; sub 0.1bar, with hard-coded min.
+    movff   opt_ppO2_min,lo     ; banksafe
+    incf    lo,F
+	movlw	.21
+	cpfsgt	lo
+    bra     do_toggle_ppo2_min2
+	movlw	ppo2_lowest_setting
+	movwf	lo
+do_toggle_ppo2_min2:
+    movff   lo,opt_ppO2_min
+    return
+
+
+	; Logbook offset sub-menu
+do_log_offset_menu:
+	MENU_BEGIN  tLogOffset, .6
+        MENU_DYNAMIC    TFT_LogOffset_Logtitle,      0
+		MENU_CALL       tLogOffsetp1,				do_logoffset_plus1
+		MENU_CALL       tLogOffsetp10,				do_logoffset_plus10
+		MENU_CALL       tLogOffsetm1,				do_logoffset_minus1
+		MENU_CALL       tLogOffsetm10,				do_logoffset_minus10
+        MENU_CALL       tExit,                  	do_dispsets_menu_3stack
+    MENU_END
+
+
+do_logoffset_minus1:
+	call	do_logoffset_common_read			; Read into lo:hi
+	movlw	d'1'
+	subwf	lo
+	movlw	d'0'
+	subwfb	hi
+	btfss	hi,7								; <0?
+	goto	do_logoffset_common_write			; Store and return
+	clrf	lo
+	clrf	hi
+	goto	do_logoffset_common_write			; Store and return
+
+do_logoffset_minus10:
+	call	do_logoffset_common_read			; Read into lo:hi
+	movlw	d'10'
+	subwf	lo
+	movlw	d'0'
+	subwfb	hi
+	btfss	hi,7								; <0?
+	goto	do_logoffset_common_write			; Store and return
+	clrf	lo
+	clrf	hi
+	goto	do_logoffset_common_write			; Store and return
+
+do_logoffset_plus1:
+	call	do_logoffset_common_read			; Read into lo:hi
+	movlw	d'1'
+	addwf	lo
+	movlw	d'0'
+	addwfc	hi
+	goto	do_logoffset_common_write			; Store and return
+
+do_logoffset_plus10:
+	call	do_logoffset_common_read			; Read into lo:hi
+	movlw	d'10'
+	addwf	lo
+	movlw	d'0'
+	addwfc	hi
+	goto	do_logoffset_common_write			; Store and return
+
+do_dispsets_menu_3stack:
+    call    menu_processor_pop
+    call    menu_processor_pop
+
+do_dispsets_menu:
+    MENU_BEGIN  tDispSets, .5
+        MENU_OPTION tBright,    oBrightness,    0
+        MENU_OPTION tUnits,    oUnits,          0
+		MENU_CALL	tLogOffset,					do_log_offset_menu
+        MENU_OPTION tDvSalinity,oDiveSalinity,  0
+        MENU_CALL   tExit,                      do_return_settings
+    MENU_END
+
+;=============================================================================
+
+	global	new_battery_menu
+new_battery_menu:
+    bsf     enable_screen_dumps     ; To prevent exiting into COMM mode immediately
+	call	TFT_boot                ; Initialize TFT (includes clear screen)
+	call    TFT_Display_FadeIn      ; Show splash
+    movlw   .100
+    movwf   batt_percent            ; make sure to reset batt_percent
+
+    ; Default (In cases of timeout or USB): Use old battery
+	clrf	EEADRH
+	read_int_eeprom 0x07
+	movff	EEDATA,battery_gauge+0
+	read_int_eeprom 0x08
+	movff	EEDATA,battery_gauge+1
+	read_int_eeprom 0x09
+	movff	EEDATA,battery_gauge+2
+	read_int_eeprom 0x0A
+	movff	EEDATA,battery_gauge+3
+	read_int_eeprom 0x0B
+	movff	EEDATA,battery_gauge+4
+	read_int_eeprom 0x0C
+	movff	EEDATA,battery_gauge+5
+
+    MENU_BEGIN tNewBattTitle, .3
+		MENU_CALL   tNewBattOld,                 use_old_batteries
+        MENU_CALL   tNewBattNew36,               use_new_36V_batteries
+        MENU_CALL   tNewBattNew15,               use_new_15V_batteries
+    MENU_END
+
+	global	use_old_batteries
+use_old_batteries:
+	clrf	EEADRH
+	read_int_eeprom 0x07
+	movff	EEDATA,battery_gauge+0
+	read_int_eeprom 0x08
+	movff	EEDATA,battery_gauge+1
+	read_int_eeprom 0x09
+	movff	EEDATA,battery_gauge+2
+	read_int_eeprom 0x0A
+	movff	EEDATA,battery_gauge+3
+	read_int_eeprom 0x0B
+	movff	EEDATA,battery_gauge+4
+	read_int_eeprom 0x0C
+	movff	EEDATA,battery_gauge+5
+    movlw   .100
+    movwf   batt_percent                ; To have 1,5V batteries right after firmware update
+	goto	power_on_return
+
+use_new_15V_batteries:
+use_new_36V_batteries:
+    call    reset_battery_pointer       ; Resets battery pointer 0x07-0x0C and battery_gauge:5
+	goto	power_on_return
+
+    END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ms5541.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,512 @@
+;=============================================================================
+;
+;   File ms5541.asm
+;
+;   Sensor subroutines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-03 : [mH] moving from OSTC code
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include 	"math.inc"					; Math routines
+
+sensors     CODE
+
+;=============================================================================
+; Expose internal variables, to ease debug:
+    global D1, D2
+    global C1, C2, C3, C4, C5, C6
+    global xdT, xdT2, OFF, SENS, amb_pressure_avg, temperature_avg
+
+;=============================================================================
+	global calculate_compensation
+calculate_compensation:
+	; xdT = D2 - C5    (s16 range -11.400 .. +12.350)
+	movf   C5+0,W                       ;  Get Value to be subtracted
+	subwf  D2+0,W             	        ;  Do the Low Byte
+	movwf  xdT+0
+	movf   C5+1,W                       ;  Then the high byte.
+	subwfb D2+1,W
+	movwf  xdT+1
+
+    ; Second order temperature calculation
+    ; xdT/128 is in range -89..+96, hence signed 8bit. dT/128 = (2*dT)/256
+    rlcf    xdT+0,W                     ; put hit bit in carry.
+    rlcf    xdT+1,W                     ; inject in high byte.
+    movwf   isr_xA+0                    ; and put result in low byte.
+    clrf    isr_xA+1
+    btfsc   xdT+1,7                     ; If dT < 0
+    setf    isr_xA+1                    ; then signextend to -1
+	movff	isr_xA+0,isr_xB+0           ; copy A to B
+	movff	isr_xA+1,isr_xB+1
+	call	isr_signed_mult16x16        ; dT*dT --> xC (32 bits)
+
+	; dT >= 0: divide by 8, ie. 3 shifts rights.
+	; dT <  0: divide by 2, ie. 1 shifts rights.
+    movlw   .3
+	btfss	xdT+1,7                     ; Was dT negative ?
+	movlw   .1
+calc_loop_1:
+    bcf     STATUS,C                    ;dT^2 is positive, so injected zeros.
+    rrcf    isr_xC+1,F
+    rrcf    isr_xC+0,F
+    decfsz  WREG
+    bra     calc_loop_1
+
+    movf    isr_xC+0,W                  ; dT2 = dT - (dT/128)*(dT/128)/(2 ...or... 8)
+	subwf   xdT+0,W
+	movwf   xdT2+0
+	movf    isr_xC+1,W
+	subwfb  xdT+1,W
+	movwf   xdT2+1
+
+    ; Calculate OFF = C2 + ((C4-250)*dT2)/2^12 + 10000
+    ; (range +9.246 .. +18.887)
+    movff   C4+0,isr_xA+0
+    movff   C4+1,isr_xA+1
+;	movlw   LOW(-.250)                  ; C4 - 250 --> A
+;	addwf	C4+0,W
+;	movwf   isr_xA+0
+;	movlw   -1                          ; HIGH(- .250) is not understood...
+;	addwfc  C4+1,W
+;	movwf   isr_xA+1
+	
+	movff   xdT2+0,isr_xB+0             ; dT2 --> B
+	movff   xdT2+1,isr_xB+1
+	call    isr_signed_mult16x16
+    movlw   .12-.8                      ; A 12bit shift = 1 byte + 4 bits.
+    call    isr_shift_C31
+
+    movlw   LOW(.10000)                 ; Add 10000
+    addwf   isr_xC+1,F
+    movlw   HIGH(.10000)
+    addwfc  isr_xC+2,F
+    
+    movf    C2+0,W                      ; Add C2, and save into OFF
+	addwf   isr_xC+1,W
+	movwf   OFF+0
+	movf	C2+1,W
+	addwfc  isr_xC+2,W
+	movwf   OFF+1
+
+    ; Calculate SENS = C1/2 + ((C3+200)*dT)/2^13 + 3000
+    movlw   LOW(.200)                   ; C3+200 --> A
+    addwf   C3+0,W
+    movwf   isr_xA+0
+    movlw   HIGH(.200)
+    addwfc  C3+1,W
+    movwf   isr_xA+1
+                                        ; B still contains dT2
+	call    isr_signed_mult16x16        ; A*B --> C
+    movlw   .13-.8                      ; A 13bit shift = 1 byte + 5 bits.
+    call    isr_shift_C31
+    
+    bcf     STATUS,C                    ; SENS = C1 / 2
+    rrcf    C1+1,W
+    movwf   SENS+1
+    rrcf    C1+0,W
+    movwf   SENS+0
+
+    movlw   LOW(.3000)                  ; Add 3000
+    addwf   isr_xC+1,F
+    movlw   HIGH(.3000)
+    addwfc  isr_xC+2,F
+
+    movf    isr_xC+1,W                  ; And sum into SENS
+    addwf   SENS+0,F
+    movf    isr_xC+2,W
+    addwfc  SENS+1,F
+
+    ; calculate amb_pressure = (sens * (d1-off))/2^12 + 1000
+    movf    OFF+0,W                      ; d1-off --> a
+    subwf   D1+0,W
+    movwf   isr_xA+0
+    movf    OFF+1,W
+    subwfb  D1+1,W
+    movwf   isr_xA+1
+
+	movff   SENS+0,isr_xB+0             ; sens --> b
+	movff   SENS+1,isr_xB+1
+	call    isr_signed_mult16x16
+    movlw   .12-.8                      ; a 12bit shift = 1 byte + 4 bits.
+    call    isr_shift_C31
+
+    movlw   LOW(.1000)                  ; add 1000
+    addwf   isr_xC+1,F
+    movlw   HIGH(.1000)
+    addwfc  isr_xC+2,F
+
+	banksel	common
+	btfss	simulatormode_active		; are we in simulator mode?
+	bra		calc_compensation_2			; no
+	banksel	isr_backup
+
+	movff	sim_pressure+0,isr_xC+1	    ; override readings with simulator values
+	movff	sim_pressure+1,isr_xC+2
+	
+calc_compensation_2:
+	banksel	isr_backup
+    movf    isr_xC+1,W                  ; Then sum_up to pressure averaging buffer.
+    addwf   amb_pressure_avg+0,F
+    movf    isr_xC+2,W
+    addwfc  amb_pressure_avg+1,F
+
+    ; calculate temp = 200 + dT*(C6+100)/2^11
+    movlw   LOW(.100)                   ; C6 + 100 --> A
+    addwf   C6+0,W
+    movwf   isr_xA+0
+    movlw   HIGH(.100)
+    addwfc  C6+1,W
+    movwf   isr_xA+1
+
+    movff   xdT2+0,isr_xB+0             ; dT2 --> B
+    movff   xdT2+1,isr_xB+1
+	call    isr_signed_mult16x16        ; A*B
+    movlw   .11-.8                      ; A 12bit shift = 1 byte + 3 bits.
+    call    isr_shift_C31
+
+    movlw   LOW(.200)                   ; Add 200
+    addwf   isr_xC+1,F
+    movlw   HIGH(.200)
+    addwfc  isr_xC+2,F
+
+    movf    isr_xC+1,W
+    addwf   temperature_avg+0,F
+    movf    isr_xC+2,W
+    addwfc  temperature_avg+1,F
+
+	return			                    ; Done.
+
+;=============================================================================
+	global	get_pressure_start
+get_pressure_start:
+	rcall	reset_MS5541
+	movlw	b'10100000'	;+3*high as start and 1+low as stop!
+get_pressure_start2:
+	movwf	isr1_temp
+	movlw	d'12'
+	rcall	send_data_MS5541
+	return
+
+	global get_pressure_value
+get_pressure_value:
+	btfsc	MS5541_miso				; Conversion done?
+	return							; No, Return
+	rcall	get_2bytes_MS5541
+	movff	dMSB,D1+1	
+	movff	dLSB,D1+0
+	return
+
+;=============================================================================
+	global	get_temperature_start
+get_temperature_start:
+	rcall	reset_MS5541
+	movlw	b'10010000'	;+3*high as start and 1+low as stop!
+	bra		get_pressure_start2	; continue in "get_pressure"
+
+	global	get_temperature_value
+get_temperature_value:
+	btfsc	MS5541_miso				; Conversion done?
+	return							; No, Return
+	rcall	get_2bytes_MS5541
+	movff	dMSB,D2+1
+	movff	dLSB,D2+0
+	return
+
+;=============================================================================
+	global	get_calibration_data
+get_calibration_data:
+	banksel	common
+	bsf		no_sensor_int			; disable sensor interrupts
+    banksel isr_backup              ; Back to Bank0 ISR data
+
+	rcall	reset_MS5541
+	movlw	b'01010100'	;+3*high as start and 1+low as stop!
+	movwf	isr1_temp
+	movlw	d'13'
+	rcall	send_data_MS5541
+	rcall	get_2bytes_MS5541
+	movff	dMSB,W1+1	
+	movff	dLSB,W1+0
+
+	movlw	b'01011000'	;+3*high as start and 1+low as stop!
+	movwf	isr1_temp
+	movlw	d'13'
+	rcall	send_data_MS5541
+	rcall	get_2bytes_MS5541
+	movff	dMSB,W2+1	
+	movff	dLSB,W2+0
+
+	movlw	b'01100100'	;+3*high as start and 1+low as stop!
+	movwf	isr1_temp
+	movlw	d'13'
+	rcall	send_data_MS5541
+	rcall	get_2bytes_MS5541
+	movff	dMSB,W3+1	
+	movff	dLSB,W3+0
+
+	movlw	b'01101000'	;+3*high as start and 1+low as stop!
+	movwf	isr1_temp
+	movlw	d'13'
+	rcall	send_data_MS5541
+	rcall	get_2bytes_MS5541
+	movff	dMSB,W4+1	
+	movff	dLSB,W4+0
+
+; calculate C1 (16Bit)
+	movff	W1+1, C1+1
+	bcf		STATUS,C
+	rrcf	C1+1
+	bcf		STATUS,C
+	rrcf	C1+1
+	bcf		STATUS,C
+	rrcf	C1+1
+	movff	W1+0, C1+0
+	bsf		STATUS,C
+	btfss	W1+1,0
+	bcf		STATUS,C
+	rrcf	C1+0
+	bsf		STATUS,C
+	btfss	W1+1,1
+	bcf		STATUS,C
+	rrcf	C1+0
+	bsf		STATUS,C
+	btfss	W1+1,2
+	bcf		STATUS,C
+	rrcf	C1+0
+
+; calculate C2 (16Bit)
+	movff	W2+0, C2+0
+	bsf		STATUS,C
+	btfss	W2+1,0
+	bcf		STATUS,C
+	rrcf	C2+0
+	bsf		STATUS,C
+	btfss	W2+1,1
+	bcf		STATUS,C
+	rrcf	C2+0
+	bsf		STATUS,C
+	btfss	W2+1,2
+	bcf		STATUS,C
+	rrcf	C2+0
+	bsf		STATUS,C
+	btfss	W2+1,3
+	bcf		STATUS,C
+	rrcf	C2+0
+	bsf		STATUS,C
+	btfss	W2+1,4
+	bcf		STATUS,C
+	rrcf	C2+0
+	bsf		STATUS,C
+	btfss	W2+1,5
+	bcf		STATUS,C
+	rrcf	C2+0
+
+	movff	W2+1, C2+1
+	bsf		STATUS,C
+	btfss	W1+0,0
+	bcf		STATUS,C
+	rrcf	C2+1
+	bsf		STATUS,C
+	btfss	W1+0,1
+	bcf		STATUS,C
+	rrcf	C2+1
+	bsf		STATUS,C
+	btfss	W1+0,2
+	bcf		STATUS,C
+	rrcf	C2+1
+	bcf		STATUS,C
+	rrcf	C2+1
+	bcf		STATUS,C
+	rrcf	C2+1
+	bcf		STATUS,C
+	rrcf	C2+1
+
+; calculate C3 (16Bit)
+	movff	W3+1,C3+0
+	bsf		STATUS,C
+	btfss	W3+0,7
+	bcf		STATUS,C
+	rlcf	C3+0
+	bsf		STATUS,C
+	btfss	W3+0,6
+	bcf		STATUS,C
+	rlcf	C3+0
+	clrf	C3+1
+	btfsc	W3+1,7
+	bsf		C3+1,1
+	btfsc	W3+1,6
+	bsf		C3+1,0
+	
+; calculate C4 (16Bit)	
+	movff	W4+1,C4+0
+	bsf		STATUS,C
+	btfss	W4+0,7
+	bcf		STATUS,C
+	rlcf	C4+0
+	clrf	C4+1
+	btfsc	W4+1,7
+	bsf		C4+1,0
+
+; C4=C4-250
+	movlw   LOW(-.250)                  ; C4 - 250 --> C4
+	addwf	C4+0,W
+	movwf   C4+0
+	movlw   -1                          ; HIGH(- .250) is not understood...
+	addwfc  C4+1,W
+	movwf   C4+1
+	
+; calculate C5 (16Bit)		
+	movff	W3+0,C5+0
+	bcf		C5+0,6
+	btfsc	W2+0,0
+	bsf		C5+0,6
+	bcf		C5+0,7
+	btfsc	W2+0,1
+	bsf		C5+0,7
+	clrf	C5+1
+	btfsc	W2+0,2
+	bsf		C5+1,0
+	btfsc	W2+0,3
+	bsf		C5+1,1
+	btfsc	W2+0,4
+	bsf		C5+1,2
+	btfsc	W2+0,5
+	bsf		C5+1,3
+
+    ; calculate C5 = UT1
+    ; C5 = 8*C5 + 10000 (u16 range 10.000 .. +42.760)
+	clrf	isr_xA+1
+	movlw	d'8'
+	movwf	isr_xA+0
+	movff	C5+0,isr_xB+0
+	movff	C5+1,isr_xB+1
+	call	isr_unsigned_mult16x16      ;isr_xA*isr_xB=isr_xC
+    movff   isr_xC+0,C5+0
+    movff   isr_xC+1,C5+1
+	movlw   LOW		d'10000'
+	addwf   C5+0,F
+	movlw   HIGH 	d'10000'
+	addwfc  C5+1,F    ; = 8*C5 + 10000
+
+; calculate C6 (16Bit)		
+	clrf	C6+1
+	movff	W4+0,C6+0
+	bcf		C6+0,7
+
+	banksel	common
+	bcf		no_sensor_int		; enable sensor interrupts
+	bcf		pressure_refresh 		; Clear flag
+    banksel isr_backup              ; Back to Bank0 ISR data
+
+	clrf		sensor_state_counter			; Then reset State counter
+
+	return
+
+;=============================================================================
+reset_MS5541_one:
+	bsf		MS5541_mosi
+    bra    send_clk_pulse  ; Send one high-low sequence on MS5541_clk  -> and return
+
+reset_MS5541_zero:
+	bcf		MS5541_mosi
+    bra    send_clk_pulse  ; Send one high-low sequence on MS5541_clk  -> and return
+
+reset_MS5541:
+	rcall	reset_MS5541_one			;0
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero
+	rcall	reset_MS5541_one
+	rcall	reset_MS5541_zero			;15
+	rcall	reset_MS5541_zero	
+	rcall	reset_MS5541_zero	
+	rcall	reset_MS5541_zero	
+	rcall	reset_MS5541_zero	
+	rcall	reset_MS5541_zero			;20
+	return
+
+get_2bytes_MS5541:
+	movlw	d'8'
+	movwf	clock_count
+	rcall	recieve_loop
+	movff	isr1_temp,dMSB
+
+	movlw	d'8'
+	movwf	clock_count
+	rcall	recieve_loop
+	movff	isr1_temp,dLSB
+    bra    send_clk_pulse  ; Send one high-low sequence on MS5541_clk  -> and return
+	;return
+
+recieve_loop:
+    rcall   send_clk_pulse  ; Send one high-low sequence on MS5541_clk
+	btfss	MS5541_miso	;MSB first
+	bcf		STATUS,C
+	btfsc	MS5541_miso	;MSB first
+	bsf		STATUS,C
+	rlcf	isr1_temp,F
+	decfsz	clock_count,F
+	bra		recieve_loop
+	return
+
+send_clk_pulse:
+	bsf		MS5541_clk
+	nop
+	nop
+	nop
+	nop
+	bcf		MS5541_clk
+	nop
+	nop
+    return
+
+send_data_MS5541:
+	movwf	clock_count     ; From WREG
+	; send three startbits first
+	bcf		MS5541_clk
+	bsf		MS5541_mosi
+	movlw	d'3'
+	subwf	clock_count,F	; total bit counter
+    rcall   send_clk_pulse  ; Send one high-low sequence on MS5541_clk
+    rcall   send_clk_pulse  ; Send one high-low sequence on MS5541_clk
+    rcall   send_clk_pulse  ; Send one high-low sequence on MS5541_clk
+	; now send 8 bytes from isr_temp1 and fill-up with zeros
+send_data_MS5541_2:
+	bcf		MS5541_clk
+
+	btfss	isr1_temp,7	;MSB first
+	bcf		MS5541_mosi
+	btfsc	isr1_temp,7	;MSB first
+	bsf		MS5541_mosi
+
+	bsf		MS5541_clk
+
+	bcf		STATUS,C
+	rlcf	isr1_temp,F
+;	nop
+;	nop
+;	nop
+;	nop
+;	nop
+;	nop
+;	bcf		MS5541_clk
+
+	decfsz	clock_count,F
+	bra		send_data_MS5541_2
+	bcf		MS5541_clk
+	return
+
+        END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ms5541.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,16 @@
+;=============================================================================
+;
+;   File ms5541.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-04 : [mH] moving from OSTC code
+
+	extern	calculate_compensation
+	extern	get_pressure_start
+	extern	get_pressure_value
+	extern	get_temperature_start
+	extern	get_temperature_value
+	extern 	get_calibration_data
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/options.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,577 @@
+;=============================================================================
+;
+;   File options.asm
+;
+;   Manage all options data.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-07-12 : [jDG] Creation.
+;
+; RATIONALS:
+;
+;   Provides a centralized file with 
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include    "strings.inc"
+#include    "convert.inc"
+#include	"ghostwriter.inc"
+#include 	"eeprom_rs232.inc"
+#include	"external_flash.inc"
+
+        extern  write_eeprom
+        extern  read_eeprom
+        extern  eeprom_serial_save,eeprom_opt_backup
+
+        global  option_reset_all        ; Reset all options to factory default.
+        global  option_reset            ; Reset FSR0 option to factory default.
+        global  option_save_all         ; Save options to EEPROM.
+        global  option_restore_all      ; Restore options from EEPROM.
+        global  option_inc              ; Increment FSR0 option.
+        global  option_draw             ; STRCAT FRS0 option.
+
+;=============================================================================
+        CBLOCK  tmp+0x10                ; Reserve space for wordprocessor & convert
+            opt_type
+            opt_default
+            opt_inc                     ; Also default+1 (string), and enum low
+            opt_min                     ; also enum high
+            opt_max
+            opt_unit:2                  ; Multi-lingual unit text.
+            opt_eeprom
+            opt_backup_tbl:3
+            ; Reserved to tmp+0x1F...
+        ENDC
+
+gui     CODE                            ; Appends to other GUI segment
+;=============================================================================
+; Reset all options to factory defauts.
+;
+; INPUT:  none
+; OUTPUT: none
+; TRASH:  TBLPTR, TABLAT, WREG, FSR0, FSR1, FSR2
+
+option_reset_all:
+	    clrf	EEADRH
+		read_int_eeprom	.2
+		movff	EEDATA,lo
+		read_int_eeprom	.3
+		movff	EEDATA,hi
+		tstfsz	lo							; Total dives=0?
+		bra		option_reset_all2			; No, skip resetting logbook
+		tstfsz	hi							; Total dives=0?
+		bra		option_reset_all2			; No, skip resetting logbook
+
+		clrf    EEADRH                      ; Make sure to select eeprom bank 0
+		clrf	EEDATA
+		write_int_eeprom	.4
+		write_int_eeprom	.5
+		write_int_eeprom	.6
+		write_int_eeprom	.2				; Also, delete total dive counter
+		write_int_eeprom	.3				
+		call	ext_flash_erase_logbook		; And complete logbook (!)
+
+option_reset_all2:
+		clrf	lo
+		clrf	hi
+		call	do_logoffset_common_write	; reset Logbook offset
+        movlw   LOW(option_table_begin)
+        movwf   FSR0L
+        movlw   HIGH(option_table_begin)
+        movwf   FSR0H
+
+option_reset_all_1:
+        movf    FSR0L,W                 ; Reached end of table ?
+        xorlw   LOW(option_table_end)   ; (8bit test -> 10 bytes x 128 options max)
+        btfsc   STATUS,Z                ; YES: done.
+        return
+
+        rcall   option_reset            ; Reset one option.
+        bra     option_reset_all_1      ; and loop.
+
+;=============================================================================
+; Read option handle
+; INPUT:  FSR0 = option handle
+; OUTPUT: FSR1 = address of variable.
+; TRASH:  TBLPTR, TABLAT, WREG, FSR0, FSR1
+option_read:
+        movff   FSR0L,TBLPTRL
+        movlw   HIGH(option_table_begin); Get 8 high bits.
+        andlw   0xF0                    ; Keep only the 4 highest ones.
+        iorwf   FSR0H,W                 ; Cat with the known 4 lower ones.
+        movwf   TBLPTRH                 ; And we have the high byte.
+        movlw   UPPER(option_table_begin)
+        movwf   TBLPTRU
+
+        ; Read type, default and register from table
+        tblrd*+
+        movff   TABLAT,opt_type
+        tblrd*+
+        movff   TABLAT,opt_default
+        tblrd*+
+        movff   TABLAT,opt_inc
+        tblrd*+
+        movff   TABLAT,opt_min
+        tblrd*+
+        movff   TABLAT,opt_max
+        tblrd*+
+        movff   TABLAT,opt_eeprom
+        tblrd*+
+        movff   TABLAT,opt_unit+0
+        tblrd*+
+        movff   TABLAT,opt_unit+1
+        tblrd*+
+        movff   TABLAT,FSR1L
+        tblrd*+
+        movff   TABLAT,FSR1H
+        movff   TBLPTRL,FSR0L           ; Advance handle too, for reset_all
+        movff   TBLPTRH,FSR0H
+
+        return
+        
+;=============================================================================
+; Reset an option to its default value.
+; INPUT:  FSR0 = option handle
+; OUTPUT: none
+; TRASH:  TBLPTR, TABLAT, WREG, FSR1, FSR2
+;
+option_reset:
+        ; Read type, default and register from table
+        rcall   option_read
+
+        ; Switch on type
+        movf    opt_type,W              ; Type == STRING ?
+        xorlw   2
+        bz      opt_reset_string        ; YES: special copy
+        
+        movff   opt_default,INDF1       ; NO: just a 8bit indirect copy
+        return
+
+opt_reset_string:
+        movff   FSR1L,FSR2L             ; set string destination address.
+        movff   FSR1H,FSR2H
+
+        movff   opt_default+0,FSR1L     ; Get handle to multi-lingual text in FSR1
+        movff   opt_default+1,FSR1H
+
+        movff   TBLPTRL,opt_backup_tbl+0; TBLPTR trashed by text routine...
+        movff   TBLPTRH,opt_backup_tbl+1
+        movff   TBLPTRU,opt_backup_tbl+2
+
+        call    strcat_text             ; Copy translated text to FSR2
+
+        movff   opt_backup_tbl+0,TBLPTRL
+        movff   opt_backup_tbl+1,TBLPTRH
+        movff   opt_backup_tbl+2,TBLPTRU
+
+        return
+
+;=============================================================================
+; Save all options to EEPROM
+option_save_all:
+        ;---- Save option serial into EEPROM to detect reset and new version
+        movlw   LOW(eeprom_serial_save)
+        movwf   EEADR
+        movlw   HIGH(eeprom_serial_save)
+        movf    EEADRH
+        movlw   LOW(eeprom_opt_serial)
+        movwf   EEDATA
+        call    write_eeprom
+        incf    EEADR,F
+        movlw   HIGH(eeprom_opt_serial)
+        movwf   EEDATA
+        call    write_eeprom
+        
+        ;---- Save all options
+        movlw   LOW(option_table_begin)
+        movwf   FSR0L
+        movlw   HIGH(option_table_begin)
+        movwf   FSR0H
+
+option_save_all_1:
+        movf    FSR0L,W                 ; Reached end of table ?
+        xorlw   LOW(option_table_end)   ; (8bit test -> 10 bytes x 128 options max)
+        btfsc   STATUS,Z                ; YES: done.
+        return
+
+        rcall   option_save             ; Save one option.
+        bra     option_save_all_1       ; and loop.
+
+option_save:
+        rcall   option_read
+        incf    opt_eeprom,W            ; Should we save it ?
+        btfsc   STATUS,Z                ; eeprom address is FFh ?
+        return                          ; YES: nothing to do.
+
+        movf    opt_eeprom,W            ; Compute backup address in EEPROM
+        addlw   LOW(eeprom_opt_backup)  ; Add offset
+        movwf   EEADR
+        movlw   HIGH(eeprom_opt_backup)
+        movwf   EEADRH
+
+        movf    opt_type,W              ; Option type is string ?
+        xorlw   2                       
+        bz      option_save_string
+
+        ; One byte to save to eeprom
+        movff   INDF1,EEDATA
+        goto    write_eeprom
+        
+option_save_string:
+        movff   POSTINC1,EEDATA         ; Write one byte
+        call    write_eeprom
+        infsnz  EEADR,F
+        incf    EEADRH,F
+        
+        decfsz  opt_max                 ; Decrement string length
+        bra     option_save_string      ; And loop while not finished
+
+        return
+;=============================================================================
+
+option_restore_all:
+        ;---- Read option serial from EEPROM
+        movlw   LOW(eeprom_serial_save)
+        movwf   EEADR
+        movlw   HIGH(eeprom_serial_save)
+        movf    EEADRH
+        call    read_eeprom
+        movlw   LOW(eeprom_opt_serial)
+        xorwf   EEDATA,W
+        bnz     option_restore_bad      ; Auto reset if changed.
+        incf    EEADR,F
+        call    read_eeprom
+        movlw   HIGH(eeprom_opt_serial)
+        xorwf   EEDATA,W
+        bz      option_restore_ok       ; Auto reset if changed.
+
+option_restore_bad:
+        call    option_reset_all        ; Reset RAM contains
+        goto    option_save_all         ; Then save to EEPROM
+
+        ;---- Proper restore
+option_restore_ok:
+        movlw   LOW(option_table_begin)
+        movwf   FSR0L
+        movlw   HIGH(option_table_begin)
+        movwf   FSR0H
+
+option_restore_all_1:
+        movf    FSR0L,W                 ; Reached end of table ?
+        xorlw   LOW(option_table_end)   ; (8bit test -> 10 bytes x 128 options max)
+        btfsc   STATUS,Z                ; YES: done.
+        return
+
+        rcall   option_restore          ; Restore one option.
+        bra     option_restore_all_1    ; and loop.
+        return
+
+option_restore:
+        rcall   option_read
+        incf    opt_eeprom,W            ; Should we save it ?
+        btfsc   STATUS,Z                ; eeprom address is FFh ?
+        return                          ; YES: nothing to do.
+
+        movf    opt_eeprom,W            ; Compute backup address in EEPROM
+        addlw   LOW(eeprom_opt_backup)  ; Add offset
+        movwf   EEADR
+        movlw   HIGH(eeprom_opt_backup)
+        movwf   EEADRH
+
+        movf    opt_type,W              ; Option type is string ?
+        xorlw   2                       
+        bz      option_restore_string
+
+        ; Read one byte from eeprom
+        call    read_eeprom
+        movff   EEDATA, INDF1           ; And restore option register.
+        return
+
+option_restore_string:
+        call    read_eeprom             ; Read one byte, and
+        movff   EEDATA,POSTINC1         ; restore it
+        infsnz  EEADR,F
+        incf    EEADRH,F
+        
+        decfsz  opt_max                 ; Decrement string length
+        bra     option_restore_string   ; And loop while not finished
+        return
+
+;=============================================================================
+; Increment an option, based on type, and boundary.
+; INPUT:  FSR0 = option handle
+; OUTPUT: none
+; TRASH:  TBLPTR, TABLAT, WREG, FSR0, FSR1
+option_inc:
+        ; Read type, default and register from table
+        rcall   option_read
+        
+        ; Switch on type
+        movf    opt_type,W
+        bz      option_inc_uint8
+        dcfsnz  WREG
+        bra     option_inc_enum8
+        dcfsnz  WREG
+        bra     option_inc_string
+
+option_inc_uint8:                       ; Defaults type too...
+        movf    INDF1,W
+        addwf   opt_inc,W
+        cpfslt  opt_max
+        bra     option_inc_1
+        movf    opt_min,W
+option_inc_1:
+        movwf   INDF1
+        return
+
+option_inc_enum8:                       ; Always +1
+        incf    INDF1,W
+        cpfsgt  opt_max
+        clrf    WREG
+        movwf   INDF1
+        return
+
+option_inc_string:                      ; No edition yet...
+        return
+
+;=============================================================================
+; Strcat option into FSR2 buffer.
+option_draw:
+        ; Read type, default and register from table
+        rcall   option_read
+        
+        ; Switch on type
+        movf    opt_type,W
+        bz      option_draw_uint8
+        dcfsnz  WREG
+        bra     option_draw_enum8
+        dcfsnz  WREG
+        bra     option_draw_string
+        return                      ; Unknown: return...
+
+option_draw_uint8:
+        movff   INDF1,lo            ; Draw value.
+        output_8
+        clrf    INDF2               ; Make sure to close string...
+
+		btfsc	settime_setdate		; In the Set Time or Set Date menu?
+		return                      ; Yes, ignore the rest
+
+        movf    opt_unit+0,W        ; Is there a unit to append ?
+        iorwf   opt_unit+1,W
+        rcall   option_draw_unit
+
+        movf    opt_default,W       ; Default value
+        cpfseq  lo                  ; Current value
+        bra     option_draw_uint8_2 ; Not default, add *
+        return                      ; Default, Done.
+option_draw_uint8_2:
+        PUTC    "*"
+        return                      ; Done.
+
+option_draw_unit:
+        movff   opt_unit+0,FSR1L
+        movff   opt_unit+1,FSR1H
+        goto    strcat_text
+        
+
+
+;---- Draw an enumerated value (set of translated strings)
+option_draw_enum8:
+        movf    INDF1,W             ; Get current value.
+        cpfsgt  opt_max             ; Bound value
+        clrf    WREG
+        addwf   WREG                ; *= 2            
+        addwf   opt_inc,W           ; Base text + 2 * value
+        movwf   FSR1L
+        movlw   0
+        addwfc  opt_min,W           ; Propagate carry
+        movwf   FSR1H               ; Into FSR1
+
+        goto    strcat_text
+
+option_draw_string:
+        movff   POSTINC1,POSTINC2
+        decfsz  opt_max
+        bra     option_draw_string
+        return
+
+;=============================================================================
+; Options Tables
+
+OPTION_UINT8    MACRO   lbl, min, max, default, unit, eeprom, register
+        global  lbl
+lbl:    db      0, default  ; Type0 = INT8
+        db      1, min
+        db      max, eeprom
+        dw      unit
+        dw      register      
+        ENDM
+
+OPTION_UINT8p2  MACRO   lbl, min, max, default, unit, eeprom, register
+        global  lbl
+lbl:    db      0, default  ; Type0 = INT8
+        db      2, min
+        db      max, eeprom
+        dw      unit
+        dw      register      
+        ENDM
+
+OPTION_UINT8p3  MACRO   lbl, min, max, default, unit, eeprom, register
+        global  lbl
+lbl:    db      0, default  ; Type0 = INT8
+        db      3, min
+        db      max, eeprom
+        dw      unit
+        dw      register      
+        ENDM
+
+OPTION_UINT8p10  MACRO   lbl, min, max, default, unit, eeprom, register
+        global  lbl
+lbl:    db      0, default  ; Type0 = INT8
+        db      .10, min
+        db      max, eeprom
+        dw      unit
+        dw      register      
+        ENDM
+
+OPTION_ENUM8    MACRO   lbl, max, default, tValue, eeprom, register
+        global  lbl
+        extern  tValue
+lbl:    db      1, default  ; Type1 = ENUM
+        db      LOW(tValue), HIGH(tValue)
+        db      max, eeprom
+        dw      0                       ; No unit
+        dw      register      
+        ENDM
+
+OPTION_BOOL     MACRO   lbl, default, eeprom, register
+        OPTION_ENUM8    lbl, 2, default, tNo, eeprom, register
+        ENDM
+
+        
+OPTION_STRING   MACRO   lbl, length, defText, eeprom, register
+        global  lbl
+lbl:    db      2, LOW(defText)         ; Type2 = STRING
+        db      HIGH(defText), 0
+        db      length, eeprom
+        dw      0                       ; No unit
+        dw      register
+        ENDM
+
+;=============================================================================
+    ; Option table
+    ; OPTION_UINT8  Label,   min,    max,    default, text-string,   EEPROM location (-1 for RAM only),   RAM location
+
+; Manage Gas List.
+        extern tPercent, tMeters, tMinutes, tGasDisabled, tbar
+
+option_table_begin:
+        extern  char_I_deco_gas_change, char_I_setpoint_change, char_I_setpoint_cbar, char_I_dil_change
+;=============================================================================
+; Manage Decoplaner & Dive parameters
+
+        extern  char_I_dive_interval, char_I_bottom_time, char_I_bottom_depth
+        OPTION_UINT8p10 odiveInterval,  .0, .240,   .0,     tMinutes, -1,     char_I_dive_interval
+        OPTION_UINT8p2  obottomTime,    .1, .60,    .5,     tMinutes, -1,     char_I_bottom_time
+        OPTION_UINT8p3  obottomDepth,   .12,.120,    .21,    tMeters,  -1,     char_I_bottom_depth
+
+        extern  char_I_deco_model, char_I_saturation_multiplier, char_I_desaturation_multiplier
+        OPTION_ENUM8    oDiveMode,      4,  0,  tDvOC,               .8,    opt_dive_mode
+        OPTION_ENUM8    oDecoMode,      2,  1,  tZHL16,              .9,    char_I_deco_model
+        OPTION_UINT8p10 oPPO2Max,       .120, ppo2_warning_high, .160,   0,      .10,    opt_ppO2_max
+        OPTION_UINT8    oLastDeco,      .3,  .6, .3,  tMeters,      .11,    opt_last_stop
+        OPTION_UINT8    oGF_low,       .10,  .100, .40,  tPercent,  .12,    opt_GF_low
+        OPTION_UINT8    oGF_high,      .70,  .110, .85, tPercent,   .13,    opt_GF_high
+        OPTION_UINT8p10 osatmult,      .100,  .140, .110,tPercent,  .14,    char_I_saturation_multiplier
+        OPTION_UINT8p10 odesatmult,    .60,  .100,  .90,tPercent,   .15,    char_I_desaturation_multiplier
+        OPTION_UINT8p10 oPPO2Min,       .16, ppo2_warning_low, .19,   0,         .16,    opt_ppO2_min
+        OPTION_UINT8    oaGF_low,      .60,  .100, .60,  tPercent,  .17,    opt_aGF_low
+        OPTION_UINT8    oaGF_high,     .80,  .120, .85, tPercent,   .18,    opt_aGF_high
+        OPTION_BOOL     oEnable_aGF,    1,                          .19,    opt_enable_aGF              ; =1: aGF can be selected underwater
+
+;=============================================================================
+; Managing Settings
+        extern          char_I_extra_time
+        OPTION_UINT8    oExtraTime,     0,  .9,   5,tMinutes,   .22,    char_I_extra_time
+        OPTION_ENUM8    oBrightness,    3,  0,  tEco,           .23,    opt_brightness
+        OPTION_UINT8    oDiveSalinity,  0,  4, 0,  tPercent,    .24,    opt_salinity
+        OPTION_ENUM8    oCCRMode,    2,  0,  tCCRModeFixedSP,   .25,    opt_ccr_mode
+        extern  tDefName
+        OPTION_ENUM8    oLanguage,      4,  0,  tEnglish,   .26,    opt_language
+		OPTION_ENUM8    oDateFormat,    3,  1,  tDateformat,.27,    opt_dateformat
+        OPTION_ENUM8    oUnits,         2,  0,  tMetric,    .28,    opt_units			; 0=Meters, 1=Feets
+
+;=============================================================================
+; Compass calibration data
+        OPTION_UINT8    oCalx0,         0,.255,.0,      0,  .29,    compass_CX_f+0
+        OPTION_UINT8    oCalx1,         0,.255,.0,      0,  .30,    compass_CX_f+1
+        OPTION_UINT8    oCaly0,         0,.255,.0,      0,  .31,    compass_CY_f+0
+        OPTION_UINT8    oCaly1,         0,.255,.0,      0,  .32,    compass_CY_f+1
+        OPTION_UINT8    oCalz0,         0,.255,.0,      0,  .33,    compass_CZ_f+0
+        OPTION_UINT8    oCalz1,         0,.255,.0,      0,  .34,    compass_CZ_f+1
+
+        OPTION_ENUM8    oGas1,          3,  1,  tGasDisabled,         .35,     opt_gas_type+0; 0=Disabled, 1=First, 2=Travel, 3=Deco
+        OPTION_ENUM8    oGas2,          3,  0,  tGasDisabled,         .36,     opt_gas_type+1
+        OPTION_ENUM8    oGas3,          3,  0,  tGasDisabled,         .37,     opt_gas_type+2
+        OPTION_ENUM8    oGas4,          3,  0,  tGasDisabled,         .38,     opt_gas_type+3
+        OPTION_ENUM8    oGas5,          3,  0,  tGasDisabled,         .39,     opt_gas_type+4
+        OPTION_UINT8    oGas1O2,        .21,.100,   .21,    tPercent, .40,     opt_gas_O2_ratio+0
+        OPTION_UINT8    oGas1He,        .1, .100,   .0,     tPercent, .41,     opt_gas_He_ratio+0
+        OPTION_UINT8    oGas2O2,        .21,.100,   .21,    tPercent, .42,     opt_gas_O2_ratio+1
+        OPTION_UINT8    oGas2He,        .1, .100,   .0,     tPercent, .43,     opt_gas_He_ratio+1
+        OPTION_UINT8    oGas3O2,        .21,.100,   .21,    tPercent, .44,     opt_gas_O2_ratio+2
+        OPTION_UINT8    oGas3He,        .1, .100,   .0,     tPercent, .45,     opt_gas_He_ratio+2
+        OPTION_UINT8    oGas4O2,        .21,.100,   .21,    tPercent, .46,     opt_gas_O2_ratio+3
+        OPTION_UINT8    oGas4He,        .1, .100,   .0,     tPercent, .47,     opt_gas_He_ratio+3
+        OPTION_UINT8    oGas5O2,        .21,.100,   .21,    tPercent, .48,     opt_gas_O2_ratio+4
+        OPTION_UINT8    oGas5He,        .1, .100,   .0,     tPercent, .49,     opt_gas_He_ratio+4
+        OPTION_UINT8    oGas1Depth,     .0, .100,   .0,     tMeters,  .50,     char_I_deco_gas_change+0
+        OPTION_UINT8    oGas2Depth,     .0, .100,   .0,     tMeters,  .51,     char_I_deco_gas_change+1
+        OPTION_UINT8    oGas3Depth,     .0, .100,   .0,     tMeters,  .52,     char_I_deco_gas_change+2
+        OPTION_UINT8    oGas4Depth,     .0, .100,   .0,     tMeters,  .53,     char_I_deco_gas_change+3
+        OPTION_UINT8    oGas5Depth,     .0, .100,   .0,     tMeters,  .54,     char_I_deco_gas_change+4
+        OPTION_UINT8    oDil1O2,        .21,.100,   .21,    tPercent, .55,     opt_dil_O2_ratio+0
+        OPTION_UINT8    oDil1He,        .1, .100,   .0,     tPercent, .56,     opt_dil_He_ratio+0
+        OPTION_UINT8    oDil2O2,        .21,.100,   .21,    tPercent, .57,     opt_dil_O2_ratio+1
+        OPTION_UINT8    oDil2He,        .1, .100,   .0,     tPercent, .58,     opt_dil_He_ratio+1
+        OPTION_UINT8    oDil3O2,        .21,.100,   .21,    tPercent, .59,     opt_dil_O2_ratio+2
+        OPTION_UINT8    oDil3He,        .1, .100,   .0,     tPercent, .60,     opt_dil_He_ratio+2
+        OPTION_UINT8    oDil4O2,        .21,.100,   .21,    tPercent, .61,     opt_dil_O2_ratio+3
+        OPTION_UINT8    oDil4He,        .1, .100,   .0,     tPercent, .62,     opt_dil_He_ratio+3
+        OPTION_UINT8    oDil5O2,        .21,.100,   .21,    tPercent, .63,     opt_dil_O2_ratio+4
+        OPTION_UINT8    oDil5He,        .1, .100,   .0,     tPercent, .64,     opt_dil_He_ratio+4
+        OPTION_UINT8    oSetPoint1,     .20, .160,  .70,    tbar,     .65,     char_I_setpoint_cbar+0
+        OPTION_UINT8    oSetPoint2,     .20, .160,  .90,    tbar,     .66,     char_I_setpoint_cbar+1
+        OPTION_UINT8    oSetPoint3,     .20, .160,  .100,   tbar,     .67,     char_I_setpoint_cbar+2
+        OPTION_UINT8    oSetPoint4,     .20, .160,  .120,   tbar,     .68,     char_I_setpoint_cbar+3
+        OPTION_UINT8    oSetPoint5,     .20, .160,  .140,   tbar,     .69,     char_I_setpoint_cbar+4
+        OPTION_UINT8    oSP1Depth,      .0, .100,   .0,     tMeters,  .70,     char_I_setpoint_change+0
+        OPTION_UINT8    oSP2Depth,      .0, .100,   .0,     tMeters,  .71,     char_I_setpoint_change+1
+        OPTION_UINT8    oSP3Depth,      .0, .100,   .0,     tMeters,  .72,     char_I_setpoint_change+2
+        OPTION_UINT8    oSP4Depth,      .0, .100,   .0,     tMeters,  .73,     char_I_setpoint_change+3
+        OPTION_UINT8    oSP5Depth,      .0, .100,   .0,     tMeters,  .74,     char_I_setpoint_change+4
+        OPTION_ENUM8    oDil1,          2,  1,  tDilDisabled,         .75,     opt_dil_type+0   ; 0=Disabled, 1=First, 2=Normal
+        OPTION_ENUM8    oDil2,          2,  0,  tDilDisabled,         .76,     opt_dil_type+1
+        OPTION_ENUM8    oDil3,          2,  0,  tDilDisabled,         .77,     opt_dil_type+2
+        OPTION_ENUM8    oDil4,          2,  0,  tDilDisabled,         .78,     opt_dil_type+3
+        OPTION_ENUM8    oDil5,          2,  0,  tDilDisabled,         .79,     opt_dil_type+4
+        OPTION_UINT8    oDil1Depth,     .0, .100,   .0,     tMeters,  .80,     char_I_dil_change+0
+        OPTION_UINT8    oDil2Depth,     .0, .100,   .0,     tMeters,  .81,     char_I_dil_change+1
+        OPTION_UINT8    oDil3Depth,     .0, .100,   .0,     tMeters,  .82,     char_I_dil_change+2
+        OPTION_UINT8    oDil4Depth,     .0, .100,   .0,     tMeters,  .83,     char_I_dil_change+3
+        OPTION_UINT8    oDil5Depth,     .0, .100,   .0,     tMeters,  .84,     char_I_dil_change+4
+        OPTION_STRING   oName,          opt_name_length,    tDefName, .85,     opt_name
+        ; opt_name from 85 to 145
+
+
+; Set Time/Set Date
+		OPTION_UINT8    oSetHours,		.0,	.23, .0,	0, -1,		hours
+		OPTION_UINT8    oSetMinutes,	.0,	.59, .0,	0, -1,		mins
+		OPTION_UINT8    oSetDay,		.1,	.31, .0,	0, -1,		day
+		OPTION_UINT8    oSetMonth,		.1,	.12, .0,	0, -1,		month
+		OPTION_UINT8    oSetYear,		.13,.20, .0,	0, -1,		year
+
+option_table_end:
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ostc3.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,281 @@
+;=============================================================================
+;
+;   File ostc3.asm
+;
+;   Definition of the ostc3 dive computer platform.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-05-24 : [jDG] Cleanups from initial Matthias code.
+;   2011-06-24 : [MH]  Added clock speeds.
+#include "ostc3.inc"
+
+;=============================================================================
+;
+;----------------------------- CONFIG ---------------------------------
+;    CONFIG	RETEN = OFF          ;Disabled - Controlled by SRETEN bit
+;    CONFIG	SOSCSEL = HIGH       ;High Power SOSC circuit selected
+;    CONFIG XINST = OFF          ;Code won't excute in extended mode...
+;    CONFIG	FOSC = INTIO2        ;Internal RC oscillator, no clock-out
+;    CONFIG	PLLCFG = OFF
+;    CONFIG	IESO = OFF           ;Disabled
+;    CONFIG	PWRTEN = OFF         ;Disabled, because incompatible with ICD3 (Ri-400)
+;    CONFIG	BOREN = ON           ;Controlled with SBOREN bit
+;    CONFIG	BORV = 2             ;2.0V
+;    CONFIG	BORPWR = MEDIUM      ;BORMV set to medium power level
+;    CONFIG	WDTEN = ON           ;WDT controlled by SWDTEN bit setting
+;    CONFIG	WDTPS = 128          ;1:128
+;    CONFIG	RTCOSC = SOSCREF     ;RTCC uses SOSC
+;    CONFIG	MCLRE = ON           ;MCLR Enabled, RG5 Disabled
+;    CONFIG	CCP2MX = PORTBE      ;RE7-Microcontroller Mode/RB3-All other modes
+;=============================================================================
+boot    CODE
+    global init_ostc3
+
+init_ostc3:
+	banksel common              ; Bank1
+;init oscillator
+	movlw	b'01110010'
+	movwf	OSCCON				; 16MHz INTOSC
+	movlw	b'00001000'
+	movwf	OSCCON2				; Secondary Oscillator running
+	movlw	b'00000000'
+	movwf	OSCTUNE				; 4x PLL Disable (Bit6) - only works with 8 or 16MHz (=32 or 64MHz)
+	bcf		RCON,SBOREN			; Bown-Out off
+	bcf		RCON,IPEN			; Priority Interrupts off
+
+; I/O Ports
+	banksel 0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+
+	clrf	REFOCON				; No reference oscillator active on REFO pin
+	clrf	ODCON1				; Disable Open Drain capability
+	clrf	ODCON2				; Disable Open Drain capability
+	clrf	ODCON3				; Disable Open Drain capability
+
+	movlw	b'11000000'			; ANSEL, AN7 and AN6 -> Analog inputs, PORTA is digital.
+	movwf	ANCON0
+	movlw	b'00000000'			; ANSEL
+	movwf	ANCON1
+	movlw	b'00000010'			; ANSEL, AN17 -> Analog input
+	movwf	ANCON2
+
+	banksel common
+
+	movlw	b'00000000'			; 1= Input -> Data TFT_high
+	movwf	TRISA
+	movlw	b'00000000'			; Init port
+	movwf	PORTA
+
+	movlw	b'00001011'			; 1= Input, (RB0, RB1) -> Switches, RB2 -> Power_MCP, RB3 -> lf_data, RB4 -> LED_green, RB5 -> /TFT_POWER
+	movwf	TRISB
+	movlw	b'00100000'			; Init port
+	movwf	PORTB
+
+    movlw	b'10011010'			; 1= Input, (RC0, RC1) -> SOSC, RC2 -> TFT_LED_PWM, (RC3,RC4) -> I²C, RC5 -> MOSI_MS5541, (RC6, RC7) -> UART1
+	movwf	TRISC
+	movlw	b'00000000'			; Init port
+	movwf	PORTC
+
+	movlw	b'00100000'			; 1= Input, RD0 -> TFT_NCS, RD1 -> TFT_RS, RD2 -> TFT_NWR, RD3 -> TFT_RD, RD4 -> MOSI_Flash, RD5 -> MISO_Flash, RD6 -> CLK_Flash, RD7 -> TFT_NRESET
+	movwf	TRISD
+	movlw	b'00000000'			; Init port
+	movwf	PORTD
+
+	movlw	b'00000000'			; 1= Input, RE1 -> Power_IR, RE2 -> CS_MCP, RE3 -> LED_blue, RE4 -> power_sw1,
+	movwf	TRISE
+	movlw	b'00010000'			; Init port
+	movwf	PORTE
+
+	movlw	b'00000110'			; 1= Input, (RF1, RF2) -> Analog
+	movwf	TRISF
+	movlw	b'00000000'			; Init port
+	movwf	PORTF
+
+	movlw	b'00001111'			; 1= Input, <7:6> not implemented, RG0 -> SCLK_MCP, RG2 -> RX2, RG3 -> AN17_RSSI, RG4 -> SOSC_OUT, RG5 -> /RESET
+	movwf	TRISG
+	movlw	b'00000000'			; Init port
+	movwf	PORTG
+
+	movlw	b'00000000'			; 1= Input -> Data TFT_low
+	movwf	TRISH
+	movlw	b'00000000'			; Init port
+	movwf	PORTH
+
+	movlw	b'10010000'			; 1= Input, RJ4 -> vusb_in, RJ5 -> power_sw2,  RJ6 -> CLK_MS5541, RJ7 -> MISO_MS5541
+	movwf	TRISJ
+	movlw	b'00100000'			; Init port
+	movwf	PORTJ
+
+
+; Timer 0
+;	movlw	b'00000000'				; Timer0 with 1:2 prescaler
+	movlw	b'00001000'				; Timer0 with 1:1 prescaler
+	movwf	T0CON
+
+; Timer 1 - Button hold-down timer
+	movlw	b'10001100'             ; 32768Hz clock source, 1:1 Prescaler -> ; 30,51757813µs/bit in TMR1L:TMR1H
+	movwf	T1CON
+
+	banksel 0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+
+; RTCC
+	movlw 	0x55
+	movwf 	EECON2
+	movlw 	0xAA
+	movwf 	EECON2
+	bsf 	RTCCFG,RTCWREN		; Unlock sequence for RTCWREN
+	bsf		RTCCFG,RTCPTR1
+	bsf		RTCCFG,RTCPTR0
+	bsf		RTCCFG,RTCEN		; Module enable
+	bsf		RTCCFG,RTCOE		; Output enable
+	movlw	b'00000100'			; 32768Hz SOCS on RTCC pin (PORTG,4) Bit7-5: Pullups for Port D, E and J
+	movwf	PADCFG1
+	movlw	b'11000100'
+	movwf	ALRMCFG				; 1 second alarm
+	movlw	d'1'
+	movwf	ALRMRPT				; Alarm repeat counter
+	movlw 	0x55
+	movwf 	EECON2
+	movlw 	0xAA
+	movwf 	EECON2
+	bcf 	RTCCFG,RTCWREN		; Lock sequence for RTCWREN
+
+	banksel common
+; A/D Converter
+	movlw	b'00011000'			; power off ADC, select AN6
+	movwf	ADCON0
+	movlw	b'00100000'			; 2.048V Vref+
+	movwf	ADCON1
+	movlw	b'10001101'			; Right justified
+	movwf	ADCON2
+
+
+;init serial port1 (TRISC6/7)
+	movlw	b'00001000'			; BRG16=1
+	movwf	BAUDCON1
+	movlw 	b'00100100'			; BRGH=1, SYNC=0
+	movwf 	TXSTA1
+	movlw 	.34					; SPBRGH:SPBRG = .34  : 114285 BAUD @ 16MHz (+0,79% Error to 115200 BAUD)
+	movwf 	SPBRG1				; SPBRGH:SPBRG = .207 :  19230 BAUD @ 16MHz (-0,16% Error to 19200 BAUD)
+	clrf	SPBRGH1				;
+	movlw 	b'10010000'
+	movwf 	RCSTA1
+
+;init serial port2 (TRISG2)
+    banksel BAUDCON2
+	movlw	b'00100000'			; BRG16=0
+	movwf	BAUDCON2
+	movlw 	b'00100000'			; BRGH=0, SYNC=0
+	movwf 	TXSTA2
+	movlw 	.102                ; SPBRGH:SPBRG = .102  : 2403 BAUD @ 16MHz
+	movwf 	SPBRG2
+	clrf	SPBRGH2
+	movlw 	b'10010000'
+	movwf 	RCSTA2
+    banksel common
+
+; Timer3 for IR-RX Timeout
+	clrf	T3GCON				; Reset Timer3 Gate Control register
+;	movlw	b'10001101'			; 1:1 Prescaler -> 2seconds@32768Hz, not synced
+	movlw	b'10001001'			; 1:1 Prescaler -> 2seconds@32768Hz, synced
+; 30,51757813µs/bit in TMR3L:TMR3H
+	movwf	T3CON
+
+; SPI Module(s)
+; SPI2: External Flash
+	movlw	b'00110000'
+	movwf	SSP2CON1
+	movlw	b'00000000'
+	movwf	SSP2STAT
+; ->0,25MHz Bit clock  @1MHz mode (Eco)
+; ->  4MHz  Bit clock @16MHz mode (Normal)
+; -> 16MHz  Bit clock @64MHz mode (Fastest)
+
+; MSSP1 Module: I2C Master
+    movlw	b'00101000'		; I2C Master Mode
+	movwf	SSP1CON1
+	movlw	b'00000000'
+	movwf	SSP1CON2
+	movlw	0x27
+	movwf	SSP1ADD			; 100kHz @ 16MHz Fosc
+
+; PWM Module(s)
+; PWM1 for LED dimming
+	movlw	b'00001100'
+	movwf	CCP1CON
+	movlw	b'00000001'
+	movwf	PSTR1CON			; Pulse steering disabled
+	movlw	d'255'
+	movwf	PR2					; Period
+	; 255 is max brightness (300mW)
+	clrf	CCPR1L				; Duty cycle
+	clrf	CCPR1H				; Duty cycle
+	movlw	T2CON_NORMAL
+	movwf	T2CON
+
+; Timer5 for ISR-independent wait routines
+	clrf	T5GCON				; Reset Timer5 Gate Control register
+;	movlw	b'10001101'			; 1:1 Prescaler -> 2seconds@32768Hz, not synced
+	movlw	b'10001001'			; 1:1 Prescaler -> 2seconds@32768Hz, synced
+; 30,51757813µs/bit in TMR5L:TMR5H
+	movwf	T5CON
+
+; Timer7 for 62,5ms Interrupt (Sensor states)
+	banksel 0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+	clrf	T7GCON				; Reset Timer7 Gate Control register
+;	movlw	b'10001101'			; 1:1 Prescaler -> 2seconds@32768Hz, not synced
+	movlw	b'10001001'			; 1:1 Prescaler -> 2seconds@32768Hz, synced
+	movwf	T7CON
+	clrf	TMR7L
+	movlw	.248
+	movwf	TMR7H				; -> Rollover after 2048 cycles -> 62,5ms
+
+	banksel common
+; Interrupts
+	movlw	b'11110000'
+	movwf	INTCON
+	movlw	b'10000000'			; BIT7=1: Pullup for PORTB disabled
+	movwf	INTCON2
+	movlw	b'00001000'			
+	movwf	INTCON3
+	movlw	b'00000001'			; Bit0: TMR1
+	movwf	PIE1
+	movlw	b'00000010'			; Bit1: TMR3
+	movwf	PIE2			
+	movlw	b'00000000'			; Bit1: TMR5
+	movwf	PIE5
+	movlw	b'00100001'			; Bit0: RTCC, Bit5: UART2
+	movwf	PIE3
+	movlw	b'00001000'			; Bit3: TMR7
+	movwf	PIE5
+
+    bsf     power_sw1
+    bsf     power_sw2
+
+	return
+
+;=============================================================================
+	global	speed_eco
+speed_eco:
+	movlw	d'1'
+	movff	WREG,speed_setting		; Bank-independent
+	; Done in ISR
+	return
+;=============================================================================
+	global	speed_normal
+speed_normal:
+	movlw	d'2'
+	movff	WREG,speed_setting		; Bank-independent
+	; Done in ISR
+	return
+;=============================================================================
+	global	speed_fastest
+speed_fastest:
+	movlw	d'3'
+	movff	WREG,speed_setting		; Bank-independent
+	; Done in ISR
+	return
+;=============================================================================
+
+    END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ostc3.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,593 @@
+;=============================================================================
+;
+;   File ostc3.asm
+;
+;   OSTC3 Platform definitions
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2011-05-24 : [jDG] Cleanups from initial Matthias code.
+
+;=============================================================================
+
+        LIST      P=18F87K22	; change also: Configure->SelectDevice from Mplab
+
+;#DEFINE __DEBUG
+
+#include <p18f87k22.inc>
+#include <ports.inc>                        ; Portmap
+
+#DEFINE	softwareversion_x		d'0'		; Software version  XX.YY
+#DEFINE	softwareversion_y		d'90'		; Software version  XX.YY
+#DEFINE softwareversion_beta 	0 			; (and 0 for release)
+
+#DEFINE comm_service_key        0xABCDEF
+
+;-----------------------------------------------------------------------------
+
+#DEFINE	CCP1CON_VALUE		b'00001100'		; PWM1 for LED dimming
+#DEFINE T2CON_ECO           b'00000100'		; 1:1 Postscaler, 1:1 Prescaler, Timer 2 start -> 980Hz (Good compromise of no-flicker and efficiency)
+#DEFINE T2CON_NORMAL        b'00001110'
+#DEFINE T2CON_FASTEST       b'00001110'		; 1:2 Postscaler, 1:16 Prescaler, Timer 2 start -> 1960Hz (no-flicker)
+
+; Timing for button hold-down flags
+#DEFINE TMR1H_VALUE_FIRST        .255-.128  ; in steps of 7,8125ms -> 1s
+#DEFINE TMR1H_VALUE_CONT         .255-.32   ; in steps of 7,8125ms -> 0.25s
+#DEFINE TMR1H_VALUE_CONT_DIVE    .255-.64   ; in steps of 7,8125ms -> 0.5s
+
+; Color Definitions: 8Bit RGB b'RRRGGGBB'
+#DEFINE	color_red	    	b'11100000'     ; (7,0,0)
+#DEFINE	color_dark_red	    b'10000101'     ; (4,1,1)
+#DEFINE	color_violet    	b'11101011'     ; (7,2,3)
+#DEFINE	color_blue		    b'11000111'     ; (6,1,3)
+#DEFINE	color_green	        b'00011100'     ; (0,7,0)
+#DEFINE	color_greenish      b'00111110'     ; (1,7,2)
+#DEFINE color_dark_green    b'00111001'     ; (1,6,1)
+#DEFINE	color_yellow 	    b'11111101'     ; (7,7,1)
+#DEFINE	color_white         b'11111111'     ; (7,7,3)
+#DEFINE	color_black         b'00000000'     ; (0,0,0)
+#DEFINE	color_deepblue      b'00000010'     ; (0,0,2)
+#DEFINE	color_grey	        b'11011111'     ; (6,7,3)
+#DEFINE	color_cyan	        b'11011111'     ; (6,7,3)
+#DEFINE	color_lightblue     b'11011011'     ; (6,7,3)
+#DEFINE color_orange        b'11111000'     ; (7,6,0)
+#DEFINE color_pink          b'11111010'     ; (7,6,2)
+
+#DEFINE	FT_TINY             .0
+#DEFINE	FT_SMALL            .1
+#DEFINE	FT_MEDIUM           .2
+#DEFINE	FT_LARGE            .3
+
+#DEFINE	warn_depth          .1
+#DEFINE	warn_cns            .2
+#DEFINE	warn_gf             .3
+#DEFINE	warn_ppo2           .4
+#DEFINE warn_velocity       .5
+#DEFINE warn_ceiling        .6
+#DEFINE	warn_gas_in_gaslist	.7
+#DEFINE	warn_ppo2_hud       .8
+#DEFINE warn_battery        .9
+
+
+; Profile recording parameters
+#DEFINE	logbook_profile_version	0x23
+#DEFINE	samplingrate		.10	; [seconds]
+#DEFINE	samplingrate_apnoe	.1	; [seconds]
+; Warning: Divisors must be <.16 !
+#DEFINE	div_temperature		.6	; x samplingrate [s]
+#DEFINE	div_deco			.6	; x samplingrate [s]
+#DEFINE	div_gf				.12	; x samplingrate [s]
+#DEFINE	div_ppo2_sensors    .2	; x samplingrate [s]
+#DEFINE	div_decoplan		.12	; x samplingrate [s]
+#DEFINE div_cns				.12	; x samplingrate [s]
+#DEFINE div_tank			.0	; x samplingrate [s]
+; Warning: Information lengths must be <.16 !
+#DEFINE infolength_temperature  .2  ; [byte]
+#DEFINE infolength_deco         .2  ; [byte]
+#DEFINE infolength_gf           .1  ; [byte]
+#DEFINE infolength_ppo2_sensors .9  ; [byte]
+#DEFINE infolength_decoplan     .15 ; [byte]
+#DEFINE infolength_cns          .2  ; [byte]
+#DEFINE infolength_tank         .0  ; [byte]
+
+; "Better Gas" behavior
+; better_gas_window <= minimum_change_depth !
+; minimum_change_depth >=5 !
+#DEFINE	minimum_change_depth	.3 			; [m]
+#DEFINE	better_gas_window		.3			; [m]
+
+; Dive mode limits and thresholds
+#DEFINE	start_dive_threshold 	.100	; [cm]
+#DEFINE	high_altitude_dive_threshold .300;[cm]
+#DEFINE	apnoe_timeout			.30 	; [min]
+#DEFINE divemode_menuview_timeout   .10 ; [s]
+#DEFINE	divemode_timeout		.300	; [s]
+#DEFINE	divemode_menu_timeout	.30		; [s]
+#DEFINE	ppo2_warning_low		.19     ; [cbar] (Default value)
+#DEFINE ppo2_lowest_setting     .16     ; [cbar] (Minimum value)
+#DEFINE	ppo2_display_high		.120	; [cbar]
+#DEFINE	ppo2_warning_high		.160    ; [cbar] (Default value)
+#DEFINE ppo2_highest_setting    .160    ; [cbar] (Max. Value)
+#DEFINE	cns_display_high		.70		; [%]
+#DEFINE	cns_warning_high		.100    ; [%]
+#DEFINE	gf_display_high     	.75		; [%]
+#DEFINE	gf_warning_high         .100    ; [%]
+#DEFINE	depth_warn_mbar 		.13000	; [mbar]
+#DEFINE	wake_up_from_sleep		.1160	; [mbar]
+#DEFINE	gf_display_threshold	.20		; [%]
+#DEFINE	simulator_start_depth	.2500	; [mbar] + 1000mbar surface
+#DEFINE simulator_timeout       .15     ; [s]
+
+
+; Surface mode limits and thresholds
+#DEFINE	cns_display_surface_high .70	; [%]
+#DEFINE	high_altitude_threshold	 .880	; [mbar]
+#DEFINE	max_surfpressure		 .1080	; [mbar]
+#DEFINE	timeout_surfacemode		 .90	; [s]
+
+
+; Decomodel paramters
+#DEFINE no_fly_time_ratio		.60		; [%]
+#DEFINE	deco_distance			.10		; [dm]
+
+
+; Color-code parameters for the divemode
+#DEFINE	color_code_cns_high		.100	; [%]
+#DEFINE	color_code_gf_warn_high .101	; [%]
+#DEFINE	color_code_velocity_warn_high .10;[m/min]
+
+; Velocity threshold
+#DEFINE	velocity_warning_level_1	.7	; [m/min]
+
+; Battery thresholds
+#DEFINE lithium_36v_empty       .3050   ; [mV] Saft 3,6V LS14500 AA - threshold for battery percent display
+#DEFINE	lithium_36v_low			.2000	; [mV] (Must be bigger then aa_15v_high!)
+#DEFINE	aa_15v_high				.1550	; [mV] Energizer 1,5V E2 AA
+#DEFINE	aa_15v_low				.1100	; [mV] According to Energizer Datasheet EBC-4201R, Page 2
+#DEFINE color_code_battery_low  .15     ; [%]
+#DEFINE battery_show_level      .30     ; [%]
+
+#DEFINE	current_sleepmode           .62
+#DEFINE	current_backlight_multi     .115    ; *CCPR1L+current_backlight_offset
+#DEFINE	current_backlight_offset    .216
+#DEFINE	current_speed_eco           .1914
+#DEFINE	current_speed_normal        .4027
+#DEFINE	current_speed_fastest       .5050
+#DEFINE current_ir_reciever         .139
+#DEFINE current_compass             .28
+
+; Brightness thresholds (between zero (off) and 255 (max. power))
+#DEFINE	ambient_light_max_high_36V	.220		; When used with a 3,6V battery
+#DEFINE	ambient_light_max_high		.170
+#DEFINE	ambient_light_min_high		.40
+#DEFINE	ambient_light_max_medium 	.155
+#DEFINE	ambient_light_min_medium 	.30
+#DEFINE	ambient_light_max_eco		.120
+#DEFINE	ambient_light_min_eco		.20
+
+; IR Link timeout
+#DEFINE ir_timeout_value            .48         ; multiples of 62,5ms
+
+; Gaslist hard-coded limits
+#DEFINE gaslist_min_o2              .7          ; Minimum O2 [%]
+#DEFINE gaslist_max_change_depth    .100        ; Max. change depth [m]
+#DEFINE gaslist_sp_stepsize         .10         ; Steps for Setpoint Setup [cbar]
+#DEFINE gaslist_sp_max              .160        ; Max. Setpoint [cbar]
+#DEFINE gaslist_sp_min              .50         ; Min. Setpoint [cbar]
+
+;---------------------------- Macros ------------------------------------
+
+TSTOSS  macro opt_reg           ; TeST Option Skip if not Zero
+    movff   opt_reg,WREG
+    tstfsz  WREG,A
+    bra     $+4
+    endm
+
+;---------------------------- Bank0 DATA ------------------------------------
+isr_backup  equ		    0x60
+isr_backup  udata_ovr   isr_backup    ; Reserved space for interupt data
+
+;---- Backup for general registers
+isr_prod    res 2
+
+;---- MS5541 subroutines
+amb_pressure	res	2
+temperature		res	2
+
+W1              res 2           ; Raw (packed) calibration data
+W2              res 2
+W3              res 2
+W4              res 2	        ; 100
+C1              res 2           ; Decoded calibration data
+C2              res 2
+C3              res 2
+C4              res 2           ; Here: C4-250
+C5              res 2           ; Here: Reference Temperature UT1 = 8*C5 + 10000 (u16 range 10.000 .. +42.760)
+C6              res 2
+D1              res 2           ; raw pressure
+D2              res 2           ; raw temperature
+xdT				res	2
+xdT2			res	2
+OFF				res	2
+SENS			res	2
+dLSB            res 1           ;Pressure sensor interface 
+dMSB            res 1
+clock_count     res 1
+sensor_state_counter res 1		; counts to eight for state maschine
+amb_pressure_avg res 2
+temperature_avg	res	2
+minimum_temperature	res 2		; minimum temperature
+last_temperature	res 2
+last_pressure	res 2
+last_pressure_velocity	res 2   ; For velocity
+last_surfpressure res 2
+last_surfpressure_15min res 2
+last_surfpressure_30min res 2
+rel_pressure	res 2
+sim_pressure	res 2   ; hold simulated pressure in mbar if in Simulator mode
+max_pressure	res 2
+avr_rel_pressure	res 2
+avr_rel_pressure_total res 2
+;---- Data for ISR math subroutines
+isr_xC          res 4
+isr_xA          res 2
+isr_xB          res 2
+
+;---- Data for ISR routines
+isr1_temp       res 1           ; ISR temp variable, used in ms5541.asm, isr_rtcc, isr_battery_gauge
+isr2_temp       res 1           ; ISR temp variable, used isr_battery_gauge
+
+;---- Display brightness
+max_CCPR1L		res	1			; Max. brightness value for CCPR1L
+
+; Battery gauge (nAs, nC)
+battery_gauge	res	6			; 48Bit -> 78Ah max...
+
+; IR-Link
+ir_buffer           res .16
+ir_counter          res 1
+ir_timeout          res 1       ; Timeout for valid data
+
+; Compass raw data
+compass_DX          res 2
+compass_DY          res 2
+compass_DZ          res 2
+
+accel_DX            res 2
+accel_DY            res 2
+accel_DZ            res 2
+
+; Compass FILTERED data
+compass_DX_f        res 2
+compass_DY_f        res 2
+compass_DZ_f        res 2
+
+accel_DX_f          res 2
+accel_DY_f          res 2
+accel_DZ_f          res 2
+
+; Compass calibration data
+compass_CX_f        res 2
+compass_CY_f        res 2
+compass_CZ_f        res 2
+
+; Compass more data
+compass_heading     res 2       ; Corrected heading (in 1°) : -180 .. 180
+compass_roll        res 2       ; Rotation around the X axis
+compass_pitch       res 2       ; Rotation arounf the Y axis
+
+compass_a           res 2       ; Tmp data for Q15 arithmetics
+compass_b           res 2
+compass_r           res 3
+
+CNS_start           res 2       ; CNS value at beginning of dive
+GF_start            res 1       ; GF value at beginning of dive
+
+;---------------------------- Common DATA ------------------------------------
+
+common          equ         0x100       ; Alias for "banksel common"
+common          udata_ovr   common      ; Bank1 general variables
+
+;---- Time and Date
+secs         	   		res 1           
+mins            		res 1
+hours           		res 1
+day             		res 1
+month           		res 1
+year            		res 1
+surface_interval		res 2
+
+flag1            		res 1
+flag2           		res 1
+flag3           		res 1
+flag4           		res 1
+flag5           		res 1
+flag6           		res 1
+flag7           		res 1
+flag8           		res 1
+
+temp1			res 1
+temp2			res 1
+
+;---- Interface to wait macros
+wait_temp       res 1
+waitms_temp     res 1
+
+;---- Interface to graphic subroutines (aa_wordprocessor, color_processor, ...)
+win_leftx2      res 1
+win_top         res 1
+win_width       res 2
+win_height      res 1
+win_bargraph    res 1
+win_color1      res 1
+win_color2      res 1
+win_font        res 1
+win_invert      res 1
+
+;---- Draw subroutines
+tft_temp4       res 1
+tft_temp3       res 1
+tft_temp2       res 1
+tft_temp1       res 1
+
+;---- data conversion subroutines
+lo              res 1
+hi              res 1
+up				res 1
+
+;---- RS232 temp variables
+uart1_temp      res 1
+uart2_temp      res 1
+
+;---- Data for math subroutines
+divA            res 2
+divB            res 1
+xC              res 4
+xA              res 2
+xB              res 2
+sub_c           res 2
+sub_a           res 2
+sub_b           res 2
+
+;---- Data for conversion subroutines
+cvt_flags       res 1
+ignore_digits   res 1
+
+#define leftbind            cvt_flags,0
+#define ignore_digit3       cvt_flags,1
+#define ignore_digit4       cvt_flags,2
+#define ignore_digit5       cvt_flags,3
+#DEFINE enable_screen_dumps cvt_flags,4 ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+
+;---- Misc.
+speed_setting        	res 1           ; =1: Eco, =2: Normal, =3: Fastest
+nofly_time              res 2   		; No Fly time in Minutes (Calculated after Dive)
+timeout_counter 		res 1
+timeout_counter2		res 1
+timeout_counter3		res 1
+batt_voltage			res 2			; Battery voltage in mV
+batt_percent            res 1           ; Battery in percent (1-100)
+ambient_light			res 2			; ambient_light level
+lo_temp					res 1
+hi_temp					res 1
+desaturation_time		res 2  
+convert_value_temp      res 3   ; used in menu_battery_state_convert_date 
+active_gas				res 1
+decoplan_page			res 1
+warning_counter			res 1			; Counts amount of warning in divemode
+warning_counter_backup	res 1			; Backup of warning_counter
+warning_page            res 1           ; current # of warning page
+rssi_value              res 1           ; Current RSSI level
+
+; Remind history for menu processor (and such):
+menustack               res 5           ; menu stack
+menupos					res 1           ; Logbook and divemode menu
+menupos2				res 1           ; For dive mode simulator and pre-menu
+menupos3				res 1           ; For Customviews
+menupos4				res 1           ; For divemode menu
+
+; Apnoe stuff that must be in bank common
+apnoe_mins				res 1
+apnoe_secs				res 1
+apnoe_max_pressure		res 2
+
+; Divemode
+divemins				res 2
+divesecs				res 1
+samplesecs_value		res 1
+divisor_temperature		res 1
+divisor_deco			res 1
+divisor_gf				res 1
+divisor_ppo2_sensors	res 1
+divisor_decoplan		res 1
+divisor_cns				res 1
+divisor_tank            res 1
+average_depth_hold      res 4
+average_depth_hold_total res 4
+total_divetime_seconds	res 2
+average_divesecs        res 2   ; For the resettable stopwatch
+decodata				res 2
+apnoe_timeout_counter 	res 1
+apnoe_surface_mins 		res 1
+apnoe_surface_secs		res 1
+
+
+; Profile storing
+AlarmType			res 1
+samplesecs			res 1
+EventByte			res 1
+ProfileFlagByte		res 1
+
+; External flash
+ext_flash_address		res 3	; 24bit Address
+ext_flash_log_pointer	res 3	; 24bit Address for logbook profile storing
+ext_flash_dive_counter  res 3   ; 24bit Counter for dive length (increased in write_byte_ext_flash_plus)
+
+; I2C
+i2c_temp            res 1       ; Temp
+
+; MCP
+mcp_temp            res 4       ; For RX
+
+; O2 Sensor data
+o2_mv_sensor1       res 2       ; in 0.1mV steps
+o2_mv_sensor2       res 2       ; in 0.1mV steps
+o2_mv_sensor3       res 2       ; in 0.1mV steps
+o2_ppo2_sensor1     res 1       ; Sensor1 ppO2 (in 0.01bar steps)
+o2_ppo2_sensor2     res 1       ; Sensor2 ppO2 (in 0.01bar steps)
+o2_ppo2_sensor3     res 1       ; Sensor3 ppO2 (in 0.01bar steps)
+hud_battery_mv      res 2
+hud_status_byte     res 1
+;Status Byte/
+;Bit0 = 1 -> HUD connection ok
+;Bit1 = 1 -> HUD is calibrated
+;Bit2 = 1 -> HUD Battery is low (<3000mV)
+;Bit3 = 1 -> Sensor 1 active
+;Bit4 = 1 -> Sensor 2 active
+;Bit5 = 1 -> Sensor 3 active
+;Bit6 unused in stand-alone HUD
+;Bit7 unused in stand-alone HUD
+
+sensor_setpoint     res 1       ; sensor ppo2 in 0.01bar for deco routine
+
+better_gas_number	res 1       ; number (1-5) of the "better gas" in divemode, =0: no better gas available
+
+;---------------------------- TMP DATA ---------------------------------------
+; Space for various overlayed data from color, word, menu processors, etc.
+; 
+
+tmp             udata_ovr   0x1A0       ; Bank1 shared TMP space
+tmp             equ         0x1A0       ; Alias for CBLOCK directive.
+                res         0x060       ; RESERVED area.
+
+;-----------------------------------------------------------------------------
+; Reserve BANK2 for general purpose buffer (strings, images, etc).
+; NOTE: Needs to be aligned with a bank (LOW(buffer)==0).
+buffer          udata_ovr   0x200
+buffer          res .256
+
+opt_table       equ         0xE00
+opt_table       udata_ovr   opt_table
+
+;---- Dive Options
+opt_gas_O2_ratio        res 5   ; Needed because deco gaslist use N2
+opt_dil_O2_ratio        res 5   ; Must be in line with opt_gas_O2_ratio
+opt_gas_He_ratio        res 5   ; He ratio Gas1-5
+opt_dil_He_ratio        res 5   ; Must be in line with opt_gas_He_ratio
+opt_gas_type            res 5   ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+opt_dil_type            res 5   ; 0=Disabled, 1=First, 2=Normal
+opt_dive_mode           res 1   ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
+opt_ppO2_max            res 1   ; PPO2 Max for MOD calculation and color coding in divemode
+opt_ccr_mode            res 1   ; =0: Fixed SP, =1: Sensor
+opt_ppO2_min            res 1   ; PPO2 min for Sensors and color coding in divemode
+
+;---- Managing Settings
+
+opt_brightness          res 1   ; =0: Eco, =1:Medium, =2:Full
+opt_salinity            res 1	; 0-5%
+#DEFINE opt_name_length    .60  ; Custom text string 5 rows with 12 chars
+opt_name                res opt_name_length
+opt_language            res 1   ; Current language. 0=EN, 1=DE, 2=FR, 3=SP
+opt_units               res 1   ; 0:m/°C, 1:ft/°F
+opt_dateformat			res	1	; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
+opt_last_stop           res 1   ; =3:3m, =4:4m, =5:5m, =6:6m
+opt_aGF_high            res 1   ; Alternative GF HIGH
+opt_aGF_low             res 1   ; Alternative GF LOW
+opt_GF_high             res 1   ; GF HIGH
+opt_GF_low              res 1   ; GF LOW
+opt_enable_aGF          res 1   ; =1: aGF can be selected underwater
+
+;-----------------------------EEPROM DATA ------------------------------------
+; Automatic reset of all options when this is changed:
+#define    eeprom_opt_serial   0x0005   ; Version 0.5
+
+;-----------------------------------------------------------------------------
+; Flags
+#DEFINE	switch_left				flag1,0
+#DEFINE	switch_right			flag1,1			
+#DEFINE neg_flag				flag1,2	; e.g. sub16 (sub_c = sub_a - sub_b)
+#DEFINE pressure_refresh 		flag1,3	; =1: A new pressure/temperature is available
+#DEFINE	sleepmode				flag1,4	; =1: In Sleepmode
+#DEFINE	tft_is_dimming			flag1,5	; =1: The TFT is dimming, ignore light sensor
+#DEFINE	display_velocity		flag1,6	; =1: show velocity
+#DEFINE	no_sensor_int			flag1,7	; =1: block any further access to pressure sensor
+
+#DEFINE	rs232_recieve_overflow	flag2,0	; =1: An RS232 timeout overflow occoured
+#DEFINE	stored_gas_changed		flag2,1	; =1: Stored Gas changed
+#DEFINE	high_altitude_mode		flag2,2	; =1: Unit was manually turned on with ambient pressure <880mbar
+#DEFINE	FLAG_apnoe_mode			flag2,3	; =1: Apnoe mode selected
+#DEFINE	restore_deco_data		flag2,4	; =1: Restore deco data (After simulation)
+#DEFINE premenu					flag2,5	; =1: Premenu/Divemenu selected
+#DEFINE	menubit					flag2,6	; menu
+#DEFINE	simulatormode_active	flag2,7	; =1: Simulator mode active, override pressure sensor readings
+
+#DEFINE divemode_menu           flag3,0	; =1: Divemode menu is shown
+#DEFINE	onesecupdate			flag3,1	; =1 after any second
+#DEFINE twosecupdate			flag3,2	; =1: New two-second update
+#DEFINE	toggle_customview		flag3,3	; =1: Next customview
+#DEFINE	oneminupdate			flag3,4	; =1 after any minute
+#DEFINE	divemode				flag3,5	; =1: in Divemode
+#DEFINE	battery_is_36v          flag3,6	; =1: 3,6V Battery is in use
+#DEFINE	warning_active          flag3,7	; =1: A warning is active in divemode or surfacemode
+
+#DEFINE	better_gas_available	flag4,0	; =1: A better gas is available
+#DEFINE	blinking_better_gas		flag4,1	; =1: Gas is blinking
+#DEFINE menuview                flag4,2 ; =1: A menuview is shown in divemode (e.g. "Menu?")
+#DEFINE quarter_second_update   flag4,3 ; =1: A new 1/4 second has begun
+#DEFINE divemode_gaschange      flag4,4 ; =1: The gas will change very soon
+#DEFINE	decostop_active			flag4,5	; =1: Decompression stop shown
+#DEFINE depth_greater_100m      flag4,6 ; =1: Current Depth > 100m
+#DEFINE	realdive				flag4,7	; =1: A real dive during divemode
+
+#DEFINE	dive_warning_displayed	flag5,0	; =1: The warning sign is shown
+#DEFINE	reset_average_depth		flag5,1	; =1: Reset the average depth
+#DEFINE	store_sample			flag5,2	; =1: Store a new sample
+#DEFINE	divemode2				flag5,3	; =1: Dive longer then one minute
+#DEFINE	FLAG_active_descent		flag5,4	; Used in Apnoe mode
+#DEFINE	event_occured			flag5,5	; =1: An event occured, store it!
+#DEFINE	divemode_menu_active	flag5,6 ; =1: The divemode menu is shown
+#DEFINE	temp_changed			flag5,7	; =1: The temperature changed
+
+#DEFINE gas6_changed            flag6,0	; =1: Gas 6 has been selected/changed underwater
+#DEFINE	onehourupdate			flag6,1	; =1: A new hour has just begun
+#DEFINE	settime_setdate			flag6,2	; =1: In the Set Time or Set Date Menu
+#DEFINE setpoint_changed        flag6,3	; =1: Setpoint has been changed
+#DEFINE second_row_warning      flag6,4	; =1: The second row contains a warning
+#DEFINE FLAG_ccr_mode           flag6,5	; =1: CCR mode (Fixed ppO2 or Sensor) active
+#DEFINE dive_hud1_displayed     flag6,6 ; =1: The Sensor1 HUD reading is displayed
+#DEFINE dive_hud2_displayed     flag6,7 ; =1: The Sensor2 HUD reading is displayed
+
+#DEFINE dive_hud3_displayed     flag7,0 ; =1: The Sensor3 HUD reading is displayed
+#DEFINE no_more_divesecs        flag7,1 ; =1: Do no longer show seconds in divemode
+#DEFINE FLAG_gauge_mode         flag7,2 ; =1: In Gauge mode
+#DEFINE ignore_last_edited_gas  flag7,3 ; Used in gaslist_cleanup_list
+#DEFINE ccr_diluent_setup       flag7,4 ; =1: Setting up Diluents ("Gas6-10")
+#DEFINE menu_show_sensors       flag7,5 ; =1: Update HUD data in menu
+#DEFINE short_gas_decriptions   flag7,6 ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+
+#DEFINE is_bailout              flag8,0 ; =1: Bailout
+#DEFINE is_bailout_menu         flag8,1 ; =1: Bailout
+#DEFINE toggle_gf               flag8,2 ; =1: Toggle GF/aGF
+#DEFINE use_agf                 flag8,3 ; =1: Use aGF (instead of GF)
+#DEFINE battery_removed_in_usb  flag8,4 ; =1: The battery has been removed in USB
+#DEFINE adc_running             flag8,5 ; =1: The ADC is in use
+#DEFINE comm_service_enabled    flag8,6 ; =1: COMM Service mode unlocked
+#DEFINE compass_enabled         flag8,7 ; =1: The compass and accelerometer chip is active
+
+;=============================================================================
+; C-code Routines
+; PART 2
+    extern deco_calc_CNS_decrease_15min    
+    extern deco_calc_CNS_fraction
+    extern deco_calc_desaturation_time
+    extern deco_calc_hauptroutine
+    extern deco_calc_tissue
+    extern deco_calc_percentage
+    extern deco_calc_wo_deco_step_1_min
+    extern deco_calc_dive_interval
+    extern deco_clear_CNS_fraction
+    extern deco_clear_tissue
+    extern deco_pull_tissues_from_vault
+    extern deco_push_tissues_to_vault
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/p2_deco.c	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,2307 @@
+// **************************************************************
+// p2_deco.c
+//
+//  Created on: 12.05.2009
+//  Author: chsw
+//
+// **************************************************************
+
+//////////////////////////////////////////////////////////////////////////////
+// OSTC - diving computer code
+// Copyright (C) 2011 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 char_I_depth_last_deco for Gradient Model
+// 03/31/09 v107: integration of FONT Incon24
+// 05/23/10 v109: 5 gas changes & 1 min timer
+// 07/13/10 v110: cns vault added
+// 12/25/10 v110: split in three files (deco.c, main.c, definitions.h)
+// 2011/01/20: [jDG] Create a common file included in ASM and C code.
+// 2011/01/24: [jDG] Make ascenttime an short. No more overflow!
+// 2011/01/25: [jDG] Fusion deco array for both models.
+// 2011/01/25: [jDG] Use CF(54) to reverse deco order.
+// 2011/02/11: [jDG] Reworked gradient-factor implementation.
+// 2011/02/15: [jDG] Fixed inconsistencies introduced by gas switch delays.
+// 2011/03/21: [jDG] Added gas consumption (CF56 & CF57) evaluation for OCR mode.
+// 2011/04/15: [jDG] Store low_depth in 32bits (w/o rounding), for a better stability.
+// 2011/04/25: [jDG] Added 1mn mode for CNS calculation, to allow it for decoplanning.
+// 2011/04/27: [jDG] Fixed char_O_gradient_factor calculation when model uses gradient-factor.
+// 2011/05/02: [jDG] Added "Future TTS" function (CF58).
+// 2011/05/17: [jDG] Various cleanups.
+// 2011/08/08: [jDG] Computes CNS during deco planning ascent.
+// 2011/11/24: [jDG] Slightly faster and better NDL computation.
+// 2011/12/17: [mH]  Remove of the useless debug stuff
+// 2012/02/24: [jDG] Remove missed stop bug.
+// 2012/02/25: [jDG] Looking for a more stable LOW grad factor reference.
+// 2012/09/10: [mH]  Fill char_O_deco_time_for_log for logbook write
+// 2012/10/05: [jDG] Better deco_gas_volumes accuracy (average depth, switch between stop).
+// 2013/03/05: [jDG] Should vault low_depth too.
+// 2013/03/05: [jDG] Wrobell remark: ascent_to_first_stop works better with finer steps (2sec).
+//
+// TODO:
+//
+// Literature:
+// Bühlmann, Albert: Tauchmedizin; 4. Auflage [2002];
+// 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 <math.h>
+
+// ***********************************************
+// ** V A R I A B L E S   D E F I N I T I O N S **
+// ***********************************************
+
+#include "p2_definitions.h"
+#define TEST_MAIN
+#include "shared_definitions.h"
+
+// Water vapour partial pressure in the lumb.
+#define ppWater        0.0627
+#define METER_TO_BAR   0.09985
+#define BAR_TO_METER   10.0150      // (1.0/METER_TO_BAR)
+
+// Surface security factor
+#define SURFACE_DESAT_FACTOR    0.7042
+
+// *************************
+// ** P R O T O T Y P E S **
+// *************************
+
+static void calc_hauptroutine(void);
+static void calc_nullzeit(void);
+
+static void calc_tissue(PARAMETER unsigned char period);
+static void calc_limit(void);
+
+static void clear_tissue(void);
+static void calc_ascenttime(void);
+static void update_startvalues(void);
+static void clear_deco_table(void);
+static unsigned char update_deco_table(void);
+
+static void sim_tissue(PARAMETER unsigned char period);
+static void sim_limit(PARAMETER float GF_current);
+static void sim_extra_time(void);
+static void calc_dive_interval(void);
+
+static void calc_gradient_factor(void);
+static void calc_wo_deco_step_1_min(void);
+
+static void calc_hauptroutine_data_input(void);
+static void calc_hauptroutine_update_tissues(void);
+static void calc_hauptroutine_calc_deco(void);
+static void sim_ascent_to_first_stop(void);
+
+static unsigned char gas_switch_deepest(void);
+static void gas_switch_set(void);
+
+static unsigned char calc_nextdecodepth(void);
+
+//---- Bank 5 parameters -----------------------------------------------------
+#ifndef UNIX
+#   pragma udata bank5=0x500
+#endif
+
+static float			GF_low;
+static float			GF_high;
+static float			GF_delta;
+static float			locked_GF_step;             // GF_delta / low_depth
+
+static unsigned char    temp_depth_limit;
+static unsigned char    low_depth;                  // Depth of deepest stop
+
+// Simulation context: used to predict ascent.
+static unsigned char	sim_lead_tissue_no;         // Leading compatiment number.
+static float			sim_lead_tissue_limit;      // Buhlmann tolerated pressure.
+
+// Real context: what we are doing now.
+static float			calc_lead_tissue_limit;     //
+
+static unsigned char	internal_deco_time[NUM_STOPS];
+static unsigned char	internal_deco_depth[NUM_STOPS];
+
+static float cns_vault;
+static float low_depth_vault;
+static float pres_tissue_N2_vault[NUM_COMP];
+static float pres_tissue_He_vault[NUM_COMP];
+
+//---- Bank 6 parameters -----------------------------------------------------
+#ifndef UNIX
+#   pragma udata bank6=0x600
+#endif
+
+static unsigned char	ci;
+static float 		pres_respiration;
+static float		pres_surface;
+static float		temp_deco;
+static float		ppN2;
+static float		ppHe;
+static float		temp_tissue;
+static float		N2_ratio;       // Breathed gas nitrogen ratio.
+static float		He_ratio;       // Breathed gas helium ratio.
+static float 		var_N2_a;       // Bühlmann a, for current N2 tissue.
+static float 		var_N2_b;       // Bühlmann b, for current N2 tissue.
+static float 		var_He_a;       // Bühlmann a, for current He tissue.
+static float 		var_He_b;       // Bühlmann b, for current He tissue.
+static float  		var_N2_e;       // Exposition, for current N2 tissue.
+static float  		var_He_e;       // Exposition, for current He tissue.
+static float            var_N2_ht;      // Half-time for current N2 tissue.
+static float            var_He_ht;      // Half-time for current N2 tissue.
+
+static float            pres_diluent;                   // new in v.101
+static float            const_ppO2;                     // new in v.101
+
+static unsigned char    sim_gas_last_depth;             // Depth of last used gas, to detected a gas switch.
+static unsigned char    sim_gas_last_used;              // Number of last used gas, to detected a gas switch.
+static unsigned short   sim_dive_mins;                  // Simulated dive time.
+static float		calc_N2_ratio;                  // Simulated (switched) nitrogen ratio.
+static float		calc_He_ratio;                  // Simulated (switched) helium ratio.
+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
+//static char		flag_in_divemode;		// new in v.108
+
+static unsigned char    deco_gas_change[NUM_GAS];       // new in v.109
+
+//---- Bank 7 parameters -----------------------------------------------------
+#ifndef UNIX
+#   pragma udata bank7=0x700
+#endif
+
+float  pres_tissue_N2[NUM_COMP];
+float  pres_tissue_He[NUM_COMP];
+float  sim_pres_tissue_N2[NUM_COMP];             // 16 floats = 64 bytes.
+float  sim_pres_tissue_He[NUM_COMP];             // 16 floats = 64 bytes.
+
+//---- Bank 8 parameters -----------------------------------------------------
+#ifndef UNIX
+#   pragma udata overlay bank8=0x800
+    static char	  md_pi_subst[256];
+#   define C_STACK md_pi_subst      // Overlay C-code data stack here, too.
+#endif
+
+// Back to bank6 for further tmp data
+#ifndef UNIX
+#   pragma udata bank6
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+///////////////////////////// THE LOOKUP TABLES //////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//
+// End of PROM code is 17F00, So push tables on PROM top...
+//
+#ifndef UNIX
+#   pragma romdata buhlmann_tables = 0x1DD00  // Needs to be in UPPER bank.
+#endif
+
+#include "p2_tables.romdata" 		        // new table for deco_main_v.101 (var_N2_a modified)
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+////////////////////////////// THE SUBROUTINES ///////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//
+// all new in v.102
+// moved from 0x0D000 to 0x0C000 in v.108
+#ifndef UNIX
+#   pragma code p2_deco = 0x0C000
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+///////////////////////  U T I L I T I E S   /////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// Bump to blue-screen when an assert is wrong
+#ifdef __DEBUG
+void assert_failed(PARAMETER short int line)
+{
+}
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// When calling C code from ASM context, the data stack pointer and
+// frames should be reset. Bank8 is used by stack
+
+#ifdef CROSS_COMPILE
+#       define RESET_C_STACK
+#else
+#   ifdef __DEBUG
+#       define RESET_C_STACK fillDataStack();
+        void fillDataStack(void)
+        {
+            _asm
+                LFSR    1,C_STACK
+                MOVLW   0xCC
+        loop:   MOVWF   POSTINC1,0
+                TSTFSZ  FSR1L,0
+                BRA     loop
+
+                LFSR    1,C_STACK
+                LFSR    2,C_STACK
+            _endasm
+        }
+#   else
+#       define RESET_C_STACK    \
+        _asm                    \
+            LFSR    1, C_STACK  \
+            LFSR    2, C_STACK  \
+        _endasm
+#   endif
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// Fast subroutine to read timer 5.
+// Note: result is in 1/32 of msecs (30,51757813µs/bit to be precise)
+static unsigned short tmr5(void)
+{
+#ifndef CROSS_COMPILE
+    _asm
+        movff   0xf7c,PRODL     // TMR5L
+        movff   0xf7d,PRODH     // TMR5H
+    _endasm                     // result in PRODH:PRODL.
+#else
+    return 0;
+#endif
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// read buhlmann tables A and B for compatriment ci
+//
+static void read_buhlmann_coefficients(void)
+{
+#ifndef CROSS_COMPILE
+    // Note: we don't use far rom pointer, because the
+    //       24 bits is too complex, hence we have to set
+    //       the UPPER page ourself...
+    //       --> Set zero if tables are moved to lower pages !
+    _asm
+        movlw 1
+        movwf TBLPTRU,0
+    _endasm
+#endif
+
+    assert( ci < NUM_COMP );
+
+    // Use an interleaved array (AoS) to access coefficients with a
+    // single addressing.
+    {
+        overlay rom const float* ptr = &buhlmann_ab[4*ci];
+        var_N2_a = *ptr++;
+        var_N2_b = *ptr++;
+        var_He_a = *ptr++;
+        var_He_b = *ptr++;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// read buhlmann tables for compatriment ci
+// If period == 0 : 2sec interval
+//              1 : 1 min interval
+//              2 : 10 min interval.
+static void read_buhlmann_times(PARAMETER char period)
+{
+#ifndef CROSS_COMPILE
+    // Note: we don't use far rom pointer, because the
+    //       24 bits is to complex, hence we have to set
+    //       the UPPER page ourself...
+    //       --> Set zero if tables are moved to lower pages !
+    _asm
+        movlw 1
+        movwf TBLPTRU,0
+    _endasm
+#endif
+
+    assert( ci < NUM_COMP );
+
+    // Integration intervals.
+    switch(period)
+    {
+    case 0: //---- 2 sec -----------------------------------------------------
+        {
+            overlay rom const float* ptr = &e2secs[2*ci];
+            var_N2_e = *ptr++;
+            var_He_e = *ptr++;
+        }
+        break;
+
+    case 1: //---- 1 min -----------------------------------------------------
+       {
+            overlay rom const float* ptr = &e1min[2*ci];
+            var_N2_e = *ptr++;
+            var_He_e = *ptr++;
+        }
+        break;
+
+    case 2: //---- 10 min ----------------------------------------------------
+        {
+            overlay rom const float* ptr = &e10min[2*ci];
+            var_N2_e = *ptr++;
+            var_He_e = *ptr++;
+        }
+        break;
+
+    default:
+        assert(0);  // Never go there...
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// read buhlmann tables for compatriment ci
+//
+static void read_buhlmann_ht(void)
+{
+
+#ifndef CROSS_COMPILE
+    // Note: we don't use far rom pointer, because the
+    //       24 bits is to complex, hence we have to set
+    //       the UPPER page ourself...
+    //       --> Set zero if tables are moved to lower pages !
+    _asm
+        movlw 1
+        movwf TBLPTRU,0
+    _endasm
+#endif
+
+    assert( ci < NUM_COMP );
+    {
+        overlay rom const float* ptr = &buhlmann_ht[2*ci];
+        var_N2_ht = *ptr++;
+        var_He_ht = *ptr++;
+    }
+
+    assert( 4.0    <= var_N2_ht && var_N2_ht <= 635.0 );
+    assert( 1.5099 <= var_He_ht && var_He_ht <= 240.03 );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_nextdecodepth
+//
+// new in v.102
+//
+// INPUT, changing during dive:
+//      temp_deco
+//      low_depth
+//
+// INPUT, fixed during dive:
+//      pres_surface
+//      GF_delta
+//      GF_high
+//      GF_low
+//      char_I_depth_last_deco
+//      float_deco_distance
+//
+// RETURN TRUE iff a stop is needed.
+//
+// OUTPUT
+//      locked_GF_step
+//      temp_depth_limt
+//      low_depth
+//
+static unsigned char calc_nextdecodepth(void)
+{
+    //--- Max ascent speed ---------------------------------------------------
+    // Recompute leading gas limit, at current depth:
+    overlay float depth = (temp_deco - pres_surface) * BAR_TO_METER;
+
+    // At most, ascent 1 minute, at 10m/min == 10.0 m.
+    overlay float min_depth = (depth > 10.0) ? (depth - 10.0) : 0.0;
+
+    // Do we need to stop at current depth ?
+    overlay unsigned char need_stop = 0;
+
+    assert( depth >= -0.2 );        // Allow for 200mbar of weather change.
+
+    //---- ZH-L16 + GRADIENT FACTOR model ------------------------------------
+	if( char_I_deco_model != 0 )
+	{
+        overlay unsigned char first_stop = 0;
+        overlay float p;
+
+        sim_limit( GF_low );
+        p = sim_lead_tissue_limit - pres_surface;
+        if( p <= 0.0f )
+            goto no_deco_stop;          // We can surface directly...
+
+        p *= BAR_TO_METER;
+        if( p < min_depth )
+            goto no_deco_stop;          // First stop is higher than 1' ascent.
+
+        first_stop = 3 * (short)(0.99999 + p*0.333333);
+        assert( first_stop < 128 );
+
+        // Apply correction for the shallowest stop.
+        if( first_stop == 3 )                           // new in v104
+            first_stop = char_I_depth_last_deco;        // Use last 3m..6m instead.
+
+        // Store the deepest point needing a deco stop as the LOW reference for GF.
+        // NOTE: following stops will be validated using this LOW-HIGH gf scale,
+        //       so if we want to keep coherency, we should not validate this stop
+        //       yet, but apply the search to it, as for all the following stops afterward.
+        if( first_stop > low_depth )
+        {
+            low_depth = first_stop;
+            locked_GF_step = GF_delta / first_stop;
+        }
+
+        // We have a stop candidate.
+        // But maybe ascending to the next stop will diminish the constraint,
+        // because the GF might decrease more than the preassure gradient...
+        while(first_stop > 0)
+        {
+            overlay unsigned char next_stop;            // Next depth (0..90m)
+            overlay float pres_stop;                    // Next pressure (bar)
+
+            // Check max speed, or reaching surface.
+            if( first_stop <= min_depth )
+                goto no_deco_stop;
+
+            if( first_stop <= char_I_depth_last_deco )  // new in v104
+                next_stop = 0;
+            else if( first_stop == 6 )
+                next_stop = char_I_depth_last_deco;
+            else
+                next_stop = first_stop - 3;             // Index of next (upper) stop.
+
+            // Just a check we are indeed above LOW ref.
+            assert( next_stop < low_depth );
+
+            // Total preassure at the new stop candidate:
+            pres_stop =  next_stop * METER_TO_BAR
+    	              + pres_surface;
+
+            // Keep GF_low until a first stop depth is found:
+            sim_limit( GF_high - next_stop * locked_GF_step );
+
+            // Check upper limit (lowest pressure tolerated):
+            if( sim_lead_tissue_limit >= pres_stop )    // check if ascent to next deco stop is ok
+                goto deco_stop_found;
+
+            // Else, validate that stop and loop...
+            first_stop = next_stop;
+        }
+        assert( first_stop == 0 );
+
+no_deco_stop:
+		temp_depth_limit = min_depth;
+        goto done;
+
+        // next stop is the last validated depth found, aka first_stop
+deco_stop_found:
+        need_stop = 1;                  // Hit.
+        temp_depth_limit = first_stop;  // Stop depth, in meter.
+
+done:
+        ;
+    }
+    else //---- ZH-L16 model -------------------------------------------------
+    {
+        overlay float pres_gradient;
+
+        // Original model
+        // optimized in v.101
+        // char_I_depth_last_deco included in v.101
+
+        // Compute sim_lead_tissue_limit too, but just once.
+        sim_limit(1.0);
+
+        pres_gradient = sim_lead_tissue_limit - pres_surface;
+        if (pres_gradient >= 0)
+        {
+            pres_gradient *= BAR_TO_METER/3;                        // Bar --> stop number;
+            temp_depth_limit = 3 * (short) (pres_gradient + 0.99);  // --> metre : depth for deco
+            need_stop = 1;                                          // Hit.
+
+            // Implement last stop at 4m/5m/6m...
+            if( temp_depth_limit == 3 )
+                temp_depth_limit = char_I_depth_last_deco;
+        }
+        else
+            temp_depth_limit = 0;
+    }
+
+    //---- Check gas change --------------------------------------------------
+    need_stop |= gas_switch_deepest();  // Update temp_depth_limit if there is a change,
+
+    return need_stop;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// copy_deco_table
+//
+// Buffer the stops, once computed, so we can continue to display them
+// while computing the next set.
+//
+static void copy_deco_table(void)
+{
+    // Copy depth of the first (deepest) stop, because when reversing
+    // order, it will be hard to find...
+    char_O_first_deco_depth = internal_deco_depth[0] & 0x7F;
+    char_O_first_deco_time  = internal_deco_time [0];
+
+    {
+        overlay unsigned char x, y;
+
+        for(x=0; x<NUM_STOPS; x++)
+        {
+            char_O_deco_depth[x] = internal_deco_depth[x];
+            char_O_deco_time [x] = internal_deco_time [x];
+        }
+
+        //Now fill the char_O_deco_time_for_log array
+        //---- First: search the first non-null depth
+        for(x=(NUM_STOPS-1); x != 0; --x)
+            if( internal_deco_depth[x] != 0 ) break;
+
+        //---- Second: copy to output table (in reverse order)
+        for(y=0; y<NUM_STOPS; y++, --x)
+        {
+            char_O_deco_time_for_log[y] = internal_deco_time [x];
+
+            // Stop only once the last transfer is done.
+            if( x == 0 ) break;
+        }
+
+        //---- Third: fill table end with null
+        for(y++; y<NUM_STOPS; y++)
+        {
+            char_O_deco_time_for_log [y] = 0;
+        }
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// temp_tissue_safety //
+//
+// outsourced in v.102
+//
+// Apply safety factors for brand ZH-L16 model.
+//
+static void temp_tissue_safety(void)
+{
+    assert( 0.0 <  float_desaturation_multiplier && float_desaturation_multiplier <= 1.0 );
+    assert( 1.0 <= float_saturation_multiplier   && float_saturation_multiplier   <= 2.0 );
+
+	if( char_I_deco_model == 0 )
+	{
+		if( temp_tissue < 0.0 )
+			temp_tissue *= float_desaturation_multiplier;
+ 		else
+			temp_tissue *= float_saturation_multiplier;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+// ** THE JUMP-IN CODE **
+// ** for the asm code **
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// Called every 2 seconds during diving.
+// update tissues every time.
+//
+// Every 6 seconds (or slower when TTS > 16):
+//    - update deco table (char_O_deco_time/depth) with new values.
+//    - update ascent time,
+//    - set status to zero (so we can check there is new results).
+//
+void deco_calc_hauptroutine(void)
+{
+    RESET_C_STACK
+    calc_hauptroutine();
+    int_O_desaturation_time = 65535;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Reset decompression model:
+// + Set all tissues to equilibrium with Air at ambient pressure.
+// + Reset last stop to 0m
+// + Reset all model output.
+void deco_clear_tissue(void)
+{
+    RESET_C_STACK
+    clear_tissue();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Called every 1 min during decoplanning.
+// Update tissues for 1 min.
+//
+void deco_calc_tissue(void)
+{
+    RESET_C_STACK
+    calc_hauptroutine_update_tissues();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void deco_calc_wo_deco_step_1_min(void)
+{
+    RESET_C_STACK
+    calc_wo_deco_step_1_min();
+    deco_calc_desaturation_time();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void deco_calc_dive_interval(void)
+{
+    RESET_C_STACK
+    calc_dive_interval();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Find current gas in the list (if any).
+//
+// Input:  char_I_current_gas = 1..6
+//
+// Output: sim_gas_last_depth = 0..5, temp_depth_limit.
+//
+static void gas_switch_find_current(void)
+{
+    assert( 0 < char_I_current_gas && char_I_current_gas <= (NUM_GAS+1) );
+
+    if( char_I_current_gas <= NUM_GAS )                 // Gas1..Gas5
+    {
+        sim_gas_last_used  = char_I_current_gas;
+
+        // Note: if current is first gas, we must find it, but not set
+        //       last depth change to surface.
+        if( char_I_deco_gas_change[sim_gas_last_used-1] )
+            sim_gas_last_depth = char_I_deco_gas_change[sim_gas_last_used-1];
+    }
+    else
+        sim_gas_last_used = 0;                          // Gas 6 = manual set
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Find deepest available gas.
+//
+// Input:  temp_depth_limit,
+//         deco_gas_change[]
+//         sim_gas_depth_used, sim_dive_mins.
+//
+// RETURNS TRUE if a stop is needed for gas switch.
+//
+// Output: temp_depth_limit, sim_gas_depth_used IFF the is a switch.
+//
+// NOTE: might be called from bottom (when sim_gas_delay and sim_gas_depth_used
+//       are null), or during the ascent to make sure we are not passing a
+//       stop (in which case both can be already set).
+//
+static unsigned char gas_switch_deepest(void)
+{
+    overlay unsigned char switch_deco = 0, switch_last = 0;
+
+    if (char_I_const_ppO2 == 0)
+    {
+        overlay unsigned char j;
+
+        // Loop over all enabled gas, to find the deepest one,
+        // above last used gas, but below temp_depth_limit.
+        for(j=0; j<NUM_GAS; ++j)
+        {
+            // Gas not (yet) allowed ? Skip !
+            if( temp_depth_limit > deco_gas_change[j] )
+                continue;
+
+            // Gas deeper (or equal) than the current one ? Skip !
+            if( sim_gas_last_depth && deco_gas_change[j] >= sim_gas_last_depth )
+                continue;
+
+            // First, or deeper ?
+            if( switch_deco < deco_gas_change[j] )
+            {
+                switch_deco = deco_gas_change[j];
+                switch_last = j+1;  // 1..5
+            }
+        }
+    }
+
+    // If there is a better gas available
+    if( switch_deco )
+    {
+        assert( !sim_gas_last_depth || sim_gas_last_depth > switch_deco );
+
+        sim_gas_last_depth = switch_deco;
+        sim_gas_last_used  = switch_last;
+        return 0;
+    }
+    return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Calculate gas switches
+//
+//
+// Input:  N2_ratio, He_ratio.
+//         sim_gas_last_used
+//
+// Output: calc_N2_ratio, calc_He_ratio
+//
+static void gas_switch_set(void)
+{
+    assert( sim_gas_last_used <= NUM_GAS );
+
+    if( sim_gas_last_used == 0 )    // Gas6 = manualy set gas.
+    {
+        calc_N2_ratio = N2_ratio;
+	    calc_He_ratio = He_ratio;
+    }
+    else
+    {
+        calc_N2_ratio = char_I_deco_N2_ratio[sim_gas_last_used-1] * 0.01;
+	    calc_He_ratio = char_I_deco_He_ratio[sim_gas_last_used-1] * 0.01;
+    }
+
+    assert( 0.0 <= calc_N2_ratio && calc_N2_ratio <= 0.95 );
+    assert( 0.0 <= calc_He_ratio && calc_He_ratio <= 0.95 );
+    assert( (calc_N2_ratio + calc_He_ratio) <= 1.00 );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Input: calc_N2_ratio, calc_He_ratio : simulated gas mix.
+//        temp_deco : simulated respiration pressure
+//        float_deco_distance : security factor.
+//        Water-vapor pressure inside limbs (ppWater).
+//
+// Output: ppN2, ppHe.
+//
+static void sim_alveolar_presures(void)
+{
+    overlay float deco_diluent = temp_deco;                 // new in v.101
+
+    // Take deco offset into account, but not at surface.
+    // Note: this should be done on ambiant pressure, hence before
+    //       computing the diluant partial pressure...
+    if( deco_diluent > pres_surface )
+        deco_diluent += float_deco_distance;
+
+    //---- CCR mode : deco gas switch ? --------------------------------------
+    if( char_I_const_ppO2 != 0 )
+   	{
+        // In CCR mode, use calc_XX_ratio instead of XX_ratio.
+        // Note: PPO2 and ratios are known outside the lumbs, so there is no
+        //       ppWater in the equations below:
+        deco_diluent -= const_ppO2;
+        deco_diluent /= calc_N2_ratio + calc_He_ratio;
+
+        if (deco_diluent > temp_deco)
+    	    deco_diluent = temp_deco;
+  	}
+
+    if( deco_diluent > ppWater )
+    {
+        ppN2 = calc_N2_ratio * (deco_diluent - ppWater);
+        ppHe = calc_He_ratio * (deco_diluent - ppWater);
+    }
+    else
+    {
+        ppN2 = 0.0;
+        ppHe = 0.0;
+    }
+    assert( 0.0 <= ppN2 && ppN2 < 14.0 );
+    assert( 0.0 <= ppHe && ppHe < 14.0 );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// clear_tissue
+//
+// optimized in v.101 (var_N2_a)
+//
+// preload tissues with standard pressure for the given ambient pressure.
+// Note: fixed N2_ratio for standard air.
+//
+static void clear_tissue(void)
+{
+    overlay float p;
+
+    // Kludge: the 0.0002 of 0.7902 are missing with standard air.
+    N2_ratio = 0.7902;
+    pres_respiration = int_I_pres_respiration * 0.001;
+
+    p = N2_ratio * (pres_respiration -  ppWater);
+    for(ci=0; ci<NUM_COMP; ci++)
+    {
+        // cycle through the 16 Bühlmann N2 tissues
+        pres_tissue_N2[ci] = p;
+
+        // cycle through the 16 Bühlmann tissues for Helium
+        pres_tissue_He[ci] = 0.0;
+    }
+
+    clear_deco_table();
+//    flag_in_divemode = 0;
+    char_O_deco_status = 0;
+    char_O_nullzeit = 0;
+    int_O_ascenttime = 0;
+    char_O_gradient_factor = 0;
+    char_O_relative_gradient_GF = 0;
+
+    calc_lead_tissue_limit = 0.0;
+    char_O_gtissue_no = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_hauptroutine
+//
+// this is the major code in dive mode calculates:
+// 		the tissues,
+//		the bottom time,
+//		and simulates the ascend with all deco stops.
+//
+// The deco_state sequence is :
+//       3 (at surface)
+// +---> 0 : calc nullzeit
+// |     2 : simulate ascent to first stop (at 10m/min, less that 16x 1min simu)
+// | +-> 1 : simulate up to 16min of stops.
+// | +------< not finished
+// +--------< finish
+//
+// Added steps 6,5 for @+5 calculation:
+//      6 = ascent to first stop (same as 2), except continue to 7
+//      7 = same as 1, except loop to 7.
+//
+static void calc_hauptroutine(void)
+{
+    static unsigned char backup_gas_used;
+    static unsigned char backup_gas_depth;
+
+    calc_hauptroutine_data_input();
+
+    calc_hauptroutine_update_tissues();
+    calc_gradient_factor();
+
+    // toggle between calculation for nullzeit (bottom time),
+    //                deco stops
+    //                and more deco stops (continue)
+    switch( char_O_deco_status )
+    {
+    case 3: //---- At surface: start a new dive ------------------------------
+    	clear_deco_table();
+    	copy_deco_table();
+    	int_O_ascenttime = 0;       // Reset DTR.
+    	int_O_extra_ascenttime = 0;
+    	char_O_nullzeit = 0;        // Reset bottom time.
+        char_O_deco_status = 0;     // Calc bottom-time/nullzeit next iteration.
+
+        // Values that should be reset just once for the full real dive.
+        // This is used to record the lowest stop for the whole dive,
+        // Including ACCROSS all simulated ascent.
+        low_depth = 0;
+        locked_GF_step = 0.0;
+
+        // Reset gas switch history.
+        backup_gas_used  = sim_gas_last_used  = 0;
+        backup_gas_depth = sim_gas_last_depth = 0;
+        sim_dive_mins = 0;
+        break;
+
+    case 0: //---- bottom time -----------------------------------------------
+    default:
+        gas_switch_find_current();              // Lookup for current gas & time.
+        gas_switch_set();                       // setup calc_ratio's
+
+    	calc_nullzeit();
+        if( char_O_nullzeit > 0 )               // Some NDL time left ?
+        {
+            char_O_deco_status = 0;             // YES: recalc ndl next time.
+            clear_deco_table();                 // Also clear stops !
+            copy_deco_table();
+            char_O_deco_last_stop = 0;          // And last stop (OSTC menu anim)
+        }
+        else
+            char_O_deco_status = 2;             // NO: calc ascent next time.
+    	break;
+
+    case 2: //---- Simulate ascent to first stop -----------------------------
+    case 6: // @+5min variation
+        // Check proposed gas at begin of ascent simulation
+        sim_dive_mins = int_I_divemins;         // Init current time.
+
+       	gas_switch_find_current();              // Lookup for current gas & time.
+        gas_switch_set();                       // setup calc_ratio's
+
+        backup_gas_used  = sim_gas_last_used;   // And save for later simu steps.
+        backup_gas_depth = sim_gas_last_depth;  // And save for later simu steps.
+
+    	sim_ascent_to_first_stop();
+
+        // Calc stops next time (deco or gas switch).
+        char_O_deco_status = 1 | ( char_O_deco_status & 4 );
+    	break;
+
+    case 1: //---- Simulate stops --------------------------------------------
+    case 5: // @+5 variation.
+    	calc_hauptroutine_calc_deco();
+
+        // If simulation is finished, restore the GF low reference, so that
+        // next ascent simulation is done from the current depth:
+    	if( (char_O_deco_status & 3) == 0 )
+    	{
+            sim_gas_last_used  = backup_gas_used;
+            sim_gas_last_depth = backup_gas_depth;
+        }
+    	break;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_hauptroutine_data_input
+//
+// Reset all C-code dive parameters from their ASM-code values.
+// Detect gas change condition.
+//
+void calc_hauptroutine_data_input(void)
+{
+    overlay short int_temp;
+    overlay unsigned char g;
+
+    pres_respiration    = int_I_pres_respiration * 0.001;
+    pres_surface        = int_I_pres_surface     * 0.001;
+    N2_ratio            = char_I_N2_ratio        * 0.01;
+    He_ratio            = char_I_He_ratio        * 0.01;
+    float_deco_distance = char_I_deco_distance   * 0.01;     // Get offset is in mbar.
+
+    // ____________________________________________________
+    //
+    // _____________ G A S _ C H A N G E S ________________
+    // ____________________________________________________
+
+    // Keep a margin of 150mbar = 1.50m
+    int_temp = (int_I_pres_respiration - int_I_pres_surface)
+             + MBAR_REACH_GASCHANGE_AUTO_CHANGE_OFF;
+
+    // Gas are selectable if we did not pass the change depth by more than 1.50m:
+    for(g=0; g < NUM_GAS; ++g)
+    {
+        deco_gas_change[g] = 0;
+        if(char_I_deco_gas_change[g])
+            if( int_temp > 100 *(short)char_I_deco_gas_change[g] )
+            	deco_gas_change[g] = char_I_deco_gas_change[g];
+    }
+
+    const_ppO2 = char_I_const_ppO2 * 0.01;
+    float_desaturation_multiplier = char_I_desaturation_multiplier * 0.01;
+    float_saturation_multiplier   = char_I_saturation_multiplier   * 0.01;
+    GF_low   = char_I_GF_Low_percentage  * 0.01;
+    GF_high  = char_I_GF_High_percentage * 0.01;
+    GF_delta = GF_high - GF_low;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//
+void calc_hauptroutine_update_tissues(void)
+{
+    assert( 0.00 <= N2_ratio && N2_ratio <= 1.00 );
+    assert( 0.00 <= He_ratio && He_ratio <= 1.00 );
+    assert( (N2_ratio + He_ratio) <= 0.95 );
+    assert( 0.800 < pres_respiration && pres_respiration < 14.0 );
+
+    pres_diluent = pres_respiration;
+    if( char_I_const_ppO2 != 0 )
+    {
+        overlay float flush_ppO2 = pres_respiration * (1.0 - N2_ratio - He_ratio);
+
+        pres_diluent -= const_ppO2;
+        pres_diluent /= N2_ratio + He_ratio;
+        if( pres_diluent < 0.0 )
+            pres_diluent = 0.0;
+        if( pres_diluent > pres_respiration )
+            pres_diluent = pres_respiration;
+
+        char_O_diluent = (unsigned char)(pres_diluent/pres_respiration*100.0 + 0.5);
+
+        if( flush_ppO2 > 2.545) flush_ppO2 = 2.55;
+        if( flush_ppO2 < 0.0  ) flush_ppO2 = 0.0;
+        char_O_flush_ppO2 = (unsigned char)(flush_ppO2*100.0 + 0.5);
+    }
+
+    if( pres_diluent > ppWater )
+    {
+     	overlay float EAD, END;
+
+        ppN2 = N2_ratio * (pres_diluent - ppWater); 
+        ppHe = He_ratio * (pres_diluent - ppWater);
+
+        // EAD : Equivalent Air Dive. Equivalent depth for the same N2 level
+        //       with plain air.
+        //       ppN2 = 79% * (P_EAD - ppWater)
+        //       EAD = (P_EAD - Psurface) * 10
+        //   ie: EAD = (ppN2 / 0.7902 + ppWater -Psurface) * 10
+        EAD = (ppN2 / 0.7902 + ppWater - pres_surface) * BAR_TO_METER;
+        if( EAD < 0.0 || EAD > 245.5 ) EAD = 0.0;
+        char_O_EAD = (unsigned char)(EAD + 0.5);
+
+        // END : Equivalent Narcotic Dive.
+        //       Here we count O2 as narcotic too. Hence everything but helium (has a narcosis factor of
+        //       0.23 btw). Hence the formula becomes:
+        //       END * BarPerMeter * (1.0 - 0.0) - ppWater + Psurface == Pambient - ppHe - ppWater
+        //  ie:  END = (Pambient - ppHe - Psurface) * BAR_TO_METER
+        //
+        // Source cited:
+        //       The Physiology and Medicine of Diving by Peter Bennett and David Elliott,
+        //       4th edition, 1993, W.B.Saunders Company Ltd, London.
+        END = (pres_respiration - ppHe - pres_surface) * BAR_TO_METER;
+        if( END < 0.0 || END > 245.5 ) END = 0.0;
+        char_O_END = (unsigned char)(END  + 0.5);
+    }
+    else																		// new in v.101
+    {
+        ppN2 = 0.0;
+        ppHe = 0.0;
+        char_O_EAD = char_O_END = 0;
+    }
+
+    if(!char_I_step_is_1min)
+        calc_tissue(0);
+    else
+        calc_tissue(1);
+
+    // Calc limit for surface, ie. GF_high.
+    calc_limit();
+
+    int_O_gtissue_limit = (short)(calc_lead_tissue_limit * 1000);
+    int_O_gtissue_press = (short)((pres_tissue_N2[char_O_gtissue_no] + pres_tissue_He[char_O_gtissue_no]) * 1000);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Compute stops.
+//
+// Note: because this can be very long, break on 16 iterations, and set state
+//       to 0 when finished, or to 1 when needing to continue.
+// Note: because each iteration might be very long too (~ 66 ms in 1.84beta),
+//       break the loop when total time > 512msec.
+//
+void calc_hauptroutine_calc_deco(void)
+{
+    overlay unsigned char loop;
+
+    for(loop = 0; loop < 32; ++loop)
+    {
+        // Limit loops to 512ms, using timer 5:
+      	if( tmr5() & (512*32) )
+      	    break;
+        // Do not ascent while doing a gas switch ?
+            if( calc_nextdecodepth() )
+            {
+                if( temp_depth_limit == 0 )
+                    goto Surface;
+
+                //---- We hit a stop at temp_depth_limit ---------------------
+                temp_deco = temp_depth_limit * METER_TO_BAR // Convert to relative bar,
+                              + pres_surface;                   // To absolute.
+                if( !update_deco_table() )                  // Adds a one minute stops.
+                    goto Surface;                           // Deco table full: abort...
+            }
+            else
+            {
+                //---- No stop -----------------------------------------------
+                temp_deco -= (10*METER_TO_BAR);             // Ascend 10m, no wait.
+
+                //---- Finish computations once surface is reached -----------
+                if( temp_deco <= pres_surface )
+                {
+Surface:
+                    if( char_O_deco_status == 1 )   // Don't in @+5min variant.
+                        copy_deco_table();
+
+                    calc_ascenttime();
+                    char_O_deco_status = 0;         // calc nullzeit next time.
+                    char_O_deco_last_stop = 0;      // Surface reached (to animate menu)
+                        return;
+                }
+            }
+        //---- Then update tissue --------------------------------------------
+        sim_dive_mins++;            // Advance simulated time by 1 minute.
+        gas_switch_set();           // Apply any simulated gas change, once validated.
+        sim_alveolar_presures();    // Updates ppN2 and ppHe.
+        sim_tissue(1);              // Simulate compartiments for 1 minute.
+    }
+
+    // Surface not reached, need more stops... for menu animation.
+    char_O_deco_last_stop = temp_depth_limit;   // Reached depth.
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Simulation ascention to first deco stop.
+//
+// Note: because we ascent with a constant speed (10m/mn, ie. 1bar/mn),
+//       there is no need to break on more that 16 iterations
+//       (or we are already in deep shit).
+//
+// Input:  pres_respiration
+// Output: temp_deco
+//
+// if char_O_deco_status indicate @+5 variant, add extra time at current depth,
+// before ascent.
+void sim_ascent_to_first_stop(void)
+{
+    overlay unsigned char fast = 1; // 1min or 2sec steps.
+
+    update_startvalues();
+    clear_deco_table();
+
+    temp_deco = pres_respiration;       // Starts from current real depth.
+
+    // Are we doing the special @+5min variation ?
+    if(char_O_deco_status & 4)
+        sim_extra_time();
+
+    //---- Loop until first stop, gas switch, or surface is reached ----------
+    for(;;)
+    {
+        overlay float old_deco = temp_deco;     // Pamb backup (bars)
+
+        // Try ascending 1 full minute (fast) or 2sec (!fast):
+        if( fast )
+            temp_deco -= 10*METER_TO_BAR;   // 1 min, at 10m/min. ~ 1bar.
+        else
+            temp_deco -= (10.0/30.0)*METER_TO_BAR;  // 2sec at 10m/min.
+
+        if( temp_deco < pres_surface )  // But don't go over surface.
+            temp_deco = pres_surface;
+
+        // Recompute sim_lead_tissue_limit at GF_low (deepest stop), because
+        // one minute passed.
+        sim_limit(GF_low);
+
+        // Did we reach deepest remaining stop ?
+        if( temp_deco < sim_lead_tissue_limit )
+        {
+            temp_deco = old_deco;           // Restore last correct depth,
+
+            if( fast )
+            {
+                fast = 0;                   // Retry with 2sec steps.
+                continue;
+            }
+            else
+                break;                      // Done...
+        }
+
+        // Did we reach surface ?
+        // NOTE: we should round BEFORE checking surface is reached.
+        temp_depth_limit = (unsigned char)(0.5 + (temp_deco - pres_surface) * BAR_TO_METER);
+        if( temp_depth_limit == 0 )
+        {
+            temp_deco = pres_surface;   // Yes: finished !
+            break;
+        }
+
+        // Check for gas change below new depth ?
+        if( gas_switch_deepest() )
+        {
+            assert( temp_depth_limit > 0);
+
+            temp_deco = temp_depth_limit * METER_TO_BAR + pres_surface;
+            break;
+        }
+
+        if( fast )
+            sim_dive_mins++;            // Advance simulated time by 1 minute.
+        sim_alveolar_presures();        // temp_deco --> ppN2/ppHe
+        sim_tissue(fast);               // and update tissues for 1 min.
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// Simulation extra time at the current depth.
+//
+// This routine is used for @+5min feature.
+void sim_extra_time(void)
+{
+    overlay unsigned char extra = char_I_extra_time;
+    do {
+        sim_dive_mins++;                // Advance simulated time by 1 minute.
+        sim_tissue(1);                  // and update tissues for 1 min.
+    } while( --extra != 0 );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_tissue
+//
+// optimized in v.101
+//
+static void calc_tissue(PARAMETER unsigned char period)
+{
+    assert( 0.00 <= ppN2 && ppN2 < 11.2 );  // 80% N2 at 130m
+    assert( 0.00 <= ppHe && ppHe < 12.6 );  // 90% He at 130m
+
+    for (ci=0;ci<NUM_COMP;ci++)
+    {
+        read_buhlmann_times(period);        // 2 sec or 1 min period.
+
+        // N2
+        temp_tissue = (ppN2 - pres_tissue_N2[ci]) * var_N2_e;
+        temp_tissue_safety();
+        pres_tissue_N2[ci] += temp_tissue;
+
+        // He
+        temp_tissue = (ppHe - pres_tissue_He[ci]) * var_He_e;
+        temp_tissue_safety();
+        pres_tissue_He[ci] += temp_tissue;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_limit
+//
+// New in v.111 : separated from calc_tissue(), and depends on GF value.
+//
+static void calc_limit(void)
+{
+    char_O_gtissue_no = 255;
+    calc_lead_tissue_limit = 0.0;
+
+    for(ci=0; ci<NUM_COMP;ci++)
+    {
+        overlay float N2 = pres_tissue_N2[ci];
+        overlay float He = pres_tissue_He[ci];
+        overlay float p = N2 + He;
+
+        read_buhlmann_coefficients();
+        var_N2_a = (var_N2_a * N2 + var_He_a * He) / p;
+        var_N2_b = (var_N2_b * N2 + var_He_b * He) / p;
+
+        // Apply the Eric Baker's varying gradient factor correction.
+        // Note: the correction factor depends both on GF and b,
+        //       Actual values are in the 1.5 .. 1.0 range (for a GF=30%),
+        //       so that can change who is the leading gas...
+        // Note: Also depends of the GF. So the calcul is different for
+        //       GF_low, current GF, or GF_high...
+        //       *BUT* calc_tissue() is used to compute bottom time,
+        //       hence what would happend at surface,
+        //       hence at GF_high.
+        if( char_I_deco_model != 0 )
+            p = ( p - var_N2_a * GF_high) * var_N2_b
+              / (GF_high + var_N2_b * (1.0 - GF_high));
+        else
+            p = (p - var_N2_a) * var_N2_b;
+        if( p < 0.0 ) p = 0.0;
+
+        if( p > calc_lead_tissue_limit )
+        {
+            char_O_gtissue_no = ci;
+            calc_lead_tissue_limit = p;
+        }
+    }
+
+    assert( char_O_gtissue_no < NUM_COMP );
+    assert( 0.0 <= calc_lead_tissue_limit && calc_lead_tissue_limit <= 14.0);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_nullzeit
+//
+// calculates the remaining bottom time
+//
+// NOTE: Erik Baker's closed formula works for Nitroxes. Trimix adds a second
+//       exponential term to the M-value equation, making it impossible to
+//       invert... So we have to make a fast-simu until we find a better way.
+//
+// Input:  pres_respiration
+// Output: char_O_nullzeit
+//
+static void calc_nullzeit(void)
+{
+    //---- Compute ppN2 and ppHe ---------------------------------------------
+    temp_deco = pres_respiration;
+    sim_alveolar_presures();
+
+    char_O_nullzeit = 240;
+    for(ci=0; ci<NUM_COMP; ci++)
+    {
+        //---- Read A/B values and loading factor for N2 and He --------------
+        overlay float tN2 = pres_tissue_N2[ci];
+        overlay float tHe = pres_tissue_He[ci];
+        overlay float t = tN2 + tHe;
+        overlay unsigned char ndl;
+        overlay unsigned char period = 10;
+
+        read_buhlmann_coefficients();
+        read_buhlmann_times(2);             // Starts with a 10min period.
+
+        //---- Simulate for that tissue --------------------------------------
+        // NOTE: No need to simulate for longuer than the already found NDL.
+        for(ndl=0; ndl<char_O_nullzeit;)
+        {
+            //---- Compute updated mix M-value at surface
+            overlay float a = (var_N2_a * tN2 + var_He_a * tHe) / t;
+            overlay float b = (var_N2_b * tN2 + var_He_b * tHe) / t;
+            overlay float M0 = (a + pres_surface/b);
+
+            //---- Add 10min/1min to N2/He tissues
+            overlay float dTN2 = (ppN2 - tN2) * var_N2_e;
+            overlay float dTHe = (ppHe - tHe) * var_He_e;
+
+            //---- Apply security margin when using the non-GF model
+            if( char_I_deco_model == 0 )
+            {
+                dTN2 *= float_saturation_multiplier;
+                dTHe *= float_saturation_multiplier;
+            }
+            else // Or GF-based model
+                M0 = GF_high * (M0 - pres_surface) + pres_surface;
+
+            //---- Simulate off-gasing while going to surface
+            // TODO !
+            // dTN2 -= exp( ... ascent time ... ppN2...)
+            // dTHe -= exp( ... ascent time ... ppHe...)
+
+            //---- Ok now, and still ok to surface after 1 or 10 minutes ?
+            if( (t <= M0) && (t + dTN2 + dTHe <= M0) )
+            {
+                tN2 += dTN2;    // YES: apply gas loadings,
+                tHe += dTHe;
+                t = tN2 + tHe;
+                ndl += period;  // increment NDL,
+                continue;       // and loop.
+            }
+
+            //---- Should we retry with smaller steps ?
+            if( period == 10 )
+            {
+                read_buhlmann_times(1); // 1min coefs.
+                period = 1;
+                continue;
+            }
+
+            //---- ELSE make a linear approx for the last minute
+            // Usefull to have a meaningfull rounding of NDL.
+            // But ONLY it positive (negativ casted to unsigned is bad).
+            if( M0 > t )
+                ndl += (unsigned char)(0.5f + (M0-t)/(dTN2+dTHe));
+            break;
+        }
+
+        // Keep the shortest NDL found
+        if( ndl < char_O_nullzeit )
+            char_O_nullzeit = ndl;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_ascenttime
+//
+// Summup ascent from bottom to surface, at 1 bar/min, 1min for last 3 meters,
+// and all stops.
+//
+// Result in int_O_ascenttime, or int_O_extra_ascenttime if in @+5min variant.
+static void calc_ascenttime(void)
+{
+    overlay unsigned char x;
+    overlay unsigned short sum;
+
+    // + 0.7 to count 1 minute ascent time from 3 metre to surface
+    overlay float ascent = pres_respiration - pres_surface + 0.7;
+    if (ascent < 0.0)
+        ascent = 0.0;
+    sum = (unsigned short)(ascent + 0.99);
+
+    for(x=0; x<NUM_STOPS && internal_deco_depth[x]; x++)
+        sum += (unsigned short)internal_deco_time[x];
+
+    if( char_O_deco_status == 1 )
+        int_O_ascenttime = sum;
+    else
+        int_O_extra_ascenttime = sum;
+
+    if(int_O_ascenttime>999)
+        int_O_ascenttime=999;   // limit to 999'
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// update_startvalues
+//
+// updated in v.102
+//
+void update_startvalues(void)
+{
+    overlay unsigned char x;
+
+    // Start ascent simulation with current tissue partial pressures.
+    for(x=0; x<NUM_COMP; x++)
+    {
+        sim_pres_tissue_N2[x] = pres_tissue_N2[x];
+        sim_pres_tissue_He[x] = pres_tissue_He[x];
+    }
+
+    // No leading tissue (yet) for this ascent simulation.
+    sim_lead_tissue_limit = 0.0;
+    sim_lead_tissue_no = 255;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sim_tissue
+//
+// optimized in v.101
+//
+// Function very simular to calc_tissue, but:
+//   + Use a 1min or 10min period.
+//   + Do it on sim_pres_tissue, instead of pres_tissue.
+static void sim_tissue(PARAMETER unsigned char period)
+{
+    assert( 0.00 <= ppN2 && ppN2 < 11.2 );  // 80% N2 at 130m
+    assert( 0.00 <= ppHe && ppHe < 12.6 );  // 90% He at 130m
+
+    for(ci=0; ci<NUM_COMP; ci++)
+    {
+        read_buhlmann_times(period);        // 1 or 10 minute(s) interval
+
+        // N2
+        temp_tissue = (ppN2 - sim_pres_tissue_N2[ci]) * var_N2_e;
+        temp_tissue_safety();
+        sim_pres_tissue_N2[ci] += temp_tissue;
+
+        // He
+        temp_tissue = (ppHe - sim_pres_tissue_He[ci]) * var_He_e;
+        temp_tissue_safety();
+        sim_pres_tissue_He[ci] += temp_tissue;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sim_limit()
+//
+// New in v.111
+//
+// Function separated from sim_tissue() to allow recomputing limit on
+// different depth, because it depends on current gradient factor.
+//
+static void sim_limit(PARAMETER float GF_current)
+{
+    assert( 0.0 < GF_current && GF_current <= 1.0f);
+
+    sim_lead_tissue_limit = 0.0;
+    sim_lead_tissue_no = 0;             // If no one is critic, keep first tissue.
+
+    for(ci=0; ci<NUM_COMP; ci++)
+    {
+        overlay float N2 = sim_pres_tissue_N2[ci];
+        overlay float He = sim_pres_tissue_He[ci];
+        overlay float p = N2 + He;
+
+        read_buhlmann_coefficients();
+        var_N2_a = (var_N2_a * N2 + var_He_a * He) / p;
+        var_N2_b = (var_N2_b * N2 + var_He_b * He) / p;
+
+        // Apply the Eric Baker's varying gradient factor correction.
+        // Note: the correction factor depends both on GF and b,
+        //       Actual values are in the 1.5 .. 1.0 range (for a GF=30%),
+        //       so that can change who is the leading gas...
+        // Note: Also depends of the GF_current...
+        if( char_I_deco_model != 0 )
+            p = ( p - var_N2_a * GF_current)
+              / (GF_current / var_N2_b + 1.0 - GF_current);
+        else
+            p = (p - var_N2_a) * var_N2_b;
+        if( p < 0.0 ) p = 0.0;
+
+        if( p > sim_lead_tissue_limit )
+        {
+            sim_lead_tissue_no = ci;
+            sim_lead_tissue_limit = p;
+        }
+    } // for ci
+
+    assert( sim_lead_tissue_no < NUM_COMP );
+    assert( 0.0 <= sim_lead_tissue_limit && sim_lead_tissue_limit <= 14.0 );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// clear_deco_table
+//
+// unchanged in v.101
+//
+static void clear_deco_table(void)
+{
+    overlay unsigned char x;
+
+    for(x=0; x<NUM_STOPS; ++x)
+    {
+        internal_deco_time [x] = 0;
+        internal_deco_depth[x] = 0;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// update_deco_table
+//
+// Add 1 min to current stop.
+//
+// Inputs:
+//      temp_depth_limit = stop's depth, in meters.
+// In/Out:
+//      internal_deco_depth[] : depth (in metres) of each stops.
+//      internal_deco_time [] : time (in minutes) of each stops.
+//
+static unsigned char update_deco_table()
+{
+    overlay unsigned char x;
+    assert( temp_depth_limit < 128 );   // Can't be negativ (overflown).
+    assert( temp_depth_limit > 0 );     // No stop at surface...
+
+    for(x=0; x<NUM_STOPS; ++x)
+    {
+        // Make sure deco-stops are recorded in order:
+        assert( !internal_deco_depth[x] || temp_depth_limit <= (internal_deco_depth[x]& 0x7F) );
+
+        if( (internal_deco_depth[x] & 0x7F) == temp_depth_limit )
+        {
+            // Do not overflow (max 255')
+            if( internal_deco_time[x] < 255 )
+            {
+                internal_deco_time[x]++;
+                return 1;
+            }
+            // But store extra in the next stop...
+        }
+
+        if( internal_deco_depth[x] == 0 )
+        {
+            internal_deco_depth[x] = temp_depth_limit;
+
+            internal_deco_time[x]  = 1;
+            return 1;
+        }
+    }
+
+    // Can't store stops at more than 96m.
+    // Or stops at less that 3m too.
+    // Just do nothing with that...
+    return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_gradient_factor
+//
+// optimized in v.101 (var_N2_a)
+// new code in v.102
+//
+static void calc_gradient_factor(void)
+{
+    overlay float gf;
+    overlay float N2 = pres_tissue_N2[char_O_gtissue_no];
+    overlay float He = pres_tissue_He[char_O_gtissue_no];
+
+    assert( char_O_gtissue_no < NUM_COMP );
+    assert( 0.800 <= pres_respiration && pres_respiration < 14.0 );
+
+    // tissue > respiration (currently off-gasing)
+    // GF =   0% when respiration == tissue, ie. bubbles are at equilibrium.
+    // GF = 100% when respiration == limit.
+    temp_tissue = N2 + He;
+    if( temp_tissue <= pres_respiration )
+        gf = 0.0;
+    else
+    {
+        overlay float limit = calc_lead_tissue_limit;
+        // NOTE: in GF model, calc_lead_tissue_limit include already the
+        //       correction due to gradient factor. To compute the actual
+        //       current GF, we need to (re-)compute the raw ambiant-pressure
+        //       limit from the Bühlmann model.
+        if( char_I_deco_model != 0 )
+        {
+            ci = char_O_gtissue_no;
+            read_buhlmann_coefficients();
+            var_N2_a = (var_N2_a * N2 + var_He_a * He) / temp_tissue;
+            var_N2_b = (var_N2_b * N2 + var_He_b * He) / temp_tissue;
+            limit = (temp_tissue - var_N2_a) * var_N2_b;
+        }
+
+        gf = (temp_tissue  - pres_respiration)
+           / (temp_tissue  - limit)
+           * 100.0;
+        if( gf > 254.5 ) gf = 255.0;
+        if( gf < 0.0   ) gf = 0.0;
+    }
+    char_O_gradient_factor = (unsigned char)(gf+0.5f);
+
+    if( char_I_deco_model != 0 )        // calculate relative gradient factor
+    {
+        overlay float rgf;
+
+        if( low_depth < 3 )
+            rgf = GF_high;
+        else
+        {
+            overlay float temp1 = low_depth * METER_TO_BAR;
+            overlay float temp2 = pres_respiration - pres_surface;
+
+            if (temp2 <= 0)
+                rgf = GF_high;
+            else if (temp2 >= temp1)
+                rgf = GF_low;
+            else
+                rgf = GF_low + (temp1 - temp2)/temp1*GF_delta;
+        }
+
+        rgf = gf / rgf; // gf is already in percent
+        if( rgf <   0.0 ) rgf =   0.0;
+        if( rgf > 254.5 ) rgf = 255.0;
+            char_O_relative_gradient_GF  = (unsigned char)(rgf+0.5f);
+    }
+    else
+        char_O_relative_gradient_GF = char_O_gradient_factor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_calc_desaturation_time
+//
+// FIXED N2_ratio
+// unchanged in v.101
+// Inputs:  int_I_pres_surface, ppWater, char_I_desaturation_multiplier
+// Outputs: int_O_desaturation_time, char_O_tissue_saturation[0..31]
+//
+void deco_calc_desaturation_time(void)
+{
+    RESET_C_STACK
+
+    assert( 800 < int_I_pres_surface && int_I_pres_surface < 1100 );
+    assert( 0 < char_I_desaturation_multiplier && char_I_desaturation_multiplier <= 100 );
+
+    N2_ratio = 0.7902; // FIXED sum as stated in bühlmann
+    pres_surface = int_I_pres_surface * 0.001;
+    ppN2 = N2_ratio * (pres_surface - ppWater);
+    int_O_desaturation_time = 0;
+    float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR);
+
+    for(ci=0; ci<NUM_COMP; ci++)
+    {
+        overlay unsigned short desat_time;    // For a particular compartiment, in min.
+        overlay float temp1;
+        overlay float temp2;
+        overlay float temp3;
+        overlay float temp4;
+
+        read_buhlmann_ht();
+
+        // 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 * ppN2 - pres_tissue_N2[ci];
+        temp2 = ppN2 - pres_tissue_N2[ci];
+        if (temp2 >= 0.0)
+            temp1 = 0.0;
+        else
+            temp1 = temp1 / temp2;
+
+        if( 0.0 < temp1 && temp1 < 1.0 )
+        {
+            // 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.
+            temp1 = log(1.0 - temp1) / -0.6931; // temp1 is the multiples of half times necessary.
+            temp2 = var_N2_ht * temp1 / float_desaturation_multiplier; // time necessary (in minutes ) for complete desaturation (see comment about 5 percent)
+        }
+        else
+        {
+            temp1 = 0.0;
+            temp2 = 0.0;
+        }
+
+        // He
+        temp3 = 0.1 - pres_tissue_He[ci];
+        if (temp3 >= 0.0)
+            temp3 = 0.0;
+        else
+            temp3 = - temp3 / pres_tissue_He[ci];
+
+        if( 0.0 < temp3 && temp3 < 1.0 )
+    	{
+            temp3 = log(1.0 - 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 = var_He_ht * temp3 / float_desaturation_multiplier; // time necessary (in minutes ) for "complete" desaturation, new in v.101 float_desaturation_multiplier
+    	}
+        else
+    	{
+        	temp3 = 0.0;
+        	temp4 = 0.0;
+    	}
+
+        // saturation_time (for flight)
+        if (temp4 > temp2)
+            desat_time = (unsigned short)temp4;
+        else
+            desat_time = (unsigned short)temp2;
+
+        if(desat_time > int_O_desaturation_time)
+            int_O_desaturation_time = desat_time;
+
+        // 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_N2_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_He_saturation[ci] = (char)temp4;
+    } // for
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_wo_deco_step_1_min
+//
+// FIXED N2 Ratio
+// optimized in v.101 (...saturation_multiplier)
+// desaturation slowed down to 70,42%
+//
+static void calc_wo_deco_step_1_min(void)
+{
+    assert( 800 < int_I_pres_surface && int_I_pres_surface < 1100 );
+    assert( 800 < int_I_pres_respiration && int_I_pres_respiration < 1100 );
+    assert( 100 <= char_I_saturation_multiplier && char_I_saturation_multiplier < 200 );
+    assert( 0 < char_I_desaturation_multiplier && char_I_desaturation_multiplier <= 100 );
+
+    N2_ratio = 0.7902; // FIXED, sum lt. buehlmann
+    pres_respiration = pres_surface = int_I_pres_surface * 0.001;
+    ppN2 = N2_ratio * (pres_respiration - ppWater);
+    ppHe = 0.0;
+    float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR);
+    float_saturation_multiplier   = char_I_saturation_multiplier   * 0.01;
+
+    calc_tissue(1);  // update the pressure in the tissues N2/He in accordance with the new ambient pressure
+
+    clear_deco_table();
+    char_O_deco_status = 3;     // surface new in v.102 : stays in surface state.
+    char_O_nullzeit = 0;
+    int_O_ascenttime = 0;
+    int_O_extra_ascenttime = 0;
+    calc_gradient_factor();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// calc_dive_interval
+//
+// Prepare tissue for delay before the next dive simulation.
+//
+// Inputs:  char_I_dive_interval == delay before dive (in 10' steps).
+// Outputs: pres_tissue_N2/He[], CNS_fraction
+//
+// Should be protected by deco_push_tissues_to_vault(),
+//                        deco_pull_tissues_from_vault()
+//
+// desaturation slowed down to 70,42%.
+//
+static void calc_dive_interval(void)
+{
+    overlay unsigned char t;
+    overlay unsigned char backup_model;
+
+    //---- Initialize simulation parameters ----------------------------------
+    N2_ratio = 0.7902; // FIXED, sum lt. buehlmann
+    pres_respiration = pres_surface = int_I_pres_surface * 0.001;
+    ppN2 = N2_ratio * (pres_respiration - ppWater);
+    ppHe = 0.0;
+    float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR);
+    float_saturation_multiplier   = char_I_saturation_multiplier   * 0.01;
+
+    // Make sure SURFACE_DESAT_FACTOR is applied:
+    backup_model = char_I_deco_model;
+    char_I_deco_model = 0;
+
+    //---- Perform simulation ------------------------------------------------
+    for(t=0; t<char_I_dive_interval; ++t)
+    {
+        calc_tissue(2);  // period = 10min.
+        CNS_fraction =  0.92587471 * CNS_fraction;  // Half-time = 90min: (1/2)^(1/9)
+    }
+    assert( 0.0 <= CNS_fraction && CNS_fraction <= 2.56 );
+    int_O_CNS_fraction = (unsigned int)(CNS_fraction * 100.0 + 0.5);
+
+    //---- Restore model -----------------------------------------------------
+    char_I_deco_model = backup_model;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_clear_CNS_fraction
+//
+// new in v.101
+//
+void deco_clear_CNS_fraction(void)
+{
+    RESET_C_STACK
+
+    CNS_fraction = 0.0;
+    int_O_CNS_fraction = 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_calc_CNS_fraction
+//
+// Input:  char_I_actual_ppO2   : Current condition (in decibars).
+//         char_I_step_is_1min  : use 1min or 10min steps instead of 2sec.
+//         CNS_fraction         : velue before period.
+// Output: CNS_fraction, int_O_CNS_fraction
+//
+void deco_calc_CNS_fraction(void)
+{
+    overlay float time_factor = 1.0f;
+    RESET_C_STACK
+
+    assert( 0.0 <= CNS_fraction && CNS_fraction <= 2.56 );
+    assert( char_I_actual_ppO2 > 15 );
+
+    if( char_I_step_is_1min == 1 )
+        time_factor = 30.0f;
+    else if( char_I_step_is_1min == 2  )
+        time_factor = 300.0f;
+
+    if (char_I_actual_ppO2 < 50)
+        ;   // no changes
+    else if (char_I_actual_ppO2 < 60)
+        CNS_fraction += time_factor/(-540.0 * char_I_actual_ppO2 + 54000.0);
+    else if (char_I_actual_ppO2 < 70)
+        CNS_fraction += time_factor/(-450.0 * char_I_actual_ppO2 + 48600.0);
+    else if (char_I_actual_ppO2 < 80)
+        CNS_fraction += time_factor/(-360.0 * char_I_actual_ppO2 + 42300.0);
+    else if (char_I_actual_ppO2 < 90)
+        CNS_fraction += time_factor/(-270.0 * char_I_actual_ppO2 + 35100.0);
+    else if (char_I_actual_ppO2 < 110)
+        CNS_fraction += time_factor/(-180.0 * char_I_actual_ppO2 + 27000.0);
+    else if (char_I_actual_ppO2 < 150)
+        CNS_fraction += time_factor/( -90.0 * char_I_actual_ppO2 + 17100.0);
+    else if (char_I_actual_ppO2 < 160)
+        CNS_fraction += time_factor/(-225.0 * char_I_actual_ppO2 + 37350.0);
+    else if (char_I_actual_ppO2 < 165)
+        CNS_fraction += time_factor*0.000755; // 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 += time_factor*0.00102; // example calculation: Sqrt((1.7/1.55)^20)*0.000404
+    else if (char_I_actual_ppO2 < 175)
+        CNS_fraction += time_factor*0.00136;
+    else if (char_I_actual_ppO2 < 180)
+        CNS_fraction += time_factor*0.00180;
+    else if (char_I_actual_ppO2 < 185)
+        CNS_fraction += time_factor*0.00237;
+    else if (char_I_actual_ppO2 < 190)
+        CNS_fraction += time_factor*0.00310;
+    else if (char_I_actual_ppO2 < 195)
+        CNS_fraction += time_factor*0.00401;
+    else if (char_I_actual_ppO2 < 200)
+        CNS_fraction += time_factor*0.00517;
+    else if (char_I_actual_ppO2 < 230)
+        CNS_fraction += time_factor*0.0209;
+    else
+        CNS_fraction += time_factor*0.0482; // value for 2.5
+
+    if( CNS_fraction > 9.99)
+        CNS_fraction = 9.99;
+    if( CNS_fraction < 0.0 )
+        CNS_fraction = 0.0;
+
+    int_O_CNS_fraction = (unsigned int)(100.0 * CNS_fraction + 0.5);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_calc_CNS_planning
+//
+// Compute CNS during predicted ascent.
+//
+// Note:    Needs a call to deco_push_tissues_to_vault(),
+//          deco_pull_tissues_from_vault() to avoid trashing everything...
+//
+// Input:   CNS_fraction, char_O_deco_time[], char_O_deco_depth[]
+// Output:  CNS_fraction, int_O_CNS_fraction
+//
+void deco_calc_CNS_planning(void)
+{
+    overlay unsigned char  backup_gas_last_depth;
+    overlay unsigned char  backup_gas_last_used;
+    overlay unsigned short backup_dive_mins;
+    overlay unsigned char  backup_actual_ppO2;
+
+    RESET_C_STACK
+
+    // Backup state machine
+    backup_gas_last_depth = sim_gas_last_depth;
+    backup_gas_last_used  = sim_gas_last_used;
+    backup_dive_mins      = sim_dive_mins;
+    backup_actual_ppO2    = char_I_actual_ppO2;
+
+    // Uses 1min CNS period:
+    char_I_step_is_1min = 1;
+
+    //---- Retrieve bottom Gas used, and set variables.
+    sim_gas_last_used  = char_I_first_gas;
+    sim_gas_last_depth = 0;             // Surface gas marker.
+    gas_switch_set();                   // Sets initial calc_N2/He_ratio
+
+    //---- CCR mode : do the full TTS at once --------------------------------
+    if( char_I_const_ppO2 != 0 )
+    {
+        overlay unsigned short t;       // Needs 16bits here !
+        char_I_actual_ppO2 = char_I_const_ppO2;
+        for(t=0; t<int_O_ascenttime; ++t)
+            deco_calc_CNS_fraction();
+    }
+    else //---- OC mode : have to follow all gas switches... -----------------
+    {
+        overlay unsigned char i = 0;    // Decostop loop counter
+        overlay float actual_ppO2;
+        overlay unsigned char time, t;
+
+        //---- Ascent to surface delay
+        // NOTE: count as if time is spent with bottom pressure,
+        //       AND the bottom gas
+        actual_ppO2 = (pres_surface + char_I_bottom_depth * METER_TO_BAR)
+                    * (1.0 - calc_N2_ratio - calc_He_ratio);
+        if( actual_ppO2 < 0.0  ) actual_ppO2 = 0.0;
+        if( actual_ppO2 > 2.50 ) actual_ppO2 = 2.55;
+        char_I_actual_ppO2 = (unsigned char)(100.0 * actual_ppO2 + 0.5);
+
+        // Ascent time (rounded up):
+        time = (unsigned char)(0.1 * char_I_bottom_depth + 0.5);
+
+        for(t=0; t<time; ++t)
+        {
+            deco_calc_CNS_fraction();
+            sim_dive_mins++;
+        }
+
+        //---- Do all further stops ------------------------------------------
+        for(i=0; i<NUM_STOPS; ++i)
+        {
+            overlay unsigned char switch_gas;
+
+            //---- Get next stop, possibly in reverse order ------------------
+            {
+                time             = char_O_deco_time[(NUM_STOPS-1)-i];
+                temp_depth_limit = char_O_deco_depth[(NUM_STOPS-1)-i];
+            }
+            if( time == 0 ) continue;
+
+            //---- Gas Switch ? ----------------------------------------------
+            switch_gas = temp_depth_limit & 0x80;   // Switch flag.
+            temp_depth_limit &= 0x7F;               // True stop depth.
+
+            if( switch_gas )
+            {
+                gas_switch_deepest();
+                gas_switch_set();
+            }
+
+            //---- Convert Depth and N2_ratio to ppO2 ------------------------
+            actual_ppO2 = (pres_surface + temp_depth_limit * METER_TO_BAR)
+                        * (1.0 - calc_N2_ratio - calc_He_ratio);
+            if( actual_ppO2 < 0.0  ) actual_ppO2 = 0.0;
+            if( actual_ppO2 > 2.50 ) actual_ppO2 = 2.55;
+            char_I_actual_ppO2 = (unsigned char)(100.0 * actual_ppO2 + 0.5);
+
+            //---- Apply the stop
+            for(t=0; t<time; ++t)
+            {
+                deco_calc_CNS_fraction();
+                sim_dive_mins++;
+            }
+        }
+    }
+
+    //---- Back to normal mode... --------------------------------------------
+    char_I_step_is_1min = 0;
+    sim_gas_last_depth  = backup_gas_last_depth;
+    sim_gas_last_used   = backup_gas_last_used;
+    sim_dive_mins       = backup_dive_mins;
+    char_I_actual_ppO2  = backup_actual_ppO2;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_calc_CNS_decrease_15min
+//
+// new in v.101
+//
+// calculates the half time of 90 minutes in 6 steps of 15 min
+// (Used in sleepmode, for low battery mode).
+//
+// Output: int_O_CNS_fraction
+// Uses and Updates: CNS_fraction
+//
+void deco_calc_CNS_decrease_15min(void)
+{
+    RESET_C_STACK
+    assert( 0.0 <= CNS_fraction && CNS_fraction <= 2.56 );
+
+    CNS_fraction =  0.890899 * CNS_fraction;
+    int_O_CNS_fraction = (unsigned int)(CNS_fraction * 100.0 + 0.5);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_calc_percentage
+//
+// new in v.101
+//
+// calculates int_I_temp * char_I_temp / 100
+// output is int_I_temp
+//
+// Used to compute NoFly remaining time.
+//
+void deco_calc_percentage(void)
+{
+    RESET_C_STACK
+
+    assert( 60 <= char_I_temp && char_I_temp <= 100 );
+    assert( int_I_temp  < 5760 );      // Less than 4 days = 96h...
+
+    int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 );
+
+    assert( int_I_temp < 5760 );                            // Less than 96h too...
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// deco_gas_volumes
+//
+// new in v.111
+//
+// calculates volumes for each gas.
+//
+// Input:   char_I_bottom_depth, char_I_bottom_time for planned dive.
+//          Gas list.
+//          char_I_first_gas is the bottom gas.
+//          decoplan (char_O_deco_depth, char_O_deco_time).
+//          CF#54 == TRUE if shallowest stop first.
+//          CF#56 == bottom liters/minutes (5 .. 50) or bar/min.
+//          CF#57 == deco liters/minutes (5 .. 50) or bar/min.
+// Output:  int_O_gas_volumes[0..4] in litters * 0.1
+//
+void deco_gas_volumes(void)
+{
+    overlay float volumes[NUM_GAS];
+    overlay float bottom_usage, deco_usage;
+    overlay unsigned char i, deepest_first;
+    overlay unsigned char gas, depth;
+    RESET_C_STACK
+
+    //---- initialize with bottom consumption --------------------------------
+    for(i=0; i<NUM_GAS; ++i)                            // Nothing yet...
+        volumes[i] = 0.0;
+
+    assert(1 <= char_I_first_gas && char_I_first_gas <= NUM_GAS);
+    gas = char_I_first_gas - 1;
+
+    bottom_usage = (float) char_I_bottom_usage;
+    if( char_I_const_ppO2 == 0 && bottom_usage > 0.0 )
+        volumes[gas]
+            = (char_I_bottom_depth*0.1 + 1.0)           // Use Psurface = 1.0 bar.
+            * char_I_bottom_time                        // in minutes.
+            * bottom_usage;                             // In liter/minutes.
+
+    //---- Ascent usage ------------------------------------------------------
+    deco_usage    = (float) char_I_deco_usage; // In liter/minutes.
+
+    depth = char_I_bottom_depth;
+
+    for(i=0; i<NUM_STOPS; ++i)
+    {
+        overlay unsigned char newDepth, time;
+
+        // Manage stops in reverse order (CF#54)
+        if( deepest_first )
+        {
+            time = char_O_deco_time[i];
+            if( time == 0 ) break;          // End of table: done.
+
+             newDepth  = char_O_deco_depth[i] & 0x7F;
+        }
+        else
+        {
+            time = char_O_deco_time[31-i];
+            if( time == 0 ) continue;       // not yet: still search table.
+
+            newDepth = char_O_deco_depth[31-i] & 0x7F;
+        }
+
+        //---- Gas switch during this step -----------------------------------
+        {
+            overlay unsigned char newGas = 0;
+            overlay unsigned char newStop = 0;  // NO CHANGE yet
+            overlay unsigned char j;
+
+            for(j=0; j<NUM_GAS; ++j)
+            {
+                // Skip gas without changing depth:
+                if( ! char_I_deco_gas_change[j] )
+                    continue;
+                // Select gas changed between [newDepth .. depth]
+                if( newDepth <= char_I_deco_gas_change[j]
+                 && char_I_deco_gas_change[j] <= depth )
+                {
+                    // Keep the DEEPEST gas in that range:
+                    // Note: that = means changing gas at BEGINNING of this stop.
+                    if( char_I_deco_gas_change[j] >= newStop )
+                    {
+                        newGas  = j;
+                        newStop = char_I_deco_gas_change[j];
+                    }
+                }
+            }
+
+            if( newStop ) // Did we find something ?
+            {
+                // usage BEFORE gas switch (if any), at 10m/min :
+                if( deco_usage > 0.0 && depth > newStop )
+                    // Plus usage during ascent to the next stop, at 10m/min.
+                    volumes[gas] += ((depth+newStop)*0.05 + 1.0)    // average depth --> bar.
+                                  * (depth-newStop)*0.1             // metre --> min
+                                  * deco_usage;
+
+                // Do gas switch:
+                gas = newGas;
+                depth = newStop;
+            }
+        }
+
+        // usage AFTER gas switch (if any), at 10m/min :
+        if( depth > newDepth )
+            volumes[gas] += ((depth+newDepth)*0.05 + 1.0)    // average depth --> bar.
+                          * (depth-newDepth)*0.1             // metre --> min
+                          * deco_usage;
+
+        // Do stop:
+        depth = newDepth;
+
+        // Usage at stop:
+        if( deco_usage > 0.0 )
+            volumes[gas] += (depth*0.1 + 1.0)   // depth --> bar.
+                          * time                // in minutes.
+                          * deco_usage;         // in xxx / min @ 1bar.
+        else
+            volumes[gas] = 65535.0;
+    }
+
+    // From last stop to surface
+    if( deco_usage > 0.0 )
+        volumes[gas] += (depth*0.05 + 1.0)      // avg depth --> bar.
+                      * depth * 0.1             // time to surface, in minutes.
+                      * deco_usage;             // in xxx / min @ 1bar.
+
+    //---- convert results for the ASM interface -----------------------------
+    for(i=0; i<NUM_GAS; ++i)
+        if( volumes[i] > 65534.0 )
+            int_O_gas_volumes[i] = 65535;
+        else
+            int_O_gas_volumes[i] = (unsigned short)(volumes[i] + 0.5);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void deco_push_tissues_to_vault(void)
+{
+    overlay unsigned char x;
+    RESET_C_STACK
+
+    cns_vault = CNS_fraction;
+    low_depth_vault = low_depth;
+
+    for (x=0;x<NUM_COMP;x++)
+    {
+        pres_tissue_N2_vault[x] = pres_tissue_N2[x];
+        pres_tissue_He_vault[x] = pres_tissue_He[x];
+    }
+}
+
+void deco_pull_tissues_from_vault(void)
+{
+    overlay unsigned char x;
+    RESET_C_STACK
+
+    for (x=0; x<NUM_COMP; x++)
+    {
+        pres_tissue_N2[x] = pres_tissue_N2_vault[x];
+        pres_tissue_He[x] = pres_tissue_He_vault[x];
+    }
+
+    // Restore both CNS variable, too.
+    CNS_fraction = cns_vault;
+    int_O_CNS_fraction = (unsigned int)(CNS_fraction * 100.0 + 0.5);
+
+    // GF history too:
+    low_depth = low_depth_vault;
+    locked_GF_step = GF_delta / low_depth;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+#ifndef CROSS_COMPILE
+void main() {}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/p2_definitions.h	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,73 @@
+// *********************************************************
+// ** Common definitions for the OSTC decompression code  **
+// *********************************************************
+
+//////////////////////////////////////////////////////////////////////////////
+// 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/>.
+//
+//////////////////////////////////////////////////////////////////////////////
+// history:
+// 2010-12-25 v110: [jDG] split in three files (deco.c, main.c, definitions.h)
+
+
+#define	MBAR_REACH_GASCHANGE_AUTO_CHANGE_OFF	150
+
+// *************************
+// ** P R O T O T Y P E S **
+// *************************
+
+extern void calc_percentage(void);
+extern void deco_calc_hauptroutine(void);
+extern void deco_clear_tissue(void);
+extern void deco_calc_percentage(void);
+extern void deco_calc_wo_deco_step_1_min(void);
+extern void deco_calc_dive_interval(void);
+extern void deco_gradient_array(void);
+extern void deco_calc_desaturation_time(void);
+extern void deco_calc_CNS_fraction(void);
+extern void deco_calc_CNS_planning(void);
+extern void deco_clear_CNS_fraction(void);
+extern void deco_push_tissues_to_vault(void);
+extern void deco_pull_tissues_from_vault(void);
+
+// ***********************************************
+// **         Allow compile on VisualC          **
+// ***********************************************
+
+#ifdef WIN32
+    // Some keywords just dont exists on Visual C++:
+#   define CROSS_COMPILE
+#   define __18CXX
+#   define ram
+#   define rom
+#   define overlay
+#   define PARAMETER
+
+#include <assert.h>
+
+    // Avoid warnings about float/double mismatches:
+#   pragma warning(disable: 4244 4068 4305)
+#else
+#   define PARAMETER static
+#   ifdef __DEBUG
+#       define assert(predicate) if( !(predicate) ) assert_failed(__LINE__)
+#   else
+#       define assert(predicate)
+#   endif
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/p2_tables.romdata	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,134 @@
+// **************************************************************
+// 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/>.
+//
+// HISTORY
+// 2011-01-20: jDG Cleanup addressing.
+// 2011-02-13: jDG Correct some typos.
+// 2011-05-17: jDG Optimized using interleaved arrays.
+//
+// **************************************************************
+
+rom const float buhlmann_ab[4*16] = {
+// Data ZH-L16C, from Bühlmann Tauchmedizin 2002, option 1a (4mn)
+// a for N2    b for N2     a of He     b for He
+	1.2599,     0.5050,     1.7424,     0.4245,
+	1.0000,     0.6514,     1.3830,     0.5747,
+	0.8618,     0.7222,     1.1919,     0.6527,
+	0.7562,     0.7825,     1.0458,     0.7223,
+	0.6200,     0.8126,     0.9220,     0.7582,
+	0.5043,     0.8434,     0.8205,     0.7957,
+	0.4410,     0.8693,     0.7305,     0.8279,
+	0.4000,     0.8910,     0.6502,     0.8553,
+	0.3750,     0.9092,     0.5950,     0.8757,
+	0.3500,     0.9222,     0.5545,     0.8903,
+	0.3295,     0.9319,     0.5333,     0.8997,
+	0.3065,     0.9403,     0.5189,     0.9073,
+	0.2835,     0.9477,     0.5181,     0.9122,
+	0.2610,     0.9544,     0.5176,     0.9171,
+	0.2480,     0.9602,     0.5172,     0.9217,
+	0.2327,     0.9653,     0.5119,     0.9267
+};
+
+rom const float buhlmann_ht[2*16] = {
+// Compartiment half-life, in minute
+//-- N2 ---- He ---------------------------------------------------------------------
+	  4.0,    1.51,
+	  8.0,    3.02,
+	 12.5,    4.72,
+	 18.5,    6.99,
+	 27.0,   10.21,
+	 38.3,   14.48,
+	 54.3,   20.53,
+	 77.0,   29.11,
+	109.0,   41.20,
+	146.0,   55.19,
+	187.0,   70.69,
+	239.0,   90.34,
+	305.0,  115.29,
+	390.0,  147.42,
+	498.0,  188.24,
+	635.0,  240.03
+};
+
+rom const float e2secs[2*16] = {
+// result of  1 - 2^(-1/(30sec*HT))
+//---- N2 ------------- He ------------
+	5.75958E-03,    1.51848E-02,  
+	2.88395E-03,    7.62144E-03,
+	1.84669E-03,    4.88315E-03,
+    1.24813E-03,    3.29997E-03,
+    8.55371E-04,    2.26041E-03,
+    6.03079E-04,    1.59437E-03,
+    4.25414E-04,    1.12479E-03,
+    3.00019E-04,    7.93395E-04,
+    2.11949E-04,    5.60641E-04,
+    1.58240E-04,    4.18555E-04,
+    1.23548E-04,    3.26795E-04,
+    9.66686E-05,    2.55722E-04,
+    7.57509E-05,    2.00387E-04,
+    5.92416E-05,    1.56716E-04,
+    4.63943E-05,    1.22734E-04,
+    3.63850E-05,    9.62538E-05
+//-------------------------------------
+};
+
+rom const float e1min[2*16] = {
+// Integration constant for 1 minute,
+// Ie. 1- 2^(-1/HT)
+//----- N2 --------- e 1min He --------
+	1.59104E-01,    3.68109E-01,  	
+    8.29960E-02,   	2.05084E-01,     
+    5.39424E-02,    1.36579E-01,
+    3.67742E-02,    9.44046E-02,
+    2.53454E-02,    6.56359E-02,
+    1.79351E-02,    4.67416E-02,
+    1.26840E-02,    3.31991E-02,
+    8.96152E-03,    2.35301E-02,
+    6.33897E-03,    1.66832E-02,
+    4.73633E-03,    1.24808E-02,
+    3.69981E-03,    9.75753E-03,
+    2.89600E-03,    7.64329E-03,
+    2.27003E-03,    5.99417E-03,
+    1.77572E-03,    4.69082E-03,
+    1.39089E-03,    3.67548E-03,
+    1.09097E-03,    2.88359E-03
+//-------------------------------------
+};
+
+rom const float e10min[2*16] = {
+// The 10 min Value in float notation:
+//  result of 1 - 2^(-10/ht)
+//---- N2 -------------- He -----------
+	8.23223E-01,    9.89851E-01,  
+	5.79552E-01,  	8.99258E-01,
+    4.25651E-01,    7.69737E-01,
+    3.12487E-01,    6.29027E-01,
+    2.26416E-01,    4.92821E-01,
+    1.65547E-01,    3.80407E-01,
+    1.19840E-01,    2.86538E-01,
+    8.60863E-02,    2.11886E-01,
+    6.16117E-02,    1.54849E-01,
+    4.63665E-02,    1.18026E-01,
+    3.63881E-02,    9.34005E-02,
+    2.85855E-02,    7.38569E-02,
+    2.24698E-02,    5.83504E-02,
+    1.76160E-02,    4.59303E-02,
+    1.38222E-02,    3.61528E-02,
+    1.08563E-02,    2.84646E-02
+//-------------------------------------
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ports.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,86 @@
+;=============================================================================
+;
+;   File ports.inc
+;
+;   Portmap
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2012-08-13 : [mH] Creation
+
+;----------------------------- PORTS ---------------------------------
+
+; PORTA: TFT_HIGH
+; TRIS=b'00000000'
+
+; PORTB
+#DEFINE	switch_left1	PORTB,1	; Switch
+#DEFINE	switch_right2	PORTB,0	; Switch
+#DEFINE mcp_power		PORTB,2	; RX Power supply
+#DEFINE	mcp_lf_data		PORTB,3	; RX in
+#DEFINE	LEDg			PORTB,4	; LED green
+#DEFINE	tft_power		PORTB,5 ; via P-MOSFET (Inverted)
+#DEFINE	icsp_clk		PORTB,6	; ICSP
+#DEFINE	icsp_dat		PORTB,7	; ICSP
+; TRIS=b'00001011'
+
+; PORTC
+#DEFINE	SOSC_RC0		PORTC,0	; SOSC
+#DEFINE	SOSC_RC1		PORTC,1	; SOSC
+#DEFINE	TFT_PWM			PORTC,2	; TFT Backlight
+#DEFINE	I2C_RC3			PORTC,3	; I²C
+#DEFINE	I2C_RC4			PORTC,4	; I²C
+#DEFINE	MS5541_mosi		PORTC,5	; MS5541
+#DEFINE	uart1_RC6		PORTC,6	; UART1 (USB)
+#DEFINE	uart1_RC7		PORTC,7	; UART1 (USB)
+; TRIS=b'10011010'
+
+; PORTD
+#DEFINE	tft_cs			PORTD,0	; /CS
+#DEFINE	tft_rs			PORTD,1	; RS
+#DEFINE	tft_nwr			PORTD,2	; /WR
+#DEFINE	tft_rd			PORTD,3 ; RD
+#DEFINE	flash_mosi		PORTD,4	; MOSI
+#DEFINE	flash_miso		PORTD,5	; MISO
+#DEFINE	flash_clk		PORTD,6	; CLK
+#DEFINE	tft_nreset		PORTD,7	; /RESET
+; TRIS=b'00100000'
+
+; PORTE
+#DEFINE	RE0_unused		PORTE,0	; unused
+#DEFINE	ir_power		PORTE,1	; Power supply for IR
+#DEFINE	mcp_ncs			PORTE,2	; RX /CS
+#DEFINE	LEDr			PORTE,3	; LED red
+#DEFINE	power_sw2		PORTE,4	; Power supply for switch1 circuit
+#DEFINE	RE5_unused		PORTE,5	; unused
+#DEFINE	lightsen_power 	PORTE,6	; Power supply for lightsensor
+#DEFINE	flash_ncs		PORTE,7	; /CS
+; TRIS=b'00000000'
+
+; PORTF
+; RF1 (AN6, Batt_analog) and RF2 (AN7, Lightsensor)
+; TRIS=b'11000000'
+
+; PORTG
+#DEFINE	mcp_clk		PORTG,0	; RX clk
+#DEFINE	RG1_blocked_by_RS232_2	PORTG,1	; unused
+#DEFINE	tsop_rx			PORTG,2	; IR (RX2)
+; RG3 (AN17, RSSI RX)
+; RG4 (32768Hz Clock out)
+#DEFINE	RG5_unused		PORTG,5	; /MCLR
+#DEFINE	RG6_unused		PORTG,6	; unavailable
+#DEFINE	RG7_unused		PORTG,7	; unavailable
+; TRIS=b'10001111'
+
+; PORTJ
+#DEFINE	RJ0_unused		PORTJ,0	; unused
+#DEFINE	RJ1_unused		PORTJ,1	; unused
+#DEFINE	RJ2_unused		PORTJ,2	; unused
+#DEFINE	RJ3_unused		PORTJ,3	; unused
+#DEFINE	vusb_in			PORTJ,4	; external power supply detect, USB enumerated
+#DEFINE	power_sw1		PORTJ,5	; Power supply for switch2 circuit
+#DEFINE	MS5541_clk		PORTJ,6	; MS5541 mH
+#DEFINE	MS5541_miso		PORTJ,7	; MS5541 mH
+; TRIS=b'10010000'
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/rtc.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,91 @@
+;=============================================================================
+;
+;   File rtc.asm
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-08 : [mH] moving from OSTC code
+
+#include "ostc3.inc"
+#include "math.inc"
+
+sensors     CODE
+
+	global	rtc_init
+rtc_init:
+	movlw	.1
+	movwf	secs
+	movlw	.59
+	movwf	mins
+	movlw	.12
+	movwf	hours
+	movlw	.13
+	movwf	day
+	movlw	.1
+	movwf	month
+	movlw	.13
+	movwf	year
+	rcall	rtc_set_rtc			; writes mins,sec,hours,day,month and year to rtc module
+	return
+	
+	global	rtc_set_rtc
+rtc_set_rtc:
+	banksel 0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+	movlw 	0x55
+	movwf 	EECON2
+	movlw 	0xAA
+	movwf 	EECON2
+	bsf 	RTCCFG,RTCWREN		; Unlock sequence for RTCWREN
+	bsf		RTCCFG,RTCPTR1
+	bsf		RTCCFG,RTCPTR0		; year
+	movff	year,WREG
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALL				; year
+	movwf	RTCVALH				; dummy write
+	movff	day,WREG
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALL				;day
+	movff	month,WREG
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALH				;month
+	movff	hours,WREG
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALL				;hours
+	movlw	d'0'
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALH				;weekday
+	movff	secs,WREG
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALL				;secs
+	movff	mins,WREG
+	rcall	rtc_dec2bcd			; IN: temp1 in WREG, OUT: WREG in BCD, also sets to bank16h!
+	movwf	RTCVALH				;minutes
+	movlw 	0x55
+	movwf 	EECON2
+	movlw 	0xAA
+	movwf 	EECON2
+	bcf 	RTCCFG,RTCWREN		; Lock sequence for RTCWREN
+	banksel	common
+	return
+
+rtc_dec2bcd:
+	banksel	temp1
+	movwf	temp1				; Input in dec
+	setf	temp2				; 10s
+	
+rtc_dec2bcd2:
+	incf	temp2,F             ; Count 10's
+	movlw	d'10'
+	subwf	temp1,F
+	btfss	STATUS,N
+	bra		rtc_dec2bcd2
+	movlw	d'10'
+	addwf	temp1,F				; 1s
+    swapf   temp2,W             ; swap to bit 7-4 -> WREG
+	addwf	temp1,W				; Result in BCD
+	banksel 0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+	return
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/rtc.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,12 @@
+;=============================================================================
+;
+;   File rtc.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-08 : [mH] moving from OSTC code
+
+	extern	rtc_init
+	extern 	rtc_set_rtc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/shared_definitions.h	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,171 @@
+#ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+;
+;    shared_definitions.h
+;
+;    Declare variables used both in C and ASM code
+;
+;    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/>.
+;
+;    Copyright (c) 2010, JD Gascuel.
+;=============================================================================
+; RATIONAL
+;
+; We must enforce good data passing between the C and the ASM parts of code.
+; The previous design used two independant definitions of each variable,
+; one in C, one in ASM. If they did not match, no error was generated, and
+; anything can happend at runtime...
+;
+; The new design use LINKING to ensure the variables defined in C are at the
+; same address when used in ASM code. And it uses a unique declaration file
+; (with suitable macros) to make sure they have the same size in both language.
+;
+; HISTORY
+;  2011-01-20: [jDG] Creation.
+;
+; NOTE
+;
+; This file have to obey both ASM and C syntax. The only common directives
+; are #if/#ifdef/#endif and the #define, so they are eavily used to do the
+; trick.
+;
+; BUGS
+;=============================================================================
+; HISTORY
+#endif
+
+#ifdef __18CXX
+    //------------------------------------------------------------------------
+    // C-style declarations:
+#   ifndef TEST_MAIN
+#       define VAR_UCHAR(n)      extern unsigned  char n
+#       define TAB_UCHAR(n,size) extern unsigned  char n[size]
+#       define VAR_UINT(n)       extern unsigned short n
+#       define TAB_UINT(n,size)  extern unsigned short n[size]
+#   else
+#       define VAR_UCHAR(n)      unsigned  char n
+#       define TAB_UCHAR(n,size) unsigned  char n[size]
+#       define VAR_UINT(n)       unsigned short n
+#       define TAB_UINT(n,size)  unsigned short n[size]
+#   endif
+#else
+    ;-------------------------------------------------------------------------
+    ; ASM-style declarations:
+#define VAR_UCHAR(n)       n    res     1
+#define TAB_UCHAR(n,size)  n    res     size
+#define VAR_UINT(n)        n    res     2
+#define TAB_UINT(n,size)   n    res     2*size
+#endif
+
+#ifdef __18CXX
+    //---- BANK 3 DATA -------------------------------------------------------
+    // Gather all data C-code --> ASM-code
+#   pragma udata overlay bank3=0x300
+#else
+bank3   udata_ovr  0x300
+#endif
+
+#ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+    Define model dimensions.
+    NUM_COMP  is the number of compartiments in the Bühlmann ZH-L16 model, ie 16.
+    NUM_STOPS is the maximum number of stops computed by decoplanning. 
+              Note that the deapest stop is roughly limited to 3m * NUM_STOPS
+                   (this is assuming all stops up to the surface are used).
+              Note also that if the table overflow, extra stops are ignored,
+                   and not reported in TTS summing.
+    NUM_GAS   is the number of (potentially) active gas considered during
+              ascent simulation.
+#endif
+#define NUM_COMP    0x10
+#define NUM_STOPS   0x20
+#define NUM_GAS     5
+
+VAR_UINT  (int_O_gtissue_limit);
+VAR_UINT  (int_O_gtissue_press);
+VAR_UINT  (int_O_desaturation_time);       // 
+VAR_UINT  (int_O_ascenttime);              // TTS (in minutes)
+VAR_UINT  (int_O_extra_ascenttime);        // TTS for @+5min variant (in minutes)
+VAR_UINT  (int_O_CNS_fraction);            // new in v.101
+
+VAR_UCHAR (char_O_nullzeit);               // 
+VAR_UCHAR (char_O_deco_status);            // Deko state-machine state.
+VAR_UCHAR (char_O_deco_last_stop);         // Depth reached during deko planning.
+VAR_UCHAR (char_O_gradient_factor);        // 
+VAR_UCHAR (char_O_gtissue_no);             // 
+VAR_UCHAR (char_O_diluent);                // new in v.101
+VAR_UCHAR (char_O_flush_ppO2);             // 2011-05-01: ppO2 from diluant (CCR mode).
+VAR_UCHAR (char_O_EAD);                    // 2011-05-01: Added EAD/END in deco model.
+VAR_UCHAR (char_O_END);                    // 2011-05-01: Added EAD/END in deco model.
+VAR_UCHAR (char_O_relative_gradient_GF);   // new in v.102
+
+VAR_UCHAR (char_O_first_deco_depth);        // Depth of first stop.
+VAR_UCHAR (char_O_first_deco_time) ;        // Duration of first stop.
+TAB_UCHAR (char_O_deco_depth, NUM_STOPS);   // Fusionned decompression table:
+TAB_UCHAR (char_O_deco_time,  NUM_STOPS);   // Both ZH-L16 and L16-GF models.
+TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // For logging the full decoplan
+
+TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // Nitrogen compartiment desaturation time, in min.
+TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP); // Helium compartiment desaturation time, in min.
+
+TAB_UINT (int_O_gas_volumes, 5);            // Volumes evaluation for each gas tank, in 0.1 liters.
+
+#ifdef __18CXX
+    //---- BANK 4 DATA -------------------------------------------------------
+    // Gather all data ASM-code --> C-code
+#   pragma udata overlay bank4=0x400
+#else
+    ; In ASM, put the same bank, in overlay mode, at the same address
+bank4   udata_ovr  0x400
+#endif
+
+VAR_UCHAR (char_I_step_is_1min);           // Use 1min integration for tissue and CNS.
+
+VAR_UINT  (int_I_pres_respiration);        // 
+VAR_UINT  (int_I_pres_surface);            // 
+VAR_UINT  (int_I_temp);                    // new in v101
+VAR_UINT  (int_I_divemins);                // Dive time (minutes)
+VAR_UCHAR (char_I_temp);                   // new in v101
+VAR_UCHAR (char_I_actual_ppO2);            // 
+VAR_UCHAR (char_I_first_gas);              // Gas used at start of dive (bottom mix)
+VAR_UCHAR (char_I_current_gas);            // Current gas breathed (1..3).
+VAR_UCHAR (char_I_N2_ratio);               //
+VAR_UCHAR (char_I_He_ratio);               //
+VAR_UCHAR (char_I_O2_ratio);               //
+VAR_UCHAR (char_I_saturation_multiplier);  // for conservatism/safety values 1.0  no conservatism to 1.5  50% faster saturation
+VAR_UCHAR (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 
+VAR_UCHAR (char_I_GF_High_percentage);     // new in v.102
+VAR_UCHAR (char_I_GF_Low_percentage);      // new in v.102
+VAR_UCHAR (char_I_deco_distance);          // 
+VAR_UCHAR (char_I_depth_last_deco);        // new in v.101 unit: [m]
+VAR_UCHAR (char_I_deco_model);             // new in v.102. 0 == ZH-L16, 1 = ZH-L16-GF (Gradiant factor)
+VAR_UCHAR (char_I_bottom_depth);           // Bottom depth for planning (used in gas volume evaluation).
+VAR_UCHAR (char_I_bottom_time);            // Bottom time for planning (used in gas volume evaluation).
+VAR_UCHAR (char_I_dive_interval);          // Delay before next dive simulation.
+VAR_UCHAR (char_I_const_ppO2);             // new in v.101
+
+TAB_UCHAR (char_I_deco_enable, NUM_GAS);    // new in v.101
+
+TAB_UCHAR (char_I_deco_gas_change,NUM_GAS); // new in v.101
+TAB_UCHAR (char_I_dil_change,NUM_GAS);      // Must be placed after char_I_deco_gas_change!
+
+TAB_UCHAR (char_I_setpoint_change,NUM_GAS); // Change depths in m
+TAB_UCHAR (char_I_deco_N2_ratio, NUM_GAS);  // new in v.101
+TAB_UCHAR (char_I_deco_He_ratio, NUM_GAS);  // new in v.101
+
+TAB_UCHAR (char_I_setpoint_cbar,NUM_GAS);         // Setpoints in cbar
+
+VAR_UCHAR (char_I_bottom_usage);            // [l/min]
+VAR_UCHAR (char_I_deco_usage);              // [l/min]
+
+VAR_UCHAR (char_I_extra_time);              // [min]
+VAR_UCHAR (temp_bankx400);                  // temp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/simulator.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,675 @@
+;=============================================================================
+;
+;   File simulator.asm
+;
+;   Decoplan interface to C model code.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-07-09 : [jDG] Creation...
+
+#include "ostc3.inc"					; Mandatory include.
+#include "convert.inc"                  ; output_*
+#include "shared_definitions.h"         ; Mailbox from/to p2_deco.c
+#include "strings.inc"                  ; STRCPY,...
+#include "tft.inc"                      ; WIN_LEFT,...
+#include "wait.inc"                     ; speed_*
+#include "start.inc"
+#include "divemode.inc"
+#include "math.inc"
+#include "eeprom_rs232.inc"
+
+gui     CODE
+
+    extern  deco_clear_tissue
+    extern  deco_push_tissues_to_vault
+    extern  deco_calc_dive_interval
+    extern  deco_calc_hauptroutine
+    extern  deco_calc_tissue
+    extern  deco_calc_CNS_fraction
+    extern  deco_calc_CNS_planning
+    extern  deco_pull_tissues_from_vault
+
+    extern  log_screendump_and_onesecond, logbook_preloop_tasks
+
+;---- Private temp variables -------------------------------------------------
+        CBLOCK  tmp+0x10                ; Reserved space for wordprocessor and convert
+            decoplan_index              ; within each page
+            decoplan_gindex             ; global index
+            decoplan_last               ; Depth of last stop (CF#29)
+            decoplan_max                ; Number of lines per page.
+            decoplan_flags              ; Various private flags.
+            decoplan_CNS:2              ; Backup CNS before vault restore
+            ; Reserved to tmp+0x1F...
+        ENDC
+#define decoplan_last_ceiling_shown   decoplan_flags,0
+
+;---- Demo decoplanner -------------------------------------------------------
+        global  do_demo_planner
+        extern  do_planner_menu
+
+do_demo_planner:
+        call    speed_fastest
+;        call    deco_reset              ; TODO: remove reset all Decodata
+        call    deco_planer
+        call    deco_show_plan
+        call    speed_eco
+        bcf     switch_right
+        bcf     switch_left
+        goto    do_planner_menu
+
+;=============================================================================
+; Pass all parameters to the C code
+;
+
+    global  get_first_dil_to_WREG
+get_first_dil_to_WREG:                  ; Gets first dil (0-4) into WREG
+        lfsr    FSR1,opt_dil_type       ; Point to dil types
+        clrf    lo                      ; start with Gas0
+        bra     get_first_gas_to_WREG2  ; Start
+
+    global  get_first_gas_to_WREG
+get_first_gas_to_WREG:                  ; Gets first gas (0-4) into WREG
+        lfsr    FSR1,opt_gas_type       ; Point to gas types
+        clrf    lo                      ; start with Gas0
+get_first_gas_to_WREG2:
+        movf    lo,W                    ;
+        movf    PLUSW1,W                ; Get Type of Gas #lo
+        sublw   .1                      ; it is = 1 (First Gas)
+        bz      get_first_gas_to_WREG3  ; Found the first gas!
+        incf    lo,F                    ; ++
+        movlw   NUM_GAS+1
+        cpfseq  lo                      ; All done?
+        bra     get_first_gas_to_WREG2  ; Not yet
+        retlw  .1                       ; No first gas found, use #1
+get_first_gas_to_WREG3:
+        movf    lo,W                    ; Put into Wreg
+        return                          ; Done
+
+        global  deco_setup
+deco_setup:
+        banksel char_I_step_is_1min     ; Select the right bank...
+        clrf    char_I_step_is_1min     ; Default to 2sec steps.
+
+        ; Fixed ambient surface pressure to 1bar.
+        movlw   LOW(.1000)
+        movwf   int_I_pres_surface+0
+        movwf   int_I_pres_respiration+0
+        movlw   HIGH(.1000)
+        movwf   int_I_pres_surface+1
+        movwf   int_I_pres_respiration+1
+    
+        clrf    int_I_divemins+0        ; Dive start
+        clrf    int_I_divemins+1
+
+        call    get_first_gas_to_WREG           ; Gets first gas (0-4) into WREG
+        movff   WREG,char_I_first_gas           ; Copy for compatibility
+        extern  setup_gas_registers
+        call    setup_gas_registers             ; With WREG=Gas 0-4, set current N2/He/O2 ratios.
+        extern  set_actual_ppo2
+        call    set_actual_ppo2                 ; Then configure char_I_actual_ppO2 (For CNS)
+
+        global	deco_setup_dive
+deco_setup_dive:						; Called from divemode
+        banksel common                  ; Bank1
+
+        btfss   FLAG_ccr_mode           ; =1: CCR mode (Fixed ppO2 or Sensor) active
+        rcall   deco_setup_oc_gases     ; Setup OC Gases
+        btfsc   FLAG_ccr_mode           ; =1: CCR mode (Fixed ppO2 or Sensor) active
+        rcall   deco_setup_cc_diluents  ; Setup CC Diluents
+        btfsc   is_bailout              ; =1: Bailout
+        rcall   deco_setup_oc_gases     ; Setup OC/Bailout Gases
+
+        movlw   deco_distance
+        movff   WREG,char_I_deco_distance
+        movff   opt_last_stop,char_I_depth_last_deco
+        movff   opt_GF_low,char_I_GF_Low_percentage
+        movff   opt_GF_high,char_I_GF_High_percentage
+        ;Overwrite GF if aGF is wanted
+        btfsc   use_agf                         ; =1: Use aGF
+        movff   opt_aGF_low,char_I_GF_Low_percentage
+        btfsc   use_agf                         ; =1: Use aGF        
+        movff   opt_aGF_high,char_I_GF_High_percentage
+        return
+
+deco_setup_cc_diluents:
+        movff   opt_dil_He_ratio+0,char_I_deco_He_ratio+0
+        movff   char_I_deco_He_ratio+0,lo
+        movff   opt_dil_O2_ratio+0,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+0
+        movff   opt_dil_type+0,WREG   ; 0=Disabled, 1=First, 2=Normal
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+0   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_dil_He_ratio+1,char_I_deco_He_ratio+1
+        movff   char_I_deco_He_ratio+1,lo
+        movff   opt_dil_O2_ratio+1,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+1
+        movff   opt_dil_type+1,WREG   ; 0=Disabled, 1=First, 2=Normal
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+1   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_dil_He_ratio+2,char_I_deco_He_ratio+2
+        movff   char_I_deco_He_ratio+2,lo
+        movff   opt_dil_O2_ratio+2,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+2
+        movff   opt_dil_type+2,WREG   ; 0=Disabled, 1=First, 2=Normal
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+2   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_dil_He_ratio+3,char_I_deco_He_ratio+3
+        movff   char_I_deco_He_ratio+3,lo
+        movff   opt_dil_O2_ratio+3,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+3
+        movff   opt_dil_type+3,WREG   ; 0=Disabled, 1=First, 2=Normal
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+3   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_dil_He_ratio+4,char_I_deco_He_ratio+4
+        movff   char_I_deco_He_ratio+4,lo
+        movff   opt_dil_O2_ratio+4,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+4
+        movff   opt_dil_type+4,WREG   ; 0=Disabled, 1=First, 2=Normal
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+4   ; Yes, clear char_I_deco_gas_change
+        return
+
+deco_setup_oc_gases:
+        movff   opt_gas_He_ratio+0,char_I_deco_He_ratio+0
+        movff   char_I_deco_He_ratio+0,lo
+        movff   opt_gas_O2_ratio+0,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+0
+        movff   opt_gas_type+0,WREG   ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+0   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_gas_He_ratio+1,char_I_deco_He_ratio+1
+        movff   char_I_deco_He_ratio+1,lo
+        movff   opt_gas_O2_ratio+1,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+1
+        movff   opt_gas_type+1,WREG   ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+1   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_gas_He_ratio+2,char_I_deco_He_ratio+2
+        movff   char_I_deco_He_ratio+2,lo
+        movff   opt_gas_O2_ratio+2,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+2
+        movff   opt_gas_type+2,WREG   ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+2   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_gas_He_ratio+3,char_I_deco_He_ratio+3
+        movff   char_I_deco_He_ratio+3,lo
+        movff   opt_gas_O2_ratio+3,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+3
+        movff   opt_gas_type+3,WREG   ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+3   ; Yes, clear char_I_deco_gas_change
+
+        movff   opt_gas_He_ratio+4,char_I_deco_He_ratio+4
+        movff   char_I_deco_He_ratio+4,lo
+        movff   opt_gas_O2_ratio+4,WREG
+        addwf   lo,W                  ; O2 + He -> WREG
+        sublw   .100                  ; 100 - (O2 + He) -> WREG
+        movff   WREG,char_I_deco_N2_ratio+4
+        movff   opt_gas_type+4,WREG   ; 0=Disabled, 1=First, 2=Travel, 3=Deco
+        tstfsz  WREG                  ; Disabled?
+        bra     $+4                   ; No
+        movff   WREG,char_I_deco_gas_change+4   ; Yes, clear char_I_deco_gas_change
+        return
+
+;=============================================================================
+; Reset decompression tissues
+; 
+        global  deco_reset
+deco_reset:
+        rcall   deco_setup              ; Setup all model parameters.
+        call    deco_clear_tissue       ; Set all tissues to Pamb * N2_ratio
+        call    deco_clear_CNS_fraction ; Reset CNS value.
+        banksel common                  ; Bank1
+        return
+
+;=============================================================================
+; Launch decoplanning
+; 
+    global  deco_planer
+deco_planer:
+        call    speed_fastest           ; Quick !
+        rcall   deco_setup              ; Setup all model parameters.
+        call    deco_push_tissues_to_vault
+        banksel common                  ; Bank1
+
+;---- Specific settings ------------------------------------------------------
+   
+        banksel char_O_deco_status      ; Bank 2
+        movlw   .3                      ; Start in surface state.
+        movwf   char_O_deco_status
+    
+        banksel char_I_step_is_1min     ; Bank 3
+        movlw   1
+        movwf   char_I_step_is_1min     ; Set 1min steps
+
+;---- Add delay at surface, if needed ----------------------------------------
+        tstfsz  char_I_dive_interval
+        call    deco_calc_dive_interval
+
+;---- Dive loop --------------------------------------------------------------
+
+        ; Compute dive ambiant conditions
+        banksel char_I_bottom_depth
+        movf    char_I_bottom_depth,W
+        mullw   .100
+        movlw   LOW(.1000)
+        addwf   PRODL,W
+        movwf   int_I_pres_respiration+0
+        movlw   HIGH(.1000)
+        addwfc  PRODH,W
+        movwf   int_I_pres_respiration+1
+
+        banksel int_I_divemins          ; Bank 4
+        clrf    int_I_divemins+0        ; Clear dive time
+        clrf    int_I_divemins+1
+
+        clrf    TMR5L
+        clrf    TMR5H                   ; 30,51757813µs/bit in TMR5L:TMR5H
+        call    deco_calc_hauptroutine  ; Reset + simulate first min.
+
+deco_planer_loop:
+        banksel int_I_divemins          ; Bank 3
+        incf    int_I_divemins,F        ; Done 1 min.
+        btg     LEDg
+    
+        movf    char_I_bottom_time,W    ; Finished ?
+        xorwf   int_I_divemins,W
+        bz      deco_planer_endloop     ; YES
+    
+        call	deco_calc_tissue	    ; JUST calc tissue (faster).
+        call	deco_calc_CNS_fraction  ; Also calculate CNS (in 1min loop)
+        bra     deco_planer_loop
+
+deco_planer_endloop:
+        banksel char_I_step_is_1min
+        clrf    char_I_step_is_1min     ; Back to 2sec loops
+
+;---- Wait until status reach zero -------------------------------------------
+deco_planer_finishing:
+        btg     LEDg
+        clrf    TMR5L
+        clrf    TMR5H                       ; 30,51757813µs/bit in TMR5L:TMR5H
+        call    deco_calc_hauptroutine  ; Simulate 2sec more
+
+        banksel char_O_deco_status      ; Bank 2
+        movf    char_O_deco_status,W
+        bz      deco_planer_finished
+        
+        bra     deco_planer_finishing
+
+deco_planer_finished:
+        call    deco_calc_CNS_planning
+        movff   int_O_CNS_fraction+0,decoplan_CNS+0
+        movff   int_O_CNS_fraction+1,decoplan_CNS+1
+        call    deco_pull_tissues_from_vault
+        bcf     LEDg
+        banksel common                  ; Bank1
+		movlw	b'00111000'				; 1:8 Prescaler -> 65,536ms@16MHz
+		movwf	T3CON
+        call    speed_normal
+        return
+
+;-----------------------------------------------------------------------------
+; Draw a stop of the deco plan (simulator or dive).
+; Inputs: lo      = depth. Range 3m...93m
+;                 + 80 if this is a switch-gas stop.
+;         up      = minutes. range 1'..240'.
+;         win_top = line to draw on screen.
+; Trashed: up, lo, win_height, win_leftx2, win_width, win_color*,
+;          WREG, PROD, TBLPTR TABLAT.
+;
+deco_plan_show_stop:
+        ;---- Print depth ----------------------------------------------------
+        btfss   lo,7                    ; Bit set ?
+        bra     deco_plan_show_std_stop  ; No : Just an usual stop.
+
+        TFT_ATTENTION_COLOR
+        bcf     lo,7                    ; and cleanup depth.
+        bra     deco_plan_show_nstd_stop
+
+deco_plan_show_std_stop:
+    	TFT_STD_COLOR
+
+deco_plan_show_nstd_stop:        
+	    lfsr	FSR2,buffer
+
+		TSTOSS  opt_units			; 0=Meters, 1=Feets
+		bra		deco_plan_show_nstd_stop_metric
+
+        WIN_LEFT .85
+		movf	lo,W					; lo = m
+		mullw	.100					; PRODL:PRODH = mbar
+		movff	PRODL,lo
+		movff	PRODH,hi
+; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops...
+		movff	lo,xA+0
+		movff	hi,xA+1
+		movlw	LOW 	d'334'          ; 334feet/100m
+		movwf	xB+0
+		movlw	HIGH 	d'334'
+		movwf	xB+1
+		call	mult16x16			    ; xA*xB=xC (lo:hi * 328)
+		movlw	d'50'                   ; round up
+		addwf	xC+0,F
+		movlw	0
+		addwfc	xC+1,F
+		addwfc	xC+2,F
+		addwfc	xC+3,F
+		movlw	d'100'					
+		movwf	xB+0
+		clrf	xB+1
+		call	div32x16  			    ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+		movff	xC+0,lo
+		movff	xC+1,hi				    ; restore lo and hi with updated value
+		bsf		leftbind
+		bsf		ignore_digit4			; Only full feet
+		output_16
+		STRCAT_PRINT	"ft "
+		bra		deco_plan_show_nstd_stop_common
+
+deco_plan_show_nstd_stop_metric:
+        WIN_LEFT .90
+	    bsf     leftbind
+	    output_8					    ; outputs into Postinc2!
+        STRCAT_PRINT 	"m "
+deco_plan_show_nstd_stop_common:
+        ;---- Print duration -------------------------------------------------
+	    WIN_LEFT	.135
+	    lfsr	FSR2,buffer
+	    
+	    movf    lo,W                    ; Swap up & lo
+	    movff   up,lo
+	    movwf   up
+
+	    output_8					    ; Allow up to 240'
+        STRCAT_PRINT "'  "              ; 1 to 3 chars for depth.
+
+	    movf    lo,W                    ; Swap back up & lo
+	    movff   up,lo
+	    movwf   up
+
+        ;---------------------------------------------------------------------
+        ; Draw the bar graph used for deco stops (decoplan in simulator or dive).
+        incf   win_top,F
+        movlw	.19
+        movwf   win_height
+        movlw	.118
+        movwf	win_leftx2    		    ; column left (0-159)
+        movlw	.16
+        movwf	win_width    		    ; column max width.
+
+        ; Draw used area (up = minutes):
+        movlw	.16                     ; Limit length (16min)
+        cpfslt	up
+        movwf	up
+        movff	up,win_bargraph         ; Active width, the rest is cleared.
+        call	TFT_box
+
+        ; Restore win_top
+	    TFT_STD_COLOR
+        decf    win_top,F               ; Restore win_top
+        return
+
+;-----------------------------------------------------------------------------
+; Clear unused area belw last stop
+; Inputs: win_top : last used area...
+deco_plan_show_clear_bottom:
+        movf    win_top,W               ; Get back from bank0
+        btfsc   divemode                ; In dive mode ?
+        sublw   .168                    ; Yes: bottom row in divemode
+        btfss   divemode                ; In dive mode ?
+        sublw   .240                    ; No: bottom row in planning
+        movwf   win_height
+
+        WIN_LEFT .85                    ; Full divemenu width
+        movlw   .160-.85+1
+        movwf   win_width
+
+        clrf    win_color1              ; Fill with black
+        clrf    win_color2
+
+        goto	TFT_box
+
+;-----------------------------------------------------------------------------
+; Display the decoplan (simulator or divemode).
+; Inputs: char_O_deco_table (array of stop times, in minutes)
+;         decoplan_page = page number.
+;
+deco_show_plan_page:
+        WIN_INVERT 0
+
+        ;---- Is there deco stops ? ------------------------------------------
+    	movff   char_O_first_deco_depth,WREG
+    	iorwf   WREG
+        bnz		deco_plan_show_1
+
+        ;---- No Deco --------------------------------------------------------
+    	TFT_STD_COLOR
+        TEXT_SMALL   .80, .0, tNoDeco
+        bsf     decoplan_last_ceiling_shown
+        return
+
+deco_plan_show_1:
+    	lfsr	FSR0,char_O_deco_depth  ; Initialize indexed addressing.
+	    lfsr	FSR1,char_O_deco_time
+
+        movlw   .8                      ; 8 lines/page in decoplan
+        btfsc   divemode
+        movlw   .6                      ; 6 lines/page in divemode.
+        movwf   decoplan_max
+
+        clrf    decoplan_index          ; Start with index = 0
+        clrf	win_top                 ; and row = 0
+
+        ; Read stop parameters, indexed by decoplan_index and decoplan_page
+        movf    decoplan_page,W         ; decoplan_gindex = 6*decoplan_page + decoplan_index
+        mulwf   decoplan_max
+        movf    decoplan_index,W
+        addwf   PRODL,W
+        movwf   decoplan_gindex         ; --> decoplan_gindex
+
+        bcf     decoplan_last_ceiling_shown   ; Not finished yet...
+
+deco_plan_show_2:
+        btfsc   decoplan_gindex,5       ; Reached table length (32) ?
+        bra     deco_plan_show_99       ; YES: finished...
+
+        ; Read stop parameters, indexed by decoplan_index
+        movf    decoplan_gindex,W       ; index
+    	movff	PLUSW1,up               ; char_O_deco_time [gindex] --> up
+	    movff	PLUSW0,lo               ; char_O_deco_depth[gindex]
+        movf    lo,W
+        bz      deco_plan_show_99       ; depth == 0 : finished.
+
+        ; Display the stop line
+    	rcall	deco_plan_show_stop
+
+        ; Next
+        movlw   .24
+        addwf   win_top,F               ; row: += 24
+	    incf	decoplan_index,F        ; local index += 1
+	    incf	decoplan_gindex,F       ; global index += 1
+
+        ; Max number of lines/page reached ?
+    	movf    decoplan_max,W          ; index+1 == max ?
+    	cpfseq	decoplan_index
+    	bra		deco_plan_show_2         ; NO: loop
+
+    	; Check if next stop if end-of-list ?
+    	movf    decoplan_gindex,W
+	    movf	PLUSW0,W                ; char_O_deco_depth[gindex]
+    	bz      deco_plan_show_99         ; End of list...
+
+        ; Display the message "more..."
+        rcall   deco_plan_show_clear_bottom  ; Clear from next line
+
+    	TFT_STD_COLOR
+        TEXT_SMALL .85, .240-.25, tMore
+        return
+
+deco_plan_show_99:
+        bsf		decoplan_last_ceiling_shown ; Nothing more in table to display.
+        rcall   deco_plan_show_clear_bottom ; Clear from next line
+        return
+
+;-----------------------------------------------------------------------------
+; Loop to show all pages of the decoplan (surfacemode)
+
+        global  deco_show_plan
+deco_show_plan:
+        clrf    decoplan_page
+        call    TFT_ClearScreen
+        WIN_COLOR   color_greenish
+        TEXT_SMALL  .1,.1, tDivePlan
+        TFT_STD_COLOR
+        WIN_LEFT    .0
+        
+        ;---- Display model
+        movff   char_I_deco_model,WREG
+        iorwf   WREG
+        bnz     deco_show_plan_m1
+        
+        ; Display ZH-L16 sat/desat model.
+        TEXT_SMALL  .0,.40,  tZHL16
+        WIN_TOP .65
+        lfsr    FSR2,buffer
+        movff   char_I_desaturation_multiplier,lo
+        bsf     leftbind
+        output_8
+        STRCAT  "%/"
+        movff   char_I_saturation_multiplier,lo
+        output_8
+        STRCAT_PRINT  "%"
+        bra     deco_show_plan_m2
+
+        ; Display ZH-L16-GF low/high model.
+deco_show_plan_m1:
+        TEXT_SMALL  .0,.40,  tZHL16GF
+        WIN_TOP .65
+        lfsr    FSR2,buffer
+        movff   char_I_GF_Low_percentage,lo
+        output_99x
+        STRCAT  "%/"
+        movff   char_I_GF_High_percentage,lo
+        output_99x
+        STRCAT_PRINT  "%"
+        ;bra     deco_show_plan_m2
+
+deco_show_plan_m2:        
+        
+        ;---- Display TTS result
+        WIN_TOP     .165
+        STRCPY_TEXT tTTS
+        STRCAT  ": "
+
+        movff   int_O_ascenttime+0,lo
+        movff   int_O_ascenttime+1,hi
+        bsf     leftbind
+        output_16
+        STRCAT_PRINT "'"
+
+        ;---- Display CNS result
+        WIN_TOP     .190
+        STRCPY_TEXT tCNS
+        STRCAT  ": "
+        movff   int_O_CNS_fraction+0,lo
+        movff   int_O_CNS_fraction+1,hi
+        output_16_3
+        STRCAT  "%\x92"					; "->"
+        movff   decoplan_CNS+0,lo
+        movff   decoplan_CNS+1,hi
+        output_16_3
+        STRCAT_PRINT "%"
+       
+        ;---- Loop through pages
+deco_show_plan_1:
+        call    speed_normal
+        rcall   deco_show_plan_page
+        incf    decoplan_page,F
+
+        call    logbook_preloop_tasks
+deco_show_plan_2:
+        btfsc   switch_right
+        bra     deco_show_plan_3
+        btfsc   switch_left
+        bra     deco_show_plan_4
+        call    log_screendump_and_onesecond    ; Check if we need to make a screenshot and check for new second
+    	btfsc	sleepmode                       ; Timeout?
+        bra		deco_show_plan_4                ; Exit
+        bra     deco_show_plan_2
+
+deco_show_plan_3:
+        btfss   decoplan_last_ceiling_shown
+        bra     deco_show_plan_1
+
+deco_show_plan_4:
+        call    speed_normal            ; Display in fast mode.
+        return
+
+;=============================================================================
+;
+        global  do_demo_divemode
+do_demo_divemode:
+		extern	option_save_all
+		call	option_save_all			; Save all settings into EEPROM before starting simulation
+ 		call    deco_push_tissues_to_vault
+        banksel common                  ; Bank1
+
+		bsf		restore_deco_data		; Restore tissue and CNS after sim
+
+		bcf		pressure_refresh
+		btfss	pressure_refresh					; Wait for sensor
+		bra		$-2
+
+		bsf		simulatormode_active				; Set Flag
+		movlw	LOW			simulator_start_depth
+		movff	WREG,rel_pressure+0
+		movlw	HIGH		simulator_start_depth
+		movff	WREG,rel_pressure+1					; Set Depth
+
+		movlw	LOW			(simulator_start_depth+.1000)
+		movff	WREG,sim_pressure+0
+		movlw	HIGH		(simulator_start_depth+.1000)
+		movff	WREG,sim_pressure+1					; Set Depth
+
+		bsf		divemode
+		goto	diveloop							; Switch into Divemode!
+
+
+        END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sleepmode.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,201 @@
+;=============================================================================
+;
+;   File sleepmode.asm
+;
+;   Sleepmode
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-12 : [mH] moving from OSTC code
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include	"surfmode.inc"
+#include	"tft.inc"
+#include	"isr.inc"
+#include	"start.inc"
+#include	"adc_lightsensor.inc"
+#include	"math.inc"
+#include	"ms5541.inc"
+#include	"wait.inc"
+#include	"eeprom_rs232.inc"
+#include 	"external_flash.inc"
+#include	"ghostwriter.inc"
+#include    "i2c.inc"
+
+gui     CODE
+
+	global	sleeploop
+sleeploop:							; enter sleepmode!
+    call    disable_ir              ; IR off
+    bcf     mcp_power               ; RX off
+    btfsc   mcp_power
+    bra     $-4
+	bcf		LEDg
+	bcf		LEDr
+	call	TFT_Display_FadeOut
+	call	TFT_DisplayOff			; display off
+	call	disable_rs232			; USB off
+    call    I2C_sleep_accelerometer
+    call    I2C_sleep_compass
+	call	ext_flash_enable_protection	; enable write protection for external flash
+	call	update_battery_registers	; update battery registers into EEPROM
+	clrf	divemins+0
+	clrf	divemins+1
+	call	speed_normal
+	bsf		no_sensor_int			; No sensor interrupt
+    bcf     enable_screen_dumps     ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+	clrf	ADCON0					; Power-Down ADC Module
+sleeploop_loop:
+	btfsc	onehourupdate			; one hour in sleep?
+	call	update_battery_registers;update battery registers into EEPROM
+
+	btfsc	oneminupdate			; one minute in sleep?
+	rcall	onemin_sleep			; do oneminute tasks, e.g. calculate desaturation
+
+	btfsc	onesecupdate			; one second in sleep?
+	rcall	onesec_sleep			; check switches, check pressure sensor, etc.
+
+	btfss	sleepmode				; wake up? (This bit will be set in other routines)
+	goto	restart					; yes
+
+	rcall 	sleepmode_sleep			; Wait at least 35ms (every 62,5ms Timer7 wakeup)
+
+	; Any button pressed in sleep?
+	btfsc	switch_left	
+	rcall	onesec_sleep1a
+	btfsc	switch_right
+	rcall	onesec_sleep1a
+
+	btfss	sleepmode				; wake up? (This bit will be set in other routines)
+	goto	restart					; yes
+
+	bra		sleeploop_loop			; do loop until someting happens
+
+
+onemin_sleep:
+    ;---- adjust airpressure compensation any 15 minutes
+	incf	divemins+1,F			; counts to 14...
+	movlw	d'14'
+	cpfsgt	divemins+1
+	bra		onemin_sleep2			; 15 minutes not done!
+
+; Tasks every 15 minutes in sleep
+	clrf	divemins+1				; reset counter
+
+	call	deco_calc_CNS_decrease_15min		; compute CNS decay in sleep only
+	banksel	common
+
+	SAFE_2BYTE_COPY last_surfpressure_15min, last_surfpressure_30min		; save older airpressure
+	SAFE_2BYTE_COPY amb_pressure, last_surfpressure_15min		; save new airpressure
+
+	movlw	LOW		max_surfpressure
+	movff	WREG,sub_a+0				; max. "allowed" airpressure in mbar
+	movlw	HIGH	max_surfpressure
+	movff	WREG,sub_a+1				; max. "allowed" airpressure in mbar
+	movff	last_surfpressure_15min+0,sub_b+0
+	movff	last_surfpressure_15min+1,sub_b+1
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag                ; Is 1080mbar < amb_pressure ?
+	bra		onemin_sleep2			; NO: current airpressure is lower then "allowed" airpressure, ok!
+
+    ; not ok! Overwrite with max. "allowed" airpressure
+	movlw	LOW		max_surfpressure
+	movff	WREG,last_surfpressure_15min+0	; max. "allowed" airpressure in mbar
+	movlw	HIGH	max_surfpressure
+	movff	WREG,last_surfpressure_15min+1	; max. "allowed" airpressure in mbar
+
+onemin_sleep2:
+; Tasks every minute in sleep
+    SAFE_2BYTE_COPY amb_pressure, int_I_pres_respiration ; LOW copy pressure to deco routine
+	call	deco_calc_wo_deco_step_1_min	; "calc_tissue_sleep"
+	banksel		common
+
+	bcf		oneminupdate			; all done
+	return
+
+onesec_sleep:
+	incf	divemins+0,F 			; counts to #test_pressure_in_sleep (5)
+	movlw	d'5'
+	cpfsgt	divemins+0				; here: temp variable
+	bra		onesec_sleep1			; #test_pressure_in_sleep not done yet
+
+	clrf	divemins+0				; clear counter
+	rcall	pressuretest_sleep_fast	; Gets pressure without averaging (faster!)
+        ; compare current ambient pressure with wake_up_from_sleep
+	movlw	LOW		wake_up_from_sleep
+	movwf	sub_a+0					; power on if ambient pressure is greater threshold
+	movlw	HIGH	wake_up_from_sleep
+	movwf	sub_a+1					; power on if ambient pressure is greater threshold
+	SAFE_2BYTE_COPY amb_pressure, sub_b
+	call	subU16					; Is (1160mbar - averaged(amb_pressure)) < 0 ?
+	btfsc	neg_flag				; Wake up from Sleep?
+	bra		onesec_sleep1a			; Yes, skip button checks, wake up!
+
+    btfsc   vusb_in                 ; USB plugged in?
+	bra		onesec_sleep1a			; Yes, skip button checks, wake up!
+
+onesec_sleep1:
+	bcf		onesecupdate			; all done.
+; Check switches
+	btfsc	switch_left
+	bra		onesec_sleep1a
+	btfsc	switch_right
+	bra		onesec_sleep1a				
+; No button pressed
+	bcf		INTCON,INT0IF				; Clear flag
+	bcf		INTCON3,INT1IF				; Clear flag
+	return
+
+onesec_sleep1a:	; At least one button pressed or amb_pressure > wake_up_from_sleep
+	bcf		INTCON,INT0IF				; Clear flag
+	bcf		INTCON3,INT1IF				; Clear flag
+	bcf		switch_right
+	bcf		switch_left
+	bcf		sleepmode                   ; wake up!
+	SAFE_2BYTE_COPY last_surfpressure_30min, amb_pressure	; copy for compatibility
+	movlw	.0
+	movff	WREG,sensor_state_counter	; Reset sensor state counter
+	bcf		no_sensor_int				; normal sensor interrupt mode
+	return
+	
+pressuretest_sleep_fast:				; Get pressure without averaging (Faster to save some power in sleep mode)
+	banksel 	isr_backup              ; Back to Bank0 ISR data
+	clrf		amb_pressure_avg+0  	; pressure average registers
+	clrf		amb_pressure_avg+1
+	clrf		temperature_avg+0
+	clrf		temperature_avg+1
+	call		get_temperature_start	; and start temperature integration (73,5us)
+	banksel		common
+	rcall 		sleepmode_sleep			; Wait at least 35ms (every 62,5ms Timer7 wakeup)
+	rcall 		sleepmode_sleep			; Wait at least 35ms (every 62,5ms Timer7 wakeup)
+	banksel 	isr_backup              ; Back to Bank0 ISR data
+	call		get_temperature_value	; State 1: Get temperature	
+	call		get_pressure_start	 	; Start pressure integration.
+	banksel 	common
+	rcall 		sleepmode_sleep			; Wait at least 35ms (every 62,5ms Timer7 wakeup)
+	rcall 		sleepmode_sleep			; Wait at least 35ms (every 62,5ms Timer7 wakeup)
+	banksel 	isr_backup              ; Back to Bank0 ISR data
+	call		get_pressure_value		; State2: Get pressure (51us)
+	call		calculate_compensation		; calculate temperature compensated pressure (27us)
+	banksel 	common
+    SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure	; copy for compatibility
+	return
+
+sleepmode_sleep:
+	banksel 	0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+	clrf		T7GCON				; Reset Timer7 Gate Control register
+	movlw		b'10001101'			; 1:1 Prescaler -> 2seconds@32768Hz, not synced
+	movwf		T7CON
+    banksel 	common              ; Bank1
+	sleep
+	nop	
+	banksel 	0xF16				; Addresses, F16h through F5Fh, are also used by SFRs, but are not part of the Access RAM.
+	clrf		T7GCON				; Reset Timer7 Gate Control register
+	movlw		b'10001001'			; 1:1 Prescaler -> 2seconds@32768Hz, synced
+	movwf		T7CON
+    banksel 	common              ; Bank1
+	return
+
+ END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/sleepmode.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,11 @@
+;=============================================================================
+;
+;   File sleepmode.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-12 : [mH] moving from OSTC code
+
+ extern sleeploop
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/start.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,283 @@
+;=============================================================================
+;
+;   File start.asm
+;
+;   Startup subroutines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-06 : [mH] moving from OSTC code
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include	"ms5541.inc"
+#include	"isr.inc"
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include	"eeprom_rs232.inc"
+#include	"math.inc"
+#include	"tft.inc"
+#include	"surfmode.inc"
+#include	"wait.inc"
+#include	"rtc.inc"
+#include 	"external_flash.inc"
+#include	"convert.inc"
+#include	"strings.inc"
+#include	"tft_outputs.inc"
+
+        extern  init_ostc3
+        extern  option_restore_all
+
+;=============================================================================
+; Reset vector: What to do on device wake-up and hard reset.
+;
+reset_v code     0x00000
+;    goto    start
+	goto	0x1FF00     ; Bootloader
+
+	ORG     0x00004			; Needed for second-level bootloader
+	goto	start
+;=============================================================================
+boot   CODE
+	global start
+
+start:
+	lfsr	FSR0,0x000				; Clear rambank 0-14
+clear_rambank:
+	clrf	POSTINC0
+	movlw	0x0F
+	cpfseq	FSR0H					; Bank 14 done?
+	bra		clear_rambank			; clear...
+
+    call    init_ostc3
+  	call    speed_normal
+
+	bsf		no_sensor_int			; disable sensor interrupt
+
+	call	disable_rs232			; disable UART module
+; Air pressure compensation	after reset
+	call	get_calibration_data	; Get calibration data from pressure sensor
+	banksel common                  ; get_calibration_data uses isr_backup
+	bcf		no_sensor_int		    ; normal sensor interrupt mode
+
+	bcf		pressure_refresh
+; First pass will not have valid temperature!
+	btfss	pressure_refresh 		; Air pressure compensation
+	bra		$-2
+; Second pass
+	bcf		pressure_refresh
+	btfss	pressure_refresh 		; Air pressure compensation
+	bra		$-2
+
+	clrf	rel_pressure+0
+	clrf	rel_pressure+1
+	clrf	surface_interval+0
+	clrf	surface_interval+1
+
+    SAFE_2BYTE_COPY amb_pressure, last_surfpressure
+
+	movlw	LOW		max_surfpressure
+	movff	WREG,sub_a+0				; max. "allowed" airpressure in mbar
+	movlw	HIGH	max_surfpressure
+	movff	WREG,sub_a+1				; max. "allowed" airpressure in mbar
+	movff	last_surfpressure+0,sub_b+0
+	movff	last_surfpressure+1,sub_b+1
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag                ; Is 1080mbar < amb_pressure ?
+	bra		start_copy_pressure		; NO: current airpressure is lower then "allowed" airpressure, ok!
+
+    ; not ok! Overwrite with max. "allowed" airpressure
+	movlw	LOW		max_surfpressure
+	movff	WREG,last_surfpressure+0	; max. "allowed" airpressure in mbar
+	movlw	HIGH	max_surfpressure
+	movff	WREG,last_surfpressure+1	; max. "allowed" airpressure in mbar
+
+start_copy_pressure:
+	movff	last_surfpressure+0,last_surfpressure_15min+0
+	movff	last_surfpressure+1,last_surfpressure_15min+1
+	movff	last_surfpressure+0,last_surfpressure_30min+0
+	movff	last_surfpressure+1,last_surfpressure_30min+1	; Rests all airpressure registers
+
+; reset deco data for surface mode
+	movlw	d'79'
+	movff	WREG,char_I_N2_ratio            ; 79% N2
+    SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine
+	movff	int_I_pres_respiration+0,int_I_pres_surface+0     ; copy for desat routine
+	movff	int_I_pres_respiration+1,int_I_pres_surface+1		
+
+	extern	deco_reset
+	call	deco_reset
+	call	deco_calc_desaturation_time     ; calculate desaturation time
+	banksel common
+	call	deco_calc_wo_deco_step_1_min	; calculate deco in surface mode 
+	banksel common
+  	clrf	nofly_time+0	              	; Reset NoFly
+  	clrf	nofly_time+1
+	clrf	desaturation_time+0				; Reset Desat
+	clrf	desaturation_time+1
+	bcf		menubit							; clear menu flag
+; Check for Power-on reset here
+	extern	new_battery_menu	
+	extern	use_old_batteries
+
+	btfsc	RCON,POR						; Was this a power-on reset?
+    goto	use_old_batteries				; No, load last stored battery values
+	; "new_battery_menu" and "use_old_batteries" 'goto' back to "power_on_return"
+
+    ; Yes
+	call	rtc_init						; init clock
+ 	goto	new_battery_menu				; show "New battery dialog"
+	; "new_battery_menu" and "use_old_batteries" 'goto' back to "power_on_return"
+
+	global	power_on_return
+power_on_return:
+	bsf		RCON,POR						; Set bit for next detection
+
+; check firmware and reset Custom Functions after an update
+	movlw	d'1'
+	movwf	EEADR
+	movlw	d'1'
+	movwf	EEADRH
+	call	read_eeprom				; read current version x
+	movff	EEDATA,temp1
+	incf	EEADR,F					; set to 0x102
+	call	read_eeprom				; read current version y
+	movff	EEDATA,temp2
+	clrf	EEADRH					; Reset EEADRH
+
+	movlw	softwareversion_x
+	cpfseq	temp1					; compare version x
+	bra		check_firmware_new		; is not equal -> reset CF and store new version in EEPROM
+
+	movlw	softwareversion_y
+	cpfseq	temp2					; compare version y
+	bra		check_firmware_new		; is not equal -> reset CF and store new version in EEPROM
+	bra		restart					; x and y are equal -> do not reset cf
+		
+check_firmware_new:
+    call	speed_normal
+	call	TFT_boot                ; Initialize TFT (includes clear screen)
+	clrf    CCPR1L          		; Backlight off
+    WIN_TOP     .50
+    WIN_LEFT    .10
+    movlw   LOW     0x1E000
+    movwf   TBLPTRL
+    movlw   HIGH    0x1E000
+    movwf   TBLPTRH
+    movlw   UPPER   0x1E000
+    movwf   TBLPTRU
+    extern  color_image
+    call    color_image             ; Show logo
+	call	TFT_standard_color
+	WIN_SMALL   .10,.100
+	STRCPY_TEXT_PRINT	tNewFirmware1	; "Update sucessfull!"
+	WIN_SMALL   .10,.140
+	STRCPY_TEXT	tNewFirmware2			; "New Firmware: "
+	movlw	softwareversion_x
+	movwf	lo
+	bsf		leftbind
+	output_8
+	PUTC	"."
+	movlw	softwareversion_y
+	movwf	lo
+	output_8
+	bcf		leftbind
+	STRCAT_PRINT	""					; Print second row
+    call    TFT_Display_FadeIn          ; Display resulting surface screen.
+
+; place "after-update reset" here...
+	movlw	d'1'					; store current version in EEPROM
+	movwf	EEADR
+	movlw	d'1'
+	movwf	EEADRH
+	movlw	softwareversion_x
+	movwf	EEDATA		
+	call	write_eeprom			; write version x
+	incf	EEADR,F					; set to 0x102
+	movlw	softwareversion_y
+	movwf	EEDATA		
+	call	write_eeprom			; write version y
+	clrf	EEADRH					; Reset EEADRH
+
+	movlw	.7
+	movwf	lo
+check_firmware_new2:
+	; Wait 1 second
+	bcf		onesecupdate
+	btfss	onesecupdate
+	bra		$-2
+	decfsz	lo,F					; Wait 10 seconds...
+	bra		check_firmware_new2
+
+	global	restart	
+restart:
+    clrf    STKPTR                  ; Never return from here
+	extern	option_save_all
+	btfsc	menubit					; Return from Menu/COMM mode or timeout?
+	call	option_save_all			; Yes, save all settings into EEPROM
+
+	clrf	flag1					; clear all flags
+	clrf	flag2
+	clrf	flag3
+	clrf	flag4
+	clrf	flag5
+	clrf	flag6
+    clrf	flag7
+    clrf	flag8
+	bsf		tft_is_dimming	; TFT is dimming up (soon), ignore ambient sensor!
+	; Select high altitude (Fly) mode?
+	movff	last_surfpressure_30min+0,sub_b+0
+	movff	last_surfpressure_30min+1,sub_b+1
+	movlw	HIGH	high_altitude_threshold
+	movwf	sub_a+1
+	movlw	LOW		high_altitude_threshold	; Hard-wired 880mbar
+	movwf	sub_a+0
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag				; Result negative (Ambient>880mbar)?
+	bsf		high_altitude_mode		; No, Set Flag!
+
+	call	ext_flash_disable_protection	; Disable write protection for external flash
+
+	extern  testloop
+;    goto    testloop
+
+	goto	surfloop				; Jump to Surfaceloop!
+
+;=============================================================================
+; Setup all flags and parameters for divemode and simulator computations.
+;
+	global	restart_set_modes_and_flags
+restart_set_modes_and_flags:		    ; "Call"ed from divemode, as well!
+    call    option_restore_all      	; Restore everything from EEPROM
+    movff   opt_dive_mode,lo            ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
+
+	bcf		FLAG_apnoe_mode
+    bcf     FLAG_ccr_mode             ; =1: CCR mode (Fixed ppO2 or Sensor) active
+    bcf     FLAG_gauge_mode           ; =1: In Gauge mode
+    call    disable_ir                ; IR off
+
+    tstfsz  lo
+    bra     restart_set_modes_and_flags2
+    ; OC Mode
+    return
+
+restart_set_modes_and_flags2:
+    decfsz  lo,F
+    bra     restart_set_modes_and_flags3
+    ; CC Mode
+	bsf     FLAG_ccr_mode               ; =1: CCR mode (Fixed ppO2 or Sensor) active
+    call    enable_ir                   ; Enable IR-Port
+    return
+
+restart_set_modes_and_flags3:
+    decfsz  lo,F
+    bra     restart_set_modes_and_flags4
+    ; Gauge Mode
+    bsf     FLAG_gauge_mode           ; =1: In Gauge mode
+    return
+
+restart_set_modes_and_flags4:
+    ; Apnea Mode
+	bsf		FLAG_apnoe_mode
+    return							    ; start in Surfacemode
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/start.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,14 @@
+;=============================================================================
+;
+;   File start.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-06 : [mH] moving from OSTC code
+
+	extern	restart
+	extern	restart_set_modes_and_flags
+	extern	start
+	extern	power_on_return	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/strings.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,308 @@
+;=============================================================================
+;
+;   File strings.asm
+;
+;   Implementation code various string functions.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2010-12-02 : [jDG] Creation...
+;
+; See strings.inc for doc and public calling macros.
+
+#include "ostc3.inc"
+#include "varargs.inc"
+
+        extern  aa_wordprocessor
+
+basic   CODE
+;=============================================================================
+; Variants that call word_processor at the end:
+        global  strcpy_block_print
+strcpy_block_print:
+        lfsr    FSR2, buffer
+        global  strcat_block_print
+strcat_block_print:
+        clrf    PRODL,A
+        bra     strings_common
+
+; Variants that do not call word_processor at end:
+        global  strcpy_block
+strcpy_block:
+        lfsr    FSR2, buffer
+        global  strcat_block
+strcat_block:
+        setf    PRODL,A
+        
+; Common part: append the string from PROM return address:
+strings_common:
+        VARARGS_BEGIN
+
+        rcall   strcat_prom
+
+        VARARGS_ALIGN
+        VARARGS_END
+		
+		btfsc   PRODL,0,A               ; Should we print afterward ?
+		return                          ; NO: then return straight away.
+		goto    aa_wordprocessor        ; ELSE: print it...
+
+;=============================================================================
+; Copy multi-lingual text from FSR1 12bit pointers, to buffer.
+;
+; Input: FSR1 = 12bit pointer to multi-lingual text.
+; Output: FSR2 points to closing null byte in buffer.
+; Trashed: TBLPTR, TABLAT.
+        global  strcpy_text
+strcpy_text:
+        rcall   text_get_tblptr
+        bra     strcpy_prom
+
+; Copy then print multi-lingual text from FSR1 12bit pointers, to buffer.
+;
+; Input: FSR1 = 12bit pointer to multi-lingual text.
+; Output: FSR2 points to closing null byte in buffer.
+; Trashed: TBLPTR, TABLAT.
+        global  strcpy_text_print
+strcpy_text_print:
+        rcall   text_get_tblptr
+        bra     strcpy_prom_print
+
+; Append multi-lingual text from FSR1 12bit pointers, to buffer at FRS2.
+;
+; Input: FSR1 = 12bit pointer to multi-lingual text.
+;        FSR2 = Current position in buffer.
+; Output: FSR2 points to closing null byte in buffer.
+; Trashed: TBLPTR, TABLAT.
+        global  strcat_text
+strcat_text:
+        rcall   text_get_tblptr
+        bra     strcat_prom
+
+; Append then print multi-lingual text from FSR1 12bit pointers, to buffer at FRS2.
+;
+; Input: FSR1 = 12bit pointer to multi-lingual text.
+;        FSR2 = Current position in buffer.
+; Output: FSR2 points to closing null byte in buffer.
+; Trashed: TBLPTR, TABLAT.
+        global  strcat_text_print
+strcat_text_print:
+        rcall   text_get_tblptr
+        bra     strcat_prom_print
+
+;=============================================================================
+; Get pointer to multilingual texl in TBLPTR
+;
+; Input:  FSR1 = 12bits of text handle.
+;         opt_language = current language.
+; Output: TBLPTR = 24bits of PROM address.
+;
+        global  text_get_tblptr
+text_get_tblptr:
+        extern  text_english_base
+        movlw   UPPER(text_english_base); Complete 12bits to 24bits address.
+        movwf   TBLPTRU
+        movlw   HIGH(text_english_base)
+        andlw   0xF0
+        iorwf   FSR1H,W
+        movwf   TBLPTRH
+        movff   FSR1L,TBLPTRL
+
+        movff   opt_language,WREG       ; Get lang
+        bz      text_get_english        ; 0 == English
+        dcfsnz  WREG                    ; 1 == German
+        bra     text_get_german
+        dcfsnz  WREG                    ; 2 == French
+        bra     text_get_french
+        dcfsnz  WREG                    ; 3 == Italian
+        bra     text_get_italian
+; Other ??? Keep english...
+
+; Read 2-byte pointer to string
+text_get_english:
+        tblrd*+
+        movff   TABLAT,WREG
+        tblrd*+
+        movff   WREG,TBLPTRL
+        movff   TABLAT,TBLPTRH
+        return
+
+; Add correction for German table:
+text_get_german:
+        extern  text_german_base
+        movlw   LOW(text_german_base)
+        addwf   TBLPTRL
+        movlw   HIGH(text_german_base)
+        addwfc  TBLPTRH
+        movlw   UPPER(text_german_base)
+        addwfc  TBLPTRU
+
+        movlw   LOW(text_english_base)
+        subwf   TBLPTRL
+        movlw   HIGH(text_english_base)
+        subwfb  TBLPTRH
+        movlw   UPPER(text_english_base)
+        subwfb  TBLPTRU
+        bra     text_get_english
+        
+        ; Add correction for French table:
+text_get_french:
+        extern  text_french_base
+        movlw   LOW(text_french_base)
+        addwf   TBLPTRL
+        movlw   HIGH(text_french_base)
+        addwfc  TBLPTRH
+        movlw   UPPER(text_french_base)
+        addwfc  TBLPTRU
+
+        movlw   LOW(text_english_base)
+        subwf   TBLPTRL
+        movlw   HIGH(text_english_base)
+        subwfb  TBLPTRH
+        movlw   UPPER(text_english_base)
+        subwfb  TBLPTRU
+        bra     text_get_english
+        
+        ; Add correction for Spanish table:
+text_get_italian:
+        extern  text_italian_base
+        movlw   LOW(text_italian_base)
+        addwf   TBLPTRL
+        movlw   HIGH(text_italian_base)
+        addwfc  TBLPTRH
+        movlw   UPPER(text_italian_base)
+        addwfc  TBLPTRU
+
+        movlw   LOW(text_english_base)
+        subwf   TBLPTRL
+        movlw   HIGH(text_english_base)
+        subwfb  TBLPTRH
+        movlw   UPPER(text_english_base)
+        subwfb  TBLPTRU
+        bra     text_get_english
+
+;=============================================================================
+; Copy a null-terminated string from TBLPTR to buffer.
+;
+; Input:  TBLPTR : string pointer into PROM.
+; Output: string in buffer, FSR2 pointer on the closing null byte.
+;
+        global  strcpy_prom
+strcpy_prom:
+        lfsr    FSR2,buffer
+
+; Append a null-terminated string from TBLPTR to buffer.
+;
+; Input:  TBLPTR : string pointer into PROM.
+;         FRS2   : current character position.
+; Output: string in buffer, FSR2 pointer on the closing null byte.
+;
+        global  strcat_prom
+strcat_prom:
+        tblrd*+
+        movf    TABLAT,W
+        movwf   POSTINC2
+        bnz     strcat_prom
+        movf    POSTDEC2,W               ; rewind one char in string buffer.
+        return
+
+;=============================================================================
+; Variant that calls word processor right-away...
+        global  strcpy_prom_print
+        global  strcat_prom_print
+
+strcpy_prom_print:
+        lfsr    FSR2,buffer
+strcat_prom_print:
+        rcall   strcat_prom
+        goto    aa_wordprocessor
+
+;=============================================================================
+
+        global      start_tiny_block
+start_tiny_block:
+        clrf        WREG
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_tiny_invert_block
+start_tiny_invert_block:
+        clrf        WREG
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        movlw       1
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_small_block
+start_small_block:
+        movlw       1
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        clrf        WREG
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_small_invert_block
+start_small_invert_block:
+        movlw       1
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_std_block
+start_std_block:
+        movlw       2
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        clrf        WREG
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_std_invert_block
+start_std_invert_block:
+        movlw       2
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        movlw       1
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_medium_block
+start_medium_block:
+        movlw       3
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        clrf        WREG
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_medium_invert_block
+start_medium_invert_block:
+        movlw       3
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        movlw       1
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_large_block
+start_large_block:
+        movlw       4
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        clrf        WREG
+        movff       WREG, win_invert
+        bra         start_common
+
+        global      start_large_invert_block
+start_large_invert_block:
+        movlw       4
+        movff       WREG, win_font      ; Need a bank-safe move here !
+        movlw       1
+        movff       WREG, win_invert
+        bra         start_common
+
+start_common:
+        VARARGS_BEGIN
+            VARARGS_GET8    win_leftx2
+            VARARGS_GET8    win_top
+        VARARGS_END
+        return
+
+        END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/strings.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,215 @@
+;=============================================================================
+;
+;   File strings.asm
+;
+;   Implementation code various string functions.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2010-12-02 : [jDG] Creation...
+;
+
+;=============================================================================
+; Copy a short embebed string at start of the string buffer (letter)
+; Input:    (nothing)
+; Output:   chars are copied into letter, starting at the beginning.
+;           FSR2 point to the first unused char (the NULL termination).
+;           
+; Trashed:  WREG, TBLPTR, TABLAT, PRODL
+; Note:     This are all bank-safe call.
+;
+        extern  strcpy_block
+STRCPY  macro   string
+        call    strcpy_block
+        DB  string, 0
+        endm
+
+;=============================================================================
+; A variant of STRCPY that appends chars to the current FSR2 pointer.
+; Input/Output/Trashed : see STRCPY.
+        extern  strcat_block
+STRCAT  macro   string
+        call    strcat_block
+        DB  string, 0
+        endm
+
+;=============================================================================
+; A variant of STRCAT when there is just on char to output
+; Input/Output/Trashed : none.
+PUTC    macro   char
+        movlw   char
+        movwf   POSTINC2
+        endm
+
+;=============================================================================
+; A variant of STRCPY that send the string to the word processor afterwards.
+; Input/Output: see STRCPY.
+; Trashed: See STRCPY + word_processor. In particular, switch RAM to Bank1 
+;
+        extern  strcpy_block_print
+STRCPY_PRINT    macro string
+        call    strcpy_block_print
+        DB  string, 0
+        endm
+
+; Trashed: See STRCPY + word_processor. In particular, switch RAM to Bank1 
+        extern  strcat_block_print
+STRCAT_PRINT    macro string
+        call    strcat_block_print
+        DB  string, 0
+        endm
+
+;=============================================================================
+; Subroutines to operate on strings from PROM code
+;
+; Input:  TBLPTR : string pointer into PROM.
+; Output: string in buffer, FSR2 pointer on the closing null byte.
+
+        extern  strcpy_prom, strcat_prom
+        extern  strcpy_prom_print, strcat_prom_print
+
+;=============================================================================
+; Subroutines and macros to operate on multilingual text
+;
+        extern  strcpy_text
+STRCPY_TEXT macro   txt
+        extern  txt
+        lfsr    FSR1, txt
+        call    strcpy_text
+        endm
+
+        extern  strcpy_text_print
+STRCPY_TEXT_PRINT macro   txt
+        extern  txt
+        lfsr    FSR1, txt
+        call    strcpy_text_print
+        endm
+
+        extern  strcat_text
+STRCAT_TEXT macro   txt
+        extern  txt
+        lfsr    FSR1, txt
+        call    strcat_text
+        endm
+
+        extern  strcat_text_print
+STRCAT_TEXT_PRINT macro   txt
+        extern  txt
+        lfsr    FSR1, txt
+        call    strcat_text_print
+        endm
+
+;=============================================================================
+; A shortcut for the macros WIN_TOP + WIN_LEFT + WIN_FONT + WIN_INVERT.
+; The idea is to replace a 4x6=24 bytes sequence by a more compact 6bytes one.
+;
+; Trashed: TBLPTR, TABLAT, WREG.
+; Note:    This are all bank-safe call.
+        extern  start_tiny_block
+WIN_TINY macro x, y
+        call    start_tiny_block
+        DB      x, y
+        endm
+
+        extern  start_tiny_invert_block
+WIN_TINY_INVERT macro x, y
+        call    start_tiny_invert_block
+        DB      x, y
+        endm
+
+        extern  start_small_block
+WIN_SMALL macro x, y
+        call    start_small_block
+        DB      x, y
+        endm
+
+        extern  start_small_invert_block
+WIN_SMALL_INVERT macro x, y
+        call    start_small_invert_block
+        DB      x, y
+        endm
+
+        extern  start_std_block
+WIN_STD macro x, y
+        call    start_std_block
+        DB      x, y
+        endm
+
+        extern  start_std_invert_block
+WIN_STD_INVERT macro x, y
+        call    start_std_invert_block
+        DB      x, y
+        endm
+
+        extern  start_medium_block
+WIN_MEDIUM   macro   x, y
+        call    start_medium_block
+        DB      x, y
+        endm
+
+        extern  start_medium_invert_block
+WIN_MEDIUM_INVERT   macro   x, y
+        call    start_medium_invert_block
+        DB      x, y
+        endm
+
+       extern  start_large_block
+WIN_LARGE   macro   x, y
+       call    start_large_block
+       DB      x, y
+       endm
+
+        extern  start_large_invert_block
+WIN_LARGE_INVERT   macro   x, y
+        call    start_large_invert_block
+        DB      x, y
+        endm
+
+;=============================================================================
+; Shortcuts for compact display programmings.
+TEXT_TINY macro   x, y, txt
+        WIN_TINY   x,y
+        STRCPY_TEXT_PRINT txt
+        endm
+
+TEXT_SMALL  macro   x, y, txt
+        WIN_SMALL   x,y
+        STRCPY_TEXT_PRINT txt
+        endm
+
+TEXT_SMALL_INVERT  macro   x, y, txt
+        WIN_SMALL_INVERT   x,y
+        STRCPY_TEXT_PRINT txt
+        endm
+
+TEXT_MEDIUM  macro   x, y, txt
+        WIN_MEDIUM   x,y
+        STRCPY_TEXT_PRINT txt
+        endm
+
+TEXT_LARGE  macro   x, y, txt
+        WIN_LARGE   x,y
+        STRCPY_TEXT_PRINT txt
+        endm
+
+STRING_TINY macro   x, y, string
+        WIN_SMALL   x,y
+        STRCPY_PRINT string
+        endm
+
+STRING_SMALL  macro   x, y, string
+        WIN_SMALL   x,y
+        STRCPY_PRINT string
+        endm
+
+STRING_MEDIUM  macro   x, y, string
+        WIN_MEDIUM   x,y
+        STRCPY_PRINT string
+        endm
+
+STRING_LARGE  macro   x, y, string
+        WIN_LARGE   x,y
+        STRCPY_PRINT string
+        endm
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/surfmode.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,415 @@
+;=============================================================================
+;
+;   File surfmode.asm
+;
+;   Surfacemode
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-07 : [mH] moving from OSTC code
+
+#include    "ostc3.inc"                 ; Mandatory header
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include	"start.inc"
+#include	"tft.inc"
+#include	"tft_outputs.inc"
+#include	"isr.inc"
+#include	"adc_lightsensor.inc"
+#include 	"menu_processor.inc"
+#include	"strings.inc"
+#include	"sleepmode.inc"
+#include 	"wait.inc"                  ; speed_*
+#include	"external_flash.inc"
+#include	"customview.inc"
+#include	"divemode.inc"
+#include    "mcp.inc"                   ; RX
+#include    "i2c.inc"
+#include    "comm.inc"
+#include    "eeprom_rs232.inc"
+
+#DEFINE	menu_pos_row		.215
+#DEFINE	menu_pos_column		.0
+#DEFINE	view_row            .215
+#DEFINE	view_column         .124
+
+   	extern   do_main_menu
+
+gui     CODE
+
+
+;=============================================================================
+; Boot tasks for all modes
+	global	surfloop
+surfloop:
+    call	speed_normal
+    bcf     no_sensor_int           ; Normal pressure mode
+
+    clrf	CCP1CON					; stop PWM
+	bcf		PORTC,2					; Pull PWM output to GND
+	call	TFT_boot                ; Initialize TFT (includes clear screen)
+	bcf		restore_deco_data
+
+    WIN_TOP     .50
+    WIN_LEFT    .10
+    movlw   LOW     0x1E000
+    movwf   TBLPTRL
+    movlw   HIGH    0x1E000
+    movwf   TBLPTRH
+    movlw   UPPER   0x1E000
+    movwf   TBLPTRU
+    extern  color_image
+    call    color_image             ; Show logo
+
+    WIN_TOP     .100
+    WIN_LEFT    .34
+    extern  ostc3_logo_block
+    movlw   LOW(ostc3_logo_block)
+    movwf   TBLPTRL
+    movlw   HIGH ostc3_logo_block;&0xFFFF
+    movwf   TBLPTRH
+    movlw   UPPER(ostc3_logo_block)
+    movwf   TBLPTRU
+    call    color_image
+    call    TFT_Display_FadeIn      ; Show splash
+	call	TFT_serial              ; Show serial and firmware version
+
+    ;---- Do any usefull initializes that takes time -------------------------
+	call	restart_set_modes_and_flags	; Sets decomode flags
+;	call	speed_fastest
+	bcf		pressure_refresh
+    call    I2C_init_compass
+    call    I2C_init_accelerometer
+	clrf	ext_flash_address+0
+	clrf	ext_flash_address+1
+	clrf	ext_flash_address+2
+
+	clrf	timeout_counter2
+	clrf 	timeout_counter3
+	bcf		premenu						; clear premenu flag
+	bcf		menubit						; clear menu flag
+	clrf	last_pressure+0
+	clrf	last_pressure+1
+    bcf     is_bailout                  ; =1: Bailout
+    bcf     ccr_diluent_setup           ; Use OC gases for gaslist routine
+
+	bcf		simulatormode_active		; Quit simulator mode (if active)
+	bcf		switch_left
+	bcf		switch_right
+    bcf     LEDg
+    bcf     LEDr
+
+	;---- Fade to standard surface view --------------------------------------
+	; Wait 1 second
+	bcf		onesecupdate
+	btfss	onesecupdate
+	bra		$-2
+	; Wait 1 second
+	bcf		onesecupdate
+	btfss	onesecupdate
+	bra		$-2
+
+	call    TFT_Display_FadeOut         ; Go to black screen
+	call	TFT_ClearScreen             ; Then change everything
+	WIN_TOP		.0
+	WIN_LEFT	.0
+	WIN_FONT 	FT_SMALL
+	WIN_INVERT	.0					    ; Init new Wordprocessor
+
+;	call	TFT_user_image				; Show the user image/text
+	
+    WIN_COLOR	color_lightblue
+	WIN_SMALL	menu_pos_column,menu_pos_row
+    STRCPY_TEXT_PRINT  tMenu		;"<Menu"
+	WIN_SMALL	view_column,view_row
+    STRCPY_TEXT_PRINT  tView        ;"View>"
+	call    TFT_standard_color
+
+    call    mcp_reset                   ; Setup RX
+	call	TFT_clock					; display time
+    call    update_surfloop60
+	call	get_battery_voltage			; get battery voltage
+	call	TFT_update_batt_voltage		; display battery voltage
+	call	TFT_update_surf_press		; display surface pressure
+	call	TFT_temp_surfmode			; Displays temperature
+	call	TFT_display_decotype_surface
+    extern  surf_customview_mask
+    call    surf_customview_mask        ; Update #menupos3 view
+
+    WIN_TOP     .0
+    WIN_LEFT    .70
+    movlw   LOW(ostc3_logo_block)
+    movwf   TBLPTRL
+    movlw   HIGH ostc3_logo_block;&0xFFFF
+    movwf   TBLPTRH
+    movlw   UPPER(ostc3_logo_block)
+    movwf   TBLPTRU
+    call    color_image
+
+	btfsc	FLAG_apnoe_mode				; Ignore in Apnoe mode
+	bra		surfloop1
+	btfsc	FLAG_gauge_mode				; Ignore in Gauge mode
+	bra		surfloop1
+
+surfloop1:
+    call    TFT_Display_FadeIn          ; Display resulting surface screen.
+
+    ;---- Late initialisations -----------------------------------------------    
+	movff	last_surfpressure_30min+0,int_I_pres_respiration+0		; copy surface air pressure to deco routine
+	movff	last_surfpressure_30min+1,int_I_pres_respiration+1		; 30min old values 
+	movff	last_surfpressure_30min+0,int_I_pres_surface+0			; copy surface air pressure to deco routine
+	movff	last_surfpressure_30min+1,int_I_pres_surface+1			; 30min old values 
+	movff	last_surfpressure_30min+0,last_surfpressure+0			; Use 30min old airpressure 
+	movff	last_surfpressure_30min+1,last_surfpressure+1			; Use 30min old airpressure
+
+    extern  do_demo_divemode
+;    goto    do_demo_divemode
+
+; Startup tasks for all modes
+    ; Desaturation time needs:
+    ;   int_I_pres_surface
+    ;   char_I_desaturation_multiplier
+	call	deco_calc_desaturation_time ; calculate desaturation time
+	movlb	b'00000001'					; select ram bank 1
+
+    btfsc   enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+    call	enable_rs232				; Also sets to speed_normal ...
+
+surfloop_loop:
+	btfss	onesecupdate				; do every second tasks?
+	bra		surfloop_loop2				; no, loop
+
+; One Second tasks for all modes
+	call	speed_normal
+	call	TFT_debug_output
+	call	TFT_clock					; update clock
+	call	timeout_surfmode			; check timeout 
+	call	get_battery_voltage			; get battery voltage
+	call	TFT_update_batt_voltage		; display battery voltage
+	call	timeout_premenu				; timeout premenu
+	call	set_dive_modes				; tests if depth>threshold
+    btfss   secs,0                      ; Every two seconds...
+	call	TFT_temp_surfmode			; Displays temperature
+    btfss   secs,0                      ; Every two seconds...
+    call    surfmode_check_for_warnings ; ... check for warnings (and display/update) them
+
+    btfsc   FLAG_ccr_mode               ; In CCR mode...
+    call    TFT_surface_hud             ; ...update HUD data in surface mode
+
+	bcf		onesecupdate				; every second tasks done
+	
+surfloop_loop2:	
+; Tasks approx. every 50ms for all modes
+	call	test_switches_surfmode		; check switches
+	call	speed_normal
+
+; One minute tasks for all modes
+	btfsc	oneminupdate				; do every minute tasks
+	call	update_surfloop60			; yes, e.g. update time and date
+
+; Mode tasks
+	btfsc	menubit						; Menu?
+	goto	do_main_menu				; Menu!
+
+	btfsc	pressure_refresh			; new pressure available?
+	call	TFT_update_surf_press		; display surface pressure
+	bcf		pressure_refresh			; until new pressure is available
+
+    btfss   quarter_second_update
+    bra     surfloop_loop2a
+    bcf     quarter_second_update
+    movlw   .6
+    cpfseq  menupos3                    ; in compass view?
+    bra     surfloop_loop2a             ; No
+    call    TFT_surface_compass_heading ; Yes, update compass heading value
+
+surfloop_loop2a:
+	btfsc	toggle_customview			; Next view?
+	call	surf_customview_toggle      ; Yes, show next customview (and delete this flag)
+
+    btfsc   enable_screen_dumps         ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+    bra     surfloop_loop3
+    btfsc   vusb_in                     ; USB plugged in?
+    goto    comm_mode                   ; Start COMM mode
+    bra     surfloop_loop4
+surfloop_loop3:
+    btfss   vusb_in                     ; USB (still) plugged in?
+    bcf     enable_screen_dumps         ; No, clear flag
+    call    rs232_get_byte
+    btfsc   rs232_recieve_overflow
+    bra     surfloop_loop4
+    movlw   "l"
+    cpfseq	RCREG1
+    bra     surfloop_loop4
+    call    TFT_dump_screen             ; Dump the screen contents
+surfloop_loop4:
+	btfsc	divemode					; Divemode active?
+	goto	diveloop					; Yes, switch into Divemode!
+	btfsc	sleepmode					; Sleepmode active?
+	goto	sleeploop					; Yes, switch into sleepmode!
+
+	bra		surfloop_loop				; loop surfacemode
+
+update_surfloop60:
+; One minute tasks for all modes
+	call	TFT_date					; Update date
+	call	calc_deko_surfmode			; calculate desaturation every minute
+	bcf		oneminupdate				
+	return
+
+    extern  check_cns_violation,check_warn_battery,check_and_store_gf_violation
+surfmode_check_for_warnings:
+	movf	warning_counter_backup,W
+	cpfseq	warning_counter						; warning_counter_backup = warning_counter?
+	call	TFT_clear_warning_text              ; No, clear all warnings
+	movff	warning_counter,warning_counter_backup	; copy warning_counter
+
+	bcf		warning_active                      ; Clear flag
+	clrf	warning_counter						; Clear counter
+
+    ; Warnings for all modes
+    call	check_warn_battery                  ; Check if the battery level should be displayed/warned
+    call    surfmode_check_for_nofly            ; Check if nofly time should be shown
+    call    surfmode_check_for_desat            ; Check if desat time should be shown
+    call    surfmode_check_for_interval         ; Check if surface interval should be shown
+
+	btfsc	FLAG_apnoe_mode             ; Done for Apnoe or Gauge mode
+    bra     surfmode_check_for_warnings2
+	btfsc	FLAG_gauge_mode             ; Done for Apnoe or Gauge mode
+	bra     surfmode_check_for_warnings2
+
+    ; Warnings only in deco modes
+	call	check_cns_violation					; Check CNS value and display it, if required
+    call	check_and_store_gf_violation		; Check GF value and display it, if required
+
+surfmode_check_for_warnings2:
+; Setup warning_page number
+    incf    warning_page,F
+    bcf     STATUS,C
+    rlcf    warning_page,W                      ; *2
+    cpfsgt  warning_counter                     ; > warning_counter
+    clrf    warning_page                        ; No, clear
+
+; Clear 2nd row of warnings if there is nothing to show (on this page)
+    btfss   second_row_warning                  ; =1: The second row contains a warning
+    call    TFT_clear_warning_text_2nd_row      ; No, clear this row
+    return                                      ; Done.
+
+surfmode_check_for_interval:
+	movf    	surface_interval+0,W            ; Is interval null ?
+    iorwf   	surface_interval+0,W
+    bnz     	surfmode_check_for_interval2	; No
+    return
+surfmode_check_for_interval2:
+	incf    warning_counter,F			; increase counter
+    call    TFT_interval
+    return
+
+
+surfmode_check_for_desat:
+	movf    	desaturation_time+0,W           ; Is nofly null ?
+    iorwf   	desaturation_time+1,W
+    bnz     	surfmode_check_for_desat2		; No
+    return
+surfmode_check_for_desat2:
+	incf	warning_counter,F			; increase counter
+    call    TFT_desaturation_time
+    return
+
+surfmode_check_for_nofly:
+ 	movf    nofly_time+0,W              ; Is nofly null ?
+    iorwf   nofly_time+1,W
+    bnz     surfmode_check_for_nofly2   ; No...
+    return
+surfmode_check_for_nofly2:
+	incf	warning_counter,F			; increase counter
+    call    TFT_nofly_time
+    return
+
+
+;=============================================================================
+	global	calc_deko_surfmode
+calc_deko_surfmode:
+    SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine
+	call	deco_calc_wo_deco_step_1_min    ; calculate deco in surface mode
+	banksel		common
+	return
+
+timeout_premenu:
+	btfsc	premenu					; is "<Menu" displayed?
+	bra		timeout_premenu1		; Yes
+	return
+
+timeout_premenu1:
+	incf	timeout_counter3,F		; Yes...
+	movlw	d'2'
+	cpfsgt	timeout_counter3		; ... longer then premenu_timeout
+	return							; No!
+
+	bcf		premenu					; Yes, so clear "Menu?" and clear pre_menu bit
+
+	WIN_SMALL	menu_pos_column,menu_pos_row
+    WIN_COLOR	color_lightblue
+    STRCPY_TEXT_PRINT  tMenu		; "<Menu"
+	call	TFT_standard_color
+	clrf	timeout_counter3		; Also clear timeout
+	bcf		switch_left				; and debounce switches
+	bcf		switch_right
+	return
+
+test_switches_surfmode:		; checks switches in surfacemode
+	btfsc	switch_right
+	bra		test_switches_surfmode2
+	btfsc	switch_left
+	bra		test_switches_surfmode3		
+	
+	; No button press
+	return
+
+test_switches_surfmode3:
+	bcf		switch_left
+	btfss	premenu
+	bra		test_switches_surfmode4
+	bsf		menubit					; Enter Menu!
+	return
+
+test_switches_surfmode4:
+    WIN_COLOR	color_lightblue
+	WIN_SMALL	view_column,view_row
+    STRCPY_TEXT_PRINT  tView        ;"View"
+	WIN_SMALL	menu_pos_column,menu_pos_row
+	call	TFT_standard_color
+	WIN_INVERT	.1					; Init new Wordprocessor
+	STRCPY_TEXT_PRINT  tMenu		;"<Menu"
+	WIN_INVERT	.0					; Init new Wordprocessor
+	bsf		premenu
+	clrf	timeout_counter2
+	return
+
+test_switches_surfmode2:
+	bcf		switch_right
+	bsf		toggle_customview
+    clrf	timeout_counter2        ; and reset timeout
+	return
+
+test_switches_surfmode5:
+	WIN_SMALL	menu_pos_column,menu_pos_row
+    WIN_COLOR	color_lightblue
+	STRCPY_TEXT_PRINT  tMenu		;"<Menu"
+	call	TFT_standard_color
+    bcf		premenu
+	clrf	timeout_counter2
+	return
+
+	global	timeout_surfmode
+timeout_surfmode:
+	movlw	timeout_surfacemode		; [s]
+	global	timeout_testmode
+timeout_testmode:
+	incf	timeout_counter2,F		; increase timeout counter
+	cpfsgt	timeout_counter2		; Compare with timeout_counter2
+	return							; return, no timeout
+	bsf		sleepmode				; Set Flag
+	return							; Return
+
+ END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/surfmode.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,88 @@
+;=============================================================================
+;
+;   File surfmode.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-07 : [mH] moving from OSTC code
+
+ extern surfloop
+ extern	calc_deko_surfmode
+ extern	timeout_surfmode
+ extern	timeout_testmode
+
+; Surfacemode/Homescreen layout:
+; row=0...239
+; column=0...159 (x2)
+
+#DEFINE	surf_clock_row		.28
+#DEFINE	surf_clock_column	.5
+#DEFINE	surf_date_row		.10
+#DEFINE	surf_date_column	surf_clock_column
+
+#DEFINE	batt_voltage_row	.46
+#DEFINE	batt_voltage_column	surf_clock_column
+#DEFINE	batt_percent_row	batt_voltage_row
+#DEFINE	batt_percent_column	.30
+
+#DEFINE surf_decotype_row       .60
+#DEFINE surf_decotype_column    .100
+
+#DEFINE	surf_desat_row		.103
+#DEFINE	surf_desat_column	.65
+#DEFINE	surf_nofly_row		.128
+#DEFINE	surf_nofly_column	.65
+
+#DEFINE surf_warning1_column    .40
+#DEFINE surf_warning1_row       .191
+#DEFINE surf_warning2_column    surf_warning1_column
+#DEFINE surf_warning2_row       surf_warning1_row+.24
+#DEFINE surf_warning_length     .11                 ; total string length
+
+#DEFINE	surf_temp_row		.185
+#DEFINE	surf_temp_column	.112
+#DEFINE	surf_press_row		.160
+#DEFINE	surf_press_column	.98
+
+#DEFINE	surf_gaslist_row        .66
+#DEFINE	surf_gaslist_column     .2
+#DEFINE surf_gaslist_spacing    .24
+
+#DEFINE surf_customtext_row1    .66
+#DEFINE surf_customtext_row2    surf_customtext_row1+.24
+#DEFINE surf_customtext_row3    surf_customtext_row2+.24
+#DEFINE surf_customtext_row4    surf_customtext_row3+.24
+#DEFINE surf_customtext_row5    surf_customtext_row4+.24
+#DEFINE surf_customtext_column  .5
+
+#DEFINE surf_compass_mask_row       surf_customtext_row2
+#DEFINE surf_compass_mask_column    .10
+#DEFINE surf_compass_head_row       surf_customtext_row4-.5
+#DEFINE surf_compass_head_column    .18
+
+#DEFINE surf_hud_sensor1_column .112
+#DEFINE surf_hud_sensor1_row    .87
+#DEFINE surf_hud_sensor2_column surf_hud_sensor1_column
+#DEFINE surf_hud_sensor2_row    .111
+#DEFINE surf_hud_sensor3_column surf_hud_sensor1_column
+#DEFINE surf_hud_sensor3_row    .135
+
+#DEFINE surf_menu_sensor1_column    .80
+#DEFINE surf_menu_sensor1_row       .73
+#DEFINE surf_menu_sensor2_column    surf_menu_sensor1_column
+#DEFINE surf_menu_sensor2_row       surf_menu_sensor1_row+.27*.1
+#DEFINE surf_menu_sensor3_column    surf_menu_sensor1_column
+#DEFINE surf_menu_sensor3_row       surf_menu_sensor1_row+.27*.2
+#DEFINE surf_menu_sensor4_column    surf_menu_sensor1_column
+#DEFINE surf_menu_sensor4_row       surf_menu_sensor1_row+.27*.3
+
+#DEFINE surf_tissue_diagram_top     .66
+#DEFINE surf_tissue_diagram_bottom  tissue_diagram_top+.64
+#DEFINE surf_tissue_diagram_left    .5
+#DEFINE surf_tissue_diagram_right   surf_decotype_column-.5
+#DEFINE surf_tissue_N2_row          surf_tissue_diagram_top+.1
+#DEFINE surf_tissue_N2_column       surf_tissue_diagram_left+.5
+#DEFINE surf_tissue_He_row          surf_tissue_diagram_top+.56
+#DEFINE surf_tissue_He_column       surf_tissue_N2_column
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testmode.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,196 @@
+;=============================================================================
+;
+;   File tesmode.asm
+;
+;   Test Mode for Hardware check
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2012-10-31 : [mH] Creation
+
+#include    "ostc3.inc"                 ; Mandatory header
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include	"start.inc"
+#include	"tft.inc"
+#include	"tft_outputs.inc"
+#include	"isr.inc"
+#include	"adc_lightsensor.inc"
+#include	"strings.inc"
+#include	"sleepmode.inc"
+#include 	"wait.inc"                  ; speed_*
+#include    "mcp.inc"                   ; RX
+#include    "i2c.inc"
+#include    "surfmode.inc"
+#include    "math.inc"
+#include    "eeprom_rs232.inc"
+
+    extern  compass
+    extern  compass_filter
+    extern  compass_filter_init
+    extern  compass_reset_calibration
+    extern  compass_add_calibration
+    extern  compass_solve_calibration
+
+testmode    CODE
+
+;=============================================================================
+; Boot tasks for all modes
+	global	testloop
+testloop:
+    call	speed_normal
+    bcf     no_sensor_int           ; Sensor ISR
+
+    clrf	CCP1CON					; stop PWM
+	bcf		PORTC,2					; Pull PWM output to GND
+	call	TFT_boot                ; Initialize TFT (includes clear screen)
+    call    enable_ir               ; Enable IR-Port
+	WIN_TOP		.0
+	WIN_LEFT	.0
+	WIN_FONT 	FT_SMALL
+	WIN_INVERT	.0					    ; Init new Wordprocessor
+	call    TFT_standard_color
+    call    mcp_reset_rssi              ; Setup RX
+    call    TFT_Display_FadeIn
+
+    call    I2C_init_compass
+    call    I2C_init_accelerometer
+
+    ; Init compass/accel filtering value.
+    call    I2C_RX_compass
+    call    I2C_RX_accelerometer
+    call    compass_filter_init
+
+ 	clrf	timeout_counter2				
+	clrf 	timeout_counter3
+	bcf		premenu						; clear premenu flag
+	bcf		menubit						; clear menu flag
+
+	bcf		switch_left
+	bcf		switch_right
+
+testloop_loop:
+    btfss	onesecupdate				; do every second tasks?
+	bra		testloop_loop2				; no, loop
+
+; One Second tasks
+	call	speed_normal
+    call    I2C_RX_compass              ; Test Compass
+    call    I2C_RX_accelerometer        ; Test Accelerometer
+    call    compass_filter              ; Filter Raw compass + accel readings.
+    banksel common
+
+    ; Make a second measure and filter, to show faster reactions.
+    call    I2C_RX_compass              ; Test Compass
+    call    I2C_RX_accelerometer        ; Test Accelerometer
+    call    compass_filter              ; Filter Raw compass + accel readings.
+    call    compass                     ; Do compass corrections.
+    banksel common
+
+    call    TFT_update_raw_data
+	movlw	.240
+    call	timeout_testmode			; check timeout
+
+	bcf		onesecupdate				; every second tasks done
+	
+testloop_loop2:
+; Tasks approx. every 50ms for all modes
+    bcf     LEDg
+    btfsc   vusb_in
+    bsf     LEDg
+
+; Mode tasks
+    extern  surfloop
+    btfsc   switch_left
+   	goto	surfloop    				; Exit
+
+    btfsc   switch_right
+   	goto	compass_calibration_loop
+
+    btfsc	sleepmode					; Sleepmode active?
+	goto	sleeploop					; Yes, switch into sleepmode!
+
+	bra		testloop_loop				; loop testmode
+
+
+    global  compass_calibration_loop
+compass_calibration_loop:               ; Compass calibration
+    bsf     no_sensor_int               ; No Sensor ISR
+    call    I2C_init_accelerometer
+    call    I2C_init_compass_fast
+    call	TFT_ClearScreen
+
+    ; Mask
+    WIN_COLOR   color_greenish
+	WIN_SMALL	.16,.0
+	STRCPY_TEXT_PRINT	tCompassMenu
+    call	TFT_standard_color
+	WIN_SMALL	.0,.215
+    STRCPY_TEXT_PRINT  tExit
+
+ 	clrf	timeout_counter2
+	clrf 	timeout_counter3
+
+    call	speed_fastest
+    call    I2C_RX_compass              ; read compass
+    call    I2C_RX_accelerometer        ; read Accelerometer
+    call    compass_filter_init         ; set DX_f values
+    call	compass_reset_calibration   ; Reset CX_f values
+    banksel common
+
+compass_calibration_loop2:
+    call    I2C_RX_compass              ; read compass
+    call    I2C_RX_accelerometer        ; Test Accelerometer
+    call    compass_filter              ; Filter compass raw data
+    banksel common
+
+    ; Twice
+    call    I2C_RX_compass              ; read compass
+    call    I2C_RX_accelerometer        ; Test Accelerometer
+    call    compass_filter              ; Filter compass raw data
+    banksel common
+;
+;    ; Three
+;    call    I2C_RX_compass              ; read compass
+;    call    I2C_RX_accelerometer        ; Test Accelerometer
+;    call    compass_filter              ; Filter compass raw data
+;    banksel common
+;
+;    ; Four times to get cleaner values
+;    call    I2C_RX_compass              ; read compass
+;    call    I2C_RX_accelerometer        ; Test Accelerometer
+;    call    compass_filter              ; Filter compass raw data
+
+    ; And register only one value out of four:
+    call    compass_add_calibration     ; check and store new max/min values
+    banksel common
+
+    call    TFT_compass_fast            ; show values
+;    btg     LEDg                       ; Show read-out interval
+
+    btfsc	sleepmode					; Sleepmode active?
+    bra     compass_calibration_exit    ; Yes, exit
+
+    btfsc   switch_left                 ; Button pressed?
+    bra     compass_calibration_exit    ; Yes, exit
+
+    btfss	onesecupdate				; do every second tasks?
+    bra     compass_calibration_loop2   ; no, loop here
+
+	movlw	.240
+    call	timeout_testmode			; check timeout
+    bcf     onesecupdate                ; clear flag
+
+    bra     compass_calibration_loop2   ; loop here
+
+compass_calibration_exit:
+    call    compass_solve_calibration
+    banksel common
+    extern  option_save_all
+	call	option_save_all             ; save all settings into EEPROM
+    bcf     sleepmode                   ; Clear the flag before exiting to surfacemode
+    movlw   .6
+    movwf   menupos3                    ; Set to compass view...
+   	goto	surfloop       				; ...and exit
+
+    END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_english.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,263 @@
+;=============================================================================
+;
+;    File text_english.asm
+;
+;    English texts reference file.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+
+; Basic texts
+	TCODE	tNo,        "No"            ; No
+	TCODE	tYes,       "Yes"           ; Yes = No + 1
+
+; Surface-mode texts
+    TCODE   tBeta,      "beta"         	; beta
+	TCODE	tMenu,		"<Menu"			; <Menu
+    TCODE   tView,      "View>"         ; View>
+    TCODE   tHeading,   "Heading:"      ; Heading:
+
+; Divemode Menu
+    TCODE   tDivemenu_Gaslist,  "Gaslist"       ; Gaslist
+    TCODE   tDivemenu_ResetAvr, "Reset Avr."    ; Reset Avr.
+    TCODE   tDivemenu_Setpoint, "Setpoint"      ; Setpoint
+    TCODE   tDivemenu_UseSensor,"Use Sensor"    ; Use Sensor
+    TCODE   tDivemenu_ToggleGF, "Toggle GF"     ; Toggle GF
+
+; Main menu
+    TCODE   tNext,      "<Next"         ; <Next
+    TCODE   tEnter,     "Enter>"        ; Enter>
+
+    TCODE   tMainMenu,  "Main Menu"     ; MainMenu
+    TCODE   tLogbook,   "Logbook"       ; Logbook
+    TCODE   tGasSetup,  "OC Gas Setup"  ; OC Gas Setup
+    TCODE   tSimulator, "Simulator"     ; Simulator
+    TCODE   tSetTime,   "Set Time"		; Set Time
+	TCODE	tSetDate,	"Set Date"		; Set Date
+	TCODE	tSetTimeDate,"Set Time & Date"; Set Time & Date
+    TCODE   tDispSets,  "Display Settings" ; Display Settings
+    TCODE   tExit,      "Exit"          ; Exit
+	TCODE	tResetMenu, "Reset Menu"	; Reset Menu
+	TCODE	tDiveModeMenu,"Deco Mode"	; Deco Mode
+	TCODE	tInfoMenu,	"Information"	; Information
+    TCODE   tCCRSetup,  "CCR Setup"     ; CCR Setup
+    TCODE   tDiluentSetup,"Diluent Setup"   ; Diluent Setup
+    TCODE   tFixedSetpoints,"Fixed Setpoints" ; Fixed Setpoints
+    TCODE   tCCRSensor, "CCR Sensor"    ; CCR Sensor
+
+; Gas menu
+    TCODE   tGaslist,   "OC Gas List"
+    TCODE   tGasEdit,   "Edit Gas"
+    TCODE   tType,      "Type: "
+    TCODE   tGasDisabled,"Disabled"  ; Disabled
+    TCODE   tGasFirst,   "First"     ; First
+    TCODE   tGasTravel,  "Travel"    ; Travel
+    TCODE   tGasDeco,    "Deco"      ; Deco
+    TCODE   tDilDisabled,"Disabled"  ; Disabled
+    TCODE   tDilFirst,   "First"     ; First
+    TCODE   tDilNorm,   "Normal"     ; Normal
+    TCODE   tAir,       "Air  "         ; Enum: values must follows (5 chars)
+    TCODE   tO2,        "O2   "         ; tAir + 5
+    TCODE   tO2Plus,    "O2 +"
+    TCODE   tO2Minus,   "O2 -"
+    TCODE   tHePlus,    "He +"
+    TCODE   tHeMinus,   "He -"
+    TCODE   tMOD,       "MOD:"
+    TCODE   tEAD,       "EAD:"
+    TCODE   tGasDepth,  "Change depth"
+    TCODE   tDepthPlus, "Depth +"
+    TCODE   tDepthMinus,"Depth -"
+    TCODE   tDepthReset,"Reset to MOD:"
+    TCODE   tSetup_mix, "Setup Mix"
+    TCODE   tCCRMode,   "CCR Mode:"             ; CCR Mode:
+    TCODE   tCCRModeFixedSP,  "Fixed SP"        ; Fixed SP
+    TCODE   tCCRModeSensor,   "Sensor"          ; Sensor
+    TCODE   tSP,            "SP"                ; SP (SetPoint)
+    TCODE   tSPPlus,    "pO2+"                  ; pO2+
+
+; New battery menu
+	TCODE   tNewBattTitle,      "New Battery?"
+	TCODE	tNewBattOld,		"Keep old"
+	TCODE	tNewBattNew36,		"New 3.6V"
+	TCODE	tNewBattNew15,		"New 1.5V"
+
+; Gaslist management
+    TCODE   tGas,       "Gas"           ; Gas
+    TCODE   tNx,        "Nx "          	; Nx   (3 chars)
+    TCODE   tTx,        "Tx "          	; Tx   (3 chars)
+    TCODE   tGasErr,    "Err"           ; Err  (3 chars)
+        
+; Communication Menu
+    TCODE   tUsbMode,  "Start USB"
+	TCODE	tUsbTitle,	"USB Mode"
+	TCODE	tUsbStarting,  "Starting..."
+	TCODE	tUsbStartDone, "Done.      "
+	TCODE	tUsbServiceMode, "Service mode enabled"
+	TCODE	tUsbClosed,		"Port closed"
+	TCODE	tUsbExit,		"Exited"
+	TCODE	tUsbDownloadMode, "Download mode enabled"
+    TCODE   tUsbLlBld,      "Low-level Bootloader"
+
+; Dive Settings
+    TCODE   tDvMode,    "Dive Mode:"
+    TCODE   tDvOC,      "OC"
+    TCODE   tDvCC,      "CC"
+    TCODE   tDvGauge,   "Gauge"
+    TCODE   tDvApnea,   "Apnea"
+    TCODE   tDkMode,    "Decotype:"
+    TCODE   tZHL16,     "ZH-L16"
+    TCODE   tZHL16GF,   "ZH-L16+GF"
+    TCODE   tPPO2Max,   "ppO2 Max:"
+    TCODE   tPPO2Min,   "ppO2 Min:"
+    TCODE   tLastDecostop, "Last Deco:"
+    TCODE   tDecoparameters, "Deco Parameters"
+    TCODE   tGF_low,    "GF low:"
+    TCODE   tGF_high,   "GF high:"
+    TCODE   tSaturationMult,    "Saturation:"
+    TCODE   tDesaturationMult,  "Desaturation:"
+    TCODE   tFTTSMenu,  "Future TTS:"            ; Future TTS
+    TCODE   taGFMenu,   "Alternative GF"         ; Alternative GF
+    TCODE   taGF_low,   "aGF low:"               ; aGF low
+    TCODE   taGF_high,  "aGF high:"              ; aGF high
+    TCODE   taGF_enable,"aGF Selectable:"        ; aGF Selectable
+    TCODE   tDiveaGF_active,"aGF!"          ; aGF!
+
+; Display Settings
+    TCODE   tBright,    "Brightness:"
+    TCODE   tEco,       "Eco"
+    TCODE   tMedium,    "Medium"
+    TCODE   tHigh,      "High"
+    TCODE   tDvSalinity,"Salinity:"             ; Salinity
+
+; Setup Menu
+    TCODE   tSystSets,  "Settings"
+    TCODE   tLanguage,  "Language:"
+    TCODE   tEnglish,   "English"
+    TCODE   tGerman,    "German"
+    TCODE   tFrench,    "French"
+    TCODE   tItalian,   "Italian"
+    TCODE   tCompassMenu,"Compass calibration"  ; Compass calibration
+
+    TCODE   tUnits,     "Units:"
+    TCODE   tMetric,     " m/°C"            ; Enum menu
+    TCODE   tImperial,   "ft/°F"
+	
+    TCODE   tDefName,   "HW OSTC3"
+	TCODE	tbar,		"bar"				; bar
+
+; Units for all menu
+    TCODE   tMeters,    "m"
+	TCODE	tFeets,		"ft"
+	TCODE	tFeets1,	"f"
+    TCODE   tMinutes,   "'"
+    TCODE   tPercent,   "%"
+
+; Date
+	TCODE	tDateFormat, "Date:"
+	TCODE	tDateformat, "MMDDYY"
+	TCODE	tDateformat1,"DDMMYY"
+	TCODE	tDateformat2,"YYMMDD"
+
+; Simulator menu
+    TCODE   tInter, 	"Simulator"         ; Dive Simulator
+    TCODE   tPlan,  	"Deco Planner"      ; Deco Planner
+
+; Decoplanner submenu
+    TCODE   tBtTm,  	"Bot. Time:"        ; Bot. Time: (10 chars)
+    TCODE   tMxDep, 	"Max Depth:"        ; Max Depth: (10 chars)
+    TCODE   tIntvl, 	"Interval :"        ; Interval : (10 chars)
+    TCODE   tDeco,  	"Calculate Deco"    ; Calculate Deco
+    TCODE   tDivePlan,  "Dive Plan:"        ; Dive Plan:
+    TCODE   tNoDeco,    "No Deco"           ; No Deco
+    TCODE   tMore,      "More..."           ; More...
+    TCODE   tCNS,       "CNS"               ; CNS
+
+; Information menu
+    TCODE   tFirmware,  "Firmware: "        ; Firmware: (space)
+    TCODE   tSerial,    "Serial  : "        ; Serial  : (space)
+	TCODE	tTotalDives,"Total Dives: "		; Total Dives: 
+    
+; Divemode screen
+    TCODE   tNDL,       "NDL"
+    TCODE   tTTS,   	"TTS"
+	TCODE	tVelMetric,	 "m/min"
+	TCODE	tVelImperial,"ft/m "
+	TCODE	tGasSelect,  "Select Gas"       ; Select Gas
+	TCODE	tSelectAir,	 "Air "     		; Air
+	TCODE	tSelectO2,	 "O2  "             ; O2
+    TCODE   tSelectNx,   "Nx"               ; Nx
+    TCODE   tSelectTx,   "Tx"               ; Tx
+    TCODE   tDepth,      "Depth"            ; Depth
+    TCODE   tMaxDepth,   "Max. Depth"       ; Max. Depth
+    TCODE   tDivetime,   "Divetime"         ; Divetime
+    TCODE   tDiveHudMask1,  "Sensor 1"
+    TCODE   tDiveHudMask2,  "Sensor 2"
+    TCODE   tDiveHudMask3,  "Sensor 3"
+    TCODE   tDiveTotalAvr,  "Total Avr"
+    TCODE   tDiveStopwatch, "Stopwatch"
+    TCODE   tDiveStopAvr,   "Stopped Avr"
+    TCODE   tApnoeMax,      "Last Descend"  ; Last decend
+    TCODE   tApnoeSurface,  "Surface Time"  ; Surface Time
+    TCODE   tDiveDecoplan,  "Decoplan"      ; Decoplan
+    TCODE   tDiveClock,     "Clock"         ; Clock
+    TCODE   tDiveEAD_END,   "EAD/END"       ; EAD/END
+    TCODE   tDiveTissues,   "Tissues"       ; Tissues
+    TCODE   tEND,           "END:"          ; END:
+    TCODE   tHe,            "He"            ; He
+    TCODE   tN2,            "N2"            ; N2
+    TCODE   tDiveBailout,   "Bailout"       ; Bailout
+    TCODE   tGFactors,      "GF Values"     ; GF Values
+    TCODE   taGFactors,     "aGF Values"    ; aGF Values
+    TCODE   tGFInfo,        "Current GF"    ; GF Info
+
+; Divemode menu
+    TCODE   tDivePreMenu,   "Menu?"         ; Menu?
+
+; Simulator menu
+	TCODE	tQuitApnea,	 "Quit?"            ; Quit Apnea mode?
+	TCODE	tQuitSim,	 "Quit?"            ; Quit Simulation?
+	TCODE	tDescent1m,	 "Sim:-1m"          ; Descent 1m
+	TCODE	tAscent1m,	 "Sim:+1m"          ; Ascent 1m
+
+; Logbook
+	TCODE	tCNS2,		"CNS:"
+	TCODE	tAVR,		"Avr:"
+	TCODE	tGF,		"GF:"
+	TCODE	tSAT,		"Sat:"					; Sat:
+
+; Logbook units
+	TCODE	tLogTunitC,	"°C"	
+	TCODE	tLogTunitF,	"°F"
+	TCODE	tKGL,		"kg/l"
+	TCODE	tMBAR,		"mbar"
+
+; Logbook menu
+	TCODE	tNextLog, 	"Next Page"
+	TCODE	tExitLog, 	"Exit Logbook"
+
+; Reset menu
+	TCODE	tReboot,	"Reboot"			;Reboot
+	TCODE	tResetMenu2,"Are you sure?"		;Are you sure?
+	TCODE	tAbort,     "Abort"             ;Abort
+	TCODE	tResetSettings, "Reset all" 	;Reset all
+	TCODE	tResetDeco,	"Reset Deco"		;Reset Deco
+    TCODE	tResetBattery,	"Reset Battery"		;Reset Battery
+
+; Set Time Menu/Set Date Menu
+	TCODE	tSetHours,	"Set Hours"			; Set Hours
+	TCODE	tSetMinutes,"Set Minutes"		; Set Minutes
+	TCODE	tSetSeconds,"Clear Seconds"		; Clear seconds
+	TCODE	tSetDay,	"Set Day"			; Set Day
+	TCODE	tSetMonth,	"Set Month"			; Set Month
+	TCODE	tSetYear,	"Set Year"			; Set Year
+
+; After update texts
+	TCODE	tNewFirmware1, "Update sucessful!"	; Update sucessful!
+	TCODE	tNewFirmware2, "New Firmware: "		; New Firmware: 
+
+; Logbook Offset Menu
+	TCODE	tLogOffset,		"Logbook offset"	; Logbook offset
+	TCODE	tLogOffsetp1,	"+1"				; +1
+	TCODE	tLogOffsetp10,	"+10"				; +10
+	TCODE	tLogOffsetm1,	"-1"				; -1
+	TCODE	tLogOffsetm10,	"-10"				; -10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_french.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,263 @@
+;=============================================================================
+;
+;    File text_french.asm
+;
+;    French texts translation file.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+
+; Basic texts
+	TCODE	tNo,    	"Non"        	; No
+	TCODE	tYes,   	"Oui"         	; Yes = No + 1
+
+; Surface-mode texts
+    TCODE   tBeta,      "béta"          ; beta
+	TCODE	tMenu,		"<Menu"			; <Menu
+    TCODE   tView,      "vues>"         ; View>
+    TCODE   tHeading,   "Heading:"      ; Heading:
+
+; Divemode Menu
+    TCODE   tDivemenu_Gaslist,  "listgaz"       ; Gaslist
+    TCODE   tDivemenu_ResetAvr, "Resetchrono"    ; Reset Avr.
+    TCODE   tDivemenu_Setpoint, "Setpoint"      ; Setpoint
+    TCODE   tDivemenu_UseSensor,"cellules"    ; Use Sensor
+    TCODE   tDivemenu_ToggleGF, "bascul.GF"     ; Toggle GF
+
+; Main menu
+    TCODE   tNext,      "<Suiv."        ; <Next
+    TCODE   tEnter,     "Entrer>"        ; Enter>
+
+    TCODE   tMainMenu,  "Menu Principal"; MainMenu
+    TCODE   tLogbook,   "Carnet de Plongée" ; Logbook
+    TCODE   tGasSetup,  "Config.gaz OC"  ; OC Gas Setup
+    TCODE   tSimulator, "Simulateur"    ; Simulator
+    TCODE   tSetTime,   "Réglage Heure"	; Set Time
+	TCODE	tSetDate,	"Réglage Date"	; Set Date
+	TCODE	tSetTimeDate,"Date & Heure" ; Set Time & Date
+    TCODE   tDispSets,  "Préf. Affich."	; Display Settings
+    TCODE   tExit,      "Retour"        ; Exit
+	TCODE	tResetMenu, "Menu reset"     ; Reset Menu
+	TCODE	tDiveModeMenu,"Menu Déco"	; Deco Mode
+	TCODE	tInfoMenu,	"Information"	; Information
+    TCODE   tCCRSetup,  "Config. CCR"     ; CCR Setup
+    TCODE   tDiluentSetup,"Config. Diluent"   ; Diluent Setup
+    TCODE   tFixedSetpoints,"Setpoints fixes" ; Fixed Setpoints
+    TCODE   tCCRSensor, "Cellules CCR"    ; CCR Sensor
+
+; Gas menu
+    TCODE   tGaslist,   "List. gaz OC"
+    TCODE   tGasEdit,   "Préf. Gaz"
+    TCODE   tType,      "Type: "
+    TCODE   tGasDisabled,"Desactiv."  ; Disabled
+    TCODE   tGasFirst,   "Premier"     ; First
+    TCODE   tGasTravel,  "Travel"    ; Travel
+    TCODE   tGasDeco,    "Deco"      ; Deco
+    TCODE   tDilDisabled,"Desactiv."  ; Disabled
+    TCODE   tDilFirst,   "Premier"     ; First
+    TCODE   tDilNorm,   "Normal"     ; Normal
+    TCODE   tAir,       "Air  "         ; Enum: values must follows (5 chars)
+    TCODE   tO2,        "O2   "         ; tAir + 5
+    TCODE   tO2Plus,    "O2 +"
+    TCODE   tO2Minus,   "O2 -"
+    TCODE   tHePlus,    "He +"
+    TCODE   tHeMinus,   "He -"
+    TCODE   tMOD,       "PMU:"
+    TCODE   tEAD,       "PEA:"
+    TCODE   tGasDepth,  "Prof. changmt"
+    TCODE   tDepthPlus, "Prof. +"
+    TCODE   tDepthMinus,"Prof. -"
+    TCODE   tDepthReset,"PMU par défaut:"
+    TCODE   tSetup_mix, "Confi. Mix"
+    TCODE   tCCRMode,   "Mode CCR:"             ; CCR Mode:
+    TCODE   tCCRModeFixedSP,  "SP Fixe"        ; Fixed SP
+    TCODE   tCCRModeSensor,   "Cellule"          ; Sensor
+    TCODE   tSP,            "SP"                ; SP (SetPoint)
+    TCODE   tSPPlus,    "pO2+"                  ; pO2+
+
+; New batteries menu
+	TCODE   tNewBattTitle,      "Nouvelle Batterie?"
+	TCODE	tNewBattOld,		"Conserver"
+	TCODE	tNewBattNew36,		"Réinit. 3,6V"
+	TCODE	tNewBattNew15,		"Réinit. 1,5V"
+
+; Gaslist management
+    TCODE   tGas,       "Gaz"           ; Gas
+    TCODE   tNx,        "Nx "           ; Nx    (3 chars)
+    TCODE   tTx,        "Tx "          	; Tx   (3 chars)
+    TCODE   tGasErr,    "Err"           ; Err  (3 chars)
+
+; Communication Menu
+    TCODE   tUsbMode,  "USB"
+	TCODE	tUsbTitle,		"Mode USB"
+	TCODE	tUsbStarting,  	"Début..."
+	TCODE	tUsbStartDone, 	"Ok.     "
+	TCODE	tUsbServiceMode,"Mode maintenance"
+	TCODE	tUsbClosed,		"Port fermé"
+	TCODE	tUsbExit,		"Terminé"
+	TCODE	tUsbDownloadMode,"Mode téléchargement"
+    TCODE   tUsbLlBld,      "Chargeur bas-niv."
+
+; Dive Settings
+    TCODE   tDvMode,    "Mode:"
+    TCODE   tDvOC,      "OC"
+    TCODE   tDvCC,      "CC"
+    TCODE   tDvGauge,   "Gauge"
+    TCODE   tDvApnea,   "Apnee"
+    TCODE   tDkMode,    "Modèle:"
+    TCODE   tZHL16,     "ZH-L16"
+    TCODE   tZHL16GF,   "ZH-L16+GF"
+    TCODE   tPPO2Max,   "ppO2 Max:"
+    TCODE   tPPO2Min,   "ppO2 Min:"
+    TCODE   tLastDecostop, "Dern. palier:"
+    TCODE   tDecoparameters, "Param. Deco"
+    TCODE   tGF_low,    "GF bas:"
+    TCODE   tGF_high,   "GF haut:"
+    TCODE   tSaturationMult,    "Saturation:"
+    TCODE   tDesaturationMult,  "Desaturation:"
+    TCODE   tFTTSMenu,  "Future DTR:"            ; Future TTS
+    TCODE   taGFMenu,   "GF Alternatif"         ; Alternative GF
+    TCODE   taGF_low,   "aGF bas:"               ; aGF low
+    TCODE   taGF_high,  "aGF haut:"              ; aGF high
+    TCODE   taGF_enable,"aGF Possible:"        ; aGF Selectable
+    TCODE   tDiveaGF_active,"aGF!"          ; aGF!
+
+; Display Settings
+    TCODE   tBright,    "Luminosité:"
+    TCODE   tEco,       "Eco"
+    TCODE   tMedium,    "Medium"
+    TCODE   tHigh,      "Haute"
+    TCODE   tDvSalinity,"Salinité:"             ; Salinity
+
+; Setup Menu
+    TCODE   tSystSets,  "Configuration"
+    TCODE   tLanguage,  "Langue:"
+    TCODE   tEnglish,   "Anglais"
+    TCODE   tGerman,    "Allemand"
+    TCODE   tFrench,    "Français"
+    TCODE   tItalian,   "Italien"
+    TCODE   tCompassMenu,"Calibration boussole"  ; Compass calibration
+
+    TCODE   tUnits,     "Unités:"
+    TCODE   tMetric,     " m/°C"            ; Enum menu
+    TCODE   tImperial,   "ft/°F"
+
+    TCODE   tDefName,   "HW OSTC3"
+	TCODE	tbar,		"bar"				; bar
+
+; Units for all menu
+    TCODE   tMeters,    "m"
+	TCODE	tFeets,		"ft"
+	TCODE	tFeets1,	"f"
+    TCODE   tMinutes,   "'"
+    TCODE   tPercent,   "%"
+
+; Date
+	TCODE	tDateFormat, "Date:"
+	TCODE	tDateformat, "MMJJAA"
+	TCODE	tDateformat1,"JJMMAA"
+	TCODE	tDateformat2,"AAMMJJ"
+
+; Simulator menu
+    TCODE   tInter, 	"Simulateur"        ; Dive Simulator
+    TCODE   tPlan,  	"Planification"     ; Deco Planner
+
+; Decoplanner submenu
+    TCODE   tBtTm,  	"Tps. fond:"        ; Bot. Time: (10 chars)
+    TCODE   tMxDep, 	"Prof. max:"        ; Max Depth: (10 chars)
+    TCODE   tIntvl, 	"Intervalle:"       ; Interval :  (10 chars)
+    TCODE   tDeco,  	"Calcul..."         ; Calculate Deco
+    TCODE   tDivePlan,  "Runtime:"          ; Dive Plan:
+    TCODE   tNoDeco,    "SansDéco"          ; No Deco
+    TCODE   tMore,      "Suite..."          ; More...
+    TCODE   tCNS,       "CNS"               ; CNS
+
+; Information menu
+    TCODE   tFirmware,  "Logiciel: "        ; Firmware: (space)
+    TCODE   tSerial,    "N. Série: "        ; Serial  : (space)
+	TCODE	tTotalDives,"Plongées tot.: "   ; Total Dives: (space)
+
+; Divemode screen
+    TCODE   tNDL,       "NDL"
+    TCODE   tTTS,       "DTR"
+	TCODE	tVelMetric,	 "m/min"
+	TCODE	tVelImperial,"ft/m "
+	TCODE	tGasSelect,  "Activer Gaz"      ; Select Gas
+	TCODE	tSelectAir,	 "Air "             ; Air
+	TCODE	tSelectO2,	 "O2  "             ; O2
+    TCODE   tSelectNx,   "Nx"               ; Nx
+    TCODE   tSelectTx,   "Tx"               ; Tx
+    TCODE   tDepth,      "Prof."            ; Depth
+    TCODE   tMaxDepth,   "Prof. Max."       ; Max. Depth
+    TCODE   tDivetime,   "DuréeTot."         ; Divetime
+    TCODE   tDiveHudMask1,   "cell. 1"
+    TCODE   tDiveHudMask2,   "cell. 2"
+    TCODE   tDiveHudMask3,   "cell. 3"
+    TCODE   tDiveTotalAvr,  "Prof. Moy."
+    TCODE   tDiveStopwatch, "Chrono"
+    TCODE   tDiveStopAvr,   "P.MoyChrono"
+    TCODE   tApnoeMax,      "Dern.plongée"  ; Last decend
+    TCODE   tApnoeSurface,  "Tps.Surface"  ; Surface Time
+    TCODE   tDiveDecoplan,  "Runtime"      ; Decoplan
+    TCODE   tDiveClock,     "Heure"         ; Clock
+    TCODE   tDiveEAD_END,   "PEA/END"       ; EAD/END
+    TCODE   tDiveTissues,   "Tissus"       ; Tissues
+    TCODE   tEND,           "END:"          ; END:
+    TCODE   tHe,            "He"            ; He
+    TCODE   tN2,            "N2"            ; N2
+    TCODE   tDiveBailout,   "Bailout"       ; Bailout
+    TCODE   tGFactors,      "Valeurs GF"     ; GF Values
+    TCODE   taGFactors,     "Valeurs aGF"    ; aGF Values
+    TCODE   tGFInfo,        "GF Info"       ; GF Info
+
+; Divemode menu
+    TCODE   tDivePreMenu,   "Menu?"         ; Menu?
+
+; Simulator menu
+	TCODE	tQuitApnea,	 "Fin?"            ; Quit Apnea mode?
+	TCODE	tQuitSim,	 "Fin?"            ; Quit Simulation?
+	TCODE	tDescent1m,	 "Sim:-1m"          ; Descent 1m
+	TCODE	tAscent1m,	 "Sim:+1m"          ; Ascent 1m
+
+; Logbook
+	TCODE	tCNS2,		"SNC:"
+	TCODE	tAVR,		"Moy:"
+	TCODE	tGF,		"GF:"
+	TCODE	tSAT,		"Sat:"					; Sat:
+
+; Logbook units
+	TCODE	tLogTunitC,	"°C"	
+	TCODE	tLogTunitF,	"°F"
+	TCODE	tKGL,		"kg/l"
+	TCODE	tMBAR,		"mbar"
+
+; Logbook menu
+	TCODE	tNextLog, 	"Page suiv."
+	TCODE	tExitLog, 	"Sortir carnet"
+	
+; Reset menu
+	TCODE	tReboot,	"Redemarrage"            ;Reboot
+	TCODE	tResetMenu2,"Confirmer ?"       ;Are you sure?
+	TCODE	tAbort,     "Quitter"         ;Abort
+	TCODE	tResetSettings, "RàZ complète"  ;Reset all
+	TCODE	tResetDeco,	"RàZ Deco"          ;Reset Deco
+    TCODE	tResetBattery,	"RàZ Batterie"		;Reset Battery
+
+; Set Time Menu/Set Date Menu
+	TCODE	tSetHours,	"Ajust. Heures"     ; Set Hours
+	TCODE	tSetMinutes,"Ajust. Minutes"    ; Set Minutes
+	TCODE	tSetSeconds,"RàZ Secondes"      ; Clear seconds
+	TCODE	tSetDay,	"Ajust. Jours"      ; Set Day
+	TCODE	tSetMonth,	"Ajust. Mois"       ; Set Month
+	TCODE	tSetYear,	"Ajust. Année"      ; Set Year
+
+; After update texts
+	TCODE	tNewFirmware1, "Mise à jours ok !"	; Update sucessful!
+	TCODE	tNewFirmware2, "Nouvelle version: "		; New Firmware: 
+
+; Logbook Offset Menu
+	TCODE	tLogOffset,		"Num. 1er plongée"  ; Logbook offset
+	TCODE	tLogOffsetp1,	"+1"				; +1
+	TCODE	tLogOffsetp10,	"+10"				; +10
+	TCODE	tLogOffsetm1,	"-1"				; -1
+	TCODE	tLogOffsetm10,	"-10"				; -10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_german.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,263 @@
+;=============================================================================
+;
+;    File text_german.asm
+;
+;    German texts translation file.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+
+; Basic texts
+	TCODE	tNo,    "Nein"              ; No
+	TCODE	tYes,   "Ja"                ; Yes = No + 1
+
+; Surface-mode texts
+    TCODE   tBeta,      "beta"          ; beta
+	TCODE	tMenu,		"<Menü"			; <Menu
+    TCODE   tView,      "View>"         ; View>
+    TCODE   tHeading,   "Kurs:"         ; Heading:
+
+; Divemode Menu
+    TCODE   tDivemenu_Gaslist,  "Gasliste"    ; Gaslist
+    TCODE   tDivemenu_ResetAvr, "Stoppuhr"    ; Reset Avr.
+    TCODE   tDivemenu_Setpoint, "Setpoint"      ; Setpoint
+    TCODE   tDivemenu_UseSensor,"Ben. Sensor"    ; Use Sensor
+    TCODE   tDivemenu_ToggleGF, "Toggle GF"     ; Toggle GF
+
+; Main menu
+    TCODE   tNext,      "<Weiter"         ; <Next
+    TCODE   tEnter,     "Enter>"        ; Enter>
+
+    TCODE   tMainMenu,  "Hauptmenü"     ; MainMenu
+    TCODE   tLogbook,   "Logbuch"       ; Logbook
+    TCODE   tGasSetup,  "OC Gas Setup"  ; OC Gas Setup
+    TCODE   tSimulator, "Simulator"     ; Simulator
+    TCODE   tSetTime,   "Zeit stellen" ; Set Time
+	TCODE	tSetDate,	"Datum stellen"	; Set Date
+	TCODE	tSetTimeDate,"Datum & Uhrzeit"; Set Time & Date
+    TCODE   tDispSets,  "Anzeige" ; Display Settings
+    TCODE   tExit,      "Ende"          ; Exit
+	TCODE	tResetMenu, "Reset Menü"	; Reset Menu
+	TCODE	tDiveModeMenu,"Dekoberechnung"	; Deco Mode
+	TCODE	tInfoMenu,	"Informationen"	; Information
+    TCODE   tCCRSetup,  "CCR Menü"     ; CCR Setup
+    TCODE   tDiluentSetup,"Diluent Menü"   ; Diluent Setup
+    TCODE   tFixedSetpoints,"Feste Setpoints" ; Fixed Setpoints
+    TCODE   tCCRSensor, "CCR Sensor"    ; CCR Sensor
+
+; Gas menu
+    TCODE   tGaslist,   "OC Gas Liste"
+    TCODE   tGasEdit,   "Gas einstellen"
+    TCODE   tType,      "Type: "
+    TCODE   tGasDisabled,"Deaktiviert"  ; Disabled
+    TCODE   tGasFirst,   "Start"        ; First
+    TCODE   tGasTravel,  "Reise"        ; Travel
+    TCODE   tGasDeco,    "Deko"         ; Deco
+    TCODE   tDilDisabled,"Deaktiviert"  ; Disabled
+    TCODE   tDilFirst,   "Start"        ; First
+    TCODE   tDilNorm,   "Normal"        ; Normal
+    TCODE   tAir,       "Luft "         ; Enum: values must follows (5 chars)
+    TCODE   tO2,        "O2   "         ; tAir + 5
+    TCODE   tO2Plus,    "O2 +"
+    TCODE   tO2Minus,   "O2 -"
+    TCODE   tHePlus,    "He +"
+    TCODE   tHeMinus,   "He -"
+    TCODE   tMOD,       "MOD:"
+    TCODE   tEAD,       "EAD:"
+    TCODE   tGasDepth,  "Wechseltiefe"
+    TCODE   tDepthPlus, "Tiefe +"
+    TCODE   tDepthMinus,"Tiefe -"
+    TCODE   tDepthReset,"Reset auf MOD:"
+    TCODE   tSetup_mix, "Mix Einstellen"
+    TCODE   tCCRMode,   "CCR Modus:"             ; CCR Mode:
+    TCODE   tCCRModeFixedSP,  "Fester SP"        ; Fixed SP
+    TCODE   tCCRModeSensor,   "Sensor"          ; Sensor
+    TCODE   tSP,            "SP"                ; SP (SetPoint)
+    TCODE   tSPPlus,    "pO2+"                  ; pO2+
+
+; New batteries menu
+	TCODE   tNewBattTitle,      "Neue Batterien?"
+	TCODE	tNewBattOld,		"Behalte alte"
+	TCODE	tNewBattNew36,		"Neue 3,6V"
+	TCODE	tNewBattNew15,		"Neue 1,5V"
+
+; Gaslist management
+    TCODE   tGas,       "Gas"           ; Gas
+    TCODE   tNx,        "Nx "           ; Nx   (3 chars)
+    TCODE   tTx,        "Tx "          	; Tx   (3 chars)
+    TCODE   tGasErr,    "Err"           ; Err  (3 chars)
+
+; Communication Menu
+    TCODE   tUsbMode,  "Starte USB"
+	TCODE	tUsbTitle,	"USB Modus"
+	TCODE	tUsbStarting,  "Starte....."
+	TCODE	tUsbStartDone, "Fertig.    "
+	TCODE	tUsbServiceMode, "Servicemodus aktiv"
+	TCODE	tUsbClosed,		"Abgebrochen"
+	TCODE	tUsbExit,		"Beendet"
+	TCODE	tUsbDownloadMode, "Downloadmodus aktiv"
+    TCODE   tUsbLlBld,      "Low-Level Bootloader"
+
+; Dive Settings
+    TCODE   tDvMode,    "Betrieb:"
+    TCODE   tDvOC,      "OC"
+    TCODE   tDvCC,      "CC"
+    TCODE   tDvGauge,   "Tiefen."
+    TCODE   tDvApnea,   "Apnoe"
+    TCODE   tDkMode,    "Deko-Modus:"
+    TCODE   tZHL16,     "ZH-L16"
+    TCODE   tZHL16GF,   "ZH-L16+GF"
+    TCODE   tPPO2Max,   "ppO2 Max:"
+    TCODE   tPPO2Min,   "ppO2 Min:"
+    TCODE   tLastDecostop, "Letzter Stopp:"
+    TCODE   tDecoparameters, "Deko Parameter"
+    TCODE   tGF_low,    "GF low:"
+    TCODE   tGF_high,   "GF high:"
+    TCODE   tSaturationMult,    "Sättigung:"
+    TCODE   tDesaturationMult,  "Entsättigung:"
+    TCODE   tFTTSMenu,  "Future TTS:"            ; Future TTS
+    TCODE   taGFMenu,   "Alternativ-GF"         ; Alternative GF
+    TCODE   taGF_low,   "aGF low:"               ; aGF low
+    TCODE   taGF_high,  "aGF high:"              ; aGF high
+    TCODE   taGF_enable,"aGF Wählbar:"        ; aGF Selectable
+    TCODE   tDiveaGF_active,"aGF Aktiv"      ; aGF Active
+
+; Display Settings
+    TCODE   tBright,    "Helligkeit:"
+    TCODE   tEco,       "Eco"
+    TCODE   tMedium,    "Mittel"
+    TCODE   tHigh,      "Hoch"
+    TCODE   tDvSalinity,"Salinity:"             ; Salinity
+
+; Setup Menu
+    TCODE   tSystSets,  "Konfiguration"
+    TCODE   tLanguage,  "Sprache:"
+    TCODE   tEnglish,   "Englisch"
+    TCODE   tGerman,    "Deutsch"
+    TCODE   tFrench,    "Französisch"
+    TCODE   tItalian,   "Italienisch"
+    TCODE   tCompassMenu,"Kompass-kalibrierung"  ; Compass calibration
+
+    TCODE   tUnits,     "Einheiten:"
+    TCODE   tMetric,     " m/°C"            ; Enum menu
+    TCODE   tImperial,   "ft/°F"
+
+    TCODE   tDefName,   "HW OSTC3"
+	TCODE	tbar,		"bar"				; bar
+
+; Units for all menu
+    TCODE   tMeters,    "m"
+	TCODE	tFeets,		"ft"
+	TCODE	tFeets1,	"f"
+    TCODE   tMinutes,   "'"
+    TCODE   tPercent,   "%"
+
+; Date
+	TCODE	tDateFormat, "Datum:"
+	TCODE	tDateformat, "MMTTJJ"
+	TCODE	tDateformat1,"TTMMJJ"
+	TCODE	tDateformat2,"JJMMTT"
+
+; Simulator menu
+    TCODE   tInter, 	"Simulator"         ; Dive Simulator
+    TCODE   tPlan,  	"Deko Planer"       ; OSTC3 Decoplanner
+
+; Decoplanner submenu
+    TCODE   tBtTm,  	"Grundzeit:"        ; Bot. Time: (10 chars)
+    TCODE   tMxDep, 	"Max.Tiefe:"        ; Max Depth: (10 chars)
+    TCODE   tIntvl, 	"Intervall:"        ; Interval : (10 chars)
+    TCODE   tDeco,  	"Deko berechnen"    ; Calculate Deco
+    TCODE   tDivePlan,  "Tauchplan:"        ; Dive Plan:
+    TCODE   tNoDeco,    "Keine Deco"           ; No Deco
+    TCODE   tMore,      "Mehr..."           ; More...
+    TCODE   tCNS,       "ZNS"               ; CNS
+
+; Information menu
+    TCODE   tFirmware,  "Firmware: "        ; Firmware: (space)
+    TCODE   tSerial,    "Seriennr.: "        ; Serial  : (space)
+	TCODE	tTotalDives,"Anzahl TG: "		; Total Dives: 
+
+; Divemode screen
+    TCODE   tNDL,       " NZ"
+    TCODE   tTTS,   	"TTS"
+	TCODE	tVelMetric,	 "m/min"
+	TCODE	tVelImperial,"ft/m "
+	TCODE	tGasSelect,  "Wähle Gas"       ; Select Gas
+	TCODE	tSelectAir,	 "Air "     		; Air
+	TCODE	tSelectO2,	 "O2  "             ; O2
+    TCODE   tSelectNx,   "Nx"               ; Nx
+    TCODE   tSelectTx,   "Tx"               ; Tx
+    TCODE   tDepth,      "Tiefe"            ; Depth
+    TCODE   tMaxDepth,   "Max. Tiefe"       ; Max. Depth
+    TCODE   tDivetime,   "TG-Dauer"         ; Divetime
+    TCODE   tDiveHudMask1,  "Sensor 1"
+    TCODE   tDiveHudMask2,  "Sensor 2"
+    TCODE   tDiveHudMask3,  "Sensor 3"
+    TCODE   tDiveTotalAvr,  "Durchschn.1"
+    TCODE   tDiveStopwatch, "Stoppuhr"
+    TCODE   tDiveStopAvr,   "Durchschn.2"
+    TCODE   tApnoeMax,      "  Letzter TG"  ; Last decend
+    TCODE   tApnoeSurface,  "Oberflächenzeit"  ; Surface Time
+    TCODE   tDiveDecoplan,  "Dekoplan"      ; Decoplan
+    TCODE   tDiveClock,     "Uhr"           ; Clock
+    TCODE   tDiveEAD_END,   "EAD/END"       ; EAD/END
+    TCODE   tDiveTissues,   "Gewebe"        ; Tissues
+    TCODE   tEND,           "END:"          ; END:
+    TCODE   tHe,            "He"            ; He
+    TCODE   tN2,            "N2"            ; N2
+    TCODE   tDiveBailout,   "Bailout"       ; Bailout
+    TCODE   tGFactors,      "GF Values"     ; GF Values
+    TCODE   taGFactors,     "aGF Values"    ; aGF Values
+    TCODE   tGFInfo,        "GF Info"       ; GF Info
+
+; Divemode menu
+    TCODE   tDivePreMenu,   "Menü?"         ; Menu?
+
+; Simulator menu
+	TCODE	tQuitApnea,	 "Ende?"            ; Quit Apnea mode?
+	TCODE	tQuitSim,	 "Ende?"            ; Quit Simulation?
+	TCODE	tDescent1m,	 "Sim:-1m"          ; Descent 1m
+	TCODE	tAscent1m,	 "Sim:+1m"          ; Ascent 1m
+
+; Logbook
+	TCODE	tCNS2,		"ZNS:"
+	TCODE	tAVR,		"Mit:"
+	TCODE	tGF,		"GF:"
+	TCODE	tSAT,		"Sät:"					; Sat:
+
+; Logbook units
+	TCODE	tLogTunitC,	"°C"	
+	TCODE	tLogTunitF,	"°F"
+	TCODE	tKGL,		"kg/l"
+	TCODE	tMBAR,		"mbar"
+
+; Logbook menu
+	TCODE	tNextLog, 	"Nächste Seite"
+	TCODE	tExitLog, 	"Logbuch beenden"
+
+; Reset menu
+	TCODE	tReboot,	"Neu starten"			;Reboot
+	TCODE	tResetMenu2,"Sind Sie sicher?"		;Are you sure?
+	TCODE	tAbort,     "Abbrechen"             ;Abort
+	TCODE	tResetSettings, "Alles zurücksetzen";Reset all
+	TCODE	tResetDeco,	"Deko zurücksetzen"		;Reset Deco
+    TCODE	tResetBattery,	"Batterie zurücksetzen"		;Reset Battery
+
+; Set Time Menu/Set Date Menu
+	TCODE	tSetHours,	"Stunden einst."	; Set Hours
+	TCODE	tSetMinutes,"Minuten einst."	; Set Minutes
+	TCODE	tSetSeconds,"Sekunden zurücks."	; Clear seconds
+	TCODE	tSetDay,	"Setze Tag"			; Set Day
+	TCODE	tSetMonth,	"Setze Monat"		; Set Month
+	TCODE	tSetYear,	"Setze Jahr"		; Set Year
+
+; After update texts
+	TCODE	tNewFirmware1, "Update erfolgreich!"	; Update sucessful!
+	TCODE	tNewFirmware2, "Neue Firmware: "		; New Firmware: 
+
+; Logbook Offset Menu
+	TCODE	tLogOffset,		"Logbuch offset"	; Logbook offset
+	TCODE	tLogOffsetp1,	"+1"				; +1
+	TCODE	tLogOffsetp10,	"+10"				; +10
+	TCODE	tLogOffsetm1,	"-1"				; -1
+	TCODE	tLogOffsetm10,	"-10"				; -10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_italian.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,263 @@
+;=============================================================================
+;
+;    File text_italian.asm
+;
+;    Italian texts translation file.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+
+; Basic texts
+	TCODE	tNo,        "No"            ; No
+	TCODE	tYes,       "Si"            ; Yes = No + 1
+
+; Surface-mode texts
+    TCODE   tBeta,      "beta"         	; beta
+	TCODE	tMenu,		"<Menu"			; <Menu
+    TCODE   tView,      "Vedi>"         ; View>
+    TCODE   tHeading,   "Direzione:"    ; Heading:
+
+; Divemode Menu
+    TCODE   tDivemenu_Gaslist,  "Lista Gas"       ; Gaslist
+    TCODE   tDivemenu_ResetAvr, "Azzera Media"  ; Reset Avr.
+    TCODE   tDivemenu_Setpoint, "Setpoint"      ; Setpoint
+    TCODE   tDivemenu_UseSensor,"Usa Sensore"    ; Use Sensor
+    TCODE   tDivemenu_ToggleGF, "Alterna GF"     ; Toggle GF
+
+; Main menu
+    TCODE   tNext,      "<Prossimo"         ; <Next
+    TCODE   tEnter,     "Enter>"        ; Enter>
+
+    TCODE   tMainMenu,  "Menu Principale"     ; MainMenu
+    TCODE   tLogbook,   "Logbook"       ; Logbook
+    TCODE   tGasSetup,  "Imposta Gas OC"  ; OC Gas Setup
+    TCODE   tSimulator, "Simulatore"     ; Simulator
+    TCODE   tSetTime,   "Imposta Ora"		; Set Time
+	TCODE	tSetDate,	"Imposta Data"		; Set Date
+	TCODE	tSetTimeDate,"Imp. Ora e Data"; Set Time & Date
+    TCODE   tDispSets,  "Visualizzazione" ; Display Settings
+    TCODE   tExit,      "Uscita"          ; Exit
+	TCODE	tResetMenu, "Menu Reset"	; Reset Menu
+	TCODE	tDiveModeMenu,"Modalita' Deco"	; Deco Mode
+	TCODE	tInfoMenu,	"Informazioni"	; Information
+    TCODE   tCCRSetup,  "Imposta CCR"     ; CCR Setup
+    TCODE   tDiluentSetup,"Imposta Diluente"   ; Diluent Setup
+    TCODE   tFixedSetpoints,"Setpoints Fissi" ; Fixed Setpoints
+    TCODE   tCCRSensor, "Sensore CCR"    ; CCR Sensor
+
+; Gas menu
+    TCODE   tGaslist,   "Lista Gas OC"
+    TCODE   tGasEdit,   "Modifica Gas"
+    TCODE   tType,      "Tipo: "
+    TCODE   tGasDisabled,"Disabilitato"  ; Disabled
+    TCODE   tGasFirst,   "Primo"     ; First
+    TCODE   tGasTravel,  "Viaggio"    ; Travel
+    TCODE   tGasDeco,    "Deco"      ; Deco
+    TCODE   tDilDisabled,"Disabilitato"  ; Disabled
+    TCODE   tDilFirst,   "Primo"     ; First
+    TCODE   tDilNorm,   "Normale"     ; Normal
+    TCODE   tAir,       "Aria  "         ; Enum: values must follows (5 chars)
+    TCODE   tO2,        "O2   "         ; tAir + 5
+    TCODE   tO2Plus,    "O2 +"
+    TCODE   tO2Minus,   "O2 -"
+    TCODE   tHePlus,    "He +"
+    TCODE   tHeMinus,   "He -"
+    TCODE   tMOD,       "MOD:"
+    TCODE   tEAD,       "EAD:"
+    TCODE   tGasDepth,  "Cambia profondita'"
+    TCODE   tDepthPlus, "Profondita' +"
+    TCODE   tDepthMinus,"Profondita' -"
+    TCODE   tDepthReset,"Reset a MOD:"
+    TCODE   tSetup_mix, "Imposta Miscela"
+    TCODE   tCCRMode,   "Modalita' CCR:"             ; CCR Mode:
+    TCODE   tCCRModeFixedSP,  "SP Fissi"        ; Fixed SP
+    TCODE   tCCRModeSensor,   "Sensore"          ; Sensor
+    TCODE   tSP,            "SP"                ; SP (SetPoint)
+    TCODE   tSPPlus,    "pO2+"                  ; pO2+
+
+; New battery menu
+	TCODE   tNewBattTitle,      "Nuova Batteria?"
+	TCODE	tNewBattOld,		"Mantieni vecchio"
+	TCODE	tNewBattNew36,		"Nuova 3,6V"
+	TCODE	tNewBattNew15,		"Nuova 1,5V"
+
+; Gaslist management
+    TCODE   tGas,       "Gas"           ; Gas
+    TCODE   tNx,        "Nx "          	; Nx   (3 chars)
+    TCODE   tTx,        "Tx "          	; Tx   (3 chars)
+    TCODE   tGasErr,    "Err"           ; Err  (3 chars)
+
+; Communication Menu
+    TCODE   tUsbMode,  "Avvio USB"
+	TCODE	tUsbTitle,	"Modalita' USB"
+	TCODE	tUsbStarting,  "Avvio..."
+	TCODE	tUsbStartDone, "Fatto.      "
+	TCODE	tUsbServiceMode, "Modo Servizio abil"
+	TCODE	tUsbClosed,		"Porta chiusa"
+	TCODE	tUsbExit,		"Uscita"
+	TCODE	tUsbDownloadMode, "Modo Download abil"
+    TCODE   tUsbLlBld,      "Livello-basso Bootloader"
+
+; Dive Settings
+    TCODE   tDvMode,    "Modo Dive:"
+    TCODE   tDvOC,      "OC"
+    TCODE   tDvCC,      "CC"
+    TCODE   tDvGauge,   "Gauge"
+    TCODE   tDvApnea,   "Apnea"
+    TCODE   tDkMode,    "Algoritmo:"
+    TCODE   tZHL16,     "ZH-L16"
+    TCODE   tZHL16GF,   "ZH-L16+GF"
+    TCODE   tPPO2Max,   "ppO2 Max:"
+    TCODE   tPPO2Min,   "ppO2 Min:"
+    TCODE   tLastDecostop, "Ultima Deco:"
+    TCODE   tDecoparameters, "Parametri Deco"
+    TCODE   tGF_low,    "GF basso:"
+    TCODE   tGF_high,   "GF alto:"
+    TCODE   tSaturationMult,    "Saturazione:"
+    TCODE   tDesaturationMult,  "Desaturazione:"
+    TCODE   tFTTSMenu,  "TTS Futuro:"            ; Future TTS
+    TCODE   taGFMenu,   "GF Alternativo"         ; Alternative GF
+    TCODE   taGF_low,   "aGF basso:"               ; aGF low
+    TCODE   taGF_high,  "aGF alto:"              ; aGF high
+    TCODE   taGF_enable,"aGF Selezionabile:"        ; aGF Selectable
+    TCODE   tDiveaGF_active,"aGF!"          ; aGF!
+
+; Display Settings
+    TCODE   tBright,    "Luminosita':"
+    TCODE   tEco,       "Eco"
+    TCODE   tMedium,    "Media"
+    TCODE   tHigh,      "Alta"
+    TCODE   tDvSalinity,"Salinita':"             ; Salinity
+
+; Setup Menu
+    TCODE   tSystSets,  "Impostazioni"
+    TCODE   tLanguage,  "Lingua:"
+    TCODE   tEnglish,   "Inglese"
+    TCODE   tGerman,    "Tedesco"
+    TCODE   tFrench,    "Francese"
+    TCODE   tItalian,   "Italiano"
+    TCODE   tCompassMenu,"Calibra Bussola"  ; Compass calibration
+
+    TCODE   tUnits,     "Unita':"
+    TCODE   tMetric,     " m/°C"            ; Enum menu
+    TCODE   tImperial,   "ft/°F"
+
+    TCODE   tDefName,   "HW OSTC3"
+	TCODE	tbar,		"bar"				; bar
+
+; Units for all menu
+    TCODE   tMeters,    "m"
+	TCODE	tFeets,		"ft"
+	TCODE	tFeets1,	"f"
+    TCODE   tMinutes,   "'"
+    TCODE   tPercent,   "%"
+
+; Date
+	TCODE	tDateFormat, "Data:"
+	TCODE	tDateformat, "MMGGAA"
+	TCODE	tDateformat1,"GGMMAA"
+	TCODE	tDateformat2,"AAMMGG"
+
+; Simulator menu
+    TCODE   tInter, 	"Simulatore"           ; Dive Simulator
+    TCODE   tPlan,  	"Pianifica Deco"       ; Deco Planner
+
+; Decoplanner submenu
+    TCODE   tBtTm,  	"Tempo Fondo :"        ; Bot. Time: (10 chars)
+    TCODE   tMxDep, 	"Profond. Max:"        ; Max Depth: (10 chars)
+    TCODE   tIntvl, 	"Int.Superf. :"        ; Interval : (10 chars)
+    TCODE   tDeco,  	"Calcola Deco"         ; Calculate Deco
+    TCODE   tDivePlan,  "Pianificat:"          ; Dive Plan:
+    TCODE   tNoDeco,    "No Deco"              ; No Deco
+    TCODE   tMore,      "Dettagli..."          ; More...
+    TCODE   tCNS,       "CNS"                  ; CNS
+
+; Information menu
+    TCODE   tFirmware,  "Firmware: "        ; Firmware: (space)
+    TCODE   tSerial,    "Seriale : "        ; Serial  : (space)
+	TCODE	tTotalDives,"Totale Immersioni:"		; Total Dives:
+
+; Divemode screen
+    TCODE   tNDL,       "NDL"
+    TCODE   tTTS,   	"TTS"
+	TCODE	tVelMetric,	 "m/min"
+	TCODE	tVelImperial,"ft/m "
+	TCODE	tGasSelect,  "Selez. Gas"       ; Select Gas
+	TCODE	tSelectAir,	 "Aria "     		; Air
+	TCODE	tSelectO2,	 "O2  "           	; O2
+    TCODE   tSelectNx,   "Nx"               ; Nx
+    TCODE   tSelectTx,   "Tx"               ; Tx
+    TCODE   tDepth,      "Prof.'"           ; Depth
+    TCODE   tMaxDepth,   "Prof. Max"        ; Max. Depth
+    TCODE   tDivetime,   "Divetime"         ; Divetime
+    TCODE   tDiveHudMask1,  "Sensore 1"
+    TCODE   tDiveHudMask2,  "Sensore 2"
+    TCODE   tDiveHudMask3,  "Sensore 3"
+    TCODE   tDiveTotalAvr,  "Media"
+    TCODE   tDiveStopwatch, "Cronometro"
+    TCODE   tDiveStopAvr,   "Media Interrotta"
+    TCODE   tApnoeMax,      "Ultima Discesa"  ; Last decend
+    TCODE   tApnoeSurface,  "Tempo Superficie"  ; Surface Time
+    TCODE   tDiveDecoplan,  "Piano Deco"      ; Decoplan
+    TCODE   tDiveClock,     "Orologio"         ; Clock
+    TCODE   tDiveEAD_END,   "EAD/END"       ; EAD/END
+    TCODE   tDiveTissues,   "Tessuti"       ; Tissues
+    TCODE   tEND,           "END:"          ; END:
+    TCODE   tHe,            "He"            ; He
+    TCODE   tN2,            "N2"            ; N2
+    TCODE   tDiveBailout,   "Bailout"       ; Bailout
+    TCODE   tGFactors,      "Valori GF"     ; GF Values
+    TCODE   taGFactors,     "Valori aGF"    ; aGF Values
+    TCODE   tGFInfo,        "Info GF"       ; GF Info
+
+; Divemode menu
+    TCODE   tDivePreMenu,   "Menu?"         ; Menu?
+
+; Simulator menu
+	TCODE	tQuitApnea,	 "Uscire?"            ; Quit Apnea mode?
+	TCODE	tQuitSim,	 "Uscire?"            ; Quit Simulation?
+	TCODE	tDescent1m,	 "Sim:-1m"          ; Descent 1m
+	TCODE	tAscent1m,	 "Sim:+1m"          ; Ascent 1m
+
+; Logbook
+	TCODE	tCNS2,		"CNS:"
+	TCODE	tAVR,		"Avr:"
+	TCODE	tGF,		"GF:"
+	TCODE	tSAT,		"Sat:"					; Sat:
+
+; Logbook units
+	TCODE	tLogTunitC,	"°C"
+	TCODE	tLogTunitF,	"°F"
+	TCODE	tKGL,		"kg/l"
+	TCODE	tMBAR,		"mbar"
+
+; Logbook menu
+	TCODE	tNextLog, 	"Pagina Seguente"
+	TCODE	tExitLog, 	"Esci da Logbook"
+
+; Reset menu
+	TCODE	tReboot,	"Riavvio"			;Reboot
+	TCODE	tResetMenu2,"Sei sicuro?"		;Are you sure?
+	TCODE	tAbort,     "Annulla"             ;Abort
+	TCODE	tResetSettings, "Azzera Tutto" 	;Reset all
+	TCODE	tResetDeco,	"Azzera Deco"		;Reset Deco
+    TCODE	tResetBattery,	"Azzera Batteria"		;Reset Battery
+
+; Set Time Menu/Set Date Menu
+	TCODE	tSetHours,	"Imposta Ora"			; Set Hours
+	TCODE	tSetMinutes,"Imposta Minuti"		; Set Minutes
+	TCODE	tSetSeconds,"Azzera Secondi"		; Clear seconds
+	TCODE	tSetDay,	"Imp Giorno"			; Set Day
+	TCODE	tSetMonth,	"Imp Mese"			; Set Month
+	TCODE	tSetYear,	"Imp Anno"			; Set Year
+
+; After update texts
+	TCODE	tNewFirmware1, "Aggiornam OK!"	; Update sucessful!
+	TCODE	tNewFirmware2, "Nuovo Firmware: "		; New Firmware:
+
+; Logbook Offset Menu
+	TCODE	tLogOffset, "Offset Logbook"	; Logbook offset
+	TCODE	tLogOffsetp1,	"+1"				; +1
+	TCODE	tLogOffsetp10,	"+10"				; +10
+	TCODE	tLogOffsetm1,	"-1"				; -1
+	TCODE	tLogOffsetm10,	"-10"				; -10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_multilang.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,88 @@
+;=============================================================================
+;
+;   File text_multilang.asm
+;
+;   Implementation text in various selectable languages.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-06-12 : [jDG] Creation...
+
+#include "text_multilang.inc"
+
+; Because text are indexed by 12bits value in FSR register, they can't
+; just be anywhere. It is safe to make them start in address 0xHHH000.
+texts       code    0x009000
+
+;=============================================================================
+            global  text_english_base
+text_english_base:
+
+;---- PASS 1 : generate description block ------------------------------------
+tcode_idx   set     0
+LANG        set     0
+#define     TCODE TCODE_1
+#include    "text_english.inc"
+#undefine   TCODE
+
+;---- PASS 2 : generate text contens -----------------------------------------
+tcode_idx   set     0
+#define     TCODE TCODE_2
+#include    "text_english.inc"
+#undefine   TCODE
+
+;=============================================================================
+            global  text_german_base
+text_german_base:
+
+;---- PASS 1 : generate description block ------------------------------------
+tcode_idx   set     0
+LANG        set     1
+#define     TCODE TCODE_1
+#include    "text_german.inc"
+#undefine   TCODE
+
+;---- PASS 2 : generate text contens -----------------------------------------
+tcode_idx   set     0
+#define     TCODE TCODE_2
+#include    "text_german.inc"
+#undefine   TCODE
+
+;=============================================================================
+            global  text_french_base
+text_french_base
+
+;---- PASS 1 : generate description block ------------------------------------
+tcode_idx   set     0
+LANG        set     2
+#define     TCODE TCODE_1
+#include    "text_french.inc"
+#undefine   TCODE
+
+;---- PASS 2 : generate text contens -----------------------------------------
+tcode_idx   set     0
+#define     TCODE TCODE_2
+#include    "text_french.inc"
+#undefine   TCODE
+
+;=============================================================================
+            global  text_italian_base
+text_italian_base
+
+;---- PASS 1 : generate description block ------------------------------------
+tcode_idx   set     0
+LANG        set     3
+#define     TCODE TCODE_1
+#include    "text_italian.inc"
+#undefine   TCODE
+
+;---- PASS 2 : generate text contens -----------------------------------------
+tcode_idx   set     0
+#define     TCODE TCODE_2
+#include    "text_italian.inc"
+#undefine   TCODE
+
+;=============================================================================
+
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_multilang.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,88 @@
+;=============================================================================
+;
+;    File text_multilang.inc
+;
+;    Implementation text in various selectable languages.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-06-12 : [jDG] Creation...
+;
+; Text definitions (text_french.asm example):
+;	TCODE	tYes,   "Oui"               ; Yes
+;   TCODE   tNo,    "Non"               ; No
+;   TCODE   tLogbk, "Carnet de plongées"  ; Logbook
+;
+; Text direct usage:
+;   lfsr    FSR1,tYes                   ; Load a 12bit text index
+;   call    strcpy_text                 ; Copy to string buffer.
+;   PUTC    '/'
+;   lfsr    FSR1,tNo
+;   call    strcat_text_print           ; Append, and call word processor.
+;
+; RATIONALS:
+;  - The macro should define a label so that text files can be reordered
+;    to keep consistency while adding more option (and make translator life easier).
+;
+;  - The text positions is keept in menu blocks for the menu processor.
+;
+;  - library function take text number from the FSR1 register, because a
+;    lfsr instruction loads a 12bits constant at once.
+;
+;=============================================================================
+;
+
+; Pass 1: generate jump table, and define labels.
+TCODE_1 macro   label, text
+tcode_idx set   tcode_idx+1
+    If LANG == 0
+        global  label
+label:
+    Endif
+        dw      t#v(LANG)_#v(tcode_idx)
+        endm
+;
+; Pass 2: generates string table.
+TCODE_2 macro   label, text
+tcode_idx set   tcode_idx+1
+t#v(LANG)_#v(tcode_idx):
+        db      text, 0
+        endm
+;
+;=============================================================================
+; strcpy_text : copy a multiling text into string buffer.
+;
+; Input:   FSR1 :  text index
+; Output:  Buffer: filled with the text.
+;          FSR2:   pointer to end of copied text (the null char).
+; Trashed: WREG.
+        extern  strcpy_text
+
+;=============================================================================
+; strcpy_text_print : Same as above, but calls word processor afterward.
+;
+; Input:   FSR1 :  text index
+; Output:  Buffer: filled with the text.
+;          FSR2:   pointer to end of copied text (the null char).
+; Trashed: WREG.
+        extern  strcpy_text_print
+
+;=============================================================================
+; strcat_text : Append a multiling text to FSR2 pointer.
+;
+; Input:   FSR1 :  text index
+;          FSR2 :  Current position (in Buffer)
+; Output:  FSR2:   pointer to end of copied text (the null char).
+; Trashed: WREG.
+        extern  strcat_text
+
+;=============================================================================
+; strcat_text_print : Same as above, but calls word processor afterward.
+;
+; Input:   FSR1 :  text index
+;          FSR2 :  Current position (in Buffer)
+; Output:  FSR2:   pointer to end of copied text (the null char).
+; Trashed: WREG.
+        extern  strcat_text_print
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/text_spanish.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,260 @@
+;=============================================================================
+;
+;    File text_spanish.asm
+;
+;    Spanish texts translation file.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+
+; Basic texts
+	TCODE	tNo,        "No"            ; No
+	TCODE	tYes,       "Yes"           ; Yes = No + 1
+
+; Surface-mode texts
+    TCODE   tBeta,      "beta"         	; beta
+	TCODE	tMenu,		"<Menu"			; <Menu
+    TCODE   tView,      "View>"         ; View>
+
+; Divemode Menu
+    TCODE   tDivemenu_Gaslist,  "Gaslist"       ; Gaslist
+    TCODE   tDivemenu_ResetAvr, "Reset Avr."  ; Reset Avr.
+    TCODE   tDivemenu_Setpoint, "Setpoint"      ; Setpoint
+    TCODE   tDivemenu_UseSensor,"Use Sensor"    ; Use Sensor
+    TCODE   tDivemenu_ToggleGF, "Toggle GF"     ; Toggle GF
+
+; Main menu
+    TCODE   tNext,      "<Next"         ; <Next
+    TCODE   tEnter,     "Enter>"        ; Enter>
+
+    TCODE   tMainMenu,  "Main Menu"     ; MainMenu
+    TCODE   tLogbook,   "Logbook"       ; Logbook
+    TCODE   tGasSetup,  "OC Gas Setup"  ; OC Gas Setup
+    TCODE   tSimulator, "Simulator"     ; Simulator
+    TCODE   tSetTime,   "Set Time"		; Set Time
+	TCODE	tSetDate,	"Set Date"		; Set Date
+	TCODE	tSetTimeDate,"Set Time & Date"; Set Time & Date
+    TCODE   tDispSets,  "Display Settings" ; Display Settings
+    TCODE   tExit,      "Exit"          ; Exit
+	TCODE	tResetMenu, "Reset Menu"	; Reset Menu
+	TCODE	tDiveModeMenu,"Deco Mode"	; Deco Mode
+	TCODE	tInfoMenu,	"Information"	; Information
+    TCODE   tCCRSetup,  "CCR Setup"     ; CCR Setup
+    TCODE   tDiluentSetup,"Diluent Setup"   ; Diluent Setup
+    TCODE   tFixedSetpoints,"Fixed Setpoints" ; Fixed Setpoints
+    TCODE   tCCRSensor, "CCR Sensor"    ; CCR Sensor
+
+; Gas menu
+    TCODE   tGaslist,   "OC Gas List"
+    TCODE   tGasEdit,   "Edit Gas"
+    TCODE   tType,      "Type: "
+    TCODE   tGasDisabled,"Disabled"  ; Disabled
+    TCODE   tGasFirst,   "First"     ; First
+    TCODE   tGasTravel,  "Travel"    ; Travel
+    TCODE   tGasDeco,    "Deco"      ; Deco
+    TCODE   tDilDisabled,"Disabled"  ; Disabled
+    TCODE   tDilFirst,   "First"     ; First
+    TCODE   tDilNorm,   "Normal"     ; Normal
+    TCODE   tAir,       "Air  "         ; Enum: values must follows (5 chars)
+    TCODE   tO2,        "O2   "         ; tAir + 5
+    TCODE   tO2Plus,    "O2 +"
+    TCODE   tO2Minus,   "O2 -"
+    TCODE   tHePlus,    "He +"
+    TCODE   tHeMinus,   "He -"
+    TCODE   tMOD,       "MOD:"
+    TCODE   tEAD,       "EAD:"
+    TCODE   tGasDepth,  "Change depth"
+    TCODE   tDepthPlus, "Depth +"
+    TCODE   tDepthMinus,"Depth -"
+    TCODE   tDepthReset,"Reset to MOD:"
+    TCODE   tSetup_mix, "Setup Mix"
+    TCODE   tCCRMode,   "CCR Mode:"             ; CCR Mode:
+    TCODE   tCCRModeFixedSP,  "Fixed SP"        ; Fixed SP
+    TCODE   tCCRModeSensor,   "Sensor"          ; Sensor
+    TCODE   tSP,            "SP"                ; SP (SetPoint)
+    TCODE   tSPPlus,    "pO2+"                  ; pO2+
+
+; New battery menu
+	TCODE   tNewBattTitle,      "New Battery?"
+	TCODE	tNewBattOld,		"Keep old"
+	TCODE	tNewBattNew36,		"New 3,6V"
+	TCODE	tNewBattNew15,		"New 1,5V"
+
+; Gaslist management
+    TCODE   tGas,       "Gas"           ; Gas
+    TCODE   tNx,        "Nx "          	; Nx   (3 chars)
+    TCODE   tTx,        "Tx "          	; Tx   (3 chars)
+    TCODE   tGasErr,    "Err"           ; Err  (3 chars)
+
+; Communication Menu
+    TCODE   tUsbMode,  "Start USB"
+	TCODE	tUsbTitle,	"USB Mode"
+	TCODE	tUsbStarting,  "Starting..."
+	TCODE	tUsbStartDone, "Done.      "
+	TCODE	tUsbServiceMode, "Service mode enabled"
+	TCODE	tUsbClosed,		"Port closed"
+	TCODE	tUsbExit,		"Exited"
+	TCODE	tUsbDownloadMode, "Download mode enabled"
+    TCODE   tUsbLlBld,      "Low-level Bootloader"
+
+; Dive Settings
+    TCODE   tDvMode,    "Dive Mode:"
+    TCODE   tDvOC,      "OC"
+    TCODE   tDvCC,      "CC"
+    TCODE   tDvGauge,   "Gauge"
+    TCODE   tDvApnea,   "Apnea"
+    TCODE   tDkMode,    "Decotype:"
+    TCODE   tZHL16,     "ZH-L16"
+    TCODE   tZHL16GF,   "ZH-L16+GF"
+    TCODE   tPPO2Max,   "ppO2 Max:"
+    TCODE   tPPO2Min,   "ppO2 Min:"
+    TCODE   tLastDecostop, "Last Deco:"
+    TCODE   tDecoparameters, "Deco Parameters"
+    TCODE   tGF_low,    "GF low:"
+    TCODE   tGF_high,   "GF high:"
+    TCODE   tSaturationMult,    "Saturation:"
+    TCODE   tDesaturationMult,  "Desaturation:"
+    TCODE   tFTTSMenu,  "Future TTS:"            ; Future TTS
+    TCODE   taGFMenu,   "Alternative GF"         ; Alternative GF
+    TCODE   taGF_low,   "aGF low:"               ; aGF low
+    TCODE   taGF_high,  "aGF high:"              ; aGF high
+    TCODE   taGF_enable,"aGF Selectable:"        ; aGF Selectable
+    TCODE   tDiveaGF_active,"aGF!"          ; aGF!
+
+; Display Settings
+    TCODE   tBright,    "Brightness:"
+    TCODE   tEco,       "Eco"
+    TCODE   tMedium,    "Medium"
+    TCODE   tHigh,      "High"
+    TCODE   tDvSalinity,"Salinity:"             ; Salinity
+
+; Setup Menu
+    TCODE   tSystSets,  "Settings"
+    TCODE   tLanguage,  "Language:"
+    TCODE   tEnglish,   "English"
+    TCODE   tGerman,    "German"
+    TCODE   tFrench,    "French"
+    TCODE   tSpanish,   "Spanish"
+
+    TCODE   tUnits,     "Units:"
+    TCODE   tMetric,     " m/°C"            ; Enum menu
+    TCODE   tImperial,   "ft/°F"
+
+    TCODE   tDefName,   "HW OSTC3"
+	TCODE	tbar,		"bar"				; bar
+
+; Units for all menu
+    TCODE   tMeters,    "m"
+	TCODE	tFeets,		"ft"
+	TCODE	tFeets1,	"f"
+    TCODE   tMinutes,   "'"
+    TCODE   tPercent,   "%"
+
+; Date
+	TCODE	tDateFormat, "Date:"
+	TCODE	tDateformat, "MMDDYY"
+	TCODE	tDateformat1,"DDMMYY"
+	TCODE	tDateformat2,"YYMMDD"
+
+; Simulator menu
+    TCODE   tInter, 	"Simulator"         ; Dive Simulator
+    TCODE   tPlan,  	"Deco Planner"      ; Deco Planner
+
+; Decoplanner submenu
+    TCODE   tBtTm,  	"Bot. Time:"        ; Bot. Time: (10 chars)
+    TCODE   tMxDep, 	"Max Depth:"        ; Max Depth: (10 chars)
+    TCODE   tIntvl, 	"Interval :"        ; Interval : (10 chars)
+    TCODE   tDeco,  	"Calculate Deco"    ; Calculate Deco
+    TCODE   tDivePlan,  "Dive Plan:"        ; Dive Plan:
+    TCODE   tNoDeco,    "No Deco"           ; No Deco
+    TCODE   tMore,      "More..."           ; More...
+    TCODE   tCNS,       "CNS"               ; CNS
+
+; Information menu
+    TCODE   tFirmware,  "Firmware: "        ; Firmware: (space)
+    TCODE   tSerial,    "Serial  : "        ; Serial  : (space)
+	TCODE	tTotalDives,"Total Dives: "		; Total Dives:
+
+; Divemode screen
+    TCODE   tNDL,       "NDL"
+    TCODE   tTTS,   	"TTS"
+	TCODE	tVelMetric,	 "m/min"
+	TCODE	tVelImperial,"ft/m "
+	TCODE	tGasSelect,  "Select Gas"       ; Select Gas
+	TCODE	tSelectAir,	 "Air "     		; Air
+	TCODE	tSelectO2,	 "O2  "           	; O2
+    TCODE   tSelectNx,   "Nx"               ; Nx
+    TCODE   tSelectTx,   "Tx"               ; Tx
+    TCODE   tDepth,      "Depth"            ; Depth
+    TCODE   tMaxDepth,   "Max. Depth"       ; Max. Depth
+    TCODE   tDivetime,   "Divetime"         ; Divetime
+    TCODE   tDiveHudMask1,  "Sensor 1"
+    TCODE   tDiveHudMask2,  "Sensor 2"
+    TCODE   tDiveHudMask3,  "Sensor 3"
+    TCODE   tDiveTotalAvr,  "Total Avr"
+    TCODE   tDiveStopwatch, "Stopwatch"
+    TCODE   tDiveStopAvr,   "Stopped Avr"
+    TCODE   tApnoeMax,      "Last Descend"  ; Last decend
+    TCODE   tApnoeSurface,  "Surface Time"  ; Surface Time
+    TCODE   tDiveDecoplan,  "Decoplan"      ; Decoplan
+    TCODE   tDiveClock,     "Clock"         ; Clock
+    TCODE   tDiveEAD_END,   "EAD/END"       ; EAD/END
+    TCODE   tDiveTissues,   "Tissues"       ; Tissues
+    TCODE   tEND,           "END:"          ; END:
+    TCODE   tHe,            "He"            ; He
+    TCODE   tN2,            "N2"            ; N2
+    TCODE   tDiveBailout,   "Bailout"       ; Bailout
+    TCODE   tGFactors,      "GF Values"     ; GF Values
+    TCODE   taGFactors,     "aGF Values"    ; aGF Values
+    TCODE   tGFInfo,        "GF Info"       ; GF Info
+
+; Divemode menu
+    TCODE   tDivePreMenu,   "Menu?"         ; Menu?
+
+; Simulator menu
+	TCODE	tQuitApnea,	 "Quit?"            ; Quit Apnea mode?
+	TCODE	tQuitSim,	 "Quit?"            ; Quit Simulation?
+	TCODE	tDescent1m,	 "Sim:-1m"          ; Descent 1m
+	TCODE	tAscent1m,	 "Sim:+1m"          ; Ascent 1m
+
+; Logbook
+	TCODE	tCNS2,		"CNS:"
+	TCODE	tAVR,		"Avr:"
+	TCODE	tGF,		"GF:"
+	TCODE	tSAT,		"Sat:"					; Sat:
+
+; Logbook units
+	TCODE	tLogTunitC,	"°C"
+	TCODE	tLogTunitF,	"°F"
+	TCODE	tKGL,		"kg/l"
+	TCODE	tMBAR,		"mbar"
+
+; Logbook menu
+	TCODE	tNextLog, 	"Next Page"
+	TCODE	tExitLog, 	"Exit Logbook"
+
+; Reset menu
+	TCODE	tReboot,	"Reboot"			;Reboot
+	TCODE	tResetMenu2,"Are you sure?"		;Are you sure?
+	TCODE	tAbort,     "Abort"             ;Abort
+	TCODE	tResetSettings, "Reset all" 	;Reset all
+	TCODE	tResetDeco,	"Reset Deco"		;Reset Deco
+
+; Set Time Menu/Set Date Menu
+	TCODE	tSetHours,	"Set Hours"			; Set Hours
+	TCODE	tSetMinutes,"Set Minutes"		; Set Minutes
+	TCODE	tSetSeconds,"Clear Seconds"		; Clear seconds
+	TCODE	tSetDay,	"Set Day"			; Set Day
+	TCODE	tSetMonth,	"Set Month"			; Set Month
+	TCODE	tSetYear,	"Set Year"			; Set Year
+
+; After update texts
+	TCODE	tNewFirmware1, "Update sucessful!"	; Update sucessful!
+	TCODE	tNewFirmware2, "New Firmware: "		; New Firmware:
+
+; Logbook Offset Menu
+	TCODE	tLogOffset,		"Logbook offset"	; Logbook offset
+	TCODE	tLogOffsetp1,	"+1"				; +1
+	TCODE	tLogOffsetp10,	"+10"				; +10
+	TCODE	tLogOffsetm1,	"-1"				; -1
+	TCODE	tLogOffsetm10,	"-10"				; -10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tft.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,1071 @@
+;=============================================================================
+;
+;   File tft.asm
+;
+;   Managing the TFT screen
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-05-24 : [jDG] Cleanups from initial Matthias code.
+
+#include "ostc3.inc"
+#include "wait.inc"
+#include "varargs.inc"
+#include "external_flash.inc"
+#include "tft_outputs.inc"
+#include "eeprom_rs232.inc"
+
+;=============================================================================
+; TFT_frame needs to backup coordinates.
+        CBLOCK  tmp
+            save_top                
+            save_height 
+            save_left   
+            save_width
+        	ds_line                 ; Current line (0..239).
+        	ds_column               ; Current columnx2 (0..159)
+        	ds_pixel:2              ; Current pixel color.
+        	ds_count                ; Repetition count.
+        ENDC
+
+;=============================================================================
+; Basic bit-level macros
+
+RD_H		macro
+			bsf tft_rd,0
+			endm
+
+RD_L		macro
+			bcf tft_rd,0
+			endm
+
+RS_H		macro
+			bsf tft_rs,0
+			endm
+
+RS_L		macro
+			bcf tft_rs,0
+			endm
+
+NCS_H		macro
+			bsf tft_cs,0
+			endm
+
+NCS_L		macro
+			bcf tft_cs,0
+			endm
+
+WR_H		macro
+			bsf tft_nwr,0
+			endm
+
+WR_L		macro
+			bcf tft_nwr,0
+			endm
+
+;=============================================================================
+; Byte-leve macros
+;
+Index_out		macro low_b
+				movlw low_b
+				rcall TFT_CmdWrite
+				endm
+
+Parameter_out	macro high_b, low_b
+				movlw high_b
+				movwf PORTA		; Upper
+				movlw low_b
+				rcall TFT_DataWrite
+				endm
+
+
+basic   CODE
+
+ 
+;=============================================================================
+; TFT_write_flash_image
+;
+; Inputs:  FSR2 = EEPROM address / 256
+;          win_left, win_top : imagte CENTER position
+; Outputs: win_height, win_width.
+;          image copyed on screen.
+; Trashed: PROD, hi, lo
+; 
+	global	TFT_write_flash_image
+TFT_write_flash_image:
+    ; Get back the full 24bit EEPROM address
+    clrf    ext_flash_address+0
+    movff   FSR2L,ext_flash_address+1
+    movf    FSR2H,W
+    iorlw   0x30
+    movwf   ext_flash_address+2
+    
+    ; Read header: width and height
+    global  TFT_write_flash_image_addr
+TFT_write_flash_image_addr:    
+	call	ext_flash_read_block_start
+	movff   SSP2BUF,win_width+0 
+	movwf	SSP2BUF						; Write to buffer to initiate new read
+	btfss	SSP2STAT, BF                ; Next byte ready ?
+	bra		$-2                         ; NO: wait...
+   	movff   SSP2BUF,win_width+1
+	movwf	SSP2BUF						; Write to buffer to initiate new read
+	btfss	SSP2STAT, BF                ; Next byte ready ?
+	bra		$-2                         ; NO: wait...
+	movff   SSP2BUF,win_height  
+	movwf	SSP2BUF						; Write to buffer to initiate new read
+	btfss	SSP2STAT, BF                ; Next byte ready ?
+	bra		$-2                         ; NO: wait...
+	movff   SSP2BUF,WREG                ; drop 4th byte.
+	movwf	SSP2BUF						; Write to buffer to initiate new read
+	btfss	SSP2STAT, BF                ; Next byte ready ?
+	bra		$-2                         ; NO: wait...
+
+    ; Sanity check on header to avoid badly uploaded images.
+    iorwf   WREG                        ; Check height < 256
+    bnz     TFT_write_flash_image_failed
+    movf    win_width+1,W               ; Check width < 512
+    andlw   0xFE
+    bnz     TFT_write_flash_image_failed
+    
+    ; Center image on win_top, win_left values
+    bcf     STATUS,C                    ; Clear carry
+    rrcf    win_height,W                ; And get height/2
+    subwf   win_top,F                   ; top -= height/2
+    rrcf    win_width+1,W               ; Get 9th bit into carry
+    rrcf    win_width+0,W               ; Get width/2 (in 0..320 range)
+    bcf     STATUS,C
+    rrcf    WREG,W                      ; Get width/2 in 0..160 range
+    subwf   win_leftx2,F                ; left -= width/2
+
+	rcall	TFT_box_write		    	; Inputs : win_top, win_leftx2, win_height, win_width(in 1..320 range)
+        
+    ; Compute number of pixels to move (result on 17 bits !)
+    clrf    TBLPTRU
+    movf    win_width+0,W
+    mulwf   win_height                  ; Result in PRODL:H
+    movf    win_width+1,W
+    bz      TFT_write_flash_image_1     ; width > 8bits ?
+    movf    win_height,W                ; YES: add extra
+    addwf   PRODH,F
+    rlcf    TBLPTRU                     ; And carry into upper register.
+TFT_write_flash_image_1:
+    incf    PRODH,F                     ; Pre-condition nested loops
+    incf    TBLPTRU,F
+
+    ; Write pixels
+	Index_out 0x22						; Frame Memory Data Write start
+	RS_H								; Data
+
+TFT_write_flash_image_loop:
+	btfss	SSP2STAT, BF				; Buffer full?
+	bra		$-2                         ; NO: wait...
+	movff	SSP2BUF,PORTH			    ; Read lo
+	movwf	SSP2BUF						; Write to buffer to initiate new read
+
+	btfss	SSP2STAT, BF				; Buffer full?
+	bra		$-2                         ; NO: wait...
+	movff	SSP2BUF,PORTA               ; And read hi
+	movwf	SSP2BUF						; Write to buffer to initiate new read
+	WR_L
+	WR_H								; Write 1 Pixel
+
+	decfsz	PRODL,F
+	bra		TFT_write_flash_image_loop
+	decfsz	PRODH,F
+	bra		TFT_write_flash_image_loop
+	decfsz	TBLPTRU,F
+	bra		TFT_write_flash_image_loop
+
+	btfss	SSP2STAT, BF				; Buffer full?
+	bra		$-2	                        ; No, wait
+	movf	SSP2BUF,W                   ; Read dummy byte
+
+	bsf		flash_ncs					; CS=1
+	movlw	0x00                        ; NOP, to stop window mode
+	bra     TFT_CmdWrite				; This routine "returns"
+	
+	;---- Draw a 4x4 red square in place of missing images...
+TFT_write_flash_image_failed:
+    movlw   -1
+    addwf   win_leftx2,F
+    movlw   -2
+    addwf   win_top,F
+    movlw   2
+    movwf   win_width+0
+    clrf    win_width+1
+    movlw   4
+    movwf   win_height
+    movlw   color_red
+    rcall   TFT_set_color
+    goto    TFT_box
+
+;=============================================================================
+;
+
+    global  TFT_CmdWrite
+TFT_CmdWrite:
+	RS_L				; Command
+	clrf	PORTA		; Upper
+	movwf	PORTH		; Lower
+	WR_L
+	WR_H				; Tick
+	return;
+
+    global  TFT_DataWrite
+TFT_DataWrite:
+	RS_H				; Data
+	movwf 	PORTH		; Lower
+	WR_L
+	WR_H				; Tick
+	return
+
+;=============================================================================
+;
+    global  TFT_ClearScreen
+TFT_ClearScreen:
+	Index_out 0x50				; Window Horizontal Start Address
+	Parameter_out 0x00, 0x00	; 0-239
+	Index_out 0x51				; Window Horizontal End Address
+	Parameter_out 0x00, 0xEF	; 0-239
+	Index_out 0x52				; Window Vertical Start Address
+	Parameter_out 0x00, 0x00	; 0-319
+	Index_out 0x53				; Window Vertical End Address
+	Parameter_out 0x01, 0x3F	; 0-319
+	Index_out 0x20				; Frame Memory Horizontal Address
+	Parameter_out 0x00, 0x00	; 0-239
+	Index_out 0x21				; Frame Memory Vertical Address
+	Parameter_out 0x01, 0x3F	; 0-319
+
+	Index_out 0x22				; Frame Memory Data Write start
+
+	RD_H						; Not Read
+	RS_H						; Data
+	NCS_L						; Not CS
+	clrf	PORTA				; Data Upper
+	clrf	PORTH				; Data Lower
+
+	movlw	d'10'
+	movwf	tft_temp3
+TFT_ClearScreen2:
+	movlw	d'30'
+	movwf	tft_temp2
+TFT_ClearScreen3:
+	clrf	tft_temp1				; 30*10*256=76800 Pixels -> Clear complete 240*320
+TFT_ClearScreen4:
+	WR_L
+	WR_H							; Tick
+	decfsz	tft_temp1,F
+	bra		TFT_ClearScreen4
+	decfsz	tft_temp2,F
+	bra		TFT_ClearScreen3
+	decfsz	tft_temp3,F
+	bra		TFT_ClearScreen2
+	return
+
+;=============================================================================
+; 
+    global  TFT_DisplayOff
+TFT_DisplayOff:
+	clrf	CCPR1L				; PWM OFF
+	clrf	PORTA
+    clrf	PORTH
+	RD_L	; LOW
+	nop
+	RS_L	; LOW
+	bcf		tft_nwr
+	nop
+	bcf		tft_cs
+	nop
+	bcf		tft_nreset
+	WAITMS	d'1'
+	bsf		tft_power				; inverted...
+	bcf		lightsen_power  		; power-down light sensor
+	return
+
+; -----------------------------
+; TFT boot
+; -----------------------------
+    global  TFT_boot
+TFT_boot:
+	clrf	PORTA
+	clrf	PORTH
+	RD_L	; LOW
+	bcf		tft_nwr
+	nop
+	bcf		tft_cs
+	nop
+	bcf		tft_nreset
+	WAITMS	d'1'
+	bcf		tft_power				; inverted...
+	WAITMS	d'1'
+
+	RD_H	; Keep high
+	WR_H	;
+	NCS_L	; Not CS
+
+	WAITMS	d'2'
+	bsf		tft_nreset
+	WAITMS	d'150'
+	bsf		lightsen_power  		; Supply power to light sensor
+
+; Data Transfer Synchronization
+	Parameter_out 0x00, 0x00
+	Parameter_out 0x00, 0x00
+
+; Init through config table...
+    movlw   LOW     display0_config_table
+    movwf   TBLPTRL
+    movlw   HIGH    display0_config_table
+    movwf   TBLPTRH
+    movlw   UPPER   display0_config_table
+    movwf   TBLPTRU
+    rcall   display0_init_loop
+
+	Index_out 0x22
+;	WAITMS	d'81'					; 46
+	call	TFT_ClearScreen
+	Index_out 0x07
+	Parameter_out 0x01, 0x00
+	return
+
+
+display0_config_table:
+    ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end
+    db  0xA4,0x00,0x01,0xFF,.002,0x00
+    db  0x09,0x00,0x01,0x92,0x04,0x00
+    db  0x93,0x04,0x02,0x94,0x00,0x02
+    db  0x07,0x00,0x00,0x10,0x04,0x30
+    db  0x11,0x02,0x37,0x12,0x11,0x8D
+    db  0x13,0x11,0x00,0x01,0x01,0x00
+    db  0x02,0x02,0x00,0x03,0x50,0x20
+    db  0x0A,0x00,0x08,0x0D,0x00,0x00
+    db  0x0E,0x00,0x30,0xFF,.151,0x00
+    db  0x12,0x11,0xBD,0x20,0x00,0x00
+    db  0x21,0x00,0x00,0x30,0x06,0x02
+    db  0x31,0x56,0x0D,0x32,0x05,0x07
+    db  0x33,0x06,0x09,0x34,0x00,0x00
+    db  0x35,0x09,0x06,0x36,0x57,0x05
+    db  0x37,0x0D,0x06,0x38,0x02,0x06
+    db  0x39,0x00,0x00,0xFF,0x00,0x00
+
+display0_init_loop:
+    TBLRD*+
+    movlw   0xFF
+    cpfseq  TABLAT
+    bra     display0_config_write    ; Write Config pair to Display
+    ; Delay ms or quit (return)
+    TBLRD*+
+    tstfsz  TABLAT                  ; End of config?
+    bra     $+4                     ; No
+    return                          ; Done.
+    movf    TABLAT,W
+    call    WAITMSX                 ; Wait WREG milliseconds
+    TBLRD*+                         ; Dummy read (Third byte of delay command)
+    bra     display0_init_loop      ; Loop
+
+display0_config_write:              ; With command in WREG
+    movf    TABLAT,W
+    rcall   TFT_CmdWrite            ; Write command
+    TBLRD*+                         ; Get config0
+    movff   TABLAT,PORTA
+    TBLRD*+                         ; Get config1
+    movf    TABLAT,W
+    rcall   TFT_DataWrite           ; Write config
+    bra     display0_init_loop      ; Loop
+
+
+;=============================================================================
+; Smooth lighting-up of the display:
+;
+; Trashes: WREG, PRODL
+; Typical usage:
+;    clrf    CCPR1L            ; Backlight off
+;   [draw splash screen]
+;   call     TFT_DisplayFadeIn
+;
+        global  TFT_Display_FadeIn
+TFT_Display_FadeIn:
+    	movlw	CCP1CON_VALUE			; See ostc3.inc
+        movwf	CCP1CON
+		bsf		tft_is_dimming	; TFT is dimming, ignore ambient sensor!
+        clrf    CCPR1L          ; Backlight off - to be sure
+		movff	max_CCPR1L,PRODL
+TFT_Display_FadeIn_0:
+        incf    CCPR1L,F        ; Duty cycle
+        WAITMS  d'2'
+        decfsz  PRODL,F
+        bra     TFT_Display_FadeIn_0 
+		bcf		tft_is_dimming	; dimming done.
+        return
+
+;=============================================================================
+; Smooth lighting-off of the display:
+; Trashes: WREG, PRODL
+        global  TFT_Display_FadeOut
+TFT_Display_FadeOut:
+		movff	max_CCPR1L,PRODL
+		bsf		tft_is_dimming	; TFT is dimming, ignore ambient sensor!
+TFT_Display_FadeOut_0:
+        movff   PRODL,CCPR1L    ; Duty cycle
+        WAITMS  d'1'
+        decfsz  PRODL,F
+        bra     TFT_Display_FadeOut_0 
+        clrf    CCPR1L
+        return
+
+;=============================================================================
+
+start_common:
+        VARARGS_BEGIN
+            VARARGS_GET8    win_leftx2
+            VARARGS_GET8    win_top
+        VARARGS_END
+        return
+
+;=============================================================================
+
+        global  box_std_block, box_black_block, box_color_block
+
+box_std_block:                          ; Use white color
+        setf    WREG
+        bra     box_common
+box_black_block:                        ; Use black color
+        clrf    WREG
+box_common:
+box_color_block:
+        rcall   TFT_set_color
+        VARARGS_BEGIN
+            VARARGS_GET8    win_top
+            VARARGS_GET8    win_height
+            VARARGS_GET8    win_leftx2
+            VARARGS_GET8    win_width
+        VARARGS_END
+        bra    TFT_box
+
+;-----------------------------------------------------------------------------
+
+        global  box_frame_std, box_frame_common, box_frame_color, box_frame_color16
+
+box_frame_std:
+        setf    WREG
+        rcall   TFT_set_color
+
+box_frame_common:
+        VARARGS_BEGIN
+            VARARGS_GET8    win_top
+            VARARGS_GET8    win_height
+            VARARGS_GET8    win_leftx2
+            VARARGS_GET8    win_width
+        VARARGS_END
+        bra    TFT_frame
+
+box_frame_color:
+      	rcall	TFT_set_color
+box_frame_color16:
+		bra		box_frame_common
+
+;=============================================================================
+; Init for half_pixel_write
+; Set column register on TFT device, and current color.
+; Inputs: win_leftx2
+; Outputs: win_color:2
+; Trashed: WREG, PROD
+        global init_pixel_write
+init_pixel_write:
+        movff   win_leftx2,WREG
+        mullw   2
+        rcall   pixel_write_col320      ; Start Address Vertical (.0 - .319)
+        setf    WREG
+        bra     TFT_set_color
+
+;-----------------------------------------------------------------------------
+; Writes two half-pixels at position (win_top,win_leftx2)
+; Inputs: win_leftx2, win_top, win_color:2
+; Trashed: WREG, PROD
+    global  pixel_write
+pixel_write:
+        movff   win_leftx2,WREG
+        mullw   2						; win_leftx2 x 2 -> PRODH:PRODL
+        rcall   pixel_write_col320      ; Start Address Vertical (.0 - .319)
+        rcall   half_pixel_write        ; Write this half-one.
+
+        movff   win_leftx2,WREG         ; Address of next one
+        mullw   2
+        infsnz  PRODL                   ; +1
+        incf    PRODH
+    	rcall   pixel_write_col320
+    	bra     half_pixel_write        ; Note: Cmd 0x20 is mandatory, because
+    	                                ; of the autoincrement going vertical
+
+	global	pixel_write_col320
+pixel_write_col320:
+		Index_out 0x21					; Frame Memory Vertical Address
+		bra     TFT_DataWrite_PROD
+
+;-----------------------------------------------------------------------------
+; Writes one half-pixel at position (win_top,win_leftx2).
+; Inputs: win_leftx2, win_top, win_color:2
+; Trashed: WREG, PROD
+        global  half_pixel_write
+half_pixel_write:
+    	movff  	win_top,WREG            ; d'0' ... d'239'
+    ; Variant with Y position in WREG.
+half_pixel_write_1:
+	  	sublw   .239                    ; 239-Y --> Y
+
+    	mullw   1                       ; Copy row to PRODH:L
+		Index_out 0x20				; Frame Memory Horizontal Address
+		rcall   TFT_DataWrite_PROD
+
+		Index_out 0x22				; Frame Memory Data Write start
+		RS_H				; Data
+		movff	win_color1,PORTA		; Upper
+		movff	win_color2,PORTH		; Lower
+		WR_L
+		WR_H				; Tick
+    	return
+
+;-----------------------------------------------------------------------------
+; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height).
+; Inputs: win_leftx2, win_top, win_height, win_color:2
+; Trashed: WREG, PROD, TABLAT, TBLPTRL
+	global	half_vertical_line
+half_vertical_line:
+        clrf    TABLAT                  ; Loop index.
+
+half_vertical_line_loop:
+        movff   win_leftx2,WREG         ; Init X position.
+        mullw   2
+        movf    TABLAT,W                ; Get loop index
+        andlw   1                       ; Just low bit
+        xorwf   PRODL,F                 ; And use it to jitter current X position
+        rcall   pixel_write_col320      ; Start Address Vertical (.0 - .319)
+
+        movff   win_height,WREG         ; Index reached height (Bank0 read) ?
+        xorwf   TABLAT,W
+        btfsc   STATUS,Z                ; Equals ?
+        return                          ; Yes: done.
+        movff   win_top,WREG            ; Y = top + index (Bank0 read)
+        addwf   TABLAT,W
+        rcall   half_pixel_write_1
+        incf    TABLAT,F                ; index++
+        bra     half_vertical_line_loop
+
+;-----------------------------------------------------------------------------
+; Writes a horizontal line of half-pixel at position (win_top,win_leftx2,win_width).
+; Inputs: win_leftx2, win_top, win_width, win_color:2
+; Trashed: WREG, PROD, TABLAT, TBLPTRL
+	global	half_horizontal_line
+half_horizontal_line:
+        clrf    TABLAT                  ; Loop index.
+
+half_horizontal_line_loop:
+        movff   win_leftx2,WREG         ; Init X position.
+        mullw   2
+        rcall   pixel_write_col320      ; Start Address Vertical (.0 - .319)
+        movff   win_width,WREG          ; Index reached height (Bank0 read) ?
+        xorwf   TABLAT,W
+        btfsc   STATUS,Z                ; Equals ?
+        return                          ; Yes: done.
+        movff   win_top,WREG            ; Y = top + index (Bank0 read)
+        addwf   TABLAT,W
+        rcall   half_pixel_write_1
+        incf    TABLAT,F                ; index++
+        bra     half_horizontal_line_loop
+
+
+;-----------------------------------------------------------------------------
+; TFT Data Cmd via W
+;
+    global  TFT_DataWrite_PROD
+TFT_DataWrite_PROD:
+;	RD_H				; Keep high
+	RS_H				; Data
+	movff	PRODH,PORTA	; Move high byte to PORTA
+    movff	PRODL,PORTH	; Move low byte to PORTH
+	WR_L
+	WR_H                ; Tick
+	return
+
+TFT_DataRead_PROD:
+    Index_out 0x22                  ; Frame Memory Data Read start
+    setf    TRISA                   ; PortA as input.
+    setf    TRISH                   ; PortH as input.
+	RS_H				; Data
+	WR_H                ; Not write
+	RD_L                ; Read!
+    nop
+    nop
+    nop
+	RD_H				; Tick
+    nop
+	RD_L                ; Read!
+    nop
+    nop
+    nop
+    movff   PORTA,PRODH
+    movff   PORTH,PRODL
+	RD_H				; Tick
+    nop
+    clrf    TRISA                   ; PortA as output
+    clrf    TRISH                   ; PortH as output
+	return
+
+
+
+;=============================================================================
+; Output TFT Window Address commands.
+; Inputs : win_top, win_leftx2, win_height, win_width.
+; Output : PortA/PortH commands.
+; Trashed: PROD
+;
+        global  TFT_box_write
+TFT_box_write:
+		movff	win_leftx2,WREG         ; Compute left = 2*leftx2 --> PROD
+		mullw	2
+
+        ;---- Normal horizontal window ---------------------------------------
+        ; Output 0x35 left,
+        ;        0x36 right ==  left + width - 1.
+
+		Index_out 0x52				; Window Vertical Start Address
+		rcall   TFT_DataWrite_PROD          ; Output left
+		Index_out 0x21				; Frame Memory Vertical Address
+		rcall   TFT_DataWrite_PROD			; Output left
+
+		movff	win_width+0,WREG	    ; right = left + width - 1
+		addwf	PRODL,F
+		movff	win_width+1,WREG
+		addwfc	PRODH,F
+		decf	PRODL,F			    ; decrement result
+		btfss   STATUS,C
+		decf	PRODH,F
+
+		Index_out 0x53				; Window Vertical End Address
+		rcall   TFT_DataWrite_PROD
+
+        ;---- Flipped vertical window ----------------------------------------
+        ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height
+        ;             flipped(top)    = 239-top
+TFT_box_flip_V:
+		movff   win_top,PRODL
+		movff   win_height,WREG
+		addwf   PRODL,W
+		sublw   .240                 ; 240 - top - height
+		movwf   PRODH                ; First byte
+
+		movf	PRODL,W
+		sublw   .239                ; 249-top
+		movwf   PRODL               ; --> second byte.
+
+		Index_out 0x50				; Window Horizontal Start Address
+		clrf	PORTA				; Upper
+		movf	PRODH,W
+		rcall	TFT_DataWrite		; Lower (and tick)
+
+		Index_out 0x51				; Window Horizontal End Address
+		clrf	PORTA				; Upper
+		movf	PRODL,W
+		rcall	TFT_DataWrite		; Lower (and tick)
+
+		Index_out 0x20				; Frame Memory Horizontal Address
+		clrf	PORTA				; Upper
+		movf	PRODL,W
+		rcall	TFT_DataWrite		; Lower (and tick)
+		return
+
+
+;=============================================================================
+; TFT_frame : draw a frame around current box with current color.
+; Inputs:  win_top, win_leftx2, win_height, win_width, win_color1, win_color2
+; Outputs: (none)
+; Trashed: WREG, PROD, aa_start:2, aa_end:2
+    global  TFT_frame
+TFT_frame:
+    movff   win_top,save_top            ; Backup everything.
+    movff   win_height,save_height
+    movff   win_leftx2,save_left
+    movff   win_width,save_width
+
+    ;---- TOP line -----------------------------------------------------------
+    movlw   1                           ; row ~ height=1
+    movff   WREG,win_height
+    rcall   TFT_box
+
+    ;---- BOTTOM line --------------------------------------------------------
+    movff   save_top,PRODL               ; Get back top,
+    movff   save_height,WREG             ; and height
+    addwf   PRODL,W                      ; top+height
+    decf    WREG                         ; top+height-1
+    movff   WREG,win_top                 ; top+height-1 --> top
+    rcall   TFT_box                        
+
+    ;---- LEFT column --------------------------------------------------------
+    movff   save_top,win_top             ; Restore top/height.
+    movff   save_height,win_height
+    movlw   1                               ; column ~ width=1
+    movff   WREG,win_width
+    rcall   TFT_box
+
+    ;---- RIGHT column -------------------------------------------------------
+    movff   save_left,WREG
+    movff   save_width,PRODL
+    addwf   PRODL,W
+    decf    WREG
+    movff   WREG,win_leftx2
+    rcall     TFT_box
+    
+    ;---- Restore everything -------------------------------------------------
+    movff   save_left,win_leftx2
+    movff   save_width,win_width
+    return
+
+;=============================================================================
+; TFT_box : fills current box with current color.
+; Inputs:  win_top, win_leftx2, win_height, win_width, win_color1, win_color2
+; Outputs: (none)
+; Trashed: WREG, PROD
+    global  TFT_box
+
+TFT_box:
+    ;---- Define Window ------------------------------------------------------
+	movf	win_width,W
+	bcf     STATUS,C
+	rlcf    WREG
+	movwf   win_width+0
+	movlw   0
+	rlcf    WREG
+	movwf   win_width+1
+	rcall   TFT_box_write
+
+    rrcf    win_width+1,W               ; width /= 2
+    rrcf    win_width+0,W
+    movwf   win_width
+
+    ;---- Fill Window --------------------------------------------------------
+	Index_out 0x22						; Frame Memory Data Write start
+
+	clrf	PRODH                       ; Column counter.
+	RS_H				; Data
+
+TFT_box2:                              ; Loop height times
+	movff	win_height,PRODL
+
+TFT_box3:                              ; loop width times
+	movff	win_color1,PORTA			; Upper
+	movff	win_color2,PORTH			; Lower
+	WR_L
+	WR_H				; Tick
+
+	movff	win_color1,PORTA			; Upper
+	movff	win_color2,PORTH			; Lower
+	WR_L
+	WR_H				; Tick
+
+	decfsz	PRODL,F                     ; row loop finished ?
+	bra		TFT_box3                   ; No: continue.
+
+    incf    PRODH,F                     ; column count ++
+
+    movff   win_bargraph,WREG           ; current column == bargraph ?
+    cpfseq  PRODH
+    bra     TFT_box4                   ; No: just loop.
+
+    clrf    WREG                        ; Yes: switch to black
+    movff   WREG,win_color1
+    movff   WREG,win_color2
+TFT_box4:
+
+    movff   win_width+0,WREG            ; compare ?
+    xorwf   PRODH,W
+    bnz     TFT_box2                    ; Loop not finished.
+
+	movlw	0x00                        ; NOP, to stop window mode
+	rcall   TFT_CmdWrite
+
+	setf    WREG                        ; Reset bargraph mode...
+	movff   WREG,win_bargraph
+
+	return
+
+;=============================================================================
+;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB'
+    global  TFT_set_color
+
+TFT_set_color:
+	movwf	tft_temp1				; Get 8Bit RGB b'RRRGGGBB'
+	movwf   tft_temp2               ; Copy
+
+	; Mask Bit 7,6,5,4,3,2
+	movlw	b'00000011'
+	andwf	tft_temp2,F
+
+	movlw	b'00000000'
+	dcfsnz	tft_temp2,F
+	movlw	b'01010000'
+	dcfsnz	tft_temp2,F
+	movlw	b'10100000'
+	dcfsnz	tft_temp2,F
+	movlw	b'11111000'
+	movwf	tft_temp3				; Blue done.
+
+	movff	tft_temp1,	tft_temp2	; Copy
+	; Mask Bit 7,6,5,1,0
+	movlw	b'00011100'
+	andwf	tft_temp2,F
+	rrncf	tft_temp2,F
+	rrncf	tft_temp2,F
+
+	movlw	b'00000000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00000100'
+	dcfsnz	tft_temp2,F
+	movlw	b'00001000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00001100'
+	dcfsnz	tft_temp2,F
+	movlw	b'00010000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00010100'
+	dcfsnz	tft_temp2,F
+	movlw	b'00100000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00111111'
+	movwf	tft_temp4			
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp3,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp3,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp3,F		; tft_temp3 (b'GGGBBBBB') done.
+
+	movff	tft_temp1,	tft_temp2	; Copy
+	clrf	tft_temp1
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F		; Green done.
+
+	; Mask Bit 4,3,2,1,0
+	movlw	b'11100000'
+	andwf	tft_temp2,F
+
+	rrncf	tft_temp2,F
+	rrncf	tft_temp2,F
+	rrncf	tft_temp2,F
+	rrncf	tft_temp2,F
+	rrncf	tft_temp2,F
+
+	movlw	b'00000000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00000100'
+	dcfsnz	tft_temp2,F
+	movlw	b'00001000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00001100'
+	dcfsnz	tft_temp2,F
+	movlw	b'00010000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00010100'
+	dcfsnz	tft_temp2,F
+	movlw	b'00100000'
+	dcfsnz	tft_temp2,F
+	movlw	b'00111111'
+	movwf	tft_temp4			
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F	
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F
+
+	rrcf	tft_temp4,F
+	rrcf	tft_temp1,F		; Red done.
+
+	movff	tft_temp1,win_color1
+	movff	tft_temp3,win_color2	; Set Bank0 Color registers...
+	return
+
+;=============================================================================
+; Dump screen contents to the UART
+
+    global  TFT_dump_screen
+TFT_dump_screen:
+    bsf         no_sensor_int
+	movlw	    'l'
+	movwf	    TXREG                   ; Send command echo.
+    call		rs232_wait_tx           ; wait for UART
+    ;---- Send DISPLAY box command for the full screen window -------------------
+	Index_out 0x50				; Window Horizontal Start Address
+	Parameter_out 0x00, 0x00	; 0-239
+	Index_out 0x51				; Window Horizontal End Address
+	Parameter_out 0x00, 0xEF	; 0-239
+	Index_out 0x52				; Window Vertical Start Address
+	Parameter_out 0x00, 0x00	; 0-319
+	Index_out 0x53				; Window Vertical End Address
+	Parameter_out 0x01, 0x3F	; 0-319
+
+    clrf        ds_column
+    rcall       dump_screen_pixel_reset
+dump_screen_1:
+    btg         LEDr                 ; LED activity toggle
+    ; Dump even column
+	movlw	    .240                 ; 240 lines, once.
+	movwf	    ds_line
+dump_screen_2:
+	Index_out   0x20				; Frame Memory Horizontal Address
+    movff       ds_line,WREG        ; d'0' ... d'239'
+   	mullw       1                   ; Copy row to PRODH:L
+	rcall       TFT_DataWrite_PROD
+
+    movff       ds_column,WREG     ; Init X position.
+    mullw       2
+    rcall       pixel_write_col320  ; Start Address Vertical (.0 - .319)
+
+    rcall       TFT_DataRead_PROD      ; read pixel
+    rcall       dump_screen_pixel
+
+    decfsz	    ds_line,F
+    bra		    dump_screen_2
+    rcall       dump_screen_pixel_flush
+
+    ; Dump odd column
+	movlw	    .240                    ; 240 lines, twice.
+	movwf	    ds_line
+dump_screen_3:
+	Index_out   0x20				; Frame Memory Horizontal Address
+    movff   	ds_line,WREG        ; d'0' ... d'239'
+   	mullw       1                   ; Copy row to PRODH:L
+	rcall       TFT_DataWrite_PROD
+
+    movff       ds_column,WREG     ; Init X position.
+    mullw       2
+    movlw       .1
+    addwf       PRODL,F
+    movlw       0
+    addwfc      PRODH,F             ; +1
+    rcall       pixel_write_col320  ; Start Address Vertical (.0 - .319)
+
+    rcall       TFT_DataRead_PROD      ; read pixel
+    rcall       dump_screen_pixel
+
+    decfsz	    ds_line,F
+    bra		    dump_screen_3
+    rcall       dump_screen_pixel_flush
+
+    incf        ds_column,F
+    movlw       .160
+    cpfseq      ds_column
+    bra		    dump_screen_1
+
+    bcf         no_sensor_int
+    clrf        RCREG1              ; Clear receive buffer
+	bcf         RCSTA1,CREN         ; Clear receiver status
+	bsf         RCSTA1,CREN
+    bsf         enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump)
+    return
+
+
+;=============================================================================
+; Pixel compression
+;
+; Input: PRODH:L = pixel.
+; Output: Compressed stream on output.
+; Compressed format:
+;       0ccccccc    : BLACK pixel, repeated ccccccc+1 times (1..128).
+;       11cccccc    : WHITE pixel, repeated cccccc+1 times (1..64).
+;       10cccccc HIGH LOW : color pixel (H:L) repeated ccccc+1 times (1..64).
+;
+dump_screen_pixel:
+    movf        PRODH,W                 ; Compare pixel-high
+    xorwf       ds_pixel+1,W
+    bnz         dump_screen_pixel_1     ; Different -> dump.
+
+    movf        PRODL,W                 ; Compare pixel-low
+    xorwf       ds_pixel+0,W
+    bnz         dump_screen_pixel_1     ; Different -> dump.
+
+    incf        ds_count,F              ; Same color: just increment.
+    return
+
+dump_screen_pixel_1:                    ; Send (pixel,count) tuple
+    movf        ds_count,W              ; Is count zero ?
+    bz          dump_screen_pixel_2     ; Yes: skip sending.
+
+    movf        ds_pixel+1,W            ; This is a BLACK pixel ?
+    iorwf       ds_pixel+0,W    
+    bz          dump_screen_pix_black   ; YES.
+
+    movf        ds_pixel+1,W            ; This is a white pixel ?
+    andwf       ds_pixel+0,W
+    incf        WREG
+    bz          dump_screen_pix_white   ; YES.
+
+    ; No: write the pixel itself...
+    movlw       .64                     ; Max color pixel on a single byte.
+    cpfsgt      ds_count                ; Skip if count > 64
+    movf        ds_count,W              ; W <- min(64,count)
+    subwf       ds_count,F              ; ds_count <- ds_count-W
+    decf        WREG                    ; Save as 0..63
+    iorlw       b'10000000'             ; MARK as a color pixel.
+
+    movwf       TXREG
+    call		rs232_wait_tx           ; wait for UART
+    movff       ds_pixel+1,TXREG
+    call		rs232_wait_tx           ; wait for UART
+    movff       ds_pixel+0,TXREG
+    call		rs232_wait_tx           ; wait for UART
+    bra         dump_screen_pixel_1
+
+dump_screen_pixel_2:
+    movff       PRODH,ds_pixel+1        ; Save new pixel color
+    movff       PRODL,ds_pixel+0
+    movlw       1
+    movwf       ds_count                ; And set count=1.
+    return
+
+dump_screen_pix_black:
+    movlw       .128                    ; Max black pixel on a single byte.
+    cpfsgt      ds_count                ; Skip if count > 128
+    movf        ds_count,W              ; W <- min(128,count)
+    subwf       ds_count,F              ; ds_count <- ds_count-W
+    decf        WREG                    ; Save as 0..127
+dump_screen_pix_3:
+    movwf       TXREG
+    call        rs232_wait_tx
+    bra         dump_screen_pixel_1     ; More to dump ?
+
+dump_screen_pix_white:
+    movlw       .64                     ; Max white pixel on a single byte.
+    cpfsgt      ds_count                ; Skip if count > 64
+    movf        ds_count,W              ; W <- min(64,count)
+    subwf       ds_count,F              ; ds_count <- ds_count-W
+    decf        WREG                    ; Save as 0..63
+    iorlw       b'11000000'             ; MARK as a compressed white.
+    bra         dump_screen_pix_3
+
+dump_screen_pixel_flush:
+    clrf        PRODH
+    clrf        PRODL
+    rcall       dump_screen_pixel_1     ; Send it
+dump_screen_pixel_reset:
+    clrf        ds_count                ; But clear count.
+    return
+
+    end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tft.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,229 @@
+;=============================================================================
+;
+;   File tft.inc
+;
+;   Declaring interfaces to the TFT screen and its Oxxx controler
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-05-24 : [jDG] Cleanups from initial Matthias code.
+
+;=============================================================================
+; TFT public subroutines
+;=============================================================================
+
+; Writes two half-pixels at position (win_top,win_leftx2)
+; Inputs: win_leftx2, win_top, win_color:2
+; Trashed: WREG, PROD
+    extern  pixel_write
+
+;-----------------------------------------------------------------------------
+; Writes one half-pixel at position (win_top,win_leftx2).
+; Inputs: win_leftx2, win_top, win_color:2
+; Trashed: WREG, PROD
+    extern  half_pixel_write
+
+;-----------------------------------------------------------------------------
+; TFT_frame : draw a frame around current box with current color.
+; Inputs:  win_top, win_leftx2, win_height, win_width, win_color1, win_color2
+; Outputs: (none)
+; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1
+    extern  TFT_frame
+
+;-----------------------------------------------------------------------------
+	extern	TFT_DisplayOff              ; Power-off everything (need a boot next)
+    extern  TFT_boot                    ; Initialize screen hardware
+    extern  TFT_Display_FadeIn          ; Smooth lighting
+    extern  TFT_Display_FadeOut         ; Smooth darkening
+    extern  TFT_ClearScreen
+    extern  TFT_box_write
+    extern  TFT_box
+    extern  TFT_DataWrite_PROD
+    extern  TFT_set_color
+	extern	init_pixel_write
+	extern	pixel_write
+	extern	pixel_write_col320
+	extern	half_vertical_line
+	extern  half_horizontal_line
+    extern  TFT_dump_screen
+
+;-----------------------------------------------------------------------------
+; Macro to encode standard colors.
+; TODO: User preferences... Maybe.
+TFT_STD_COLOR   macro
+        setf    WREG                    ; Default to white
+        call    TFT_set_color
+        endm
+
+TFT_MASK_COLOR  macro
+        movlw   color_greenish          ; Default to OSTC mask-green
+        call    TFT_set_color
+        endm
+
+TFT_ATTENTION_COLOR  macro
+        movlw   color_yellow             ; Default to OSTC yelow
+        call    TFT_set_color
+        endm
+
+TFT_WARNINGS_COLOR  macro
+        movlw   color_red                ; Default to OSTC red
+        call    TFT_set_color
+        endm
+
+;TFT_DISABLED_COLOR  macro
+;        movlw   color_grey               ; Default to OSTC grey (dark blue)
+;        call    TFT_set_color
+;        endm
+
+;=============================================================================
+; Low level macros (for aa_wordprocessor and color_processor).
+;
+            extern  TFT_CmdWrite
+Index_out	macro low_b
+			movlw low_b
+			call  TFT_CmdWrite
+			endm
+
+;=============================================================================
+; A shortcut for TFT_box and TFT_frame call sequences.
+;
+        extern  box_frame_std, box_frame_common, box_frame_color, box_frame_color16
+        extern  box_std_block, box_black_block, box_color_block
+
+; Erase a given screen area.
+WIN_BOX_BLACK macro   top, bottom, left, right
+        call    box_black_block
+        db      top, (bottom)-(top)+1, left, (right)-(left)+1
+        endm
+
+; Fill a given screen area with standard color (White).
+WIN_BOX_STD macro   top, bottom, left, right
+        call    box_std_block
+        db      top, (bottom)-(top)+1, left, (right)-(left)+1
+        endm
+
+; Fill a given screen area with color from WREG (8bits rrrgggbb)
+WIN_BOX_COLOR macro   top, bottom, left, right
+        call    box_color_block
+        db      top, (bottom)-(top)+1, left, (right)-(left)+1
+        endm
+
+; Draw a frame in standard color (White).
+WIN_FRAME_STD macro   top, bottom, left, right
+        call    box_frame_std
+        db      top, (bottom)-(top)+1, left, (right)-(left)+1
+        endm
+
+; Draw a frame with color from WREG (8bits rrrgggbb)
+WIN_FRAME_COLOR macro   top, bottom, left, right
+        call    box_frame_color
+        db      top, (bottom)-(top)+1, left, (right)-(left)+1
+        endm
+
+; Draw a frame with color from win_color (16bits in TFT format)
+WIN_FRAME_COLOR16 macro   top, bottom, left, right
+        call    box_frame_color16
+        db      top, (bottom)-(top)+1, left, (right)-(left)+1
+        endm
+
+WIN_FONT 	macro	win_font_input
+			movlw	win_font_input
+			movff	WREG,win_font
+			endm
+			
+WIN_TOP 	macro 	win_top_input
+			movlw	win_top_input
+			movff	WREG,win_top
+			endm
+
+WIN_HEIGHT 	macro 	h
+			movlw	h
+			movff	WREG,win_height
+			endm
+			
+WIN_LEFT 	macro 	win_left_input
+			movlw	win_left_input
+			movff	WREG,win_leftx2
+			endm
+			
+WIN_WIDTH 	macro 	w
+			movlw	w
+			movff	WREG,win_width
+			endm
+
+WIN_INVERT	macro 	win_invert_input
+			movlw	win_invert_input
+			movff	WREG,win_invert
+			endm
+
+WIN_COLOR	macro 	win_color_input
+			movlw	win_color_input
+			call	TFT_set_color
+			endm
+
+;=============================================================================
+; TFT_write_flash_image
+;
+; Inputs:  cx, cy : Image center (in 0..160 x 0..240 range)
+;          image  : flash image header's address
+; Outputs: win_top, win_left, win_height, win_width
+;          image copyed on screen.
+; Trashed: PROD, hi, lo
+; 
+    extern  TFT_write_flash_image
+    extern  TFT_write_flash_image_addr
+TFT_WRITE_FLASH_IMAGE macro cx, cy, image
+    If LOW(image) != 0
+        Error "Image "image" mis-aligned"
+    Endif
+    If (UPPER(image) & 0xF0) != 0x30
+        Error "Image "image" not in image flash memory"
+    Endif
+    If (cx < 0) || (cx > 160)
+        Error "Image center's X "cx" not in 0..160 range".
+    Endif
+    If (cy < 0) || (cy > 240)
+        Error "Image center's Y "cy" not in 0..240 range".
+    Endif
+            ; Once we know image is aligned, we can use the compact (4bytes)
+            ; 12bit registers to pass the address:
+            lfsr    FSR2, ((image)>>8) & 0xFFF
+            WIN_LEFT    cx
+            WIN_TOP     cy
+            call    TFT_write_flash_image
+            endm
+
+;=============================================================================
+; TFT_write_prom_image
+;
+TFT_WRITE_PROM_IMAGE    macro   icon
+            extern  icon, color_image
+            movlw   LOW(icon)
+            movwf   TBLPTRL
+            movlw   HIGH(icon)
+            movwf   TBLPTRH
+            movlw   UPPER(icon)
+            movwf   TBLPTRU
+            call    color_image
+            endm
+
+;=============================================================================
+; Macro to provides our own interface code.
+;
+PIXEL_WRITE macro   colRegister, rowRegister
+        movff   colRegister,win_leftx2
+        movff   rowRegister,win_top
+        call    pixel_write
+        endm
+
+INIT_PIXEL_WROTE macro colRegister
+        movff   colRegister,win_leftx2
+        call    init_pixel_write
+        endm
+
+HALF_PIXEL_WRITE macro rowRegister
+        movff   rowRegister,win_top
+        call    half_pixel_write
+        endm
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tft_outputs.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,2930 @@
+;=============================================================================
+;
+;   File tft_outputs.asm
+;
+;   Startup subroutines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-07 : [mH] moving from OSTC code
+
+#include    "ostc3.inc"                  ; Mandatory header
+#include 	"shared_definitions.h"      ; Mailbox from/to p2_deco.c
+#include 	"tft.inc"
+#include 	"wait.inc"
+#include 	"strings.inc"
+#include	"convert.inc"
+#include 	"varargs.inc"
+#include	"math.inc"
+#include	"isr.inc"
+#include	"eeprom_rs232.inc"
+#include	"adc_lightsensor.inc"
+#include	"surfmode.inc"
+#include	"divemode.inc"
+#include    "external_flash.inc"
+#include	"ghostwriter.inc"
+#include    "customview.inc"
+#include    "i2c.inc"
+
+	extern	aa_wordprocessor
+
+;=============================================================================
+
+gui    CODE
+;=============================================================================
+
+    global   TFT_divemask_color
+TFT_divemask_color:
+    movlw   color_green         ; TODO
+	bra		TFT_standard_color0
+
+    global  TFT_warnings_color
+TFT_warnings_color:
+    movlw   color_red           ; TODO
+	bra		TFT_standard_color0
+
+    global  TFT_disabled_color
+TFT_disabled_color:
+    movlw   color_grey          ; Default to OSTC grey (dark blue)
+    bra		TFT_standard_color0
+
+    global  TFT_standard_color
+TFT_standard_color:
+    setf    WREG                ; TODO...
+TFT_standard_color0:
+	call	TFT_set_color
+	return
+
+TFT_color_code macro color_code_temp
+	movlw	color_code_temp
+	call	TFT_color_code1
+	endm
+	
+	global	TFT_color_code1
+TFT_color_code1:				; Color-codes the output, if required
+	dcfsnz	WREG
+	bra		TFT_color_code_depth		; depth_warn_mbar [mbar], 16Bit
+	dcfsnz	WREG
+	bra		TFT_color_code_cns			; color_code_cns_high [%]
+	dcfsnz	WREG
+	bra		TFT_color_code_gf			; color_code_gf_warn_high [%]
+	dcfsnz	WREG
+	bra		TFT_color_code_ppo2         ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold
+	dcfsnz	WREG
+	bra		TFT_color_code_velocity     ; color_code_velocity_warn_high [m/min]
+	dcfsnz	WREG
+	bra		TFT_color_code_ceiling		; Show warning if current depth>shown ceiling
+	dcfsnz	WREG
+	bra		TFT_color_code_gaslist		; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold
+    dcfsnz	WREG
+    bra     TFT_color_code_ppo2_hud     ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold
+    dcfsnz	WREG
+    bra     TFT_color_code_battery      ; Color-code the battery display
+
+TFT_color_code_gaslist:				; %O2 in hi
+; Check very high ppO2 manually
+    SAFE_2BYTE_COPY amb_pressure,xA
+	movlw		d'10'
+	movwf		xB+0
+	clrf		xB+1
+	call		div16x16				; xC=p_amb/10
+	movff		xC+0,xA+0
+	movff		xC+1,xA+1
+	movff		hi,xB+0
+	clrf		xB+1
+	call		mult16x16                   ; lo * p_amb/10
+; Check if ppO2>6,55bar
+	tstfsz		xC+2						; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
+	bra			TFT_color_code_warn     	; Yes, warn in warning color
+; Check if ppO2>3,30bar
+	btfsc		xC+1,7
+	bra			TFT_color_code_warn         ; Yes, warn in warning color
+
+; Check for low ppo2
+	movff       xC+0,sub_a+0
+	movff       xC+1,sub_a+1
+    movff       opt_ppO2_min,WREG
+	mullw       d'100'                  ; opt_ppO2_min*100
+	movff       PRODL,sub_b+0
+	movff       PRODH,sub_b+1
+	call        subU16
+	btfsc       neg_flag
+    bra			TFT_color_code_warn     ; too low -> Warning Color!
+
+; Check for high ppo2
+	movff		opt_ppO2_max,WREG		; PPO2 Max for MOD calculation and color coding in divemode
+	mullw		d'100'					; opt_ppO2_max*100
+	movff		PRODL,sub_b+0
+	movff		PRODH,sub_b+1
+	call		subU16					;  sub_c = sub_a - sub_b	
+	btfss		neg_flag
+	bra			TFT_color_code_warn     ; too high -> Warning Color!
+	return
+
+TFT_color_code_warn:
+	call		TFT_warnings_color
+	return
+
+TFT_color_code_ceiling:
+    SAFE_2BYTE_COPY rel_pressure, lo
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+	movff	hi,xA+1
+	movff	lo,xA+0
+	movff	char_O_first_deco_depth,lo  ; Ceiling in m
+	decf	lo,F	                    ; -1
+	movlw	LOW		d'100'
+	movwf	xB+0
+	clrf	xB+1						; Devide/100 -> xC+0 = Depth in m
+	call	div16x16					; xA/xB=xC with xA as remainder 	
+	movf	xC+0,W						; Depth in m
+	subwf	lo,W
+	btfsc	STATUS,C
+	bra		TFT_color_code_warn     	; Set to warning color
+	call	TFT_standard_color
+	return
+
+TFT_color_code_depth:
+	movff	hi,hi_temp
+	movff	lo,lo_temp
+    SAFE_2BYTE_COPY rel_pressure, lo
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+	movff	lo,sub_a+0
+	movff	hi,sub_a+1
+	movlw	LOW		depth_warn_mbar
+	movwf	lo
+	movlw	HIGH	depth_warn_mbar
+	movwf	hi
+	movff	lo,sub_b+0
+	movff	hi,sub_b+1
+	movff	hi_temp,hi
+	movff	lo_temp,lo			; Restore hi, lo
+	call	subU16			;  sub_c = sub_a - sub_b
+	btfss	neg_flag
+	bra		TFT_color_code_warn ; Set to warning color
+	call	TFT_standard_color
+	return
+
+TFT_color_code_cns:
+    movff   int_O_CNS_fraction+1,lo		; copy into bank1
+    tstfsz  lo                          ; >255% ?
+    bra     TFT_color_code_warn         ; Yes
+	movff	int_O_CNS_fraction+0,lo
+	movlw	color_code_cns_high		; CNS Warn [%]
+	subwf	lo,W
+	btfsc	STATUS,C
+	bra		TFT_color_code_warn		; Set to warning color
+	call	TFT_standard_color
+	return
+
+TFT_color_code_gf:
+	movff	char_O_gradient_factor,lo		; gradient factor
+	movlw	color_code_gf_warn_high 	; GF Warn [%]
+	subwf	lo,W
+	btfsc	STATUS,C
+	bra		TFT_color_code_warn         ; Set to warning color
+	call	TFT_standard_color
+	return
+
+TFT_color_code_ppo2:
+; Check if ppO2>6,55bar
+	tstfsz	xC+2					; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
+	bra		TFT_color_code_warn     ; Yes, warn in warning color
+; Check if ppO2>3,30bar
+	btfsc	xC+1,7
+	bra		TFT_color_code_warn     ; Yes, warn in warning color
+
+	movff	xC+0,sub_a+0
+	movff	xC+1,sub_a+1
+	movff	opt_ppO2_max,WREG		; PPO2 Max for MOD calculation and color coding in divemode
+	mullw	d'100'
+	movff	PRODL,sub_b+0
+	movff	PRODH,sub_b+1
+	call	subU16			  		; sub_c = sub_a - sub_b
+	btfss	neg_flag
+	bra		TFT_color_code_warn     ; Set to warning color
+
+	movff	xC+0,sub_a+0
+	movff	xC+1,sub_a+1
+	movff	opt_ppO2_min,WREG		; PPO2 min for Sensors and color coding in divemode
+	mullw	d'100'
+	movff	PRODL,sub_b+0
+	movff	PRODH,sub_b+1
+	call	subU16			  		; sub_c = sub_a - sub_b
+	btfsc	neg_flag
+	bra		TFT_color_code_warn     ; Set to warning color
+	call	TFT_standard_color
+	return
+
+TFT_color_code_velocity:
+	btfss	neg_flag                        ; Ignore for descend!
+	bra		TFT_color_code_velocity1		; Skip check!
+	movff	divA+0,lo
+	movlw	color_code_velocity_warn_high	; Velocity warn [m/min]
+	subwf	lo,W
+	btfsc	STATUS,C
+	bra		TFT_color_code_warn             ; Set to warning color
+TFT_color_code_velocity1:
+	call	TFT_standard_color
+	return
+
+TFT_color_code_ppo2_hud:            ; With ppO2 [cbar] in lo
+	movff	opt_ppO2_max,WREG		; PPO2 Max for MOD calculation and color coding in divemode
+    cpfsgt  lo                      ; lo > opt_ppO2_max?
+    bra     TFT_color_code_ppo2_hud1; No
+    bra     TFT_color_code_warn     ; Yes
+TFT_color_code_ppo2_hud1:
+	movff	opt_ppO2_min,WREG		; PPO2 min for Sensors and color coding in divemode
+    cpfslt  lo                      ; lo < opt_ppO2_min?
+    bra     TFT_color_code_ppo2_hud2; No
+    bra     TFT_color_code_warn     ; Yes
+TFT_color_code_ppo2_hud2:
+    call	TFT_standard_color
+    return
+
+TFT_color_code_battery:             ; With battery percent in lo
+    movlw   color_code_battery_low
+    cpfsgt  lo                      ; lo < color_code_battery_low ?
+    bra     TFT_color_code_warn     ; No
+    call	TFT_standard_color
+    return
+
+; ****************************************************************************
+
+	global	TFT_divemode_mask
+TFT_divemode_mask:					; Displays mask in Dive-Mode
+    call    TFT_divemask_color
+    WIN_TINY  divemode_mask_depth_column,divemode_mask_depth_row
+    lfsr	FSR2,buffer
+    STRCAT_TEXT_PRINT	tDepth
+    WIN_TINY  divemode_mask_maxdepth_column,divemode_mask_maxdepth_row
+    lfsr	FSR2,buffer
+    STRCAT_TEXT_PRINT	tMaxDepth
+    WIN_TINY  divemode_mask_divetime_column,divemode_mask_divetime_row
+    lfsr	FSR2,buffer
+    STRCAT_TEXT_PRINT	tDivetime
+    
+    call	TFT_standard_color
+	return
+
+	global	TFT_clear_customview_divemode
+TFT_clear_customview_divemode:
+    WIN_BOX_BLACK    divemode_customview_row, .163, .0, .159	; top, bottom, left, right
+	return
+
+	global	TFT_display_velocity
+TFT_display_velocity:						; With divA+0 = m/min
+	TFT_color_code	warn_velocity	    	; Color-code Output (With divA+0 = m/min)
+	WIN_SMALL	velocity_text_column,velocity_text_row
+
+    TSTOSS  opt_units			; 0=Meters, 1=Feets
+	bra		TFT_display_velocity_metric
+;TFT_display_velocity_imperial:
+	lfsr	FSR2,buffer
+	movff	divA+0,WREG						; divA+0 = m/min
+	mullw	.100							; PRODL:PRODH = mbar/min
+	movff	PRODL,lo
+	movff	PRODH,hi
+	call	convert_mbar_to_feet			; convert value in lo:hi from mbar to feet
+	movlw	'-'
+	btfsc	neg_flag
+	movlw	'+'
+	movwf	POSTINC2
+	bsf		leftbind
+	output_16
+	bcf		leftbind
+	STRCAT_TEXT_PRINT  tVelImperial			; Unit switch
+	call	TFT_standard_color
+    return
+
+TFT_display_velocity_metric:
+	lfsr	FSR2,buffer
+	movff	divA+0,lo						; divA+0 = m/min
+	movlw	'-'
+	btfsc	neg_flag
+	movlw	'+'
+	movwf	POSTINC2
+	output_99
+	STRCAT_TEXT_PRINT  tVelMetric			; Unit switch
+	call	TFT_standard_color
+    return
+
+	global	TFT_display_velocity_clear
+TFT_display_velocity_clear:
+	; Clear Text
+	WIN_BOX_BLACK   velocity_text_row, velocity_text_row+.22, velocity_text_column, (velocity_text_column+.7*.8)-1	; top, bottom, left, right
+	return
+
+TFT_clear_decoarea:
+    WIN_BOX_BLACK   decostop_1st_stop_row, .239, decostop_1st_stop_column ,.159	; top, bottom, left, right
+	return
+
+    global  TFT_clear_divemode_menu
+TFT_clear_divemode_menu:
+    WIN_BOX_BLACK   divemode_menu_row, divemode_menu_lower, divemode_menu_left ,divemode_menu_right	; top, bottom, left, right
+	return
+
+	global	TFT_display_ndl_mask
+TFT_display_ndl_mask:
+    btfsc   divemode_menu               ; Is the dive mode menu shown?
+    return                              ; Yes, return
+	rcall	TFT_clear_decoarea			; Clear Dekostop and Dekosum
+    call    TFT_divemask_color
+   	WIN_STD 	ndl_text_column,ndl_text_row
+	STRCPY_TEXT_PRINT  tNDL             ; NDL
+	call	TFT_standard_color
+	return
+
+	global	TFT_show_TTS_divemode
+TFT_show_TTS_divemode:
+    btfsc   divemode_menu               ; Is the dive mode menu shown?
+    return                              ; Yes, return
+	call	TFT_standard_color
+	movff	int_O_ascenttime+0,lo       ; TTS
+	movff	int_O_ascenttime+1,hi       ; on 16bits
+	WIN_MEDIUM  tts_value_column,tts_value_row
+	lfsr	FSR2,buffer
+	output_16_3					;Displays only 0...999
+	STRCAT_PRINT "'"
+	return
+
+	global	TFT_display_ndl
+TFT_display_ndl:
+    btfsc   divemode_menu               ; Is the dive mode menu shown?
+    return                              ; Yes, return
+	WIN_MEDIUM	ndl_value_column,ndl_value_row
+	lfsr	FSR2,buffer
+	call	TFT_standard_color
+	movff	char_O_nullzeit,lo		; Get NDL from C-code
+	output_8
+	STRCAT_PRINT "'"
+	return
+
+	global	TFT_divemode_warning
+TFT_divemode_warning:
+    bsf     dive_warning_displayed              ; =1: The warning sign is shown
+    WIN_TOP  	warning_icon_row
+	WIN_LEFT 	warning_icon_column
+    TFT_WRITE_PROM_IMAGE dive_warning_block 	; Show Warning icon
+;    movlw   .3
+;    cpfslt  warning_counter                     ; More then two warnings?
+;    rcall   TFT_divemode_warning_counter        ; Yes, show the number
+	return
+
+;TFT_divemode_warning_counter:
+;    WIN_SMALL	warning_icon_column+.8,warning_icon_row+.13
+;	lfsr	FSR2,buffer
+;    call	TFT_warnings_color
+;    movff   warning_counter,lo
+;    bsf     leftbind
+;	output_8
+;    bcf     leftbind
+;	STRCAT_PRINT ""
+;	call	TFT_standard_color
+;	return
+
+	global	TFT_divemode_warning_clear
+TFT_divemode_warning_clear:
+    btfss   dive_warning_displayed              ; =1: The warning sign is shown
+    return
+    bcf     dive_warning_displayed              ; clear only once
+	WIN_BOX_BLACK   warning_icon_row, warning_icon_row+.38, warning_icon_column, warning_icon_column+.21; top, bottom, left, right
+	return
+
+	global	TFT_display_deko_mask
+TFT_display_deko_mask:
+	rcall		TFT_clear_decoarea
+   	WIN_STD 	tts_text_column,tts_text_row
+    call    TFT_divemask_color
+	STRCPY_TEXT_PRINT  tTTS             ; TTS
+	call	TFT_standard_color
+    return
+
+TFT_display_deko_output_depth:		; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	TSTOSS	opt_units				; 0=m, 1=ft
+	bra		TFT_display_deko_output_metric
+;TFT_display_deko_output_imperial:
+	movf	lo,W					; lo = m
+	mullw	.100					; PRODL:PRODH = mbar
+	movff	PRODL,lo
+	movff	PRODH,hi
+; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops...
+	movff	lo,xA+0
+	movff	hi,xA+1
+	movlw	LOW 	d'334'          ; 334feet/100m
+	movwf	xB+0
+	movlw	HIGH 	d'334'
+	movwf	xB+1
+	call	mult16x16			    ; xA*xB=xC (lo:hi * 328)
+	movlw	d'50'                   ; round up
+	addwf	xC+0,F
+	movlw	0
+	addwfc	xC+1,F
+	addwfc	xC+2,F
+	addwfc	xC+3,F
+	movlw	d'100'					
+	movwf	xB+0
+	clrf	xB+1
+	call	div32x16  			    ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+	movff	xC+1,hi				    ; restore lo and hi with updated value
+	bcf		leftbind
+	bsf		ignore_digit4			; Only full feet
+	output_16
+	STRCAT_TEXT	tFeets1
+	return
+
+TFT_display_deko_output_metric:
+	output_99
+	STRCAT_TEXT	tMeters
+	PUTC	' '
+	return
+
+	global	TFT_display_deko
+TFT_display_deko:
+    btfsc   divemode_menu               ; Is the dive mode menu shown?
+    return                              ; Yes, return
+	WIN_MEDIUM	decostop_1st_stop_column,decostop_1st_stop_row
+	TFT_color_code		warn_ceiling    ; Color-code Output
+	lfsr	FSR2,buffer
+	movff	char_O_first_deco_depth,lo  ; Ceiling in m
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_first_deco_time,lo   ; length of first stop in min
+	output_99
+	STRCAT_PRINT "'"
+	call	TFT_standard_color
+    return
+
+    global  TFT_decoplan
+TFT_decoplan:
+    call    TFT_divemask_color
+    WIN_TINY    decoplan_title_column,decoplan_title_row
+    STRCPY_TEXT_PRINT tDiveDecoplan
+	call	TFT_standard_color
+
+	movff	char_O_deco_depth+1,lo
+	tstfsz	lo							; Show another stop?
+	bra		TFT_display_deko2			; Yes
+	; No, clear output and return
+	call	TFT_standard_color
+	WIN_SMALL	decostop_4th_stop_column+.16,decostop_4th_stop_row
+	STRCPY_PRINT "---"
+	WIN_BOX_BLACK   decostop_2nd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column	; top, bottom, left, right
+	WIN_BOX_BLACK   decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column	; top, bottom, left, right
+	WIN_BOX_BLACK   decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159	; top, bottom, left, right
+    return
+TFT_display_deko2:
+	WIN_SMALL	decostop_2nd_stop_column,decostop_2nd_stop_row
+	lfsr	FSR2,buffer
+	movff	char_O_deco_depth+1,lo  	; stop in m
+	bcf     lo,7                        ; Clear GAS_SWITCH bit
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_deco_time+1,lo   	; length of stop in min
+	output_99
+	STRCAT_PRINT "'"
+	movff	char_O_deco_depth+2,lo
+	tstfsz	lo							; Show another stop?
+	bra		TFT_display_deko3			; Yes
+	; No, clear output and return
+	WIN_BOX_BLACK   decostop_3rd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column	; top, bottom, left, right
+	WIN_BOX_BLACK   decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159	; top, bottom, left, right
+	return
+
+TFT_display_deko3:
+	WIN_SMALL	decostop_3rd_stop_column,decostop_3rd_stop_row
+	lfsr	FSR2,buffer
+	movff	char_O_deco_depth+2,lo  	; stop in m
+	bcf     lo,7                        ; Clear GAS_SWITCH bit
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_deco_time+2,lo   	; length of stop in min
+	output_99
+	STRCAT_PRINT "'"
+
+	movff	char_O_deco_depth+3,lo
+	tstfsz	lo							; Show another stop?
+	bra		TFT_display_deko4			; Yes
+	; No, clear output and return
+	WIN_BOX_BLACK   decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right
+	return								; Done.
+
+TFT_display_deko4:
+	WIN_SMALL	decostop_4th_stop_column,decostop_4th_stop_row
+	lfsr	FSR2,buffer
+	movff	char_O_deco_depth+3,lo  	; stop in m
+	bcf     lo,7                        ; Clear GAS_SWITCH bit
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_deco_time+3,lo   	; length of stop in min
+	output_99
+	STRCAT_PRINT "'"
+
+	movff	char_O_deco_depth+4,lo
+	tstfsz	lo							; Show another stop?
+	bra		TFT_display_deko5			; Yes
+	; No, clear output and return
+	WIN_BOX_BLACK   decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column	; top, bottom, left, right
+	WIN_BOX_BLACK   decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159                     ; top, bottom, left, right
+	return								; Done.
+
+TFT_display_deko5:
+	WIN_SMALL	decostop_5th_stop_column,decostop_5th_stop_row
+	lfsr	FSR2,buffer
+	movff	char_O_deco_depth+4,lo  	; stop in m
+	bcf     lo,7                        ; Clear GAS_SWITCH bit
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_deco_time+4,lo   	; length of stop in min
+	output_99
+	STRCAT_PRINT "'"
+	movff	char_O_deco_depth+5,lo
+	tstfsz	lo							; Show another stop?
+	bra		TFT_display_deko6			; Yes
+	; No, clear output and return
+	WIN_BOX_BLACK   decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159                     ; top, bottom, left, right
+	return								; Done.
+TFT_display_deko6:
+	WIN_SMALL	decostop_6th_stop_column,decostop_6th_stop_row
+	lfsr	FSR2,buffer
+	movff	char_O_deco_depth+5,lo  	; stop in m
+	bcf     lo,7                        ; Clear GAS_SWITCH bit
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_deco_time+5,lo   	; length of stop in min
+	output_99
+	STRCAT_PRINT "'"
+	movff	char_O_deco_depth+6,lo
+	tstfsz	lo							; Show another stop?
+	bra		TFT_display_deko7			; Yes
+	; No, clear output and return
+	WIN_BOX_BLACK   decostop_7th_stop_row, divemode_simtext_row-1, decostop_7th_stop_column, .159                     ; top, bottom, left, right
+	return								; Done.
+TFT_display_deko7:
+	WIN_SMALL	decostop_7th_stop_column,decostop_7th_stop_row
+	lfsr	FSR2,buffer
+	movff	char_O_deco_depth+6,lo  	; stop in m
+	bcf     lo,7                        ; Clear GAS_SWITCH bit
+	rcall	TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
+	movff	char_O_deco_time+6,lo   	; length of stop in min
+	output_99
+	STRCAT_PRINT "'"
+	return								; Done.
+
+;TFT_display_deko1:
+;	movff	char_O_gradient_factor,lo		; gradient factor
+;	movlw	gf_display_threshold			; threshold for display
+;	cpfslt	lo				; show value?
+;	bra		TFT_display_deko2	; Yes
+;	; No
+;	bra		TFT_display_ndl_mask2	; Clear gradient factor
+;
+
+    global  TFT_mask_avr_stopwatch             ; Show mask for average depth and stopwatch
+TFT_mask_avr_stopwatch:
+    ; The mask
+    call    TFT_divemask_color
+    WIN_TINY  dive_custom_avr_stop_column1,dive_custom_avr_stop_row
+    STRCPY_TEXT_PRINT tDiveTotalAvr
+    WIN_TINY  dive_custom_avr_stop_column2,dive_custom_avr_stop_row
+    STRCPY_TEXT_PRINT tDiveStopwatch
+    WIN_TINY  dive_custom_avr_stop_column3,dive_custom_avr_stop_row
+    STRCPY_TEXT_PRINT tDiveStopAvr
+    call	TFT_standard_color
+    return
+
+    global  TFT_update_avr_stopwatch           ; Update average depth and stopwatch
+TFT_update_avr_stopwatch:
+    call    TFT_standard_color
+    SAFE_2BYTE_COPY  average_divesecs,lo
+	call	convert_time			; lo=secs, hi=mins
+    WIN_MEDIUM  dive_avr_stop_column2,dive_avr_stop_row
+    lfsr    FSR2,buffer
+    bsf     leftbind
+	movf	hi,W
+	movff	lo,hi
+	movwf	lo					; exchange lo and hi
+	output_8
+	PUTC    ':'
+	movff	hi,lo
+	output_99x
+    movlw   .5
+    call    TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+    clrf    WREG
+    movff   WREG,buffer+.5              ; limit to 5 chars
+	STRCAT_PRINT ""
+
+    TSTOSS  opt_units   			; 0=m, 1=ft
+	bra		TFT_update_avr_stopwatch_metric
+;TFT_update_avr_stopwatch_imperial
+    movff   avr_rel_pressure_total+0,lo
+    movff   avr_rel_pressure_total+1,hi
+    call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+    call	convert_mbar_to_feet       	; convert value in lo:hi from mbar to feet
+    WIN_MEDIUM  dive_avr_stop_column1,dive_avr_stop_row
+    lfsr    FSR2,buffer
+    bsf     leftbind
+    output_16                       ; yxz
+    STRCAT_PRINT " "
+    ; Stopped average depth
+    movff   avr_rel_pressure+0,lo
+    movff   avr_rel_pressure+1,hi
+    call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+    call	convert_mbar_to_feet       	; convert value in lo:hi from mbar to feet
+    WIN_MEDIUM  dive_avr_stop_column3,dive_avr_stop_row
+    lfsr    FSR2,buffer
+    output_16                       ; yxz
+    bcf     leftbind
+    STRCAT_PRINT " "
+    return
+
+TFT_update_avr_stopwatch_metric:
+    ; Non-resettable average depth
+    movff   avr_rel_pressure_total+0,lo
+    movff   avr_rel_pressure_total+1,hi
+    call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+    WIN_MEDIUM  dive_avr_stop_column1,dive_avr_stop_row
+    lfsr    FSR2,buffer
+    bsf     ignore_digit5         ; no cm
+    output_16dp  .3               ; yxz.a
+    STRCAT_PRINT ""
+    ; Stopped average depth
+    movff   avr_rel_pressure+0,lo
+    movff   avr_rel_pressure+1,hi
+    call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+    WIN_MEDIUM  dive_avr_stop_column3,dive_avr_stop_row
+    lfsr    FSR2,buffer
+    bsf     ignore_digit5         ; no cm
+    output_16dp  .3               ; yxz.a
+    bcf     leftbind
+    bcf     ignore_digit5
+    STRCAT_PRINT ""
+    return
+
+    global  TFT_hud_mask                        ; The HUD mask
+TFT_hud_mask:
+    ; The mask
+    call    TFT_divemask_color
+    WIN_TINY  dive_custom_hud_column1,dive_custom_hud_row
+    STRCPY_TEXT_PRINT tDiveHudMask1
+    WIN_TINY  dive_custom_hud_column2,dive_custom_hud_row
+    STRCPY_TEXT_PRINT tDiveHudMask2
+    WIN_TINY  dive_custom_hud_column3,dive_custom_hud_row
+    STRCPY_TEXT_PRINT tDiveHudMask3
+    call	TFT_standard_color
+    return
+
+    global  TFT_update_hud             ; Update HUD data
+TFT_update_hud:
+    ; show three sensors
+    bsf     leftbind
+    movff   o2_ppo2_sensor1,lo
+    tstfsz  lo              ; ppO2=0 (No data/failure)?
+    bra     TFT_update_hud1 ; No
+    btfss   dive_hud1_displayed         ; Was the sensor shown?
+    bra     TFT_update_hud2             ; Yes, skip clear
+    bcf     dive_hud1_displayed         ; No, clear display flag
+    WIN_BOX_BLACK   dive_hud_data_row, dive_hud_data_row+.30, dive_hud_sensor1_column, dive_hud_sensor2_column	; top, bottom, left, right
+	WIN_STD dive_hud_sensor1_column+.7,dive_hud_data_row+.5
+   	call	TFT_standard_color
+    STRCPY_PRINT "---"
+    bra     TFT_update_hud2 ; Skip Sensor 1
+TFT_update_hud1:
+    WIN_MEDIUM dive_hud_sensor1_column,dive_hud_data_row
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+    lfsr    FSR2,buffer
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    STRCAT_PRINT ""
+    bsf     dive_hud1_displayed         ; Set display flag
+TFT_update_hud2:
+    movff   o2_ppo2_sensor2,lo
+    tstfsz  lo              ; ppO2=0 (No data/failure)?
+    bra     TFT_update_hud3 ; No
+    btfss   dive_hud2_displayed         ; Was the sensor shown?
+    bra     TFT_update_hud4             ; Yes, skip clear
+    bcf     dive_hud2_displayed         ; No, clear display flag
+    WIN_BOX_BLACK   dive_hud_data_row, dive_hud_data_row+.30, dive_hud_sensor2_column, dive_hud_sensor3_column	; top, bottom, left, right
+    WIN_STD dive_hud_sensor2_column+.7,dive_hud_data_row+.5
+   	call	TFT_standard_color
+    STRCPY_PRINT "---"
+    bra     TFT_update_hud4 ; Skip Sensor 2
+TFT_update_hud3:
+    WIN_MEDIUM dive_hud_sensor2_column,dive_hud_data_row
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+    lfsr    FSR2,buffer
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    STRCAT_PRINT ""
+    bsf     dive_hud2_displayed         ; Set display flag
+TFT_update_hud4:
+    movff   o2_ppo2_sensor3,lo
+    tstfsz  lo              ; ppO2=0 (No data/failure)?
+    bra     TFT_update_hud5 ; No
+    btfss   dive_hud3_displayed         ; Was the sensor shown?
+    bra     TFT_update_hud6             ; Yes, skip clear
+    bcf     dive_hud3_displayed         ; No, clear display flag
+    WIN_BOX_BLACK   dive_hud_data_row, dive_hud_data_row+.30, dive_hud_sensor3_column, .159 ; top, bottom, left, right
+    WIN_STD dive_hud_sensor3_column+.7,dive_hud_data_row+.5
+   	call	TFT_standard_color
+    STRCPY_PRINT "---"
+    bra     TFT_update_hud6 ; Skip Sensor 3
+TFT_update_hud5:
+    WIN_MEDIUM dive_hud_sensor3_column,dive_hud_data_row
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+    lfsr    FSR2,buffer
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    STRCAT_PRINT ""
+    bsf     dive_hud3_displayed         ; Set display flag
+TFT_update_hud6:
+    bcf     leftbind
+   	call	TFT_standard_color
+    return
+
+    global  TFT_surface_hud             ; Update HUD data in surface mode
+TFT_surface_hud:
+    ; show three sensors
+    bsf     leftbind
+    WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row
+    movff   o2_ppo2_sensor1,lo
+    tstfsz  lo              ; ppO2=0 (No data/failure)?
+    bra     TFT_surface_hud1 ; No
+   	call	TFT_standard_color
+    STRCPY_PRINT "--- "
+    bra     TFT_surface_hud2 ; Skip Sensor 1
+TFT_surface_hud1:
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+    lfsr    FSR2,buffer
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    STRCAT_PRINT ""
+TFT_surface_hud2:
+    WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row
+    movff   o2_ppo2_sensor2,lo
+    tstfsz  lo              ; ppO2=0 (No data/failure)?
+    bra     TFT_surface_hud3 ; No
+   	call	TFT_standard_color
+    STRCPY_PRINT "--- "
+    bra     TFT_surface_hud4 ; Skip Sensor 2
+TFT_surface_hud3:
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+    lfsr    FSR2,buffer
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    STRCAT_PRINT ""
+TFT_surface_hud4:
+    WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row
+    movff   o2_ppo2_sensor3,lo
+    tstfsz  lo              ; ppO2=0 (No data/failure)?
+    bra     TFT_surface_hud5 ; No
+   	call	TFT_standard_color
+    STRCPY_PRINT "--- "
+    bra     TFT_surface_hud6 ; Skip Sensor 3
+TFT_surface_hud5:
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+    lfsr    FSR2,buffer
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    STRCAT_PRINT ""
+TFT_surface_hud6:
+    bcf     leftbind
+   	call	TFT_standard_color
+    return
+
+    global  TFT_menu_hud
+TFT_menu_hud:            ; Yes, update HUD data
+    movlw   color_yellow
+    call	TFT_set_color
+    bsf     leftbind
+    WIN_SMALL   surf_menu_sensor1_column,surf_menu_sensor1_row
+    lfsr    FSR2,buffer
+    movff   o2_ppo2_sensor1,lo
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    PUTC    ","
+    movff   o2_mv_sensor1+0,lo      ; in 0.1mV steps
+    movff   o2_mv_sensor1+1,hi      ; in 0.1mV steps
+    output_16dp  .4         ; xxx.y mV
+    STRCAT_PRINT "mV "
+    WIN_SMALL   surf_menu_sensor2_column,surf_menu_sensor2_row
+    lfsr    FSR2,buffer
+    movff   o2_ppo2_sensor2,lo
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    PUTC    ","
+    movff   o2_mv_sensor2+0,lo      ; in 0.1mV steps
+    movff   o2_mv_sensor2+1,hi      ; in 0.1mV steps
+    output_16dp  .4         ; xxx.y mV
+    STRCAT_PRINT "mV "
+    WIN_SMALL   surf_menu_sensor3_column,surf_menu_sensor3_row
+    lfsr    FSR2,buffer
+    movff   o2_ppo2_sensor3,lo
+    clrf    hi
+    output_16dp  .3         ; x.xx bar
+    PUTC    ","
+    movff   o2_mv_sensor3+0,lo      ; in 0.1mV steps
+    movff   o2_mv_sensor3+1,hi      ; in 0.1mV steps
+    output_16dp  .4         ; xxx.y mV
+    STRCAT_PRINT "mV "
+    WIN_SMALL   surf_menu_sensor4_column,surf_menu_sensor4_row
+    lfsr    FSR2,buffer
+    STRCPY  "Batt:"
+    movff   hud_battery_mv+0,lo      ; in mV
+    movff   hud_battery_mv+1,hi      ; in mV
+    output_16dp  .2         ; x.yyy V
+    STRCAT_PRINT "V"
+    call    TFT_standard_color
+    bcf     leftbind
+    return
+
+    	global	TFT_clock
+TFT_clock:
+	WIN_TINY  surf_clock_column,surf_clock_row
+TFT_clock2:                         ; called from divemode clock
+   	call	TFT_standard_color
+	lfsr    FSR2,buffer
+	movff	hours,lo
+	output_99
+	movlw	':'
+	btfss	secs,0					; blinking every second
+	movlw	' '
+	movwf	POSTINC2
+	movff	mins,lo
+	output_99x
+	STRCAT_PRINT ""
+	return
+
+	global	TFT_show_time_date_menu
+TFT_show_time_date_menu:
+    call    speed_fastest
+	WIN_SMALL  .15,.30
+   	call	TFT_standard_color
+	lfsr    FSR2,buffer
+	movff	hours,lo
+	output_99
+	PUTC	':'
+	movff	mins,lo
+	output_99x
+	PUTC	':'
+	movff	secs,lo
+	output_99x
+	STRCAT  " - "
+	movff	month,convert_value_temp+0
+	movff	day,convert_value_temp+1
+	movff	year,convert_value_temp+2
+	call	TFT_convert_date		; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2	
+	STRCAT_PRINT " "
+	return
+;=============================================================================
+
+    global  TFT_interval
+TFT_interval:
+	call	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+	STRCPY	"Int:"
+	movff	surface_interval+0,lo
+	movff	surface_interval+1,hi
+	call	convert_time			; lo=mins, hi=hours
+	movf	hi,W
+	movff	lo,hi
+	movwf	lo					; exchange lo and hi
+	output_99x
+	PUTC    ':'
+	movff	hi,lo
+	output_99x
+    movlw   surf_warning_length         ; No, use surface string length
+    call    TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT ""
+	return
+
+    global  TFT_compass_fast
+TFT_compass_fast:
+	WIN_TINY	.20,.50
+	STRCPY  "X:"
+    movff	compass_DX+0,lo
+    movff	compass_DX+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT  " Y:"
+    movff	compass_DY+0,lo
+    movff	compass_DY+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT  " Z:"
+    movff	compass_DZ+0,lo
+    movff	compass_DZ+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT_PRINT "  "
+    return
+
+	global	TFT_update_raw_data
+TFT_update_raw_data:
+	WIN_TINY	.0,.0
+	STRCPY  "pres:"
+    SAFE_2BYTE_COPY amb_pressure, lo
+	bsf		leftbind
+	output_16
+	STRCAT_PRINT "mbar "
+	WIN_TINY	.80,.0
+	STRCPY  "temp:"
+    SAFE_2BYTE_COPY temperature, lo
+	call	TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	movlw	d'3'
+	movwf	ignore_digits
+	output_16dp	d'2'					; temperature
+	STRCAT_PRINT "°C "
+
+	call	get_battery_voltage			; get battery voltage
+	WIN_TINY	.0,.18
+	STRCPY  "AN06:"
+	movff	ADRESL,lo
+	movff	ADRESH,hi
+	output_16
+	STRCAT_PRINT ""
+	WIN_TINY	.80,.18
+	STRCPY  "BATT:"
+	movff	batt_voltage+0,lo
+	movff	batt_voltage+1,hi
+	output_16
+	STRCAT_PRINT "mV "
+
+	call	get_ambient_level			; get ambient light level
+	WIN_TINY	.0,.36
+	STRCPY  "AN07:"
+	movff	ADRESL,lo
+	movff	ADRESH,hi
+	output_16
+	STRCAT_PRINT " "
+	WIN_TINY	.80,.36
+	STRCPY  "Amb.:"
+	movff	ambient_light+0,lo
+	movff	ambient_light+1,hi
+    output_16
+    STRCAT_PRINT " "
+
+	call	get_rssi_level              ; get rssi level
+	WIN_TINY	.0,.54
+	STRCPY  "AN17:"
+	movff	ADRESL,lo
+	movff	ADRESH,hi
+	output_16
+	STRCAT_PRINT " "
+	WIN_TINY	.80,.54
+	STRCPY  "RSSI:"
+	movff	rssi_value,lo
+    output_8
+	STRCAT_PRINT " "
+
+	WIN_TINY	.0,.72
+	STRCPY  "HUD_Status:"
+	movff	hud_status_byte,lo
+	output_8
+	STRCAT_PRINT "  "
+	WIN_TINY	.80,.72
+	STRCPY  "HUD_BATT:"
+	movff	hud_battery_mv+0,lo
+	movff	hud_battery_mv+1,hi
+	output_16
+	STRCAT_PRINT "mV   "
+
+	WIN_TINY	.0,.90
+	STRCPY  "Sens1.:"
+    movff	o2_mv_sensor1+0,lo
+    movff	o2_mv_sensor1+1,hi
+    output_16dp d'4'
+	STRCAT_PRINT "mV   "
+	WIN_TINY	.80,.90
+	STRCPY  "Sens2:"
+	movff	o2_mv_sensor2+0,lo
+	movff	o2_mv_sensor2+1,hi
+	output_16dp d'4'
+	STRCAT_PRINT "mV   "
+
+	WIN_TINY	.0,.108
+	STRCPY  "Sens3.:"
+    movff	o2_mv_sensor3+0,lo
+    movff	o2_mv_sensor3+1,hi
+    output_16dp d'4'
+	STRCAT_PRINT "mV   "
+	WIN_TINY	.80,.108            ; Space
+
+    WIN_TINY	.0,.128
+    STRCPY  "ccDX:"
+    movff	compass_DX_f+0,lo           ; Display calibrated data
+    movff   compass_CX_f+0,WREG         ; by substracting compass_CX_f
+    subwf   lo,F                        ; lo := lo - W
+    movff	compass_DX_f+1,hi
+    movff   compass_CX_f+1,WREG
+    subwfb  hi,F
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+    STRCAT_PRINT "    "
+    WIN_TINY	.80,.128
+    STRCPY  "ccDY:"
+    movff	compass_DY_f+0,lo
+    movff   compass_CY_f+0,WREG
+    subwf   lo,F
+    movff	compass_DY_f+1,hi
+    movff   compass_CY_f+1,WREG
+    subwfb  hi,F
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+    STRCAT_PRINT "    "
+    WIN_TINY	.0,.146
+    STRCPY  "ccDZ:"
+    movff	compass_DZ_f+0,lo
+    movff   compass_CZ_f+0,WREG
+    subwf   lo,F
+    movff	compass_DZ_f+1,hi
+    movff   compass_CZ_f+1,WREG
+    subwfb  hi,F
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT_PRINT "    "
+	WIN_TINY	.80,.146                ; Space
+
+	WIN_TINY	.0,.164
+	STRCPY  "AcDX:"
+    movff	accel_DX_f+0,lo
+    movff	accel_DX_f+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT_PRINT "mg   "
+	WIN_TINY	.80,.164
+	STRCPY  "AcDY:"
+    movff	accel_DY_f+0,lo
+    movff	accel_DY_f+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT_PRINT "mg   "
+	WIN_TINY	.0,.182
+	STRCPY  "AcDZ:"
+    movff	accel_DZ_f+0,lo
+    movff	accel_DZ_f+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+	STRCAT_PRINT "mg   "
+
+	WIN_TINY	.80,.182
+    STRCPY  "Head:"
+    movff	compass_heading+0,lo
+    movff	compass_heading+1,hi
+
+    btfsc   hi,7                        ; Uncalibrated compass ?
+    bra     TFT_update_compass_1
+
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+    STRCAT_PRINT "   "
+    bra     TFT_update_compass_2
+
+TFT_update_compass_1:
+    STRCAT_PRINT "---"
+
+TFT_update_compass_2:
+    WIN_TINY	.0,.200
+    STRCPY  "calX:"
+    movff   compass_CX_f+0,lo
+    movff   compass_CX_f+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+    STRCAT  ", "
+    movff   compass_CY_f+0,lo
+    movff   compass_CY_f+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+    STRCAT  ", "
+    movff   compass_CZ_f+0,lo
+    movff   compass_CZ_f+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    output_16
+    STRCAT_PRINT  "     "
+
+    WIN_TINY    .0,.218
+    STRCPY  "Roll:"
+    movff   compass_roll+0,lo
+    movff   compass_roll+1,hi
+    call    TFT_convert_signed_16bit
+    output_16
+    STRCAT_PRINT "   "
+
+    WIN_TINY    .80, .218
+    STRCPY  "Pitch:"
+    movff   compass_pitch+0,lo
+    movff   compass_pitch+1,hi
+    call    TFT_convert_signed_16bit
+    output_16
+    STRCAT_PRINT  "     "
+
+    ;   call    TFT_serial
+    bcf     leftbind
+    return
+
+
+    global  TFT_surface_compass_mask
+TFT_surface_compass_mask:
+    WIN_SMALL   surf_compass_mask_column,surf_compass_mask_row
+	call	TFT_standard_color
+    STRCPY_TEXT_PRINT   tHeading            ; Heading:
+    return
+
+    global  TFT_dive_compass_mask
+TFT_dive_compass_mask:
+    WIN_TINY    dive_compass_mask_column,dive_compass_mask_row
+    call    TFT_divemask_color
+    STRCPY_TEXT_PRINT   tHeading            ; Heading:
+    return
+
+
+    global  TFT_surface_compass_heading
+TFT_surface_compass_heading:
+    rcall   compass_heading_common
+    WIN_STD   surf_compass_head_column,surf_compass_head_row
+	call	TFT_standard_color
+    lfsr	FSR2,buffer
+    movff	compass_heading+0,lo
+    movff	compass_heading+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    bsf     leftbind
+    output_16
+    bcf     leftbind
+    STRCAT_PRINT "°  "
+    return
+
+    global  TFT_dive_compass_heading
+TFT_dive_compass_heading:
+    rcall   compass_heading_common
+    WIN_STD dive_compass_head_column,dive_compass_head_row
+	call	TFT_standard_color
+    lfsr	FSR2,buffer
+    movff	compass_heading+0,lo
+    movff	compass_heading+1,hi
+    call    TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+    bsf     leftbind
+    output_16
+    bcf     leftbind
+    STRCAT_PRINT "°  "
+    return
+
+
+compass_heading_common:
+    extern  compass
+    extern  compass_filter
+    rcall   TFT_get_compass
+    rcall   TFT_get_compass
+    rcall   TFT_get_compass
+    rcall   TFT_get_compass
+    rcall   TFT_get_compass
+    rcall   TFT_get_compass
+    call    compass                     ; Do compass corrections.
+    banksel common
+    return
+
+TFT_get_compass:
+	call	speed_normal
+    call    I2C_RX_compass              ; Test Compass
+    call    I2C_RX_accelerometer        ; Test Accelerometer
+    call    compass_filter              ; Filter Raw compass + accel readings.
+    banksel common
+    return
+
+	global	TFT_debug_output
+TFT_debug_output:
+    return
+    WIN_TINY   .107,.0
+	call	TFT_standard_color
+	lfsr	FSR2,buffer
+    movff   CCPR1L,lo
+    output_8
+	STRCAT_PRINT ""
+	return
+
+	global	TFT_ftts
+TFT_ftts:
+    movff   char_I_extra_time,lo
+    tstfsz  lo
+    bra     $+4
+    return                              ; char_I_extra_time=0, return.
+	incf	warning_counter,F			; increase counter
+	call	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+    movff   char_I_extra_time,lo
+    STRCPY  "@+"
+    bsf     leftbind
+    output_8
+    PUTC    ":"
+	movff   int_O_extra_ascenttime+0,lo
+    movff   int_O_extra_ascenttime+1,hi
+    movf    lo,W
+	iorwf   hi,W                    ; extra_ascenttime == 0 ?
+	bz      TFT_ftts2   			; No deco
+	movf    lo,W                    ; extra_ascenttime == 0xFFFF ?
+	andwf   hi,W
+	incf    WREG,w
+	bz      TFT_ftts2       		; Wait...
+	output_16
+	bcf         leftbind
+    PUTC    "'"
+    movlw   warning_length             ; Divemode string length
+    call    TFT_fillup_with_spaces     ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT ""
+	return
+
+TFT_ftts2:
+    STRCAT  "---"
+	bcf     leftbind
+    movlw   warning_length             ; Divemode string length
+    call    TFT_fillup_with_spaces     ; Fillup FSR2 with spaces (Total string length in #WREG)
+    STRCAT_PRINT ""
+    return
+
+
+;=============================================================================
+	
+	global	TFT_temp_surfmode
+TFT_temp_surfmode:
+	WIN_SMALL   surf_temp_column,surf_temp_row
+	call	TFT_standard_color
+
+    SAFE_2BYTE_COPY    temperature, lo
+
+    TSTOSS  opt_units   			; 0=°C, 1=°F
+	bra		TFT_temp_surfmode_metric
+
+;TFT_temp_surfmode_imperial:
+	call	TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	call	convert_celsius_to_fahrenheit	; convert value in lo:hi from celsius to fahrenheit
+	lfsr	FSR2,buffer						; Overwrite "-"
+	bsf		ignore_digit5		; Full degrees only
+	output_16
+	STRCAT_PRINT  ""
+    call    TFT_divemask_color
+	WIN_SMALL   surf_temp_column+4*8,surf_temp_row
+	STRCPY_PRINT  "°F"
+	return
+
+TFT_temp_surfmode_metric:
+	lfsr	FSR2,buffer
+	call	TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	movlw	d'3'
+	movwf	ignore_digits
+	bsf		ignore_digit5		; Full degrees only
+	output_16
+
+	; read-back the buffer+3
+	movff	buffer+3,lo
+	movlw	" "					; Space
+	cpfseq	lo					; Was it a space (between +1°C and -1°C)?
+	bra		TFT_temp_surfmode1	; No.
+	movlw	"0"					; Yes, print manual zero
+	movff	WREG,buffer+3
+	bra		TFT_temp_surfmode2
+TFT_temp_surfmode1:
+	; Test if output was negative (Flag set in TFT_convert_signed_16bit)
+	btfss	neg_flag			; Negative temperature?
+    bra		TFT_temp_surfmode3	; No, continue
+	; Yes, negative temperature!
+	movff	buffer+3,buffer+2	; remove two spaces manually
+	movff	buffer+4,buffer+3
+TFT_temp_surfmode2:
+	movlw	0x00
+	movff	WREG,buffer+4
+TFT_temp_surfmode3:
+	STRCAT_PRINT  ""
+    call    TFT_divemask_color
+	WIN_SMALL   surf_temp_column+4*8,surf_temp_row
+	STRCPY_PRINT  "°C"
+	return
+
+;=============================================================================
+    global  TFT_divemode_menu_cursor
+TFT_divemode_menu_cursor:
+    WIN_BOX_BLACK   divemode_menu_item1_row,divemode_menu_item3_row+.24,divemode_menu_item1_column-.8,divemode_menu_item1_column-.1
+    WIN_BOX_BLACK   divemode_menu_item4_row,divemode_menu_item6_row+.24,divemode_menu_item4_column-.8,divemode_menu_item4_column-.1
+    call	TFT_standard_color
+
+    movlw   divemode_menu_item1_column-.8
+    btfsc   menupos,2       ; >3?
+    movlw   divemode_menu_item4_column-.8  ; Yes
+    movff   WREG,win_leftx2
+    
+    movff   menupos,lo                      ; Copy menu pos
+    movlw   divemode_menu_item6_row
+    dcfsnz  lo,F
+    movlw   divemode_menu_item1_row
+    dcfsnz  lo,F
+    movlw   divemode_menu_item2_row
+    dcfsnz  lo,F
+    movlw   divemode_menu_item3_row
+    dcfsnz  lo,F
+    movlw   divemode_menu_item4_row
+    dcfsnz  lo,F
+    movlw   divemode_menu_item5_row
+    movff   WREG,win_top
+    movlw   FT_SMALL
+    movff   WREG,win_font
+    STRCPY_PRINT    "\xb7"          ; print cursor
+    return
+
+	global	TFT_temp_divemode
+TFT_temp_divemode:
+    btfsc   divemode_menu               ; Is the dive mode menu shown?
+    return                              ; Yes, return
+	btfsc	blinking_better_gas         ; blinking better Gas?
+	return                              ; Yes, no update of temperature now
+; temperature
+	WIN_SMALL	dive_temp_column,dive_temp_row
+	call	TFT_standard_color
+    bsf     leftbind
+
+    SAFE_2BYTE_COPY    temperature, lo
+    TSTOSS  opt_units   			; 0=°C, 1=°F
+	bra		TFT_temp_divemode_metric
+
+;TFT_temp_divemode_imperial:
+	call	TFT_convert_signed_16bit        ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	call	convert_celsius_to_fahrenheit	; convert value in lo:hi from celsius to fahrenheit
+	lfsr	FSR2,buffer						; Overwrite "-" (There won't be less then -18°C underwater...)
+	bsf		ignore_digit5		; Full degrees only
+	output_16
+	STRCAT_TEXT tLogTunitF
+TFT_temp_divemode_common:
+    bcf     leftbind
+    movlw   .4                      ; limit to three chars
+    call    TFT_fillup_with_spaces  ; Fillup FSR2 with spaces (Total string length in #WREG)
+    STRCAT_PRINT    ""
+	return                          ; Done.
+
+TFT_temp_divemode_metric:
+	lfsr	FSR2,buffer
+	call	TFT_convert_signed_16bit	; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
+	movlw	d'3'
+	movwf	ignore_digits
+	bsf		ignore_digit5		; Full degrees only
+	output_16
+	STRCAT_TEXT tLogTunitC
+    bra     TFT_temp_divemode_common    ; Done.
+
+TFT_active_setpoint:         ; Show setpoint
+	WIN_STD  active_gas_column,active_gas_row
+	call	TFT_standard_color
+    btfsc   is_bailout                  ; =1: Bailout
+    bra     TFT_active_setpoint_bail    ; Show "Bailout" instead of Setpoint
+
+    lfsr	FSR2,buffer
+	movff	char_I_const_ppO2,lo
+    TFT_color_code  warn_ppo2_hud       ; With ppO2 [cbar] in lo
+	clrf	hi
+	bsf		leftbind
+	output_16dp d'3'
+    bcf		leftbind
+    STRCAT_TEXT tbar
+    TSTOSS  opt_ccr_mode                    ; =0: Fixed SP, =1: Sensor
+    bra     $+4
+    PUTC    "*"
+	STRCAT_PRINT ""
+
+TFT_active_setpoint_diluent:
+    call	TFT_standard_color
+	WIN_SMALL  active_dil_column,active_dil_row
+    movff   char_I_O2_ratio,lo          ; lo now stores O2 in %
+    movff   char_I_He_ratio,hi          ; hi now stores He in %
+    rcall   TFT_show_dil_divemode2      ; Show diluent  (Non-Inverted in all cases)
+
+	btfss	better_gas_available        ; =1: A better gas is available and a gas change is advised in divemode
+	return					; Done.
+	btg		blinking_better_gas         ; Toggle blink bit...
+	btfss	blinking_better_gas         ; blink now?
+	return                              ; No, Done.
+
+	movlw	color_yellow                ; Blink in yellow
+    call	TFT_set_color
+    WIN_SMALL_INVERT  active_dil_column,active_dil_row
+    movff   char_I_O2_ratio,lo          ; lo now stores O2 in %
+    movff   char_I_He_ratio,hi          ; hi now stores He in %
+	rcall	TFT_show_dil_divemode2      ; Show gas
+	WIN_INVERT	.0                      ; Init new Wordprocessor
+	call	TFT_standard_color
+	return                              ; Done.
+
+TFT_show_dil_divemode2:
+	lfsr	FSR2,buffer
+    call    customview_show_mix         ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+	STRCAT_PRINT ""
+	return
+
+TFT_active_setpoint_bail:
+    STRCPY_TEXT_PRINT   tDiveBailout        ; Bailout
+    bra     TFT_active_setpoint_diluent
+
+	global	TFT_active_gas_divemode
+TFT_active_gas_divemode:				; Display gas/Setpoint
+    btfsc   divemode_menu               ; Is the dive mode menu shown?
+    return                              ; Yes, return
+	btfsc	FLAG_apnoe_mode				; Ignore in Apnoe mode
+	return
+    btfsc   FLAG_ccr_mode               ; in CCR mode
+    bra     TFT_active_setpoint         ; Yes, show setpoint
+
+    call    TFT_standard_color
+	WIN_STD active_gas_column,active_gas_row
+    movff   char_I_O2_ratio,lo          ; lo now stores O2 in %
+    movff   char_I_He_ratio,hi          ; hi now stores He in %
+	rcall	TFT_active_gas_divemode2    ; Show gas (Non-Inverted in all cases)
+	btfss	better_gas_available        ; =1: A better gas is available and a gas change is advised in divemode
+	return					; Done.
+
+	btg		blinking_better_gas         ; Toggle blink bit...
+	btfss	blinking_better_gas         ; blink now?
+	return                              ; No, Done.
+	movlw	color_yellow                ; Blink in yellow
+    call	TFT_set_color
+    WIN_STD_INVERT active_gas_column,active_gas_row
+    movff   char_I_O2_ratio,lo          ; lo now stores O2 in %
+    movff   char_I_He_ratio,hi          ; hi now stores He in %
+	rcall	TFT_active_gas_divemode2    ; Show gas (Non-Inverted in all cases)
+	WIN_INVERT	.0                      ; Init new Wordprocessor
+	call	TFT_standard_color
+	return                              ; Done.
+
+TFT_active_gas_divemode2:
+	lfsr	FSR2,buffer
+    call    customview_show_mix         ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
+	STRCAT_PRINT ""
+	return
+
+	global	TFT_display_decotype_surface
+    global  TFT_display_decotype_surface1   ; Used from logbook!
+TFT_display_decotype_surface:
+	WIN_STD  surf_decotype_column,surf_decotype_row
+    WIN_COLOR	color_lightblue
+    lfsr	FSR2,buffer
+    movff   opt_dive_mode,lo        ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
+TFT_display_decotype_surface1:  ; Used from logbook!
+    tstfsz  lo
+    bra     TFT_display_decotype_surface2
+    STRCAT_TEXT_PRINT	tDvOC	; OC
+    bra     TFT_display_decotype_exit
+TFT_display_decotype_surface2:
+    decfsz  lo,F
+    bra     TFT_display_decotype_surface3
+    STRCAT_TEXT_PRINT	tDvCC	; CC
+    bra     TFT_display_decotype_exit
+TFT_display_decotype_surface3:
+    decfsz  lo,F
+    bra     TFT_display_decotype_surface4
+    STRCAT_TEXT_PRINT	tDvGauge	; Gauge
+    bra     TFT_display_decotype_exit
+TFT_display_decotype_surface4:
+    STRCAT_TEXT_PRINT	tDvApnea	; Apnea
+TFT_display_decotype_exit:
+    call	TFT_standard_color
+    return
+;=============================================================================
+
+    global  TFT_splist_surfmode     ; Show Setpoint list
+    extern  gaslist_strcat_setpoint
+TFT_splist_surfmode:
+    bsf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+    ;SP 1
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row
+    lfsr	FSR2,buffer
+    clrf    PRODL
+    call    gaslist_strcat_setpoint     ; Show SP#+1 of PRODL#
+    STRCAT_PRINT ""
+    ;SP 2
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)
+    lfsr	FSR2,buffer
+    movlw   .1
+    movwf   PRODL
+    call    gaslist_strcat_setpoint     ; Show SP#+1 of PRODL#
+    STRCAT_PRINT ""
+    ;SP 3
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)
+    lfsr	FSR2,buffer
+    movlw   .2
+    movwf   PRODL
+    call    gaslist_strcat_setpoint     ; Show SP#+1 of PRODL#
+    STRCAT_PRINT ""
+    ;SP 4
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)
+    lfsr	FSR2,buffer
+    movlw   .3
+    movwf   PRODL
+    call    gaslist_strcat_setpoint     ; Show SP#+1 of PRODL#
+    STRCAT_PRINT ""
+    ;SP 5
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)
+    lfsr	FSR2,buffer
+    movlw   .4
+    movwf   PRODL
+    call    gaslist_strcat_setpoint     ; Show SP#+1 of PRODL#
+    STRCAT_PRINT ""
+    bcf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+    bcf     leftbind
+    return
+
+	global	TFT_gaslist_surfmode
+TFT_gaslist_surfmode:				; Displays Gas List
+    bsf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+    extern  gaslist_strcat_gas_mod
+    ;Gas 1
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row
+    lfsr	FSR2,buffer
+    movlw   .0
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Gas 2
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)
+    lfsr	FSR2,buffer
+    movlw   .1
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Gas 3
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)
+    lfsr	FSR2,buffer
+    movlw   .2
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Gas 4
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)
+    lfsr	FSR2,buffer
+    movlw   .3
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Gas 5
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)
+    lfsr	FSR2,buffer
+    movlw   .4
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    bcf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+    bcf     leftbind
+    return
+
+	global	TFT_dillist_surfmode
+TFT_dillist_surfmode:				; Displays Diluent List
+    bsf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+    ;Dil 1
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row
+    lfsr	FSR2,buffer
+    movlw   .5
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Dil 2
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)
+    lfsr	FSR2,buffer
+    movlw   .6
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Dil 3
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)
+    lfsr	FSR2,buffer
+    movlw   .7
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Dil 4
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)
+    lfsr	FSR2,buffer
+    movlw   .8
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    ;Dil 5
+    WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)
+    lfsr	FSR2,buffer
+    movlw   .9
+    movwf   PRODL
+    call    gaslist_strcat_gas_mod  ;Append gas description of gas #PRODL (0-4) to current string
+    STRCAT_PRINT ""
+    bcf     short_gas_decriptions   ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
+    bcf     leftbind
+    return
+
+	global	TFT_depth
+TFT_depth:
+    SAFE_2BYTE_COPY rel_pressure, lo
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+
+    TSTOSS  opt_units   			; 0=m, 1=ft
+	bra		TFT_depth_metric
+;TFT_depth_imperial
+	WIN_LARGE	depth_feet_column,depth_feet_row
+	lfsr    FSR2,buffer
+	TFT_color_code	warn_depth			; Color-code the output
+
+    clrf    sub_a+1                     ; Display 0ft if lower then 30cm
+	movlw	d'30'
+	movwf	sub_a+0
+	movff	hi,sub_b+1
+	movff	lo,sub_b+0
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag				; Depth lower then 0.4m?
+	bra		depth_less_0.3mtr_feet	; Yes, Show 0ft manually
+
+	call	convert_mbar_to_feet    ; convert value in lo:hi from mbar to feet
+	bsf		leftbind
+	output_16						; feet in Big font
+    bcf		leftbind
+    movlw   .3                      ; limit to three chars
+    call    TFT_fillup_with_spaces  ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT ""					; Display feet
+    return
+	
+depth_less_0.3mtr_feet:
+	STRCAT_PRINT "0  "				; manual zero
+	return
+
+TFT_depth_metric:
+	WIN_LARGE	depth_column,depth_row
+	TFT_color_code	warn_depth			; Color-code the output
+
+	movlw	.039
+	cpfslt	hi
+    bra		depth_greater_99_84mtr
+
+	btfsc	depth_greater_100m			; Was depth>100m during last call
+	call	TFT_clear_depth             ; Yes, clear depth area
+	bcf		depth_greater_100m			; Do this once only...
+
+	lfsr    FSR2,buffer
+	movlw	HIGH	d'1000'
+	movwf	sub_a+1
+	movlw	LOW		d'1000'
+	movwf	sub_a+0
+	movff	hi,sub_b+1
+	movff	lo,sub_b+0
+	incf	sub_b+0,F
+	movlw	d'0'
+	addwfc	sub_b+1,F				; Add 1mbar offset
+	call	sub16					; sub_c = sub_a - sub_b
+    movlw   ' '
+	btfss	neg_flag				; Depth lower then 10m?
+    movwf   POSTINC2                ; Yes, add extra space
+
+	clrf    sub_a+1
+	movlw	d'99'
+	movwf	sub_a+0
+	movff	hi,sub_b+1
+	movff	lo,sub_b+0
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag				; Depth lower then 1m?
+	bra		tft_depth2				; Yes, display manual Zero
+
+	bsf		leftbind
+	bsf		ignore_digit4
+	output_16						; Full meters in Big font
+	bcf		leftbind
+	bra		tft_depth3
+
+tft_depth2:
+	WIN_LARGE	depth_column,depth_row
+	STRCAT	"0"
+
+tft_depth3:
+	STRCAT_PRINT ""					; Display full meters
+
+	; .1m in MEDIUM font
+	WIN_MEDIUM	depth_dm_column,depth_dm_row
+	TFT_color_code	warn_depth			; Color-code the output
+
+    SAFE_2BYTE_COPY rel_pressure, lo
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+	
+    lfsr    FSR2,buffer
+	PUTC    "."
+	movlw	HIGH	d'30'			; Display 0.0m if lower then 30cm
+	movwf	sub_a+1
+	movlw	LOW		d'30'
+	movwf	sub_a+0
+	movff	hi,sub_b+1
+	movff	lo,sub_b+0
+	call	subU16					; sub_c = sub_a - sub_b
+	btfss	neg_flag				; Depth lower then 0.3m?
+	bra		depth_less_0.3mtr		; Yes, Show ".0" manually
+
+	movlw	d'4'
+	movwf	ignore_digits
+	bsf		ignore_digit5
+	output_16dp	d'0'
+	STRCAT_PRINT ""					; Display decimeters
+	WIN_FONT 	FT_SMALL
+	return
+
+depth_less_0.3mtr:
+	STRCAT_PRINT "0"				; Display 0.0m manually
+	WIN_FONT 	FT_SMALL
+	return
+
+depth_greater_99_84mtr:			; Display only in full meters
+	btfss	depth_greater_100m		; Is depth>100m already?
+	rcall	TFT_clear_depth			; No, clear depth area and set flag
+	; Depth is already in hi:lo
+	; Show depth in Full meters
+	; That means ignore figure 4 and 5
+	lfsr    FSR2,buffer
+	bsf		ignore_digit4
+	bsf		leftbind
+	output_16
+	bcf		leftbind
+    STRCAT_PRINT ""					; Display full meters only
+	WIN_FONT 	FT_SMALL
+	return
+
+TFT_clear_depth:            			; No, clear depth area and set flag
+    WIN_BOX_BLACK   depth_row, .77,.0, max_depth_column-.1    ;top, bottom, left, right
+	bsf		depth_greater_100m			; Set Flag
+	return
+
+;=============================================================================
+
+;	global	TFT_user_image
+;TFT_user_image:
+;    ;---- Display user image -------------------------------------------------
+;    ; Compute address in external EEPROM
+;    movff   opt_skin,WREG
+;    mullw   0x50
+;    movff   PRODL,ext_flash_address+1
+;    movf    PRODH,W
+;    iorlw   0x30
+;    movwf   ext_flash_address+2
+;
+;    ; First pixel at @+4:
+;    movlw   4
+;    movwf   ext_flash_address+0
+;
+;    ; Read first pixel
+;	call	ext_flash_read_block_start
+;;	movff   SSP2BUF,skin_color+1        ; TFT format: HIGH is first...
+;	movwf	SSP2BUF						; Write to buffer to initiate new read
+;	btfss	SSP2STAT, BF                ; Next byte ready ?
+;	bra		$-2                         ; NO: wait...
+;;   	movff   SSP2BUF,skin_color+0
+;	call    ext_flash_read_block_stop
+;
+;   ; Make a frame of the retrieved skin color.
+;    setf    win_color1
+;    setf    win_color2
+;	WIN_FRAME_COLOR16 user_image_upper-.1, user_image_upper+.100,user_image_left-.1, user_image_left+.50
+;
+;    WIN_LEFT    user_image_left+.25
+;    WIN_TOP     user_image_upper+.50
+;
+;    ; Display skin icon
+;    clrf        ext_flash_address+0
+;    call        TFT_write_flash_image_addr
+;
+;    ;---- Print custom text string
+;    WIN_LEFT    user_image_left+.50+.5
+;    WIN_TOP     user_image_upper+.0
+;
+;    ; ---- STRNCPY : String copy from RAM
+;   ; lfsr        FSR0, opt_name          ; Source
+;    lfsr        FSR1, .13               ; Len max
+;    lfsr        FSR2, buffer            ; destination
+;TFT_user_image_1:
+;    movf        POSTINC0,W              ; Get byte
+;    bz          TFT_user_image_2        ; End if NULL
+;    movwf       POSTINC2                ; NO: copy
+;    decfsz      FSR1L                   ; Max len reached ?
+;    bra         TFT_user_image_1        ; NO: loop
+;TFT_user_image_2:
+;    clrf        POSTINC2                ; Mark end of string
+;
+;    goto        aa_wordprocessor        ; and print
+
+
+    global  TFT_custom_text
+TFT_custom_text:            ; Show the custom text
+    lfsr        FSR0, opt_name          ; Source
+    WIN_SMALL   surf_customtext_column,surf_customtext_row1 ; First row
+    rcall       TFT_custom_text_2       ; Show up to 12 chars and print
+    incfsz      lo,F                    ; Was lo=255?
+    return                              ; No, all done.
+    lfsr        FSR0, opt_name+.12      ; Source
+    WIN_SMALL   surf_customtext_column,surf_customtext_row2 ; Second row
+    rcall       TFT_custom_text_2       ; Show up to 12 chars and print
+    incfsz      lo,F                    ; Was lo=255?
+    return                              ; No, all done.
+    lfsr        FSR0, opt_name+.24      ; Source
+    WIN_SMALL   surf_customtext_column,surf_customtext_row3 ; Third row
+    rcall       TFT_custom_text_2       ; Show up to 12 chars and print
+    incfsz      lo,F                    ; Was lo=255?
+    return                              ; No, all done.
+    lfsr        FSR0, opt_name+.36      ; Source
+    WIN_SMALL   surf_customtext_column,surf_customtext_row4 ; Forth row
+    rcall       TFT_custom_text_2       ; Show up to 12 chars and print
+    incfsz      lo,F                    ; Was lo=255?
+    return                              ; No, all done.
+    lfsr        FSR0, opt_name+.48      ; Source
+    WIN_SMALL   surf_customtext_column,surf_customtext_row5 ; Fifth row
+    rcall       TFT_custom_text_2       ; Show up to 12 chars and print
+    return                              ; Done.
+
+TFT_custom_text_2:
+    lfsr        FSR2, buffer            ; destination
+    movlw       .12
+    movwf       lo                      ; length/line
+TFT_custom_text_3:
+    movf        POSTINC0,W              ; Get byte
+    bz          TFT_custom_text_4       ; End if NULL
+    movwf       POSTINC2                ; NO: copy
+    decfsz      lo,F                    ; Max len reached ?
+    bra         TFT_custom_text_3       ; NO: loop
+    setf        lo                      ; lo=255 -> more to come
+TFT_custom_text_4:
+    clrf        POSTINC2                ; Mark end of string
+    goto        aa_wordprocessor        ; print and return
+
+
+;=============================================================================
+	global	TFT_update_surf_press
+TFT_update_surf_press:
+    WIN_SMALL   surf_press_column,surf_press_row
+	call	TFT_standard_color
+    SAFE_2BYTE_COPY amb_pressure, lo
+	lfsr	FSR2,buffer
+	movff	lo,sub_a+0
+	movff	hi,sub_a+1
+	movff	last_surfpressure_30min+0,sub_b+0
+	movff	last_surfpressure_30min+1,sub_b+1
+	call	subU16					; sub_c = sub_a - sub_b
+	btfsc	neg_flag				; Pressure lower?
+	rcall	update_surf_press2		; Yes, test threshold
+
+	tstfsz	sub_c+1					; >255mbar difference?
+	bra		update_surf_press_common; Yes, display!
+	movlw	d'10'					; 10mbar noise suppression
+	subwf	sub_c+0,W
+	btfsc	STATUS,C
+	bra		update_surf_press_common; Yes, display!
+    SAFE_2BYTE_COPY last_surfpressure_30min, lo	; Overwrite with stable value...
+
+update_surf_press_common:
+	output_16
+	; Show only 4 figures
+	movff	buffer+1,buffer+0
+	movff	buffer+2,buffer+1
+	movff	buffer+3,buffer+2
+	movff	buffer+4,buffer+3
+	movlw	0x00
+	movff	WREG,buffer+4
+	STRCAT_PRINT  ""
+    call    TFT_divemask_color
+	WIN_SMALL   surf_press_column+4*8,surf_press_row
+	STRCPY_PRINT  "mbar"
+	return
+
+update_surf_press2:
+	movff	lo,sub_b+0
+	movff	hi,sub_b+1
+	movff	last_surfpressure_30min+0,sub_a+0
+	movff	last_surfpressure_30min+1,sub_a+1
+	call	subU16					; sub_c = sub_a - sub_b
+	return
+
+;=============================================================================
+
+	global	TFT_update_batt_voltage
+TFT_update_batt_voltage:
+    movff   batt_percent,lo         ; Get battery percent
+    TFT_color_code		warn_battery; Color-code battery percent
+	WIN_TINY batt_percent_column,batt_percent_row
+	lfsr    FSR2,buffer
+	bsf		leftbind
+	output_8
+	bcf		leftbind
+	STRCAT_PRINT	"%"
+	call	TFT_standard_color
+	WIN_TINY batt_voltage_column,batt_voltage_row
+	lfsr    FSR2,buffer
+	movff	batt_voltage+0,lo
+	movff	batt_voltage+1,hi
+	bsf		leftbind
+	output_16dp	.2
+	bcf		leftbind
+	PUTC	'V'
+	movff	buffer+5,buffer+3
+	movlw	0x00
+	movff	WREG,buffer+4			; Only "x.yV"
+	STRCAT_PRINT	""
+	return
+
+;update_battery_debug:
+;	call	TFT_standard_color
+;	WIN_TINY .70,.0
+;	lfsr    FSR2,buffer
+;	movff	battery_gauge+5,xC+3
+;	movff	battery_gauge+4,xC+2
+;	movff	battery_gauge+3,xC+1
+;	movff	battery_gauge+2,xC+0
+;	; battery_gauge:6 is nAs
+;	; devide through 65536
+;	; devide through 152
+;	; Result is 0.01Ah in xC+1:xC+0
+;	movlw	LOW		.152
+;	movwf	xB+0
+;	movlw	HIGH	.152
+;	movwf	xB+1
+;	call	div32x16	  ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+;	bsf		leftbind
+;	movff	xC+0,lo
+;	movff	xC+1,hi
+;	output_16
+;	STRCAT_PRINT	"x.01Ah"
+;	WIN_FONT	FT_SMALL
+;	bcf		leftbind
+;	return
+		
+;=============================================================================
+
+	global	TFT_convert_signed_16bit
+TFT_convert_signed_16bit:
+	bcf			neg_flag				; Positive temperature
+   	btfss   	hi,7                    ; Negative temperature ?
+    return								; No, return
+; Yes, negative temperature!
+	bsf			neg_flag				; Negative temperature
+	PUTC		'-'                     ; Display "-"
+    comf    	hi                      ; Then, 16bit sign changes.
+    negf    	lo
+    btfsc   	STATUS,C
+    incf    	hi
+	return								; and return
+
+;=============================================================================
+
+	global	TFT_convert_date
+TFT_convert_date:	; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
+	movff	opt_dateformat,WREG		; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
+	movwf	EEDATA					; used as temp here
+	tstfsz	EEDATA
+	bra		TFT_convert_date1
+; EEDATA was 0
+; Use MMDDYY
+	movff	convert_value_temp+0,lo			;month
+	bsf		leftbind
+	output_99x
+	PUTC    '.'
+	movff	convert_value_temp+1,lo			;day
+	bra 	TFT_convert_date1_common		;year
+
+TFT_convert_date1:	; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
+	decfsz	EEDATA,F
+	bra		TFT_convert_date2				; EEDATA was 2
+; EEDATA was 1
+; Use DDMMYY
+	movff	convert_value_temp+1,lo			;day
+	bsf		leftbind
+	output_99x
+	PUTC    '.'
+	movff	convert_value_temp+0,lo			;month
+
+TFT_convert_date1_common:
+	bsf		leftbind
+	output_99x
+	PUTC    '.'
+	movff	convert_value_temp+2,lo			;year
+	output_99x
+	bcf		leftbind
+	return
+
+TFT_convert_date2:
+; Use YYMMDD
+	movff	convert_value_temp+2,lo			;year
+	bsf		leftbind
+	output_99x
+    PUTC    '.'
+	movff	convert_value_temp+0,lo			;month
+	output_99x
+    PUTC    '.'
+	movff	convert_value_temp+1,lo			;day
+	output_99x
+	bcf		leftbind
+	return
+
+;=============================================================================
+
+	global	TFT_convert_date_short
+TFT_convert_date_short:	; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2
+	movff	opt_dateformat,WREG		; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
+	movwf	EEDATA					; used as temp here
+	tstfsz	EEDATA
+	bra		TFT_convert_date_short1
+; EEDATA was 0
+; Use MMDDYY
+TFT_convert_date_short_common:
+	movff	convert_value_temp+0,lo			;month
+	bsf		leftbind
+	output_99x
+    PUTC    '.'
+	movff	convert_value_temp+1,lo			;day
+	output_99x
+	bcf		leftbind
+	return
+
+TFT_convert_date_short1:
+	decfsz	EEDATA,F
+	bra		TFT_convert_date_short_common	; EEDATA was 2 -> Use YYMMDD
+; EEDATA was 1
+; Use DDMMYY
+	movff	convert_value_temp+1,lo			;day
+	bsf		leftbind
+	output_99x
+    PUTC    '.'
+	movff	convert_value_temp+0,lo			;month
+	output_99x
+	bcf		leftbind
+	return
+
+;=============================================================================
+
+	global	TFT_date
+TFT_date:
+    WIN_TINY   surf_date_column,surf_date_row				; Init new Wordprocessor
+	call	TFT_standard_color
+	lfsr	FSR2,buffer
+	movff	month,convert_value_temp+0
+	movff	day,convert_value_temp+1
+	movff	year,convert_value_temp+2
+	call	TFT_convert_date		; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2	
+	STRCAT_PRINT ""
+	return
+
+;=============================================================================
+
+	global	TFT_max_pressure
+TFT_max_pressure:
+	btfsc	FLAG_apnoe_mode						; different display in apnoe mode
+	bra		TFT_max_pressure_apnoe
+TFT_max_pressure2:
+    SAFE_2BYTE_COPY max_pressure, lo
+TFT_max_pressure3:
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+    TSTOSS  opt_units   			; 0=m, 1=ft
+	bra		TFT_max_pressure2_metric
+;TFT_max_pressure2_imperial
+	call	convert_mbar_to_feet              	; convert value in lo:hi from mbar to feet
+	WIN_MEDIUM	max_depth_feet_column,max_depth_feet_row
+	lfsr	FSR2,buffer
+	call	TFT_standard_color
+	output_16_3
+	STRCAT_PRINT ""
+	return
+
+TFT_max_pressure2_metric:
+	WIN_MEDIUM	max_depth_column,max_depth_row
+	lfsr	FSR2,buffer
+	call	TFT_standard_color
+	bsf		ignore_digit4			; no 0.1m
+	output_16
+	STRCAT_PRINT ""
+	return
+
+TFT_max_pressure_apnoe:
+	btfss	FLAG_active_descent				; Are we descending?			
+	bra		TFT_max_pressure2				; Yes, show normal max.
+	SAFE_2BYTE_COPY apnoe_max_pressure, lo
+	bra		TFT_max_pressure3				; Show apnoe_max_pressure as max. depth
+
+	global	TFT_display_apnoe_last_max
+TFT_display_apnoe_last_max:
+    call    TFT_divemask_color
+    WIN_TINY    last_max_apnoe_text_column,last_max_apnoe_text_row
+    STRCPY_TEXT_PRINT   tApnoeMax
+
+	call	TFT_standard_color
+	SAFE_2BYTE_COPY max_pressure, lo
+    call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
+    TSTOSS  opt_units   			; 0=m, 1=ft
+	bra		TFT_display_apnoe_last_m_metric
+;TFT_display_apnoe_last_max_imperial
+	call	convert_mbar_to_feet              	; convert value in lo:hi from mbar to feet
+	WIN_MEDIUM	apnoe_last_max_depth_column,apnoe_last_max_depth_row
+	lfsr	FSR2,buffer
+	output_16
+	STRCAT_PRINT ""
+	return
+
+TFT_display_apnoe_last_m_metric:
+	WIN_MEDIUM	apnoe_last_max_depth_column,apnoe_last_max_depth_row
+	lfsr	FSR2,buffer
+	bsf		ignore_digit5		; do not display 1cm depth
+	output_16dp	d'3'
+	STRCAT_PRINT ""
+	return
+
+;=============================================================================
+	global	TFT_divemins
+TFT_divemins:
+	movff	divemins+0,lo
+	movff	divemins+1,hi
+
+	btfsc	no_more_divesecs		; Ignore seconds?
+	bra     TFT_divemins2           ; Show minutes only
+
+	movlw	.99
+	cpfsgt	lo                      ; bigger then 99?
+	bra		TFT_divemins1           ; No show mins:secs
+	; Yes, remove second display for the rest of the dive and clear seconds
+	bsf		no_more_divesecs        ; Set flag
+	; Clear rest of seconds
+	WIN_BOX_BLACK   divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right
+    bra     TFT_divemins2           ; Show minutes only
+
+TFT_divemins1:
+	WIN_MEDIUM	divetime_column, divetime_row
+	lfsr	FSR2,buffer
+	output_16_3                     ; displays only last three figures from a 16Bit value (0-999)
+	call	TFT_standard_color
+	STRCAT_PRINT ""                 ; Show minutes in large font
+
+	WIN_SMALL  divetime_secs_column, divetime_secs_row   		; left position for two sec figures
+	lfsr    FSR2,buffer
+	PUTC    ':'
+	bsf		leftbind
+	movff   divesecs,lo
+	output_99x
+	bcf     leftbind
+	STRCAT_PRINT ""                 ; Show seconds in small font
+	return
+
+TFT_divemins2:
+	WIN_MEDIUM	divetime_minsonly_column, divetime_row
+	lfsr	FSR2,buffer
+	output_16
+	call	TFT_standard_color
+	STRCAT_PRINT ""                 ; Show minutes in large font
+    return
+
+;=============================================================================
+	global	TFT_display_apnoe_surface
+TFT_display_apnoe_surface:
+    call    TFT_divemask_color
+    WIN_TINY    surface_apnoe_text_column,surface_apnoe_text_row
+    STRCPY_TEXT_PRINT   tApnoeSurface
+
+	call	TFT_standard_color
+	WIN_MEDIUM	surface_time_apnoe_column, surface_time_apnoe_row
+	movff	apnoe_surface_mins,lo
+	lfsr	FSR2,buffer
+	output_8
+    PUTC    ':'
+	movff	apnoe_surface_secs,lo
+	output_99x
+	STRCAT_PRINT ""
+	return
+
+	global	TFT_apnoe_clear_surface
+TFT_apnoe_clear_surface:
+	; Clear Surface timer....
+	WIN_BOX_BLACK   surface_apnoe_text_row, .239, surface_apnoe_text_column, .159                 ;top, bottom, left, right
+	return
+
+	global	TFT_display_apnoe_descent
+TFT_display_apnoe_descent:		; Descent divetime
+	movff	apnoe_mins,lo
+    clrf    hi
+	WIN_MEDIUM	divetime_column, divetime_row
+	lfsr	FSR2,buffer
+	output_16_3                     ; displays only last three figures from a 16Bit value (0-999)
+	call	TFT_standard_color
+	STRCAT_PRINT ""                 ; Show minutes in large font
+
+	WIN_SMALL  divetime_secs_column, divetime_secs_row   		; left position for two sec figures
+	lfsr    FSR2,buffer
+	PUTC    ':'
+	bsf		leftbind
+	movff	apnoe_secs,lo
+	output_99x
+	bcf     leftbind
+	STRCAT_PRINT ""                 ; Show seconds in small font
+	return
+	
+;=============================================================================
+; Writes ostc3 #Serial and Firmware version in splash screen
+;
+	global	TFT_serial
+TFT_serial:		
+    WIN_TINY	.0,.239-.14
+    
+    STRCPY  "OSTC3 #"                    ; Won't translate that...
+    rcall   TFT_cat_serial
+    
+    STRCAT  " v"
+    rcall   TFT_cat_firmware
+
+    ifdef __DEBUG
+        movlw   color_grey              ; Write header in blue when
+        call    TFT_set_color           ; compiled in DEBUG mode...
+        STRCAT_PRINT "DEBUG"    
+        call	TFT_standard_color
+    else
+        call	TFT_standard_color
+        STRCAT_PRINT ""
+        
+        movlw	softwareversion_beta    ; =1: Beta, =0: Release
+        decfsz	WREG,F
+        return                          ; Release version -> Return
+        
+        call	TFT_warnings_color
+        WIN_LEFT    .160-4*9/2          ; Right pad.
+        STRCPY_TEXT_PRINT tBeta
+        call	TFT_standard_color
+    endif
+
+	return
+
+	
+
+;=============================================================================
+; For the Information menu: append firmware x.yy version.
+    global info_menu_firmware
+    extern  tFirmware
+info_menu_firmware:
+    lfsr    FSR1,tFirmware
+    call    strcat_text
+TFT_cat_firmware:
+    movlw	softwareversion_x
+    movwf	lo
+    bsf		leftbind
+    output_8
+    PUTC    '.'
+    movlw	softwareversion_y
+    movwf	lo
+    output_99x
+    bcf		leftbind
+    return
+
+;-----------------------------------------------------------------------------
+; For the Information menu: append serial number ostc3#42.
+    global  info_menu_serial
+    extern  tSerial
+info_menu_serial:
+    lfsr    FSR1,tSerial
+    call    strcat_text
+TFT_cat_serial:
+    clrf	EEADRH
+    clrf	EEADR                       ; Get Serial number LOW
+    call	read_eeprom                 ; read byte
+    movff	EEDATA,lo
+    incf	EEADR,F                     ; Get Serial number HIGH
+    call	read_eeprom                 ; read byte
+    movff	EEDATA,hi
+
+    bsf		leftbind
+    output_16
+    bcf		leftbind
+    return
+
+;-----------------------------------------------------------------------------
+; For the Information menu: Append total dives
+    global  info_menu_total_dives
+    extern  tTotalDives
+info_menu_total_dives:
+    lfsr    FSR1,tTotalDives
+    call    strcat_text
+TFT_cat_total_dives:
+	read_int_eeprom	.2
+	movff	EEDATA,lo
+	read_int_eeprom	.3
+	movff	EEDATA,hi
+	bsf		leftbind
+	output_16
+    bcf		leftbind
+    return
+
+;-----------------------------------------------------------------------------
+; ppO2 menu
+	global	divesets_ppo2_max
+    extern  tPPO2Max
+    extern  tbar
+divesets_ppo2_max:
+    lfsr    FSR1,tPPO2Max
+    call    strcat_text
+	movff	opt_ppO2_max,lo
+    movlw   ppo2_warning_high
+divesets_ppo2_common:
+    movwf   up                  ; Save default value
+	clrf	hi
+	bsf		leftbind
+	output_16dp d'3'
+    bcf		leftbind
+    lfsr    FSR1,tbar
+    call    strcat_text
+
+    movf    up,W                ; Default value
+    cpfseq  lo                  ; Current value
+    bra     divesets_ppo2_common2 ; Not default, add *
+    return                      ; Default, Done.
+divesets_ppo2_common2:
+    PUTC    "*"
+    return                      ; Done.
+
+	global	divesets_ppo2_min
+    extern  tPPO2Min
+divesets_ppo2_min:
+    lfsr    FSR1,tPPO2Min
+    call    strcat_text
+	movff	opt_ppO2_min,lo
+    movlw   ppo2_warning_low
+    bra     divesets_ppo2_common
+
+;=============================================================================
+
+    global  TFT_clear_warning_text
+TFT_clear_warning_text:
+    btfss   divemode                            ; in divemode?
+    bra     TFT_clear_warning_text2             ; No, setup for surface mode
+    WIN_BOX_BLACK   warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3	;top, bottom, left, right
+    return
+TFT_clear_warning_text2:
+    WIN_BOX_BLACK   surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76     ;top, bottom, left, right
+    return
+
+    global  TFT_clear_warning_text_2nd_row
+TFT_clear_warning_text_2nd_row:
+    btfss   divemode                            ; in divemode?
+    bra     TFT_clear_warning_text_2nd_2        ; No, setup for surface mode
+    WIN_BOX_BLACK   warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3	;top, bottom, left, right
+    return
+TFT_clear_warning_text_2nd_2:
+    WIN_BOX_BLACK   surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76     ;top, bottom, left, right
+    return
+
+    global  TFT_fillup_with_spaces
+TFT_fillup_with_spaces:         ; Fillup FSR2 with spaces (Total string length in #WREG)
+    movwf   lo                  ; save max. string length into lo
+    movf    FSR2L,W             ; Get current string length
+    subwf   lo,F                ; lo-WREG
+    btfsc   STATUS,N            ; longer then #lo already?
+    return                      ; Yes, done.
+    tstfsz  lo                  ; Zero?
+    bra     TFT_fillup_with_spaces2 ; No.
+    return                      ; Yes, done.
+TFT_fillup_with_spaces2:
+    PUTC    " "                 ; Add one space
+    decfsz  lo,F                ; All done?
+    bra     TFT_fillup_with_spaces2 ; No, loop
+    return                      ; Done.
+
+	global	TFT_desaturation_time
+TFT_desaturation_time:
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+	STRCPY	"Desat:"
+	movff		desaturation_time+0,lo			; divide by 60...
+	movff		desaturation_time+1,hi
+	call		convert_time				; converts hi:lo in minutes to hours (hi) and minutes (lo)
+	bsf			leftbind
+	movf		lo,W
+	movff		hi,lo
+	movwf		hi							; exchange lo and hi...
+	output_8								; Hours
+	PUTC        ':'
+	movff		hi,lo						; Minutes
+	output_99x
+	bcf		leftbind
+    movlw   surf_warning_length             ; Only use surface string length
+    rcall   TFT_fillup_with_spaces          ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT	""
+	return
+
+	global	TFT_nofly_time
+TFT_nofly_time:
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+	STRCPY	"NoFly:"
+	movff		nofly_time+0,lo			; divide by 60...
+	movff		nofly_time+1,hi
+	call		convert_time			; converts hi:lo in minutes to hours (hi) and minutes (lo)
+	bsf			leftbind
+	movf		lo,W
+	movff		hi,lo
+	movwf		hi							; exchange lo and hi...
+	output_8							; Hours
+	PUTC        ':'
+	movff		hi,lo					; Minutes
+	output_99x
+	bcf		leftbind
+    movlw   surf_warning_length         ; Only use surface string length
+    rcall   TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT	""
+	return
+
+    global  TFT_warning_agf
+TFT_warning_agf:
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+    call	TFT_warnings_color
+	STRCPY_TEXT tDiveaGF_active         ; "aGF!"
+    movlw   warning_length              ; Divemode string length
+    rcall   TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+    STRCAT_PRINT ""
+	call	TFT_standard_color
+    return
+
+    global  TFT_warning_gf
+TFT_warning_gf:                         ;GF
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+	TFT_color_code		warn_gf		; Color-code Output
+	STRCPY  "GF:"
+	movff	char_O_gradient_factor,lo		; gradient factor
+    bsf     leftbind
+	output_8
+    PUTC    "%"
+    movlw   warning_length              ; Divemode string length
+    btfss   divemode                    ; In Divemode?
+    movlw   surf_warning_length         ; No, use surface string length
+    rcall   TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+    STRCAT_PRINT  ""
+    bcf     leftbind
+	call	TFT_standard_color
+	return
+
+TFT_warning_set_window:                 ; Sets the row and column for the current warning
+    ; ignore warning (now)?
+    decf    warning_counter,W           ; -1
+    bcf     STATUS,C
+    rrcf    WREG,W                      ; (warning_counter-1)/2
+    cpfseq  warning_page
+    retlw   .255                        ; WREG <> 0 -> Warning window not defined
+
+    call	TFT_standard_color
+
+    btfss   divemode                    ; in divemode?
+    bra     TFT_warning_set_window3     ; No, setup for surface mode
+
+    btfss   warning_counter,0           ; Toggle with each warning
+	bra		TFT_warning_set_window2
+	WIN_SMALL	warning1_column,warning1_row
+    bcf     second_row_warning          ; =1: The second row contains a warning
+	retlw   .0                          ; WREG=0 -> Warning window defined
+TFT_warning_set_window2:
+	WIN_SMALL	warning2_column,warning2_row
+    bsf     second_row_warning          ; =1: The second row contains a warning
+	retlw   .0                          ; WREG=0 -> Warning window defined
+
+TFT_warning_set_window3:
+    btfss   warning_counter,0           ; Toggle with each warning
+	bra		TFT_warning_set_window4
+    WIN_SMALL	surf_warning1_column,surf_warning1_row
+    bcf     second_row_warning          ; =1: The second row contains a warning
+	retlw   .0                          ; WREG=0 -> Warning window defined
+TFT_warning_set_window4:
+	WIN_SMALL	surf_warning2_column,surf_warning2_row
+    bsf     second_row_warning          ; =1: The second row contains a warning
+	retlw   .0                          ; WREG=0 -> Warning window defined
+
+
+	global	TFT_update_batt_percent_divemode
+TFT_update_batt_percent_divemode:
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+    movff   batt_percent,lo         ; Get battery percent
+    TFT_color_code		warn_battery; Color-code battery percent
+    STRCPY  "Batt:"
+	bsf		leftbind
+	output_8
+	bcf		leftbind
+    PUTC    "%"
+    movlw   warning_length              ; Divemode string length
+    btfss   divemode                    ; In Divemode?
+    movlw   surf_warning_length         ; No, use surface string length
+    rcall   TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT	""
+	call	TFT_standard_color
+	return
+
+
+    global  TFT_gf_mask                         ; Setup Mask
+TFT_gf_mask:
+    ; The mask
+    call    TFT_divemask_color
+    WIN_TINY  dive_gf_column1,dive_gf_text_row
+    STRCPY_TEXT_PRINT tGFactors
+    WIN_TINY  dive_gf_column2,dive_gf_text_row
+    STRCPY_TEXT_PRINT taGFactors
+    WIN_TINY  dive_gf_column3,dive_gf_text_row
+    STRCPY_TEXT_PRINT tGFInfo
+
+    ; Show GF (Static)
+    call    TFT_disabled_color
+    btfss   use_agf
+    call	TFT_standard_color
+
+    WIN_STD   dive_gf_column,dive_gf_row
+    lfsr	FSR2,buffer
+    bsf     leftbind
+    movff   opt_GF_low,lo
+    output_8
+    PUTC    "/"
+    movff   opt_GF_high,lo
+    output_8
+    STRCAT_PRINT   ""
+    ; Show aGF (Static)
+    call	TFT_standard_color
+    TSTOSS  opt_enable_aGF              ; =1: aGF can be selected underwater
+    bra     TFT_gf_mask2                ; Show "---" instead
+
+    btfss   use_agf
+    call    TFT_disabled_color
+
+    WIN_STD   dive_agf_column,dive_agf_row
+    lfsr	FSR2,buffer
+    movff   opt_aGF_low,lo
+    output_8
+    PUTC    "/"
+    movff   opt_aGF_high,lo
+    output_8
+    STRCAT_PRINT   ""
+    bcf     leftbind
+    call	TFT_standard_color
+    return
+
+TFT_gf_mask2:
+    WIN_STD   dive_agf_column+.10,dive_agf_row
+    STRCPY_PRINT   "---"
+    bcf     leftbind
+    return
+
+    global  TFT_gf_info                         ; Show GF informations
+TFT_gf_info:
+    ; Show current GF
+	movff	char_O_gradient_factor,lo			; gradient factor absolute (Non-GF model)
+	movff	char_I_deco_model,hi
+	decfsz	hi,F		; jump over next line if char_I_deco_model == 1
+	movff	char_O_relative_gradient_GF,lo		; gradient factor relative (GF model)
+    WIN_STD   dive_currentgf_column,dive_currentgf_row
+    lfsr	FSR2,buffer
+    output_8
+    STRCAT_PRINT   "%"
+    return
+
+    global  TFT_ead_end_tissues_clock_mask      ; Setup Mask
+TFT_ead_end_tissues_clock_mask:
+    ; The mask
+    call    TFT_divemask_color
+    ; Put three columns at HUD positions
+    WIN_TINY  dive_custom_hud_column1,dive_custom_hud_row
+    STRCPY_TEXT_PRINT tDiveClock
+    WIN_TINY  dive_custom_hud_column2,dive_custom_hud_row
+    STRCPY_TEXT_PRINT tDiveEAD_END
+    WIN_TINY  dive_custom_hud_column3,dive_custom_hud_row
+    STRCPY_TEXT_PRINT tDiveTissues
+    call	TFT_standard_color
+    return
+
+    global  TFT_ead_end_tissues_clock           ; Show EAD/END, Tissues and clock
+TFT_ead_end_tissues_clock:
+    ; Update clock and date
+    WIN_SMALL   dive_clock_column,dive_clock_row
+    call    TFT_clock2                          ; print clock
+;    WIN_SMALL   dive_date_column,dive_date_row
+;	lfsr	FSR2,buffer
+;	movff	month,convert_value_temp+0
+;	movff	day,convert_value_temp+1
+;	movff	year,convert_value_temp+2
+;    rcall    TFT_convert_date_short              ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2
+;	STRCAT_PRINT "."
+
+    ; Show END/EAD
+    WIN_SMALL   dive_ead_column,dive_ead_row
+    STRCPY_TEXT tEAD                            ; EAD:
+    movff   char_O_EAD,lo
+    rcall   TFT_end_ead_common                  ; print "lo m" (or ft) and limit to 8 chars
+    WIN_SMALL   dive_end_column,dive_end_row
+    STRCPY_TEXT tEND                            ; END:
+    movff   char_O_END,lo
+    rcall   TFT_end_ead_common                  ; print "lo m" (or ft) and limit to 8 chars
+
+    ; Show tissue diagram
+    call    TFT_divemask_color
+    WIN_TINY    dive_tissue_N2_column,dive_tissue_N2_row
+    STRCPY_TEXT_PRINT   tN2
+    WIN_TINY    dive_tissue_He_column,dive_tissue_He_row
+    STRCPY_TEXT_PRINT   tHe
+ 	call    deco_calc_desaturation_time         ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation)
+	movlb	b'00000001'                         ; select ram bank 1
+    rcall   DISP_tissue_saturation_graph        ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation
+    return
+
+TFT_end_ead_common:           ; print "lo m" (or ft) and limit to 8 chars
+    bsf     leftbind
+    TSTOSS  opt_units			; 0=Meters, 1=Feets
+	bra		TFT_end_ead_common_metric
+;TFT_end_ead_common_imperial:
+    ; With lo in m
+    movf    lo,W
+	mullw	.100							; PRODL:PRODH = mbar/min
+	movff	PRODL,lo
+	movff	PRODH,hi
+	call	convert_mbar_to_feet			; convert value in lo:hi from mbar to feet
+    output_16_3
+    STRCAT_TEXT     tFeets
+    clrf    WREG
+    movff   WREG,buffer+.8                  ; limit string length to 8
+    bra     TFT_end_ead_common_exit
+TFT_end_ead_common_metric:
+    output_8
+    STRCAT_TEXT     tMeters
+TFT_end_ead_common_exit:
+    bcf     leftbind
+    movlw   .8
+    rcall   TFT_fillup_with_spaces          ; Fillup FSR2 with spaces (Total string length in #WREG)
+    STRCAT_PRINT    ""
+    return
+
+    global  TFT_surface_tissues
+TFT_surface_tissues:             ; Show Tissue diagram in surface mode
+    WIN_SMALL    surf_tissue_N2_column,surf_tissue_N2_row
+    STRCPY_TEXT_PRINT   tN2
+    WIN_SMALL    surf_tissue_He_column,surf_tissue_He_row
+    STRCPY_TEXT_PRINT   tHe
+
+ 	call    deco_calc_desaturation_time         ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation)
+	movlb	b'00000001'                         ; select ram bank 1
+
+    movlw       color_deepblue
+	call		TFT_set_color				; Make this configurable?
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77
+    WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85
+    WIN_FRAME_STD   surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right    ; outer frame
+
+	movlw	.1
+	movff	WREG,win_height             ; row bottom (0-239)
+    movlw   surf_tissue_diagram_left+.4      ; Surface mode
+	movff	WREG,win_leftx2             ; column left (0-159)
+	movlw	surf_tissue_diagram_right-surf_tissue_diagram_left-4  ; Width
+	movff   WREG,win_width
+
+    ;---- Draw N2 Tissues
+	lfsr	FSR2, char_O_tissue_N2_saturation
+	movlw	d'16'
+	movwf	wait_temp                   ; 16 tissues
+	clrf	waitms_temp                 ; Row offset
+surf_tissue_saturation_graph_N2:
+    movlw   surf_tissue_diagram_top+.23 ; surface mode
+	addwf	waitms_temp,W
+	movff	WREG,win_top                ; row top (0-239)
+    rcall   surf_tissue_saturation_loop    ; Show one tissue
+	decfsz	wait_temp,F
+	bra		surf_tissue_saturation_graph_N2
+
+    ;---- Draw He Tissues ----------------------------------------------------
+	lfsr	FSR2, char_O_tissue_He_saturation
+	movlw	d'16'
+	movwf	wait_temp                   ; 16 tissues
+	clrf	waitms_temp                 ; Row offset
+surf_tissue_saturation_graph_He:
+    movlw   surf_tissue_diagram_top+.23+.56    ; surface mode
+	addwf	waitms_temp,W
+	movff	WREG,win_top                ; row top (0-239)
+    rcall   surf_tissue_saturation_loop    ; Show one tissue
+	decfsz	wait_temp,F
+	bra		surf_tissue_saturation_graph_He
+    return
+
+surf_tissue_saturation_loop:
+    call	TFT_standard_color
+    movlw   .2                          ; row spacing
+	addwf   waitms_temp,F
+	movf	POSTINC2,W                  ; Get tissue load
+    bcf		STATUS,C
+	rrcf	WREG                        ; And divide by 2
+	movwf   temp1
+    movlw   .20
+    subwf   temp1,F                     ; Subtract some offset
+	movff   win_width,WREG              ; Max width.
+	cpfslt	temp1                       ; skip if WREG < win_width
+	movwf	temp1
+	movff   temp1,win_bargraph
+	call	TFT_box
+    return
+
+;=============================================================================
+; Draw saturation graph, is surface mode or in dive mode.
+DISP_tissue_saturation_graph:
+    ;---- Draw Frame
+    WIN_FRAME_STD   tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159    ; outer frame
+
+	movlw	.1
+	movff	WREG,win_height             ; row bottom (0-239)
+    movlw   tissue_diagram_left+.3      ; divemode
+	movff	WREG,win_leftx2             ; column left (0-159)
+	movlw	.159-tissue_diagram_left-4  ; Width
+	movff   WREG,win_width
+
+    ;---- Draw N2 Tissues
+	lfsr	FSR2, char_O_tissue_N2_saturation
+	movlw	d'16'
+	movwf	wait_temp                   ; 16 tissues
+	clrf	waitms_temp                 ; Row offset
+tissue_saturation_graph_N2:
+    movlw   tissue_diagram_top+3        ; divemode
+	addwf	waitms_temp,W
+	movff	WREG,win_top                ; row top (0-239)
+    rcall   tissue_saturation_graph_loop    ; Show one tissue
+	decfsz	wait_temp,F
+	bra		tissue_saturation_graph_N2
+
+    ;---- Draw He Tissues ----------------------------------------------------
+	lfsr	FSR2, char_O_tissue_He_saturation
+	movlw	d'16'
+	movwf	wait_temp                   ; 16 tissues
+	clrf	waitms_temp                 ; Row offset
+tissue_saturation_graph_He:
+    movlw   tissue_diagram_top+3+.22    ; divemode
+	addwf	waitms_temp,W
+	movff	WREG,win_top                ; row top (0-239)
+
+    rcall   tissue_saturation_graph_loop    ; Show one tissue
+
+	decfsz	wait_temp,F
+	bra		tissue_saturation_graph_He
+	return
+
+tissue_saturation_graph_loop:
+    call	TFT_standard_color
+	incf	waitms_temp,F
+	movf	POSTINC2,W
+	bcf		STATUS,C
+	rrcf	WREG
+    bcf		STATUS,C
+	rrcf	WREG                        ; And divide by 4
+	movwf   temp1
+    movlw   .12
+    subwf   temp1,F                     ; Subtract some offset
+	movff   win_width,WREG              ; Max width.
+	cpfslt	temp1                       ; skip if WREG < win_width
+	movwf	temp1
+	movff   temp1,win_bargraph
+	call	TFT_box
+    return
+
+	global	TFT_display_cns
+TFT_display_cns:
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+	TFT_color_code		warn_cns		; Color-code CNS output
+	STRCPY_TEXT tCNS2                   ; CNS:
+	movff	int_O_CNS_fraction+0,lo
+    movff	int_O_CNS_fraction+1,hi
+	bsf		leftbind
+	output_16_3					;Displays only 0...999
+	bcf		leftbind
+    PUTC    "%"
+    movlw   warning_length              ; Divemode string length
+    btfss   divemode                    ; In Divemode?
+    movlw   surf_warning_length         ; No, use surface string length
+    rcall   TFT_fillup_with_spaces          ; Fillup FSR2 with spaces (Total string length in #WREG)
+	STRCAT_PRINT ""
+	call	TFT_standard_color
+	return
+
+	global	TFT_display_ppo2
+TFT_display_ppo2:                       ; Show ppO2 (ppO2 stored in xC, in mbar!)
+	rcall	TFT_warning_set_window		; Sets the row and column for the current warning
+    tstfsz  WREG                        ; Is there room for the warning?
+    return                              ; No
+	TFT_color_code		warn_ppo2		; Color-code output (ppO2 stored in xC)
+    STRCPY  "O2:"
+; Check very high ppO2 manually
+	tstfsz	xC+2                        ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
+	bra		TFT_show_ppO2_3             ; Yes, display fixed Value!
+	movff	xC+0,lo
+	movff	xC+1,hi
+	bsf		ignore_digit4
+	output_16dp	d'1'
+TFT_show_ppO2_2:
+    movlw   warning_length              ; Divemode string length
+    rcall   TFT_fillup_with_spaces      ; Fillup FSR2 with spaces (Total string length in #WREG)
+    STRCAT_PRINT ""
+	call	TFT_standard_color
+	return
+
+TFT_show_ppO2_3:
+    STRCAT  ">6.6"
+	bra		TFT_show_ppO2_2
+
+
+	global	TFT_LogOffset_Logtitle
+TFT_LogOffset_Logtitle:
+	STRCPY_TEXT tLogOffset
+	PUTC	":"
+	call	do_logoffset_common_read	; Offset into lo:hi
+	bsf		leftbind
+	output_16
+	bcf		leftbind
+	PUTC	" "
+	return			; No "_PRINT" here...
+	
+
+	global	adjust_depth_with_salinity
+adjust_depth_with_salinity:			; computes salinity setting into lo:hi [mbar]
+	btfsc	simulatormode_active	; Do apply salinity in Simulatormode
+	return
+
+    movff   opt_salinity,WREG       ; 0-5%
+	addlw	d'100'                  ; 1.00kg/l
+	movwf	wait_temp
+	
+	movlw	d'105'					; 105% ?
+	cpfslt	wait_temp				; Salinity higher limit
+	return							; Out of limit, do not adjust lo:hi
+	movlw	d'99'					; 99% ?
+	cpfsgt	wait_temp				; Salinity lower limit
+	return							; Out of limit, do not adjust lo:hi
+
+	movff	lo,xA+0
+	movff	hi,xA+1
+
+	movlw	d'102'					; 0,98bar/10m
+	movwf	xB+0
+	clrf	xB+1
+	call	mult16x16				;xA*xB=xC (lo:hi * 100)
+	movff	wait_temp,xB+0			; Salinity
+	clrf	xB+1
+	call	div32x16  				; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+	movff	xC+1,hi					; restore lo and hi with updated value
+	return
+
+	global	convert_mbar_to_feet   	; convert value in lo:hi from mbar to feet
+convert_mbar_to_feet:              	; convert value in lo:hi from mbar to feet
+	movff	lo,xA+0
+	movff	hi,xA+1
+
+	movlw	LOW 	d'328'          ; 328feet/100m
+	movwf	xB+0
+	movlw	HIGH 	d'328'
+	movwf	xB+1
+
+	call	mult16x16			    ; xA*xB=xC (lo:hi * 328)
+
+	movlw	d'50'                   ; round up
+	addwf	xC+0,F
+	movlw	0
+	addwfc	xC+1,F
+	addwfc	xC+2,F
+	addwfc	xC+3,F
+
+    movlw   LOW  .10000
+    movwf   xB+0
+    movlw   HIGH .10000
+    movwf   xB+1
+
+	call	div32x16  			    ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+
+	movff	xC+0,lo
+	movff	xC+1,hi				    ; restore lo and hi with updated value
+	return
+
+	global	convert_celsius_to_fahrenheit	; convert value in lo:hi from celsius to fahrenheit
+convert_celsius_to_fahrenheit:		; convert value in lo:hi from celsius to fahrenheit
+	; Does it work with signed temperature? mH
+	movff	lo,xA+0
+	movff	hi,xA+1
+
+	movlw	d'18'                   ; 1C = 1.8F
+	movwf	xB+0
+	clrf	xB+1
+
+	call	mult16x16               ;xA*xB=xC (lo:hi * 18)
+
+	movlw	d'10'
+	movwf	xB+0
+	clrf	xB+1
+
+	call	div32x16                ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+
+    movlw	LOW d'320'              ; 0C = 32F
+	addwf	xC+0,F
+	movlw	HIGH d'320'
+	addwfc	xC+1,F
+
+	movff	xC+0,lo
+	movff	xC+1,hi                 ; restore lo and hi with updated value
+	return
+
+	END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tft_outputs.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,102 @@
+;=============================================================================
+;
+;   File tft_outputs.inc
+;
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-08-07 : [mH] moving from OSTC code
+
+; Macros
+	extern	TFT_color_code1
+TFT_color_code macro color_code_temp
+	movlw	color_code_temp
+	call	TFT_color_code1
+	endm
+
+; Surface mode
+	extern	TFT_serial
+	extern	TFT_clock
+	extern	TFT_date
+	extern	TFT_desaturation_time
+	extern	TFT_nofly_time
+    extern  TFT_interval
+	extern	TFT_gaslist_surfmode
+    extern  TFT_dillist_surfmode
+    extern  TFT_splist_surfmode             ; Show Setpoint list
+	extern	TFT_temp_surfmode
+	extern	TFT_update_batt_voltage
+	extern	TFT_display_decotype_surface
+    extern  TFT_display_decotype_surface1   ; Used from logbook!
+	extern	TFT_update_surf_press
+    extern  TFT_surface_hud             ; Update HUD data in surface mode
+;	extern	TFT_user_image
+;    extern  TFT_clear_customview_surfacemode
+    extern  TFT_menu_hud                ; Update HUD data in menu (including mV)
+    extern  TFT_custom_text             ; The custom text
+    extern  TFT_surface_tissues         ; Show Tissue diagram in surface mode
+    extern  TFT_surface_compass_mask    ; Compass heading mask
+    extern  TFT_surface_compass_heading ; Compass heading value
+
+; Menu
+	extern	TFT_LogOffset_Logtitle
+
+; Debug and useless stuff
+	extern	TFT_update_raw_data
+    extern  TFT_compass_fast
+
+; Dive mode
+	extern	TFT_display_cns
+	extern	TFT_divemins
+	extern	TFT_depth
+	extern	TFT_temp_divemode
+	extern	TFT_max_pressure
+	extern	TFT_active_gas_divemode
+	extern	TFT_divemode_mask
+	extern	TFT_display_ndl_mask
+	extern	TFT_show_TTS_divemode
+	extern	TFT_display_ndl
+	extern	TFT_display_deko_mask
+	extern	TFT_divemode_warning
+	extern	TFT_divemode_warning_clear
+	extern	TFT_display_velocity_clear
+	extern	TFT_display_velocity
+	extern 	TFT_clear_customview_divemode
+	extern	TFT_display_deko
+	extern	TFT_display_ppo2
+	extern	TFT_update_batt_percent_divemode
+	extern	TFT_display_apnoe_descent
+	extern	TFT_apnoe_clear_surface
+	extern	TFT_display_apnoe_surface
+	extern	TFT_display_apnoe_last_max
+	extern	TFT_ftts
+    extern  TFT_clear_warning_text
+    extern  TFT_clear_warning_text_2nd_row
+    extern  TFT_warning_gf
+    extern  TFT_update_hud                      ; Update HUD data
+    extern  TFT_hud_mask                        ; The HUD mask
+    extern  TFT_mask_avr_stopwatch              ; Show mask for average depth and stopwatch
+    extern  TFT_update_avr_stopwatch            ; Update average depth and stopwatch
+    extern  TFT_decoplan                        ; Decoplan
+    extern  TFT_clear_divemode_menu             ; Clear the divemode menu
+    extern  TFT_divemode_menu_cursor            ; the divemode cursor
+    extern  TFT_ead_end_tissues_clock_mask      ; Setup Mask
+    extern  TFT_ead_end_tissues_clock           ; Show EAD/END, Tissues and clock
+    extern  TFT_gf_mask                         ; Setup Mask
+    extern  TFT_gf_info                         ; Show GF informations
+    extern  TFT_warning_agf                     ; Show a warning if aGF is selected
+    extern  TFT_dive_compass_mask               ; Compass mask
+    extern  TFT_dive_compass_heading            ; Compass heading
+
+; Misc
+	extern	TFT_standard_color
+    extern  TFT_disabled_color
+	extern	adjust_depth_with_salinity
+	extern	TFT_convert_date_short
+	extern	TFT_convert_signed_16bit
+	extern	TFT_convert_date
+	extern	TFT_debug_output
+	extern	TFT_show_time_date_menu
+	extern	convert_mbar_to_feet   			; convert value in lo:hi from mbar to feet
+	extern	convert_celsius_to_fahrenheit	; convert value in lo:hi from celsius to fahrenheit
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/varargs.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,63 @@
+;=============================================================================
+;
+;    File varargs.inc
+;
+;    Utilities to pass multiple arguments in compact code stream.
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;  2011-05-27 : [jDG] Creation.
+;
+
+VARARGS_BEGIN   macro
+        movff   TOSL, TBLPTRL
+        movff   TOSH, TBLPTRH
+        movff   TOSU, TBLPTRU
+        endm
+
+VARARGS_GET8    macro   register
+        tblrd*+
+        movff   TABLAT, register
+        endm
+
+VARARGS_GET16   macro   register
+        tblrd*+
+        movff   TABLAT, register+0
+        tblrd*+
+        movff   TABLAT, register+1
+        endm
+
+VARARGS_GET24   macro   register
+        tblrd*+
+        movff   TABLAT, register+0
+        tblrd*+
+        movff   TABLAT, register+1
+        tblrd*+
+        movff   TABLAT, register+2
+        endm
+
+VARARGS_ALIGN   macro
+        local   no_tblptr_align
+
+        btfss   TBLPTRL,0
+        bra     no_tblptr_align
+        incf    TBLPTRL
+        movlw   0
+        addwfc  TBLPTRH
+        addwfc  TBLPTRU
+no_tblptr_align:
+        endm
+
+VARARGS_END macro
+        ; Compute string length (modulo 256):
+        movf    TOSL,W
+        subwf   TBLPTRL,W
+        
+		; Then 24bit add to return address
+		addwf	TOSL,F
+		movlw	0			            ; Clear WREG, but keep carry
+		addwfc	TOSH,F
+		addwfc	TOSU,F
+		endm
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wait.asm	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,37 @@
+;=============================================================================
+;
+;   File wait.asm
+;
+;  Wait routines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2004-01-31 : [chsw] Initial version.
+;   2007-05-11 : Updated (OSTC code).
+;   2011-10-18 : [mH] Timings tested with oscilloscope
+	
+#include "ostc3.inc"
+
+basic       CODE
+
+; ==========================================================
+; 	WAIT 1 MILLISECOND   (Not exact: 1,008ms +/- 30,5µs + worst case ISR latency)
+; ==========================================================
+
+            global  WAITMSX
+WAITMSX		movwf	waitms_temp
+			
+WAITMSX2	setf	TMR5H
+			movlw	.255-.32 			;32 x 31,5µs = 1,008ms
+			movwf	TMR5L
+			bcf		PIR5,TMR5IF			; Clear flag
+WAITMSX3	btfss	PIR5,TMR5IF
+			bra		WAITMSX3			; Wait loop
+			decfsz	waitms_temp,F
+			bra		WAITMSX2
+			return
+
+;=============================================================================
+
+            END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wait.inc	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,26 @@
+;=============================================================================
+;
+;   File wait.asm
+;
+;  Wait routines
+;
+;   Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
+;=============================================================================
+; HISTORY
+;   2004-01-31 : [chsw] Initial version.
+;   2007-05-11 : Updated (OSTC code).
+;   2011-06-24 : [MH]  Added clock speeds.
+	
+;=============================================================================
+
+WAITMS		macro	waitms_temp
+			movlw	waitms_temp
+			call    WAITMSX
+			endm
+            extern  WAITMSX
+
+; asm routines in ostc3.asm
+	extern	speed_eco			; SPEED_ECO: 4MHz
+	extern	speed_normal		; SPEED_NORMAL: 16MHz
+	extern	speed_fastest		; SPEED_FASTEST: 64MHz 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/crop_ostc3_hex.bat	Wed Apr 24 19:22:45 2013 +0200
@@ -0,0 +1,3 @@
+:: Crops hex file from MPLAP X to work with Tinybld
+:: Downloaded from http://srecord.sourceforge.net/download.html
+srec_cat ../ostc3_code.X/dist/default/production/ostc3_code.X.production.hex -intel -crop 0x00000 0x1E000 -o o3_tiny.hex -intel
\ No newline at end of file
Binary file tools/srec_cat.exe has changed