annotate src/aa_wordprocessor.asm @ 613:8077ee960199

fix for italian and french language
author heinrichsweikamp
date Wed, 30 Jan 2019 16:27:56 +0100
parents d866684249bd
children c40025d8e750
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
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
51 extern convert_for_display2
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
52
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
53 aa_word CODE
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54
0
heinrichsweikamp
parents:
diff changeset
55 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
56 ; Setup pointers for a char:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
57 ; Inputs WREG = char to draw, win_font
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
58 ; Output aa_start, aa_end, win_height, aa_flags
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
59 ; Trashed PRODH, PRODL, TBLPTR, TABLAT
0
heinrichsweikamp
parents:
diff changeset
60 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
61
0
heinrichsweikamp
parents:
diff changeset
62 aa_char_setup:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
63 movwf PRODL ; save char into PROD for now
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
64 movf win_font,W ; get font number (updates Z flag)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
65 bnz aa_char_1
0
heinrichsweikamp
parents:
diff changeset
66
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
67 ; TINY font ---------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
68 ; Font TINY character folding...
0
heinrichsweikamp
parents:
diff changeset
69 aa_char_0:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
70 movlw LOW aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
71 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
72 movlw HIGH aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
73 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
74 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
75 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
76 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
77
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
78 ; SMALL font ---------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
79 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
80 aa_char_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
81 decfsz WREG ; requested small font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
82 bra aa_char_2 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
83 movlw LOW aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
84 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
85 movlw HIGH aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
86 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
87 movlw UPPER aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
88 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
89 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
90
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
91 ; STD font -----------------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
92 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
93 aa_char_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
94 decfsz WREG ; requested std font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
95 bra aa_char_3 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
96 movlw LOW aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
97 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
98 movlw HIGH aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
99 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
100 movlw UPPER aa_font36_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
101 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
102 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
103
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
104 ; MEDIUM font --------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
105 aa_char_3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
106 decfsz WREG ; requested medium font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
107 bra aa_char_4 ; NO
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
108 movlw LOW aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
109 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
110 movlw HIGH aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
111 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
112 movlw UPPER aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
113 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
114 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
115
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
116 ; LARGE font ---------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
117 aa_char_4:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
118 ; no to all above - must be large font then...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
119 movlw LOW aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
120 movwf TBLPTRL
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
121 movlw HIGH aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
122 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
123 movlw UPPER aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
124 movwf TBLPTRU
0
heinrichsweikamp
parents:
diff changeset
125
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
126 ; Execute font block -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
127 aa_char_99:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
128 ; This is safe if the three fonts are in the same code segment
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
129 ; (and that segment do not span the 64K edge...)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
130 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
131 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
132
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
133 ; Proceed to character substitutions
0
heinrichsweikamp
parents:
diff changeset
134 aa_char_30:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
135 tblrd*+ ; read FROM char
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
136 movf TABLAT,W ; get it, and set Z,N
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
137 bz aa_char_32 ; break at end of translations
0
heinrichsweikamp
parents:
diff changeset
138
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
139 tblrd*+ ; read TO char
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
140 cpfseq PRODL ; FROM == current char ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
141 bra aa_char_30 ; different -> loop
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
142 movff TABLAT, PRODL ; make substitution
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
143 bra aa_char_30 ; loop
0
heinrichsweikamp
parents:
diff changeset
144
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
145 ; Make sure char is in the available range
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
146 aa_char_32:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
147 tblrd*+ ; read first char
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
148 movf TABLAT,W ; get it
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
149 subwf PRODL,F ; (char - first) --> PRODL
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
150 tblrd*+ ; read nb chars
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
151 movf TABLAT,W ; nbchars --> WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
152 tblrd*+ ; read default char
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
153 cpfslt PRODL ; char > WREG ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
154 movff TABLAT,PRODL ; replace PRODL
0
heinrichsweikamp
parents:
diff changeset
155
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
156 ; Decode font height and anti-aliasing mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
157 clrf aa_flags ; default to no AA
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
158 tblrd*+ ; read font height + AA flag
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
159 movf TABLAT,W ; into WREG
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
160 bnn aa_char_34 ; high bit set ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
161 bsf aa_antialias ; YES - then the font is AA
0
heinrichsweikamp
parents:
diff changeset
162 aa_char_34:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
163 andlw 0x7F ; keep just font height,
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
164 movwf win_height ; then save it (its a register)
0
heinrichsweikamp
parents:
diff changeset
165
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
166 ; Set PROM pointer to the char index
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
167 movf PRODL,W ; read back char
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
168 mullw 2 ; PROD = 2*(char - base), TBLPTR=idx
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
169 movf PRODL,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
170 addwf TBLPTRL,F ; add into TBLPTR (low byte)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
171 movf PRODH,W
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
172 addwfc TBLPTRH,F ; and high byte
0
heinrichsweikamp
parents:
diff changeset
173
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
174 ; Read start and stop pointers
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
175 tblrd*+ ; aa_start = PROM16(*tblptr++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
176 movff TABLAT,aa_start+0 ; read low byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
177 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
178 movff TABLAT,aa_start+1 ; and high byte
0
heinrichsweikamp
parents:
diff changeset
179
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
180 tblrd*+ ; aa_end = PROM16(*tblptr++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
181 movff TABLAT,aa_end+0 ; read low byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
182 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
183 movff TABLAT,aa_end+1 ; and high byte
0
heinrichsweikamp
parents:
diff changeset
184
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
185 return
0
heinrichsweikamp
parents:
diff changeset
186
heinrichsweikamp
parents:
diff changeset
187 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
188 ; Character width
heinrichsweikamp
parents:
diff changeset
189 ; Inputs aa_start, aa_end, win_width, win_height, aa_flags
heinrichsweikamp
parents:
diff changeset
190 ; Output width added to win_width
heinrichsweikamp
parents:
diff changeset
191 ; Trashed aa_bitlen, TBLPTR, TABLAT
heinrichsweikamp
parents:
diff changeset
192 ;
heinrichsweikamp
parents:
diff changeset
193 aa_char_width:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
194 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
195 movff aa_start+1, TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
196 clrf aa_bitlen ; clear reminders...
0
heinrichsweikamp
parents:
diff changeset
197
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
198 ; Read bitmap byte, and decode length:
0
heinrichsweikamp
parents:
diff changeset
199 aa_char_width_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
200
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
201 ifdef AA_BYTE_SWAP
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
202 btg TBLPTRL ; toggle low ptr bit
0
heinrichsweikamp
parents:
diff changeset
203 tblrd*
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
204 movf TABLAT,W ; store to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
205 btg TBLPTRL ; get is back
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
206 tblrd*+ ; then increment (but trash TABLAT)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
207 movwf TABLAT ; then restore copy to TABLAT
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
208 else
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
209 tblrd*+ ; normal read...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
210 movf TABLAT,W ; store copy to WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
211 endif
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
212
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
213 btfss aa_antialias ; anti-aliased font ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
214 bra aa_char_width_10 ; NO - always 7 bit count
0
heinrichsweikamp
parents:
diff changeset
215
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
216 bn aa_char_width_10 ; none-white pixels?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
217 andlw 0x1F ; YES - 5 bit count
0
heinrichsweikamp
parents:
diff changeset
218 aa_char_width_10:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
219 andlw 0x7F ; NO - 7 bit count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
220 incf WREG ; WREG = repetition count
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
221 addwf aa_bitlen,F ; add remaining pixels from last code
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
222
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
223 movf win_height,W ; WREG -= height
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
224 negf WREG
0
heinrichsweikamp
parents:
diff changeset
225
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
226 ; This is a hand-made division by successive subtraction of height
0
heinrichsweikamp
parents:
diff changeset
227 aa_char_width_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
228 addwf aa_bitlen,F ; try to subtract win_height
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
229 bn aa_char_width_3 ; if neg it was a bad idea...
0
heinrichsweikamp
parents:
diff changeset
230
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
231 infsnz win_width+0,F ; succeeded: do a 16 bit increment
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
232 incf win_width+1,F ; on the win_width counter
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
233 bra aa_char_width_2 ; and loop
0
heinrichsweikamp
parents:
diff changeset
234
heinrichsweikamp
parents:
diff changeset
235 aa_char_width_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
236 negf WREG ; WREG = +height
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
237 addwf aa_bitlen,F ; restore true reminder
0
heinrichsweikamp
parents:
diff changeset
238
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
239 ; Are we done ?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
240 movf TBLPTRL,W ; compare TBLPTR to aa_end
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
241 cpfseq aa_end+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
242 bra aa_char_width_1 ; loop if LOW is different
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
243 movf TBLPTRH,W
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
244 cpfseq aa_end+1 ; loop to if HIGH is different
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
245 bra aa_char_width_1
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
246 return
0
heinrichsweikamp
parents:
diff changeset
247
heinrichsweikamp
parents:
diff changeset
248 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
249 ; String width
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
250 ; Inputs buffer (SHOULD BE NULL TERMINATED)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
251 ; Output win_width, win_height
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
252 ; Trashed PROD, TBLPTR, FSR2, aa_bitlen, aa_start, aa_end, aa_flags
0
heinrichsweikamp
parents:
diff changeset
253 ;
heinrichsweikamp
parents:
diff changeset
254 aa_string_width:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
255 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
256 clrf win_width+0 ; clear width sum
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
257 clrf win_width+1 ; (16 bit counter)
0
heinrichsweikamp
parents:
diff changeset
258
heinrichsweikamp
parents:
diff changeset
259 aa_string_width_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
260 movf POSTINC2,W ; WREG = *FSR2++
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
261 bz aa_string_width99 ; exit if null byte encountered
0
heinrichsweikamp
parents:
diff changeset
262
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
263 rcall aa_char_setup ; setup aa_start / aa_end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
264 rcall aa_char_width ; sum-up width into win_width
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
265 bra aa_string_width_1 ; and loop
0
heinrichsweikamp
parents:
diff changeset
266
heinrichsweikamp
parents:
diff changeset
267 aa_string_width99:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
268 return
0
heinrichsweikamp
parents:
diff changeset
269
heinrichsweikamp
parents:
diff changeset
270 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
271 ; Decode a compressed char.
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
272 ; Inputs aa_start, aa_end, win_height, win_invert, win_color1, win_color2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
273 ; Output none
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
274 ; Trashed TBLPTR, TABLAT, PROD, aa_bitlen, aa_flags, aa_colorDir:2
0
heinrichsweikamp
parents:
diff changeset
275 ;
heinrichsweikamp
parents:
diff changeset
276 aa_decode_char:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
277 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
278 movff aa_start+1, TBLPTRH
0
heinrichsweikamp
parents:
diff changeset
279
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
280 ; Read bitmap byte, and decode color & length
0
heinrichsweikamp
parents:
diff changeset
281 aa_decode_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
282
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
283 ifdef AA_BYTE_SWAP
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
284 btg TBLPTRL ; toggle low ptr bit
0
heinrichsweikamp
parents:
diff changeset
285 tblrd*
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
286 movf TABLAT,W ; store to WREG
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
287 btg TBLPTRL ; get is back
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
288 tblrd*+ ; then increment (but trash TABLAT)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
289 movwf TABLAT ; then restore copy to TABLAT
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
290 else
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
291 tblrd*+ ; normal read...
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
292 movf TABLAT,W ; store copy to WREG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
293 endif
0
heinrichsweikamp
parents:
diff changeset
294
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
295 btfss aa_antialias ; anti-aliased font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
296 bra aa_decode_10 ; NO - always 7 bit count
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
297 bn aa_decode_10 ; none-white pixels?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
298 andlw 0x1F ; Yes - 5 bit count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
299 aa_decode_10:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
300 andlw 0x7F ; NO - 7 bit count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
301 incf WREG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
302 movwf aa_bitlen ; repetition count --> aa_bitlen
0
heinrichsweikamp
parents:
diff changeset
303
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
304 ;---- COLOR DECODING -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
305 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
306 ; Code Normal Inverse
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
307 ; 1xx 0% 100% : Managed by aa_decode_13
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
308 ; 011 25% 75%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
309 ; 010 50% 50%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
310 ; 001 75% 25%
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
311 ; 000 100% 0% : Managed by aa_decode_13, too
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
312 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
313 movf TABLAT,W ; get back code
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
314 btfss aa_antialias ; anti-aliased font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
315 bra aa_decode_13 ; NO - 1 bit case
0
heinrichsweikamp
parents:
diff changeset
316
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
317 ; Asymmetry test: 1xx code is another case for 1bit color.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
318 ; 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
319 ; of the asymmetric processing!
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
320 bn aa_decode_13 ; decode as none-aa
0
heinrichsweikamp
parents:
diff changeset
321
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
322 ; Manage 000 special case too:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
323 andlw 0xE0 ; select color bits
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
324 bz aa_decode_13 ; that's a 000 !
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
325
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
326 ; Apply reverse video, in a reversed way
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
327 btfss win_invert ; inverse video mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
328 sublw 0x80 ; NO
0
heinrichsweikamp
parents:
diff changeset
329
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
330 ; Move the two bits to aa_color_half and aa_color_quarter:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
331 swapf WREG ; --> 0000.0LL0 byte
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
332 iorlw b'001' ; we are in AA mode, don't forget it!
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
333 movwf aa_flags ; save that to aa_color_(half/quad)/AA flags
0
heinrichsweikamp
parents:
diff changeset
334
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
335 ;---- 2 bit x RGB(16bits) computation --------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
336 clrf PRODL ; we will accumulate result here...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
337 clrf PRODH
0
heinrichsweikamp
parents:
diff changeset
338
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
339 ; 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
340 rrcf win_color1,W ; xRRRRxGG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
341 andlw b'01111011' ; 0RRRR0GG (don't change C)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
342 movwf aa_temp+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
343 rrcf win_color2,W ; GGGxBBBB
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
344 andlw b'11101111' ; GGG0BBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
345 movwf aa_temp+1
0
heinrichsweikamp
parents:
diff changeset
346
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
347 btfss aa_color_half
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
348 bra aa_decode_12
0
heinrichsweikamp
parents:
diff changeset
349
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
350 movff aa_temp+0,PRODH ; add color/2 if bit set
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
351 movff aa_temp+1,PRODL ; TFT is big endian, so swap here
0
heinrichsweikamp
parents:
diff changeset
352 aa_decode_12:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
353 btfss aa_color_quart
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
354 bra aa_decode_3
0
heinrichsweikamp
parents:
diff changeset
355
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
356 ; Divide it once again by 2. Max red = 7/31.
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
357 rrcf aa_temp+0,W ; xxRRRxxG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
358 andlw b'00111001' ; 00RRR00G (don't change C)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
359 movwf aa_temp+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
360 rrcf aa_temp+1,W ; GGGxxBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
361 andlw b'11100111' ; GGG00BBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
362 movwf aa_temp+1
0
heinrichsweikamp
parents:
diff changeset
363
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
364 movf aa_temp+1,W ; add color/4
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
365 addwf PRODL,F ; NOTE: 7/31+15/31=22/31,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
366 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
367 addwfc PRODH,F ; in right order, to propagate carry
0
heinrichsweikamp
parents:
diff changeset
368
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
369 aa_decode_12b:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
370 btfss screen_type2 ; Display 2?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
371 bra aa_decode_3 ; No, Done.
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
372
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
373 call convert_for_display2 ; Convert 16Bit RGB b'RRRRRGGG GGGBBBBB' into 24Bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
374
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
375 bra aa_decode_3 ; Done.
0
heinrichsweikamp
parents:
diff changeset
376
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
377 ; ---- Simple BLACK and WHITE cases ------------------------------
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
378 aa_decode_13: ; Got a 1xx or a 000 code...
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
379 btfsc win_invert ; Inverse video mode ?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
380 xorlw 0x80 ; YES: invert levels.
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
381 bn aa_decode_2 ; Then test high bit.
0
heinrichsweikamp
parents:
diff changeset
382
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
383 ; WHITE pixel (ie. full color)
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
384 movff win_color1,PRODH ; current draw color
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
385 movff win_color2,PRODL ; (rem: DISPLAY is big endian)
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
386 bra aa_decode_12b
0
heinrichsweikamp
parents:
diff changeset
387
heinrichsweikamp
parents:
diff changeset
388 aa_decode_2:
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
389 clrf PRODH ; BLACK pixel
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
390 clrf PRODL
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
391 clrf win_color5
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
392 clrf win_color4
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
393 clrf win_color3
0
heinrichsweikamp
parents:
diff changeset
394
heinrichsweikamp
parents:
diff changeset
395 aa_decode_3:
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
396 ;---- PIXEL WRITE LOOP -----------------------------------------------
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
397 bsf tft_rs ; Data!
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
398
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
399 btfsc screen_type2 ; Display 2?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
400 bra aa_decode_3_display2 ; Yes
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
401
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
402 movff PRODH,PORTA ; Move high byte to PORTA
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
403 movff PRODL,PORTH ; Move low byte to PORTH
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
404 aa_decode_3_display0and1:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
405 bcf tft_nwr
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
406 bsf tft_nwr ; Tick
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
407 decf aa_bitlen,F
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
408 bnz aa_decode_3_display0and1
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
409 bra aa_decode_3_done
0
heinrichsweikamp
parents:
diff changeset
410
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
411 aa_decode_3_display2:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
412 movff win_color5,PORTH ; Move high byte to PORTH (DISPLAY is bigendian)
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
413 bcf tft_nwr
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
414 bsf tft_nwr ; Tick
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
415 movff win_color4,PORTH ; Move low byte to PORTH
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
416 bcf tft_nwr
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
417 bsf tft_nwr ; Tick
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
418 movff win_color3,PORTH ; Move low(est) byte to PORTH
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
419 bcf tft_nwr
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
420 bsf tft_nwr ; Tick
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
421 decf aa_bitlen,F
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
422 bnz aa_decode_3_display2
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
423
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
424 aa_decode_3_done:
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
425 ;---- BYTE-CODE LOOP -------------------------------------------------
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
426 ; Are we done ?
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
427 movf TBLPTRL,W ; Compare TBLPTR to aa_end
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
428 cpfseq aa_end+0
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
429 bra aa_decode_1 ; Loop if LOW is different
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
430 movf TBLPTRH,W
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
431 cpfseq aa_end+1 ; Loop to if HIGH is different
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
432 bra aa_decode_1
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
433 return
0
heinrichsweikamp
parents:
diff changeset
434
heinrichsweikamp
parents:
diff changeset
435 ;------------------------------------------------------------------------------
heinrichsweikamp
parents:
diff changeset
436 ; Setup pointers for a char:
heinrichsweikamp
parents:
diff changeset
437 ; Inputs : buffer : string to print (SHOULD BE NULL TERMINATED)
heinrichsweikamp
parents:
diff changeset
438 ; Output : TFT commands on port D + clocks.
heinrichsweikamp
parents:
diff changeset
439 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
440 global aa_wordprocessor ; callable from C-code
0
heinrichsweikamp
parents:
diff changeset
441 aa_wordprocessor:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
442 banksel win_font ; bank1, just to be sure
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
443 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
444 call TFT_box_write ; use that for the box
0
heinrichsweikamp
parents:
diff changeset
445
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
446 ; Restart the loop for each char to print
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
447 lfsr FSR2, buffer ; FSR2 pointer to start of string
0
heinrichsweikamp
parents:
diff changeset
448
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
449 ; DATA block command
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
450 Index_out 0x22 ; index_out is a macro defined in tft.inc
0
heinrichsweikamp
parents:
diff changeset
451
heinrichsweikamp
parents:
diff changeset
452 aa_wordprocessor_1:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
453 movf POSTINC2,W ; WREG = *FSR2++
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
454 bz aa_wordprocessor_99 ; exit if null byte encountered
0
heinrichsweikamp
parents:
diff changeset
455
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
456 rcall aa_char_setup ; setup aa_start / aa_end
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
457 rcall aa_decode_char ; write pixels to screen
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
458 bra aa_wordprocessor_1 ; and loop
0
heinrichsweikamp
parents:
diff changeset
459
heinrichsweikamp
parents:
diff changeset
460 aa_wordprocessor_99:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
461 ; END of bloc command
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
462 Index_out 0x00
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
463 return
0
heinrichsweikamp
parents:
diff changeset
464
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
465 END