annotate src/tft.inc @ 620:cd986267a5ca

potential compass bug "fixed"
author heinrichsweikamp
date Fri, 22 Feb 2019 16:30:05 +0100
parents ca4556fb60b9
children c40025d8e750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
3 ; File tft.inc V2.99c
0
heinrichsweikamp
parents:
diff changeset
4 ;
heinrichsweikamp
parents:
diff changeset
5 ; Declaring interfaces to the TFT screen and its Oxxx controler
heinrichsweikamp
parents:
diff changeset
6 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code.
heinrichsweikamp
parents:
diff changeset
11
heinrichsweikamp
parents:
diff changeset
12 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
13 ; TFT public subroutines
heinrichsweikamp
parents:
diff changeset
14 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
15
heinrichsweikamp
parents:
diff changeset
16 ; Writes two half-pixels at position (win_top,win_leftx2)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
17 ; Inputs : win_leftx2, win_top, win_color:2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
18 ; Outputs: (none)
0
heinrichsweikamp
parents:
diff changeset
19 ; Trashed: WREG, PROD
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
20 extern pixel_write
0
heinrichsweikamp
parents:
diff changeset
21
heinrichsweikamp
parents:
diff changeset
22 ;-----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
23 ; Writes one half-pixel at position (win_top,win_leftx2)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
24 ; Inputs : win_leftx2, win_top, win_color:2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
25 ; Outputs: (none)
0
heinrichsweikamp
parents:
diff changeset
26 ; Trashed: WREG, PROD
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
27 extern half_pixel_write
0
heinrichsweikamp
parents:
diff changeset
28
heinrichsweikamp
parents:
diff changeset
29 ;-----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
30 ; Draws a frame around current box with current color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
31 ; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2
0
heinrichsweikamp
parents:
diff changeset
32 ; Outputs: (none)
heinrichsweikamp
parents:
diff changeset
33 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
34 extern TFT_frame
0
heinrichsweikamp
parents:
diff changeset
35
heinrichsweikamp
parents:
diff changeset
36 ;-----------------------------------------------------------------------------
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
37 extern TFT_DisplayOff ; Power-off everything (need a boot next)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
38 extern TFT_boot ; Initialize screen hardware
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
39 extern TFT_Display_FadeIn ; Smooth lighting
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
40 extern TFT_Display_FadeOut ; Smooth darkening
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
41 extern TFT_ClearScreen
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
42 extern TFT_box_write
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
43 extern TFT_box_write_16bit_win_left ; With column in PRODL:PRODH
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
44 extern TFT_box
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
45 extern TFT_box_16bit_win_left ; With column in PRODL:PRODH
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
46 extern TFT_DataWrite_PROD
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
47 extern TFT_set_color
434
a001f170a1f7 hunting a bug in the logbook (Day 3)
heinrichsweikamp
parents: 371
diff changeset
48 ; extern init_pixel_write
0
heinrichsweikamp
parents:
diff changeset
49 extern pixel_write
heinrichsweikamp
parents:
diff changeset
50 extern pixel_write_col320
heinrichsweikamp
parents:
diff changeset
51 extern half_vertical_line
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
52 extern half_horizontal_line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
53
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
54 IFDEF _screendump
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
55 extern TFT_dump_screen
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
56 extern TFT_dump_screen_check
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
57 ENDIF
0
heinrichsweikamp
parents:
diff changeset
58
heinrichsweikamp
parents:
diff changeset
59 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
60 ; Low level macros (for aa_wordprocessor and color_processor)
0
heinrichsweikamp
parents:
diff changeset
61 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
62 extern TFT_CmdWrite
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
63 Index_out macro low_b
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
64 movlw low_b
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
65 call TFT_CmdWrite
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
66 endm
0
heinrichsweikamp
parents:
diff changeset
67
heinrichsweikamp
parents:
diff changeset
68 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
69 ; A shortcut for TFT_box and TFT_frame call sequences
0
heinrichsweikamp
parents:
diff changeset
70 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
71 extern box_frame_std, box_frame_common, box_frame_color, box_frame_color16
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
72 extern box_std_block, box_black_block, box_color_block
0
heinrichsweikamp
parents:
diff changeset
73
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
74 ; Erase a given screen area
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
75 WIN_BOX_BLACK macro top, bottom, left, right
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
76 call box_black_block
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
77 db top, (bottom)-(top)+1, left, (right)-(left)+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
78 endm
0
heinrichsweikamp
parents:
diff changeset
79
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
80 ; Fill a given screen area with standard color (white)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
81 WIN_BOX_STD macro top, bottom, left, right
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
82 call box_std_block
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
83 db top, (bottom)-(top)+1, left, (right)-(left)+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
84 endm
0
heinrichsweikamp
parents:
diff changeset
85
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
86 ; Fill a given screen area with color from WREG (8 bits rrrgggbb)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
87 WIN_BOX_COLOR macro top, bottom, left, right
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
88 call box_color_block
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
89 db top, (bottom)-(top)+1, left, (right)-(left)+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
90 endm
0
heinrichsweikamp
parents:
diff changeset
91
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
92 ; Draw a frame in standard color (white)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
93 WIN_FRAME_STD macro top, bottom, left, right
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
94 call box_frame_std
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
95 db top, (bottom)-(top)+1, left, (right)-(left)+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
96 endm
0
heinrichsweikamp
parents:
diff changeset
97
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
98 ; Draw a frame with color from WREG (8 bits rrrgggbb)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
99 WIN_FRAME_COLOR macro top, bottom, left, right
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
100 call box_frame_color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
101 db top, (bottom)-(top)+1, left, (right)-(left)+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
102 endm
0
heinrichsweikamp
parents:
diff changeset
103
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
104 ; Draw a frame with color from win_color (16 bits in TFT format)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
105 WIN_FRAME_COLOR16 macro top, bottom, left, right
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
106 call box_frame_color16
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
107 db top, (bottom)-(top)+1, left, (right)-(left)+1
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
108 endm
0
heinrichsweikamp
parents:
diff changeset
109
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
110 WIN_FONT macro win_font_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
111 movlw win_font_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
112 movff WREG,win_font
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
113 endm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
114
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
115 WIN_TOP macro win_top_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
116 movlw win_top_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
117 movff WREG,win_top
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
118 endm
0
heinrichsweikamp
parents:
diff changeset
119
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
120 WIN_HEIGHT macro h
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
121 movlw h
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
122 movff WREG,win_height
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
123 endm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
124
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
125 WIN_LEFT macro win_left_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
126 movlw win_left_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
127 movff WREG,win_leftx2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
128 endm
0
heinrichsweikamp
parents:
diff changeset
129
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
130 WIN_WIDTH macro w
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
131 movlw w
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
132 movff WREG,win_width
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
133 endm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
134
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
135 WIN_COLOR macro win_color_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
136 movlw win_color_input
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
137 call TFT_set_color
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
138 endm
0
heinrichsweikamp
parents:
diff changeset
139
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
140 ;;=============================================================================
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
141 ;; TFT_write_flash_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
142 ;;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
143 ;; Inputs : cx, cy : Image center (in 0..160 x 0..240 range)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
144 ;; image : flash image header's address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
145 ;; Outputs: win_top, win_left, win_height, win_width
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
146 ;; image copyed on screen.
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
147 ;; Trashed: PROD, hi, lo
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
148 ;;
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
149 ;; extern TFT_write_flash_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
150 ;; extern TFT_write_flash_image_addr
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
151 ;TFT_WRITE_FLASH_IMAGE macro cx, cy, image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
152 ; If LOW(image) != 0
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
153 ; Error "Image "image" mis-aligned"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
154 ; Endif
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
155 ; If (UPPER(image) & 0xF0) != 0x30
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
156 ; Error "Image "image" not in image flash memory"
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
157 ; Endif
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
158 ; If (cx < 0) || (cx > 160)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
159 ; Error "Image center's X "cx" not in 0..160 range".
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
160 ; Endif
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
161 ; If (cy < 0) || (cy > 240)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
162 ; Error "Image center's Y "cy" not in 0..240 range".
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
163 ; Endif
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
164 ; ; Once we know image is aligned, we can use the compact (4 bytes)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
165 ; ; 12 bit registers to pass the address:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
166 ; lfsr FSR2, ((image)>>8) & 0xFFF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
167 ; WIN_LEFT cx
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
168 ; WIN_TOP cy
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
169 ; call TFT_write_flash_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
170 ; endm
0
heinrichsweikamp
parents:
diff changeset
171
heinrichsweikamp
parents:
diff changeset
172 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
173 ; TFT_write_prom_image
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
174
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
175 ; image referenced by a label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
176 TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
177 extern image_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
178 movlw LOW (image_label)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
179 movwf TBLPTRL
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
180 movlw HIGH (image_label)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
181 movwf TBLPTRH
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
182 movlw UPPER (image_label)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
183 movwf TBLPTRU
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
184 extern color_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
185 call color_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
186 endm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
187
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
188 ; image referenced by an address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
189 TFT_WRITE_PROM_IMAGE_BY_ADDR macro image_address
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
190 movlw LOW (image_address)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
191 movwf TBLPTRL
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
192 movlw HIGH (image_address & 0xFFFF)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
193 movwf TBLPTRH
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
194 movlw UPPER (image_address)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
195 movwf TBLPTRU
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
196 extern color_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
197 call color_image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
198 endm
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
199
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
200 ; custom colors referenced by label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
201 TFT_WRITE_PROM_IMAGE_CUST_COLOR macro colors_label
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
202 movlw LOW (colors_label)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
203 movwf TBLPTRL
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
204 movlw HIGH (colors_label)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
205 movwf TBLPTRH
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
206 movlw UPPER (colors_label)
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
207 movwf TBLPTRU
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
208 extern get_colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
209 call get_colors
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
210 bsf use_custom_colors ; will suppress read-in of the colors that come with the image
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
211 endm
0
heinrichsweikamp
parents:
diff changeset
212
heinrichsweikamp
parents:
diff changeset
213 ;=============================================================================
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
214 ; Macro to provide our own interface code
0
heinrichsweikamp
parents:
diff changeset
215 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
216 PIXEL_WRITE macro colRegister, rowRegister
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
217 movff colRegister,win_leftx2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
218 movff rowRegister,win_top
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
219 call pixel_write
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
220 endm
0
heinrichsweikamp
parents:
diff changeset
221
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
222 ;INIT_PIXEL_WRITE macro colRegister
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
223 ; movff colRegister,win_leftx2
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
224 ; call init_pixel_write
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
225 ; endm
0
heinrichsweikamp
parents:
diff changeset
226
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
227 HALF_PIXEL_WRITE macro rowRegister
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
228 movff rowRegister,win_top
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
229 call half_pixel_write
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 560
diff changeset
230 endm