-
Notifications
You must be signed in to change notification settings - Fork 0
/
tunnel.s
1823 lines (1552 loc) · 39.5 KB
/
tunnel.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VIEWPORT_W_PX equ 160
VIEWPORT_H_PX equ 100
TEXTURE_WIDTH equ 64
TEXTURE_HEIGHT equ 64
VIEWPORT_HEIGHT equ 100
VIEWPORT_WIDTH equ 20
GENERATE_FROM_TGA equ 1
MOVETUNNEL equ 0
TUNNEL_BARS_TUNER equ 50
TUNNEL_PLANE_OFFSET equ 0
PIC_WIDTH equ 4
PIC_HEIGHT equ 64*2
OFFSMAPWIDTH equ 480
IFD DEMOSYSTEM
IFD STANDALONE
ELSE
STANDALONE equ 1
ENDC
ELSE
STANDALONE equ 0
ENDC
IFEQ STANDALONE
TRUE equ 0
FALSE equ 1
true equ 0
false equ 1
TUNNEL_EFFECT_FRAMES_MOVE_WAIT equ 40
TUNNEL_POETRY_START_SPEED equ $24000
TUNNEL_POETRY_BREAK_SPEED equ $990
ENDC
incdir gfx
incdir lib
incdir msx
incdir res/smfx
section DATA
include macro.s
IFEQ STANDALONE
initAndRun init_effect
init_effect
jsr init_demo
; jsr prepPoetry
move.w #32000,effect_vbl_counter
jsr init_tunnel
.demostart
.x
move.l screenpointer2,$ffff8200
cmp.b #$39,$fffffc02.w ; spacebar to exit
bne .x ;
rts
init_demo
move.w #$000,$ffff8240
move.l #memBase+65536,d0
sub.w d0,d0
move.l d0,screenpointer
move.l d0,screen1
add.l #$10000,d0
move.l d0,screenpointer2
move.l d0,screen2
rts
ENDC
init_tunnel_pointers
move.l screen1,screenpointer
move.l screen2,screenpointer2
move.l screen2,d0
add.l #$10000,d0 ;1
move.l d0,screenpointer3
add.l #$10000,d0 ;2
move.l d0,d1
add.l #$8000,d1
move.l d1,offsmapPointer
move.l d0,planartexture1pointer
move.l d0,offsmapPointer
add.l #98304,d0 ;98304 ;65536
move.l d0,planartexture2pointer
add.l #98304,d0 ;98304 196608
move.l d0,planartexture3pointer
add.l #98304,d0 ;98304 294912
move.l d0,planartexture4pointer
add.l #98304,d0 ;9304 393216
move.l d0,c2pCopyPointerPointer
add.l #4802,d0 ;4802 478020
move.l d0,texture_tunnelPointer
add.l #8192,d0 ;8192 486212
move.l d0,tunnelCodePointer
add.l #240000+2,d0 ; 726236 ;12 offset
move.l d0,poetryBufferPointer
move.w #$4e75,init_tunnel_pointers
rts
precalc_tunnel1
lea offsmapcrk,a0
move.l offsmapPointer,a1
jsr cranker
jsr genc2pCode ; this generates the unrolled c2p stuff
jsr generateC2PCopy ; generate the copy stuff
IFEQ STANDALONE
lea planar,a0
move.l texture_tunnelPointer,a1
jsr convertPlanar2Chunky ; this converts the planar to chunky format
ELSE
lea tunneltext,a0
move.l texture_tunnelPointer,a1
jsr cranker
ENDC
lea poetrycrk,a0
move.l poetryBufferPointer,a1
jsr cranker
; jsr convertPlanar2Chunky ; this converts the planar to chunky format
move.w #$4e75,precalc_tunnel1
rts
precalc_tunnel2
IFEQ GENERATE_FROM_TGA
jsr convertOffsmapToTGA
jsr generateOffsetFromTGA
ENDC
jsr prepareChunkyTextureBPL1to2 ; this prepares the c2p tables
; precalc fades
IFNE STANDALONE
lea fadeOutTunnelPal-32,a0
lea barFade,a2
lea allYellow,a3
jsr calcFadeT
lea fadeOutTunnelPal-32,a0
lea barFade2,a2
lea allBlue,a3
jsr calcFadeT
lea fadeOutTunnelPal-32,a0
lea barFade3,a2
lea allRed,a3
jsr calcFadeT
lea fadeOutTunnelPal-32,a0
lea barFade4,a2
lea allGreen,a3
jsr calcFadeT
lea fadeOutTunnelPal-32,a0
lea barFade5,a2
lea allGrey,a3
jsr calcFadeT
ENDC
move.w #$4e75,precalc_tunnel2
rts
calcFadeT
movem.l (a0),d0-d7
movem.l d0-d7,(a2)
move.l a2,a0
lea 32(a2),a2
move.w #8-1,d7
.loop
move.l a3,a1
move.w #16,d0 ; 16 colors
IFNE STANDALONE
jsr fadePalzz
ENDC
lea 32(a0),a0
lea 32(a2),a2
dbra d7,.loop
rts
allYellow
REPT 16
; dc.w $770 ; yellow->green
; dc.w $222 ; greyscale 2
; dc.w $562 ; green->purple
dc.w $352 ; green->white->yellow/red
; dc.w $333 ; greyscale
; dc.w $772 ; yellow->purple
; dc.w $776 ; yellow->purple 2
; dc.w $773 ; pastel hell
ENDR
allBlue
REPT 16
; dc.w $561
; dc.w $666
; dc.w $451
dc.w $573
; dc.w $555
; dc.w $651
; dc.w $774
; dc.w $763
ENDR
allRed
REPT 16
; dc.w $350
; dc.w $555
; dc.w $330
dc.w $777
; dc.w $777
; dc.w $531
; dc.w $675
; dc.w $643
ENDR
allGrey
REPT 16
; dc.w $032
; dc.w $333
; dc.w $312
dc.w $621
; dc.w $333
; dc.w $211
; dc.w $765
; dc.w $423
ENDR
allGreen
REPT 16
; dc.w $141
; dc.w $444
; dc.w $321
dc.w $751
; dc.w $555
; dc.w $321
; dc.w $576
; dc.w $533
ENDR
init_tunnel
jsr init_tunnel_pointers
jsr precalc_tunnel1
; move.b #0,$ffffc123
jsr precalc_tunnel2
; move.b #0,$ffffc123
; lea planar+2,a0
; movem.l (a0),d0-d7
; movem.l d0-d7,$ffff8240.w
move.w #$2700,sr
move.l #tunnel_vbl,$70
move.w #$2300,sr
jsr tunnel_mainloop
IFNE STANDALONE
jsr clearMem
ENDC
rts
tunnel_vbl
addq.w #1,$466.w
subq.w #1,effect_vbl_counter
addq.w #1,vblCounter
clr.b $fffffa1b.w ;Timer B control (stop)
bset #0,$fffffa07.w ;Interrupt enable A (Timer B)
bset #0,$fffffa13.w ;Interrupt mask A (Timer B)
tst.w tunnel_barsout_waiter
blt .special
move.l #timer_b_open_curtain_stable,$120.w
jmp .ccc
.special
move.l #timer_b_open_curtain_stable_bars,$120.w
.ccc
move.b #188,$fffffa21.w ;Timer B data
move.b #4,$fffffa1b.w ;Timer B control (delay mode)
bclr #3,$fffffa17.w ;Automatic end of interrupt
move.w #0,$ffff8240
pushall
IFEQ STANDALONE
movem.l planar+2,d0-d7
movem.l d0-d7,$ffff8240
ELSE
jsr doTunnelFades
ENDC
tst.w tunnel_barsout_waiter
bge .skipppp
subq.w #1,.barFadeOff
bge .k1
move.w #1,.barFadeOff
add.w #32,barFadeOff
cmp.w #8*32,barFadeOff
ble .k1
move.w #8*32,barFadeOff
.k1
subq.w #1,.barFade2Off
bge .k2
move.w #1,.barFade2Off
add.w #32,barFade2Off
cmp.w #8*32,barFade2Off
ble .k2
move.w #8*32,barFade2Off
.k2
subq.w #1,.barFade3Off
bge .k3
move.w #1,.barFade3Off
add.w #32,barFade3Off
cmp.w #8*32,barFade3Off
ble .k3
move.w #8*32,barFade3Off
.k3
subq.w #1,.barFade4Off
bge .k4
move.w #1,.barFade4Off
add.w #32,barFade4Off
cmp.w #8*32,barFade4Off
ble .k4
move.w #8*32,barFade4Off
.k4
subq.w #1,.barFade5Off
bge .k5
move.w #1,.barFade5Off
add.w #32,barFade5Off
cmp.w #8*32,barFade5Off
ble .k1
move.w #8*32,barFade5Off
.k5
.skipppp
move.l currentPoetryRout,a0
jsr (a0)
cmp.w #600,vblCounter
bne .skip
moveq #0,d0
moveq #0,d1
move.w vblCounter,d0
move.w effectCounter,d1
; move.b #0,$ffffc123
.skip
IFNE STANDALONE
jsr replayMymDump
ENDC
popall
rte
.barFadeOff dc.w 13*2+15
.barFade2Off dc.w 13*0+15
.barFade3Off dc.w 13*4+15
.barFade4Off dc.w 13*3+15
.barFade5Off dc.w 13*1+15
tunnelFadeInOff dc.w 0
tunnelFadeOutOff dc.w 7*32
tunnelFadeInWaiter dc.w 0
tunnelFadeOutWaiter dc.w 32000
textureSelect dc.l 0
tunnel_barsout_waiter dc.w 32000
doTunnelFades
subq.w #1,tunnelFadeInWaiter
bge .nofadein
move.w #3,tunnelFadeInWaiter
lea targetTunnelPal+2,a0
add.w tunnelFadeInOff,a0
lea $ffff8240+2,a1
REPT 7
move.l (a0)+,(a1)+
ENDR
move.w (a0)+,(a1)+
add.w #32,tunnelFadeInOff
cmp.w #8*32,tunnelFadeInOff
bne .coldone
move.w #0,tunnelFadeInOff
move.w #32000,tunnelFadeInWaiter
jmp .coldone
.nofadein
subq.w #1,tunnelFadeOutWaiter
bge .coldone
subq.w #1,.fadeOutTimes
bge .kk
move.w #-1,tunnel_barsout_waiter
move.w #$4e75,doTunnelFades
jmp .coldone
.kk
move.w #3,tunnelFadeOutWaiter
lea targetTunnelPal+2,a0
add.w tunnelFadeOutOff,a0
lea $ffff8240+2,a1
REPT 7
move.l (a0)+,(a1)+
ENDR
move.w (a0)+,(a1)+
sub.w #32,tunnelFadeOutOff
bge .coldone
move.w #32*7,tunnelFadeOutOff
move.w #32000,tunnelFadeOutWaiter
.coldone
rts
.fadeOutTimes dc.w 5*8
targetTunnelPal
; dc.w $777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777
; dc.w $777,$767,$777,$776,$777,$777,$777,$777,$767,$777,$777,$777,$777,$777,$777,$666
; dc.w $777,$756,$776,$775,$776,$777,$777,$666,$656,$677,$777,$777,$777,$777,$777,$555
; dc.w $777,$745,$765,$774,$775,$776,$777,$555,$545,$566,$666,$777,$767,$777,$777,$444
; dc.w $777,$634,$754,$763,$774,$775,$777,$444,$434,$455,$555,$676,$757,$777,$777,$333
; dc.w $777,$523,$643,$752,$763,$774,$777,$333,$323,$344,$444,$565,$646,$777,$777,$222
; dc.w $777,$412,$532,$741,$752,$773,$777,$222,$212,$233,$333,$454,$535,$766,$777,$111
; dc.w $777,$302,$421,$630,$641,$762,$777,$111,$101,$122,$222,$343,$424,$755,$766,$000
dc.w $777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777
dc.w $777,$777,$776,$776,$777,$677,$776,$776,$776,$776,$777,$677,$776,$776,$776,$766
dc.w $777,$777,$775,$765,$777,$576,$775,$775,$775,$775,$677,$577,$775,$775,$775,$755
dc.w $777,$777,$774,$754,$777,$465,$774,$674,$774,$774,$577,$467,$774,$774,$774,$744
dc.w $777,$677,$773,$743,$777,$354,$673,$573,$773,$763,$467,$356,$773,$773,$763,$733
dc.w $777,$577,$772,$732,$777,$243,$572,$462,$772,$752,$356,$245,$772,$762,$752,$722
dc.w $777,$466,$761,$721,$666,$132,$461,$351,$671,$741,$245,$134,$761,$751,$641,$611
dc.w $777,$355,$750,$710,$555,$021,$350,$240,$560,$730,$134,$023,$750,$640,$530,$500
fadeOutTunnelPal
dc.w $000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000
dc.w $111,$100,$100,$100,$000,$000,$000,$000,$000,$000,$000,$000,$100,$000,$000,$000
dc.w $222,$200,$200,$200,$000,$010,$000,$000,$000,$000,$000,$000,$200,$100,$000,$111
dc.w $333,$310,$300,$300,$100,$120,$010,$000,$000,$011,$000,$000,$310,$210,$100,$111
dc.w $444,$420,$400,$400,$200,$230,$020,$010,$000,$022,$001,$000,$420,$320,$200,$222
dc.w $555,$530,$510,$500,$300,$340,$130,$020,$000,$133,$012,$001,$530,$430,$310,$333
dc.w $666,$640,$620,$600,$400,$450,$240,$130,$010,$244,$023,$012,$640,$530,$420,$444
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$021,$355,$134,$023,$750,$640,$530,$555
currentPoetryRout dc.l doNothing
tunnelSequence
; here we do the tunnel sequence stuff
; we count vbls to change tunnel thing, and we do fades and stuff
subq.l #1,currentCounter
bge .end
lea tunnelEffectList,a0
add.w tunnelEffectListOff,a0
add.w #4*6,tunnelEffectListOff
move.l (a0)+,textureSelect
move.l (a0)+,currentTunnelEffect
move.l (a0)+,doLeft
move.l (a0)+,currentCounter
move.l (a0)+,d0
move.l (a0)+,currentPoetryRout
move.w d0,jmpOffset
move.l currentTunnelEffect,d0
cmp.l #doClearScreen,d0
beq .end
move.l currentCounter,d0
muls #3,d0 ; number of vbl
move.w #5,tunnelFadeInWaiter
sub.w #30,d0
subq.w #1,.times
bge .ok
sub.w #TUNNEL_BARS_TUNER,d0
.ok
move.w d0,tunnelFadeOutWaiter
.end
cmp.w #11*4*6,tunnelEffectListOff
beq .stopt
rts
.stopt
move.w #TUNNEL_EFFECT_FRAMES_MOVE_WAIT,moveWaiter
move.w #$4e75,tunnelSequence
rts
.times dc.w 5
currentCounter dc.l 1
tunnelFadeInOutFlag dc.w 1
tunnelFadeOff dc.w 32*7
tunnelEffectListOff dc.w 0
tunnelEffectList ; start with right, right
;def: texture 0 or 1, effect,fade?,duration(vbl/3),offset, change duration for longer/shorter; doClearScreen needs to remain 1
dc.l 1,doPartTunnel,-1,30,40*49,doPoetry0 ; do right tunnel, left half
dc.l 0,doClearScreen,0,1,0,doNothing ; clear
dc.l 1,doPartTunnel,0,30,40*39,doPoetry1 ; do right tunnel, right half
dc.l 0,doClearScreen,0,1,0,doNothing ; clear
dc.l 1,doWholeTunnel,0,60,40*39,doNothing ; do right tunnel, whole
dc.l 0,doClearScreen,0,1,0,doNothing ; clear
dc.l 0,doPartTunnel,0,30,0,doPoetry2 ; do left tunnel, left half
dc.l 0,doClearScreen,0,1,0,doNothing ; clear
dc.l 0,doPartTunnel,-1,30,40*10,doPoetry3 ; do left tunnel, right half
dc.l 0,doClearScreen,0,1,0,doNothing ; clear
dc.l 0,doWholeTunnel,0,280-16-10,0,doNothing ; do whole and move
dc.l 0,doNothing,0,600,0,doNothing ; do whole and move
currentTunnelEffect dc.l doClearScreen
doLeft dc.l 0
jmpOffset dc.w 0
fadeInFlag dc.w 0
fadeOutFlag dc.w 0
poetryBufferPointer dc.l 0
;poetryBuffer
; ds.b 62*10*2*4 ; 4960
;
;prepPoetry
; lea poetry+128,a0
; lea poetryBuffer,a1
;
; jsr cpPrep
;
; lea poetry+128+60*160,a0
;
; jsr cpPrep
;
; lea poetry+128+120*160,a0
;
; jsr cpPrep
;
; lea poetry+128+80,a0
;
; jsr cpPrep
;
; lea poetryBuffer,a0
; move.l poetryBufferPointer,a1
; move.w #62-1,d7
;.lll
; REPT 20
; move.l (a0)+,(a1)+
; ENDR
; dbra d7,.lll
; move.b #0,$ffffc123
; rts
;
;cpPrep
;.y set 0
; REPT 2
; REPT 10
; move.w #0,(a1)+
; ENDR
; ENDR
; REPT 60
;.x set .y
; REPT 10
; move.w .x(a0),(a1)+
;.x set .x+8
; ENDR
;.y set .y+160
; ENDR
; rts
;
;poetry
; incbin "data/tunnel/poetry3.neo"
poetrycrk
incbin "data/tunnel/poetry2.crk"
even
poetry0off dc.l $0
poetry1off dc.l $0
poetry2off dc.l $0
poetry3off dc.l $0
poetry0Const dc.l TUNNEL_POETRY_START_SPEED
poetry1Const dc.l TUNNEL_POETRY_START_SPEED
poetry2Const dc.l TUNNEL_POETRY_START_SPEED
poetry3Const dc.l TUNNEL_POETRY_START_SPEED
poetryOff
.y set 0
REPT 100
dc.w .y
.y set .y+160
ENDR
doPoetry0
; lea poetry+128,a0
; lea poetryBuffer,a0
move.l poetryBufferPointer,a0
moveq #0,d0
move.b $ffff8201,d0
lsl.l #8,d0
lsl.l #8,d0
move.l d0,a1
lea poetryOff,a2
move.w poetry0off,d0
add.w d0,d0
add.w #TUNNEL_PLANE_OFFSET,a1
add.w (a2,d0.w),a1
move.l poetry0Const,d0
add.l d0,poetry0off
sub.l #TUNNEL_POETRY_BREAK_SPEED,poetry0Const
bge .k1
move.l #0,poetry0Const
.k1
jmp doPaint
doPoetry1
; lea poetry+128+56*160,a0
; lea poetryBuffer+62*2*10,a0
move.l poetryBufferPointer,a0
add.w #62*2*10,a0
moveq #0,d0
move.b $ffff8201,d0
lsl.l #8,d0
lsl.l #8,d0
move.l d0,a1
lea poetryOff,a2
move.w poetry1off,d0
add.w d0,d0
add.w #TUNNEL_PLANE_OFFSET,a1
add.w (a2,d0.w),a1
move.l poetry1Const,d0
add.l d0,poetry1off
sub.l #TUNNEL_POETRY_BREAK_SPEED,poetry1Const
bge .k2
move.l #0,poetry1Const
.k2
jmp doPaint
doPoetry2
; lea poetry+128+119*160,a0
; lea poetryBuffer+62*2*10*2,a0
move.l poetryBufferPointer,a0
add.w #62*2*10*2,a0
moveq #0,d0
move.b $ffff8201,d0
lsl.l #8,d0
lsl.l #8,d0
move.l d0,a1
lea poetryOff,a2
move.w poetry2off,d0
add.w d0,d0
add.w #TUNNEL_PLANE_OFFSET,a1
add.w (a2,d0.w),a1
move.l poetry2Const,d0
add.l d0,poetry2off
sub.l #TUNNEL_POETRY_BREAK_SPEED,poetry2Const
bge .k3
move.l #0,poetry2Const
.k3
jmp doPaint
doPoetry3
; lea poetry+128+80,a0
; lea poetryBuffer+62*2*10*3,a0
move.l poetryBufferPointer,a0
add.w #62*2*10*3,a0
moveq #0,d0
move.b $ffff8201,d0
lsl.l #8,d0
lsl.l #8,d0
move.l d0,a1
lea poetryOff,a2
move.w poetry3off,d0
add.w d0,d0
add.w #TUNNEL_PLANE_OFFSET,a1
add.w (a2,d0.w),a1
move.l poetry3Const,d0
add.l d0,poetry3off
sub.l #TUNNEL_POETRY_BREAK_SPEED,poetry3Const
bge .k4
move.l #0,poetry3Const
.k4
jmp doPaint
doPaint
moveq #0,d6
tst.w doLeft
bne .skip
add.w #80,a1
.skip
.y set -5*160
REPT 5
.x set .y
REPT 10
move.w d6,.x(a1)
.x set .x+8
ENDR
.y set .y+160
ENDR
REPT 62
.x set .y
REPT 10
move.w (a0)+,.x(a1)
.x set .x+8
ENDR
.y set .y+160
ENDR
rts
doNothing
rts
doPartTunnel
jsr prepareTunnelTexture
jsr doTunnelEffectLeft
jsr copyLinesTunnel
rts
doWholeTunnel
jsr prepareTunnelTexture
jsr doTunnelEffectWhole
jsr copyLinesTunnel
rts
doClearScreen
move.l screenpointer,a0
move.l screenpointer2,a1
move.l screenpointer3,a2
moveq #0,d0
move.l d0,d1
move.l d0,d2
move.l d0,d3
move.l d0,d4
move.l d0,d5
move.l d0,d6
move.l d0,a3
move.l d0,a4
move.l d0,a5
move.w #200*4-1,d7
.cl
movem.l d0-d6/a3/a4/a5,(a0)
lea 40(a0),a0
movem.l d0-d6/a3/a4/a5,(a1)
lea 40(a1),a1
movem.l d0-d6/a3/a4/a5,(a2)
lea 40(a2),a2
dbra d7,.cl
rts
timer_b_open_curtain_stable_bars
movem.l d1-d2/a0,-(sp)
move.w #$2100,sr
stop #$2100
move.w #$2700,sr
lea $ffff8209.w,a0 ;Hardsync
moveq #127,d1
.sync: tst.b (a0)
beq.s .sync
move.b (a0),d2
sub.b d2,d1
lsr.l d1,d1
clr.b $fffffa1b.w ;Timer B control (stop)
move.l a1,-(sp)
lea $ffff8240,a0
lea barFade,a1
add.w barFadeOff,a1
dcb.w 59-6-2-3-2-3,$4e71
REPT 8
move.l (a1)+,(a0)+
ENDR
; move.w #$444,$ffff8240.w
move.l (sp)+,a1
movem.l (sp)+,d1-d2/a0
clr.b $fffffa1b.w
move.l #timer_b_open_curtain_stable_bars2,$120.w
move.b #38,$fffffa21.w ;Timer B data (number of scanlines to next interrupt)
move.b #8,$fffffa1b.w ;Timer B control (event mode (HBL))
rte
barFade
rept 16
dc.w $700
endr
; dc.w $000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000
dc.w $111,$100,$100,$100,$000,$000,$000,$000,$000,$000,$000,$000,$100,$000,$000,$000
dc.w $222,$200,$200,$200,$000,$010,$000,$000,$011,$000,$000,$000,$200,$100,$000,$111
dc.w $333,$310,$300,$300,$100,$120,$010,$000,$022,$011,$000,$000,$310,$210,$100,$111
dc.w $444,$420,$400,$400,$200,$230,$020,$010,$133,$022,$001,$000,$420,$320,$200,$222
dc.w $555,$530,$510,$500,$300,$340,$130,$020,$244,$133,$012,$001,$530,$430,$310,$333
dc.w $666,$640,$620,$600,$400,$450,$240,$130,$355,$244,$023,$012,$640,$530,$420,$444
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
barFadeOff dc.w 0
timer_b_open_curtain_stable_bars2
move.w #$2100,sr
stop #$2100
move.w #$2700,sr
movem.l d0-d7/a0-a3,-(sp)
lea barFade2,a0
add.w barFade2Off,a0
movem.l (a0),d3-d7/a1-a3
lea $ffff8209.w,a0 ;Hardsync
moveq #127,d1
.sync: tst.b (a0)
beq.s .sync
move.b (a0),d2
sub.b d2,d1
lsr.l d1,d1
clr.b $fffffa1b.w ;Timer B control (stop)
movem.l d3-d7/a1-a3,$ffff8240
movem.l (sp)+,d0-d7/a0-a3
clr.b $fffffa1b.w
move.l #timer_b_open_curtain_stable_bars3,$120.w
move.b #38,$fffffa21.w ;Timer B data (number of scanlines to next interrupt)
move.b #8,$fffffa1b.w ;Timer B control (event mode (HBL))
rte
barFade2
rept 16
dc.w $070
endr
; dc.w $000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000
dc.w $111,$100,$100,$100,$000,$000,$000,$000,$000,$000,$000,$000,$100,$000,$000,$000
dc.w $222,$200,$200,$200,$000,$010,$000,$000,$011,$000,$000,$000,$200,$100,$000,$111
dc.w $333,$310,$300,$300,$100,$120,$010,$000,$022,$011,$000,$000,$310,$210,$100,$111
dc.w $444,$420,$400,$400,$200,$230,$020,$010,$133,$022,$001,$000,$420,$320,$200,$222
dc.w $555,$530,$510,$500,$300,$340,$130,$020,$244,$133,$012,$001,$530,$430,$310,$333
dc.w $666,$640,$620,$600,$400,$450,$240,$130,$355,$244,$023,$012,$640,$530,$420,$444
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
barFade2Off dc.w 0
timer_b_open_curtain_stable_bars3
move.w #$2100,sr
stop #$2100
move.w #$2700,sr
movem.l d0-d7/a0-a3,-(sp)
lea barFade3,a0
add.w barFade3Off,a0
movem.l (a0),d3-d7/a1-a3
lea $ffff8209.w,a0 ;Hardsync
moveq #127,d1
.sync: tst.b (a0)
beq.s .sync
move.b (a0),d2
sub.b d2,d1
lsr.l d1,d1
clr.b $fffffa1b.w ;Timer B control (stop)
movem.l d3-d7/a1-a3,$ffff8240
movem.l (sp)+,d0-d7/a0-a3
clr.b $fffffa1b.w
move.l #timer_b_open_curtain_stable_bars4,$120.w
move.b #38,$fffffa21.w ;Timer B data (number of scanlines to next interrupt)
move.b #8,$fffffa1b.w ;Timer B control (event mode (HBL))
rte
barFade3
rept 16
dc.w $007
endr
; dc.w $000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000
dc.w $111,$100,$100,$100,$000,$000,$000,$000,$000,$000,$000,$000,$100,$000,$000,$000
dc.w $222,$200,$200,$200,$000,$010,$000,$000,$011,$000,$000,$000,$200,$100,$000,$111
dc.w $333,$310,$300,$300,$100,$120,$010,$000,$022,$011,$000,$000,$310,$210,$100,$111
dc.w $444,$420,$400,$400,$200,$230,$020,$010,$133,$022,$001,$000,$420,$320,$200,$222
dc.w $555,$530,$510,$500,$300,$340,$130,$020,$244,$133,$012,$001,$530,$430,$310,$333
dc.w $666,$640,$620,$600,$400,$450,$240,$130,$355,$244,$023,$012,$640,$530,$420,$444
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
barFade3Off dc.w 0
timer_b_open_curtain_stable_bars4
move.w #$2100,sr
stop #$2100
move.w #$2700,sr
movem.l d0-d7/a0-a3,-(sp)
lea barFade4,a0
add.w barFade4Off,a0
movem.l (a0),d3-d7/a1-a3
lea $ffff8209.w,a0 ;Hardsync
moveq #127,d1
.sync: tst.b (a0)
beq.s .sync
move.b (a0),d2
sub.b d2,d1
lsr.l d1,d1
clr.b $fffffa1b.w ;Timer B control (stop)
movem.l d3-d7/a1-a3,$ffff8240
movem.l (sp)+,d0-d7/a0-a3
clr.b $fffffa1b.w
move.l #timer_b_open_curtain_stable_bars5,$120.w
move.b #38,$fffffa21.w ;Timer B data (number of scanlines to next interrupt)
move.b #8,$fffffa1b.w ;Timer B control (event mode (HBL))
rte
barFade4
rept 16
dc.w $770
endr
; dc.w $000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000
dc.w $111,$100,$100,$100,$000,$000,$000,$000,$000,$000,$000,$000,$100,$000,$000,$000
dc.w $222,$200,$200,$200,$000,$010,$000,$000,$011,$000,$000,$000,$200,$100,$000,$111
dc.w $333,$310,$300,$300,$100,$120,$010,$000,$022,$011,$000,$000,$310,$210,$100,$111
dc.w $444,$420,$400,$400,$200,$230,$020,$010,$133,$022,$001,$000,$420,$320,$200,$222
dc.w $555,$530,$510,$500,$300,$340,$130,$020,$244,$133,$012,$001,$530,$430,$310,$333
dc.w $666,$640,$620,$600,$400,$450,$240,$130,$355,$244,$023,$012,$640,$530,$420,$444
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
barFade4Off dc.w 0
timer_b_open_curtain_stable_bars5
move.w #$2100,sr
stop #$2100
move.w #$2700,sr
movem.l d0-d7/a0-a3,-(sp)
lea barFade5,a0
add.w barFade5Off,a0
movem.l (a0),d3-d7/a1-a3
lea $ffff8209.w,a0 ;Hardsync
moveq #127,d1
.sync: tst.b (a0)
beq.s .sync
move.b (a0),d2
sub.b d2,d1
lsr.l d1,d1
clr.b $fffffa1b.w ;Timer B control (stop)
REPT 4
or.l d7,d7
ENDR
movem.l d3-d7/a1-a3,$ffff8240
movem.l (sp)+,d0-d7/a0-a3
clr.b $fffffa1b.w
move.l #timer_b_close_curtain_stable,$120.w
move.b #38,$fffffa21.w ;Timer B data (number of scanlines to next interrupt)
move.b #8,$fffffa1b.w ;Timer B control (event mode (HBL))
rte
barFade5
rept 16
dc.w $707
endr
; dc.w $000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000
dc.w $111,$100,$100,$100,$000,$000,$000,$000,$000,$000,$000,$000,$100,$000,$000,$000
dc.w $222,$200,$200,$200,$000,$010,$000,$000,$011,$000,$000,$000,$200,$100,$000,$111
dc.w $333,$310,$300,$300,$100,$120,$010,$000,$022,$011,$000,$000,$310,$210,$100,$111
dc.w $444,$420,$400,$400,$200,$230,$020,$010,$133,$022,$001,$000,$420,$320,$200,$222
dc.w $555,$530,$510,$500,$300,$340,$130,$020,$244,$133,$012,$001,$530,$430,$310,$333
dc.w $666,$640,$620,$600,$400,$450,$240,$130,$355,$244,$023,$012,$640,$530,$420,$444
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
dc.w $777,$750,$730,$710,$500,$560,$350,$240,$466,$355,$134,$023,$750,$640,$530,$555
barFade5Off dc.w 0
IFEQ STANDALONE
timer_b_open_curtain_stable
movem.l d1-d2/a0,-(sp)
move.w #$2100,sr
stop #$2100
move.w #$2700,sr
lea $ffff8209.w,a0 ;Hardsync
moveq #127,d1
.sync: tst.b (a0)
beq.s .sync