/[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 978 - (show annotations)
Sun Nov 24 18:35:12 2013 UTC (6 years, 4 months ago) by barnsey123
File size: 8946 byte(s)
v0.078 Trophy Text added and URUZ trophy now calculates correctly
1
2
3
4
5 .zero
6
7 .text
8
9 ; Add 40 to "tmp1"
10 _Add40
11 .(
12 clc
13 lda tmp1+0
14 adc #40
15 sta tmp1+0
16 bcc skip
17 inc tmp1+1
18 skip
19 rts
20 .)
21
22 _Add1
23 .(
24 clc
25 lda tmp1+0
26 adc #1
27 sta tmp1+0
28 bcc skip
29 inc tmp1+1
30 skip
31 rts
32 .)
33
34 ; X=number of columns
35 ; Out: update "tmp1"
36 _AddCol
37 .(
38 cpx #0
39 loop
40 beq end
41 clc
42 lda tmp1+0
43 adc #3
44 sta tmp1+0
45 lda tmp1+1
46 adc #0
47 sta tmp1+1
48 dex
49 jmp loop
50 end
51 rts
52 .)
53
54
55 ; Y=number of rows
56 ; Out: update "tmp1"
57 _AddRow
58 .(
59 cpy #0
60 loop
61 beq end
62 clc
63 lda tmp1+0
64 adc #<720
65 sta tmp1+0
66 lda tmp1+1
67 adc #>720
68 sta tmp1+1
69 dey
70 jmp loop
71 end
72 rts
73 .)
74
75
76 ; x=column
77 ; y=row
78 _SetScreenAddress
79 .(
80 lda #<$a002
81 sta tmp1+0
82 lda #>$a002
83 sta tmp1+1
84
85 ; +col*3
86 jsr _AddCol
87
88 ; +row*720
89 jsr _AddRow
90 rts
91 .)
92
93 _inkasm
94 .(
95 ldx #199
96 lda #<$a001
97 sta tmp1+0
98 lda #>$a001
99 sta tmp1+1
100 ldy #0
101 loop
102 lda _inkcolor
103 sta (tmp1),y
104 jsr _Add40
105 dex
106 bne loop
107 rts
108 .)
109
110 _deadatt
111 .(
112 ldx #210
113 lda #<$a024
114 sta tmp1+0
115 lda #>$a024
116 sta tmp1+1
117 ldy #0
118 loop
119 lda #3
120 sta (tmp1),y
121 jsr _Add40
122 dex
123 bne loop
124 rts
125 .)
126
127 _deaddef
128 .(
129 ldx #210
130 lda #<$a026
131 sta tmp1+0
132 lda #>$a026
133 sta tmp1+1
134 ldy #0
135 loop
136 lda #1
137 sta (tmp1),y
138 jsr _Add40
139 dex
140 bne loop
141 rts
142 .)
143
144 ; draws the bottom of the board
145 _drawbottom
146 .(
147 lda #<$bef2
148 sta tmp1+0
149 lda #>$bef2
150 sta tmp1+1
151 ldx #33
152 loop
153 ldy #0
154 lda _bottompattern;
155 sta (tmp1),y
156 jsr _Add1
157 dex
158 bne loop
159 rts
160 .)
161 ; draws bottom of trophy grid
162 _DrawTrophyBottom
163 .(
164 lda #<$b967
165 sta tmp1+0
166 lda #>$b967
167 sta tmp1+1
168 ldx #6
169 loop
170 ldy #0
171 lda #%111111;
172 sta (tmp1),y
173 jsr _Add1
174 dex
175 bne loop
176 rts
177 .)
178 ; draws the edge of the board
179 _drawedge
180 .(
181 lda #<$a023
182 sta tmp1+0
183 lda #>$a023
184 sta tmp1+1
185 ldx #199
186 loop
187 ldy #0
188 lda #%100000
189 sta (tmp1),y
190 jsr _Add40
191 dex
192 bne loop
193 rts
194 .)
195 ; draws the edge of the trophy grid
196 _DrawTrophyEdge
197 .(
198 lda #<$a5bd
199 sta tmp1+0
200 lda #>$a5bd
201 sta tmp1+1
202 ldx #127
203 loop
204 ldy #0
205 lda #%100000
206 sta (tmp1),y
207 jsr _Add40
208 dex
209 bne loop
210 rts
211 .)
212
213 _chasm
214 .(
215 lda _deadcurset+0
216 sta tmp1+0
217 lda _deadcurset+1
218 sta tmp1+1
219 ldx #0
220 loop
221 ; check to see if a space is to be printed
222 lda _deadtoggle
223 cmp #0
224 beq chasmspace ; set the space char
225 lda _playertype ; if not a space then either defender or attacker
226 cmp #1 ; is it a defender?
227 beq chasmdef ; playertype=defender
228 lda $9948,x ; else playertype=attacker
229 chasmx
230 ldy #0
231 sta (tmp1),y
232 jsr _Add40
233 inx
234 cpx #7
235 bcc loop
236 rts
237 chasmspace
238 lda $9900,x
239 jmp chasmx
240 chasmdef
241 lda $9940,x
242 jmp chasmx
243 .)
244
245 _chasm2
246 .(
247 lda _deadcurset+0
248 sta tmp1+0
249 lda _deadcurset+1
250 sta tmp1+1
251 ldx #0
252 loop
253 lda _textchar ; load the char id no into accumulator
254 cmp #65 ; is it an A?
255 beq chasmA
256 cmp #66 ; B?
257 beq chasmB
258 cmp #68 ; D?
259 beq chasmD
260 cmp #69 ; E?
261 beq chasmE
262 cmp #70 ; F?
263 beq chasmF
264 cmp #71 ; G?
265 beq chasmG
266 cmp #73 ; I?
267 beq chasmI
268 cmp #75 ; K?
269 beq chasmK
270 cmp #76 ; L?
271 beq chasmL
272 cmp #79 ; O?
273 beq chasmO
274 cmp #82 ; R?
275 beq chasmR
276 cmp #83 ; S?
277 beq chasmS
278 cmp #84 ; T?
279 beq chasmT
280 cmp #85 ; U?
281 beq chasmU
282 cmp #90 ; Z?
283 beq chasmZ
284 lda $9900,x ; else print a space
285 chasmx2
286 ldy #0
287 sta (tmp1),y
288 jsr _Add40
289 inx
290 cpx #7
291 bcc loop
292 rts
293 chasmA
294 lda $9A08,x
295 jmp chasmx2
296 chasmB
297 lda $9A10,x
298 jmp chasmx2
299 chasmD
300 lda $9A20,x
301 jmp chasmx2
302 chasmE
303 lda $9A28,x
304 jmp chasmx2
305 chasmF
306 lda $9A30,x
307 jmp chasmx2
308 chasmG
309 lda $9A38,x
310 jmp chasmx2
311 chasmI
312 lda $9A48,x
313 jmp chasmx2
314 chasmK
315 lda $9A58,x
316 jmp chasmx2
317 chasmL
318 lda $9A60,x
319 jmp chasmx2
320 chasmO
321 lda $9A78,x
322 jmp chasmx2
323 chasmR
324 lda $9A90,x
325 jmp chasmx2
326 chasmS
327 lda $9A98,x
328 jmp chasmx2
329 chasmT
330 lda $9AA0,x
331 jmp chasmx2
332 chasmU
333 lda $9AA8,x
334 jmp chasmx2
335 chasmZ
336 lda $9AD0,x
337 jmp chasmx2
338 .)
339
340 _SetScreenAddress2
341 .(
342 ldx _cx
343 ldy _cy
344 jsr _SetScreenAddress
345 rts
346 .)
347
348 _tileloop
349 .(
350 lda _ptr_graph+0
351 sta tmp0+0
352 lda _ptr_graph+1
353 sta tmp0+1
354
355 ldx _col
356 ldy _row
357 jsr _SetScreenAddress
358
359 ; Draw loop
360 .(
361 ldx #18
362 loop
363 ldy #0
364 lda (tmp0),y
365 sta (tmp1),y
366 iny
367 lda (tmp0),y
368 sta (tmp1),y
369 iny
370 lda (tmp0),y
371 sta (tmp1),y
372
373 .(
374 clc
375 lda tmp0+0
376 adc #3
377 sta tmp0+0
378 bcc skip
379 inc tmp0+1
380 skip
381 .)
382
383 jsr _Add40
384
385 dex
386 bne loop
387 .)
388
389 ; Update ptr_graph (for animation purpose)
390 lda tmp0+0
391 sta _ptr_graph+0
392 lda tmp0+1
393 sta _ptr_graph+1
394
395 rts
396 .)
397
398
399 ;_eorMagicValueTable .byt 0,128,63,63+128
400 ;_eorMagicValue .byt 0
401 ;_eorMagicValueCounter .byt 3
402
403 ;_tileloop2
404 ;.(
405 ; ;inc _eorMagicValueCounter
406 ; lda #1
407 ; and #3
408 ; tax
409 ; lda _eorMagicValueTable,x
410 ; sta _eorMagicValue
411 ;
412 ; lda _ptr_graph+0
413 ; sta tmp0+0
414 ; lda _ptr_graph+1
415 ; sta tmp0+1
416 ;
417 ; ldx _col
418 ; ldy _row
419 ; jsr _SetScreenAddress
420 ;
421 ; ; Draw loop
422 ; .(
423 ; ldx #18
424 ;loop
425 ; ldy #0
426 ; lda (tmp0),y
427 ; eor _eorMagicValue
428 ; sta (tmp1),y
429 ; iny
430 ; lda (tmp0),y
431 ; eor _eorMagicValue
432 ; sta (tmp1),y
433 ; iny
434 ; lda (tmp0),y
435 ; eor _eorMagicValue
436 ; sta (tmp1),y
437 ; .(
438 ; clc
439 ; lda tmp0+0
440 ; adc #3
441 ; sta tmp0+0
442 ; bcc skip
443 ; inc tmp0+1
444 ;skip
445 ; .)
446 ; jsr _Add40
447 ; dex
448 ; bne loop
449 ; .)
450 ; Update ptr_graph (for animation purpose)
451 ; lda tmp0+0
452 ; sta _ptr_graph+0
453 ; lda tmp0+1
454 ; sta _ptr_graph+1
455 ; rts
456 ;.)
457
458
459 /*
460 void drawtile() // draws a board tile, player piece or "arrow"
461 {
462 startpos=tiletodraw*54; // 54=3*18 calc how many lines "down" in the graphic file to print from
463 ptr_graph+=startpos; // set start position in graphic file
464 tileloop();
465 }
466 */
467 _drawtile
468 .(
469 ; ptr_graph+=tiletodraw*54
470 .(
471 ldx _tiletodraw
472 loop
473 beq end
474 clc
475 lda _ptr_graph+0
476 adc #<54
477 sta _ptr_graph+0
478 bcc skip
479 inc _ptr_graph+1
480 skip
481 dex
482 jmp loop
483 end
484 .)
485
486 jmp _tileloop
487 .)
488
489
490
491 /*
492 void drawtiles() // DRAW ALL THE TILES ON THE BOARD
493 {
494 for (row=0;row<11;row++)
495 {
496 for (col=0;col<11;col++)
497 {
498 players[row][col]=tiles[row][col]; // populate players array
499 ptr_graph=PictureTiles; // pointer to Picture Tiles graphics
500 tiletodraw=tiles[row][col];
501 if ( tiletodraw==4 ) { tiletodraw=3;}
502 drawtile();
503 }
504 }
505 }
506 */
507 _drawtiles
508 .(
509 ldy #0
510
511 ldx #0
512 loop_row
513 stx _row
514
515 ldx #0
516 loop_col
517 stx _col
518
519 lda _tiles,y
520 sta _players,y
521 cmp #4
522 bne set_tile_to_draw
523 lda #3
524 set_tile_to_draw
525 sta _tiletodraw
526
527 lda #<_PictureTiles
528 sta _ptr_graph+0
529 lda #>_PictureTiles
530 sta _ptr_graph+1
531
532 tya
533 pha
534
535 jsr _drawtile
536
537 pla
538 tay
539 iny
540
541 ldx _col
542 inx
543 cpx #11
544 bne loop_col
545
546 ldx _row
547 inx
548 cpx #11
549 bne loop_row
550
551 rts
552 .)
553
554
555
556 ; Draw an inversed colr box to highlight selected box
557 ; _cx=screen x position
558 ; _cy=screen y position
559 _inverse
560 .(
561 ;ldx _cx
562 ;ldy _cy
563 ;jsr _SetScreenAddress
564 jsr _SetScreenAddress2
565 jsr _Add40
566 ;jsr _Add40
567
568 ; Draw loop
569 .(
570 ldx #17
571 loop
572 ldy #0
573 lda (tmp1),y
574 eor #%111111
575 eor #128
576 sta (tmp1),y
577 iny
578 lda (tmp1),y
579 eor #%111111
580 eor #128
581 sta (tmp1),y
582 iny
583 lda (tmp1),y
584 eor #%111111
585 eor #128
586 sta (tmp1),y
587
588 jsr _Add40
589
590 dex
591 bne loop
592 .)
593
594 rts
595 .)
596
597 _inverse2
598 .(
599 ;ldx _cx
600 ;ldy _cy
601 ;jsr _SetScreenAddress
602 jsr _SetScreenAddress2
603 jsr _Add40
604 ; Draw loop
605 .(
606 ldx #17
607 loop
608 ldy #0
609 lda (tmp1),y
610 eor #%111111
611 eor #128
612 eor #63
613 sta (tmp1),y
614 iny
615 lda (tmp1),y
616 eor #%111111
617 eor #128
618 eor #63
619 sta (tmp1),y
620 iny
621 lda (tmp1),y
622 eor #%111111
623 eor #128
624 eor #63
625 sta (tmp1),y
626
627 jsr _Add40
628
629 dex
630 bne loop
631 .)
632
633 rts
634 .)
635
636 ; _cx=x coordinate
637 ; _cy=y coordinate
638 ; _fb=0 -> Erase
639 ; _fb=1 -> Draw
640 ;_drawcursor
641 ;.(
642 ; ldx _cx
643 ; ldy _cy
644 ; jsr _SetScreenAddress
645 ;
646 ; jsr _Add40
647 ;
648 ; lda _fb
649 ; beq erase
650 ;
651 ;draw
652 ; .(
653 ; ; top line
654 ; ldy #0
655 ; lda #%101010
656 ; sta (tmp1),y
657 ; iny
658 ; sta (tmp1),y
659 ; iny
660 ; sta (tmp1),y
661 ;
662
663 ; Draw loop
664 ; .(
665 ; ldx #8
666 ;loop
667 ; jsr _Add40
668 ; ; draw
669 ; ldy #0
670 ; lda (tmp1),y
671 ; ora #%010000
672 ; sta (tmp1),y
673 ; iny
674 ; iny
675 ; lda (tmp1),y
676 ; ora #%000001
677 ; sta (tmp1),y
678 ; jsr _Add40
679 ; dex
680 ; bne loop
681 ; .)
682 ;
683 ; ; bottom line
684 ; ldy #0
685 ; lda #%101010
686 ; sta (tmp1),y
687 ; iny
688 ; sta (tmp1),y
689 ; iny
690 ; sta (tmp1),y
691 ;
692 ; rts
693 ; .)
694 ;erase
695 ; .(
696 ; ; top line
697 ; ldy #0
698 ; lda #%1000000
699 ; sta (tmp1),y
700 ; iny
701 ; ;lda #%1000000
702 ; sta (tmp1),y
703 ; iny
704 ; sta (tmp1),y
705 ;
706
707 ; ; Draw loop
708 ; .(
709 ; ldx #8
710 ;loop
711 ; jsr _Add40
712 ;
713 ; draw
714 ; ldy #0
715 ; lda (tmp1),y
716 ; and #%11111111
717 ; sta (tmp1),y
718 ; iny
719 ; lda (tmp1),y
720 ; sta (tmp1),y
721 ; iny
722 ; lda (tmp1),y
723 ; and #%11111110
724 ; sta (tmp1),y
725 ;
726 ; jsr _Add40
727 ;
728 ; dex
729 ; bne loop
730 ; .)
731
732 ; bottom line
733 ; ldy #0
734 ; lda #%1000000
735 ; sta (tmp1),y
736 ; iny
737 ; ;lda #%1000000
738 ; sta (tmp1),y
739 ; iny
740 ; sta (tmp1),y
741
742 ; rts
743 ; .)
744 ;.)
745
746

  ViewVC Help
Powered by ViewVC 1.1.26