Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm @ 120:5c7f98fad01a
aa_wordprocessor too fast ?
author | JeanDo |
---|---|
date | Sat, 11 Dec 2010 16:23:43 +0100 |
parents | 3bcccb697bce |
children | 25433449bcb5 |
rev | line source |
---|---|
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
1 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
2 ; |
120 | 3 ; File aa_wordprocessor.asm |
4 ; | |
5 ; Anti-aliased word processor | |
6 ; | |
7 ; This program is free software: you can redistribute it and/or modify | |
8 ; it under the terms of the GNU General Public License as published by | |
9 ; the Free Software Foundation, either version 3 of the License, or | |
10 ; (at your option) any later version. | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
11 ; |
120 | 12 ; This program is distributed in the hope that it will be useful, |
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ; GNU General Public License for more details. | |
16 ; | |
17 ; You should have received a copy of the GNU General Public License | |
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 ; | |
20 ; Copyright (c) 2010, JD Gascuel. | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
21 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
22 ; HISTORY |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
23 ; 2010-11-22 : [jDG] Creation. |
120 | 24 ; 2010-12-01 : [jDG] Adding 3bits antialiased fonts. |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
25 ; |
120 | 26 ; BUGS : |
27 ; * If the three fonts are not in the same half of the PROM memory, TBLPTRU | |
28 ; will be badly set, and font48 or font90 will display giberish... | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
29 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
30 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
31 ; MEMORY FOOTPRINT: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
32 ;------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
33 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
34 ; wp_wordprocessor : 8KB, including fonts. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
35 ; aa_wordprocessor : 0.5KB code |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
36 ; + 3.5KB aa_font28 (reduced to 99 chars) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
37 ; + 1.6KB aa_font48 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
38 ; + 2.2KB aa_font90 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
39 ; = 7.9 KB including fonts... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
40 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
41 ; Input registers: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
42 ; letter:26 String to print. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
43 ; win_font Font size (0=small, 1=medium, 2=large) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
44 ; win_color1:2 16bits unpacked color |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
45 ; win_top, win_leftx2 Position on screen |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
46 ; win_inverse Inverse video mode. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
47 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
48 ; Available general purpose registers: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
49 ; PRODH, PRODL (needed for array indexing) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
50 ; FSRx 12bits. Usefull as RAM pointers. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
51 ;============================================================================= |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
52 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
53 ; Flags allocation: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
54 #define aa_antialias aa_flags,0 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
55 #define aa_color_quart aa_flags,1 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
56 #define aa_color_half aa_flags,2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
57 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
58 ; Extracted from p3_wordprocessor includes: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
59 #include aa_fonts.asm |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
60 aa_wp code ; Mark segment into the .map file |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
61 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
62 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
63 ; Setup pointers for a char: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
64 ; Inputs WREG = char to draw, win_font |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
65 ; Output aa_start, aa_end, aa_height, aa_flags |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
66 ; Trashed PRODH, PRODL, TBLPTR, TABLAT |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
67 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
68 aa_char_setup: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
69 movwf PRODL,A ; save char into PROD for now. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
70 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
71 movf win_font,W,BANKED ; Get font number (updates Z flag) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
72 bnz aa_char_1 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
73 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
74 ; SMALL font ----------------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
75 ; Font SMALL character folding... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
76 aa_char_0: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
77 movlw LOW aa_font28_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
78 movwf TBLPTRL,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
79 movlw HIGH aa_font28_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
80 movwf TBLPTRH,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
81 bra aa_char_3 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
82 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
83 ; MEDIUM font ---------------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
84 aa_char_1: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
85 decfsz WREG,A ; This is medium font ??? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
86 bra aa_char_2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
87 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
88 ; Font MEDIUM block: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
89 movlw LOW aa_font48_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
90 movwf TBLPTRL,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
91 movlw HIGH aa_font48_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
92 movwf TBLPTRH,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
93 bra aa_char_3 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
94 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
95 ; LARGE font ----------------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
96 aa_char_2: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
97 ; Font LARGE block: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
98 movlw LOW aa_font90_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
99 movwf TBLPTRL,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
100 movlw HIGH aa_font90_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
101 movwf TBLPTRH,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
102 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
103 ; Execute font block --------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
104 aa_char_3: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
105 movlw UPPER aa_font28_block |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
106 movwf TBLPTRU,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
107 |
91 | 108 ; Proceed to character substitutions |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
109 aa_char_30: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
110 tblrd*+ ; Read FROM char |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
111 movf TABLAT,W ; Get it, and set Z,N |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
112 bz aa_char_32 ; Break at end of translations |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
113 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
114 tblrd*+ ; Read TO char |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
115 cpfseq PRODL,A ; FROM == current char ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
116 bra aa_char_30 ; Different: loop |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
117 movff TABLAT, PRODL ; make substitution |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
118 bra aa_char_30 ; Loop. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
119 |
91 | 120 ; Make sure char is in the available range |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
121 aa_char_32: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
122 tblrd*+ ; Read first char |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
123 movf TABLAT,W ; get it. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
124 subwf PRODL,F ; (char - first) --> PRODL |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
125 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
126 tblrd*+ ; Read nb chars |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
127 movf TABLAT,W ; nbchars --> WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
128 tblrd*+ ; Read default char |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
129 cpfslt PRODL ; if char > WREG ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
130 movff TABLAT,PRODL ; replace PRODL |
91 | 131 |
132 ; Decode font height and anti-aliasing mode | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
133 clrf aa_flags,BANKED ; Default to no AA |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
134 tblrd*+ ; Read font height + AA flag |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
135 movf TABLAT,W ; into WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
136 bnn aa_char_34 ; High bit set ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
137 bsf aa_antialias,BANKED ; YES : then the font is AA. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
138 aa_char_34 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
139 andlw 0x7F ; Keep just font height, |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
140 movwf aa_height,BANKED ; then save it (its a register) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
141 |
91 | 142 ; Set PROM pointer to the char index |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
143 movf PRODL,W ; Read back char |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
144 mullw 2 ; PROD = 2*(char - base), TBLPTR=idx |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
145 movf PRODL,W |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
146 addwf TBLPTRL,F ; Add into TBLPTR (low byte) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
147 movf PRODH,W |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
148 addwfc TBLPTRH,F ; and high byte. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
149 |
91 | 150 ; Read start and stop pointers |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
151 tblrd*+ ; aa_start = PROM16(*tblptr++) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
152 movff TABLAT,aa_start ; Read low byte |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
153 tblrd*+ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
154 movff TABLAT,aa_start+1 ; and high byte |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
155 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
156 tblrd*+ ; aa_end = PROM16(*tblptr++) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
157 movff TABLAT,aa_end ; Read low byte |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
158 tblrd*+ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
159 movff TABLAT,aa_end+1 ; and high byte |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
160 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
161 return |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
162 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
163 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
164 ; Character width |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
165 ; Inputs aa_start, aa_end, aa_width, aa_height, aa_flags |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
166 ; Output width added to aa_width |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
167 ; Trashed aa_bitlen, TBLPTR, TABLAT |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
168 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
169 aa_char_width: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
170 movff aa_start, TBLPTRL ; TBLPTR = aa_start |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
171 movff aa_start+1, TBLPTRH |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
172 clrf aa_bitlen,BANKED ; clear reminders... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
173 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
174 ; Read bitmap byte, and decode length: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
175 aa_char_width_1: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
176 ifdef AA_BYTE_SWAP |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
177 btg TBLPTRL,0,A ; Toggle low ptr bit. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
178 tblrd* |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
179 movf TABLAT,W,A ; Store to WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
180 btg TBLPTRL,0,A ; Get is back |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
181 tblrd*+ ; then increment (but trash TABLAT) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
182 movwf TABLAT,A ; Then restore copy to TABLAT. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
183 else |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
184 tblrd*+ ; Normal read... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
185 movf TABLAT,W,A ; Store copy to WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
186 endif |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
187 btfss aa_antialias,BANKED ; Antialiased font ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
188 bra aa_char_width_10 ; No: always 7 bits count |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
189 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
190 bn aa_char_width_10 ; Non-white pixels ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
191 andlw 0x1F ; Yes : 5 bits count. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
192 aa_char_width_10: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
193 andlw 0x7F ; No: 7 bit count. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
194 incf WREG,A ; WREG = repetition count |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
195 addwf aa_bitlen,F,BANKED ; Add remaining pixels from last code. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
196 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
197 movf aa_height,W,BANKED ; WREG = - height |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
198 negf WREG,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
199 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
200 ; This is a hand-made division by successive substraction of height |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
201 aa_char_width_2: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
202 addwf aa_bitlen,F,BANKED ; Try to substract aa_height |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
203 bn aa_char_width_3 ; If neg it was a bad idea... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
204 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
205 infsnz aa_width,F,BANKED ; Succeded: do a 12bit increment |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
206 incf aa_width+1,F,BANKED ; on the aa_width counter. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
207 bra aa_char_width_2 ; and loop. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
208 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
209 aa_char_width_3: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
210 negf WREG,A ; WREG = +height |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
211 addwf aa_bitlen,F,BANKED ; Restore true reminder. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
212 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
213 ; Are we done ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
214 movf TBLPTRL,W,A ; Compare TBLPTR to aa_end |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
215 cpfseq aa_end,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
216 bra aa_char_width_1 ; Loop if LOW is different |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
217 movf TBLPTRH,W,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
218 cpfseq aa_end+1,BANKED ; Loop to if HIGH is different |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
219 bra aa_char_width_1 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
220 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
221 return |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
222 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
223 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
224 ; String width |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
225 ; Inputs letter (SHOULD BE NULL TERMINATED) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
226 ; Output aa_width, aa_height |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
227 ; Trashed PROD, TBLPTR, FSR2, aa_bitlen, aa_start, aa_end, aa_flags |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
228 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
229 aa_string_width: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
230 lfsr FSR2, letter ; FSR2 pointer to start of string. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
231 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
232 clrf aa_width,BANKED ; Clear width sum. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
233 clrf aa_width+1,BANKED ; (12 bit counter) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
234 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
235 aa_string_width_1: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
236 movf POSTINC2,W,A ; WREG = *FSR2++ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
237 bz aa_string_width99 ; Exit if null byte encountered. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
238 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
239 rcall aa_char_setup ; setup aa_start / aa_end |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
240 rcall aa_char_width ; sum-up width into aa_width |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
241 bra aa_string_width_1 ; and loop. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
242 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
243 aa_string_width99: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
244 return |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
245 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
246 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
247 ; Fast macros to write to OLED display. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
248 ; Adding a call/return adds 3 words and a pipeline flush, hence make it |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
249 ; nearly twice slower... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
250 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
251 ; Input : commande as macro parameter. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
252 ; Output : NONE |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
253 ; Trash : WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
254 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
255 AA_CMD_WRITE macro cmd |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
256 movlw cmd |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
257 bcf oled_rs ; Cmd mode |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
258 movwf PORTD,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
259 bcf oled_rw ; Tick the clock |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
260 bsf oled_rw |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
261 endm |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
262 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
263 ; Input : PRODH:L as 16bits data. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
264 ; Output : NONE |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
265 ; Trash : NONE |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
266 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
267 AA_DATA_WRITE_PROD macro |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
268 bsf oled_rs ; Data mode |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
269 movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN! |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
270 bcf oled_rw ; Tick the clock |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
271 bsf oled_rw |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
272 movff PRODL,PORTD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
273 bcf oled_rw ; Tick the clock |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
274 bsf oled_rw |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
275 endm |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
276 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
277 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
278 ; Output OLED Window Address commands. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
279 ; Inputs : win_top, win_leftx2, aa_height, aa_width. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
280 ; Output : PortD commands. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
281 ; Trashed: PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
282 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
283 aa_box_cmd: |
120 | 284 AA_CMD_WRITE 0x35 ; this is the left border |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
285 movf win_leftx2,W,BANKED ; Compute left = 2*leftx2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
286 mullw 2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
287 AA_DATA_WRITE_PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
288 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
289 movf aa_width,W,BANKED ; right = left + width - 1 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
290 addwf PRODL,F,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
291 movf aa_width+1,W,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
292 addwfc PRODH,F,A |
120 | 293 AA_CMD_WRITE 0x36 ; Write and the right border |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
294 decf PRODL,F,A ; decrement result |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
295 bc aa_box_cmd_1 ; No borrow (/Carry) ? skip propagating. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
296 decf PRODH,F,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
297 aa_box_cmd_1: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
298 AA_DATA_WRITE_PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
299 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
300 movf win_top,W,BANKED ; Write top / bottom window |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
301 movwf PRODH,A ; (remember PRODH output first) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
302 addwf aa_height,W,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
303 decf WREG,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
304 movwf PRODL,A ; And PRODL is later... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
305 AA_CMD_WRITE 0x37 |
120 | 306 nop |
307 nop | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
308 AA_DATA_WRITE_PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
309 |
120 | 310 AA_CMD_WRITE 0x20 |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
311 movf win_leftx2,W,BANKED ; Start ptr left |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
312 mullw 2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
313 AA_DATA_WRITE_PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
314 |
120 | 315 AA_CMD_WRITE 0x21 |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
316 movf win_top,W,BANKED ; Start ptr top |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
317 mullw 1 ; Load into PRODH:L |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
318 AA_DATA_WRITE_PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
319 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
320 return |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
321 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
322 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
323 ; Decode a compressed char. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
324 ; Inputs aa_start, aa_end, aa_height, win_invert, win_color1, win_color2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
325 ; Output none |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
326 ; Trashed TBLPTR, TABLAT, PROD, aa_bitlen, aa_flags, aa_colorDir:2 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
327 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
328 aa_decode_char: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
329 movff aa_start, TBLPTRL ; TBLPTR = aa_start |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
330 movff aa_start+1, TBLPTRH |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
331 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
332 ; Read bitmap byte, and decode color & length |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
333 aa_decode_1: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
334 ifdef AA_BYTE_SWAP |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
335 btg TBLPTRL,0,A ; Toggle low ptr bit. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
336 tblrd* |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
337 movf TABLAT,W,A ; Store to WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
338 btg TBLPTRL,0,A ; Get is back |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
339 tblrd*+ ; then increment (but trash TABLAT) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
340 movwf TABLAT,A ; Then restore copy to TABLAT. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
341 else |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
342 tblrd*+ ; Normal read... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
343 movf TABLAT,W,A ; Store copy to WREG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
344 endif |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
345 btfss aa_antialias,BANKED ; Antialiased font ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
346 bra aa_decode_10 ; No: always 7 bits count |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
347 bn aa_decode_10 ; Non-white pixels ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
348 andlw 0x1F ; Yes : 5 bits count. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
349 aa_decode_10: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
350 andlw 0x7F ; No: 7 bit count. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
351 incf WREG,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
352 movwf aa_bitlen,BANKED ; repetition count --> aa_bitlen |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
353 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
354 ;---- COLOR DECODING --------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
355 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
356 ; Code Normal Inverse |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
357 ; 1xx 0% 100% : Managed by aa_decode_13 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
358 ; 011 25% 75% |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
359 ; 010 50% 50% |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
360 ; 001 75% 25% |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
361 ; 000 100% 0% : Managed by aa_decode_13 too. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
362 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
363 movf TABLAT,W,A ; Get back code |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
364 btfss aa_antialias,BANKED ; Antialiased font ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
365 bra aa_decode_13 ; NO: 1bit case |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
366 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
367 ; Asymetry test: 1xx code is another case for 1bit color. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
368 ; This have to be done before inverse video, because |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
369 ; of the asymetric processing ! |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
370 bn aa_decode_13 ; decode as not-aa |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
371 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
372 ; Manage 000 special case too: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
373 andlw 0xE0 ; Select color bits |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
374 bz aa_decode_13 ; That's a 000 ! |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
375 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
376 ; Apply reverse video, in a reversed way |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
377 btfss win_invert,0 ; Inverse video mode ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
378 sublw 0x80 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
379 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
380 ; Move the two bits to aa_color_half and aa_color_quarter: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
381 swapf WREG ; --> 0000.0LL0 byte |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
382 iorlw b'001' ; We are in AA mode, don't forget it ! |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
383 movwf aa_flags ; save that to aa_color_(half/quad)/AA flags. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
384 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
385 ;---- 2 bit x RGB(16bits) computation ---------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
386 clrf PRODL ; We will accumulate result here... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
387 clrf PRODH |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
388 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
389 ; Take color div 2 into aa_colorDiv. Max red = 15/31 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
390 rrcf win_color1,W,BANKED ; xRRRRxGG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
391 andlw b'01111011' ; 0RRRR0GG (don't change C) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
392 movwf aa_colorDiv+0,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
393 rrcf win_color2,W,BANKED ; GGGxBBBB |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
394 andlw b'11101111' ; GGG0BBBB |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
395 movwf aa_colorDiv+1,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
396 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
397 btfss aa_color_half |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
398 bra aa_decode_12 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
399 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
400 movff aa_colorDiv+0,PRODH ; Add color/2 if bit set. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
401 movff aa_colorDiv+1,PRODL ; OLED is big endian, so swap here. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
402 aa_decode_12: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
403 btfss aa_color_quart |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
404 bra aa_decode_3 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
405 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
406 ; Divide it once again by 2. Max red = 7/31. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
407 rrcf aa_colorDiv+0,W,BANKED ; xxRRRxxG |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
408 andlw b'00111001' ; 00RRR00G (don't change C) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
409 movwf aa_colorDiv+0,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
410 rrcf aa_colorDiv+1,W,BANKED ; GGGxxBBB |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
411 andlw b'11100111' ; GGG00BBB |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
412 movwf aa_colorDiv+1,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
413 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
414 movf aa_colorDiv+1,W,BANKED ; Add color/4 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
415 addwf PRODL,F ; NOTE: 7/31+15/31=22/31, |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
416 movf aa_colorDiv+0,W,BANKED ; hence composants won't overlap. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
417 addwfc PRODH,F ; In right order, to propagate carry. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
418 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
419 bra aa_decode_3 ; Done. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
420 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
421 ; ---- Simple BLACK and WHITE cases ------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
422 aa_decode_13: ; Got a 1xx or a 000 code... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
423 btfsc win_invert,0 ; Inverse video mode ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
424 xorlw 0x80 ; YES: invert levels. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
425 bn aa_decode_2 ; Then test high bit. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
426 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
427 ; WHITE pixel (ie. full color) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
428 movff win_color1,PRODH ; current draw color |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
429 movff win_color2,PRODL ; (rem: OLED is big endian) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
430 bra aa_decode_3 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
431 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
432 aa_decode_2: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
433 clrf PRODH,A ; BLACK pixel |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
434 clrf PRODL,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
435 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
436 aa_decode_3: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
437 ;---- PIXEL WRITE LOOP ------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
438 AA_DATA_WRITE_PROD |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
439 decf aa_bitlen,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
440 bnz aa_decode_3 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
441 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
442 ;---- BYTE-CODE LOOP --------------------------------------------- |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
443 ; Are we done ? |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
444 movf TBLPTRL,W,A ; Compare TBLPTR to aa_end |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
445 cpfseq aa_end,BANKED |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
446 bra aa_decode_1 ; Loop if LOW is different |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
447 movf TBLPTRH,W,A |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
448 cpfseq aa_end+1,BANKED ; Loop to if HIGH is different |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
449 bra aa_decode_1 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
450 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
451 return |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
452 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
453 ;------------------------------------------------------------------------------ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
454 ; Setup pointers for a char: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
455 ; Inputs : letter : string to print (SHOULD BE NULL TERMINATED) |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
456 ; Output : OLED commands on port D + clocks. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
457 ; |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
458 aa_wordprocessor: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
459 ; Make sure context is well known |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
460 movlb HIGH aa_start ; Switch to bank 0... |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
461 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
462 rcall aa_string_width ; Set aa_height, compute aa_width |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
463 rcall aa_box_cmd ; Use that for the box. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
464 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
465 ; Restart the loop for each char to print |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
466 lfsr FSR2, letter ; FSR2 pointer to start of string. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
467 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
468 ; DATA bloc commande: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
469 AA_CMD_WRITE 0x22 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
470 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
471 aa_wordprocessor_1: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
472 movf POSTINC2,W,A ; WREG = *FSR2++ |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
473 bz aa_wordprocessor_99 ; Exit if null byte encountered. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
474 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
475 rcall aa_char_setup ; setup aa_start / aa_end |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
476 rcall aa_decode_char ; sum-up width into aa_width |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
477 bra aa_wordprocessor_1 ; and loop. |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
478 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
479 aa_wordprocessor_99: |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
480 ; END of bloc commande |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
481 AA_CMD_WRITE 0x00 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
482 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff
changeset
|
483 return |