/[projet1]/users/barnsey123/HNEFATAFL/draw.s
Defence Force logotype

Contents of /users/barnsey123/HNEFATAFL/draw.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 934 - (show annotations)
Mon Jun 3 15:10:45 2013 UTC (6 years, 10 months ago) by barnsey123
File size: 7527 byte(s)
v0.050 - color cursor and twilighte dedication
1
2
3
4
5 .zero
6
7 .text
8
9
10 ; Add 40 to "tmp1"
11 _Add40
12 .(
13 clc
14 lda tmp1+0
15 adc #40
16 sta tmp1+0
17 bcc skip
18 inc tmp1+1
19 skip
20 rts
21 .)
22
23 ; X=number of columns
24 ; Out: update "tmp1"
25 _AddCol
26 .(
27 cpx #0
28 loop
29 beq end
30 clc
31 lda tmp1+0
32 adc #3
33 sta tmp1+0
34 lda tmp1+1
35 adc #0
36 sta tmp1+1
37 dex
38 jmp loop
39 end
40 rts
41 .)
42
43
44 ; Y=number of rows
45 ; Out: update "tmp1"
46 _AddRow
47 .(
48 cpy #0
49 loop
50 beq end
51 clc
52 lda tmp1+0
53 adc #<720
54 sta tmp1+0
55 lda tmp1+1
56 adc #>720
57 sta tmp1+1
58 dey
59 jmp loop
60 end
61 rts
62 .)
63
64
65 ; x=column
66 ; y=row
67 _SetScreenAddress
68 .(
69 lda #<$a002
70 sta tmp1+0
71 lda #>$a002
72 sta tmp1+1
73
74 ; +col*3
75 jsr _AddCol
76
77 ; +row*720
78 jsr _AddRow
79 rts
80 .)
81
82 _inkasm
83 .(
84 ldx #199
85 lda #<$a001
86 sta tmp1+0
87 lda #>$a001
88 sta tmp1+1
89 ldy #0
90 loop
91 lda _inkcolor
92 sta (tmp1),y
93 jsr _Add40
94 dex
95 bne loop
96 rts
97 .)
98
99 _deadatt
100 .(
101 ldx #210
102 lda #<$a024
103 sta tmp1+0
104 lda #>$a024
105 sta tmp1+1
106 ldy #0
107 loop
108 lda #3
109 sta (tmp1),y
110 jsr _Add40
111 dex
112 bne loop
113 rts
114 .)
115
116 _deaddef
117 .(
118 ldx #210
119 lda #<$a026
120 sta tmp1+0
121 lda #>$a026
122 sta tmp1+1
123 ldy #0
124 loop
125 lda #1
126 sta (tmp1),y
127 jsr _Add40
128 dex
129 bne loop
130 rts
131 .)
132 /*
133 void tileloop()
134 {
135 ptr_draw=(unsigned char*)0xa002; // pointer to start of board
136 ptr_draw+=(col*3)+(row*720); // 720=18*40 starting screen coordinate
137 for (counter=0;counter<18;inccounter()) //tileheight=pixels (e.g. 18)
138 {
139 //for (x=0;x<tilewidth;x++)
140 // {
141 // ptr_draw[x]=ptr_graph[x];
142 // }
143 ptr_draw[0]=ptr_graph[0];
144 ptr_draw[1]=ptr_graph[1];
145 ptr_draw[2]=ptr_graph[2];
146 ptr_draw+=40; // number of 6pixel "units" to advance (+40=next line down, same position across)
147 ptr_graph+=3; // + unit of measurement (how many 6pixel chunks "across" in graphic file)
148 }
149 }
150 */
151
152 _tileloop
153 .(
154 lda _ptr_graph+0
155 sta tmp0+0
156 lda _ptr_graph+1
157 sta tmp0+1
158
159 ldx _col
160 ldy _row
161 jsr _SetScreenAddress
162
163 ; Draw loop
164 .(
165 ldx #18
166 loop
167 ldy #0
168 lda (tmp0),y
169 sta (tmp1),y
170 iny
171 lda (tmp0),y
172 sta (tmp1),y
173 iny
174 lda (tmp0),y
175 sta (tmp1),y
176
177 .(
178 clc
179 lda tmp0+0
180 adc #3
181 sta tmp0+0
182 bcc skip
183 inc tmp0+1
184 skip
185 .)
186
187 jsr _Add40
188
189 dex
190 bne loop
191 .)
192
193 ; Update ptr_graph (for animation purpose)
194 lda tmp0+0
195 sta _ptr_graph+0
196 lda tmp0+1
197 sta _ptr_graph+1
198
199 rts
200 .)
201
202
203 ;_eorMagicValueTable .byt 0,128,63,63+128
204 ;_eorMagicValue .byt 0
205 ;_eorMagicValueCounter .byt 3
206
207 ;_tileloop2
208 ;.(
209 ; ;inc _eorMagicValueCounter
210 ; lda #1
211 ; and #3
212 ; tax
213 ; lda _eorMagicValueTable,x
214 ; sta _eorMagicValue
215 ;
216 ; lda _ptr_graph+0
217 ; sta tmp0+0
218 ; lda _ptr_graph+1
219 ; sta tmp0+1
220 ;
221 ; ldx _col
222 ; ldy _row
223 ; jsr _SetScreenAddress
224 ;
225 ; ; Draw loop
226 ; .(
227 ; ldx #18
228 ;loop
229 ; ldy #0
230 ; lda (tmp0),y
231 ; eor _eorMagicValue
232 ; sta (tmp1),y
233 ; iny
234 ; lda (tmp0),y
235 ; eor _eorMagicValue
236 ; sta (tmp1),y
237 ; iny
238 ; lda (tmp0),y
239 ; eor _eorMagicValue
240 ; sta (tmp1),y
241 ; .(
242 ; clc
243 ; lda tmp0+0
244 ; adc #3
245 ; sta tmp0+0
246 ; bcc skip
247 ; inc tmp0+1
248 ;skip
249 ; .)
250 ; jsr _Add40
251 ; dex
252 ; bne loop
253 ; .)
254 ; Update ptr_graph (for animation purpose)
255 ; lda tmp0+0
256 ; sta _ptr_graph+0
257 ; lda tmp0+1
258 ; sta _ptr_graph+1
259 ; rts
260 ;.)
261
262
263 /*
264 void drawtile() // draws a board tile, player piece or "arrow"
265 {
266 startpos=tiletodraw*54; // 54=3*18 calc how many lines "down" in the graphic file to print from
267 ptr_graph+=startpos; // set start position in graphic file
268 tileloop();
269 }
270 */
271 _drawtile
272 .(
273 ; ptr_graph+=tiletodraw*54
274 .(
275 ldx _tiletodraw
276 loop
277 beq end
278 clc
279 lda _ptr_graph+0
280 adc #<54
281 sta _ptr_graph+0
282 bcc skip
283 inc _ptr_graph+1
284 skip
285 dex
286 jmp loop
287 end
288 .)
289
290 jmp _tileloop
291 .)
292
293
294
295 /*
296 void drawtiles() // DRAW ALL THE TILES ON THE BOARD
297 {
298 for (row=0;row<11;row++)
299 {
300 for (col=0;col<11;col++)
301 {
302 players[row][col]=tiles[row][col]; // populate players array
303 ptr_graph=PictureTiles; // pointer to Picture Tiles graphics
304 tiletodraw=tiles[row][col];
305 if ( tiletodraw==4 ) { tiletodraw=3;}
306 drawtile();
307 }
308 }
309 }
310 */
311 _drawtiles
312 .(
313 ldy #0
314
315 ldx #0
316 loop_row
317 stx _row
318
319 ldx #0
320 loop_col
321 stx _col
322
323 lda _tiles,y
324 sta _players,y
325 cmp #4
326 bne set_tile_to_draw
327 lda #3
328 set_tile_to_draw
329 sta _tiletodraw
330
331 lda #<_PictureTiles
332 sta _ptr_graph+0
333 lda #>_PictureTiles
334 sta _ptr_graph+1
335
336 tya
337 pha
338
339 jsr _drawtile
340
341 pla
342 tay
343 iny
344
345 ldx _col
346 inx
347 cpx #11
348 bne loop_col
349
350 ldx _row
351 inx
352 cpx #11
353 bne loop_row
354
355 rts
356 .)
357
358
359
360 ; Draw an inversed colr box to highlight selected box
361 ; _cx=screen x position
362 ; _cy=screen y position
363 _inverse
364 .(
365 ldx _cx
366 ldy _cy
367 jsr _SetScreenAddress
368 jsr _Add40
369 ;jsr _Add40
370
371 ; Draw loop
372 .(
373 ldx #17
374 loop
375 ldy #0
376 lda (tmp1),y
377 eor #%111111
378 eor #128
379 sta (tmp1),y
380 iny
381 lda (tmp1),y
382 eor #%111111
383 eor #128
384 sta (tmp1),y
385 iny
386 lda (tmp1),y
387 eor #%111111
388 eor #128
389 sta (tmp1),y
390
391 jsr _Add40
392
393 dex
394 bne loop
395 .)
396
397 rts
398 .)
399
400 _inverse2
401 .(
402 ldx _cx
403 ldy _cy
404 jsr _SetScreenAddress
405 jsr _Add40
406 ; Draw loop
407 .(
408 ldx #17
409 loop
410 ldy #0
411 lda (tmp1),y
412 eor #%111111
413 eor #128
414 eor #63
415 sta (tmp1),y
416 iny
417 lda (tmp1),y
418 eor #%111111
419 eor #128
420 eor #63
421 sta (tmp1),y
422 iny
423 lda (tmp1),y
424 eor #%111111
425 eor #128
426 eor #63
427 sta (tmp1),y
428
429 jsr _Add40
430
431 dex
432 bne loop
433 .)
434
435 rts
436 .)
437
438 ; _cx=x coordinate
439 ; _cy=y coordinate
440 ; _fb=0 -> Erase
441 ; _fb=1 -> Draw
442 ;_drawcursor
443 ;.(
444 ; ldx _cx
445 ; ldy _cy
446 ; jsr _SetScreenAddress
447 ;
448 ; jsr _Add40
449 ;
450 ; lda _fb
451 ; beq erase
452 ;
453 ;draw
454 ; .(
455 ; ; top line
456 ; ldy #0
457 ; lda #%101010
458 ; sta (tmp1),y
459 ; iny
460 ; sta (tmp1),y
461 ; iny
462 ; sta (tmp1),y
463 ;
464
465 ; Draw loop
466 ; .(
467 ; ldx #8
468 ;loop
469 ; jsr _Add40
470 ; ; draw
471 ; ldy #0
472 ; lda (tmp1),y
473 ; ora #%010000
474 ; sta (tmp1),y
475 ; iny
476 ; iny
477 ; lda (tmp1),y
478 ; ora #%000001
479 ; sta (tmp1),y
480 ; jsr _Add40
481 ; dex
482 ; bne loop
483 ; .)
484 ;
485 ; ; bottom line
486 ; ldy #0
487 ; lda #%101010
488 ; sta (tmp1),y
489 ; iny
490 ; sta (tmp1),y
491 ; iny
492 ; sta (tmp1),y
493 ;
494 ; rts
495 ; .)
496 ;erase
497 ; .(
498 ; ; top line
499 ; ldy #0
500 ; lda #%1000000
501 ; sta (tmp1),y
502 ; iny
503 ; ;lda #%1000000
504 ; sta (tmp1),y
505 ; iny
506 ; sta (tmp1),y
507 ;
508
509 ; ; Draw loop
510 ; .(
511 ; ldx #8
512 ;loop
513 ; jsr _Add40
514 ;
515 ; draw
516 ; ldy #0
517 ; lda (tmp1),y
518 ; and #%11111111
519 ; sta (tmp1),y
520 ; iny
521 ; lda (tmp1),y
522 ; sta (tmp1),y
523 ; iny
524 ; lda (tmp1),y
525 ; and #%11111110
526 ; sta (tmp1),y
527 ;
528 ; jsr _Add40
529 ;
530 ; dex
531 ; bne loop
532 ; .)
533
534 ; bottom line
535 ; ldy #0
536 ; lda #%1000000
537 ; sta (tmp1),y
538 ; iny
539 ; ;lda #%1000000
540 ; sta (tmp1),y
541 ; iny
542 ; sta (tmp1),y
543
544 ; rts
545 ; .)
546 ;.)
547
548
549 ;_hiresasm
550 ; LDA $02C0
551 ; PHA
552 ; AND #$02
553 ; BEQ $EBF4
554 ; PLA
555 ; ORA #$01
556 ; STA $02C0
557 ; JSR _sethires
558 ; RTS
559 ;
560 ;_sethires
561 ; PHA
562 ; LDA $021F
563 ; BNE $F92B
564 ; LDX #$0B
565 ; JSR _subhires1
566 ; LDA #$FE
567 ; AND $026A
568 ; STA $026A
569 ; LDA #$1E
570 ; STA $BFDF
571 ; LDA #$40
572 ; STA $A000
573 ; LDX #$17
574 ; JSR _subhires1
575 ; LDA #$00
576 ; STA $0219
577 ; STA $021A
578 ; STA $10
579 ; LDA #$A0
580 ; STA $11
581 ; LDA #$20
582 ; STA $0215
583 ; LDA #$FF
584 ; STA $0213
585 ; JSR $F8DC
586 ; LDA #$01
587 ; ORA $026A
588 ; STA $026A
589 ; PLA
590 ; RTS
591
592 ; F982
593 ;_subhires1
594 ; LDY #$06
595 ;loop
596 ; LDA $F992,X
597 ; STA $000B,Y
598 ; DEX
599 ; DEY
600 ; BNE loop
601 ; JSR _subhires1A
602 ; RTS
603 ;
604 ;EDC4
605 ;_s;ubhires1A
606 ; LDX #$00
607 ; LDY #$00
608 ;bra3
609 ; CPY $10
610 ; BNE bra2
611 ; CPX $11
612 ; BEQ bra1
613 ;bra2
614 ; LDA ($0C),Y
615 ; STA ($0E),Y
616 ; INY
617 ; BNE bra3
618 ; INC $0D
619 ; INC $0F
620 ; INX
621 ; JMP $EDC8
622 ;bra1
623 ; RTS

  ViewVC Help
Powered by ViewVC 1.1.26