annotate code_part1/OSTC_code_asm_part1/displaytext.asm @ 739:96d32c0cf206

BUGFIX: Clear end-of-dive countdown properly when descending again
author heinrichsweikamp
date Mon, 08 Jul 2013 19:32:32 +0200
parents 53b16a746166
children c50296c3059e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18 ; Displays from text_table_vx.asm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written: 10/30/05
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
21 ; last updated: 100730
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
22 ; known bugs:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
23 ; ToDo:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
24
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
25
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26 ; These macros output to POSTINC only
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
27 OUTPUTTEXT macro n ; For Texts 1-255
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
28 If n>.255
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
29 Error "Bad low text number", n
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
30 Endif
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
31 movlw n
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
32 call displaytext0_low
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
35 OUTPUTTEXTH macro n ; For Texts 256-511
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
36 If n<.256
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
37 Error "Bad low text number", n
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
38 Endif
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
39 movlw n-.256 ; Use only Lower 8 Bit
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
40 call displaytext0_high
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
43 displaytext0_high:
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
44 bsf displaytext_high ; Highbit set
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
45 bra displaytext0
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
47 displaytext0_low:
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
48 bcf displaytext_high ; Highbit clear
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 displaytext0:
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
50 bsf output_to_postinc_only
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
51 bra displaytext
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
53 ; These macros output to letter[], and call the wordprocessor
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
54 DISPLAYTEXT macro n
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
55 movlw n
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
56 call displaytext_1_low
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
59 DISPLAYTEXTH macro n
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
60 movlw LOW n ; Use only Lower 8 Bit
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
61 call displaytext_1_high
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
64 displaytext_1_high:
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
65 bsf displaytext_high ; Highbit set
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
66 bra displaytext
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
68 displaytext_1_low:
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
69 bcf displaytext_high
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
71 displaytext:
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
72 movwf textnumber
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
73 movlw LOW(text_pointer-4)
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
74 movwf TBLPTRL
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
75 movlw HIGH(text_pointer-4)
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
76 movwf TBLPTRH
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
77 movlw UPPER(text_pointer-4)
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
78 movwf TBLPTRU
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
79
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
80 movlw 4 ; textnumber * 4 --> PROD
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
81 mulwf textnumber
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
82
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
83 btfsc displaytext_high ; If high text, add 4*256 to PROD
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
84 addwf PRODH
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
85
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
86 movf PRODL,W ; Add PROD to TBLPTR
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
87 addwf TBLPTRL,F
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
88 movf PRODH,W
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
89 addwfc TBLPTRH,F
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
90 movlw 0
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
91 addwfc TBLPTRU
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
92
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 TBLRD*+
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
94 movff TABLAT,textaddress+0 ; textaddress:2 holds address for first character
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
95 TBLRD*+
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
96 movff TABLAT,textaddress+1
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
97
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
98 btfsc output_to_postinc_only ; output to postinc only?
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
99 bra displaytext2
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
100
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
101 TBLRD*+
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
102 movff TABLAT,win_leftx2 ; No, write coordinates
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 TBLRD*+
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
105 movff TABLAT,win_top ; No, write coordinates
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
107 displaytext2:
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
108 clrf WREG ; Reset to small font
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
109 movff WREG,win_font ; (BANK 0)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
111 movff textaddress+0,TBLPTRL
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
112 movff textaddress+1,TBLPTRH
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
113 btfss output_to_postinc_only ; output to postinc2 only?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 lfsr FSR2,letter ; no!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
116 displaytext3:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 TBLRD*+
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
118 movf TABLAT,W
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
119 bz display_text_exit ; Text finished?
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
120 movwf POSTINC2
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
121 bra displaytext3
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 display_text_exit:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 btfss output_to_postinc_only ; output to postinc only?
174
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
125 goto word_processor
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
126
53b16a746166 Multi-lang
JeanDo
parents: 172
diff changeset
127 bcf output_to_postinc_only
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 return