annotate code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm @ 695:5bf4f526f552

... minor cleanups ...
author JeanDo
date Wed, 13 Feb 2013 10:36:28 +0100
parents 6e456a6398e0
children 55983c4d6b2d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ;
95
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
3 ; File aa_wordprocessor.asm
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
4 ;
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
5 ; Anti-aliased word processor
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
6 ;
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
7 ; This program is free software: you can redistribute it and/or modify
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
8 ; it under the terms of the GNU General Public License as published by
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
9 ; the Free Software Foundation, either version 3 of the License, or
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
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 ;
95
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
12 ; This program is distributed in the hope that it will be useful,
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
15 ; GNU General Public License for more details.
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
16 ;
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
17 ; You should have received a copy of the GNU General Public License
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
19 ;
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
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.
95
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
24 ; 2010-12-01 : [jDG] Adding 3bits antialiased fonts.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
25 ; 2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
26 ;
95
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
27 ; BUGS :
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
28 ; * If the three fonts are not in the same half of the PROM memory, TBLPTRU
d79bf9df55d7 aa_wordprocessor too fast ?
JeanDo
parents: 91
diff changeset
29 ; 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
30 ;=============================================================================
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
31 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
32 ; MEMORY FOOTPRINT:
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 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
35 ; wp_wordprocessor : 8KB, including fonts.
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
36 ; aa_wordprocessor : 0.5KB code
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
37 ; + 3.5KB aa_font28 (reduced to 99 chars)
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
38 ; + 1.6KB aa_font48
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
39 ; + 2.2KB aa_font90
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
40 ; = 7.9 KB including fonts...
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
41 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
42 ; Input registers:
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
43 ; letter:26 String to print.
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
44 ; 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
45 ; win_color1:2 16bits unpacked color
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
46 ; win_top, win_leftx2 Position on screen
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
47 ; win_inverse Inverse video mode.
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
48 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
49 ; Available general purpose registers:
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
50 ; PRODH, PRODL (needed for array indexing)
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
51 ; FSRx 12bits. Usefull as RAM pointers.
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
52 ;=============================================================================
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
53 ; Temporary variables are overlayed in bank 0 ACCESS, used also by C-code
260
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
54 ; (p2_deco), MPLAB math and stdlib libraries.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
55
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
56 CBLOCK 0x000
260
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
57 aa_flags ; Various flags for aa_wordprocessor
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
58 aa_width:2 ; Width in pixels (0..319)
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
59 aa_bitlen ; Count of pixels when decoding bitmaps.
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
60 aa_start:2 ; PROM ptr to start of encoded bitmap
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
61 aa_end:2 ; and end of it.
bde83cac971f BUGFIX bb13 : deco_calc_desaturation_time() should reset TBLPTR Upper register.
JeanDo
parents: 167
diff changeset
62 aa_temp:2 ; Current color, divided by 2 or 4
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
63 ENDC
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
64
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
65 ; Flags allocation:
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
66 #define aa_antialias aa_flags,0
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
67 #define aa_color_quart aa_flags,1
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
68 #define aa_color_half aa_flags,2
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
69
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 ; Setup pointers for a char:
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
72 ; Inputs WREG = char to draw, win_font
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
73 ; Output aa_start, aa_end, win_height, aa_flags
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
74 ; Trashed PRODH, PRODL, TBLPTR, TABLAT
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
75 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
76 aa_char_setup:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
77 movwf PRODL,A ; save char into PROD for now.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
78
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
79 movf win_font,W,BANKED ; Get font number (updates Z flag)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
80 bnz aa_char_1
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
81
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
82 ; SMALL font ---------------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
83 ; Font SMALL character folding...
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
84 aa_char_0:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
85 movlw LOW aa_font28_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
86 movwf TBLPTRL,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
87 movlw HIGH aa_font28_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
88 movwf TBLPTRH,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
89 bra aa_char_3
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
90
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
91 ; MEDIUM font --------------------------------------------------------
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
92 aa_char_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
93 decfsz WREG,A ; This is medium font ???
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
94 bra aa_char_2
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
95
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
96 ; Font MEDIUM block:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
97 movlw LOW aa_font48_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
98 movwf TBLPTRL,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
99 movlw HIGH aa_font48_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
100 movwf TBLPTRH,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
101 bra aa_char_3
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
102
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
103 ; LARGE font ---------------------------------------------------------
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
104 aa_char_2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
105 ; Font LARGE block:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
106 movlw LOW aa_font90_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
107 movwf TBLPTRL,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
108 movlw HIGH aa_font90_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
109 movwf TBLPTRH,A
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
110
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
111 ; Execute font block -------------------------------------------------
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
112 aa_char_3:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
113 ; This is safe iff the three fonts are in the same code segment
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
114 ; (and that segment do not span the 64K edge...)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
115 movlw UPPER aa_font28_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
116 movwf TBLPTRU,A
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
117
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
118 ; Proceed to character substitutions
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
119 aa_char_30:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
120 tblrd*+ ; Read FROM char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
121 movf TABLAT,W ; Get it, and set Z,N
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
122 bz aa_char_32 ; Break at end of translations
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
124 tblrd*+ ; Read TO char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
125 cpfseq PRODL,A ; FROM == current char ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
126 bra aa_char_30 ; Different: loop
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
127 movff TABLAT, PRODL ; make substitution
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
128 bra aa_char_30 ; Loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
129
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
130 ; 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
131 aa_char_32:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
132 tblrd*+ ; Read first char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
133 movf TABLAT,W ; get it.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
134 subwf PRODL,F ; (char - first) --> PRODL
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
135
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
136 tblrd*+ ; Read nb chars
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
137 movf TABLAT,W ; nbchars --> WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
138 tblrd*+ ; Read default char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
139 cpfslt PRODL ; if char > WREG ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
140 movff TABLAT,PRODL ; replace PRODL
91
3bcccb697bce Added HW logo and dimmed cursor in small font.
JeanDo
parents: 83
diff changeset
141
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
142 ; Decode font height and anti-aliasing mode
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
143 clrf aa_flags,ACCESS ; Default to no AA
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
144 tblrd*+ ; Read font height + AA flag
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
145 movf TABLAT,W ; into WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
146 bnn aa_char_34 ; High bit set ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
147 bsf aa_antialias,ACCESS ; YES : then the font is AA.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
148 aa_char_34:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
149 andlw 0x7F ; Keep just font height,
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
150 movwf win_height,BANKED ; then save it (its a register)
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
151
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
152 ; Set PROM pointer to the char index
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
153 movf PRODL,W ; Read back char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
154 mullw 2 ; PROD = 2*(char - base), TBLPTR=idx
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
155 movf PRODL,W
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
156 addwf TBLPTRL,F ; Add into TBLPTR (low byte)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
157 movf PRODH,W
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
158 addwfc TBLPTRH,F ; and high byte.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
159
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
160 ; Read start and stop pointers
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
161 tblrd*+ ; aa_start = PROM16(*tblptr++)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
162 movff TABLAT,aa_start+0 ; Read low byte
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
163 tblrd*+
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
164 movff TABLAT,aa_start+1 ; and high byte
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
165
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
166 tblrd*+ ; aa_end = PROM16(*tblptr++)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
167 movff TABLAT,aa_end+0 ; Read low byte
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
168 tblrd*+
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
169 movff TABLAT,aa_end+1 ; and high byte
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
170
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
171 return
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
172
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 ; Character width
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
175 ; Inputs aa_start, aa_end, aa_width, win_height, aa_flags
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
176 ; Output width added to aa_width
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
177 ; Trashed aa_bitlen, TBLPTR, TABLAT
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
178 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
179 aa_char_width:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
180 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
181 movff aa_start+1, TBLPTRH
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
182 clrf aa_bitlen,ACCESS ; clear reminders...
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
183
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
184 ; Read bitmap byte, and decode length:
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
185 aa_char_width_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
186 ifdef AA_BYTE_SWAP
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
187 btg TBLPTRL,0,A ; Toggle low ptr bit.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
188 tblrd*
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
189 movf TABLAT,W,A ; Store to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
190 btg TBLPTRL,0,A ; Get is back
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
191 tblrd*+ ; then increment (but trash TABLAT)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
192 movwf TABLAT,A ; Then restore copy to TABLAT.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
193 else
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
194 tblrd*+ ; Normal read...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
195 movf TABLAT,W,A ; Store copy to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
196 endif
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
197 btfss aa_antialias,ACCESS ; Antialiased font ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
198 bra aa_char_width_10 ; No: always 7 bits count
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
199
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
200 bn aa_char_width_10 ; Non-white pixels ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
201 andlw 0x1F ; Yes : 5 bits count.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
202 aa_char_width_10:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
203 andlw 0x7F ; No: 7 bit count.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
204 incf WREG,A ; WREG = repetition count
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
205 addwf aa_bitlen,F,ACCESS ; Add remaining pixels from last code.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
206
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
207 movf win_height,W,BANKED ; WREG = - height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
208 negf WREG,A
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
209
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
210 ; This is a hand-made division by successive substraction of height
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
211 aa_char_width_2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
212 addwf aa_bitlen,F,ACCESS ; Try to substract win_height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
213 bn aa_char_width_3 ; If neg it was a bad idea...
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
214
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
215 infsnz aa_width+0,F,ACCESS ; Succeded: do a 16bit increment
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
216 incf aa_width+1,F,ACCESS ; on the aa_width counter.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
217 bra aa_char_width_2 ; and loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
218
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
219 aa_char_width_3:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
220 negf WREG,A ; WREG = +height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
221 addwf aa_bitlen,F,ACCESS ; Restore true reminder.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
222
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
223 ; Are we done ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
224 movf TBLPTRL,W,A ; Compare TBLPTR to aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
225 cpfseq aa_end+0,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
226 bra aa_char_width_1 ; Loop if LOW is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
227 movf TBLPTRH,W,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
228 cpfseq aa_end+1,ACCESS ; Loop to if HIGH is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
229 bra aa_char_width_1
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
230
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
231 return
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
232
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
233 ;------------------------------------------------------------------------------
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
234 ; String width
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
235 ; Inputs letter (SHOULD BE NULL TERMINATED)
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
236 ; Output aa_width, win_height
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
237 ; 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
238 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
239 aa_string_width:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
240 lfsr FSR2, letter ; FSR2 pointer to start of string.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
241
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
242 clrf aa_width+0,ACCESS ; Clear width sum.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
243 clrf aa_width+1,ACCESS ; (16 bit counter)
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
244
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
245 aa_string_width_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
246 movf POSTINC2,W,A ; WREG = *FSR2++
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
247 bz aa_string_width99 ; Exit if null byte encountered.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
248
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
249 rcall aa_char_setup ; setup aa_start / aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
250 rcall aa_char_width ; sum-up width into aa_width
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
251 bra aa_string_width_1 ; and loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
252
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
253 aa_string_width99:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
254 return
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
255
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
256 ;------------------------------------------------------------------------------
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
257 ; Decode a compressed char.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
258 ; Inputs aa_start, aa_end, win_height, win_invert, win_color1, win_color2
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
259 ; Output none
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
260 ; 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
261 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
262 aa_decode_char:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
263 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
264 movff aa_start+1, TBLPTRH
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
265
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
266 ; Read bitmap byte, and decode color & length
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
267 aa_decode_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
268 ifdef AA_BYTE_SWAP
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
269 btg TBLPTRL,0,A ; Toggle low ptr bit.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
270 tblrd*
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
271 movf TABLAT,W,A ; Store to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
272 btg TBLPTRL,0,A ; Get is back
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
273 tblrd*+ ; then increment (but trash TABLAT)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
274 movwf TABLAT,A ; Then restore copy to TABLAT.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
275 else
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
276 tblrd*+ ; Normal read...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
277 movf TABLAT,W,A ; Store copy to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
278 endif
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
279 btfss aa_antialias,ACCESS ; Antialiased font ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
280 bra aa_decode_10 ; No: always 7 bits count
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
281 bn aa_decode_10 ; Non-white pixels ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
282 andlw 0x1F ; Yes : 5 bits count.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
283 aa_decode_10:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
284 andlw 0x7F ; No: 7 bit count.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
285 incf WREG,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
286 movwf aa_bitlen,ACCESS ; repetition count --> aa_bitlen
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
287
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
288 ;---- COLOR DECODING -------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
289 ;
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
290 ; Code Normal Inverse
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
291 ; 1xx 0% 100% : Managed by aa_decode_13
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
292 ; 011 25% 75%
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
293 ; 010 50% 50%
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
294 ; 001 75% 25%
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
295 ; 000 100% 0% : Managed by aa_decode_13 too.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
296 ;
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
297 movf TABLAT,W,A ; Get back code
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
298 btfss aa_antialias,ACCESS ; Antialiased font ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
299 bra aa_decode_13 ; NO: 1bit case
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
300
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
301 ; Asymetry test: 1xx code is another case for 1bit color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
302 ; This have to be done before inverse video, because
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
303 ; of the asymetric processing !
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
304 bn aa_decode_13 ; decode as not-aa
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
305
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
306 ; Manage 000 special case too:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
307 andlw 0xE0 ; Select color bits
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
308 bz aa_decode_13 ; That's a 000 !
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
309
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
310 ; Apply reverse video, in a reversed way
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
311 btfss win_invert,0 ; Inverse video mode ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
312 sublw 0x80
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
313
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
314 ; Move the two bits to aa_color_half and aa_color_quarter:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
315 swapf WREG ; --> 0000.0LL0 byte
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
316 iorlw b'001' ; We are in AA mode, don't forget it !
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
317 movwf aa_flags,ACCESS ; save that to aa_color_(half/quad)/AA flags.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
318
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
319 ;---- 2 bit x RGB(16bits) computation --------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
320 clrf PRODL ; We will accumulate result here...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
321 clrf PRODH
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
322
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
323 ; Take color div 2 into aa_temp. Max red = 15/31
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
324 rrcf win_color1,W,BANKED ; xRRRRxGG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
325 andlw b'01111011' ; 0RRRR0GG (don't change C)
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
326 movwf aa_temp+0,ACCESS
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
327 rrcf win_color2,W,BANKED ; GGGxBBBB
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
328 andlw b'11101111' ; GGG0BBBB
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
329 movwf aa_temp+1,ACCESS
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
330
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
331 btfss aa_color_half,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
332 bra aa_decode_12
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
333
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
334 movff aa_temp+0,PRODH ; Add color/2 if bit set.
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
335 movff aa_temp+1,PRODL ; DISPLAY is big endian, so swap here.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
336 aa_decode_12:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
337 btfss aa_color_quart,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
338 bra aa_decode_3
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
339
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
340 ; Divide it once again by 2. Max red = 7/31.
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
341 rrcf aa_temp+0,W,ACCESS ; xxRRRxxG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
342 andlw b'00111001' ; 00RRR00G (don't change C)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
343 movwf aa_temp+0,ACCESS
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
344 rrcf aa_temp+1,W,ACCESS ; GGGxxBBB
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
345 andlw b'11100111' ; GGG00BBB
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
346 movwf aa_temp+1,ACCESS
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
347
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
348 movf aa_temp+1,W,ACCESS ; Add color/4
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
349 addwf PRODL,F ; NOTE: 7/31+15/31=22/31,
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
350 movf aa_temp+0,W,ACCESS ; hence composants won't overlap.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
351 addwfc PRODH,F ; In right order, to propagate carry.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
352
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
353 bra aa_decode_3 ; Done.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
354
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
355 ; ---- Simple BLACK and WHITE cases ------------------------------
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
356 aa_decode_13: ; Got a 1xx or a 000 code...
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
357 btfsc win_invert,0 ; Inverse video mode ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
358 xorlw 0x80 ; YES: invert levels.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
359 bn aa_decode_2 ; Then test high bit.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
360
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
361 ; WHITE pixel (ie. full color)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
362 movff win_color1,PRODH ; current draw color
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
363 movff win_color2,PRODL ; (rem: DISPLAY is big endian)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
364 setf win_color3
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
365 bra aa_decode_3
83
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 aa_decode_2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
368 clrf PRODH,A ; BLACK pixel
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
369 clrf PRODL,A
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
370 clrf win_color3
83
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 aa_decode_3:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
373 ;---- PIXEL WRITE LOOP -----------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
374 AA_DATA_WRITE_PROD
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
375 decf aa_bitlen,F,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
376 bnz aa_decode_3
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
377
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
378 ;---- BYTE-CODE LOOP -------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
379 ; Are we done ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
380 movf TBLPTRL,W,A ; Compare TBLPTR to aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
381 cpfseq aa_end+0,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
382 bra aa_decode_1 ; Loop if LOW is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
383 movf TBLPTRH,W,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
384 cpfseq aa_end+1,ACCESS ; Loop to if HIGH is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
385 bra aa_decode_1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
386
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
387 return
83
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 ;------------------------------------------------------------------------------
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
390 ; Setup pointers for a char:
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
391 ; Inputs : letter : string to print (SHOULD BE NULL TERMINATED)
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
392 ; Output : DISPLAY commands on port D + clocks.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
393 ;
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 142
diff changeset
394 global aa_wordprocessor ; Callable from C-code.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
395 aa_wordprocessor:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
396 ; Make sure context is well known
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
397 movlb HIGH win_top ; Switch to bank 0...
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
398
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
399 rcall aa_string_width ; Set win_height, compute win_width
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
400 call DISP_box_write ; Use that for the box.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
401
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
402 ; Restart the loop for each char to print
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
403 lfsr FSR2, letter ; FSR2 pointer to start of string.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
404
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
405 ; DATA bloc commande:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
406 AA_CMD_WRITE 0x22
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
407
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
408 aa_wordprocessor_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
409 movf POSTINC2,W,A ; WREG = *FSR2++
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
410 bz aa_wordprocessor_99 ; Exit if null byte encountered.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
411
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
412 rcall aa_char_setup ; setup aa_start / aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
413 rcall aa_decode_char ; write pixels to screen
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
414 bra aa_wordprocessor_1 ; and loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
415
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
416 aa_wordprocessor_99:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
417 ; END of bloc commande
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
418 AA_CMD_WRITE 0x00
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
419
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
420 return