Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/color_processor.asm @ 123:6a94f96e9cea
The big cleanup, again.
author | JeanDo |
---|---|
date | Thu, 30 Dec 2010 23:45:20 +0100 |
parents | 8aa8acada0fd |
children | 8b75ba28d641 |
comparison
equal
deleted
inserted
replaced
122:3003a8040b78 | 123:6a94f96e9cea |
---|---|
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 ; along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 ; | 19 ; |
20 ; Copyright (c) 2010, JD Gascuel. | 20 ; Copyright (c) 2010, JD Gascuel. |
21 ;============================================================================= | 21 ;============================================================================= |
22 ; HISTORY | 22 ; HISTORY |
23 ; 2010-12-13 : [jDG] Creation | 23 ; 2010-12-13 : [jDG] Creation. |
24 ; 2010-12-30 : [jDG] Revised to put temp into ACCESSRAM0 | |
24 ; | 25 ; |
25 ; RATIONALS: The OSTC have a nice color screen, and a std geek attitude impose | 26 ; RATIONALS: The OSTC have a nice color screen, and a std geek attitude impose |
26 ; to show off ... ;-) | 27 ; to show off ... ;-) |
27 ; | 28 ; |
28 ; Inputs: TBLPTR points to the image description block. | 29 ; Inputs: TBLPTR points to the image description block. |
47 ; 07 is 8 pixels color 0 | 48 ; 07 is 8 pixels color 0 |
48 ; 70 is 1 pixel color 7 | 49 ; 70 is 1 pixel color 7 |
49 ; bf is 16 pixels of color .11 | 50 ; bf is 16 pixels of color .11 |
50 ; F1 F2 F3 04 is 0x1235 pixels of color 0. | 51 ; F1 F2 F3 04 is 0x1235 pixels of color 0. |
51 ; | 52 ; |
52 ;Temporary overlay (in bank 0) | 53 ;Temporary overlay (in bank 0), ACCESS area |
53 img_width equ aa_width | 54 CBLOCK 0x000 |
54 img_height equ aa_height | 55 img_colors |
55 img_top equ win_top | 56 img_width:2 ; SHOULD be @1, because of aa_box_cmd |
56 img_left equ win_leftx2 | 57 img_pixelsL |
57 img_pixelsL equ aa_start+0 | 58 img_pixelsH |
58 img_pixelsH equ aa_start+1 | 59 img_pixelsU |
59 img_pixelsU equ aa_end+0 | 60 img_countL |
60 img_countL equ aa_end+1 | 61 img_countH |
61 img_countH equ aa_colorDiv+0 | 62 colorTable:.30 |
62 img_colors equ aa_colorDiv+1 | 63 ENDC |
63 colorTable equ letter | |
64 | |
65 ;----------------------------------------------------------------------------- | |
66 ; Make an entry in the link map. | |
67 color_processor code | |
68 | 64 |
69 ;----------------------------------------------------------------------------- | 65 ;----------------------------------------------------------------------------- |
70 color_image: | 66 color_image: |
71 movlb HIGH(img_width) ; Switch to bank 0. | 67 movlb HIGH(img_width) ; Switch to bank 0. |
72 | 68 |
73 ;---- Get image parameters ------------------------------------------- | 69 ;---- Get image parameters ------------------------------------------- |
74 tblrd*+ | 70 tblrd*+ |
75 movff TABLAT,img_width | 71 movff TABLAT,img_width |
76 tblrd*+ | 72 tblrd*+ |
77 movff TABLAT,img_height | 73 movff TABLAT,win_height |
78 tblrd*+ | 74 tblrd*+ |
79 movff TABLAT,img_colors | 75 movff TABLAT,img_colors |
80 tblrd*+ | 76 tblrd*+ |
81 ;---- Copy color table ----------------------------------------------- | 77 ;---- Copy color table ----------------------------------------------- |
82 movf img_colors,W | 78 movf img_colors,W |
89 decfsz WREG | 85 decfsz WREG |
90 bra get_colors_loop | 86 bra get_colors_loop |
91 | 87 |
92 ; Compute width * height * 2 : the number of pixels to write. | 88 ; Compute width * height * 2 : the number of pixels to write. |
93 clrf img_pixelsU | 89 clrf img_pixelsU |
94 movf img_width,W ; Compute number of pixels to draw | 90 movf img_width,W,ACCESS ; Compute number of pixels to draw |
95 mulwf img_height ; 0 .. 160x240 | 91 mulwf win_height ; 0 .. 160x240 |
96 bcf STATUS,C ; BEWARE: milw does not reset carry flag ! | 92 bcf STATUS,C ; BEWARE: milw does not reset carry flag ! |
97 rlcf PRODL ; x2 --> 0 .. 320x240, might by > 0xFFFF | 93 rlcf PRODL ; x2 --> 0 .. 320x240, might by > 0xFFFF |
98 rlcf PRODH | 94 rlcf PRODH |
99 movff PRODL, img_pixelsL | 95 movff PRODL, img_pixelsL |
100 movff PRODH, img_pixelsH | 96 movff PRODH, img_pixelsH |
139 | 135 |
140 ; Get pixel color into PROD | 136 ; Get pixel color into PROD |
141 xorlw 0xF0 ; Get back index. | 137 xorlw 0xF0 ; Get back index. |
142 swapf WREG ; Get color index to lower bits. | 138 swapf WREG ; Get color index to lower bits. |
143 addwf WREG ; x2 | 139 addwf WREG ; x2 |
144 addlw LOW(letter) ; 0x60 + 2 * .15 < 0x80. | 140 addlw LOW(colorTable) ; 0x60 + 2 * .15 < 0x80. |
145 movff WREG,FSR2L | 141 movff WREG,FSR2L |
146 movff POSTINC2,PRODL | 142 movff POSTINC2,PRODL |
147 movff POSTINC2,PRODH | 143 movff POSTINC2,PRODH |
148 | 144 |
149 ; Substract count-1 from the number of pixel we should do. | 145 ; Substract count-1 from the number of pixel we should do. |