/[projet1]/public/oric/demos/AlchimieX/effect_chessboard.s
Defence Force logotype

Contents of /public/oric/demos/AlchimieX/effect_chessboard.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 970 - (show annotations)
Tue Nov 12 20:07:47 2013 UTC (5 years, 10 months ago) by dbug
File size: 2890 byte(s)
Source code for the AlchimieGarden demo
1
2
3
4 .text
5
6 _xpos .byt 0,0 // Current checkboard coordinate
7 _curx .byt 0,0 // Temporaty values for computations
8
9 _ypos .byt 0,0
10 _cury .byt 0,0
11
12 _zoomstart .byt 128 // Half size stuff
13 _zoom .byt 128 // Half size stuff
14
15
16 buffer .dsb 40-4 // Where we have the defined values of charset after packing
17
18 InkTable .byt 0 ,3
19 PaperTable .byt 16+7+128 ,16
20 AttriTable .byt 26+128 ,26
21
22
23 _DrawHorizontalChecker
24 .(
25
26 breakpoint
27 ;jmp breakpoint
28
29 ; Init X
30 lda _xpos+0
31 sta _curx+0
32 lda _xpos+1
33 sta _curx+1
34
35 ; Init Y
36 lda _ypos+0
37 sta _cury+0
38 lda _ypos+1
39 sta _cury+1
40
41 ; Initialize pixel counter
42 ldx #(40-4)*6
43
44 ; Consider we start with value equal to the first bit of high coordinate
45 ;lda _xpos+0
46 ;and #1
47
48 ; Starting zoom counter depends of the position where we are in the pixel.
49 ; If xpos+1=0, then start value=zoom
50 ; If xpos+1=255, then start value=0
51 ; If xpos+1=128, then start value=zoom/2
52 ; start value=zoom*(255-xpos[1])/255
53 ; Perhaps usefull to do a loop of that ?
54 .(
55 lda #1
56 ldy _zoomstart
57 loop_pixel
58 ; push pixel in stack buffer
59 pha
60 dex
61 beq end
62 dey
63 bne loop_pixel
64
65 ; reload zoom factor
66 ldy _zoom
67
68 ; flip color bit
69 eor #1
70
71 ; continue
72 jmp loop_pixel
73
74 end
75 .)
76
77 ;
78 ; Now we need to pack bits together
79 ;
80 ldx #0
81 ldy #0
82 clc
83 loop_pack
84 sty tmp1
85
86 pla
87 ror
88 rol tmp1
89 pla
90 ror
91 rol tmp1
92 pla
93 ror
94 rol tmp1
95 pla
96 ror
97 rol tmp1
98 pla
99 ror
100 rol tmp1
101 pla
102 ror
103 rol tmp1
104
105 lda tmp1
106 sta buffer,x
107
108 inx
109 cpx #40-4
110 bne loop_pack
111
112
113 ;
114 ; Now, need to redefine characters with that
115 ;
116 .(
117 lda #<$b400+8*(32+10)
118 sta tmp0+0
119 lda #>$b400+8*(32+10)
120 sta tmp0+1
121
122 lda #3
123 sta tmp1
124 ldx #0
125 ldy #0
126 loop_copy
127 lda buffer,x
128
129 ldy #0
130 sta (tmp0),y
131 iny
132 sta (tmp0),y
133 iny
134 sta (tmp0),y
135 iny
136 sta (tmp0),y
137 iny
138 sta (tmp0),y
139 iny
140 sta (tmp0),y
141 iny
142 sta (tmp0),y
143 iny
144 sta (tmp0),y
145
146 lda #8
147 .(
148 dec tmp1
149 bne skip
150 lda #4
151 sta tmp1
152 lda #8+8
153 skip
154 .)
155 .(
156 clc
157 adc tmp0+0
158 sta tmp0+0
159 bcc skip
160 inc tmp0+1
161 skip
162 .)
163
164 inx
165 cpx #40-4
166 bne loop_copy
167 .)
168
169 rts
170 .)
171
172
173 _DrawVerticalChecker
174 lda #<$a000+40*88
175 sta tmp0+0
176
177 lda #>$a000+40*88
178 sta tmp0+1
179
180 .(
181 ; Initialize pixel counter
182 ldx #112
183
184 .(
185 lda #1
186 ldy _zoomstart
187 loop_pixel
188 ; push pixel in stack buffer
189 pha
190 dex
191 beq end
192 dey
193 bne loop_pixel
194
195 ; reload zoom factor
196 ldy _zoom
197
198 ; flip color bit
199 eor #1
200
201 ; continue
202 jmp loop_pixel
203
204 end
205 .)
206
207 ;
208 ; Now we need to change the colors
209 ;
210 lda #112
211 sta tmp1
212
213 loop_colors
214 pla
215 tax
216
217 lda InkTable,x
218 ldy #1
219 sta (tmp0),y
220
221 lda PaperTable,x
222 iny
223 sta (tmp0),y
224
225 lda AttriTable,x
226 iny
227 sta (tmp0),y
228
229 .(
230 clc
231 lda tmp0+0
232 adc #40
233 sta tmp0+0
234 bcc skip
235 inc tmp0+1
236 skip
237 .)
238
239 dec tmp1
240 bne loop_colors
241
242 rts
243 .)
244
245
246
247
248

  ViewVC Help
Powered by ViewVC 1.1.26