1 REM RESONANCE: an IE64 BASIC composition using VideoChip, Copper, blitter and MIDI
3 REM It reads resonance_scroll.rgba and adagioforstrings.mid from the guest file root.
4 REM Read setup first, then Copper bands, asset preparation, the music-clocked frame
5 REM loop and its drawing subroutines. FB and BB are 640 by 480 RGBA buffers; TX is
6 REM the 1024 by 512 Mode7 texture, CP the Copper list, and SB the scroll-strip data.

100 REM Reserve the first phase for source data that does not change every frame.

200 REM Allocate aligned guest RAM and select VideoChip mode 0 with FB displayed.
205 REM FB and BB are full-screen RGBA32 buffers. TX is the Mode7 source texture.
206 REM SR holds the procedural Intuition Engine logo. SB holds the scroll strip.
207 REM ST, TS, and SS are byte strides for the screen, texture, and scroll strip.
210 FB=MEMALLOC(1228800,4096):BB=MEMALLOC(1228800,4096):TX=MEMALLOC(2097152,4096)
212 CP=MEMALLOC(4096,4096):SR=MEMALLOC(235520,4096):SB=MEMALLOC(2162688,4096)
220 ST=2560:TS=4096:SS=65536:SW=640:SH=480:FP=65536:SL=16384
230 TW=1024:TH=512:HW=320:HH=240:CU=512:CV=256
235 REM Select IEVideo mode 0 and display the allocated front framebuffer.
240 POKE32 &HF0000,1:POKE32 &HF0004,0:POKE32 &HF0080,0:POKE32 &HF0084,FB

300 REM The Copper owns these raster-band register writes after COPPER ON.
310 COPPER LIST CP
320 COPPER WAIT 0
330 COPPER MOVE &H000F0050,&H00000000
340 COPPER WAIT 84
350 COPPER MOVE &H000F0050,&H00000822
360 COPPER WAIT 184
370 COPPER MOVE &H000F0050,&H0018202C
380 COPPER WAIT 320
390 COPPER MOVE &H000F0050,&H00281608
400 COPPER WAIT 440
410 COPPER MOVE &H000F0050,&H00000000
420 COPPER END
430 COPPER ON

450 REM The MIDI sample position supplies the preferred timeline; the timer is a
452 REM fallback until it advances. The scroll strip is RGBA so alpha survives copies.
455 SOUND PLAY "sdk/examples/assets/music/adagioforstrings.mid"
457 BLOAD "sdk/examples/assets/resonance_scroll.rgba",SB
458 REM Build the static logo source once, outside the per-frame render path.
460 BLIT FILL SR,640,92,&H00000000,ST
470 GOSUB 4000
474 REM SN() is a small sine table for loops where true SIN would be too costly.
475 GOSUB 4500
500 F=0:A=0:Z=0:PM=0:RT0=PEEK32(&H000F075C)/1000000
502 REM V0 to V5 are reserved for the six VU meter columns.
505 V0=0:V1=0:V2=0:V3=0:V4=0:V5=0

510 REM Per-frame state derives TM from MIDI when possible, then submits layers in
515 REM their required draw order before swapping FB and BB.
520 RT=PEEK32(&H000F075C)/1000000:MP=PEEK32(&H000F0BB0)
530 IF MP>PM THEN TM=MP/44100:PM=MP:GOTO 560
535 REM If the player has not advanced yet, fall back to the machine timer.
540 TM=RT-RT0
555 REM IN is the broad intensity envelope used to open up the visual density.
560 IN=0.12:TI=INT(TM*100)
570 IF TI>=4500 THEN IN=0.28
580 IF TI>=9000 THEN IN=0.55
590 IF TI>=15000 THEN IN=0.9
600 IF TI>=20000 THEN IN=0.22
610 IF TI>=21800 THEN GOTO 3700
616 GOSUB 1500
617 REM Shared trig and table indices. Mode7 still uses real SIN/COS for smoothness.
618 SA=SIN(A):SZ=SIN(Z):CZ=COS(A):AB=INT(A*40.743665) AND 255:AB2=INT(A*2*40.743665) AND 255
619 REM Draw order: texture, rotozoom, foreground fields, bars, late overlays, meters.
620 GOSUB 1600
630 GOSUB 1900
640 GOSUB 1000
650 GOSUB 1300
660 GOSUB 2200
670 IF TI>=4500 THEN GOSUB 2800
675 IF TI>=9000 THEN GOSUB 3100
676 IF TI>=12000 THEN GOSUB 3300
678 IF TI>=15000 THEN GOSUB 3400
679 GOSUB 3500
680 GOTO 900

