annotate src/aa_wordprocessor.asm @ 623:c40025d8e750

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