annotate src/aa_wordprocessor.asm @ 646:5b7fe7777425

3.16 release
author heinrichs weikamp
date Thu, 14 Oct 2021 12:03:24 +0200
parents 4050675965ea
children aeca5717d9eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
3 ; File aa_wordprocessor.asm * combined next generation V3.08.4l
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
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
14
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
15
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
16 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
17 ; Attention:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
18 ; If the fonts are not in the same half of the PROM memory, TBLPTRU
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
19 ; will be set wrong and gibberish font output will result
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
20 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
21
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
22
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
23 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
24 ; Input registers:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
25 ; ----------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
26 ; buffer:26 string to print
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
27 ; font_size font size (0=tiny, 1=small, 2=std, 3=medium, 4=large, 5=XL)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
28 ; font_color font color (8 bit)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
29 ; win_top, win_leftx2 output position on screen
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
30 ; win_inverse inverse video mode selection
0
heinrichsweikamp
parents:
diff changeset
31 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
32 ; Trashed:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
33 ; --------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
34 ; PRODH, PRODL needed for array indexing
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
35 ; FSRx 12 bits, used for indirect addressing
0
heinrichsweikamp
parents:
diff changeset
36 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
37 ;-----------------------------------------------------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
38
0
heinrichsweikamp
parents:
diff changeset
39
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 189
diff changeset
40 #include "hwos.inc"
0
heinrichsweikamp
parents:
diff changeset
41 #include "tft.inc"
heinrichsweikamp
parents:
diff changeset
42
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
43 extern aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
44 extern aa_font28_block
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
45 extern aa_font34_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
46 extern aa_font48_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
47 extern aa_font90_block
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
48 extern aa_font92_block
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
49
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
50 extern convert_for_display2
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
51
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
52
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
53 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
54 aa_word CODE
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
55 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
56
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
57
0
heinrichsweikamp
parents:
diff changeset
58 ;------------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
59 ; Setup Pointers for a Char
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
60 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
61 ; Input WREG char to draw
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
62 ; font_size selected font
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
63 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
64 ; Output aa_start pointer to start of character bitmap
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
65 ; aa_end pointer to end of character bitmap
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
66 ; win_height font height
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
67 ; AA_flags font attributes
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
68 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
69 ; Trashed PRODH
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
70 ; PRODL
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
71 ; TBLPTR
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
72 ; TABLAT
0
heinrichsweikamp
parents:
diff changeset
73 ;
heinrichsweikamp
parents:
diff changeset
74 aa_char_setup:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
75 movwf PRODL ; save char to draw in PROD for later use
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
76 movf font_size,W ; get font size
0
heinrichsweikamp
parents:
diff changeset
77
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
78 ; 0: TINY font -------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
79 ; Font TINY character folding...
0
heinrichsweikamp
parents:
diff changeset
80 aa_char_0:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
81 tstfsz WREG ; requested tiny font?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
82 bra aa_char_1 ; NO
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
83
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
84 aa_char_00:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
85 movlw LOW aa_font16_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
86 movwf TBLPTRL
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
87 movlw HIGH aa_font16_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
88 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
89 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
90 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
91 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
92
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
93 ; 1: SMALL font ------------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
94 ; Font SMALL character folding...
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
95 aa_char_1:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
96 decfsz WREG ; requested small font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
97 bra aa_char_2 ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
98
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
99 movlw LOW aa_font28_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
100 movwf TBLPTRL
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
101 movlw HIGH aa_font28_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
102 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
103 movlw UPPER aa_font28_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
104 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
105 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
106
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
107 ; 2: STD font --------------------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
108 ; Font STANDARD character folding...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
109 aa_char_2:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
110 decfsz WREG ; requested std font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
111 bra aa_char_3 ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
112
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
113 movlw LOW aa_font34_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
114 movwf TBLPTRL
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
115 movlw HIGH aa_font34_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
116 movwf TBLPTRH
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
117 movlw UPPER aa_font34_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
118 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
119 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
120
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
121 ; 3: MEDIUM font -----------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
122 aa_char_3:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
123 decfsz WREG ; requested medium font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
124 bra aa_char_4 ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
125
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
126 movlw LOW aa_font48_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
127 movwf TBLPTRL
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
128 movlw HIGH aa_font48_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
129 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
130 movlw UPPER aa_font48_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 bra aa_char_99
0
heinrichsweikamp
parents:
diff changeset
133
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
134 ; 4: LARGE font ------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
135 aa_char_4:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
136 decfsz WREG ; requested large font?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
137 bra aa_char_5 ; NO
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
138
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
139 movlw LOW aa_font90_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
140 movwf TBLPTRL
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
141 movlw HIGH aa_font90_block
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
142 movwf TBLPTRH
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
143 movlw UPPER aa_font90_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
144 movwf TBLPTRU
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
145 bra aa_char_99
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
146
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
147 ; 5: EXTRA LARGE font ------------------------------------------------
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
148 aa_char_5:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
149 decfsz WREG ; requested extra large font?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
150 bra aa_char_00 ; NO - illegal font code, default to tiny font
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
151
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
152 movlw LOW aa_font92_block
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
153 movwf TBLPTRL
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
154 movlw HIGH aa_font92_block
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
155 movwf TBLPTRH
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
156 movlw UPPER aa_font92_block
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
157 movwf TBLPTRU
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
158 ;bra aa_char_99
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
159
0
heinrichsweikamp
parents:
diff changeset
160
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
161 ; Execute Font Block -------------------------------------------------
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
162 aa_char_99:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
163 ; this is safe if all fonts are in the same code segment
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
164 ; (and this segment does not cross the 64 K boundary)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
165 movlw UPPER aa_font16_block
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
166 movwf TBLPTRU
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
167
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
168 ; execute the character substitutions
0
heinrichsweikamp
parents:
diff changeset
169 aa_char_30:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
170 tblrd*+ ; read FROM char
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
171 movf TABLAT,W ; get FROM char
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
172 bz aa_char_32 ; break at end of translation table
0
heinrichsweikamp
parents:
diff changeset
173
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
174 tblrd*+ ; read TO char
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
175 cpfseq PRODL ; FROM char == current char ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
176 bra aa_char_30 ; NO - different, loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
177 movff TABLAT, PRODL ; YES - make substitution
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
178 bra aa_char_30 ; - loop to consume the rest of the translations
0
heinrichsweikamp
parents:
diff changeset
179
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
180 ; make sure char is within the font set
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
181 aa_char_32:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
182 tblrd*+ ; read code of first char in font set
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
183 movf TABLAT,W ; get code of first char in font set
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
184 subwf PRODL,F ; compute code of current char - of first char
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
185 tblrd*+ ; read number of chars in font set
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
186 movf TABLAT,W ; get number of chars in font set
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
187 tblrd*+ ; read default char
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
188 cpfslt PRODL ; current char beyond last char in font set?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
189 movff TABLAT,PRODL ; YES - current char with default char
0
heinrichsweikamp
parents:
diff changeset
190
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
191 ; decode font height and anti-aliasing mode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
192 bcf aa_antialias ; default to no AA
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
193 tblrd*+ ; read font height + AA flag
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
194 movf TABLAT,W ; get font height + AA flag
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
195 btfsc WREG,7 ; AA bit set?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
196 bsf aa_antialias ; YES - then the font is AA
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
197 andlw 0x7F ; strip the AA bit
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
198 movwf win_height ; store the font height
0
heinrichsweikamp
parents:
diff changeset
199
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
200 ; set PROM pointer to the char index
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
201 movf PRODL,W ; read back char
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
202 mullw 2 ; PROD = 2*(char - base), TBLPTR=idx
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
203 movf PRODL,W ; add to base address of font data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
204 addwf TBLPTRL,F ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
205 movf PRODH,W ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
206 addwfc TBLPTRH,F ; ...
0
heinrichsweikamp
parents:
diff changeset
207
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
208 ; read pointers to character bitmap
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
209 tblrd*+ ; aa_start = PROM16(*tblptr++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
210 movff TABLAT,aa_start+0 ; read low byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
211 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
212 movff TABLAT,aa_start+1 ; and high byte
0
heinrichsweikamp
parents:
diff changeset
213
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
214 tblrd*+ ; aa_end = PROM16(*tblptr++)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
215 movff TABLAT,aa_end+0 ; read low byte
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
216 tblrd*+
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
217 movff TABLAT,aa_end+1 ; and high byte
0
heinrichsweikamp
parents:
diff changeset
218
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
219 return ; done
0
heinrichsweikamp
parents:
diff changeset
220
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
221
0
heinrichsweikamp
parents:
diff changeset
222 ;------------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
223 ; Compute Character Width
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
224 ; Input aa_start, aa_end, win_width, win_height, AA_flags
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
225 ; Output width added to win_width
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
226 ; Trashed aa_bitlen, TBLPTR, TABLAT
0
heinrichsweikamp
parents:
diff changeset
227 ;
heinrichsweikamp
parents:
diff changeset
228 aa_char_width:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
229 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
230 movff aa_start+1, TBLPTRH ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
231 clrf aa_bitlen ; clear remaining pixels counter
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
232
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
233 ; read bitmap byte and decode length
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
234 aa_char_width_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
235 ifdef AA_BYTE_SWAP
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
236 btg TBLPTRL ; toggle low ptr bit
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
237 tblrd* ; read bitmap data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
238 movf TABLAT,W ; store to WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
239 btg TBLPTRL ; toggle back
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
240 tblrd*+ ; do a dummy read to increment the pointer
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
241 movwf TABLAT ; restore TABLAT
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
242 else
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
243 tblrd*+ ; read bitmap data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
244 movf TABLAT,W ; store to WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
245 endif
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
246 btfss aa_antialias ; anti-aliased font ?
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
247 bra aa_char_width_10 ; NO - always 7 bit count
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
248 btfss WREG,7 ; YES - none-white pixels?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
249 andlw 0x1F ; YES - 5 bit count
0
heinrichsweikamp
parents:
diff changeset
250 aa_char_width_10:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
251 andlw 0x7F ; mask out none-white pixel flag
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
252 incf WREG,W ; WREG = repetition count
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
253 addwf aa_bitlen,F ; add to remaining pixels
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
254
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
255 movf win_height,W ; WREG -= height
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
256 negf WREG ; ...
0
heinrichsweikamp
parents:
diff changeset
257
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
258 ; this is a hand-made division by successive subtraction of the height
0
heinrichsweikamp
parents:
diff changeset
259 aa_char_width_2:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
260 addwf aa_bitlen,F ; try to subtract win_height, does it fit?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
261 bn aa_char_width_3 ; NO - done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
262 infsnz win_width+0,F ; YES - do a 16 bit increment of the win_width
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
263 incf win_width+1,F ; - ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
264 bra aa_char_width_2 ; - loop
0
heinrichsweikamp
parents:
diff changeset
265
heinrichsweikamp
parents:
diff changeset
266 aa_char_width_3:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
267 negf WREG ; WREG = +height
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
268 addwf aa_bitlen,F ; restore true reminder
0
heinrichsweikamp
parents:
diff changeset
269
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
270 ; all pixel data processed?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
271 movf TBLPTRL,W ; get TBLPTR, low byte
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
272 cpfseq aa_end+0 ; TBLPTR, low byte == end pointer, low byte?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
273 bra aa_char_width_1 ; NO - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
274 movf TBLPTRH,W ; YES - get TBLPTR, high byte
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
275 cpfseq aa_end+1 ; - TBLPTR, high byte == end pointer, high byte?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
276 bra aa_char_width_1 ; NO - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
277 return ; YES - done
0
heinrichsweikamp
parents:
diff changeset
278
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
279
0
heinrichsweikamp
parents:
diff changeset
280 ;------------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
281 ; Compute String Width
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
282 ; Input buffer (NEEDS TO BE NULL TERMINATED)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
283 ; Output win_width, win_height
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
284 ; Trashed PROD, TBLPTR, FSR2, aa_bitlen, aa_start, aa_end, AA_flags
0
heinrichsweikamp
parents:
diff changeset
285 ;
heinrichsweikamp
parents:
diff changeset
286 aa_string_width:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
287 lfsr FSR2, buffer ; FSR2 pointer to start of string
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
288 clrf win_width+0 ; clear 16 bit width sum
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
289 clrf win_width+1 ; ...
0
heinrichsweikamp
parents:
diff changeset
290
heinrichsweikamp
parents:
diff changeset
291 aa_string_width_1:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
292 movf POSTINC2,W ; get character
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
293 bz aa_string_width99 ; exit if null byte encountered
0
heinrichsweikamp
parents:
diff changeset
294
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
295 rcall aa_char_setup ; setup pointers for the char
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
296 rcall aa_char_width ; win_width += character width
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
297 bra aa_string_width_1 ; loop
0
heinrichsweikamp
parents:
diff changeset
298
heinrichsweikamp
parents:
diff changeset
299 aa_string_width99:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
300 return ; done
0
heinrichsweikamp
parents:
diff changeset
301
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
302
0
heinrichsweikamp
parents:
diff changeset
303 ;------------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
304 ; Print a Character
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
305 ; Input aa_start, aa_end, win_height, win_invert, win_color1, win_color2
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
306 ; Output none
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
307 ; Trashed TBLPTR, TABLAT, PROD, aa_bitlen, AA_flags, aa_colorDir:2
0
heinrichsweikamp
parents:
diff changeset
308 ;
heinrichsweikamp
parents:
diff changeset
309 aa_decode_char:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
310 movff aa_start+0, TBLPTRL ; set TBLPTR to start of character data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
311 movff aa_start+1, TBLPTRH ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
312
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
313 ; read bitmap byte and decode color & length
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
314 aa_decode_1:
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
315 ifdef AA_BYTE_SWAP
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
316 btg TBLPTRL ; toggle low ptr bit
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
317 tblrd* ; read bitmap data
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
318 movf TABLAT,W ; back-up TABLAT
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
319 btg TBLPTRL ; toggle back
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
320 tblrd*+ ; do a dummy read to increment the pointer
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
321 movwf TABLAT ; restore TABLAT
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
322 else
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
323 tblrd*+ ; normal read...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
324 movf TABLAT,W ; store copy to WREG
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
325 endif
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
326 btfss aa_antialias ; anti-aliased font ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
327 bra aa_decode_10 ; NO - always 7 bit count
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
328 btfss WREG,7 ; YES - none-white pixels?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
329 andlw 0x1F ; YES - 5 bit count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
330 aa_decode_10:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
331 andlw 0x7F ; mask out none-white pixel flag
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
332 incf WREG,W ; WREG = repetition count
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
333 movwf aa_bitlen ; repetition count --> aa_bitlen
0
heinrichsweikamp
parents:
diff changeset
334
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
335 ;---- COLOR DECODING -------------------------------------------------
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
336 ;
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
337 ; Code Normal Inverse
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
338 ; 1xx 0% 100% : Managed by aa_decode_13
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
339 ; 011 25% 75%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
340 ; 010 50% 50%
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
341 ; 001 75% 25%
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
342 ; 000 100% 0% : Managed by aa_decode_13, too
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
343
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
344 movf TABLAT,W ; get back pixel data
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
345 btfss aa_antialias ; anti-aliased font?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
346 bra aa_decode_13 ; NO - 1 bit case
0
heinrichsweikamp
parents:
diff changeset
347
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
348 ; asymmetry test: 1xx code is another case for 1 bit color
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
349 ; This has to be done before inverse video, because of the asymmetric processing!
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
350 bn aa_decode_13 ; decode as none-aa
0
heinrichsweikamp
parents:
diff changeset
351
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
352 ; manage 000 special case
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
353 andlw 0xE0 ; select color bits, is it a 000 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
354 bz aa_decode_13 ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
355
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
356 ; apply reverse video, in a reversed way
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
357 btfss win_invert ; inverse video mode?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
358 sublw 0x80 ; NO
0
heinrichsweikamp
parents:
diff changeset
359
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
360 ; extract color quarter and color half information
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
361 bsf aa_antialias ; set AA mode
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
362 bcf aa_color_quarter ; default to no color quarter
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
363 btfsc WREG,5 ; color quarter encoded?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
364 bsf aa_color_quarter ; YES - set flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
365 bcf aa_color_half ; default to no color half
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
366 btfsc WREG,6 ; color half encoded?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
367 bsf aa_color_half ; YES - set flag
0
heinrichsweikamp
parents:
diff changeset
368
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
369 ;---- 2 bit x RGB(16bits) computation --------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
370 clrf PRODL ; clear accumulator
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
371 clrf PRODH ; ...
0
heinrichsweikamp
parents:
diff changeset
372
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
373 ; take color / 2 into aa_temp (max red = 15/31)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
374 rrcf win_color1,W ; xRRRRxGG
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
375 andlw b'01111011' ; 0RRRR0GG (don't change C)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
376 movwf aa_temp+0
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
377 rrcf win_color2,W ; GGGxBBBB
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
378 andlw b'11101111' ; GGG0BBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
379 movwf aa_temp+1
0
heinrichsweikamp
parents:
diff changeset
380
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
381 btfss aa_color_half ; color half encoded?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
382 bra aa_decode_12 ; NO
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
383 movff aa_temp+0,PRODH ; YES - add color/2, TFT is big endian, so swap here
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
384 movff aa_temp+1,PRODL ; - ...
0
heinrichsweikamp
parents:
diff changeset
385
heinrichsweikamp
parents:
diff changeset
386 aa_decode_12:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
387 btfss aa_color_quarter ; color quarter encoded?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
388 bra aa_decode_3 ; NO
0
heinrichsweikamp
parents:
diff changeset
389
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
390 ; divide once again by 2 (max red = 7/31)
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
391 rrcf aa_temp+0,W ; xxRRRxxG
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
392 andlw b'00111001' ; 00RRR00G (don't change C)
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
393 movwf aa_temp+0
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
394 rrcf aa_temp+1,W ; GGGxxBBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
395 andlw b'11100111' ; GGG00BBB
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
396 movwf aa_temp+1
0
heinrichsweikamp
parents:
diff changeset
397
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 582
diff changeset
398 movf aa_temp+1,W ; add color/4
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
399 addwf PRODL,F ; NOTE: 7/31+15/31=22/31,
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
400 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
401 addwfc PRODH,F ; in right order, to propagate carry
0
heinrichsweikamp
parents:
diff changeset
402
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
403 aa_decode_12b:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
404 btfsc screen_type2 ; display type 2 ?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
405 call convert_for_display2 ; YES - convert 16 bit RGB b'RRRRRGGG GGGBBBBB' into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
406 bra aa_decode_3 ; continue
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
407
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
408 ; ---- simple BLACK and WHITE cases ------------------------------
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
409 aa_decode_13: ; got a 1xx or a 000 code
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
410 btfsc win_invert ; inverse video mode?
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
411 xorlw 0x80 ; YES - invert levels
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
412 bn aa_decode_2 ; black pixel? -> YES
0
heinrichsweikamp
parents:
diff changeset
413
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
414 ; WHITE pixel (i.e. full color)
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
415 movff win_color1,PRODH ; set current drawing color (display is big endian)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
416 movff win_color2,PRODL ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
417 bra aa_decode_12b ; post-process in case of display type 2
0
heinrichsweikamp
parents:
diff changeset
418
heinrichsweikamp
parents:
diff changeset
419 aa_decode_2:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
420 clrf PRODH ; set drawing color to black
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
421 clrf PRODL ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
422 clrf win_color5 ; set drawing color to black (display type 2)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
423 clrf win_color4 ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
424 clrf win_color3 ; ...
0
heinrichsweikamp
parents:
diff changeset
425
heinrichsweikamp
parents:
diff changeset
426 aa_decode_3:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
427 ;---- PIXEL WRITE LOOP -----------------------------------------------
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
428 bsf tft_rs ; Data!
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
429
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
430 btfsc screen_type2 ; display 2 ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
431 bra aa_decode_3_display2 ; YES
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
432 btfsc screen_type3 ; display 3 ?
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
433 bra aa_decode_3_display3 ; YES
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
434
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
435 movff PRODH,PORTA ; move high byte to PORTA
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
436 movff PRODL,PORTH ; move low byte to PORTH
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
437 aa_decode_3_display0and1:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
438 bcf tft_nwr ; tick
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
439 bsf tft_nwr ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
440 decfsz aa_bitlen,F ; decrement length counter, became zero?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
441 bra aa_decode_3_display0and1; NO - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
442 bra aa_decode_3_done ; YES - done
0
heinrichsweikamp
parents:
diff changeset
443
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
444 aa_decode_3_display2:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
445 movff win_color5,PORTH ; move high byte to PORTH (display is big endian)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
446 bcf tft_nwr ; tick
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
447 bsf tft_nwr ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
448 movff win_color4,PORTH ; move low byte to PORTH
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
449 bcf tft_nwr ; tick
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
450 bsf tft_nwr ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
451 movff win_color3,PORTH ; move low(est) byte to PORTH
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
452 bcf tft_nwr ; tick
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
453 bsf tft_nwr ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
454 decfsz aa_bitlen,F ; decrement length counter, became zero?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
455 bra aa_decode_3_display2 ; NO - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
456 bra aa_decode_3_done ; YES - done
628
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
457
cd58f7fc86db 3.05 stable work
heinrichsweikamp
parents: 623
diff changeset
458 aa_decode_3_display3:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
459 movff PRODH,PORTH ; move high byte to PORTH (display is big endian)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
460 bcf tft_nwr ; tick
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
461 bsf tft_nwr ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
462 movff PRODL,PORTH ; move low byte to PORTH
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
463 bcf tft_nwr ; tick
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
464 bsf tft_nwr ; ...
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
465 decfsz aa_bitlen,F ; decrement length counter, became zero?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
466 bra aa_decode_3_display3 ; NO - loop
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
467
608
d866684249bd work on 2.99 stable
heinrichsweikamp
parents: 604
diff changeset
468 aa_decode_3_done:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
469 ;---- BYTE-CODE LOOP -------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
470 ; all pixel data processed?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
471 movf TBLPTRL,W ; get TBLPTR, low byte
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
472 cpfseq aa_end+0 ; TBLPTR, low byte == end pointer, low byte?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
473 bra aa_decode_1 ; NO - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
474 movf TBLPTRH,W ; YES - get TBLPTR, high byte
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
475 cpfseq aa_end+1 ; - TBLPTR, high byte == end pointer, high byte?
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
476 bra aa_decode_1 ; NO - loop
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
477 return ; YES - done
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
478
0
heinrichsweikamp
parents:
diff changeset
479
heinrichsweikamp
parents:
diff changeset
480 ;------------------------------------------------------------------------------
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
481 ; Print the Output Buffer to Screen
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 608
diff changeset
482 ;
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
483 ; Input buffer - string to print (NULL TERMINATED)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
484 ; Output chars printed to screen
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
485 ;
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
486 global aa_wordprocessor
0
heinrichsweikamp
parents:
diff changeset
487 aa_wordprocessor:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
488 movf font_color,W ; get selected font color (8 bit)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
489 call TFT_set_color ; compute printing color (16 bit)
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
490 rcall aa_string_width ; set win_height and compute win_width:2
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
491 call TFT_box_write ; set up output box
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
492 lfsr FSR2,buffer ; set FSR2 to the start of the output buffer
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
493 Index_out 0x22 ; DATA block command (macro defined in tft.inc)
0
heinrichsweikamp
parents:
diff changeset
494
heinrichsweikamp
parents:
diff changeset
495 aa_wordprocessor_1:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
496 movf POSTINC2,W ; read character from the buffer
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
497 bz aa_wordprocessor_99 ; done if null byte encountered
0
heinrichsweikamp
parents:
diff changeset
498
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
499 rcall aa_char_setup ; setup pointers for the char
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
500 rcall aa_decode_char ; print character to screen
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
501 bra aa_wordprocessor_1 ; loop
0
heinrichsweikamp
parents:
diff changeset
502
heinrichsweikamp
parents:
diff changeset
503 aa_wordprocessor_99:
634
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
504 Index_out 0x00 ; send end of bloc command
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
505 bcf win_invert ; terminate inverse printing
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
506 return ; done
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
507
4050675965ea 3.10 stable release
heinrichsweikamp
parents: 628
diff changeset
508 ;------------------------------------------------------------------------------
0
heinrichsweikamp
parents:
diff changeset
509
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 436
diff changeset
510 END