900 REM Repoint the display at the completed buffer, swap the two addresses, then wait
905 REM for vertical sync before advancing the local animation phases.
910 POKE32 &HF0084,BB:T=FB:FB=BB:BB=T
920 F=F+1
930 IF F>1000000 THEN F=0
940 VSYNC
950 A=A+0.012+IN*0.026:IF A>6.28318 THEN A=A-6.28318
960 Z=Z+0.018+IN*0.04:IF Z>6.28318 THEN Z=Z-6.28318
970 GOTO 510

1000 REM RETRO HARDWARE ENGINE LASER FIELD
1005 REM Two horizontal rails and small glints sit above the Mode7 background.
1010 BLIT FILL BB,640,34,&H00000000,ST
1020 BLIT FILL BB+446*ST,640,34,&H00000000,ST
1030 B1=258+INT(14*SIN(A*1.7)+7*SIN(Z*2.3))+DR*PU
1040 B2=334+INT(16*SIN(Z*1.4)-6*SIN(A*2.1))-DR*INT(PU*0.7)
1050 BLIT FILL BB+B1*ST+92*4,456,7+INT(PU/10),BC1,ST
1060 BLIT FILL BB+B2*ST+76*4,488,6+INT(PU/12),BC2,ST
1070 FOR I=0 TO 7
1080 X=(I*79+F*5+INT(18*SIN(A+I))) AND 639
1090 Y=98+((I*47+F*2) AND 284)
1100 BLIT FILL BB+Y*ST+X*4,10,10,&H00507078,ST
1110 NEXT I
1120 GOSUB 3650
1260 RETURN

1300 REM SLOW STARFIELD DENSITY RAMPS WITH MUSIC
1302 REM Phrase direction reverses the horizontal drift. SN() removes many SIN calls.
1305 SD=1:IF PD<0 THEN SD=-1
1310 N=18+INT(IN*86)+INT(PU*1.4)+INT(PB*0.5)
1320 FOR I=0 TO N
1330 X=(I*73+F*(1+(I AND 3))*SD+INT(PB*9*SD)) AND 639
1340 Y=(I*41+F+INT(28*SN((AB+I*41) AND 255)/1024)) AND 479
1350 C=&H00384030
1360 IF IN>0.5 THEN C=&H00686050
1370 IF IN>0.85 THEN C=&H00E8D890
1380 S=1+(I AND 1):IF IN>0.85 THEN S=2
1385 IF PU>0 THEN S=S+1
1387 IF PB>12 THEN S=S+1
1390 BLIT FILL BB+Y*ST+X*4,S,S,C,ST
1400 NEXT I
1410 RETURN

