annotate code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 142:8b75ba28d641

Screen-flipping custom function. - Fix bank safe addressings.
author JeanDo
date Fri, 07 Jan 2011 03:01:02 +0100
parents d721b49b8934
children c09b0be2e1e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2009 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18 ; hardware routines for S6E6D6 Samsung OLED Driver IC
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written: 090801
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
21 ; History:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
22 ; 2009-08-30: [MH] last updated.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
23 ; 2011-01-07: [jDG] Added flip_screen option
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
24 ; known bugs: pixel-write (loogbok curves) not done yet...
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
25 ; ToDo:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 WIN_FONT macro win_font_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 movlw win_font_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 movff WREG,win_font
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 WIN_TOP macro win_top_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 movlw win_top_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 movff WREG,win_top
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 WIN_LEFT macro win_left_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 movlw win_left_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 movff WREG,win_leftx2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 WIN_INVERT macro win_invert_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 movlw win_invert_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 movff WREG,win_invert
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 WIN_COLOR macro win_color_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 movlw win_color_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 call PLED_set_color
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 endm
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
51
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
52 ;=============================================================================
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
53
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 word_processor: ; word_processor:
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
55 clrf POSTINC2 ; Required, to mark end of string.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
56 call aa_wordprocessor
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
57 movlb b'00000001' ; Back to Rambank1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
58 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
60 ;=============================================================================
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
61 ; PLED_SetColumnPixel:
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
62 ;
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
63 PLED_SetColumnPixel:
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
64 movff WREG,win_leftx2 ; d'0' ... d'159'
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
65 mullw 2 ; Copy to PROD, times 2.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
66
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
67 movlw 0x21 ; Start Address Vertical (.0 - .319)
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
68 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
69 bra PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
70
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
71 ;=============================================================================
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
72 ; PLED_SetRow:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
73 ; Backup WREG --> win_top, for the next write pixel.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
74 ; Setup OLED pixel horizontal address.
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
75 ;
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
76 PLED_SetRow:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
77 movff WREG,win_top ; d'0' ... d'239'
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
78 mullw 1 ; Copy row to PRODH:L
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
79 movlw 0x20 ; Horizontal Address START:END
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
80 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
81 bra PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
82
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
83 ;=============================================================================
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
84 ; PLED Write Two Pixel
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
85 ;
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
86
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
87 PLED_PxlWrite:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
88 rcall PLED_PxlWrite_Single ; Write first pixel.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
89
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
90 ; Write 2nd Pixel on same row but one column to the right
130
d721b49b8934 Fixed profile view (Logbook)
Heinrichsweikamp
parents: 129
diff changeset
91 movff win_top,WREG
d721b49b8934 Fixed profile view (Logbook)
Heinrichsweikamp
parents: 129
diff changeset
92 rcall PLED_SetRow ; Re-Set Row
d721b49b8934 Fixed profile view (Logbook)
Heinrichsweikamp
parents: 129
diff changeset
93 movff win_leftx2,WREG ; Increment column address.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
94 mullw 2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
95 incf PRODL
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
96 clrf WREG ; Does not reset CARRY...
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
97 addwfc PRODH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
98 movlw 0x21 ; Start Address Vertical (.0 - .319)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
99 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
100 rcall PLED_DataWrite_PROD
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
101 ; Continue with PLED_PxlWrite_Single...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
102
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
103 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
104 ; PLED Write One Pixel
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
105 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
106 PLED_PxlWrite_Single:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
107 movlw 0x22 ; Start Writing Data to GRAM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
108 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
109 bsf oled_rs ; Data!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
110 movff win_color1, PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
111 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
112 bsf oled_rw ; Upper
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
113 movff win_color2, PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
114 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
115 bsf oled_rw ; Lower
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
116 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
117
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
118 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
119 ; PLED Display Off
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
120 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
121 PLED_DisplayOff:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
122 clrf PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123 bcf oled_hv
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
124 bcf oled_vdd
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
125 bcf oled_cs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
126 bcf oled_e_nwr
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
127 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
128 bcf oled_nreset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
129 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
130
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
131 ;=============================================================================
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
132 ; Fast macros to write to OLED display.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
133 ; Adding a call/return adds 3 words and a pipeline flush, hence make it
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
134 ; nearly twice slower...
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
135 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
136 ; Input : commande as macro parameter.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
137 ; Output : NONE
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
138 ; Trash : WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
139 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
140 AA_CMD_WRITE macro cmd
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
141 movlw cmd
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
142 rcall PLED_CmdWrite
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
143 ; bcf oled_rs ; Cmd mode
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
144 ; movwf PORTD,A
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
145 ; bcf oled_rw ; Tick the clock
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
146 ; bsf oled_rw
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
147 endm
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
148 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
149 ; Input : PRODH:L as 16bits data.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
150 ; Output : NONE
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
151 ; Trash : NONE
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
152 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
153 AA_DATA_WRITE_PROD macro
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
154 rcall PLED_DataWrite_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
155 ; bsf oled_rs ; Data mode
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
156 ; movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN!
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
157 ; bcf oled_rw ; Tick the clock
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
158 ; bsf oled_rw
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
159 ; movff PRODL,PORTD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
160 ; bcf oled_rw ; Tick the clock
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
161 ; bsf oled_rw
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
162 endm
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
163
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
164 ;=============================================================================
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
165 ; Output OLED Window Address commands.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
166 ; Inputs : win_top, win_leftx2, win_height, aa_width.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
167 ; Output : PortD commands.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
168 ; Trashed: PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
169 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
170 PLED_box_write:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
171 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
172 mullw 2
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
173
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
174 movff win_flags,WREG ; BEWARE: bank0 bit-test
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
175 btfsc WREG,0 ; 180° rotation ?
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
176 bra PLED_box_flip_H ; YES:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
177
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
178 ;---- Normal horizontal window ---------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
179 ; Output 0x35 left,
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
180 ; 0x36 right == left + width - 1.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
181 AA_CMD_WRITE 0x35 ; this is the left border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
182 AA_DATA_WRITE_PROD ; Output left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
183 AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
184 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
185
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
186 movf aa_width+0,W,ACCESS ; right = left + width - 1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
187 addwf PRODL,F
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
188 movf aa_width+1,W,ACCESS
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
189 addwfc PRODH,F
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
190 decf PRODL,F,A ; decrement result
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
191 btfss STATUS,C
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
192 decf PRODH,F,A
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
193
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
194 AA_CMD_WRITE 0x36 ; Write and the right border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
195 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
196
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
197 bra PLED_box_noflip_H
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
198
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
199 ;---- Flipped horizontal window --------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
200 PLED_box_flip_H:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
201 ; Output 0x36 flipped(left) = 319-left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
202 ; 0x35 flipped(right) = 319-right = 320 - left - width
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
203 movf PRODL,W ; 16bits 319 - PROD --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
204 sublw LOW(.319) ; 319-W --> W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
205 movwf PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
206 movf PRODH,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
207 btfss STATUS,C ; Borrow = /CARRY
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
208 incf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
209 sublw HIGH(.319)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
210 movwf PRODH
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
211 AA_CMD_WRITE 0x36 ; this is the left border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
212 AA_DATA_WRITE_PROD ; Output left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
213 AA_CMD_WRITE 0x21
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
214 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
215
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
216 movf aa_width+0,W ; 16bits PROD - width --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
217 subwf PRODL,F ; PRODL - WREG --> PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
218 movf aa_width+1,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
219 subwfb PRODH,F
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
220 infsnz PRODL ; PROD+1 --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
221 incf PRODH
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
222 AA_CMD_WRITE 0x35 ; this is the left border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
223 AA_DATA_WRITE_PROD ; Output left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
224
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
225 PLED_box_noflip_H:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
226 movff win_flags,WREG ; BEWARE: bank0 bit-test
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
227 btfsc WREG,0 ; 180° rotation ?
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
228 bra PLED_box_flip_V
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
229
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
230 ;---- Normal vertical window -----------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
231 ; Output 0x37 (top) (bottom)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
232 movff win_top,PRODH ; top --> PRODH (first byte)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
233 movff win_height,WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
234 addwf PRODH,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
235 decf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
236 movwf PRODL ; top+height-1 --> PRODL (second byte)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
237
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
238 AA_CMD_WRITE 0x37
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
239 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
240
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
241 movff PRODH,PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
242 clrf PRODH ; Start pixel V coord == top.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
243 AA_CMD_WRITE 0x20
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
244 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
245
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
246 return
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
247
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
248 ;---- Flipped vertical window ----------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
249 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
250 ; flipped(top) = 239-top
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
251 PLED_box_flip_V:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
252 movff win_top,PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
253 movff win_height,WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
254 addwf PRODL,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
255 sublw .240 ; 240 - top - height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
256 movwf PRODH ; First byte
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
257
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
258 movf PRODL,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
259 sublw .239 ; 249-top
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
260 movwf PRODL ; --> second byte.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
261
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
262 AA_CMD_WRITE 0x37
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
263 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
264
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
265 clrf PRODH ; Start pixel V coord.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
266 AA_CMD_WRITE 0x20
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
267 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
268
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
269 return
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
270
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
271 ;=============================================================================
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
272 ; PLED_frame : draw a frame around current box with current color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
273 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
274 ; Outputs: (none)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
275 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
276
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
277 PLED_frame:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
278 movff win_top,aa_start+0 ; Backup everything.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
279 movff win_height,aa_start+1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
280 movff win_leftx2,aa_end+0
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
281 movff win_width,aa_end+1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
282
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
283 ;---- TOP line -----------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
284 movlw 1 ; row ~ height=1
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
285 movff WREG,win_height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
286 rcall PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
287
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
288 ;---- BOTTOM line --------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
289 movff aa_start+0,PRODL ; Get back top,
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
290 movff aa_start+1,WREG ; and height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
291 addwf PRODL,W ; top+height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
292 decf WREG ; top+height-1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
293 movff WREG,win_top ; top+height-1 --> top
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
294 rcall PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
295
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
296 ;---- LEFT column --------------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
297 movff aa_start+0,win_top ; Restore top/height.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
298 movff aa_start+1,win_height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
299 movlw 1 ; column ~ width=1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
300 movff WREG,win_width
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
301 rcall PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
302
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
303 ;---- RIGHT column -------------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
304 movff aa_end+0,WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
305 movff aa_end+1,PRODL
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
306 addwf PRODL,W
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
307 decf WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
308 movff WREG,win_leftx2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
309 bra PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
310
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
311 ;=============================================================================
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
312 ; PLED_box : fills current box with current color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
313 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
314 ; Outputs: (none)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
315 ; Trashed: WREG, PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
316
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
317 PLED_box:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
318 ;---- Define Window ------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
319 movff win_width,WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
320 bcf STATUS,C
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
321 rlcf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
322 movwf aa_width
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
323 movlw 0
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
324 rlcf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
325 movwf aa_width+1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
326 rcall PLED_box_write
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
327
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
328 ;---- Fill Window --------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
329 movlw 0x22 ; Start Writing Data to GRAM
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
330 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
331
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
332 movff win_width,PRODH
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
333 bsf oled_rs ; Data!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
334
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
335 PLED_box2: ; Loop height times
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
336 movff win_height,PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
337 PLED_box3: ; loop width times
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
338 movff win_color1,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
339 bcf oled_rw
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
340 bsf oled_rw ; Upper
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
341 movff win_color2,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
342 bcf oled_rw
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
343 bsf oled_rw ; Lower
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
344
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
345 movff win_color1,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
346 bcf oled_rw
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
347 bsf oled_rw ; Upper
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
348 movff win_color2,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
349 bcf oled_rw
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
350 bsf oled_rw ; Lower
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
351
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
352 decfsz PRODL,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
353 bra PLED_box3
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
354 decfsz PRODH,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
355 bra PLED_box2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
356
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
357 movlw 0x00 ; NOP, to stop Address Update Counter
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
358 bra PLED_CmdWrite ; returns...
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
359
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
360 ;=============================================================================
129
06c4899ddb4b Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents: 123
diff changeset
361 ; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
362 ; Trashed: WREG, PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
363
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
364 PLED_ClearScreen:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365 movlw 0x35 ; VerticalStartAddress HIGH:LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
366 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
367 mullw 0
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
368 rcall PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
369
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
370 movlw 0x36 ; VerticalEndAddress HIGH:LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
371 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
372 movlw 0x01
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
373 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
374 movlw 0x3F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
375 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
376
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
377 movlw 0x37 ; HorizontalAddress START:END
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
378 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
379 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
380 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
381 movlw 0xEF
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
382 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
383
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
384 movlw 0x20 ; Start Address Horizontal (.0 - .239)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
385 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
386 rcall PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
387
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388 movlw 0x21 ; Start Address Vertical (.0 - .319)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
389 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
390 rcall PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
391
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
392 movlw 0x22 ; Start Writing Data to GRAM
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
393 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 81
diff changeset
395 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
396 bsf oled_rs ; Data!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
397
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
398 movlw .160
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
399 movwf PRODH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
400 PLED_ClearScreen2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
401 movlw .240
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
402 movwf PRODL
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
403 PLED_ClearScreen3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
404
81
31fa973a70fd Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents: 3
diff changeset
405 clrf PORTD ; Need to generate trace here too.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
407 bsf oled_rw ; Upper
81
31fa973a70fd Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents: 3
diff changeset
408
31fa973a70fd Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents: 3
diff changeset
409 clrf PORTD ; Need to generate trace here too.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
410 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
411 bsf oled_rw ; Lower
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
412
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
413 clrf PORTD ; Need to generate trace here too.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
414 bcf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
415 bsf oled_rw ; Upper
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
416
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
417 clrf PORTD ; Need to generate trace here too.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
418 bcf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
419 bsf oled_rw ; Lower
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
420
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
421 decfsz PRODL,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
422 bra PLED_ClearScreen3
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
423 decfsz PRODH,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
424 bra PLED_ClearScreen2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
425
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
426 movlw 0x00 ; NOP, to stop Address Update Counter
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
427 bra PLED_CmdWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
428
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
429 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
430 ; PLED Write Cmd via W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
431 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
432 PLED_CmdWrite:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
433 bcf oled_rs ; Command!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
434 movwf PORTD ; Move Data to PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
435 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
436 bsf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
437 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
438
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
439 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
440 ; PLED Write Display Data via W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
441 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
442 PLED_DataWrite:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
443 bsf oled_rs ; Data!
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
444 movwf PORTD ; Move Data to PORTD
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
445 bcf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
446 bsf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
447 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
448
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
449 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
450 ; PLED Data Cmd via W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
451 ; -----------------------------
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
452 PLED_DataWrite_PROD:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
453 bsf oled_rs ; Data!
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
454 movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
455 bcf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
456 bsf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
457 movff PRODL,PORTD ; Move low byte to PORTD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
458 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
459 bsf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
460 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
461
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
462 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
463 ; PLED boot
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
464 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
465 PLED_boot:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
466 bcf oled_hv
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
467 WAITMS d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
468 bsf oled_vdd
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
469 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
470 bcf oled_cs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
471 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
472 bsf oled_nreset
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 2
diff changeset
473 ; WAITMS d'10' ; Quick wake-up
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 2
diff changeset
474 WAITMS d'250' ; Standard wake-up
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
475 bsf oled_e_nwr
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
476 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
477 bcf oled_nreset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
478 WAIT10US d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
479 bsf oled_nreset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
480 WAITMS d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
481
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
482 movlw 0x24 ; 80-System 8-Bit Mode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
483 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
484
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
485 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
486 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
487 movlw 0x00 ; X X X X X X X RM
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
488 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
489 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
490 rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
491
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
492 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
493 rcall PLED_CmdWrite
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
494 movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
495 rcall PLED_DataWrite
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
496
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
497 ; Change direction for block-writes of pixels
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
498 lfsr FSR0,win_flags
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
499 btfss INDF0,0 ; BANK-SAFE bit test.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
500 movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
501 btfsc INDF0,0
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
502 movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
503 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
504
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
505 movlw 0x18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
506 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
507 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
508 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
509 movlw 0x28
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
510 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
511
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
512 movlw 0xF8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
513 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
514 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
515 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
516 movlw 0x0F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
517 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
518
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
519 movlw 0xF9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
520 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
521 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
522 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
523 movlw 0x0F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
524 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
525
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
526 movlw 0x10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
527 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
528 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
529 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
530 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
531 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
532
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
533 ; Now Gamma settings...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
534 rcall PLED_brightness_full
2
d11ef8dc4b2c Bugfix: PC simulator
heinrichsweikamp
parents: 0
diff changeset
535 ;rcall PLED_brightness_low
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
536 ; End Gamma Settings
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
537
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
538 rcall PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
539
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
540 bsf oled_hv
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
541 WAITMS d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
542
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
543 movlw 0x05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
544 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
546 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547 movlw 0x01
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
548 rcall PLED_DataWrite ; Display ON
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
549 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
551
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
552 PLED_brightness_full:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
553 movlw 0x70
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
554 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
555 movlw 0x1F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
556 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
557 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
558 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 movlw 0x71
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
560 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
561 movlw 0x23
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
562 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
563 movlw 0x80
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
564 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
565 movlw 0x72
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
566 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
567 movlw 0x2A
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
568 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
569 movlw 0x80
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
570 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
571
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
572 movlw 0x73
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
573 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
574 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
575 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
576 movlw 0x11
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
577 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
578 movlw 0x74
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 movlw 0x1C
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
581 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 movlw 0x11
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
583 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585 movlw 0x75
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
586 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
587 movlw 0x1B
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
588 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
590 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591 movlw 0x76
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593 movlw 0x1A
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
594 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
596 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
597
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
598 movlw 0x77
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 movlw 0x1C
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
601 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 movlw 0x18
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
603 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
604 movlw 0x78
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606 movlw 0x21
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
607 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
608 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
609 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
610
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
611 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
612
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
613 PLED_brightness_low:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
614 movlw 0x70
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
615 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
616 movlw 0x14
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
617 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
619 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
620 movlw 0x71
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
621 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
622 movlw 0x17
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
623 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
624 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
625 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 movlw 0x72
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
628 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
629 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
630 movlw 0x80
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
631 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633 movlw 0x73
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
634 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
635 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
636 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
637 movlw 0x11
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
638 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639 movlw 0x74
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 movlw 0x14
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
642 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
643 movlw 0x0B
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
644 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 movlw 0x75
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
648 movlw 0x1B
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
649 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
651 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652 movlw 0x76
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654 movlw 0x13
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
655 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
656 movlw 0x0E
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
657 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
658
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659 movlw 0x77
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661 movlw 0x1C
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
662 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663 movlw 0x18
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
664 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
665 movlw 0x78
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
666 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
668 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
669 movlw 0x0E
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
670 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
671
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
672 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
673
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
674 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
675 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
676 movff oled1_temp, oled2_temp ; Copy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
677
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
678 ; Mask Bit 7,6,5,4,3,2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
679 movlw b'00000011'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
680 andwf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
681
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
682 movlw b'00000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
683 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
684 movlw b'01010000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
685 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
686 movlw b'10100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
687 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
688 movlw b'11111000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
689 movwf oled3_temp ; Blue done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
690
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
691 movff oled1_temp, oled2_temp ; Copy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
692 ; Mask Bit 7,6,5,1,0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
693 movlw b'00011100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
694 andwf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
695 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
696 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
697
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
698 movlw b'00000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
699 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
700 movlw b'00000100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
701 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
702 movlw b'00001000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
703 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
704 movlw b'00001100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
705 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
706 movlw b'00010000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
707 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
708 movlw b'00010100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
709 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
710 movlw b'00100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
711 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
712 movlw b'00111111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
713 movwf oled4_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
714
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
715 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
716 rrcf oled3_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
717
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
718 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
719 rrcf oled3_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
720
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
721 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
722 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
723
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
724 movff oled1_temp, oled2_temp ; Copy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
725 clrf oled1_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
726
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
727 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
728 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
729
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
730 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
731 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
732
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
733 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
734 rrcf oled1_temp,F ; Green done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
735
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
736 ; Mask Bit 4,3,2,1,0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
737 movlw b'11100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
738 andwf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
739
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
740 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
741 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
742 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
743 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
744 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
745
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
746 movlw b'00000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
747 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
748 movlw b'00000100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
749 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
750 movlw b'00001000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
751 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
752 movlw b'00001100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
753 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
754 movlw b'00010000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
755 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
756 movlw b'00010100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
757 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
758 movlw b'00100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
759 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
760 movlw b'00111111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
761 movwf oled4_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
762
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
763 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
764 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
765
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
766 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
767 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
768
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
769 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
770 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
771
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
772 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
773 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
774
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
775 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
776 rrcf oled1_temp,F ; Red done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
777
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
778 movff oled1_temp,win_color1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
779 movff oled3_temp,win_color2 ; Set Bank0 Color registers...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
780 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
781