annotate code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm @ 784:46ef1e1388f1

Merge
author heinrichsweikamp
date Mon, 23 Jun 2014 17:29:59 +0200
parents f32b9ad6244c
children 2750099bf5bb
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:
775
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
105 decfsz WREG,A ; This is medium font ???
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
106 bra aa_char_2a
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
107
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
108 ; Font LARGE block:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
109 movlw LOW aa_font90_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
110 movwf TBLPTRL,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
111 movlw HIGH aa_font90_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
112 movwf TBLPTRH,A
775
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
113 bra aa_char_3
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
114
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
115 ; HUGE font ---------------------------------------------------------
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
116 aa_char_2a:
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
117 ; Font HUGE block:
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
118 movlw LOW aa_font120_block
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
119 movwf TBLPTRL,A
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
120 movlw HIGH aa_font120_block
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
121 movwf TBLPTRH,A
f32b9ad6244c add 120px HUGE font
heinrichsweikamp
parents: 706
diff changeset
122
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
123
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
124 ; Execute font block -------------------------------------------------
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
125 aa_char_3:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
126 ; This is safe iff the three fonts are in the same code segment
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
127 ; (and that segment do not span the 64K edge...)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
128 movlw UPPER aa_font28_block
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
129 movwf TBLPTRU,A
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
130
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
131 ; Proceed to character substitutions
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
132 aa_char_30:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
133 tblrd*+ ; Read FROM char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
134 movf TABLAT,W ; Get it, and set Z,N
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
135 bz aa_char_32 ; Break at end of translations
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
136
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
137 tblrd*+ ; Read TO char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
138 cpfseq PRODL,A ; FROM == current char ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
139 bra aa_char_30 ; Different: loop
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
140 movff TABLAT, PRODL ; make substitution
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
141 bra aa_char_30 ; Loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
142
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
143 ; 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
144 aa_char_32:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
145 tblrd*+ ; Read first char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
146 movf TABLAT,W ; get it.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
147 subwf PRODL,F ; (char - first) --> PRODL
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
148
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
149 tblrd*+ ; Read nb chars
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
150 movf TABLAT,W ; nbchars --> WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
151 tblrd*+ ; Read default char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
152 cpfslt PRODL ; if char > WREG ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
153 movff TABLAT,PRODL ; replace PRODL
91
3bcccb697bce Added HW logo and dimmed cursor in small font.
JeanDo
parents: 83
diff changeset
154
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
155 ; Decode font height and anti-aliasing mode
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
156 clrf aa_flags,ACCESS ; Default to no AA
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
157 tblrd*+ ; Read font height + AA flag
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
158 movf TABLAT,W ; into WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
159 bnn aa_char_34 ; High bit set ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
160 bsf aa_antialias,ACCESS ; YES : then the font is AA.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
161 aa_char_34:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
162 andlw 0x7F ; Keep just font height,
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
163 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
164
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
165 ; Set PROM pointer to the char index
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
166 movf PRODL,W ; Read back char
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
167 mullw 2 ; PROD = 2*(char - base), TBLPTR=idx
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
168 movf PRODL,W
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
169 addwf TBLPTRL,F ; Add into TBLPTR (low byte)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
170 movf PRODH,W
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
171 addwfc TBLPTRH,F ; and high byte.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
172
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
173 ; Read start and stop pointers
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
174 tblrd*+ ; aa_start = PROM16(*tblptr++)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
175 movff TABLAT,aa_start+0 ; Read low byte
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
176 tblrd*+
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
177 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
178
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
179 tblrd*+ ; aa_end = PROM16(*tblptr++)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
180 movff TABLAT,aa_end+0 ; Read low byte
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
181 tblrd*+
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
182 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
183
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
184 return
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
185
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
186 ;------------------------------------------------------------------------------
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
187 ; Character width
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
188 ; 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
189 ; Output width added to aa_width
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
190 ; Trashed aa_bitlen, TBLPTR, TABLAT
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
191 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
192 aa_char_width:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
193 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
194 movff aa_start+1, TBLPTRH
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
195 clrf aa_bitlen,ACCESS ; clear reminders...
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
196
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
197 ; Read bitmap byte, and decode length:
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
198 aa_char_width_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
199 ifdef AA_BYTE_SWAP
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
200 btg TBLPTRL,0,A ; Toggle low ptr bit.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
201 tblrd*
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
202 movf TABLAT,W,A ; Store to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
203 btg TBLPTRL,0,A ; Get is back
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
204 tblrd*+ ; then increment (but trash TABLAT)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
205 movwf TABLAT,A ; Then restore copy to TABLAT.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
206 else
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
207 tblrd*+ ; Normal read...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
208 movf TABLAT,W,A ; Store copy to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
209 endif
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
210 btfss aa_antialias,ACCESS ; Antialiased font ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
211 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
212
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
213 bn aa_char_width_10 ; Non-white pixels ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
214 andlw 0x1F ; Yes : 5 bits count.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
215 aa_char_width_10:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
216 andlw 0x7F ; No: 7 bit count.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
217 incf WREG,A ; WREG = repetition count
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
218 addwf aa_bitlen,F,ACCESS ; Add remaining pixels from last code.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
219
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
220 movf win_height,W,BANKED ; WREG = - height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
221 negf WREG,A
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 ; 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
224 aa_char_width_2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
225 addwf aa_bitlen,F,ACCESS ; Try to substract win_height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
226 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
227
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
228 infsnz aa_width+0,F,ACCESS ; Succeded: do a 16bit increment
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
229 incf aa_width+1,F,ACCESS ; on the aa_width counter.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
230 bra aa_char_width_2 ; and loop.
83
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 aa_char_width_3:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
233 negf WREG,A ; WREG = +height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
234 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
235
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
236 ; Are we done ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
237 movf TBLPTRL,W,A ; Compare TBLPTR to aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
238 cpfseq aa_end+0,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
239 bra aa_char_width_1 ; Loop if LOW is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
240 movf TBLPTRH,W,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
241 cpfseq aa_end+1,ACCESS ; Loop to if HIGH is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
242 bra aa_char_width_1
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
243
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
244 return
83
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 ; String width
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
248 ; Inputs letter (SHOULD BE NULL TERMINATED)
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
249 ; Output aa_width, win_height
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
250 ; 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
251 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
252 aa_string_width:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
253 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
254
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
255 clrf aa_width+0,ACCESS ; Clear width sum.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
256 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
257
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
258 aa_string_width_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
259 movf POSTINC2,W,A ; WREG = *FSR2++
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
260 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
261
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
262 rcall aa_char_setup ; setup aa_start / aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
263 rcall aa_char_width ; sum-up width into aa_width
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
264 bra aa_string_width_1 ; and loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
265
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
266 aa_string_width99:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
267 return
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
268
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
269 ;------------------------------------------------------------------------------
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
270 ; Decode a compressed char.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
271 ; 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
272 ; Output none
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
273 ; 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
274 ;
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
275 aa_decode_char:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
276 movff aa_start+0, TBLPTRL ; TBLPTR = aa_start
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
277 movff aa_start+1, TBLPTRH
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
278
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
279 ; Read bitmap byte, and decode color & length
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
280 aa_decode_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
281 ifdef AA_BYTE_SWAP
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
282 btg TBLPTRL,0,A ; Toggle low ptr bit.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
283 tblrd*
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
284 movf TABLAT,W,A ; Store to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
285 btg TBLPTRL,0,A ; Get is back
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
286 tblrd*+ ; then increment (but trash TABLAT)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
287 movwf TABLAT,A ; Then restore copy to TABLAT.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
288 else
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
289 tblrd*+ ; Normal read...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
290 movf TABLAT,W,A ; Store copy to WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
291 endif
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
292 btfss aa_antialias,ACCESS ; Antialiased font ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
293 bra aa_decode_10 ; No: always 7 bits count
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
294 bn aa_decode_10 ; Non-white pixels ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
295 andlw 0x1F ; Yes : 5 bits count.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
296 aa_decode_10:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
297 andlw 0x7F ; No: 7 bit count.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
298 incf WREG,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
299 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
300
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
301 ;---- COLOR DECODING -------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
302 ;
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
303 ; Code Normal Inverse
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
304 ; 1xx 0% 100% : Managed by aa_decode_13
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
305 ; 011 25% 75%
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
306 ; 010 50% 50%
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
307 ; 001 75% 25%
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
308 ; 000 100% 0% : Managed by aa_decode_13 too.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
309 ;
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
310 movf TABLAT,W,A ; Get back code
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
311 btfss aa_antialias,ACCESS ; Antialiased font ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
312 bra aa_decode_13 ; NO: 1bit case
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 ; Asymetry test: 1xx code is another case for 1bit color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
315 ; This have to be done before inverse video, because
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
316 ; of the asymetric processing !
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
317 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
318
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
319 ; Manage 000 special case too:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
320 andlw 0xE0 ; Select color bits
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
321 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
322
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
323 ; Apply reverse video, in a reversed way
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
324 btfss win_invert,0 ; Inverse video mode ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
325 sublw 0x80
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
326
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
327 ; Move the two bits to aa_color_half and aa_color_quarter:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
328 swapf WREG ; --> 0000.0LL0 byte
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
329 iorlw b'001' ; We are in AA mode, don't forget it !
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
330 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
331
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
332 ;---- 2 bit x RGB(16bits) computation --------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
333 clrf PRODL ; We will accumulate result here...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
334 clrf PRODH
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
335
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
336 ; Take color div 2 into aa_temp. Max red = 15/31
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
337 rrcf win_color1,W,BANKED ; xRRRRxGG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
338 andlw b'01111011' ; 0RRRR0GG (don't change C)
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
339 movwf aa_temp+0,ACCESS
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
340 rrcf win_color2,W,BANKED ; GGGxBBBB
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
341 andlw b'11101111' ; GGG0BBBB
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
342 movwf aa_temp+1,ACCESS
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
343
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
344 btfss aa_color_half,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
345 bra aa_decode_12
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
346
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
347 movff aa_temp+0,PRODH ; Add color/2 if bit set.
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
348 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
349 aa_decode_12:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
350 btfss aa_color_quart,ACCESS
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
351 bra aa_decode_12b
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 ; Divide it once again by 2. Max red = 7/31.
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
354 rrcf aa_temp+0,W,ACCESS ; xxRRRxxG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
355 andlw b'00111001' ; 00RRR00G (don't change C)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
356 movwf aa_temp+0,ACCESS
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
357 rrcf aa_temp+1,W,ACCESS ; GGGxxBBB
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
358 andlw b'11100111' ; GGG00BBB
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
359 movwf aa_temp+1,ACCESS
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
360
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
361 movf aa_temp+1,W,ACCESS ; Add color/4
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
362 addwf PRODL,F ; NOTE: 7/31+15/31=22/31,
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 123
diff changeset
363 movf aa_temp+0,W,ACCESS ; hence composants won't overlap.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
364 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
365
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
366 aa_decode_12b:
705
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
367 movff win_flags,WREG ; BEWARE: bank0 bit-test
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
368 btfss WREG,1 ; Display1?
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
369 bra aa_decode_3 ; No, Done.
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
370
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
371 ; Convert 16Bit RGB b'RRRRRGGG GGGBBBBB' into 24Bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
372 ; PRODH PRODL win_color4 win_color5 win_color6
705
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
373 ; Blue
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
374 movff PRODL,win_color6
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
375 bcf STATUS,C
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
376 rlcf win_color6,F ; = UUBBBBB0
705
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
377 bcf STATUS,C
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
378 rlcf win_color6,F ; = UBBBBB00
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
379 bcf STATUS,C
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
380 rlcf win_color6,F ; = BBBBB000
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
381 btfsc win_color6,7
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
382 bsf win_color6,2
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
383
705
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
384 ; Green
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
385 rrcf PRODH,F
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
386 rrcf PRODL,F
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
387 rrcf PRODH,F
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
388 rrcf PRODL,F
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
389 rrcf PRODH,F ; = UUURRRRR
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
390 rrcf PRODL,F ; = GGGGGGUU
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
391 bcf PRODL,1 ; = GGGGGG0U
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
392 bcf PRODL,0 ; = GGGGGG00
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
393 movff PRODL,win_color5
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
394
705
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
395 ; Red
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 681
diff changeset
396 bcf STATUS,C
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
397 rlcf PRODH,F ; = UURRRRR0
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
398 bcf STATUS,C
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
399 rlcf PRODH,F ; = URRRRR00
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
400 bcf STATUS,C
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
401 rlcf PRODH,F ; = RRRRR000
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
402 btfsc PRODH,7
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
403 bsf PRODH,2
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
404 movff PRODH,win_color4
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
405 bra aa_decode_3 ; Done.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
406
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
407 ; ---- Simple BLACK and WHITE cases ------------------------------
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
408 aa_decode_13: ; Got a 1xx or a 000 code...
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
409 btfsc win_invert,0 ; Inverse video mode ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
410 xorlw 0x80 ; YES: invert levels.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
411 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
412
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
413 ; WHITE pixel (ie. full color)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
414 movff win_color1,PRODH ; current draw color
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
415 movff win_color2,PRODL ; (rem: DISPLAY is big endian)
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
416 bra aa_decode_12b
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
417
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
418 aa_decode_2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
419 clrf PRODH,A ; BLACK pixel
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
420 clrf PRODL,A
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
421 clrf win_color4
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
422 clrf win_color5
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
423 clrf win_color6
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
424
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
425 aa_decode_3:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
426 ;---- PIXEL WRITE LOOP -----------------------------------------------
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
427 ; AA_DATA_WRITE_PROD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
428 bsf DISPLAY_rs ; Data!
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
429
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
430 movff win_flags,WREG ; Display1? win_flags is in bank0...
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
431 btfsc WREG,1 ; Display1?
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
432 bra aa_decode_3_display1 ; Yes.
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
433
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
434 movff PRODH,PORTD ; Move high byte to PORTD (DISPLAY is bigendian)
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
435 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
436 bsf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
437 movff PRODL,PORTD ; Move low byte to PORTD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
438 bra aa_decode_3_done
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
439
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
440 aa_decode_3_display1:
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
441 movff win_color4,PORTD ; Move high byte to PORTD (DISPLAY is bigendian)
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
442 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
443 bsf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
444 movff win_color5,PORTD ; Move low byte to PORTD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
445 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
446 bsf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
447 movff win_color6,PORTD ; Move low(est) byte to PORTD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
448 aa_decode_3_done:
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
449 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
450 bsf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
451
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
452 decf aa_bitlen,F,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
453 bnz aa_decode_3
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
454
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
455 ;---- BYTE-CODE LOOP -------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
456 ; Are we done ?
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
457 movf TBLPTRL,W,A ; Compare TBLPTR to aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
458 cpfseq aa_end+0,ACCESS
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
459 bra aa_decode_1 ; Loop if LOW is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
460 movf TBLPTRH,W,A
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
461 cpfseq aa_end+1,ACCESS ; Loop to if HIGH is different
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
462 bra aa_decode_1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
463
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
464 return
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
465
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
466 ;------------------------------------------------------------------------------
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
467 ; Setup pointers for a char:
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
468 ; Inputs : letter : string to print (SHOULD BE NULL TERMINATED)
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
469 ; Output : DISPLAY commands on port D + clocks.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
470 ;
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 142
diff changeset
471 global aa_wordprocessor ; Callable from C-code.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
472 aa_wordprocessor:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
473 ; Make sure context is well known
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
474 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
475
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
476 rcall aa_string_width ; Set win_height, compute win_width
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents: 260
diff changeset
477 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
478
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
479 ; Restart the loop for each char to print
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
480 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
481
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
482 ; DATA bloc commande:
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
483 AA_CMD_WRITE 0x22
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
484
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
485 aa_wordprocessor_1:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
486 movf POSTINC2,W,A ; WREG = *FSR2++
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
487 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
488
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
489 rcall aa_char_setup ; setup aa_start / aa_end
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
490 rcall aa_decode_char ; write pixels to screen
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
491 bra aa_wordprocessor_1 ; and loop.
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
492
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
493 aa_wordprocessor_99:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
494 ; END of bloc commande
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
495 AA_CMD_WRITE 0x00
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
diff changeset
496
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 116
diff changeset
497 return