1500 REM MIDI CHORD PULSE ENVELOPE FOR BARS
1502 REM PU is a short note pulse. DR is the local up or down chord direction.
1505 PU=0:DR=0:BC1=&H00302014:BC2=&H00402818:HC=&H00181824:RC1=&H00384028:RC2=&H00284038
1510 IF TI<62 THEN PU=30:DR=1
1512 IF TI>=88 THEN IF TI<142 THEN PU=16:DR=1
1514 IF TI>=186 THEN IF TI<242 THEN PU=18:DR=1
1516 IF TI>=236 THEN IF TI<308 THEN PU=28:DR=-1
1518 IF TI>=384 THEN IF TI<442 THEN PU=20:DR=1
1520 IF TI>=478 THEN IF TI<538 THEN PU=22:DR=1
1522 IF TI>=572 THEN IF TI<630 THEN PU=20:DR=-1
1524 IF TI>=666 THEN IF TI<726 THEN PU=22:DR=1
1526 IF TI>=762 THEN IF TI<822 THEN PU=24:DR=1
1528 IF TI>=855 THEN IF TI<914 THEN PU=18:DR=-1
1530 IF TI>=948 THEN IF TI<1010 THEN PU=22:DR=1
1532 IF TI>=1170 THEN IF TI<1245 THEN PU=26:DR=-1
1534 IF TI>=1230 THEN IF TI<1280 THEN PU=18:DR=1
1536 IF TI>=1320 THEN IF TI<1370 THEN PU=18:DR=1
1538 IF TI>=1410 THEN IF TI<1460 THEN PU=17:DR=-1
1540 IF TI>=1505 THEN IF TI<1555 THEN PU=20:DR=1
1542 IF TI>=1555 THEN IF TI<1605 THEN PU=20:DR=-1
1544 IF TI>=1600 THEN IF TI<1650 THEN PU=19:DR=1
1546 IF TI>=1685 THEN IF TI<1740 THEN PU=20:DR=1
1548 IF TI>=2200 THEN IF TI<2265 THEN PU=22:DR=1
1550 IF TI>=2330 THEN IF TI<2405 THEN PU=28:DR=-1
1552 IF TI>=2820 THEN IF TI<2900 THEN PU=22:DR=-1
1554 IF TI>=4250 THEN IF TI<4330 THEN PU=24:DR=-1
1556 IF TI>=4790 THEN IF TI<4870 THEN PU=30:DR=-1
1558 IF TI>=5895 THEN IF TI<5975 THEN PU=30:DR=1
1560 IF TI>=7140 THEN IF TI<7225 THEN PU=30:DR=-1
1562 IF TI>=9370 THEN IF TI<9455 THEN PU=32:DR=-1
1564 IF TI>=10475 THEN IF TI<10555 THEN PU=30:DR=-1
1566 IF TI>=11960 THEN IF TI<12050 THEN PU=28:DR=1
1568 IF TI>=14950 THEN IF TI<15045 THEN PU=34:DR=1
1570 IF TI>=16240 THEN IF TI<16325 THEN PU=32:DR=-1
1572 IF TI>=18430 THEN IF TI<18510 THEN PU=34:DR=1
1574 IF TI>=20210 THEN IF TI<20290 THEN PU=34:DR=1
1579 REM PB is phrase brightness. PD is phrase direction: 1 rising, -1 falling.
1580 REM PHRASE-BASED BRIGHTNESS ENVELOPE
1581 PB=0:PD=0
1582 IF TI>=1170 THEN IF TI<2900 THEN PB=INT(4+(TM-11.70)*0.5):PD=1
1583 IF TI>=4250 THEN IF TI<7225 THEN PB=INT(8+5*SIN((TM-42.50)*0.45)):PD=-1
1584 IF TI>=9000 THEN IF TI<12050 THEN PB=INT(11+5*SIN((TM-90)*0.35)):PD=1
1585 IF TI>=12000 THEN IF TI<15045 THEN PB=INT(12+(TM-120)*0.25):PD=1
1586 IF TI>=14950 THEN IF TI<18510 THEN PB=INT(18+8*SIN((TM-149.50)*0.28)):PD=1
1587 IF TI>=18500 THEN IF TI<21800 THEN PB=INT(14-(TM-185)*0.3):PD=-1:IF PB<0 THEN PB=0
1590 IF PU>0 THEN BC1=&H00A8C8D0:BC2=&H00808890:HC=&H00B8A070:RC1=&H00687078:RC2=&H00587078
1592 IF PU>0 THEN IF DR<0 THEN BC1=&H00B8A070:BC2=&H00708088:HC=&H00808890:RC1=&H00706858:RC2=&H00586070
1599 RETURN

