annotate src/aa_wordprocessor.asm @ 604:ca4556fb60b9

bump to 2.99beta, work on 3.00 stable
author heinrichsweikamp
date Thu, 22 Nov 2018 19:47:26 +0100
parents b455b31ce022
children d866684249bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
3 ; File aa_wordprocessor.asm ## V2.99e
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
10 ; 2010-11-22 : [jDG] Creation
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
51 aa_word CODE
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
52
0
heinrichsweikamp
parents:
diff changeset
53 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
54 ; Setup pointers for a char:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
55 ; Inputs WREG = char to draw, win_font
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
56 ; Output aa_start, aa_end, win_height, aa_flags
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
57 ; Trashed PRODH, PRODL, TBLPTR, TABLAT
0
heinrichsweikamp
parents:
diff changeset
58 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
59
0
heinrichsweikamp
parents:
diff changeset
60 aa_char_setup:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
61 movwf PRODL ; save char into PROD for now
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
62 movf win_font,W ; get font number (updates Z flag)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
63 bnz aa_char_1
0
heinrichsweikamp
parents:
diff changeset
64
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
65 ; TINY font ---------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
66 ; Font TINY character folding...
0
heinrichsweikamp
parents:
diff changeset
67 aa_char_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
68 movlw LOW aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
69 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
70 movlw HIGH aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
71 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
72 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
73 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
74 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
75
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
76 ; SMALL font ---------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
77 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
78 aa_char_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
79 decfsz WREG ; requested small font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
80 bra aa_char_2 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
81 movlw LOW aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
82 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
83 movlw HIGH aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
84 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
85 movlw UPPER aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
86 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
87 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
88
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
89 ; STD font -----------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
90 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
91 aa_char_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
92 decfsz WREG ; requested std font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
93 bra aa_char_3 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
94 movlw LOW aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
95 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
96 movlw HIGH aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
97 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
98 movlw UPPER aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
99 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
100 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
101
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
102 ; MEDIUM font --------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
103 aa_char_3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
104 decfsz WREG ; requested medium font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
105 bra aa_char_4 ; NO
582
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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
116 ; no to all above - must be large font then...
582
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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
133 tblrd*+ ; read FROM char
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
134 movf TABLAT,W ; get it, and set Z,N
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
135 bz aa_char_32 ; break at end of translations
0
heinrichsweikamp
parents:
diff changeset
136
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
137 tblrd*+ ; read TO char
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
138 cpfseq PRODL ; FROM == current char ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
139 bra aa_char_30 ; different -> loop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
140 movff TABLAT, PRODL ; make substitution
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
145 tblrd*+ ; read first char
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
148 tblrd*+ ; read nb chars
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
149 movf TABLAT,W ; nbchars --> WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
150 tblrd*+ ; read default char
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
151 cpfslt PRODL ; char > WREG ?
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
155 clrf aa_flags ; default to no AA
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
156 tblrd*+ ; read font height + AA flag
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
157 movf TABLAT,W ; into WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
158 bnn aa_char_34 ; high bit set ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
159 bsf aa_antialias ; YES - then the font is AA
0
heinrichsweikamp
parents:
diff changeset
160 aa_char_34:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
161 andlw 0x7F ; keep just font height,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
162 movwf win_height ; 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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
165 movf PRODL,W ; read back char
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
168 addwf TBLPTRL,F ; add into TBLPTR (low byte)
582
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++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
174 movff TABLAT,aa_start+0 ; read low byte
582
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++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
179 movff TABLAT,aa_end+0 ; read low byte
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
196 ; Read bitmap byte, and decode length:
0
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
200 btg TBLPTRL ; toggle low ptr bit
0
heinrichsweikamp
parents:
diff changeset
201 tblrd*
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
202 movf TABLAT,W ; store to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
203 btg TBLPTRL ; get is back
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
204 tblrd*+ ; then increment (but trash TABLAT)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
205 movwf TABLAT ; then restore copy to TABLAT
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
206 else
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
207 tblrd*+ ; normal read...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
208 movf TABLAT,W ; store copy to WREG
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
211 btfss aa_antialias ; anti-aliased font ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
212 bra aa_char_width_10 ; NO - always 7 bit count
0
heinrichsweikamp
parents:
diff changeset
213
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
214 bn aa_char_width_10 ; none-white pixels?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
215 andlw 0x1F ; YES - 5 bit count
0
heinrichsweikamp
parents:
diff changeset
216 aa_char_width_10:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
217 andlw 0x7F ; NO - 7 bit count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
218 incf WREG ; WREG = repetition count
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
219 addwf aa_bitlen,F ; add remaining pixels from last code
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
220
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 movf win_height,W ; WREG -= height
582
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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
226 addwf aa_bitlen,F ; try to subtract win_height
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
227 bn aa_char_width_3 ; if neg it was a bad idea...
0
heinrichsweikamp
parents:
diff changeset
228
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
229 infsnz win_width+0,F ; succeeded: do a 16 bit increment
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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 ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
238 movf TBLPTRL,W ; compare TBLPTR to aa_end
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
239 cpfseq aa_end+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
240 bra aa_char_width_1 ; loop if LOW is different
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
241 movf TBLPTRH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
242 cpfseq aa_end+1 ; loop to if HIGH is different
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
254 clrf win_width+0 ; clear width sum
582
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++
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
282 btg TBLPTRL ; toggle low ptr bit
0
heinrichsweikamp
parents:
diff changeset
283 tblrd*
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
284 movf TABLAT,W ; store to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
285 btg TBLPTRL ; get is back
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
286 tblrd*+ ; then increment (but trash TABLAT)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
287 movwf TABLAT ; then restore copy to TABLAT
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
288 else
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
289 tblrd*+ ; normal read...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
290 movf TABLAT,W ; store copy to WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
291 endif
0
heinrichsweikamp
parents:
diff changeset
292
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
293 btfss aa_antialias ; anti-aliased font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
294 bra aa_decode_10 ; NO - always 7 bit count
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
295 bn aa_decode_10 ; none-white pixels?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
296 andlw 0x1F ; Yes - 5 bit count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
297 aa_decode_10:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
298 andlw 0x7F ; NO - 7 bit count
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
305 ; 1xx 0% 100% : Managed by aa_decode_13
582
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%
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
309 ; 000 100% 0% : Managed by aa_decode_13, too
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
310 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
311 movf TABLAT,W ; get back code
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
312 btfss aa_antialias ; anti-aliased font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
313 bra aa_decode_13 ; NO - 1 bit 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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
317 ; of the asymmetric processing!
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
318 bn aa_decode_13 ; decode as none-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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
321 andlw 0xE0 ; select color bits
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
322 bz aa_decode_13 ; that's a 000 !
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
325 btfss win_invert ; inverse video mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
326 sublw 0x80 ; NO
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
330 iorlw b'001' ; we are in AA mode, don't forget it!
582
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 --------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
334 clrf PRODL ; we will accumulate result here...
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
338 rrcf win_color1,W ; xRRRRxGG
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
341 rrcf win_color2,W ; GGGxBBBB
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
348 movff aa_temp+0,PRODH ; add color/2 if bit set
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
362 movf aa_temp+1,W ; add color/4
582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
365 addwfc PRODH,F ; in right order, to propagate carry
0
heinrichsweikamp
parents:
diff changeset
366
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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 ------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
370 aa_decode_13: ; got a 1xx or a 000 code...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
371 btfsc win_invert ; inverse video mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
372 xorlw 0x80 ; YES - invert levels
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
376 bsf tft_rs ; RS_H Data
582
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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
382 bsf tft_rs ; RS_H Data
582
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:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
388 bsf tft_rs ; RS_H Data
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
389 movff PRODH,PORTA ; move high byte to PORTA
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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 -----------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
395 bcf tft_nwr ; WR_L
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
396 bsf tft_nwr ; WR_H tick
582
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 ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
404 movf TBLPTRL,W ; compare TBLPTR to aa_end
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
405 cpfseq aa_end+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
406 bra aa_decode_1 ; loop if LOW is different
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
407 movf TBLPTRH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
408 cpfseq aa_end+1 ; loop too if HIGH is different
582
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 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
417 global aa_wordprocessor ; callable from C-code
0
heinrichsweikamp
parents:
diff changeset
418 aa_wordprocessor:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
419 banksel win_font ; bank1, just to be sure
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
420 rcall aa_string_width ; set win_height, compute win_width:2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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++
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
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