/[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 994 - (show annotations)
Thu Dec 5 15:35:42 2013 UTC (6 years, 1 month ago) by barnsey123
File size: 8845 byte(s)
v0.089 much reduced memory footprint (36411)
The Possible Moves section much reduced as now only inversing squares instead of printing a "compass" - this also reduces the graphics files
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 _chasm2
214 .(
215 lda _deadcurset+0
216 sta tmp1+0
217 lda _deadcurset+1
218 sta tmp1+1
219 ldx #0
220 loop
221 lda _textchar ; load the char id no into accumulator
222 cmp #40 ; is it an ( - DEFENDER
223 beq chasmDEF
224 cmp #41 ; is it an ) - ATTACKER
225 beq chasmATT
226 cmp #65 ; is it an A?
227 beq chasmA
228 cmp #66 ; B?
229 beq chasmB
230 cmp #68 ; D?
231 beq chasmD
232 cmp #69 ; E?
233 beq chasmE
234 cmp #70 ; F?
235 beq chasmF
236 cmp #71 ; G?
237 beq chasmG
238 cmp #73 ; I?
239 beq chasmI
240 cmp #75 ; K?
241 beq chasmK
242 cmp #76 ; L?
243 beq chasmL
244 cmp #79 ; O?
245 beq chasmO
246 cmp #82 ; R?
247 beq chasmR
248 cmp #83 ; S?
249 beq chasmS
250 cmp #84 ; T?
251 beq chasmT
252 cmp #85 ; U?
253 beq chasmU
254 cmp #90 ; Z?
255 beq chasmZ
256 lda $9900,x ; else print a space
257 chasmx2
258 ldy #0
259 sta (tmp1),y
260 jsr _Add40
261 inx
262 cpx #7
263 bcc loop
264 rts
265 chasmDEF
266 lda $9940,x
267 jmp chasmx2
268 chasmATT
269 lda $9948,x
270 jmp chasmx2
271 chasmA
272 lda $9A08,x
273 jmp chasmx2
274 chasmB
275 lda $9A10,x
276 jmp chasmx2
277 chasmD
278 lda $9A20,x
279 jmp chasmx2
280 chasmE
281 lda $9A28,x
282 jmp chasmx2
283 chasmF
284 lda $9A30,x
285 jmp chasmx2
286 chasmG
287 lda $9A38,x
288 jmp chasmx2
289 chasmI
290 lda $9A48,x
291 jmp chasmx2
292 chasmK
293 lda $9A58,x
294 jmp chasmx2
295 chasmL
296 lda $9A60,x
297 jmp chasmx2
298 chasmO
299 lda $9A78,x
300 jmp chasmx2
301 chasmR
302 lda $9A90,x
303 jmp chasmx2
304 chasmS
305 lda $9A98,x
306 jmp chasmx2
307 chasmT
308 lda $9AA0,x
309 jmp chasmx2
310 chasmU
311 lda $9AA8,x
312 jmp chasmx2
313 chasmZ
314 lda $9AD0,x
315 jmp chasmx2
316 .)
317
318 ;_chasm3
319 ;.(
320 ; lda _deadcurset+0
321 ; sta tmp1+0
322 ; lda _deadcurset+1
323 ; sta tmp1+1
324 ; ldx #0
325 ;loop
326 ; lda _someint,x ; where someint represents say $9AD0 (for the char Z)
327 ; ldy #0
328 ; sta (tmp1),y
329 ; jsr _Add40
330 ; inx
331 ; cpx #7
332 ; bcc loop
333 ; rts
334 ;.)
335
336
337 _SetScreenAddress2
338 .(
339 ldx _cx
340 ldy _cy
341 jsr _SetScreenAddress
342 rts
343 .)
344
345 _tileloop
346 .(
347 lda _ptr_graph+0
348 sta tmp0+0
349 lda _ptr_graph+1
350 sta tmp0+1
351
352 ldx _col
353 ldy _row
354 jsr _SetScreenAddress
355
356 ; Draw loop
357 .(
358 ldx #18
359 loop
360 ldy #0
361 lda (tmp0),y
362 sta (tmp1),y
363 iny
364 lda (tmp0),y
365 sta (tmp1),y
366 iny
367 lda (tmp0),y
368 sta (tmp1),y
369
370 .(
371 clc
372 lda tmp0+0
373 adc #3
374 sta tmp0+0
375 bcc skip
376 inc tmp0+1
377 skip
378 .)
379
380 jsr _Add40
381
382 dex
383 bne loop
384 .)
385
386 ; Update ptr_graph (for animation purpose)
387 lda tmp0+0
388 sta _ptr_graph+0
389 lda tmp0+1
390 sta _ptr_graph+1
391
392 rts
393 .)
394
395
396 ;_eorMagicValueTable .byt 0,128,63,63+128
397 ;_eorMagicValue .byt 0
398 ;_eorMagicValueCounter .byt 3
399
400 ;_tileloop2
401 ;.(
402 ; ;inc _eorMagicValueCounter
403 ; lda #1
404 ; and #3
405 ; tax
406 ; lda _eorMagicValueTable,x
407 ; sta _eorMagicValue
408 ;
409 ; lda _ptr_graph+0
410 ; sta tmp0+0
411 ; lda _ptr_graph+1
412 ; sta tmp0+1
413 ;
414 ; ldx _col
415 ; ldy _row
416 ; jsr _SetScreenAddress
417 ;
418 ; ; Draw loop
419 ; .(
420 ; ldx #18
421 ;loop
422 ; ldy #0
423 ; lda (tmp0),y
424 ; eor _eorMagicValue
425 ; sta (tmp1),y
426 ; iny
427 ; lda (tmp0),y
428 ; eor _eorMagicValue
429 ; sta (tmp1),y
430 ; iny
431 ; lda (tmp0),y
432 ; eor _eorMagicValue
433 ; sta (tmp1),y
434 ; .(
435 ; clc
436 ; lda tmp0+0
437 ; adc #3
438 ; sta tmp0+0
439 ; bcc skip
440 ; inc tmp0+1
441 ;skip
442 ; .)
443 ; jsr _Add40
444 ; dex
445 ; bne loop
446 ; .)
447 ; Update ptr_graph (for animation purpose)
448 ; lda tmp0+0
449 ; sta _ptr_graph+0
450 ; lda tmp0+1
451 ; sta _ptr_graph+1
452 ; rts
453 ;.)
454
455
456 /*
457 void drawtile() // draws a board tile, player piece or "arrow"
458 {
459 startpos=tiletodraw*54; // 54=3*18 calc how many lines "down" in the graphic file to print from
460 ptr_graph+=startpos; // set start position in graphic file
461 tileloop();
462 }
463 */
464 _drawtile
465 .(
466 ; ptr_graph+=tiletodraw*54
467 .(
468 ldx _tiletodraw
469 loop
470 beq end
471 clc
472 lda _ptr_graph+0
473 adc #<54
474 sta _ptr_graph+0
475 bcc skip
476 inc _ptr_graph+1
477 skip
478 dex
479 jmp loop
480 end
481 .)
482
483 jmp _tileloop
484 .)
485
486
487
488 /*
489 void drawtiles() // DRAW ALL THE TILES ON THE BOARD
490 {
491 for (row=0;row<11;row++)
492 {
493 for (col=0;col<11;col++)
494 {
495 players[row][col]=tiles[row][col]; // populate players array
496 ptr_graph=PictureTiles; // pointer to Picture Tiles graphics
497 tiletodraw=tiles[row][col];
498 if ( tiletodraw==4 ) { tiletodraw=3;}
499 drawtile();
500 }
501 }
502 }
503 */
504 _drawtiles
505 .(
506 ldy #0
507
508 ldx #0
509 loop_row
510 stx _row
511
512 ldx #0
513 loop_col
514 stx _col
515
516 lda _tiles,y
517 sta _players,y
518 cmp #4
519 bne set_tile_to_draw
520 lda #3
521 set_tile_to_draw
522 sta _tiletodraw
523
524 lda #<_PictureTiles
525 sta _ptr_graph+0
526 lda #>_PictureTiles
527 sta _ptr_graph+1
528
529 tya
530 pha
531
532 jsr _drawtile
533
534 pla
535 tay
536 iny
537
538 ldx _col
539 inx
540 cpx #11
541 bne loop_col
542
543 ldx _row
544 inx
545 cpx #11
546 bne loop_row
547
548 rts
549 .)
550
551
552
553 ; Draw an inversed colr box to highlight selected box
554 ; _cx=screen x position
555 ; _cy=screen y position
556 _inverse
557 .(
558 ;ldx _cx
559 ;ldy _cy
560 ;jsr _SetScreenAddress
561 jsr _SetScreenAddress2
562 jsr _Add40
563 ;jsr _Add40
564
565 ; Draw loop
566 .(
567 ldx #17
568 loop
569 ldy #0
570 lda (tmp1),y
571 eor #%111111
572 eor #128
573 sta (tmp1),y
574 iny
575 lda (tmp1),y
576 eor #%111111
577 eor #128
578 sta (tmp1),y
579 iny
580 lda (tmp1),y
581 eor #%111111
582 eor #128
583 sta (tmp1),y
584
585 jsr _Add40
586
587 dex
588 bne loop
589 .)
590
591 rts
592 .)
593
594 _inverse2
595 .(
596 ;ldx _cx
597 ;ldy _cy
598 ;jsr _SetScreenAddress
599 jsr _SetScreenAddress2
600 jsr _Add40
601 ; Draw loop
602 .(
603 ldx #17
604 loop
605 ldy #0
606 lda (tmp1),y
607 eor #%111111
608 eor #128
609 eor #63
610 sta (tmp1),y
611 iny
612 lda (tmp1),y
613 eor #%111111
614 eor #128
615 eor #63
616 sta (tmp1),y
617 iny
618 lda (tmp1),y
619 eor #%111111
620 eor #128
621 eor #63
622 sta (tmp1),y
623
624 jsr _Add40
625
626 dex
627 bne loop
628 .)
629
630 rts
631 .)
632
633 ; _cx=x coordinate
634 ; _cy=y coordinate
635 ; _fb=0 -> Erase
636 ; _fb=1 -> Draw
637 ;_drawcursor
638 ;.(
639 ; ldx _cx
640 ; ldy _cy
641 ; jsr _SetScreenAddress
642 ;
643 ; jsr _Add40
644 ;
645 ; lda _fb
646 ; beq erase
647 ;
648 ;draw
649 ; .(
650 ; ; top line
651 ; ldy #0
652 ; lda #%101010
653 ; sta (tmp1),y
654 ; iny
655 ; sta (tmp1),y
656 ; iny
657 ; sta (tmp1),y
658 ;
659
660 ; Draw loop
661 ; .(
662 ; ldx #8
663 ;loop
664 ; jsr _Add40
665 ; ; draw
666 ; ldy #0
667 ; lda (tmp1),y
668 ; ora #%010000
669 ; sta (tmp1),y
670 ; iny
671 ; iny
672 ; lda (tmp1),y
673 ; ora #%000001
674 ; sta (tmp1),y
675 ; jsr _Add40
676 ; dex
677 ; bne loop
678 ; .)
679 ;
680 ; ; bottom line
681 ; ldy #0
682 ; lda #%101010
683 ; sta (tmp1),y
684 ; iny
685 ; sta (tmp1),y
686 ; iny
687 ; sta (tmp1),y
688 ;
689 ; rts
690 ; .)
691 ;erase
692 ; .(
693 ; ; top line
694 ; ldy #0
695 ; lda #%1000000
696 ; sta (tmp1),y
697 ; iny
698 ; ;lda #%1000000
699 ; sta (tmp1),y
700 ; iny
701 ; sta (tmp1),y
702 ;
703
704 ; ; Draw loop
705 ; .(
706 ; ldx #8
707 ;loop
708 ; jsr _Add40
709 ;
710 ; draw
711 ; ldy #0
712 ; lda (tmp1),y
713 ; and #%11111111
714 ; sta (tmp1),y
715 ; iny
716 ; lda (tmp1),y
717 ; sta (tmp1),y
718 ; iny
719 ; lda (tmp1),y
720 ; and #%11111110
721 ; sta (tmp1),y
722 ;
723 ; jsr _Add40
724 ;
725 ; dex
726 ; bne loop
727 ; .)
728
729 ; bottom line
730 ; ldy #0
731 ; lda #%1000000
732 ; sta (tmp1),y
733 ; iny
734 ; ;lda #%1000000
735 ; sta (tmp1),y
736 ; iny
737 ; sta (tmp1),y
738
739 ; rts
740 ; .)
741 ;.)
742
743

  ViewVC Help
Powered by ViewVC 1.1.26