1600 REM BUILD LOW-CONTRAST PLASMA/TUNNEL TEXTURE
1605 REM Rebuild the texture each frame so colour, panels, and the logo wobble stay live.
1610 BLIT FILL TX,TW,TH,&H00000000,TS
1620 C1=&H00060818:C2=&H0010182A:C3=&H00201824
1630 IF IN>0.5 THEN C2=&H00283038:C3=&H00403034
1640 IF IN>0.85 THEN C2=&H00606058:C3=&H00D0B868
1645 IF PB>10 THEN C2=&H00384850:C3=&H00505860
1647 IF PB>18 THEN C2=&H00808890:C3=&H00D0B868
1650 FOR Y=0 TO 448 STEP 64
1660 BLIT FILL TX+Y*TS,1024,16,C1,TS
1670 BLIT FILL TX+(Y+20)*TS,1024,10,C2,TS
1680 BLIT FILL TX+(Y+40)*TS,1024,6,C3,TS
1690 NEXT Y
1700 FOR X=0 TO 960 STEP 128
1710 BLIT FILL TX+X*4,8,512,&H000A1020,TS
1720 NEXT X
1730 FOR I=0 TO 15
1735 REM Moving blocks give the texture depth before it is rotated by Mode7.
1740 X=((I*97+F*5) AND 1023):Y=(I*53+INT(70*SIN(A+I))) AND 511
1750 BLIT FILL TX+Y*TS+X*4,34+INT(IN*70),14,C2,TS
1760 NEXT I
1770 FOR Y=40 TO 448 STEP 96
1780 BLIT FILL TX+Y*TS+96*4,832,10,&H00201812,TS
1790 NEXT Y
1800 LX=192+INT((24+IN*42)*SZ)
1810 LY=204+INT((18+IN*30)*SA)
1815 WD=1:IF PD<0 THEN WD=-1
1818 REM Wobble direction follows the phrase direction. SN() avoids 92 SIN calls.
1820 WA=5+INT(PB*.8)+INT(PU*.18)
1821 ZB=INT(Z*1.4*40.743665) AND 255:YS=5:IF WD<0 THEN YS=-5
1822 FOR YY=0 TO 91
1824 WX=INT(WA*SN((ZB+YY*YS) AND 255)/1024)
1826 BLIT COPY SR+YY*ST,TX+(LY+YY)*TS+(LX+WX)*4,640,1,ST,TS
1828 NEXT YY
1830 RETURN

1900 REM MODE7 ROTOZOOM FROM WORK TEXTURE
1905 REM Keep real SIN/COS here. Table quantisation is too visible on full-screen rotation.
1910 SC=2.5-IN*1.5+SZ*0.18
1920 IF SC<0.72 THEN SC=0.72
1930 CA=CZ/SC:MS=SA/SC
1940 DC=INT(CA*FP):DS=INT(MS*FP)
1950 MU=INT((CU-HW*CA+HH*MS)*FP)
1960 MV=INT((CV-HW*MS-HH*CA)*FP)
1970 BLIT MODE7 TX,BB,640,480,MU,MV,DC,DS,0-DS,DC,1023,511,TS,ST
1980 RETURN

2200 REM COPPER-LIKE HIGHLIGHT BARS IN FRAMEBUFFER
2205 REM These rails sit in screen space and pulse with phrase and note energy.
2210 BH=4+INT(IN*10)+INT(PU/10)
2220 C=&H00181824
2230 IF IN>0.35 THEN C=&H00402010
2240 IF IN>0.85 THEN C=&H00F0D878
2242 IF PB>12 THEN C=&H00708088
2243 IF PB>18 THEN C=&H00D0B868
2245 IF PU>0 THEN C=HC
2250 Y1=80+INT(28*SIN(A)+7*SIN(Z*1.7)+3*SIN(A*3.1))-DR*INT(PU*0.5)
2260 Y2=360+INT(31*SIN(Z)+8*SIN(A*1.9)-4*SIN(Z*2.6))+DR*INT(PU*0.5)
2262 Y1=Y1-PD*INT(PB*1.2)
2264 Y2=Y2-PD*INT(PB*0.9)
2270 BLIT FILL BB+Y1*ST,640,BH,C,ST
2280 BLIT FILL BB+Y2*ST,640,BH,C,ST
2282 IF PD>=0 THEN X=(F*6+INT(PB*11)) AND 639
2284 IF PD<0 THEN X=639-((F*6+INT(PB*11)) AND 639)
2285 IF X>544 THEN X=544
2286 BLIT FILL BB+(Y1+18)*ST+X*4,96,3,C,ST
2287 X2=544-X:IF X2<0 THEN X2=0
2288 BLIT FILL BB+(Y2-18)*ST+X2*4,96,3,C,ST
2290 BLIT FILL BB+110*ST+36*4,16,280,&H00283038,ST
2300 BLIT FILL BB+110*ST+588*4,16,280,&H00283038,ST
2310 RETURN

2800 REM RISING MOTION: WINDOW PULSES AND SIDE BEAMS
2805 REM Introduced after the first build-up, driven by note direction and intensity.
2810 P=INT(42*SIN(A*3)+8*SIN(Z*2.1))+DR*INT(PU*0.7)
2815 Q=INT(38*SIN(Z*2.4)+7*SIN(A*1.6))-DR*INT(PU*0.7)
2820 BLIT FILL BB+(150+P)*ST+138*4,364,5+INT(PU/12),RC1,ST
2830 BLIT FILL BB+(250-Q)*ST+138*4,364,5+INT(PU/12),RC2,ST
2840 BLIT FILL BB+84*ST+(96+P)*4,18,312,&H00102028,ST
2850 BLIT FILL BB+84*ST+(526-P)*4,18,312,&H00102028,ST
2860 BLIT FILL BB+(188+INT(20*SIN(Z)))*ST+270*4,100,8,&H00505860,ST
2870 RETURN

