Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/displaytext.asm @ 840:b29cf452f91d
minor
author | heinrichsweikamp |
---|---|
date | Wed, 18 Oct 2023 19:54:09 +0200 |
parents | 2750099bf5bb |
children |
rev | line source |
---|---|
815 | 1 ; OSTC Mk.2, 2N and 2C - 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 |
838 | 80 clrf letter_counter ; reset the letter counter |
174 | 81 movlw 4 ; textnumber * 4 --> PROD |
82 mulwf textnumber | |
83 | |
84 btfsc displaytext_high ; If high text, add 4*256 to PROD | |
85 addwf PRODH | |
51 | 86 |
174 | 87 movf PRODL,W ; Add PROD to TBLPTR |
88 addwf TBLPTRL,F | |
89 movf PRODH,W | |
90 addwfc TBLPTRH,F | |
91 movlw 0 | |
92 addwfc TBLPTRU | |
0 | 93 |
94 TBLRD*+ | |
174 | 95 movff TABLAT,textaddress+0 ; textaddress:2 holds address for first character |
96 TBLRD*+ | |
97 movff TABLAT,textaddress+1 | |
98 | |
99 btfsc output_to_postinc_only ; output to postinc only? | |
100 bra displaytext2 | |
101 | |
102 TBLRD*+ | |
51 | 103 movff TABLAT,win_leftx2 ; No, write coordinates |
0 | 104 |
105 TBLRD*+ | |
174 | 106 movff TABLAT,win_top ; No, write coordinates |
0 | 107 |
174 | 108 displaytext2: |
109 clrf WREG ; Reset to small font | |
110 movff WREG,win_font ; (BANK 0) | |
0 | 111 |
174 | 112 movff textaddress+0,TBLPTRL |
113 movff textaddress+1,TBLPTRH | |
51 | 114 btfss output_to_postinc_only ; output to postinc2 only? |
0 | 115 lfsr FSR2,letter ; no! |
116 | |
174 | 117 displaytext3: |
0 | 118 TBLRD*+ |
174 | 119 movf TABLAT,W |
120 bz display_text_exit ; Text finished? | |
121 movwf POSTINC2 | |
838 | 122 incf letter_counter,F ; ++1 |
174 | 123 bra displaytext3 |
0 | 124 |
125 display_text_exit: | |
126 btfss output_to_postinc_only ; output to postinc only? | |
815 | 127 bra display_text_exit2 |
174 | 128 |
129 bcf output_to_postinc_only | |
0 | 130 return |
815 | 131 |
132 display_text_exit2: | |
133 clrf WREG | |
134 movff WREG,letter+.22 | |
135 goto word_processor |