Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/displaytext.asm @ 115:50a06adabc67
First gas is active, Gauge mode display
author | heinrichsweikamp |
---|---|
date | Fri, 24 Dec 2010 15:40:27 +0100 |
parents | 3e351e25f5d1 |
children | e56f80318b58 |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
3 | |
4 ; This program is free software: you can redistribute it and/or modify | |
5 ; it under the terms of the GNU General Public License as published by | |
6 ; the Free Software Foundation, either version 3 of the License, or | |
7 ; (at your option) any later version. | |
8 | |
9 ; This program is distributed in the hope that it will be useful, | |
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ; GNU General Public License for more details. | |
13 | |
14 ; You should have received a copy of the GNU General Public License | |
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 | |
18 ; Displays from text_table_vx.asm | |
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
20 ; written: 10/30/05 | |
51 | 21 ; last updated: 100730 |
0 | 22 ; known bugs: |
23 ; ToDo: | |
24 | |
25 | |
26 ; These macros output to POSTINC only | |
27 OUTPUTTEXT macro textnumber ; For Texts 1-254 | |
28 movlw textnumber | |
29 call displaytext0 | |
30 endm | |
31 | |
32 OUTPUTTEXTH macro textnumber ; For Texts 255-511 | |
33 movlw LOW textnumber ; Use only Lower 8 Bit | |
34 call displaytext0_h | |
35 endm | |
36 | |
37 displaytext0_h: | |
38 bsf displaytext_high ; Highbit set | |
39 rcall displaytext0 | |
40 return | |
41 | |
42 displaytext0: | |
43 bsf output_to_postinc_only | |
44 rcall displaytext1 | |
45 bcf output_to_postinc_only | |
46 return | |
47 | |
48 ; These macros output to POSTINC and call the wordprocessor | |
49 DISPLAYTEXT macro textnumber | |
50 movlw textnumber | |
51 call displaytext1 | |
52 endm | |
53 | |
54 DISPLAYTEXTH macro textnumber | |
55 movlw LOW textnumber ; Use only Lower 8 Bit | |
56 call displaytext1h | |
57 endm | |
58 | |
59 displaytext1h: | |
60 bsf displaytext_high ; Highbit set | |
61 rcall displaytext1 | |
62 return | |
63 | |
64 displaytext1: | |
65 movwf textnumber | |
66 movlw b'10000000' | |
67 movwf EECON1 | |
68 | |
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 | 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 | 73 movwf TBLPTRL |
74 | |
75 movff textnumber,xA+0 | |
76 movlw d'0' | |
77 btfsc displaytext_high ; Highbit set? | |
78 movlw d'1' ; Yes! | |
79 movwf xA+1 ; Set High Bit | |
51 | 80 |
81 bcf STATUS,C | |
82 rlcf xA+0,F | |
83 rlcf xA+1,F ; times 2 for adress | |
84 | |
85 movlw d'2' | |
86 addwf xA+0,F | |
87 movlw d'0' | |
88 addwfc xA+1,F ; + 2 | |
89 | |
90 movf xA+0,W | |
0 | 91 addwf TBLPTRL,F ; set adress, data can be read |
51 | 92 movf xA+1,W |
0 | 93 addwfc TBLPTRH,F ; High byte, if required |
94 | |
95 TBLRD*+ | |
51 | 96 btfss output_to_postinc_only ; output to postinc only? |
97 movff TABLAT,win_leftx2 ; No, write coordinates | |
0 | 98 |
99 TBLRD*+ | |
51 | 100 btfss output_to_postinc_only ; output to postinc only? |
101 movff TABLAT,win_top ; No, write coordinates | |
102 | |
103 movlw d'0' | |
104 movff WREG,win_font ; Bank0 Variable... | |
0 | 105 |
106 clrf textaddress+0 | |
107 clrf textaddress+1 | |
51 | 108 clrf TBLPTRH ; Set Pointer for textlength table |
0 | 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 | 111 movwf TBLPTRL |
0 | 112 bra displaytext1b |
113 | |
114 displaytext1a: | |
115 bcf displaytext_high ; Clear flag | |
116 ; Get textadress from textlength table | |
117 displaytext1b: | |
118 TBLRD*+ | |
119 movf TABLAT,W | |
120 addwf textaddress+0,F | |
121 movlw d'0' | |
122 addwfc textaddress+1,F | |
123 decfsz textnumber,F | |
124 bra displaytext1b | |
125 | |
126 btfsc displaytext_high ; Highbit set? | |
127 bra displaytext1a ; Yes, add 256 loops | |
128 | |
129 displaytext2: ; copies text to wordprocessor | |
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 | 132 addwf textaddress+0,W |
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 | 135 addwfc textaddress+1,W |
136 movwf TBLPTRH | |
137 | |
51 | 138 btfss output_to_postinc_only ; output to postinc2 only? |
0 | 139 lfsr FSR2,letter ; no! |
140 | |
141 displaytext2a: | |
142 TBLRD*+ | |
143 movlw '}' ; Text finished? | |
144 cpfseq TABLAT | |
145 bra displaytext3 | |
146 bra display_text_exit | |
147 | |
148 displaytext3: | |
51 | 149 movff TABLAT,POSTINC2 |
150 | |
0 | 151 TBLRD*+ |
152 movlw '}' ; Text finished? | |
153 cpfseq TABLAT | |
154 bra displaytext4 | |
155 bra display_text_exit | |
156 displaytext4: | |
51 | 157 movff TABLAT,POSTINC2 |
0 | 158 bra displaytext2a |
159 | |
160 display_text_exit: | |
161 btfss output_to_postinc_only ; output to postinc only? | |
162 call word_processor | |
163 return |