3100 REM MAIN BUILD: PHRASE-DIRECTED PANEL STREAM
3102 REM The panel travel direction follows the current phrase direction.
3105 CD=1:IF PD<0 THEN CD=-1
3110 FOR I=0 TO 5
3120 X=(I*104+F*3*CD+INT(PB*7*CD)) AND 639
3130 Y=72+I*48
3140 BLIT FILL BB+Y*ST+X*4,46,12,&H00403020,ST
3150 BLIT FILL BB+(Y+18)*ST+((X+52) AND 639)*4,40,10,&H00303840,ST
3160 NEXT I
3170 C=&H00606058
3180 BLIT FILL BB+(120+INT(46*SIN(A)))*ST,640,5,C,ST
3190 BLIT FILL BB+(360+INT(46*SIN(Z)))*ST,640,5,C,ST
3200 RETURN

3300 REM PRE-CRESCENDO STEEL GLINTS
3305 REM Narrow glints prepare the screen for the denser crescendo section.
3310 Y=176+INT(42*SIN(A*1.8)+8*SIN(Z*2.4))
3320 BLIT FILL BB+Y*ST,640,5,&H00587078,ST
3330 Y=318+INT(46*SIN(Z*1.7)-7*SIN(A*2.2))
3340 BLIT FILL BB+Y*ST,640,5,&H00687078,ST
3350 GX=(F*4+INT(PB*13)) AND 447
3355 X=96+GX:IF PD<0 THEN X=543-GX
3360 BLIT FILL BB+86*ST+X*4,14,286,&H00384850,ST
3370 RETURN

3400 REM CRESCENDO: STEEL/COPPER SWEEP OVERLAY
3405 REM Large sweeps arrive late and remain phrase-directed.
3410 Y=150+INT(76*SIN(A*2)+12*SIN(Z*3.1))
3420 BLIT FILL BB+Y*ST,640,12,&H00808890,ST
3430 Y=298+INT(82*SIN(Z*2.2)-10*SIN(A*2.6))
3440 BLIT FILL BB+Y*ST,640,10,&H00B8A070,ST
3450 CX=(F*(6+PD)+INT(PB*17)) AND 511
3460 X=64+CX:IF X>616 THEN X=616
3465 BLIT FILL BB+72*ST+X*4,24,336,&H00485060,ST
3470 CX=(F*(6-PD)+INT(PB*13)) AND 511
3475 X=568-CX:IF X<0 THEN X=0
3480 BLIT FILL BB+84*ST+X*4,18,308,&H00808890,ST
3490 RETURN

3500 REM PROTRACKER-STYLE MIDI VU METERS
3502 REM Six columns show low to high phrase energy. V0 to V5 are meter state only.
3505 T0=8+INT(PB*.9)+INT(PU*.8)+INT(IN*10)
3510 T1=6+INT(PB*.7)+INT(PU*.5)+INT(8*ABS(SIN(A*1.7)))
3515 T2=5+INT(PB*.5)+INT(PU*.4)+INT(7*ABS(SIN(Z*1.4)))
3520 T3=5+INT(PB*.5)+INT(PU*.4)+INT(7*ABS(SIN(A*1.9)))
3525 T4=6+INT(PB*.7)+INT(PU*.5)+INT(8*ABS(SIN(Z*1.6)))
3530 T5=8+INT(PB*.9)+INT(PU*.8)+INT(IN*10)
3535 IF PD>0 THEN T0=T0+6:T1=T1+4:T2=T2+2
3540 IF PD<0 THEN T3=T3+2:T4=T4+4:T5=T5+6
3545 IF V0<T0 THEN V0=T0 ELSE V0=V0-2:IF V0<0 THEN V0=0
3550 IF V1<T1 THEN V1=T1 ELSE V1=V1-2:IF V1<0 THEN V1=0
3555 IF V2<T2 THEN V2=T2 ELSE V2=V2-2:IF V2<0 THEN V2=0
3560 IF V3<T3 THEN V3=T3 ELSE V3=V3-2:IF V3<0 THEN V3=0
3565 IF V4<T4 THEN V4=T4 ELSE V4=V4-2:IF V4<0 THEN V4=0
3570 IF V5<T5 THEN V5=T5 ELSE V5=V5-2:IF V5<0 THEN V5=0
3575 IF V0>58 THEN V0=58
3580 IF V1>58 THEN V1=58
3585 IF V2>58 THEN V2=58
3590 IF V3>58 THEN V3=58
3595 IF V4>58 THEN V4=58
3600 IF V5>58 THEN V5=58
3605 Y=444
3610 BLIT FILL BB+386*ST+58*4,54,62,&H00101820,ST:BLIT FILL BB+(Y-V0)*ST+64*4,8,V0,&H00A87058,ST:BLIT FILL BB+(Y-V1)*ST+80*4,8,V1,&H00708088,ST:BLIT FILL BB+(Y-V2)*ST+96*4,8,V2,&H00A8C8D0,ST
3615 BLIT FILL BB+386*ST+528*4,54,62,&H00101820,ST:BLIT FILL BB+(Y-V3)*ST+536*4,8,V3,&H00A8C8D0,ST:BLIT FILL BB+(Y-V4)*ST+552*4,8,V4,&H00708088,ST:BLIT FILL BB+(Y-V5)*ST+568*4,8,V5,&H00A87058,ST
3620 GOSUB 3635
3625 RETURN

