/[projet1]/users/mmu_man/demos/oric/treize/fscroller.s
Defence Force logotype

Contents of /users/mmu_man/demos/oric/treize/fscroller.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1525 - (show annotations)
Sun Jun 30 01:08:33 2019 UTC (9 months ago) by mmu_man
File size: 15505 byte(s)
treize: fix date in text, thanks strider for noticing!

1 // scrolling inside the font buffer itself
2 #define ENABLE_MUSIC
3 //#define DEBUG
4 //#define DEBUG_FONT
5
6 #include "script.h"
7
8 #define via_portb $0300
9 #define via_t1cl $0304
10 #define via_t1ch $0305
11 #define via_t1ll $0306
12 #define via_t1lh $0307
13 #define via_t2ll $0308
14 #define via_t2ch $0309
15 #define via_sr $030A
16 #define via_acr $030b
17 #define via_pcr $030c
18 #define via_ifr $030D
19 #define via_ier $030E
20 #define via_porta $030f
21
22 ; paper+ink+dblheight on left, looks better symetrical
23 ; code requires 32 max width (due to 8bit wrapping)
24 #define SCROLLER_MAX_X 40-8
25
26 //#define SCROLLER_START_ADDR $a000+SCROLLER_OFFSET
27 // 0x9C00+33*8
28 #define SCROLLER_START_ADDR 39936+33*8
29
30
31 #define BOING_MIN_ADDR $a000+40*15*8
32 //#define BOING_MIN_ADDR $a000+40*40*8
33 #define BOING_START_ADDR $a000+40*16*8
34
35 .zero
36
37 _VblCounter .dsb 1
38
39 _SavedIRQ .dsb 2
40
41 _SystemFrameCounter
42 _SystemFrameCounter_low .dsb 1
43 _SystemFrameCounter_high .dsb 1
44
45 _ScrollerAddrBase
46 _ScrollerAddrBase_low .dsb 1
47 _ScrollerAddrBase_high .dsb 1
48
49 _MessageScrollerPtr .dsb 2
50
51 _ScrollerCommand .dsb 1
52 _ScrollerCommandParam1 .dsb 1
53 _ScrollerCommandParam2 .dsb 1
54 _ScrollerCommandParam3 .dsb 1
55 _ScrollerCommandParam4 .dsb 1
56
57 _ScrollerScreenDir .dsb 1
58 _BoingPhase .dsb 1
59
60 .text
61
62 _BottomDesc
63 .asc "Le salon de la (re)creation numerique", 0
64
65 _BottomDates
66 .asc " du 1 au 3 Novembre 2019 ", 0
67
68 _BottomPlace
69 .asc " a Tain l'Hermitage ", 0
70
71 _BottomWWW
72 .asc " triplea.fr/alchimie ", 0
73
74 _BottomRDV
75 .asc " Rendez-vous a l'Alchimie 13! ", 0
76
77 _MessageScroller
78 .byt SCROLLER_SHOW_SCROLL
79 // .asc " !'#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ abcdefghijklmnopqrstuvwxyz{|} "
80 // .asc " A little invitro... "
81 #ifndef DEBUG
82 .asc " "
83 .asc " Happy 20th Birthday VIP!!! "
84 //.byt SCROLLER_SCREEN_UP
85 //;; .byt SCROLLER_START_JSUN
86 ; .asc " "
87 #endif
88
89 #ifndef DEBUG
90 //; .asc " "
91 // .asc " It is always a pleasure to join"
92 .asc " Traditions... traditions... "
93 .asc " "
94 .asc " Once again we gather around to code... "
95 .asc " discuss... and have fun at"
96 .asc " the Very Important Party! "
97 .asc " "
98 .asc " We love you! "
99 .asc " "
100 //.byt SCROLLER_SCROLL_SCROLL
101 .asc " | We would like to invite you to... "
102 #endif
103 .byt SCROLLER_SHOW_LOGOA13
104
105 ; .asc " "
106 .asc " Alchimie Treize ! "
107 .byt SCROLLER_BOTTOM_TEXT
108 .word _BottomDesc
109 //.byt SCROLLER_SCREEN_UP
110
111 .asc " Le salon de la (re)creation numerique ! "
112 .byt SCROLLER_BOTTOM_TEXT
113 .word _BottomDates
114 .asc " du 1 au 3 Novembre 2019 "
115 .byt SCROLLER_BOTTOM_TEXT
116 .word _BottomPlace
117 .asc " a Tain l'Hermitage "
118 #ifndef DEBUG
119 .asc " triplea.fr/alchimie "
120 .byt SCROLLER_BOTTOM_TEXT
121 .word _BottomWWW
122 .asc "(demoparty) (conferences) (oldschool) (robotique) (retrogames) "
123 /*
124 .asc " Pas de DemoParty cette annee, "
125 .asc " mais une AmigaBouffe grand format ! "
126 .asc " du 20 au 21 octobre 2018 "
127 .asc " a Clerieux "
128 .asc " triplea.fr/microalchimie "
129 */
130 #endif
131 //.byt SCROLLER_SCROLL_SCROLL
132 #ifndef DEBUG
133 .asc " "
134 .byt SCROLLER_BOTTOM_TEXT
135 .word _BottomDesc
136 .asc " | This invitro was inspired by code "
137 //.byt SCROLLER_SCREEN_UP
138 .asc "and other works by _Dbug_ (Defence Force)... "
139 #endif
140 // .asc " | This time we did a 3-screenful HIRES scrolling "
141 //.byt SCROLLER_SCREEN_UP
142 // .asc " plus a scrolltext on the bottom text lines using the font RAM."
143 #ifndef DEBUG
144 // .asc " | VIP logo converted from the VIP original."
145 #endif
146 // .byt SCROLLER_SCREEN_UP
147 //.byt SCROLLER_START_BOING
148 .asc " | code: mmu_man/TripleA"
149 // .byt SCROLLER_SCREEN_UP
150 #ifndef DEBUG
151 .asc " | gfx: Cicile/TripleA"
152 .asc " | music: Fabounio/TripleA"
153 .byt SCROLLER_BOTTOM_TEXT
154 .word _BottomDates
155 // .asc " | music: David Whittaker. "
156 //;; .byt SCROLLER_SHOW_LOGOUA3
157 #endif
158 //.byt SCROLLER_START_BOING
159 .asc " "
160 // .asc "L'Alchimie ca poutre !!!! "
161 // .asc "La Micro Alchimie ca poutre !!!! "
162 //.byt SCROLLER_SCREEN_UP
163 .asc " "
164 .asc " "
165 .asc "Greetingz:"
166 #ifndef DEBUG
167 .asc " GGRO"
168 .asc " | _Dbug_ / Defence Force"
169 .asc " | PoPsY TeAm"
170 .asc " | X-Men"
171 .asc " | MPS"
172 .asc " | MJJ Prod"
173 .asc " | Laboratoire D"
174 .asc " | G2L2 Corp"
175 .byt SCROLLER_BOTTOM_TEXT
176 .word _BottomPlace
177 .asc " | SWYNG"
178 .asc " | PAULA POWERED"
179 .asc " | Logon System"
180 .asc " | Sector One"
181 .asc " | New Order"
182 .asc " | Dark Force"
183 .asc " | Cerebral Vortex"
184 .asc " | Cocoon"
185 .asc " | Replicants"
186 .asc " | Map"
187 .asc " | Woootz"
188 .byt SCROLLER_BOTTOM_TEXT
189 .word _BottomWWW
190 .asc " | Cosmosaure"
191 .asc " | SFX"
192 .asc " | Atari Legend"
193 .asc " | Eclipse"
194 .asc " | Froggy Corp."
195 .asc " | Team Unicorn"
196 .asc " | SQNY"
197 .asc " | Paradize"
198 .asc " | Calodox"
199 .asc " | ELITE"
200 .asc " | WoodTower"
201
202 .asc " | Apollo Team (Vampire POWAH!)"
203 .asc " | Silicium & MO5.com"
204 .asc " | and all the friends of TripleA"
205 #endif
206 .asc " "
207 .byt SCROLLER_SHOW_BELETT
208 .asc " "
209 .byt SCROLLER_BOTTOM_TEXT
210 .word _BottomRDV
211 .asc " Monsieur Belett' et son equipe vous remercient"
212 .asc " et vous donnent rendez-vous a l'Alchimie 13. "
213 .asc " "
214 .asc " "
215 .asc "The End :) IT'S OVER NOW "
216 .asc " "
217 .asc " SEE YOU ALL AT ALCHIMIE 13 ! "
218 .asc " "
219 .asc "The End :) IT'S OVER NOW "
220 .asc " "
221 .asc " SEE YOU ALL AT ALCHIMIE 13 ! "
222 .asc " "
223 .asc " Non mais serieux, rentrez chez vous !! "
224 .byt SCROLLER_DONE
225 .asc " "
226 .byt SCROLLER_END
227
228
229 /*
230 ;
231 ; Installs a simple 50hz Irq
232 ;
233 ; 304
234 ; 306
235 ; 307
236 bit $304 // VIA_T1CL ; Turn off interrupt early. (More on that below
237
238 ;Based on setting T1 to FFFF and adding to global counter in IRQ for up to 16.5
239 ;Million Clock Cycles.
240
241
242 #define VIA_T1CL $0304
243 #define VIA_T1CH $0305
244
245 #define VIA_T1LL $0306
246 #define VIA_T1LH $0307
247
248 _VSync
249 lda $300
250 vsync_wait
251 lda $30D
252 and #%00010000 ;test du bit cb1 du registre d'indicateur d'IRQ
253 beq vsync_wait
254 rts
255
256 */
257 _System_InstallIRQ_SimpleVbl
258 .(
259 sei
260
261 //
262 // Switch OFF interrupts, and enable Overlay RAM
263 // Because writing in ROM, is basicaly very hard !
264 //
265 sei
266 lda #%11111101
267 sta $314
268
269 // Set the VIA parameters
270 lda #<19966 ; 20000
271 sta $306
272 lda #>19966 ; 20000
273 sta $307
274
275 lda #0
276 sta _VblCounter
277 sta _SystemFrameCounter_low
278 sta _SystemFrameCounter_high
279 sta _ScrollerScreenDir
280 sta _BoingPhase
281
282 lda #SCROLLER_NOTHING
283 sta _ScrollerCommand
284 lda #0
285 sta _ScrollerCommandParam1
286 sta _ScrollerCommandParam2
287
288 lda #<SCROLLER_START_ADDR
289 sta _ScrollerAddrBase_low
290 lda #>SCROLLER_START_ADDR
291 sta _ScrollerAddrBase_high
292
293 ;
294 ; Scroller
295 ;
296 jsr ScrollerDisplayReset
297
298 ;
299 ; Music player
300 ;
301 #ifdef ENABLE_MUSIC
302 jsr _Mym_Initialize
303 #endif
304
305 lda $FFFE
306 sta _SavedIRQ
307 lda $FFFF
308 sta _SavedIRQ+1
309 // Install interrupt (this works only if overlay ram is disabled)
310 lda #<_InterruptCode_SimpleVbl
311 sta $FFFE
312 lda #>_InterruptCode_SimpleVbl
313 sta $FFFF
314
315 cli
316 rts
317 .)
318
319
320 /*
321 _System_UninstallIRQ_SimpleVbl
322 .(
323 sei
324
325 // Install interrupt (this works only if overlay ram is disabled)
326 lda _SavedIRQ
327 sta $FFFE
328 lda _SavedIRQ+1
329 sta $FFFF
330
331 cli
332 rts
333 .)
334 */
335
336 _VSync
337 lda _VblCounter
338 beq _VSync
339 lda #0
340 sta _VblCounter
341 rts
342
343
344 _InterruptCode_SimpleVbl
345 _InterruptCode
346 bit $304
347 inc _VblCounter
348
349 .(
350 inc _SystemFrameCounter_low
351 bne skip
352 inc _SystemFrameCounter_high
353 skip
354 .)
355
356 pha
357 txa
358 pha
359 tya
360 pha
361 sei
362
363 jsr _ScrollerDisplay
364
365 #ifdef ENABLE_MUSIC
366 jsr _Mym_PlayFrame
367 #endif
368
369 _InterruptCodeEnd
370 pla
371 tay
372 pla
373 tax
374 pla
375
376 rti
377
378
379
380
381 _ScrollerInit
382 lda #SCROLLER_NOTHING
383 sta _ScrollerCommand
384
385 ; Clear the scroller area
386 ldx #SCROLLER_MAX_X+1
387 lda #64
388 ScrollerInitEraseLoop
389 ; TODO: simplify?
390 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*0,x
391 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*1,x
392 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*2,x
393 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*3,x
394 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*4,x
395 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*5,x
396 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*6,x
397 sta SCROLLER_START_ADDR+(SCROLLER_MAX_X)*7,x
398 dex
399 bne ScrollerInitEraseLoop
400
401 ; Color attributes won't work in the font buffer,
402 ; set them up in the text lines directly
403 ; FIXME TODO
404 ;lda #16+1
405 ;sta SCROLLER_START_ADDR+40*7
406
407 ; HIRES switch
408 ; lda #30
409 ; sta $bb80
410
411 ; TEXT switch
412 ;lda #26
413 ;sta $a000+40*8+40+40*75
414
415 ldx #40-3
416 lda #32 // space
417 ScrollerInitTextEraseLoop
418 sta $bf90+2,x
419 sta $bf90+40+2,x
420 dex
421 bne ScrollerInitTextEraseLoop
422
423 ; paper: white
424 ; lda #23
425 ; sta $bf90+0;
426 #ifdef SCROLLER_DOUBLE_HEIGHT
427 ; sta $bf90+40+0;
428 #endif
429
430 ; ink: blue
431 ; lda #4
432 ; sta $bf90+1;
433 #ifdef SCROLLER_DOUBLE_HEIGHT
434 ; sta $bf90+40+1;
435 #endif
436
437 /* ; space to let paper+ink go through
438 lda #35
439 sta $bf90+2;
440 sta $bf90+3;
441 sta $bf90+4;
442 #ifdef SCROLLER_DOUBLE_HEIGHT
443 sta $bf90+40+2;
444 sta $bf90+40+3;
445 sta $bf90+40+4;
446 #endif
447 */
448
449 #ifdef SCROLLER_DOUBLE_HEIGHT
450 lda #11 ; dbl height non blinking alt charset
451 sta $bf90+2;
452 sta $bf90+40+2;
453 #endif
454
455 ; set up text lines to point to contiguous characters in the font
456 ldx #SCROLLER_MAX_X-1
457 ldy #33+SCROLLER_MAX_X-1 ; '!' and up
458 ScrollerInitTextLoop
459 tya
460 sta $bf90+4,x
461 #ifdef SCROLLER_DOUBLE_HEIGHT
462 sta $bf90+40+4,x
463 #endif
464 dey
465 dex
466 bne ScrollerInitTextLoop
467
468
469 ;
470 ; Minigradient test under the logos
471 ;
472 ;; lda #16+6
473 ;; sta $a000+40*87
474 ;; lda #16+4
475 ;; sta $a000+40*86
476 ;; lda #16+6
477 ;; sta $a000+40*87
478
479 rts
480
481
482
483
484
485
486
487
488
489 ScrollerCounter .byt 0
490
491 ScrollerCharBuffer .byt 0,0,0,0,0,0,0,0 ; Buffer with character to scroll
492
493
494 ; unrolled here as subroutine to avoid branch overflow
495 sub8y
496 ; y-=8 (unrolled)
497 dey
498 dey
499 dey
500 dey
501 dey
502 dey
503 dey
504 dey
505 rts
506
507 _ScrollerDisplay
508 ;Break jmp Break
509 ; rts
510
511 lda ScrollerCounter
512 beq ScrollerNewCharacter
513
514 dec ScrollerCounter
515 jmp ScrollerEndNewCharacter
516
517 ScrollerNewCharacter
518 lda #6
519 sta ScrollerCounter
520
521 readCharacter
522 ; Get character and write into the buffer
523 ldy #0
524 lda (_MessageScrollerPtr),y
525 beq ScrollerDisplayReset
526 cmp #32
527 bcc SpecialCommand
528
529 jsr ScrollerIncPointer
530
531 ; Multiply by 8 the ASCII code to point in the font
532 sta tmp7
533 lda #0
534 sta tmp7+1
535
536 asl tmp7
537 rol tmp7+1
538
539 asl tmp7
540 rol tmp7+1
541
542 asl tmp7
543 rol tmp7+1
544
545 ; Add the font pointer
546 clc
547 #ifndef DEBUG_FONT
548 ; lda #<_AmigaTopazUnicodeRus_8_bits -32*8
549 ; lda #<_Minecrafter_3_6_6_bits -32*8
550 lda _scrollerFont//+32*8
551 #else
552 lda #<$9C00 -32*8
553 #endif
554 adc tmp7
555 sta tmp7
556 #ifndef DEBUG_FONT
557 ; lda #>_AmigaTopazUnicodeRus_8_bits -32*8
558 ; lda #>_Minecrafter_3_6_6_bits -32*8
559 lda _scrollerFont+1//+32*8
560 #else
561 lda #>$9C00 -32*8
562 #endif
563 adc tmp7+1
564 sta tmp7+1
565
566 ; Copy the character data to the scroller buffer
567 ldy #0
568 loopcopychar
569 lda (tmp7),y
570 ora #64
571 sta ScrollerCharBuffer,y
572 iny
573 cpy #8
574 bne loopcopychar
575
576 ;; check if we move the screen up or down
577 ; lda _ScrollerScreenDir
578 ; beq ScrollerScreenNotMoved
579 ; bmi ScrollerScreenMovedUp
580 ; jmp ScrollerScreenMovedDown
581
582 ScrollerScreenNotMoved
583
584 ;jsr _BoingBall
585
586 ScrollerEndNewCharacter
587
588
589 ;Break jmp Break
590
591
592
593
594
595 lda _ScrollerAddrBase_low
596 sta tmp6
597 lda _ScrollerAddrBase_high
598 sta tmp6+1
599
600
601 ldx #0
602 ScrollerDisplayLoopMessageY
603 ; Get pixel from character
604 clc
605 lda ScrollerCharBuffer,x
606 ;ora #64
607 rol
608 cmp #192
609 and #%00111111
610 ora #%11000000
611 sta ScrollerCharBuffer,x
612
613 ; And then scroll the whole scanline
614 ldy #(SCROLLER_MAX_X)*8-8 ; (= 256 which overflows)
615 ScrollerDisplayLoopMessageX
616 lda (tmp6),y
617 ;ora #64
618 rol
619 cmp #192
620 and #%00111111
621 ora #%11000000
622 sta (tmp6),y
623
624 ; reset N flag
625 ;cmp #0
626 ; y-=8 (unrolled)
627 jsr sub8y
628
629 bne ScrollerDisplayLoopMessageX
630
631 clc
632 lda tmp6
633 adc #1 ; go to next line on the same first character in the font
634 sta tmp6
635 bcc skipkipppp
636 inc tmp6+1
637 skipkipppp
638
639 inx
640 cpx #8
641 bne ScrollerDisplayLoopMessageY
642 foo
643 ;jmp foo
644
645 rts
646
647
648 ScrollerDisplayReset
649 lda #<_MessageScroller
650 sta _MessageScrollerPtr
651 lda #>_MessageScroller
652 sta _MessageScrollerPtr+1
653 rts
654
655 SpecialCommand
656 ;cmp #SCROLLER_MOVE_MAP
657 ;beq ScrollerCommandThreeByte
658 ;cmp #SCROLLER_HIGHLIGHTE
659 ;beq ScrollerCommandFiveByte
660 ; ...default commands are one byte
661 ;cmp #24
662 ;bpl ScrollerCommandFiveByte
663 cmp #16
664 bpl ScrollerCommandThreeByte
665
666 ScrollerCommandOneByte
667 ldx #1
668 jmp ReadParameters
669
670 ScrollerCommandThreeByte
671 ldx #3
672 jmp ReadParameters
673
674 ScrollerCommandFiveByte
675 ldx #5
676 jmp ReadParameters
677
678 ParamCounter .byt 0
679
680 ReadParameters
681 .(
682 stx ParamCounter
683 ldx #0
684 ldy #0
685 loop
686 lda (_MessageScrollerPtr),y
687 sta _ScrollerCommand,x
688 inx
689
690 jsr ScrollerIncPointer
691
692 dec ParamCounter
693 bne loop
694 jmp readCharacter
695 .)
696
697
698
699 ScrollerIncPointer
700 inc _MessageScrollerPtr
701 bne skipscrollermove
702 inc _MessageScrollerPtr+1
703 skipscrollermove
704 rts
705
706
707 ;; ScrollerScreenMovedDown
708 ;; ;; moved down
709 ;; clc
710 ;; lda _ScrollerAddrBase_low
711 ;; sta tmp6
712 ;; adc #40
713 ;; sta tmp7
714 ;; sta _ScrollerAddrBase_low
715 ;; lda _ScrollerAddrBase_high
716 ;; sta tmp6+1
717 ;; sta tmp7+1
718 ;; bcc skipmoveddown
719 ;; inc tmp7+1
720 ;; inc _ScrollerAddrBase_high
721 ;; skipmoveddown
722 ;; dec _ScrollerScreenDir
723 ;; jmp ScrollerScreenNotMoved
724
725
726 ; reg5 =
727 ; reg6 =
728 ; reg7 =
729 _A12_DoLeftScroll
730
731 ldy #0
732 lda (sp),y
733 sta reg7
734 iny
735 lda (sp),y
736 sta reg7+1
737
738
739 lda #<$a000
740 sta reg5
741 lda #>$a000
742 sta reg5+1
743
744
745 ldx #0
746
747 A12_ScrollerDisplayLoopMessageY
748 txa
749 pha
750
751 ; = *A12_bp
752 ldy #0
753 lda (reg7),y
754 ;tax
755 sta reg6
756
757 lda reg5
758 sta A12_lda_inner1+1
759 sta A12_sta_inner1+1
760 lda reg5+1
761 sta A12_lda_inner1+2
762 sta A12_sta_inner1+2
763
764 ldy #40
765
766
767 A12_ScrollerDisplayLoopMessageX
768
769 ;txa
770 ;pha
771
772 dey
773 ; lda (reg5),y
774 A12_lda_inner1
775 lda $ffff,y
776 ;sta reg6
777 tax
778 ;pla
779 lda reg6
780
781 ; sta (reg5),y
782 A12_sta_inner1
783 sta $ffff,y
784
785 stx reg6
786
787 cpy #2
788 bne A12_ScrollerDisplayLoopMessageX
789
790 ; handle paper & ink
791 dey
792 txa
793 and #%01111111
794 cmp #8
795 bpl A12_sk1
796 txa
797 sta (reg5),y
798 jmp A12_skdone
799 A12_sk1
800 cmp #16
801 bmi A12_skdone
802 cmp #24
803 bpl A12_skdone
804 dey
805 txa
806 sta (reg5),y
807 ;jmp A12_skdone
808
809 A12_skdone
810
811 ; reg5 += 40
812 clc
813 lda reg5
814 adc #40 ; go to next line
815 sta reg5
816 bcc A12_skip1
817 inc reg5+1
818 A12_skip1
819
820 ; A12_bp += 40
821 clc
822 lda reg7 ;_A12_bp
823 adc #40 ; go to next line
824 sta reg7 ;_A12_bp
825 bcc A12_skip2
826 inc reg7+1 ;_A12_bp+1
827 A12_skip2
828
829 pla
830 tax
831
832 inx
833 cpx #200
834 bne A12_ScrollerDisplayLoopMessageY
835
836 rts
837

  ViewVC Help
Powered by ViewVC 1.1.26