annotate code_part1/OSTC_code_asm_part1/display_lowlevel.asm @ 838:2750099bf5bb

3.15 release
author heinrichsweikamp
date Tue, 19 Jan 2021 12:57:23 +0100
parents b317df6bc367
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
815
2a0e5d884fc3 BUGFIX: Fix licence in German
heinrichsweikamp
parents: 798
diff changeset
1 ; OSTC Mk.2, 2N and 2C - diving computer code
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2009 HeinrichsWeikamp GbR
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
3
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
4 ; This program is free software: you can redistribute it and/or modify
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
5 ; it under the terms of the GNU General Public License as published by
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
6 ; the Free Software Foundation, either version 3 of the License, or
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
7 ; (at your option) any later version.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
8
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
9 ; This program is distributed in the hope that it will be useful,
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
12 ; GNU General Public License for more details.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
13
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
14 ; You should have received a copy of the GNU General Public License
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
16
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
17
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
18 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
19 ; written: 090801
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
20 ; History:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
21 ; 2009-08-30: [MH] last updated.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
22 ; 2011-01-07: [jDG] Added flip_screen option
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
23 ; known bugs: pixel-write (loogbok curves) not done yet...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
24 ; ToDo:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
25
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
26 WIN_FONT macro win_font_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
27 movlw win_font_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
28 movff WREG,win_font
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
29 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
30
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
31 WIN_TOP macro win_top_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
32 movlw win_top_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
33 movff WREG,win_top
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
34 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
35
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
36 WIN_LEFT macro win_left_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
37 movlw win_left_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
38 movff WREG,win_leftx2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
39 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
40
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
41 WIN_INVERT macro win_invert_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
42 movlw win_invert_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
43 movff WREG,win_invert
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
44 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
45
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
46 WIN_COLOR macro win_color_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
47 movlw win_color_input
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
48 call DISP_set_color
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
49 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
50
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
51 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
52
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
53 word_processor: ; word_processor:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
54 clrf POSTINC2 ; Required, to mark end of string.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
55 call aa_wordprocessor
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
56 movlb b'00000001' ; Back to Rambank1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
57 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
58
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
59 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
60 ; Macro to provides our own interface code.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
61 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
62 PIXEL_WRITE macro colRegister, rowRegister
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
63 movff colRegister,win_leftx2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
64 movff rowRegister,win_top
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
65 call pixel_write
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
66 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
67
707
2129862bbfe6 correct a typo
heinrichsweikamp
parents: 706
diff changeset
68 INIT_PIXEL_WRITE macro colRegister
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
69 movff colRegister,win_leftx2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
70 call init_pixel_write
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
71 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
72
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
73 HALF_PIXEL_WRITE macro rowRegister
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
74 movff rowRegister,win_top
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
75 call half_pixel_write
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
76 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
77
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
78 ;-----------------------------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
79 ; Init for half_pixel_write
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
80 ; Set column register on DISPLAY device, and current color.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
81 ; Inputs: win_leftx2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
82 ; Outputs: win_color:2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
83 ; Trashed: WREG, PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
84 init_pixel_write:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
85 movff win_leftx2,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
86 mullw 2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
87 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
88 goto DISP_standard_color
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
89
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
90 ;-----------------------------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
91 ; Writes two half-pixels at position (win_top,win_leftx2)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
92 ; Inputs: win_leftx2, win_top, win_color:2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
93 ; Trashed: WREG, PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
94 pixel_write:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
95 movff win_leftx2,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
96 mullw 2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
97 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
98 rcall half_pixel_write ; Write this half-one.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
99
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
100 movff win_leftx2,WREG ; Address of next one
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
101 mullw 2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
102 infsnz PRODL ; +1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
103 incf PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
104 rcall pixel_write_col320
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
105 bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
106 ; of the autoincrement going vertical
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
107
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
108 ;---- Do the 16bit 319-X-->X, if needed, and send to DISPLAY ------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
109 pixel_write_col320:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
110 movff win_flags,WREG ; BEWARE: bank0 bit-test
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
111 btfsc WREG,1 ; Display1
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
112 bra pixel_write_noflip_H_display1 ; Yes.
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
113 btfss WREG,0 ; 180° rotation ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
114 bra pixel_write_noflip_H
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
115
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
116 movf PRODL,W ; 16bits 319 - PROD --> PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
117 sublw LOW(.319) ; 319-W --> W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
118 movwf PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
119 movf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
120 btfss STATUS,C ; Borrow = /CARRY
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
121 incf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
122 sublw HIGH(.319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
123 movwf PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
124
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
125 pixel_write_noflip_H:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
126 movlw 0x21 ; Start Address Vertical (.0 - .319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
127 rcall DISP_CmdWrite
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
128 bra DISP_DataWrite_PROD ; And return...
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
129
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
130 pixel_write_noflip_H_display1:
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
131 movlw 0x06
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
132 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
133 movf PRODH,W
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
134 rcall DISP_DataWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
135 movlw 0x07
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
136 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
137 movf PRODL,W
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
138 rcall DISP_DataWrite
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
139
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
140 incf PRODL,F
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
141 movlw .0
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
142 addwfc PRODH,F ;+1
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
143
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
144 movlw 0x08
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
145 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
146 movf PRODH,W
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
147 rcall DISP_DataWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
148 movlw 0x09
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
149 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
150 movf PRODL,W
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
151 bra DISP_DataWrite ; And return...
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
152
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
153
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
154 ;-----------------------------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
155 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height).
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
156 ; Inputs: win_leftx2, win_top, win_height, win_color:2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
157 ; Trashed: WREG, PROD, TABLAT, TBLPTRL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
158 half_vertical_line:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
159 clrf TABLAT ; Loop index.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
160
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
161 half_vertical_line_loop:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
162 movff win_leftx2,WREG ; Init X position.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
163 mullw 2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
164 movf TABLAT,W ; Get loop index
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
165 andlw 1 ; Just low bit
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
166 xorwf PRODL,F ; And use it to jitter current X position
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
167 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
168
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
169 movff win_height,WREG ; Index reached height (Bank0 read) ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
170 xorwf TABLAT,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
171 btfsc STATUS,Z ; Equals ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
172 return ; Yes: done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
173 movff win_top,WREG ; Y = top + index (Bank0 read)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
174 addwf TABLAT,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
175 rcall half_pixel_write_1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
176 incf TABLAT,F ; index++
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
177 bra half_vertical_line_loop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
178
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
179 ;-----------------------------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
180 ; Writes one half-pixel at position (win_top,win_leftx2).
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
181 ; Inputs: win_leftx2, win_top, win_color:2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
182 ; Trashed: WREG, PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
183 half_pixel_write:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
184 movff win_top,WREG ; d'0' ... d'239'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
185 ; Variant with Y position in WREG.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
186 half_pixel_write_1:
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
187 movff win_flags,PRODL ; Display1? win_flags is in bank0...
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
188 btfsc PRODL,1
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
189 bra half_pixel_write_1_display1 ; Yes.
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
190
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
191 btfsc PRODL,0 ; 180° rotation ?
836
heinrichsweikamp
parents: 835
diff changeset
192 sublw .239 ; 239-Y --> Y
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
193 mullw 1 ; Copy row to PRODL (PRODH=0)
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
194
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
195 movlw 0x20 ; Horizontal Address START:END
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
196 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
197 rcall DISP_DataWrite_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
198
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
199 movlw 0x22 ; Start Writing Data to GRAM
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
200 rcall DISP_CmdWrite
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
201 bsf DISPLAY_rs ; Data!
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
202 movff win_color1, PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
203 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
204 bsf DISPLAY_rw ; Upper
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
205 movff win_color2, PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
206 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
207 bsf DISPLAY_rw ; Lower
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
208 return ; Done.
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
209
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
210 half_pixel_write_1_display1:
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
211 mullw 1 ; Copy row to PRODL (PRODH=0)
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
212 ; Row address start
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
213 movlw 0x02
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
214 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
215 movlw .0
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
216 rcall DISP_DataWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
217 movlw 0x03
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
218 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
219 movf PRODL,W
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
220 rcall DISP_DataWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
221
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
222 incf PRODL,F
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
223
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
224 movlw 0x04
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
225 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
226 movlw .0
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
227 rcall DISP_DataWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
228 movlw 0x05
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
229 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
230 movf PRODL,W
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
231 rcall DISP_DataWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
232
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
233 movlw 0x22 ; Start Writing Data to GRAM
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
234 rcall DISP_CmdWrite
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
235 bsf DISPLAY_rs ; Data!
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
236 movff win_color4, PORTD
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
237 bcf DISPLAY_rw
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
238 bsf DISPLAY_rw ; Upper
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
239 movff win_color5, PORTD
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
240 bcf DISPLAY_rw
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
241 bsf DISPLAY_rw ; High
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
242 movff win_color6, PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
243 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
244 bsf DISPLAY_rw ; Lower
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
245 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
246
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
247
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
248 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
249 ; DISP Display Off
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
250 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
251 DISP_DisplayOff:
835
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
252 rcall DISP_ClearScreen
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
253
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
254 movff win_flags,WREG ; Display0? win_flags is in bank0...
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
255 btfss WREG,1 ; Display0?
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
256 bra DISP_DisplayOff_display0 ; Yes
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
257
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
258 ; Display 1
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
259 clrf PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
260 bcf DISPLAY_hv
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
261 bcf DISPLAY_cs
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
262 bcf DISPLAY_e_nwr
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
263 bcf DISPLAY_rw
835
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
264 bcf DISPLAY_rs
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
265 bcf DISPLAY_nreset
835
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
266 bcf DISPLAY_vdd
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
267 return
835
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
268
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
269 DISP_DisplayOff_display0:
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
270 movlw 0x05
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
271 rcall DISP_CmdWrite
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
272 movlw 0x00
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
273 rcall DISP_DataWrite
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
274 movlw 0x00
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
275 rcall DISP_DataWrite
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
276 WAITMS d'32'
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
277 bcf DISPLAY_hv
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
278 WAITMS d'32'
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
279 movlw 0x10
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
280 rcall DISP_CmdWrite
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
281 movlw 0x00
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
282 rcall DISP_DataWrite
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
283 movlw 0x01
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
284 rcall DISP_DataWrite
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
285 WAITMS d'100'
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
286 clrf PORTD
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
287 bcf DISPLAY_cs
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
288 bcf DISPLAY_e_nwr
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
289 bcf DISPLAY_rw
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
290 bcf DISPLAY_rs
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
291 bcf DISPLAY_nreset
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
292 WAITMS d'10'
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
293 bcf DISPLAY_vdd
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
294 return
30136fc61392 Change power-off sequence
heinrichsweikamp
parents: 815
diff changeset
295
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
296
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
297 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
298 ; Fast macros to write to DISPLAY display.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
299 ; Adding a call/return adds 3 words and a pipeline flush, hence make it
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
300 ; nearly twice slower...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
301 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
302 ; Input : commande as macro parameter.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
303 ; Output : NONE
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
304 ; Trash : WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
305 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
306 AA_CMD_WRITE macro cmd
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
307 movlw cmd
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
308 rcall DISP_CmdWrite ; slow but saves a lot of bytes in flash
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
309 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
310 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
311 ; Input : data as macro parameter.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
312 ; Output : NONE
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
313 ; Trash : WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
314 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
315 AA_DATA_WRITE macro data
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
316 movlw data
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
317 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
318 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
319 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
320 ; Input : PRODH:L as 16bits data.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
321 ; Output : NONE
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
322 ; Trash : NONE
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
323 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
324 AA_DATA_WRITE_PROD macro
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
325 rcall DISP_DataWrite_PROD ; slow but saves a lot of bytes in flash
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
326 endm
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
327
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
328 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
329 ; Output DISPLAY Window Address commands.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
330 ; Inputs : win_top, win_leftx2, win_height, aa_width.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
331 ; Output : PortD commands.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
332 ; Trashed: PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
333 ;
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
334 DISP_box_write:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
335 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
336 btfsc WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
337 bra DISP_box_write_display1 ; Yes
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
338
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
339 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
340 mullw 2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
341
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
342 movff win_flags,WREG ; BEWARE: bank0 bit-test
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
343 btfsc WREG,0 ; 180° rotation ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
344 bra DISP_box_flip_H ; YES:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
345
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
346 ;---- Normal horizontal window ---------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
347 ; Output 0x35 left,
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
348 ; 0x36 right == left + width - 1.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
349 AA_CMD_WRITE 0x35 ; this is the left border
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
350 AA_DATA_WRITE_PROD ; Output left
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
351 AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
352 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
353
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
354 movf aa_width+0,W,ACCESS ; right = left + width - 1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
355 addwf PRODL,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
356 movf aa_width+1,W,ACCESS
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
357 addwfc PRODH,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
358 decf PRODL,F,A ; decrement result
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
359 btfss STATUS,C
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
360 decf PRODH,F,A
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
361
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
362 AA_CMD_WRITE 0x36 ; Write and the right border
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
363 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
364
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
365 bra DISP_box_noflip_H
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
366
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
367 ;---- Flipped horizontal window --------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
368 DISP_box_flip_H:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
369 ; Output 0x36 flipped(left) = 319-left
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
370 ; 0x35 flipped(right) = 319-right = 320 - left - width
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
371 movf PRODL,W ; 16bits 319 - PROD --> PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
372 sublw LOW(.319) ; 319-W --> W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
373 movwf PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
374 movf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
375 btfss STATUS,C ; Borrow = /CARRY
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
376 incf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
377 sublw HIGH(.319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
378 movwf PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
379 AA_CMD_WRITE 0x36 ; this is the left border
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
380 AA_DATA_WRITE_PROD ; Output left
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
381 AA_CMD_WRITE 0x21
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
382 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
383
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
384 movf aa_width+0,W ; 16bits PROD - width --> PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
385 subwf PRODL,F ; PRODL - WREG --> PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
386 movf aa_width+1,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
387 subwfb PRODH,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
388 infsnz PRODL ; PROD+1 --> PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
389 incf PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
390 AA_CMD_WRITE 0x35 ; this is the left border
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
391 AA_DATA_WRITE_PROD ; Output left
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
392
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
393 DISP_box_noflip_H:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
394 movff win_flags,WREG ; BEWARE: bank0 bit-test
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
395 btfsc WREG,0 ; 180° rotation ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
396 bra DISP_box_flip_V
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
397
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
398 ;---- Normal vertical window -----------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
399 ; Output 0x37 (top) (bottom)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
400 movff win_top,PRODH ; top --> PRODH (first byte)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
401 movff win_height,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
402 addwf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
403 decf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
404 movwf PRODL ; top+height-1 --> PRODL (second byte)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
405
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
406 AA_CMD_WRITE 0x37
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
407 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
408
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
409 movff PRODH,PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
410 clrf PRODH ; Start pixel V coord == top.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
411 AA_CMD_WRITE 0x20
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
412 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
413
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
414 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
415
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
416 ;---- Flipped vertical window ----------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
417 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
418 ; flipped(top) = 239-top
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
419 DISP_box_flip_V:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
420 movff win_top,PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
421 movff win_height,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
422 addwf PRODL,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
423 sublw .240 ; 240 - top - height
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
424 movwf PRODH ; First byte
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
425
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
426 movf PRODL,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
427 sublw .239 ; 249-top
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
428 movwf PRODL ; --> second byte.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
429
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
430 AA_CMD_WRITE 0x37
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
431 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
432
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
433 clrf PRODH ; Start pixel V coord.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
434 AA_CMD_WRITE 0x20
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
435 AA_DATA_WRITE_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
436
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
437 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
438
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
439 DISP_box_write_display1:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
440 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
441 mullw 2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
442
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
443 movlw 0x06
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
444 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
445 movf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
446 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
447 movlw 0x07
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
448 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
449 movf PRODL,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
450 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
451
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
452 movf aa_width+0,W,ACCESS ; right = left + width - 1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
453 addwf PRODL,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
454 movf aa_width+1,W,ACCESS
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
455 addwfc PRODH,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
456 decf PRODL,F,A ; decrement result
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
457 btfss STATUS,C
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
458 decf PRODH,F,A
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
459
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
460 movlw 0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
461 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
462 movf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
463 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
464 movlw 0x09
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
465 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
466 movf PRODL,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
467 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
468
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
469 ;---- Normal vertical window -----------------------------------------
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
470 ; Output (top) (bottom)
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
471 movff win_top,PRODH ; top --> PRODH (first byte)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
472 movff win_height,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
473 addwf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
474 decf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
475 movwf PRODL ; top+height-1 --> PRODL (second byte)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
476
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
477 movlw 0x02
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
478 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
479 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
480 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
481 movlw 0x03
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
482 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
483 movf PRODH,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
484 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
485
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
486 movlw 0x04
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
487 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
488 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
489 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
490 movlw 0x05
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
491 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
492 movf PRODL,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
493 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
494 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
495
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
496 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
497 ; DISP_frame : draw a frame around current box with current color.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
498 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
499 ; Outputs: (none)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
500 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
501 global DISP_frame
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
502 DISP_frame:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
503 movff win_top,aa_start+0 ; Backup everything.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
504 movff win_height,aa_start+1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
505 movff win_leftx2,aa_end+0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
506 movff win_width,aa_end+1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
507
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
508 ;---- TOP line -----------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
509 movlw 1 ; row ~ height=1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
510 movff WREG,win_height
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
511 rcall DISP_box
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
512
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
513 ;---- BOTTOM line --------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
514 movff aa_start+0,PRODL ; Get back top,
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
515 movff aa_start+1,WREG ; and height
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
516 addwf PRODL,W ; top+height
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
517 decf WREG ; top+height-1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
518 movff WREG,win_top ; top+height-1 --> top
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
519 rcall DISP_box
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
520
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
521 ;---- LEFT column --------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
522 movff aa_start+0,win_top ; Restore top/height.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
523 movff aa_start+1,win_height
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
524 movlw 1 ; column ~ width=1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
525 movff WREG,win_width
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
526 rcall DISP_box
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
527
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
528 ;---- RIGHT column -------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
529 movff aa_end+0,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
530 movff aa_end+1,PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
531 addwf PRODL,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
532 decf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
533 movff WREG,win_leftx2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
534 bra DISP_box
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
535
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
536 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
537 ; DISP_box : fills current box with current color.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
538 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
539 ; Outputs: (none)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
540 ; Trashed: WREG, PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
541
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
542 global DISP_box
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
543 DISP_box:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
544 ;---- Define Window ------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
545 movff win_width,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
546 bcf STATUS,C
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
547 rlcf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
548 movwf aa_width+0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
549 movlw 0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
550 rlcf WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
551 movwf aa_width+1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
552 rcall DISP_box_write
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
553
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
554 ;---- Fill Window --------------------------------------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
555 movlw 0x22 ; Start Writing Data to GRAM
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
556 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
557
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
558 clrf PRODH ; Column counter.
719
ad5ab9910820 decoplan bargraph
heinrichsweikamp
parents: 713
diff changeset
559 bsf DISPLAY_rs ; Data!
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
560 DISP_box2: ; Loop height times
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
561 movff win_height,PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
562
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
563 DISP_box3: ; loop width times
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
564 movff win_flags,WREG ; Display1? win_flags is in bank0...
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
565 btfsc WREG,1 ; Display1?
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
566 bra DISP_box3aa ; Yes
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
567
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
568 movff win_color1,PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
569 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
570 bsf DISPLAY_rw ; Upper
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
571 movff win_color2,PORTD
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
572 bra DISP_box3a ; Done.
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
573 DISP_box3aa:
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
574 movff win_color4,PORTD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
575 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
576 bsf DISPLAY_rw ; Upper
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
577 movff win_color5,PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
578 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
579 bsf DISPLAY_rw ; Lower/High
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
580 movff win_color6,PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
581
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
582 DISP_box3a:
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
583 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
584 bsf DISPLAY_rw ; Lower/High
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
585
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
586 movff win_flags,WREG ; Display1? win_flags is in bank0...
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
587 btfsc WREG,1 ; Display1?
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
588 bra DISP_box3ab ; Yes
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
589
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
590 movff win_color1,PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
591 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
592 bsf DISPLAY_rw ; Upper
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
593 movff win_color2,PORTD
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
594 bra DISP_box3b
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
595
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
596 DISP_box3ab:
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
597 movff win_color4,PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
598 bcf DISPLAY_rw
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
599 bsf DISPLAY_rw ; Upper
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
600 movff win_color5,PORTD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
601 bcf DISPLAY_rw
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
602 bsf DISPLAY_rw ; High
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
603 movff win_color6,PORTD
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
604
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
605 DISP_box3b:
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
606 bcf DISPLAY_rw
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
607 bsf DISPLAY_rw ; Lower
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
608 decfsz PRODL,F ; row loop finished ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
609 bra DISP_box3 ; No: continue.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
610
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
611 incf PRODH,F ; column count ++
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
612
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
613 movff win_bargraph,WREG ; current column == bargraph ?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
614 cpfseq PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
615 bra DISP_box4 ; No: just loop.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
616
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
617 clrf WREG ; Yes: switch to black
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
618 movff WREG,win_color1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
619 movff WREG,win_color2
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
620 movff WREG,win_color3
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
621 movff WREG,win_color4
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
622 movff WREG,win_color5
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
623 movff WREG,win_color6
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
624 DISP_box4:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
625 movff win_width,WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
626 cpfseq PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
627 bra DISP_box2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
628
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
629 setf WREG ; Reset bargraph mode...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
630 movff WREG,win_bargraph
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
631
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
632 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
633 btfsc WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
634 return ; Yes, done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
635
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
636 movlw 0x00 ; NOP, to stop window mode
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
637 bra DISP_CmdWrite ; Returns....
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
638
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
639 ;=============================================================================
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
640 ; DISP_ClearScreen: An optimized version of PLEX_box, for full screen black.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
641 ; Trashed: WREG, PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
642
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
643 global DISP_ClearScreen
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
644 DISP_ClearScreen:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
645 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
646 btfsc WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
647 bra DISP_ClearScreen_display1; Yes
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
648
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
649 movlw 0x35 ; VerticalStartAddress HIGH:LOW
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
650 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
651 mullw 0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
652 rcall DISP_DataWrite_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
653
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
654 movlw 0x36 ; VerticalEndAddress HIGH:LOW
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
655 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
656 movlw 0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
657 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
658 movlw 0x3F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
659 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
660
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
661 movlw 0x37 ; HorizontalAddress START:END
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
662 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
663 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
664 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
665 movlw 0xEF
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
666 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
667
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
668 movlw 0x20 ; Start Address Horizontal (.0 - .239)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
669 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
670 rcall DISP_DataWrite_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
671
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
672 movlw 0x21 ; Start Address Vertical (.0 - .319)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
673 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
674 rcall DISP_DataWrite_PROD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
675
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
676 movlw 0x22 ; Start Writing Data to GRAM
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
677 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
678
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
679 ; See Page 101 of DISPLAY Driver IC Datasheet how to handle rs/rw clocks
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
680 bsf DISPLAY_rs ; Data!
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
681 clrf PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
682 movlw .160
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
683 movwf PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
684 DISP_ClearScreen2:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
685 movlw .240
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
686 movwf PRODL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
687 DISP_ClearScreen3:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
688 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
689 bsf DISPLAY_rw ; Upper
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
690 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
691 bsf DISPLAY_rw ; Lower
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
692 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
693 bsf DISPLAY_rw ; Upper
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
694 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
695 bsf DISPLAY_rw ; Lower
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
696 decfsz PRODL,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
697 bra DISP_ClearScreen3
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
698 decfsz PRODH,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
699 bra DISP_ClearScreen2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
700 movlw 0x00 ; NOP, to stop Address Update Counter
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
701 bra DISP_CmdWrite ; And return...
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
702
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
703 DISP_ClearScreen_display1:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
704 ; Column Address start
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
705 movlw 0x02
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
706 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
707 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
708 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
709 movlw 0x03
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
710 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
711 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
712 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
713
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
714 ; Column Address end
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
715 movlw 0x04
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
716 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
717 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
718 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
719 movlw 0x05
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
720 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
721 movlw 0xEF
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
722 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
723
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
724 ; Row address start
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
725 movlw 0x06
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
726 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
727 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
728 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
729 movlw 0x07
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
730 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
731 movlw 0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
732 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
733
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
734 ; Row address end
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
735 movlw 0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
736 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
737 movlw 0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
738 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
739 movlw 0x09
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
740 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
741 movlw 0x3F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
742 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
743
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
744 movlw 0x22 ; Start Writing Data to GRAM
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
745 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
746
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
747 bsf DISPLAY_rs ; Data!
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
748
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
749 movlw .160
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
750 movwf PRODH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
751 DISP_ClearScreen2_display1:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
752 movlw .240
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
753 movwf PRODL
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
754 clrf PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
755 DISP_ClearScreen3_display1:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
756 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
757 bsf DISPLAY_rw ; Upper
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
758 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
759 bsf DISPLAY_rw ; High
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
760 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
761 bsf DISPLAY_rw ; Lower
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
762 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
763 bsf DISPLAY_rw ; Upper
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
764 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
765 bsf DISPLAY_rw ; High
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
766 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
767 bsf DISPLAY_rw ; Lower
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
768 decfsz PRODL,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
769 bra DISP_ClearScreen3_display1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
770 decfsz PRODH,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
771 bra DISP_ClearScreen2_display1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
772 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
773
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
774
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
775 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
776 ; DISP Write Cmd via W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
777 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
778 DISP_CmdWrite:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
779 bcf DISPLAY_rs ; Command!
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
780 movwf PORTD ; Move Data to PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
781 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
782 bsf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
783 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
784
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
785 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
786 ; DISP Write Display Data via W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
787 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
788 DISP_DataWrite:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
789 bsf DISPLAY_rs ; Data!
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
790 movwf PORTD ; Move Data to PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
791 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
792 bsf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
793 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
794
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
795 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
796 ; DISP Data Cmd via W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
797 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
798 DISP_DataWrite_PROD:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
799 bsf DISPLAY_rs ; Data!
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
800 movff PRODH,PORTD ; Move high byte to PORTD (DISPLAY is bigendian)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
801 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
802 bsf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
803 movff PRODL,PORTD ; Move low byte to PORTD
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
804 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
805 bsf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
806 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
807 btfss WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
808 return ; No, done.
705
55983c4d6b2d aa fonts processor
heinrichsweikamp
parents: 693
diff changeset
809 movff win_color3,PORTD ; Move low(est) byte to PORTD
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
810 bcf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
811 bsf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
812 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
813
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
814
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
815 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
816 ; DISP Read data into WREG
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
817 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
818 ; NOTE: you should "setf TRISD" before calling this function,
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
819 ; to make PortD an input port...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
820 DISP_DataRead:
687
a8a36c85e031 ignore screenshots with display1 (for now)
heinrichsweikamp
parents: 684
diff changeset
821 movff win_flags,WREG ; Display1? win_flags is in bank0...
a8a36c85e031 ignore screenshots with display1 (for now)
heinrichsweikamp
parents: 684
diff changeset
822 btfsc WREG,1 ; Display1?
a8a36c85e031 ignore screenshots with display1 (for now)
heinrichsweikamp
parents: 684
diff changeset
823 return ; Yes, done.
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
824 bsf DISPLAY_rs ; Data register.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
825 bcf DISPLAY_e_nwr ; Read enable.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
826 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
827 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
828 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
829 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
830 movf PORTD,W ; Read byte.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
831 bsf DISPLAY_e_nwr ; release bus.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
832 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
833
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
834 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
835 ; DISP boot
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
836 ; -----------------------------
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
837 DISPLAY_boot:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
838 movlw LOW 0x17FDC
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
839 movwf TBLPTRL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
840 movlw HIGH 0x17FDC
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
841 movwf TBLPTRH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
842 movlw UPPER 0x17FDC
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
843 movwf TBLPTRU
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
844 TBLRD*
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
845 movlw 0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
846 cpfseq TABLAT ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
847 bra display0_init ; No, Display0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
848
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
849 banksel win_flags
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
850 bsf win_flags,0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
851 bsf win_flags,1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
852 banksel flag1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
853 bcf DISPLAY_hv ; Backlight off
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
854 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
855 bcf DISPLAY_vdd
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
856 WAITMS d'10'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
857 bsf DISPLAY_vdd
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
858 WAITMS d'100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
859 bsf DISPLAY_rw
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
860 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
861 bcf DISPLAY_cs
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
862 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
863 bsf DISPLAY_nreset
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
864 WAITMS d'1'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
865 bcf DISPLAY_nreset
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
866 WAIT10US d'2'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
867 bsf DISPLAY_nreset
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
868 WAITMS d'120'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
869 bsf DISPLAY_e_nwr ; release bus.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
870 rcall display1_init ; Init sequence
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
871 rcall DISP_ClearScreen
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
872 WAITMS d'60'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
873 bsf DISPLAY_hv ; Backlight on
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
874 return
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
875
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
876 display1_init:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
877 movlw LOW display1_config_table
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
878 movwf TBLPTRL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
879 movlw HIGH display1_config_table
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
880 movwf TBLPTRH
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
881 movlw UPPER display1_config_table
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
882 movwf TBLPTRU
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
883 display1_init_loop:
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
884 TBLRD*+
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
885 movlw 0xFF
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
886 cpfseq TABLAT
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
887 bra display1_config_write ; Write Config pair to Display
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
888 ; Delay ms or quit (return)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
889 TBLRD*+
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
890 tstfsz TABLAT ; End of config?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
891 bra $+4 ; No
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
892 return ; Done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
893 movf TABLAT,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
894 call WAITMSX ; Wait WREG milliseconds
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
895 bra display1_init_loop ; Loop
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
896
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
897 display1_config_write: ; With command in WREG
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
898 movf TABLAT,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
899 rcall DISP_CmdWrite ; Write command
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
900 TBLRD*+ ; Get config
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
901 movf TABLAT,W
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
902 rcall DISP_DataWrite ; Write config
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
903 bra display1_init_loop ; Loop
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
904
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
905
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
906 display1_config_table:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
907 ; Reg, Dat or 0xFF, Delay or 0xFF, 0x00 (End)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
908 db 0x96,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
909 db 0x19,0x87
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
910 db 0xFF,.10
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
911 db 0x26,0x80
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
912 db 0x1B,0x0C
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
913 db 0x43,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
914 db 0x20,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
915 db 0x1F,0x07
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
916 db 0x44,0x7F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
917 db 0x45,0x14
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
918 db 0x1D,0x05
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
919 db 0x1E,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
920 db 0x1C,0x04
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
921 db 0x1B,0x14
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
922 db 0xFF,.40
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
923 db 0x43,0x80
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
924 db 0x42,0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
925 db 0x23,0x95
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
926 db 0x24,0x95
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
927 db 0x25,0xFF
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
928 db 0x21,0x10
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
929 db 0x2B,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
930 db 0x95,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
931 db 0x1A,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
932 db 0x93,0x0F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
933 db 0x70,0x66
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
934 db 0x18,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
935 db 0x46,0x86
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
936 db 0x47,0x60
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
937 db 0x48,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
938 db 0x49,0x67
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
939 db 0x4A,0x46
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
940 db 0x4B,0x13
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
941 db 0x4C,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
942 db 0x4D,0x67
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
943 db 0x4E,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
944 db 0x4F,0x13
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
945 db 0x50,0x02
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
946 db 0x51,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
947 db 0x38,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
948 db 0x39,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
949 db 0x27,0x02
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
950 db 0x28,0x03
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
951 db 0x29,0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
952 db 0x2A,0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
953 db 0x2C,0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
954 db 0x2D,0x08
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
955 db 0x35,0x09
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
956 db 0x36,0x09
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
957 db 0x91,0x14
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
958 db 0x37,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
959 db 0x01,0x06
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
960 db 0x3A,0xA1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
961 db 0x3B,0xA1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
962 db 0x3C,0xA1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
963 db 0x3D,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
964 db 0x3E,0x2D
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
965 db 0x40,0x03
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
966 db 0x41,0xCC
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
967 db 0x0A,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
968 db 0x0B,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
969 db 0x0C,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
970 db 0x0D,0x3F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
971 db 0x0E,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
972 db 0x0F,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
973 db 0x10,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
974 db 0x11,0x40
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
975 db 0x12,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
976 db 0x13,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
977 db 0x14,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
978 db 0x15,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
979 db 0x02,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
980 db 0x03,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
981 db 0x04,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
982 db 0x05,0xEF
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
983 db 0x06,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
984 db 0x07,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
985 db 0x08,0x01
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
986 db 0x09,0x3F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
987 db 0x16,0x88
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
988 db 0x72,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
989 db 0x22,0x60
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
990 db 0x94,0x0A
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
991 db 0x90,0x7F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
992 db 0x26,0x84
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
993 db 0xFF,.40
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
994 db 0x26,0xA4
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
995 db 0x26,0xAC
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
996 db 0xFF,.40
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
997 db 0x26,0xBC
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
998 db 0x96,0x00
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
999 db 0xFF,0x00 ; End of table pair
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1000
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1001
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1002 display0_init: ; Display0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1003 banksel win_flags
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1004 bcf win_flags,1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1005 banksel flag1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1006 bcf DISPLAY_hv
713
8c293e76a517 no flicker when powering on
heinrichsweikamp
parents: 708
diff changeset
1007 btfsc DISPLAY_hv
8c293e76a517 no flicker when powering on
heinrichsweikamp
parents: 708
diff changeset
1008 bra $-4
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1009 WAITMS d'32'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1010 bsf DISPLAY_vdd
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1011 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1012 bcf DISPLAY_cs
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1013 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1014 bsf DISPLAY_nreset
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1015 WAITMS d'250' ; Standard wake-up
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1016 bsf DISPLAY_e_nwr
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1017 nop
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1018 bcf DISPLAY_nreset
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1019 WAIT10US d'2'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1020 bsf DISPLAY_nreset
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1021 WAITMS d'10'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1022
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1023 movlw 0x24 ; 80-System 8-Bit Mode
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1024 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1025
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1026 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1027 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1028 movlw 0x00 ; X X X X X X X RM
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1029 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1030 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1031 rcall DISP_DataWrite ; System Interface: RIM is ignored, Internal Clock
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1032
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1033 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1034 rcall DISP_CmdWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1035 movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1036 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1037
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1038 ; Change direction for block-writes of pixels
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1039 lfsr FSR0,win_flags
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1040 movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1041 btfss INDF0,0 ; BANK-SAFE bit test.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1042 movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1043 rcall DISP_DataWrite
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1044
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1045 movlw LOW display0_config_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1046 movwf TBLPTRL
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1047 movlw HIGH display0_config_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1048 movwf TBLPTRH
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1049 movlw UPPER display0_config_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1050 movwf TBLPTRU
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1051 rcall display0_init_loop
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1052 rcall DISP_brightness_full ; Gamma settings...
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1053 rcall DISP_ClearScreen
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1054 bsf DISPLAY_hv ; OLED volatages on
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1055 return
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1056
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1057
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1058 display0_config_table:
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1059 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1060 db 0x18,0x00,0x28,0xF8,0x00,0x0F
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1061 db 0xF9,0x00,0x0F,0x10,0x00,0x00
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1062 db 0x05,0x00,0x01,0xFF,0x00,0x00
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1063
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1064
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1065 DISP_brightness_full: ; Choose between Eco and High...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1066 btfsc DISPLAY_brightness_high ; DISPLAY brightness (=0: Eco, =1: High)
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1067 bra DISP_brightness_full_high
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1068 ; Mid
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1069 bsf PORTB,7
708
71bb907d0ce5 brightness settings for display1
heinrichsweikamp
parents: 707
diff changeset
1070 nop
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1071 bcf PORTB,6
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1072
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1073 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1074 btfsc WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1075 return ; Yes, done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1076
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1077 movlw LOW display0_gamma_high_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1078 movwf TBLPTRL
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1079 movlw HIGH display0_gamma_high_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1080 movwf TBLPTRH
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1081 movlw UPPER display0_gamma_high_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1082 movwf TBLPTRU
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1083 bra display0_init_loop ; And return...
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1084
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1085
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1086 DISP_brightness_full_high:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1087 ; Full
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1088 bsf PORTB,7
708
71bb907d0ce5 brightness settings for display1
heinrichsweikamp
parents: 707
diff changeset
1089 nop
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1090 bsf PORTB,6
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1091
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1092 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1093 btfsc WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1094 return ; Yes, done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1095
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1096 movlw LOW display0_gamma_full_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1097 movwf TBLPTRL
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1098 movlw HIGH display0_gamma_full_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1099 movwf TBLPTRH
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1100 movlw UPPER display0_gamma_full_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1101 movwf TBLPTRU
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1102 bra display0_init_loop ; And return...
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1103
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1104
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1105 DISP_brightness_low:
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1106 ;Low
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1107 bcf PORTB,7
708
71bb907d0ce5 brightness settings for display1
heinrichsweikamp
parents: 707
diff changeset
1108 nop
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1109 bcf PORTB,6
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1110 movff win_flags,WREG ; Display1? win_flags is in bank0...
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1111 btfsc WREG,1 ; Display1?
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1112 return ; Yes, done.
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1113 movlw LOW display0_gamma_low_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1114 movwf TBLPTRL
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1115 movlw HIGH display0_gamma_low_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1116 movwf TBLPTRH
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1117 movlw UPPER display0_gamma_low_table
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1118 movwf TBLPTRU
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1119 bra display0_init_loop ; And return...
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1120
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1121 display0_init_loop:
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1122 TBLRD*+
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1123 movlw 0xFF
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1124 cpfseq TABLAT
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1125 bra display0_config_write ; Write Config pair to Display
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1126 ; Delay ms or quit (return)
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1127 TBLRD*+
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1128 tstfsz TABLAT ; End of config?
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1129 bra $+4 ; No
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1130 return ; Done.
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1131 movf TABLAT,W
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1132 call WAITMSX ; Wait WREG milliseconds
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1133 bra display0_init_loop ; Loop
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1134
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1135 display0_config_write: ; With command in WREG
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1136 movf TABLAT,W
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1137 rcall DISP_CmdWrite ; Write command
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1138 TBLRD*+ ; Get config
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1139 movf TABLAT,W
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1140 rcall DISP_DataWrite ; Write config
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1141 TBLRD*+ ; Get config
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1142 movf TABLAT,W
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1143 rcall DISP_DataWrite ; Write config
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1144 bra display0_init_loop ; Loop
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1145
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1146
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1147 display0_gamma_high_table:
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1148 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1149 db 0x70,0x1B,0x80,0x71,0x1F,0x00
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1150 db 0x72,0x22,0x00,0x73,0x17,0x11
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1151 db 0x74,0x1A,0x0E,0x75,0x1D,0x15
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1152 db 0x76,0x18,0x11,0x77,0x1E,0x18
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1153 db 0x78,0x1D,0x11,0xFF,0x00,0x00
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1154
688
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1155 display0_gamma_full_table:
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1156 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1157 db 0x70,0x1F,0x00,0x71,0x23,0x80
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1158 db 0x72,0x2A,0x80,0x73,0x15,0x11
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1159 db 0x74,0x1C,0x11,0x75,0x1B,0x15
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1160 db 0x76,0x1A,0x15,0x77,0x1C,0x18
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1161 db 0x78,0x21,0x15,0xFF,0x00,0x00
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1162
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1163 display0_gamma_low_table:
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1164 ; Reg, Dat0, Dat1 or 0xFF,0x00,0x00 for end
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1165 db 0x70,0x14,0x00,0x71,0x17,0x00
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1166 db 0x72,0x15,0x80,0x73,0x15,0x11
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1167 db 0x74,0x14,0x0B,0x75,0x1B,0x15
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1168 db 0x76,0x13,0x0E,0x77,0x1C,0x18
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1169 db 0x78,0x15,0x0E,0xFF,0x00,0x00
c04e5c18acf9 some cleanups
heinrichsweikamp
parents: 687
diff changeset
1170
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1171
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1172 DISP_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGG GGGBBBBB'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1173 movwf DISPLAY1_temp ; Get 8Bit RGB b'RRRGGGBB'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1174 movwf DISPLAY2_temp ; Copy
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1175 movff WREG,win_color6 ; Another (bank-safe) copy
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1176
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1177 ; Display0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1178 ; Mask Bit 7,6,5,4,3,2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1179 movlw b'00000011'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1180 andwf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1181
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1182 movlw b'00000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1183 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1184 movlw b'01010000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1185 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1186 movlw b'10100000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1187 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1188 movlw b'11111000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1189 movwf DISPLAY3_temp ; Blue done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1190
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1191 movff DISPLAY1_temp, DISPLAY2_temp ; Copy
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1192 ; Mask Bit 7,6,5,1,0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1193 movlw b'00011100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1194 andwf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1195 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1196 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1197
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1198 movlw b'00000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1199 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1200 movlw b'00000100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1201 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1202 movlw b'00001000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1203 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1204 movlw b'00001100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1205 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1206 movlw b'00010000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1207 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1208 movlw b'00010100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1209 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1210 movlw b'00100000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1211 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1212 movlw b'00111111'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1213 movwf DISPLAY4_temp
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1214
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1215 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1216 rrcf DISPLAY3_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1217
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1218 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1219 rrcf DISPLAY3_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1220
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1221 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1222 rrcf DISPLAY3_temp,F ; DISPLAY3_temp (b'GGGBBBBB') done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1223
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1224 movff DISPLAY1_temp, DISPLAY2_temp ; Copy
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1225 clrf DISPLAY1_temp
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1226
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1227 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1228 rrcf DISPLAY1_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1229
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1230 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1231 rrcf DISPLAY1_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1232
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1233 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1234 rrcf DISPLAY1_temp,F ; Green done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1235
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1236 ; Mask Bit 4,3,2,1,0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1237 movlw b'11100000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1238 andwf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1239
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1240 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1241 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1242 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1243 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1244 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1245
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1246 movlw b'00000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1247 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1248 movlw b'00000100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1249 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1250 movlw b'00001000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1251 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1252 movlw b'00001100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1253 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1254 movlw b'00010000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1255 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1256 movlw b'00010100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1257 dcfsnz DISPLAY2_temp,F
798
d79aa21ee54c BUGFIX: Fix color codes 192-223 (Mk.2 and 2N only)
heinrichsweikamp
parents: 753
diff changeset
1258 movlw b'00011000'
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1259 dcfsnz DISPLAY2_temp,F
798
d79aa21ee54c BUGFIX: Fix color codes 192-223 (Mk.2 and 2N only)
heinrichsweikamp
parents: 753
diff changeset
1260 movlw b'00011111'
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1261 movwf DISPLAY4_temp
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1262
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1263 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1264 rrcf DISPLAY1_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1265
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1266 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1267 rrcf DISPLAY1_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1268
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1269 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1270 rrcf DISPLAY1_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1271
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1272 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1273 rrcf DISPLAY1_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1274
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1275 rrcf DISPLAY4_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1276 rrcf DISPLAY1_temp,F ; Red done.
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1277
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1278 movff DISPLAY1_temp,win_color1
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1279 movff DISPLAY3_temp,win_color2 ; Set Bank0 Color registers...
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1280
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1281 movff win_flags,WREG ; Display1? win_flags is in bank0...
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1282 btfss WREG,1 ; Display1?
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1283 return ; No
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1284
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1285 DISP_set_color_display1:;Converts 8Bit RGB b'RRRGGGBB' into 24Bit RGB b'00RRRRRR 00GGGGGG 00BBBBBB'
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1286 movff win_color6,DISPLAY1_temp
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1287 movff win_color6,DISPLAY2_temp
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1288
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1289 ; Mask Bit 7,6,5,4,3,2
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1290 movlw b'00000011'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1291 andwf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1292
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1293 movlw b'00000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1294 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1295 movlw b'01010000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1296 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1297 movlw b'10100000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1298 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1299 movlw b'11111000'
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1300 movff WREG,win_color6 ; B
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1301
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1302 movff DISPLAY1_temp, DISPLAY2_temp ; Copy
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1303 ; Mask Bit 7,6,5,1,0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1304 movlw b'00011100'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1305 andwf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1306 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1307 rrncf DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1308
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1309 movlw b'00000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1310 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1311 movlw b'00010000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1312 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1313 movlw b'00100000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1314 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1315 movlw b'00110000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1316 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1317 movlw b'01000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1318 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1319 movlw b'01010000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1320 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1321 movlw b'10000000'
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1322 dcfsnz DISPLAY2_temp,F
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1323 movlw b'11111100'
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1324 movff WREG,win_color5 ; G
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1325
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1326 ; Mask Bit 4,3,2,1,0
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1327 movlw b'11100000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1328 andwf DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1329
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1330 rrncf DISPLAY1_temp,F
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1331 rrncf DISPLAY1_temp,F
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1332 rrncf DISPLAY1_temp,F
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1333 rrncf DISPLAY1_temp,F
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1334 rrncf DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1335
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1336 movlw b'00000000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1337 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1338 movlw b'00010000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1339 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1340 movlw b'00100000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1341 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1342 movlw b'00110000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1343 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1344 movlw b'01000000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1345 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1346 movlw b'01010000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1347 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1348 movlw b'10000000'
684
99b3fb0ab4c7 pixel_write fix
heinrichsweikamp
parents: 681
diff changeset
1349 dcfsnz DISPLAY1_temp,F
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1350 movlw b'11111100'
706
d68c6a6b1f38 aa fonts processor
heinrichsweikamp
parents: 705
diff changeset
1351 movff WREG,win_color4 ; R
681
6e456a6398e0 Hardware4 support
heinrichsweikamp
parents:
diff changeset
1352 return