annotate code_part1/OSTC_code_asm_part1/aa_wordprocessor.asm @ 85:8b813f67220f

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