comparison code_part1/OSTC_code_asm_part1/displaytext.asm @ 51:ceeeb5e49348

1.70....
author heinrichsweikamp
date Fri, 30 Jul 2010 12:32:15 +0200
parents 96a35aeda5f2
children 3e351e25f5d1
comparison
equal deleted inserted replaced
50:c97c5514b165 51:ceeeb5e49348
1
2 ; OSTC - diving computer code 1 ; OSTC - diving computer code
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR 2 ; Copyright (C) 2008 HeinrichsWeikamp GbR
4 3
5 ; This program is free software: you can redistribute it and/or modify 4 ; This program is free software: you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by 5 ; it under the terms of the GNU General Public License as published by
17 16
18 17
19 ; Displays from text_table_vx.asm 18 ; Displays from text_table_vx.asm
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com 19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
21 ; written: 10/30/05 20 ; written: 10/30/05
22 ; last updated: 081215 21 ; last updated: 100730
23 ; known bugs: 22 ; known bugs:
24 ; ToDo: 23 ; ToDo:
25 24
26 25
27 ; These macros output to POSTINC only 26 ; These macros output to POSTINC only
76 movff textnumber,xA+0 75 movff textnumber,xA+0
77 movlw d'0' 76 movlw d'0'
78 btfsc displaytext_high ; Highbit set? 77 btfsc displaytext_high ; Highbit set?
79 movlw d'1' ; Yes! 78 movlw d'1' ; Yes!
80 movwf xA+1 ; Set High Bit 79 movwf xA+1 ; Set High Bit
81 movlw d'4' ; times 4 for adress 80
82 movwf xB+0 81 bcf STATUS,C
83 clrf xB+1 82 rlcf xA+0,F
84 call mult16x16 ;xA*xB=xC 83 rlcf xA+1,F ; times 2 for adress
85 movf xC+0,W 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
86 addwf TBLPTRL,F ; set adress, data can be read 91 addwf TBLPTRL,F ; set adress, data can be read
87 movf xC+1,W 92 movf xA+1,W
88 addwfc TBLPTRH,F ; High byte, if required 93 addwfc TBLPTRH,F ; High byte, if required
89 94
90 TBLRD*+ 95 TBLRD*+
91 movf TABLAT,W 96 btfss output_to_postinc_only ; output to postinc only?
92 btfsc output_to_postinc_only ; output to postinc only? 97 movff TABLAT,win_leftx2 ; No, write coordinates
93 bra displaytext1_1 ; Yes
94 movff WREG,win_leftx2
95
96 displaytext1_1:
97 TBLRD*+
98 movf TABLAT,W
99 btfsc output_to_postinc_only ; output to postinc only?
100 bra displaytext1_2 ; Yes
101 movff WREG,win_top
102
103 displaytext1_2:
104 TBLRD*+
105 movf TABLAT,W ; ScaleY
106 sublw d'1' ; -1
107 movff WREG,win_font
108 98
109 TBLRD*+ 99 TBLRD*+
110 movff TABLAT,grayvalue ; grayvalue 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...
111 105
112 clrf textaddress+0 106 clrf textaddress+0
113 clrf textaddress+1 107 clrf textaddress+1
114 clrf TBLPTRL ; Set Pointer for textlength table 0x0100 108 clrf TBLPTRH ; Set Pointer for textlength table
115 clrf TBLPTRU 109 clrf TBLPTRU
116 movlw 0x01 110 movlw textlength_pointer_low
117 movwf TBLPTRH 111 movwf TBLPTRL
118 bra displaytext1b 112 bra displaytext1b
119 113
120 displaytext1a: 114 displaytext1a:
121 bcf displaytext_high ; Clear flag 115 bcf displaytext_high ; Clear flag
122 ; Get textadress from textlength table 116 ; Get textadress from textlength table
132 btfsc displaytext_high ; Highbit set? 126 btfsc displaytext_high ; Highbit set?
133 bra displaytext1a ; Yes, add 256 loops 127 bra displaytext1a ; Yes, add 256 loops
134 128
135 displaytext2: ; copies text to wordprocessor 129 displaytext2: ; copies text to wordprocessor
136 clrf TBLPTRU 130 clrf TBLPTRU
137
138 movlw text_pointer_low 131 movlw text_pointer_low
139 addwf textaddress+0,W 132 addwf textaddress+0,W
140 movwf TBLPTRL 133 movwf TBLPTRL
141 movlw text_pointer_high ; Base address Texts 134 movlw text_pointer_high ; Base address Texts
142 addwfc textaddress+1,W 135 addwfc textaddress+1,W
143 movwf TBLPTRH 136 movwf TBLPTRH
144 137
145 btfss output_to_postinc_only ; output to postinc only? 138 btfss output_to_postinc_only ; output to postinc2 only?
146 lfsr FSR2,letter ; no! 139 lfsr FSR2,letter ; no!
147 140
148 displaytext2a: 141 displaytext2a:
149 TBLRD*+ 142 TBLRD*+
150 movlw '}' ; Text finished? 143 movlw '}' ; Text finished?
151 cpfseq TABLAT 144 cpfseq TABLAT
152 bra displaytext3 145 bra displaytext3
153 bra display_text_exit 146 bra display_text_exit
154 147
155 displaytext3: 148 displaytext3:
156 movf TABLAT,W 149 movff TABLAT,POSTINC2
157 movwf POSTINC2 150
158
159 TBLRD*+ 151 TBLRD*+
160 movlw '}' ; Text finished? 152 movlw '}' ; Text finished?
161 cpfseq TABLAT 153 cpfseq TABLAT
162 bra displaytext4 154 bra displaytext4
163 bra display_text_exit 155 bra display_text_exit
164 displaytext4: 156 displaytext4:
165 movf TABLAT,W 157 movff TABLAT,POSTINC2
166 movwf POSTINC2
167
168 bra displaytext2a 158 bra displaytext2a
169 159
170 display_text_exit: 160 display_text_exit:
171 btfss output_to_postinc_only ; output to postinc only? 161 btfss output_to_postinc_only ; output to postinc only?
172 call word_processor 162 call word_processor