annotate src/aa_wordprocessor.asm @ 586:06642f6ffe59

2.97 release
author heinrichsweikamp
date Thu, 01 Mar 2018 11:12:47 +0100
parents b455b31ce022
children ca4556fb60b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
3 ; File aa_wordprocessor.asm ## V2.97
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Anti-aliased word processor
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2010-11-22 : [jDG] Creation.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
11 ; 2010-12-01 : [jDG] Adding 3bits anti-aliased fonts.
0
heinrichsweikamp
parents:
diff changeset
12 ; 2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0
heinrichsweikamp
parents:
diff changeset
13 ; 2012-08-12 : [mH] Moved font28 into bootloader section 0x1C000
heinrichsweikamp
parents:
diff changeset
14 ;
heinrichsweikamp
parents:
diff changeset
15 ; BUGS :
heinrichsweikamp
parents:
diff changeset
16 ; * If the three fonts are not in the same half of the PROM memory, TBLPTRU
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
17 ; will be badly set, and font48 or font90 will display gibberish...
0
heinrichsweikamp
parents:
diff changeset
18 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
19 ;
heinrichsweikamp
parents:
diff changeset
20 ; MEMORY FOOTPRINT:
heinrichsweikamp
parents:
diff changeset
21 ;------------------
heinrichsweikamp
parents:
diff changeset
22 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
23 ; wp_wordprocessor : 8 KB, including fonts
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
24 ; aa_wordprocessor : 0.5 KB code
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
25 ; + 3.5 KB aa_font28 (reduced to 99 chars)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
26 ; + 1.6 KB aa_font48
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
27 ; + 2.2 KB aa_font90
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
28 ; = 7.9 KB including fonts
0
heinrichsweikamp
parents:
diff changeset
29 ;
heinrichsweikamp
parents:
diff changeset
30 ; Input registers:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
31 ; buffer:26 String to print
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
32 ; win_font Font size (0=tiny, 1=small, 2=medium, 3=large)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
33 ; win_color1:2 16bits unpacked color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
34 ; win_top, win_leftx2 Position on screen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
35 ; win_inverse Inverse video mode
0
heinrichsweikamp
parents:
diff changeset
36 ;
heinrichsweikamp
parents:
diff changeset
37 ; Available general purpose registers:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
38 ; PRODH, PRODL needed for array indexing)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
39 ; FSRx 12bits. Useful as RAM pointers.
0
heinrichsweikamp
parents:
diff changeset
40 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
41
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 189
diff changeset
42 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
43 #include "tft.inc"
heinrichsweikamp
parents:
diff changeset
44
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
45 extern aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
46 extern aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
47 extern aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
48 extern aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
49 extern aa_font90_block
0
heinrichsweikamp
parents:
diff changeset
50
heinrichsweikamp
parents:
diff changeset
51 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
52 ; Setup pointers for a char:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
53 ; Inputs WREG = char to draw, win_font
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
54 ; Output aa_start, aa_end, win_height, aa_flags
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
55 ; Trashed PRODH, PRODL, TBLPTR, TABLAT
0
heinrichsweikamp
parents:
diff changeset
56 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
57 basic CODE
0
heinrichsweikamp
parents:
diff changeset
58 aa_char_setup:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
59 movwf PRODL ; save char into PROD for now
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
60 movf win_font,W,BANKED ; Get font number (updates Z flag)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
61 bnz aa_char_1
0
heinrichsweikamp
parents:
diff changeset
62
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
63 ; TINY font ---------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
64 ; Font TINY character folding...
0
heinrichsweikamp
parents:
diff changeset
65 aa_char_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
66 movlw LOW aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
67 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
68 movlw HIGH aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
69 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
70 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
71 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
72 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
73
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
74 ; SMALL font ---------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
75 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
76 aa_char_1:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
77 decfsz WREG ; This is small font ???
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
78 bra aa_char_2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
79 movlw LOW aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
80 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
81 movlw HIGH aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
82 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
83 movlw UPPER aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
84 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
85 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
86
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
87 ; STD font -----------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
88 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
89 aa_char_2:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
90 decfsz WREG ; This is small font ???
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
91 bra aa_char_3
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
92 movlw LOW aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
93 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
94 movlw HIGH aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
95 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
96 movlw UPPER aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
97 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
98 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
99
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
100 ; MEDIUM font --------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
101 aa_char_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
102 decfsz WREG ; This is medium font ???
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
103 bra aa_char_4
0
heinrichsweikamp
parents:
diff changeset
104
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
105 ; Font MEDIUM block:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
106 movlw LOW aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
107 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
108 movlw HIGH aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
109 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
110 movlw UPPER aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
111 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
112 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
113
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
114 ; LARGE font ---------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
115 aa_char_4:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
116 ; Font LARGE block:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
117 movlw LOW aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
118 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
119 movlw HIGH aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
120 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
121 movlw UPPER aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
122 movwf TBLPTRU
0
heinrichsweikamp
parents:
diff changeset
123
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
124 ; Execute font block -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
125 aa_char_99:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
126 ; This is safe if the three fonts are in the same code segment
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
127 ; (and that segment do not span the 64K edge...)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
128 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
129 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
130
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
131 ; Proceed to character substitutions
0
heinrichsweikamp
parents:
diff changeset
132 aa_char_30:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
133 tblrd*+ ; Read FROM char
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
134 movf TABLAT,W ; Get it, and set Z,N
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
135 bz aa_char_32 ; Break at end of translations
0
heinrichsweikamp
parents:
diff changeset
136
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
137 tblrd*+ ; Read TO char
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
138 cpfseq PRODL ; FROM == current char ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
139 bra aa_char_30 ; Different: loop
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
140 movff TABLAT, PRODL ; make substitution
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
141 bra aa_char_30 ; Loop
0
heinrichsweikamp
parents:
diff changeset
142
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
143 ; Make sure char is in the available range
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
144 aa_char_32:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
145 tblrd*+ ; Read first char
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
146 movf TABLAT,W ; get it
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
147 subwf PRODL,F ; (char - first) --> PRODL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
148 tblrd*+ ; Read nb chars
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
149 movf TABLAT,W ; nbchars --> WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
150 tblrd*+ ; Read default char
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
151 cpfslt PRODL ; if char > WREG ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
152 movff TABLAT,PRODL ; replace PRODL
0
heinrichsweikamp
parents:
diff changeset
153
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
154 ; Decode font height and anti-aliasing mode
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
155 clrf aa_flags ; Default to no AA
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
156 tblrd*+ ; Read font height + AA flag
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
157 movf TABLAT,W ; into WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
158 bnn aa_char_34 ; High bit set ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
159 bsf aa_antialias ; YES : then the font is AA
0
heinrichsweikamp
parents:
diff changeset
160 aa_char_34:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
161 andlw 0x7F ; Keep just font height,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
162 movwf win_height,BANKED ; then save it (its a register)
0
heinrichsweikamp
parents:
diff changeset
163
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
164 ; Set PROM pointer to the char index
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
165 movf PRODL,W ; Read back char
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
166 mullw 2 ; PROD = 2*(char - base), TBLPTR=idx
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
167 movf PRODL,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
168 addwf TBLPTRL,F ; Add into TBLPTR (low byte)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
169 movf PRODH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
170 addwfc TBLPTRH,F ; and high byte
0
heinrichsweikamp
parents:
diff changeset
171
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
172 ; Read start and stop pointers
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
173 tblrd*+ ; aa_start = PROM16(*tblptr++)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
174 movff TABLAT,aa_start+0 ; Read low byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
175 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
176 movff TABLAT,aa_start+1 ; and high byte
0
heinrichsweikamp
parents:
diff changeset
177
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
178 tblrd*+ ; aa_end = PROM16(*tblptr++)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
179 movff TABLAT,aa_end+0 ; Read low byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
180 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
181 movff TABLAT,aa_end+1 ; and high byte
0
heinrichsweikamp
parents:
diff changeset
182
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
183 return
0
heinrichsweikamp
parents:
diff changeset
184
heinrichsweikamp
parents:
diff changeset
185 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
186 ; Character width
heinrichsweikamp
parents:
diff changeset
187 ; Inputs aa_start, aa_end, win_width, win_height, aa_flags
heinrichsweikamp
parents:
diff changeset
188 ; Output width added to win_width
heinrichsweikamp
parents:
diff changeset
189 ; Trashed aa_bitlen, TBLPTR, TABLAT
heinrichsweikamp
parents:
diff changeset
190 ;
heinrichsweikamp
parents:
diff changeset
191 aa_char_width:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
192 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
193 movff aa_start+1, TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
194 clrf aa_bitlen ; clear reminders...
0
heinrichsweikamp
parents:
diff changeset
195
heinrichsweikamp
parents:
diff changeset
196 ; Read bitmap byte, and decode length:
heinrichsweikamp
parents:
diff changeset
197 aa_char_width_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
198
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
199 ifdef AA_BYTE_SWAP
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
200 btg TBLPTRL,0 ; Toggle low ptr bit
0
heinrichsweikamp
parents:
diff changeset
201 tblrd*
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
202 movf TABLAT,W ; Store to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
203 btg TBLPTRL,0 ; Get is back
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
204 tblrd*+ ; then increment (but trash TABLAT)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
205 movwf TABLAT ; Then restore copy to TABLAT
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
206 else
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
207 tblrd*+ ; Normal read...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
208 movf TABLAT,W ; Store copy to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
209 endif
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
210
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
211 btfss aa_antialias ; Anti-aliased font ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
212 bra aa_char_width_10 ; No: always 7 bits count
0
heinrichsweikamp
parents:
diff changeset
213
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
214 bn aa_char_width_10 ; Non-white pixels ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
215 andlw 0x1F ; Yes : 5 bits count
0
heinrichsweikamp
parents:
diff changeset
216 aa_char_width_10:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
217 andlw 0x7F ; No: 7 bit count
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
218 incf WREG ; WREG = repetition count
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
219 addwf aa_bitlen,F ; Add remaining pixels from last code
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
220
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
221 movf win_height,W,BANKED ; WREG = - height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
222 negf WREG
0
heinrichsweikamp
parents:
diff changeset
223
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
224 ; This is a hand-made division by successive subtraction of height
0
heinrichsweikamp
parents:
diff changeset
225 aa_char_width_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
226 addwf aa_bitlen,F ; Try to subtract win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
227 bn aa_char_width_3 ; If neg it was a bad idea...
0
heinrichsweikamp
parents:
diff changeset
228
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
229 infsnz win_width+0,F ; Succeeded: do a 16bit increment
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
230 incf win_width+1,F ; on the win_width counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
231 bra aa_char_width_2 ; and loop
0
heinrichsweikamp
parents:
diff changeset
232
heinrichsweikamp
parents:
diff changeset
233 aa_char_width_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
234 negf WREG ; WREG = +height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
235 addwf aa_bitlen,F ; Restore true reminder
0
heinrichsweikamp
parents:
diff changeset
236
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
237 ; Are we done ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
238 movf TBLPTRL,W ; Compare TBLPTR to aa_end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
239 cpfseq aa_end+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
240 bra aa_char_width_1 ; Loop if LOW is different
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
241 movf TBLPTRH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
242 cpfseq aa_end+1 ; Loop to if HIGH is different
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
243 bra aa_char_width_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
244 return
0
heinrichsweikamp
parents:
diff changeset
245
heinrichsweikamp
parents:
diff changeset
246 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
247 ; String width
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
248 ; Inputs buffer (SHOULD BE NULL TERMINATED)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
249 ; Output win_width, win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
250 ; Trashed PROD, TBLPTR, FSR2, aa_bitlen, aa_start, aa_end, aa_flags
0
heinrichsweikamp
parents:
diff changeset
251 ;
heinrichsweikamp
parents:
diff changeset
252 aa_string_width:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
253 lfsr FSR2, buffer ; FSR2 pointer to start of string
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
254 clrf win_width+0 ; Clear width sum
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
255 clrf win_width+1 ; (16 bit counter)
0
heinrichsweikamp
parents:
diff changeset
256
heinrichsweikamp
parents:
diff changeset
257 aa_string_width_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
258 movf POSTINC2,W ; WREG = *FSR2++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
259 bz aa_string_width99 ; Exit if null byte encountered
0
heinrichsweikamp
parents:
diff changeset
260
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
261 rcall aa_char_setup ; setup aa_start / aa_end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
262 rcall aa_char_width ; sum-up width into win_width
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
263 bra aa_string_width_1 ; and loop
0
heinrichsweikamp
parents:
diff changeset
264
heinrichsweikamp
parents:
diff changeset
265 aa_string_width99:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
266 return
0
heinrichsweikamp
parents:
diff changeset
267
heinrichsweikamp
parents:
diff changeset
268 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
269 ; Decode a compressed char.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
270 ; Inputs aa_start, aa_end, win_height, win_invert, win_color1, win_color2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
271 ; Output none
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
272 ; Trashed TBLPTR, TABLAT, PROD, aa_bitlen, aa_flags, aa_colorDir:2
0
heinrichsweikamp
parents:
diff changeset
273 ;
heinrichsweikamp
parents:
diff changeset
274 aa_decode_char:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
275 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
276 movff aa_start+1, TBLPTRH
0
heinrichsweikamp
parents:
diff changeset
277
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
278 ; Read bitmap byte, and decode color & length
0
heinrichsweikamp
parents:
diff changeset
279 aa_decode_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
280
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
281 ifdef AA_BYTE_SWAP
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
282 btg TBLPTRL,0 ; Toggle low ptr bit
0
heinrichsweikamp
parents:
diff changeset
283 tblrd*
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
284 movf TABLAT,W ; Store to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
285 btg TBLPTRL,0 ; Get is back
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
286 tblrd*+ ; then increment (but trash TABLAT)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
287 movwf TABLAT ; Then restore copy to TABLAT
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
288 else
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
289 tblrd*+ ; Normal read...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
290 movf TABLAT,W ; Store copy to WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
291 endif
0
heinrichsweikamp
parents:
diff changeset
292
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
293 btfss aa_antialias ; Anti-aliased font ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
294 bra aa_decode_10 ; No: always 7 bits count
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
295 bn aa_decode_10 ; Non-white pixels ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
296 andlw 0x1F ; Yes : 5 bits count
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
297 aa_decode_10:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
298 andlw 0x7F ; No: 7 bit count
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
299 incf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
300 movwf aa_bitlen ; repetition count --> aa_bitlen
0
heinrichsweikamp
parents:
diff changeset
301
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
302 ;---- COLOR DECODING -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
303 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
304 ; Code Normal Inverse
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
305 ; 1xx 0% 100% : Managed by aa_decode_13
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
306 ; 011 25% 75%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
307 ; 010 50% 50%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
308 ; 001 75% 25%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
309 ; 000 100% 0% : Managed by aa_decode_13 too
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
310 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
311 movf TABLAT,W ; Get back code
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
312 btfss aa_antialias ; Anti-aliased font ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
313 bra aa_decode_13 ; NO: 1bit case
0
heinrichsweikamp
parents:
diff changeset
314
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
315 ; Asymmetry test: 1xx code is another case for 1bit color.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
316 ; This have to be done before inverse video, because
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
317 ; of the asymmetric processing !
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
318 bn aa_decode_13 ; decode as not-aa
0
heinrichsweikamp
parents:
diff changeset
319
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
320 ; Manage 000 special case too:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
321 andlw 0xE0 ; Select color bits
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
322 bz aa_decode_13 ; That's a 000 !
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
323
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
324 ; Apply reverse video, in a reversed way
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
325 btfss win_invert ; Inverse video mode ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
326 sublw 0x80
0
heinrichsweikamp
parents:
diff changeset
327
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
328 ; Move the two bits to aa_color_half and aa_color_quarter:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
329 swapf WREG ; --> 0000.0LL0 byte
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
330 iorlw b'001' ; We are in AA mode, don't forget it !
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
331 movwf aa_flags ; save that to aa_color_(half/quad)/AA flags
0
heinrichsweikamp
parents:
diff changeset
332
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
333 ;---- 2 bit x RGB(16bits) computation --------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
334 clrf PRODL ; We will accumulate result here...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
335 clrf PRODH
0
heinrichsweikamp
parents:
diff changeset
336
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
337 ; Take color div 2 into aa_temp. Max red = 15/31
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
338 rrcf win_color1,W,BANKED ; xRRRRxGG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
339 andlw b'01111011' ; 0RRRR0GG (don't change C)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
340 movwf aa_temp+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
341 rrcf win_color2,W,BANKED ; GGGxBBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
342 andlw b'11101111' ; GGG0BBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
343 movwf aa_temp+1
0
heinrichsweikamp
parents:
diff changeset
344
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
345 btfss aa_color_half
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
346 bra aa_decode_12
0
heinrichsweikamp
parents:
diff changeset
347
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
348 movff aa_temp+0,PRODH ; Add color/2 if bit set
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
349 movff aa_temp+1,PRODL ; TFT is big endian, so swap here
0
heinrichsweikamp
parents:
diff changeset
350 aa_decode_12:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
351 btfss aa_color_quart
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
352 bra aa_decode_3
0
heinrichsweikamp
parents:
diff changeset
353
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
354 ; Divide it once again by 2. Max red = 7/31.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
355 rrcf aa_temp+0,W ; xxRRRxxG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
356 andlw b'00111001' ; 00RRR00G (don't change C)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
357 movwf aa_temp+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
358 rrcf aa_temp+1,W ; GGGxxBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
359 andlw b'11100111' ; GGG00BBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
360 movwf aa_temp+1
0
heinrichsweikamp
parents:
diff changeset
361
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
362 movf aa_temp+1,W ; Add color/4
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
363 addwf PRODL,F ; NOTE: 7/31+15/31=22/31,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
364 movf aa_temp+0,W ; hence components won't overlap
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
365 addwfc PRODH,F ; In right order, to propagate carry
0
heinrichsweikamp
parents:
diff changeset
366
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
367 bra aa_decode_3 ; Done
0
heinrichsweikamp
parents:
diff changeset
368
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
369 ; ---- Simple BLACK and WHITE cases ------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
370 aa_decode_13: ; Got a 1xx or a 000 code...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
371 btfsc win_invert ; Inverse video mode ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
372 xorlw 0x80 ; YES: invert levels
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
373 bn aa_decode_2 ; Then test high bit
0
heinrichsweikamp
parents:
diff changeset
374
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
375 ; WHITE pixel (i.e. full color)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
376 bsf tft_rs,0 ; RS_H Data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
377 movff win_color1,PORTA ; current draw color
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
378 movff win_color2,PORTH ; (rem: TFT is big endian)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
379 bra aa_decode_4
0
heinrichsweikamp
parents:
diff changeset
380
heinrichsweikamp
parents:
diff changeset
381 aa_decode_2:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
382 bsf tft_rs,0 ; RS_H Data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
383 clrf PORTA ; BLACK pixel
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
384 clrf PORTH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
385 bra aa_decode_4
0
heinrichsweikamp
parents:
diff changeset
386
heinrichsweikamp
parents:
diff changeset
387 aa_decode_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
388 bsf tft_rs,0 ; RS_H Data
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
389 movff PRODH,PORTA ; Move high byte to PORTA
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
390 movff PRODL,PORTH ; Move low byte to PORTH
0
heinrichsweikamp
parents:
diff changeset
391 aa_decode_4:
436
95ee78f4a974 no screen reboot after logbook exit
heinrichsweikamp
parents: 432
diff changeset
392 bcf INTCON,GIE
95ee78f4a974 no screen reboot after logbook exit
heinrichsweikamp
parents: 432
diff changeset
393 aa_decode_4a:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
394 ;---- PIXEL WRITE LOOP -----------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
395 bcf tft_nwr,0 ; WR_L
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
396 bsf tft_nwr,0 ; WR_H Tick
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
397
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
398 decf aa_bitlen,F
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
399 bnz aa_decode_4a
0
heinrichsweikamp
parents:
diff changeset
400
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
401 bsf INTCON,GIE
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
402 ;---- BYTE-CODE LOOP -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
403 ; Are we done ?
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
404 movf TBLPTRL,W ; Compare TBLPTR to aa_end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
405 cpfseq aa_end+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
406 bra aa_decode_1 ; Loop if LOW is different
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
407 movf TBLPTRH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
408 cpfseq aa_end+1 ; Loop too if HIGH is different
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
409 bra aa_decode_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
410 return
0
heinrichsweikamp
parents:
diff changeset
411
heinrichsweikamp
parents:
diff changeset
412 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
413 ; Setup pointers for a char:
heinrichsweikamp
parents:
diff changeset
414 ; Inputs : buffer : string to print (SHOULD BE NULL TERMINATED)
heinrichsweikamp
parents:
diff changeset
415 ; Output : TFT commands on port D + clocks.
heinrichsweikamp
parents:
diff changeset
416 ;
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
417 global aa_wordprocessor ; Callable from C-code
0
heinrichsweikamp
parents:
diff changeset
418 aa_wordprocessor:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
419 banksel win_font ; Bank1, just to be sure
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
420 rcall aa_string_width ; Set win_height, compute win_width:2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
421 call TFT_box_write ; Use that for the box
0
heinrichsweikamp
parents:
diff changeset
422
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
423 ; Restart the loop for each char to print
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
424 lfsr FSR2, buffer ; FSR2 pointer to start of string
0
heinrichsweikamp
parents:
diff changeset
425
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
426 ; DATA block command
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
427 Index_out 0x22 ; Index_out is a macro defined in tft.inc
0
heinrichsweikamp
parents:
diff changeset
428
heinrichsweikamp
parents:
diff changeset
429 aa_wordprocessor_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
430 movf POSTINC2,W ; WREG = *FSR2++
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
431 bz aa_wordprocessor_99 ; Exit if null byte encountered
0
heinrichsweikamp
parents:
diff changeset
432
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
433 rcall aa_char_setup ; setup aa_start / aa_end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
434 rcall aa_decode_char ; write pixels to screen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
435 bra aa_wordprocessor_1 ; and loop
0
heinrichsweikamp
parents:
diff changeset
436
heinrichsweikamp
parents:
diff changeset
437 aa_wordprocessor_99:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
438 ; END of bloc command
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
439 Index_out 0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
440 return
0
heinrichsweikamp
parents:
diff changeset
441
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
442 END