Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/displaytext.asm @ 807:c50296c3059e
BUGFIX: Divetime had unwanted "." behind the minutes
Change Copyright info
3.02 release
author | heinrichsweikamp |
---|---|
date | Sat, 07 Feb 2015 12:37:04 +0100 |
parents | 53b16a746166 |
children | 2a0e5d884fc3 |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
807
c50296c3059e
BUGFIX: Divetime had unwanted "." behind the minutes
heinrichsweikamp
parents:
174
diff
changeset
|
2 ; Copyright (C) 2015 HeinrichsWeikamp GbR |
0 | 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 | |
174 | 27 OUTPUTTEXT macro n ; For Texts 1-255 |
28 If n>.255 | |
29 Error "Bad low text number", n | |
30 Endif | |
31 movlw n | |
32 call displaytext0_low | |
0 | 33 endm |
34 | |
174 | 35 OUTPUTTEXTH macro n ; For Texts 256-511 |
36 If n<.256 | |
37 Error "Bad low text number", n | |
38 Endif | |
39 movlw n-.256 ; Use only Lower 8 Bit | |
40 call displaytext0_high | |
0 | 41 endm |
42 | |
174 | 43 displaytext0_high: |
44 bsf displaytext_high ; Highbit set | |
45 bra displaytext0 | |
0 | 46 |
174 | 47 displaytext0_low: |
48 bcf displaytext_high ; Highbit clear | |
0 | 49 displaytext0: |
174 | 50 bsf output_to_postinc_only |
51 bra displaytext | |
0 | 52 |
174 | 53 ; These macros output to letter[], and call the wordprocessor |
54 DISPLAYTEXT macro n | |
55 movlw n | |
56 call displaytext_1_low | |
0 | 57 endm |
58 | |
174 | 59 DISPLAYTEXTH macro n |
60 movlw LOW n ; Use only Lower 8 Bit | |
61 call displaytext_1_high | |
0 | 62 endm |
63 | |
174 | 64 displaytext_1_high: |
65 bsf displaytext_high ; Highbit set | |
66 bra displaytext | |
0 | 67 |
174 | 68 displaytext_1_low: |
69 bcf displaytext_high | |
0 | 70 |
174 | 71 displaytext: |
72 movwf textnumber | |
73 movlw LOW(text_pointer-4) | |
74 movwf TBLPTRL | |
75 movlw HIGH(text_pointer-4) | |
76 movwf TBLPTRH | |
77 movlw UPPER(text_pointer-4) | |
78 movwf TBLPTRU | |
51 | 79 |
174 | 80 movlw 4 ; textnumber * 4 --> PROD |
81 mulwf textnumber | |
82 | |
83 btfsc displaytext_high ; If high text, add 4*256 to PROD | |
84 addwf PRODH | |
51 | 85 |
174 | 86 movf PRODL,W ; Add PROD to TBLPTR |
87 addwf TBLPTRL,F | |
88 movf PRODH,W | |
89 addwfc TBLPTRH,F | |
90 movlw 0 | |
91 addwfc TBLPTRU | |
0 | 92 |
93 TBLRD*+ | |
174 | 94 movff TABLAT,textaddress+0 ; textaddress:2 holds address for first character |
95 TBLRD*+ | |
96 movff TABLAT,textaddress+1 | |
97 | |
98 btfsc output_to_postinc_only ; output to postinc only? | |
99 bra displaytext2 | |
100 | |
101 TBLRD*+ | |
51 | 102 movff TABLAT,win_leftx2 ; No, write coordinates |
0 | 103 |
104 TBLRD*+ | |
174 | 105 movff TABLAT,win_top ; No, write coordinates |
0 | 106 |
174 | 107 displaytext2: |
108 clrf WREG ; Reset to small font | |
109 movff WREG,win_font ; (BANK 0) | |
0 | 110 |
174 | 111 movff textaddress+0,TBLPTRL |
112 movff textaddress+1,TBLPTRH | |
51 | 113 btfss output_to_postinc_only ; output to postinc2 only? |
0 | 114 lfsr FSR2,letter ; no! |
115 | |
174 | 116 displaytext3: |
0 | 117 TBLRD*+ |
174 | 118 movf TABLAT,W |
119 bz display_text_exit ; Text finished? | |
120 movwf POSTINC2 | |
121 bra displaytext3 | |
0 | 122 |
123 display_text_exit: | |
124 btfss output_to_postinc_only ; output to postinc only? | |
174 | 125 goto word_processor |
126 | |
127 bcf output_to_postinc_only | |
0 | 128 return |