/[projet1]/users/twilighte/Stormlord/Frontend.s
Defence Force logotype

Contents of /users/twilighte/Stormlord/Frontend.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 412 - (show annotations)
Thu Oct 7 20:50:23 2010 UTC (8 years, 3 months ago) by dbug
File size: 16692 byte(s)
Added Stormlord
1 ;Frontend.s
2 #define TAB1 1
3 #define TAB2 2
4 #define TAB3 3
5 #define TAB4 4
6 #define TAB5 5
7 #define TAB6 6
8 #define TAB7 7
9 #define TAB8 8
10 #define TAB9 9
11 #define TAB10 10
12 #define TAB11 11
13 #define TAB12 12
14 #define TAB13 13
15 #define TAB14 14
16 #define TAB15 15
17 #define TAB16 16
18 #define TAB17 17
19 #define TAB18 18
20 #define TAB19 19
21 #define TAB20 20
22 #define TAB21 21
23 #define TAB22 22
24 #define TAB23 23
25 #define TAB24 24
26 #define TAB25 25
27 #define TAB26 26
28 #define TAB27 27
29 #define TAB28 28
30 #define TAB29 29
31 #define TAB30 30
32 #define TAB31 31
33 #define ENDOFROW 128
34 #define ENDOFTEXT 0
35
36 FrontEnd
37 ;Start by using level 2 (classic) for display
38 ldx #MAP_LEVEL2
39 jsr UnpackData
40
41 lda #FRONTEND_TITLE
42 sta CurrentDisplay
43 lda #10
44 sta InactivityCountdown
45 lda #00
46 sta usm_SunMoonYPos
47 lda #25
48 sta SecondCounter
49 lda #17
50 sta MapX
51 .(
52 jsr DrawMap ;And pop bgbuff
53 ldx #OVERLAY_TITLE
54 jsr DisplayOverlay
55
56
57 loop1 lda KeyRegister
58 bne loop1
59 ;Add inactivity timer
60 lda #200
61 sta ProgrammableCountdown
62 loop2 ;Strobe inactivity
63 lda ProgrammableCountdown
64 bne skip7
65 ; ProgrammableCountdown is not enough, so use additional counter
66 lda #200
67 sta ProgrammableCountdown
68 dec InactivityCountdown
69 beq InactivityTimeout
70 skip7 lda KeyRegister
71 beq loop2
72
73 ldx CurrentDisplay
74 cpx #FRONTEND_OPTIONS
75 bne skip2
76
77 cmp #CTRL_UP
78 bne skip3
79 ;Up pressed
80 lda MenuOptionsY
81 beq loop1
82 jsr DeleteOptionHearts
83 dec MenuOptionsY
84 jmp skip4
85 skip3 cmp #CTRL_DOWN
86 bne skip5
87 ;Down pressed
88 lda MenuOptionsY
89 cmp #4
90 bcs loop1
91 jsr DeleteOptionHearts
92 inc MenuOptionsY
93 jmp skip4
94 skip5 cmp #CTRL_LEFT
95 bne skip6
96 jsr DecOption
97 jmp skip1
98 skip6 cmp #CTRL_RIGHT
99 bne skip2
100 jsr IncOption
101 jmp skip1
102 skip2 ;Check for fire
103 cmp #CTRL_FIRE
104
105 bne skip8
106 rts
107 skip8 cmp #CTRL_FIRE2
108 beq Switch2Title
109 skip1 ;Assume options required
110 lda #FRONTEND_OPTIONS
111 sta CurrentDisplay
112 loop3 lda KeyRegister
113 bne loop3
114 jsr ClearScreen
115 ldx #OVERLAY_OPTIONS
116 jsr DisplayOverlay
117 jsr DisplayOptionHearts
118 jmp loop1
119
120 skip4 jsr DisplayOptionHearts
121 jmp loop1
122 InactivityTimeout
123 ;On timeout
124 ; Title(0) - Stuff(2)
125 ; Options(1) - Title(0)
126 ; Stuff(2) - Title(0)
127 lda #10
128 sta InactivityCountdown
129 lda CurrentDisplay
130 beq Switch2Stuff
131 Switch2Title
132 jmp FrontEnd
133 Switch2Stuff
134 lda #FRONTEND_STUFF
135 sta CurrentDisplay
136 jsr DrawMap ;And pop bgbuff
137 ldx #OVERLAY_STUFF
138 jsr DisplayOverlay
139 jsr DisplayHighscore
140 jmp loop1
141 .)
142
143 DeleteOptionHearts
144 lda #2
145 clc
146 adc MenuOptionsY
147 tax
148 lda #">"
149 ldy #0
150 jsr PlotCharAtXY
151 ldy #27
152 lda #">"
153 jmp PlotCharAtXY
154
155
156
157 DisplayOptionHearts
158 lda MenuOptionsY ;0-3
159 clc
160 adc #2
161 tax
162 lda #":"
163 ldy #0
164 jsr PlotCharAtXY
165 lda #":"
166 ldy #27
167 jmp PlotCharAtXY
168
169 DecOption ldy MenuOptionsY
170 lda OptionValue,y
171 sec
172 sbc #01
173 .(
174 bpl skip1
175 lda OptionRange,y
176 skip1 sta OptionValue,y
177 .)
178 jmp StoreOption
179
180
181 IncOption ldy MenuOptionsY
182 lda OptionValue,y
183 clc
184 adc #01
185 cmp OptionRange,y
186 .(
187 beq skip1
188 bcc skip1
189 lda #00
190 skip1 sta OptionValue,y
191 .)
192 jmp StoreOption
193
194
195
196 StoreOption
197 cpy #1
198 bcc PlotOption1
199 beq PlotOption2
200 cpy #3
201 bcc PlotOption3
202 beq PlotOption4
203 jmp PlotOption5
204
205 PlotOption1
206 lda OptionValue
207 asl
208 asl
209 tay
210 ldx #3
211 .(
212 loop1 lda Option1Texts,y
213 sta TextOverlay_SoundOption,x
214 iny
215 dex
216 bpl loop1
217 .)
218 rts
219
220 Option1Texts
221 .byt "L"+128,"LUF"
222 .byt "T"+128,"FOS"
223 .byt " "+128,"FFO"
224
225 PlotOption2
226 lda OptionValue+1
227 asl
228 asl
229 adc OptionValue+1
230 tay
231 ldx #4
232 .(
233 loop1 lda Option2Texts,y
234 sta TextOverlay_IngameOption,x
235 iny
236 dex
237 bpl loop1
238 .)
239 rts
240
241 Option2Texts
242 .byt "C"+128,"ISUM"
243 .byt " "+128," XFS"
244
245 PlotOption3
246 lda OptionValue+2
247 asl
248 asl
249 asl
250 tay
251 ldx #7
252 .(
253 loop1 lda Option3Texts,y
254 sta TextOverlay_InputOption,x
255 iny
256 dex
257 bpl loop1
258 .)
259 rts
260
261 Option3Texts
262 .byt "D"+128,"RAOBYEK"
263 .byt "Y"+128,"OJ KJI"
264 .byt "Y"+128,"OJ ESAP"
265 .byt "Y"+128,"OJ ELET"
266
267 PlotOption4
268 lda OptionValue+3
269 asl
270 .(
271 sta vector1+1
272 asl
273 asl
274 vector1 adc #00
275 .)
276 tay
277 ldx #9
278 .(
279 loop1 lda Option4Texts,y
280 sta TextOverlay_ScreenOption,x
281 iny
282 dex
283 bpl loop1
284 .)
285 rts
286
287 Option4Texts
288 .byt " "+128," RUOLOC"
289 .byt "E"+128,"MORHCONOM"
290
291 PlotOption5
292 lda Option_Difficulty
293 asl
294 .(
295 sta vector1+1
296 asl
297 vector1 adc #00
298 .)
299 tay
300 ldx #5
301 .(
302 loop1 lda Option5Texts,y
303 sta TextOverlay_DifficultyOption,x
304 iny
305 dex
306 bpl loop1
307 .)
308 rts
309 Option5Texts
310 .byt "E"+128,"CIVON"
311 .byt "L"+128,"AMRON"
312 .byt "E"+128,"NASNI"
313
314
315
316 OverlayTextScreenylocl
317 .byt <$A006+480*3
318 .byt <$A006+480*4
319 .byt <$A006+480*5
320 .byt <$A006+480*6
321 .byt <$A006+480*7
322 .byt <$A006+480*8
323 .byt <$A006+480*9
324 .byt <$A006+480*10
325 .byt <$A006+480*11
326 .byt <$A006+480*12
327 .byt <$A006+480*13
328 .byt <$A006+480*14
329 .byt <$A002+40*138 ;12
330 OverlayTextScreenyloch
331 .byt >$A006+480*3
332 .byt >$A006+480*4
333 .byt >$A006+480*5
334 .byt >$A006+480*6
335 .byt >$A006+480*7
336 .byt >$A006+480*8
337 .byt >$A006+480*9
338 .byt >$A006+480*10
339 .byt >$A006+480*11
340 .byt >$A006+480*12
341 .byt >$A006+480*13
342 .byt >$A006+480*14
343 .byt >$A002+40*138
344
345
346 CursorX .byt 0
347 CursorY .byt 0
348 TextIndex .byt 0
349 EndOfRowFlag .byt 0
350
351 DisplayOverlay
352 lda TextOverlay_VectorLo,x
353 sta text
354 lda TextOverlay_VectorHi,x
355 sta text+1
356
357 lda #00
358 sta CursorX
359 sta CursorY
360 sta TextIndex
361 .(
362 loop1 ;Fetch next character
363 ldy TextIndex
364 lda (text),y
365 ;End of Text?
366 beq EndOfText
367
368 ;Save Bit7
369 cmp #128
370 ror EndOfRowFlag
371
372 ;End of Row?
373 and #127
374 beq EndOfRow
375
376 ;Space?
377 cmp #32
378 beq DoSpace
379
380 ;Tab?
381 bcc DoTab
382
383 ;Plot Character
384 ldy CursorX
385 ldx CursorY
386 jsr PlotCharAtXY
387 DoSpace lda EndOfRowFlag
388 bmi EndOfRow
389 inc CursorX
390 inc TextIndex
391 jmp loop1
392 EndOfRow lda #00
393 sta CursorX
394 inc CursorY
395 jmp DoTab2
396 DoTab adc CursorX
397 sta CursorX
398 DoTab2 inc TextIndex
399 jmp loop1
400 EndOfText rts
401 .)
402
403 TextOverlay_VectorLo
404 .byt <TextOverlay_Title ;0
405 .byt <TextOverlay_redefine ;1
406 .byt <TextOverlay_Options ;2
407 .byt <TextOverlay_Stuff ;3
408 .byt <TextOverlay_HighScoreEntry ;4
409 .byt <TextOverlay_Timeout ;5
410 .byt <TextOverlay_Gameover ;6
411 .byt <TextOverlay_LevelIntro1 ;7
412 .byt <TextOverlay_LevelIntro2 ;8
413 .byt <TextOverlay_LevelIntro3 ;9
414 .byt <TextOverlay_GameCompleted ;10
415 TextOverlay_VectorHi
416 .byt >TextOverlay_Title
417 .byt >TextOverlay_redefine
418 .byt >TextOverlay_Options
419 .byt >TextOverlay_Stuff
420 .byt >TextOverlay_HighScoreEntry
421 .byt >TextOverlay_Timeout
422 .byt >TextOverlay_Gameover
423 .byt >TextOverlay_LevelIntro1
424 .byt >TextOverlay_LevelIntro2
425 .byt >TextOverlay_LevelIntro3
426 .byt >TextOverlay_GameCompleted
427
428 ;0 End of text
429 ;1-31 Tab(1 to 31)
430 ;32 Space (but not plotted)
431 ;58 : Heart
432 ;59 ; Separator
433 ;60 < Back Symbol
434 ;61 = Return Symbol
435 ;62 > Real Space
436 ;63 ? Question Mark
437 ;64 @ Exclamation Mark
438 ;65-80 Characters
439 ;+128 Last character of row
440 ;128 Last character of row
441 TextOverlay_Timeout
442 .byt ENDOFROW
443 .byt ENDOFROW
444 .byt ENDOFROW
445 .byt TAB8,"OUT OF TIM","E"+128
446 .byt ENDOFTEXT
447 TextOverlay_Gameover
448 .byt ENDOFROW
449 .byt ENDOFROW
450 .byt ENDOFROW
451 .byt TAB7,"GAME OVE","R"+128
452 .byt ENDOFTEXT
453 TextOverlay_LevelIntro1
454 .byt ENDOFROW
455 .byt ENDOFROW
456 .byt ENDOFROW
457 .byt TAB1,"LEVEL ONE ; UNDERWURLD","E"+128
458 .byt ENDOFTEXT
459 TextOverlay_LevelIntro2
460 .byt ENDOFROW
461 .byt ENDOFROW
462 .byt ENDOFROW
463 .byt TAB2,"LEVEL TWO ; TOP SID","E"+128
464 .byt ENDOFTEXT
465 TextOverlay_LevelIntro3
466 .byt ENDOFROW
467 .byt ENDOFROW
468 .byt ENDOFROW
469 .byt TAB1,"LEVEL THREE ; CLOUD SCAP","E"+128
470 .byt ENDOFTEXT
471 TextOverlay_Options
472 .byt TAB9,"GAME OPTION","S"+128
473 .byt ENDOFROW
474 .byt TAB6,"SOUND ; "
475 TextOverlay_SoundOption
476 .byt "FUL","L"+128 ;Full/Soft/Off
477 .byt TAB6,"IN GAME ; "
478 TextOverlay_IngameOption
479 .byt "MUSI","C"+128 ;SFX/MUSIC
480 .byt TAB6,"INPUT ; "
481 TextOverlay_InputOption
482 .byt "KEYBOAR","D"+128 ;IJK/PASE/KEYBOARD/TELESTRAT
483 .byt TAB6,"SCREEN ; "
484 TextOverlay_ScreenOption
485 .byt "COLOUR "," "+128 ;COLOUR/MONOCHROME
486 .byt TAB2,"DIFFICULTY ; "
487 TextOverlay_DifficultyOption
488 .byt "NORMA","L"+128
489 .byt "MOVE TO MODIFY OR FIRE TO PLA","Y"+128
490 .byt ENDOFTEXT
491
492 TextOverlay_GameCompleted
493 .byt TAB6,"S T O R M L O R ","D"+128
494 .byt ENDOFROW
495 .byt TAB4,"WELL DONE STORMLORD@@"
496 .byt ENDOFROW
497 .byt "YOU HAVE FREED ALL THE FAIRIE","S"+128
498 .byt TAB4,"AND SAVED THE KINGDOM","@"+128
499 .byt ENDOFTEXT
500
501 TextOverlay_Title
502 .byt TAB4,"TWILIGHTE PRESENT","S"+128
503 .byt TAB5,"S T O R M L O R ","D"+128
504 .byt ENDOFROW
505 .byt TAB6,"ORIGINAL GAME B","Y"+128
506 .byt TAB7,"RAFFAELE CECC","O"+128
507 .byt ENDOFROW
508 .byt TAB6,"MOVE FOR OPTION","S"+128
509 .byt TAB5,"PRESS FIRE TO STAR","T"+128
510 .byt ENDOFTEXT
511 TextOverlay_redefine
512 ; .byt TAB5,"STORMLORD KEYS ARE",0
513 ; .byt TAB8,"LEFT",TAB4,33+128
514 ; .byt TAB8,"RIGHT",TAB3,34+128
515 ; .byt TAB8,"JUMP",TAB4,35+128
516 ; .byt TAB8,"FIRE",TAB4,36+128
517 ; .byt TAB8,"RESTART",TAB1,37+128
518 ; .byt TAB2,"REDEFINE KEYS YES NO","?"+128
519 ; .byt ENDOFTEXT
520 TextOverlay_Stuff ;For Symoon, credits, Highscore
521 .byt TAB5,"S>T>O>R>M>L>O>R>","D"+128
522 .byt TAB8,"FOR SYMOO","N"+128
523 .byt ENDOFROW
524 .byt TAB10,"TESTER","S"+128
525 .byt TAB3,"CHEMA;DBUG;SYMOON;YAN","N"+128
526 .byt TAB10,"IBISU","M"+128
527 .byt "HISCORE TODAY ;;;;; BY "
528 HiscoreEntryText
529 .byt ";;;;",";"+128
530 .byt ENDOFTEXT
531
532 TextOverlay_HighScoreEntry
533 .byt "NEW HISCORE;CONGRATULATIONS","@"+128
534 .byt "PLEASE GRACE YOUR NAME BELO","W"+128
535 .byt ENDOFROW
536 .byt "A B C D E F G H I ","J"+128
537 .byt ENDOFROW
538 .byt "K L M N O P Q R S ","T"+128
539 .byt ENDOFROW
540 .byt "U V W X Y Z : @ < ","="+128
541 .byt TAB12,";;;;;"," "+128
542 .byt ENDOFTEXT
543
544 HiscoreLocationsLo ;Indexed by letter 0-29
545 .byt <$A000+5+69*40
546 .byt <$A000+8+69*40
547 .byt <$A000+11+69*40
548 .byt <$A000+14+69*40
549 .byt <$A000+17+69*40
550 .byt <$A000+20+69*40
551 .byt <$A000+23+69*40
552 .byt <$A000+26+69*40
553 .byt <$A000+29+69*40
554 .byt <$A000+32+69*40
555
556 .byt <$A000+5+93*40
557 .byt <$A000+8+93*40
558 .byt <$A000+11+93*40
559 .byt <$A000+14+93*40
560 .byt <$A000+17+93*40
561 .byt <$A000+20+93*40
562 .byt <$A000+23+93*40
563 .byt <$A000+26+93*40
564 .byt <$A000+29+93*40
565 .byt <$A000+32+93*40
566
567 .byt <$A000+5+117*40
568 .byt <$A000+8+117*40
569 .byt <$A000+11+117*40
570 .byt <$A000+14+117*40
571 .byt <$A000+17+117*40
572 .byt <$A000+20+117*40
573 .byt <$A000+23+117*40
574 .byt <$A000+26+117*40
575 .byt <$A000+29+117*40
576 .byt <$A000+32+117*40
577 HiscoreLocationsHi ;Indexed by letter 0-29
578 .byt >$A000+5+69*40
579 .byt >$A000+8+69*40
580 .byt >$A000+11+69*40
581 .byt >$A000+14+69*40
582 .byt >$A000+17+69*40
583 .byt >$A000+20+69*40
584 .byt >$A000+23+69*40
585 .byt >$A000+26+69*40
586 .byt >$A000+29+69*40
587 .byt >$A000+32+69*40
588
589 .byt >$A000+5+93*40
590 .byt >$A000+8+93*40
591 .byt >$A000+11+93*40
592 .byt >$A000+14+93*40
593 .byt >$A000+17+93*40
594 .byt >$A000+20+93*40
595 .byt >$A000+23+93*40
596 .byt >$A000+26+93*40
597 .byt >$A000+29+93*40
598 .byt >$A000+32+93*40
599
600 .byt >$A000+5+117*40
601 .byt >$A000+8+117*40
602 .byt >$A000+11+117*40
603 .byt >$A000+14+117*40
604 .byt >$A000+17+117*40
605 .byt >$A000+20+117*40
606 .byt >$A000+23+117*40
607 .byt >$A000+26+117*40
608 .byt >$A000+29+117*40
609 .byt >$A000+32+117*40
610
611 HiscoreHighlight
612 .byt $F4,$C0,$CB
613 HiscoreCursorX .byt 0
614 HiscoreCursorY .byt 0
615
616
617 CheckHiscore
618 ;Check score against Hiscore and branch to entry system if more
619 sed
620 ldx #0
621 .(
622 loop1 lda HeroScore,x
623 cmp HighScore,x
624 bcc NoHighscore
625 bne NewHighscore
626 inx
627 cpx #3
628 bcc loop1
629 .)
630 NoHighscore
631 cld
632 rts
633 NewHighscore
634 cld
635 ldx #2
636 .(
637 loop1 lda HeroScore,x
638 sta HighScore,x
639 dex
640 bpl loop1
641 .)
642 jsr ClearScreen
643 ldx #OVERLAY_HISCOREENTRY
644 jsr DisplayOverlay
645
646 HiscoreEntry
647 ldx #4
648 lda #";"
649 .(
650 loop1 sta HighscoreText,x
651 dex
652 bpl loop1
653 .)
654 lda #00
655 sta TextCursor
656 .(
657 loop2 jsr PlotHiscoreHighlight
658
659 loop1 lda KeyRegister
660 bne loop1
661 loop3 lda KeyRegister
662 beq loop3
663
664 jsr DeleteHiscoreHighlight
665 lda KeyRegister
666 cmp #CTRL_LEFT
667 bne skip1
668 ;Left
669 lda HiscoreCursorX
670 beq skip9
671 dec HiscoreCursorX
672 jmp skip9
673 skip1 cmp #CTRL_RIGHT
674 bne skip2
675 ;Right
676 lda HiscoreCursorX
677 cmp #9
678 beq skip9
679 inc HiscoreCursorX
680 jmp skip9
681 skip2 cmp #CTRL_UP
682 bne skip3
683 ;Up
684 lda HiscoreCursorY
685 beq skip9
686 dec HiscoreCursorY
687 jmp skip9
688 skip3 cmp #CTRL_DOWN
689 bne skip4
690 ;Down
691 lda HiscoreCursorY
692 cmp #2
693 beq skip9
694 inc HiscoreCursorY
695 jmp skip9
696 skip4 cmp #CTRL_FIRE
697 bne skip9
698 ;Fire
699 jsr EnterCharacter
700 skip9 jmp loop2
701 .)
702
703 EnterCharacter
704 ;Convert Cursor to character
705 lda HiscoreCursorY
706 asl
707 .(
708 sta vector1+1
709 asl
710 asl
711 vector1 adc #00
712 .)
713 adc HiscoreCursorX
714 tax
715 lda Cursor2Character,x
716 ;Was Delete selected?
717 beq hsDelete
718 ;Was Return selected?
719 bmi hsReturn
720
721 ldx TextCursor
722 cpx #5
723 .(
724 beq skip1
725
726 ;plot character
727 sta vector2+1
728 lda TextCursor
729 clc
730 adc #12
731 tay
732 ldx #8
733 vector2 lda #00
734 jsr PlotCharAtXY
735 ldy TextCursor
736 lda vector2+1
737 sta HighscoreText,y
738 skip1 ;The cursor can move to a 6th character even though only 5 can be entered
739 .)
740 cpy #5
741 .(
742 bcs skip1
743 inc TextCursor
744 skip1 rts
745 .)
746
747 hsDelete
748 lda TextCursor
749 .(
750 beq skip1
751 dec TextCursor
752 lda TextCursor
753 skip1 clc
754 .)
755 adc #12
756 tay
757 ldx #8
758 lda #";"
759 jsr PlotCharAtXY
760 ldy TextCursor
761 lda #";"
762 sta HighscoreText,y
763 rts
764
765 hsReturn ;Transfer text to Stuff overlay screen
766 ldx #4
767 .(
768 loop1 lda HighscoreText,x
769 sta HiscoreEntryText,x
770 dex
771 bpl loop1
772 .)
773 ;Clear 4 rows below play area (Entered name overlaps)
774 ldx #159
775 lda #64
776 .(
777 loop1 sta $9FFF+40*138,x
778 dex
779 bne loop1
780 .)
781 ;Return to HiscoreEntry Caller
782 pla
783 pla
784 rts
785
786 Cursor2Character
787 .byt "ABCDEFGHIJKLMNOPQRSTUVWXYZ:@",0,128
788 HighscoreText
789 .dsb 6,";" ;6 but only first 5 are stored to
790 CheatCode1
791 .byt "ARE YOU TRYING TO FIND THE CHEAT?"
792
793 PlotHiscoreHighlight
794 lda HiscoreCursorY
795 ;x10
796 asl
797 .(
798 sta vector1+1
799 asl
800 asl
801 vector1 adc #00
802 .)
803 adc HiscoreCursorX
804 tax
805 lda HiscoreLocationsLo,x
806 sta screen
807 clc
808 adc #<40*14
809 sta screen2
810 lda HiscoreLocationsHi,x
811 sta screen+1
812 adc #>40*14
813 sta screen2+1
814 ldy #2
815 .(
816 loop1 lda HiscoreHighlight,y
817 sta (screen),y
818 sta (screen2),y
819 dey
820 bpl loop1
821 .)
822 rts
823
824 DeleteHiscoreHighlight
825 ldy #2
826 lda #64
827 .(
828 loop1 sta (screen),y
829 sta (screen2),y
830 dey
831 bpl loop1
832 .)
833 rts
834
835 ;A Character(58-90)
836 ;X Xpos(0-26)
837 ;Y Ypos(0-15)
838 PlotCharAtXY
839 ;Reserve AXY
840 sta ReservedA+1
841 stx ReservedX+1
842 sty ReservedY+1
843
844 ;Fetch Char Address
845 ldx ReservedA+1
846 lda CharacterAddressLo-58,x
847 sta char
848 lda CharacterAddressHi-58,x
849 sta char+1
850
851 ;Transfer Char definition to centre 12 byte buffer
852 ldy #9
853 .(
854 loop1 lda (char),y
855 sta CharBuffer+1,y
856 dey
857 bpl loop1
858 .)
859 ;Calculate location 1 pixel above char
860 ldy ReservedX+1
861 lda ReservedY+1
862 clc
863 adc OverlayTextScreenylocl,y
864 sta screen
865 lda OverlayTextScreenyloch,y
866 adc #00
867 sta screen+1
868
869 lda screen
870 sec
871 sbc #40
872 sta screen
873 lda screen+1
874 sbc #00
875 sta screen+1
876
877 ;Branch on plotting real space
878 ldy #00
879 ldx #00
880 lda ReservedA+1
881 cmp #">"
882 .(
883 bne skip3
884 loop2 lda #64
885 sta (screen),y
886 jsr nlScreen
887 inx
888 cpx #12
889 bcc loop2
890 jmp skip4
891
892 skip3 ;Fetch Background location
893 loop1 lda (screen),y
894 bpl skip1
895 ;Background is inverse
896 ;Is it even or odd row?
897 ldy EvenRowFlag,x
898 beq skip5
899 lda #$40
900 ldy #00
901 jmp skip1
902 ;however only attempt mask if blue(odd) otherwise delete(even lines)
903 skip5 eor #128+63
904 and CharMask,x
905 ora CharBuffer,x
906 eor #63+128
907 jmp skip2
908 skip1 ;Background is normal
909 and CharMask,x
910 ora CharBuffer,x
911 skip2 sta (screen),y
912 jsr nlScreen
913 inx
914 cpx #12
915 bcc loop1
916 skip4
917 .)
918 ReservedA lda #00
919 ReservedX ldx #00
920 ReservedY ldy #00
921 rts
922 EvenRowFlag ;Cyan 0
923 .byt 0,1,0,1,0,1,0,1,0,1,0,1
924 CharMask
925 .byt %11100001
926 .byt %11000000
927 .byt %11000000
928 .byt %11000000
929 .byt %11000000
930 .byt %11000000
931 .byt %11000000
932 .byt %11000000
933 .byt %11000000
934 .byt %11000000
935 .byt %11000000
936 .byt %11100001
937 CharBuffer
938 .dsb 12,64
939
940 EscMenu
941 ;Display Menu in middle border
942 ;"esc to quit or fire to restart level"
943 ldx #35
944 .(
945 loop1 lda EscText,x
946 pha
947 stx EscTemp
948 txa
949 tay
950 ldx #12
951 pla
952 jsr PlotCharAtXY
953 ldx EscTemp
954 dex
955 bpl loop1
956 .)
957 lda #<$A001+40*138
958 sta screen
959 lda #>$A001+40*138
960 sta screen+1
961 ldy #00
962 ldx #10
963 .(
964 loop1 lda #3
965 sta (screen),y
966 jsr nlScreen
967 dex
968 bne loop1
969 .)
970 .(
971 loop1 lda KeyRegister
972 bne loop1
973 loop2 lda KeyRegister
974 and #32+64
975 beq loop2
976 .)
977 cmp #CTRL_FIRE2
978 php
979 jsr ClearScreen
980 plp
981 rts
982
983 EscTemp .byt 0
984 EscText
985 .byt "ESC>TO>QUIT>OR>FIRE>TO>RESTART>LEVEL"
986
987
988
989

  ViewVC Help
Powered by ViewVC 1.1.26