3634 REM The strip is alpha-copied in 16-pixel cells over the live scene.
3635 REM LONG TRANSPARENT SINUS SCROLLTEXT BETWEEN VU METERS
3636 SC=(F*3) AND 16383
3637 FOR I=0 TO 24
3638 SX=(SC+I*16) AND 16383:IF SX>16368 THEN SX=0
3639 X=124+I*16:Y=405+INT(7*SN((AB2+I*14) AND 255)/1024)
3640 POKE32 &HF0024,SB+SX*4:POKE32 &HF0028,BB+Y*ST+X*4:POKE32 &HF002C,16:POKE32 &HF0030,33
3641 POKE32 &HF0034,SS:POKE32 &HF0038,ST:POKE32 &HF0020,4:POKE32 &HF001C,1
3642 NEXT I
3643 RETURN

3650 REM ENGINE LIGHT SWEEP ARRAY
3652 REM Extra screen-space sweeps are enabled as intensity rises.
3655 S1=104+INT(18*SIN(A*1.3)+9*SIN(Z*2.1))
3660 S2=382+INT(22*SIN(Z*1.5)-8*SIN(A*2.4))
3665 BLIT FILL BB+S1*ST+68*4,504,5,&H00485060,ST
3670 BLIT FILL BB+(S1+42)*ST+112*4,416,4,&H00303840,ST
3675 IF IN<0.5 THEN RETURN
3680 BLIT FILL BB+S2*ST+76*4,488,6,&H00687078,ST
3685 X=88+((F*3) AND 463)
3690 IF PD<0 THEN X=600-((F*3+INT(PB*9)) AND 463)
3695 IF PD>0 THEN X=88+((F*3+INT(PB*9)) AND 463)
3696 BLIT FILL BB+116*ST+X*4,20,236,&H00283038,ST
3697 IF IN<0.85 THEN RETURN
3698 X=568-((F*5) AND 511)
3699 BLIT FILL BB+92*ST+X*4,18,300,&H00808890,ST:RETURN

3700 REM STOP MUSIC, FADE FULL SCREEN TO BLACK, RETURN TO BASIC
3705 REM End cleanly when the scripted duration has elapsed.
3710 SOUND PLAY STOP
3720 FOR K=40 TO 0 STEP -1
3730 C=INT(K*1.6)
3740 CC=C*65536+C*256+C
3750 BLIT FILL FB,640,480,CC,ST
3760 VSYNC
3770 NEXT K
3780 BLIT FILL FB,640,480,&H00000000,ST
3790 COPPER OFF
3800 POKE32 &HF0004,7
3810 POKE32 &HF0080,0
3820 POKE32 &HF0000,1
3830 PRINT "INTUITION ENGINE"
3840 END

