annotate code_part1/OSTC_code_asm_part1/displaytext.asm @ 85:8b813f67220f

renaming "Max Depth" to "max."
author heinrichsweikamp
date Wed, 08 Dec 2010 08:37:03 +0100
parents 3e351e25f5d1
children e56f80318b58
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
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 OUTPUTTEXT macro textnumber ; For Texts 1-254
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 movlw textnumber
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 call displaytext0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 OUTPUTTEXTH macro textnumber ; For Texts 255-511
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 movlw LOW textnumber ; Use only Lower 8 Bit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 call displaytext0_h
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 displaytext0_h:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 bsf displaytext_high ; Highbit set
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 rcall displaytext0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 displaytext0:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 bsf output_to_postinc_only
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 rcall displaytext1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 bcf output_to_postinc_only
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 ; These macros output to POSTINC and call the wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 DISPLAYTEXT macro textnumber
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 movlw textnumber
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
51 call displaytext1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
52 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
53
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 DISPLAYTEXTH macro textnumber
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
55 movlw LOW textnumber ; Use only Lower 8 Bit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
56 call displaytext1h
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
57 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
58
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59 displaytext1h:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
60 bsf displaytext_high ; Highbit set
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 rcall displaytext1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
62 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
64 displaytext1:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
65 movwf textnumber
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
66 movlw b'10000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
67 movwf EECON1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
69 clrf TBLPTRU
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 51
diff changeset
70 movlw HIGH (textpos_pointer-4)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
71 movwf TBLPTRH
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 51
diff changeset
72 movlw LOW (textpos_pointer-4) ; base address -4 for position table
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
73 movwf TBLPTRL
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
74
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
75 movff textnumber,xA+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
77 btfsc displaytext_high ; Highbit set?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78 movlw d'1' ; Yes!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 movwf xA+1 ; Set High Bit
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
80
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
81 bcf STATUS,C
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
82 rlcf xA+0,F
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
83 rlcf xA+1,F ; times 2 for adress
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
84
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
85 movlw d'2'
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
86 addwf xA+0,F
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
87 movlw d'0'
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
88 addwfc xA+1,F ; + 2
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
89
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
90 movf xA+0,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
91 addwf TBLPTRL,F ; set adress, data can be read
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
92 movf xA+1,W
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
93 addwfc TBLPTRH,F ; High byte, if required
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
94
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
95 TBLRD*+
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
96 btfss output_to_postinc_only ; output to postinc only?
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
97 movff TABLAT,win_leftx2 ; No, write coordinates
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 TBLRD*+
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
100 btfss output_to_postinc_only ; output to postinc only?
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
101 movff TABLAT,win_top ; No, write coordinates
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
102
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
103 movlw d'0'
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
104 movff WREG,win_font ; Bank0 Variable...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 clrf textaddress+0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 clrf textaddress+1
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
108 clrf TBLPTRH ; Set Pointer for textlength table
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 clrf TBLPTRU
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 51
diff changeset
110 movlw LOW textlength_pointer
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
111 movwf TBLPTRL
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 bra displaytext1b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 displaytext1a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 bcf displaytext_high ; Clear flag
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 ; Get textadress from textlength table
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117 displaytext1b:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 TBLRD*+
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 movf TABLAT,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 addwf textaddress+0,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 movlw d'0'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 addwfc textaddress+1,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 decfsz textnumber,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 bra displaytext1b
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 btfsc displaytext_high ; Highbit set?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 bra displaytext1a ; Yes, add 256 loops
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 displaytext2: ; copies text to wordprocessor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130 clrf TBLPTRU
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 51
diff changeset
131 movlw LOW text_pointer
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
132 addwf textaddress+0,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
133 movwf TBLPTRL
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 51
diff changeset
134 movlw HIGH text_pointer ; Base address Texts
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
135 addwfc textaddress+1,W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
136 movwf TBLPTRH
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
137
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
138 btfss output_to_postinc_only ; output to postinc2 only?
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
139 lfsr FSR2,letter ; no!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
140
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
141 displaytext2a:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
142 TBLRD*+
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
143 movlw '}' ; Text finished?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
144 cpfseq TABLAT
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
145 bra displaytext3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
146 bra display_text_exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
147
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
148 displaytext3:
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
149 movff TABLAT,POSTINC2
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
150
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
151 TBLRD*+
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
152 movlw '}' ; Text finished?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
153 cpfseq TABLAT
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
154 bra displaytext4
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
155 bra display_text_exit
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
156 displaytext4:
51
ceeeb5e49348 1.70....
heinrichsweikamp
parents: 0
diff changeset
157 movff TABLAT,POSTINC2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
158 bra displaytext2a
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
159
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
160 display_text_exit:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
161 btfss output_to_postinc_only ; output to postinc only?
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
162 call word_processor
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
163 return