annotate src/convert.inc @ 637:cdff88f5a4a0

Battery menu for OSTC plus
author heinrichsweikamp
date Sun, 17 May 2020 09:34:18 +0200
parents 4050675965ea
children 75e90cd0c2c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
3 ; File convert.inc combined next generation V3.09.4l
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Converts register values to string
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, Matthias Heinrichs, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2007-10-07 : [MH] Creation for OSTC sources
heinrichsweikamp
parents:
diff changeset
11 ; 2010-12-10 : [jDG] Optimize macro size
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
12
0
heinrichsweikamp
parents:
diff changeset
13
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
14 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
15 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
16 ; The output format of all 8 and 16 bit integer printing
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
17 ; functions can be controlled with the following flags.
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
18 ; After each printing, the flags are reset automatically.
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
19 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
20 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
21 ; bsf leftbind ; print left-aligned (no leading spaces)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
22 ; bsf leading_zeros ; print leading zeros
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
23 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
24 ; bsf hide_digit5 ; do not print digit 5 (clip output at 9999)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
25 ; bsf hide_digit4 ; do not print digits 5 - 4 (clip output at 999)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
26 ; bsf hide_digit3 ; do not print digits 5 - 3 (clip output at 99)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
27 ; bsf hide_digit2 ; do not print digits 5 - 2 (clip output at 9)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
28 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
29 ; In case the output gets clipped, the flag 'output_overflow' will be set
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
30 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
31 ; bsf omit_digit_2 ; do not print digits 2 - 1 (show output as xxx--)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
32 ; bsf omit_digit_1 ; do not print digit 1 (show output as xxxx-)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
33 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
34 ; bsf decimal_digit3 ; put a decimal point in front of digit 3 (xx.xxx)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
35 ; bsf decimal_digit2 ; put a decimal point in front of digit 2 (xxx.xx)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
36 ; bsf decimal_digit1 ; put a decimal point in front of digit 1 (xxxx.x)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
37 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
38 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
heinrichsweikamp
parents:
diff changeset
39
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
40
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
41 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
42 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
43 ; Output Functions for 8 Bit Integers
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
44 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
45 ; output_x: x is the max number that will be shown
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
46 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
47 ; Input: mpr:1 (lo)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
48 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
49 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
50
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
51 output_9 macro ; print only last digit (0-9)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
52 extern output9_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
53 call output9_call
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
54 endm
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
55
300
5ad479f2a868 Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents: 0
diff changeset
56
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
57 output_99 macro ; print only 2 digits (0-99)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
58 extern output99_call
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
59 call output99_call
0
heinrichsweikamp
parents:
diff changeset
60 endm
heinrichsweikamp
parents:
diff changeset
61
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
62 output_99x macro ; print only 2 digits with leading zero (00-99)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
63 extern output99x_call
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 300
diff changeset
64 call output99x_call
0
heinrichsweikamp
parents:
diff changeset
65 endm
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
66
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
67 output_99dd macro ; print only 2 digits or double-dots if zero - variant for small font
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
68 extern output99dd_call
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
69 call output99dd_call
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
70 endm
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
71
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
72 output_99DD macro ; print only 2 digits or double-dots if zero - variant for big font
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
73 extern output99DD_call
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
74 call output99DD_call
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
75 endm
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
76
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
77 output_256 macro ; print all 3 digits (0-255)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
78 extern output256_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
79 call output256_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
80 endm
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
81
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
82 output_hex macro ; print in hex (00-FF), Attention: input is via WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
83 extern outputHEX_call
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
84 call outputHEX_call
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
85 endm
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
86
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
87
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
88 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
89 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
90 ; Output Functions for 16 Bit Integers
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
91 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
92 ; output_x: x is the max number that will be shown
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
93 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
94 ; Input: mpr:2 (lo,hi)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
95 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
96 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
97
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
98 output_65535 macro ; print all 5 digits (0-65535)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
99 extern output65535_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
100 call output65535_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
101 endm
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
102
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
103
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
104 output_9999 macro ; print only last 4 digits (0-9999)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
105 extern output9999_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
106 call output9999_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
107 endm
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
108
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
109 output_999 macro ; print only last 3 digits (0-999)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
110 extern output999_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
111 call output999_call
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
112 endm
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
113
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
114
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
115 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
116 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
117 ; Conversion Functions
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
118 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
119 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
120
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
121 extern convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm]
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
122 extern convert_cm_to_feet ; convert depth in [cm] to depth in [feet]
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
123 extern convert_meter_to_feet ; convert depth in [m] to depth in [feet]
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
124 extern convert_celsius_to_fahrenheit ; convert temperature from celsius to fahrenheit
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
125 extern convert_signed_16bit ; convert signed to unsigned 16bit, print '-' if negative
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
126 extern convert_time ; convert minutes to hours:minutes or seconds to minutes:seconds
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
127
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
128 extern output_date ; print date with day, month and year
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
129 extern output_date_short ; print date with day and month only
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
130 extern output_secs_as_days_hours ; print seconds as days and hours
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
131
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
132 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
133
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
134