4000 REM INTUITION ENGINE SOURCE LOGO
4005 REM This block draws the source logo into SR using only hardware fills.
4010 LC=&H00A8C8D0:MC=&H00485060
4020 Y=6:X=212:GOSUB 4300
4030 X=X+26:GOSUB 4310
4040 X=X+26:GOSUB 4320
4050 X=X+26:GOSUB 4330
4060 X=X+26:GOSUB 4300
4070 X=X+26:GOSUB 4320
4080 X=X+26:GOSUB 4300
4090 X=X+26:GOSUB 4340
4100 X=X+26:GOSUB 4310
4110 Y=52:X=250:GOSUB 4350
4120 X=X+26:GOSUB 4310
4130 X=X+26:GOSUB 4360
4140 X=X+26:GOSUB 4300
4150 X=X+26:GOSUB 4310
4160 X=X+26:GOSUB 4350
4180 RETURN

4295 REM Compact block letters used only for the Mode7 source logo.
4300 REM LETTER I
4302 BLIT FILL SR+Y*ST+X*4,20,5,LC,ST
4304 BLIT FILL SR+(Y+28)*ST+X*4,20,5,LC,ST
4306 BLIT FILL SR+Y*ST+(X+8)*4,5,33,LC,ST
4308 RETURN
4310 REM LETTER N
4312 BLIT FILL SR+Y*ST+X*4,5,33,LC,ST
4314 BLIT FILL SR+Y*ST+(X+15)*4,5,33,LC,ST
4316 BLIT FILL SR+(Y+8)*ST+(X+6)*4,5,17,MC,ST
4318 RETURN
4320 REM LETTER T
4322 BLIT FILL SR+Y*ST+X*4,20,5,LC,ST
4324 BLIT FILL SR+Y*ST+(X+8)*4,5,33,LC,ST
4326 RETURN
4330 REM LETTER U
4332 BLIT FILL SR+Y*ST+X*4,5,28,LC,ST
4334 BLIT FILL SR+Y*ST+(X+15)*4,5,28,LC,ST
4336 BLIT FILL SR+(Y+28)*ST+X*4,20,5,LC,ST
4338 RETURN
4340 REM LETTER O
4342 BLIT FILL SR+Y*ST+X*4,20,5,LC,ST
4344 BLIT FILL SR+(Y+28)*ST+X*4,20,5,LC,ST
4346 BLIT FILL SR+Y*ST+X*4,5,33,LC,ST
4348 BLIT FILL SR+Y*ST+(X+15)*4,5,33,LC,ST
4349 RETURN
4350 REM LETTER E
4352 BLIT FILL SR+Y*ST+X*4,20,5,LC,ST
4354 BLIT FILL SR+(Y+14)*ST+X*4,16,5,LC,ST
4356 BLIT FILL SR+(Y+28)*ST+X*4,20,5,LC,ST
4358 BLIT FILL SR+Y*ST+X*4,5,33,LC,ST
4359 RETURN
4360 REM LETTER G
4362 BLIT FILL SR+Y*ST+X*4,20,5,LC,ST
4364 BLIT FILL SR+(Y+28)*ST+X*4,20,5,LC,ST
4366 BLIT FILL SR+Y*ST+X*4,5,33,LC,ST
4368 BLIT FILL SR+(Y+14)*ST+(X+10)*4,10,5,MC,ST
4369 BLIT FILL SR+(Y+14)*ST+(X+15)*4,5,19,LC,ST
4370 RETURN

4400 REM SCROLLTEXT ASSET MESSAGE:
4405 REM WELCOME TO RESONANCE BY INTUITION - IE64 BASIC JIT-COMPILED TO NATIVE CODE DRIVES A MIDI-SYNCHRONISED MODE7 ROTOZOOM, PHRASE-LINKED COPPER BANDS, HARDWARE BLITTER SWEEPS, STARFIELD DRIFT, GLINTS, VU METERS AND SINUS SCROLLTEXT - MUSIC IS BARBER'S ADAGIO FOR STRINGS BY WILLIAM ORBIT (1995), SYNTHESISED IN REAL TIME BY THE RAWLANDMINI PATCHSET - ALL EFFECTS ARE TIMED FROM THE LIVE MIDI PLAYBACK CLOCK - GREETS TO ALL DEMOSCENERS - VISIT WWW.INTUITIONSUBSYNTH.COM

4500 REM 256-ENTRY SINE LOOKUP TABLE FOR LOOP-HEAVY EFFECTS
4510 DIM SN(255)
4520 FOR I=0 TO 255
4530 SN(I)=INT(1024*SIN(I*6.28318/256))
4540 NEXT I
4550 RETURN
