diff --git a/piraatti_intro.ras b/piraatti_intro.ras index 10b30ef..c5688e4 100644 --- a/piraatti_intro.ras +++ b/piraatti_intro.ras @@ -1,12 +1,12 @@ /** * Single file C64 intro - * + * * Finnish Pirate Party election campaign 2023 */ program PiraattiIntro; var -/* +/* Demo part flags */ @define partNone 0 @@ -17,25 +17,25 @@ var @define partLogoBarWobble 5 @define partBounceBarUp 6 @define partMain 7 - + currentPart : byte = @partNone; currentTime : integer = 0; currentPartDone : boolean = true; - -/* + +/* Main screen state flags */ @define mainShowText 0 @define mainFadeToPicture 1 @define mainPicture 2 @define mainFadeToText 3 - + mainState : byte = @mainPicture; - mainTime : integer = 0; - + mainTime : integer = 0; + /* Opening writer main variables -*/ +*/ bTime, curWait, curCol, i : byte = 0; tp, sp: pointer; onPause, bigSprite : boolean; @@ -58,23 +58,23 @@ var @define spriteLoc $3c80 @define charSetCopyLoc $c000 @define spriteBank 0 - + lookup3Dx : array[40] of integer = buildtable("300 * (i - 20) / 200"); lookup3Dy : array[25] of integer = buildtable("300 * (i - 11) / 30"); - + flightColFade : array[] of byte = ($01, $0c, $01, $0b, $01, $00, $0f, $00, $01); @define betweencharpause 8 - + /* - Writer text. + Writer text. @cmoveto moves the cursor to the x/y position @ccolor sets color @cpause initializes a pause */ text : string = (@cmoveto, 6,10, - "TIETOYHTEISKUNTA TARVITSEE ", @cpause,12, + "TIETOYHTEISKUNTA TARVITSEE ", @cpause,12, @cmoveto, 10,12, "TEKNOLOGIAPUOLUEEN ", @cpause,32, @cstop); @@ -89,12 +89,12 @@ text : string = (@cmoveto, 6,10, fastPlasmaSweep : array[256] of byte = buildtable("10 * (-Math.cos(2 * i * 6.28 / 256) * 0.5 + 0.5)"); textPlStartX : byte = 0; - textPlStartY : byte = 0; - textPlEndX : byte = 40; - textPlEndY : byte = 7; + textPlStartY : byte = 0; + textPlEndX : byte = 40; + textPlEndY : byte = 7; textPlOfsX, textPlOfsY : byte = 0; - textPlAdd : byte = 0; - + textPlAdd : byte = 0; + textBlinkOfs : byte = 0; /* @@ -103,92 +103,92 @@ text : string = (@cmoveto, 6,10, @define purpleBarBounceSize 128 @define purpleBarDefaultCenter 180 @define purpleBarCenterOffset 17 - - purpleBarBounce : array[@purpleBarBounceSize] of byte = buildtable("17 * Math.abs( (i <= 64) ? Math.exp(5*((i/64)-1)) : 1 - ( Math.abs(Math.cos( ((i/64)+0.5) * 3.1415 )) / Math.pow((i/64),2) ) )") at $5a00; - purpleBarBounce2 : array[@purpleBarBounceSize] of byte = buildtable("60 + 120 * (Math.pow(2, -8 * (i/128)))") at $5a80; + + purpleBarBounce : array[@purpleBarBounceSize] of byte = buildtable("17 * Math.abs( (i <= 64) ? Math.exp(5*((i/64)-1)) : 1 - ( Math.abs(Math.cos( ((i/64)+0.5) * 3.1415 )) / Math.pow((i/64),2) ) )") at $5a00; + purpleBarBounce2 : array[@purpleBarBounceSize] of byte = buildtable("60 + 120 * (Math.pow(2, -8 * (i/128)))") at $5a80; purpleBounceOfs : byte = 0; purpleBarCenter : byte = @purpleBarDefaultCenter; bgColBefore, fgColBefore : byte = 0; - purpleBarStartRasterLine : byte = @purpleBarDefaultCenter - 17; + purpleBarStartRasterLine : byte = @purpleBarDefaultCenter - 17; purpleBarEndRasterLine : byte = @purpleBarDefaultCenter + 17; - -/* + +/* Sprite bounce variables */ @define spriteBounceSpriteWidth 24 @define spriteBounceSize 128 @define spriteBarCenterOffset 10 - - spriteBounce : array[@spriteBounceSize] of integer = buildtable("300 - 300 * Math.abs( (i <= 64) ? Math.exp(5*((i/64)-1)) : (1 - ( Math.abs(Math.cos( ((i/64)+0.5) * 3.1415 )) / Math.pow((i/64),2) ) ) - ( (i/64) / 12 ) )") at $5b00; + + spriteBounce : array[@spriteBounceSize] of integer = buildtable("300 - 300 * Math.abs( (i <= 64) ? Math.exp(5*((i/64)-1)) : (1 - ( Math.abs(Math.cos( ((i/64)+0.5) * 3.1415 )) / Math.pow((i/64),2) ) ) - ( (i/64) / 12 ) )") at $5b00; spriteBounceOfs : byte = 0; spriteBounceStartY : byte = 170; spriteBounceStartX : byte = 24; spriteBounceXCurrent : integer = 0; - + // Export all sprites automatically on each build @define spriteLocBounce0 $3d00 @define spriteLocBounce $0000 - - @export "resources/sprites/piraattilogo-hires.flf" "resources/sprites/piraattilogo-hires.bin" 0 - bounceSpritesBank0:incbin("resources/sprites/piraattilogo-hires.bin", @spriteLocBounce0); - bounceSpritesBank1:incbin("resources/sprites/piraattilogo-hires.bin", @spriteLocBounce + $4000); + + @export "resources/sprites/piraattilogo-hires.flf" "resources/sprites/piraattilogo-hires.bin" 0 + bounceSpritesBank0:incbin("resources/sprites/piraattilogo-hires.bin", @spriteLocBounce0); + bounceSpritesBank1:incbin("resources/sprites/piraattilogo-hires.bin", @spriteLocBounce + $4000); @define spriteLocCEquals0 $3f00 @define spriteLocCEquals $0200 - - @export "resources/sprites/c-equals-2x1-hires.flf" "resources/sprites/c-equals-2x1-hires.bin" 0 - cEqualsSpritesBank0:incbin("resources/sprites/c-equals-2x1-hires.bin", @spriteLocCEquals0); - cEqualsSpritesBank1:incbin("resources/sprites/c-equals-2x1-hires.bin", @spriteLocCEquals + $4000); + + @export "resources/sprites/c-equals-2x1-hires.flf" "resources/sprites/c-equals-2x1-hires.bin" 0 + cEqualsSpritesBank0:incbin("resources/sprites/c-equals-2x1-hires.bin", @spriteLocCEquals0); + cEqualsSpritesBank1:incbin("resources/sprites/c-equals-2x1-hires.bin", @spriteLocCEquals + $4000); @define spriteWobbleSize 256 spriteWobble : array[@spriteWobbleSize] of byte = buildtable("78 + 10 * ( ( (i <= 127) ? (i/128) : ((256-i)/128) ) * Math.sin(i/4) )"); spriteWobbleEasy : array[@spriteWobbleSize] of byte = buildtable("78 + 10 * ( ( (i <= 127) ? (i/128) : ((256-i)/128) ) * Math.sin(i/10) )"); spriteWobblePtr : pointer; - + spriteWobbleOfs : byte = 0; flagOrCequals : boolean = false; - + /* Screen fade variables */ @define textFadeLumiLast 21 textFadeLumi : array[] of byte = ($01, $01,$01, $01, $07, $07, $0d, $0d, $03, $03, $03, $03, $03, $0e, $0e, $0e, $0e, $0e, $0b, $0b, $00, $00); textFadeReverse : array[] of byte = ($0, $0, $0, $0, $0b, $0b, $0b, $0e, $0e, $0e, $03, $03, $03, $0d, $0d, $0d, $07, $07, $07, $01, $01, $01); - + @define fadeStateBorder 0 @define fadeStateText 1 @define fadeStateAll 2 - + fadeStateCurrent : byte = @fadeStateBorder; fadeOfsCurrent : byte = 0; fadeTemp : byte = 0; - -/* + +/* Main part */ - @define mainpart_bitmapArea $6000 // <-- VIDEO BUFFER IS HERE!! - + @define mainpart_bitmapArea $6000 // <-- VIDEO BUFFER IS HERE!! + @define piraattinaamat1_color $5200 @define piraattinaamat1_data $8000 - @export "resources/images/piraattinaamat-1.flf" "resources/images/piraattinaamat-1.bin" 0 - naamat1Color:incbin("resources/images/piraattinaamat-1_color.bin", @piraattinaamat1_color); - naamat1Data:incbin("resources/images/piraattinaamat-1_data.bin", @piraattinaamat1_data); + @export "resources/images/piraattinaamat-1.flf" "resources/images/piraattinaamat-1.bin" 0 + naamat1Color:incbin("resources/images/piraattinaamat-1_color.bin", @piraattinaamat1_color); + naamat1Data:incbin("resources/images/piraattinaamat-1_data.bin", @piraattinaamat1_data); @define piraattinaamat2_color $f800 @define piraattinaamat2_data $a000 - @export "resources/images/piraattinaamat-2.flf" "resources/images/piraattinaamat-2.bin" 0 - naamat2Color:incbin("resources/images/piraattinaamat-2_color.bin", @piraattinaamat2_color); - naamat2Data:incbin("resources/images/piraattinaamat-2_data.bin", @piraattinaamat2_data); + @export "resources/images/piraattinaamat-2.flf" "resources/images/piraattinaamat-2.bin" 0 + naamat2Color:incbin("resources/images/piraattinaamat-2_color.bin", @piraattinaamat2_color); + naamat2Data:incbin("resources/images/piraattinaamat-2_data.bin", @piraattinaamat2_data); + - @define naamaCoordEhdokas 0 @define naamaCoordStartX 1 @define naamaCoordStartY 2 @define naamaCoordWidth 3 @define naamaCoordHeight 4 - + naamatAddresses : array[] of integer = ( @piraattinaamat1_data, @piraattinaamat1_color, @piraattinaamat1_data, @piraattinaamat1_color, @piraattinaamat1_data, @piraattinaamat1_color, @@ -202,22 +202,22 @@ text : string = (@cmoveto, 6,10, @piraattinaamat2_data, @piraattinaamat2_color, @piraattinaamat2_data, @piraattinaamat2_color, @piraattinaamat2_data, @piraattinaamat2_color); - - naamatCoordinates : array[] of byte = ( 0, 0, 13, 12, + + naamatCoordinates : array[] of byte = ( 0, 0, 13, 12, 13, 0, 13, 12, 26, 0, 13, 12, - 0, 12, 13, 12, - 13, 12, 13, 12, + 0, 12, 13, 12, + 13, 12, 13, 12, 26, 12, 13, 12, - 0, 0, 13, 12, + 0, 0, 13, 12, 13, 0, 13, 12, 26, 0, 13, 12, - 0, 12, 13, 12, - 13, 12, 13, 12, + 0, 12, 13, 12, + 13, 12, 13, 12, 26, 12, 13, 12); - - naamatNames : string = ( + + naamatNames : string = ( "TONI AITTONIEMI - UUSIMAA", @cpause, "JUHO KARVINEN - PIRKANMAA", @cpause, "RIIKKA NIEMINEN - UUSIMAA", @cpause, @@ -231,19 +231,19 @@ text : string = (@cmoveto, 6,10, "PYRY SAARELA - VARSINAIS-SUOMI", @cpause, "KAUSTI RANTALAINEN - HELSINKI", @cpause, "ARI-PEKKA PULKKIS - VAASA", @cpause, @cstop ); - - naamatNumbers : string = ( "123", "456", "789", " 10", "20 ", " 30", - " 40", "50 ", " 60", " 70", " 80", " 90", @cstop); - - tab320 : array[25] of integer = buildtable("i*320"); - tab40 : array[25] of integer = buildtable("i*40"); + naamatNumbers : string = ( "123", "456", "789", " 10", "20 ", " 30", + " 40", "50 ", " 60", " 70", " 80", " 90", @cstop); + + + tab320 : array[25] of integer = buildtable("i*320"); + tab40 : array[25] of integer = buildtable("i*40"); @define numberSpriteCopies $5800 numberSprite0loc : byte = @numberSpriteCopies / 64 + 0; numberSprite1loc : byte = @numberSpriteCopies / 64 + 1; numberSprite2loc : byte = @numberSpriteCopies / 64 + 2; - + numberSpriteFloatX : array[256] of byte = buildtable("Math.sin(i * (2 * 6.28 / 256)) * 7 + Math.cos(i * 6.28 / 256) * 20") at $5c00; numberSpriteFloatY : array[256] of byte = buildtable("Math.cos(i * (3 * 6.28 / 256)) * 5") at $5d00; numberSprite0FloatOfs : byte = 15; @@ -252,82 +252,82 @@ text : string = (@cmoveto, 6,10, numberSprite3FloatOfs : byte = 0; numberSprite4FloatOfs : byte = 15; numberSprite5FloatOfs : byte = 30; - + @define mainPartBigFontLoc $4800 mainPartBigFont:incbin("resources/charsets/broadway_xy.bin", @mainPartBigFontLoc); - + @define numMainTextPages 6 - mainText : string = ( @cmoveto, 0, 3, " COMMODORELLA ", - @cmoveto, 0, 4, " EDUSKUNTAAN ", - @cmoveto, 0, 5, " 2023 ", + mainText : string = ( @cmoveto, 0, 3, " COMMODORELLA ", + @cmoveto, 0, 4, " EDUSKUNTAAN ", + @cmoveto, 0, 5, " 2023 ", @cpage, - @cmoveto, 0, 2, " RADIKAALISTI ", - @cmoveto, 0, 3, " AVOINTA ", - @cmoveto, 0, 4, " DEMOKRATIAA ", + @cmoveto, 0, 2, " RADIKAALISTI ", + @cmoveto, 0, 3, " AVOINTA ", + @cmoveto, 0, 4, " DEMOKRATIAA ", @cmoveto, 0, 5, " VALTIONHALLINNON ", - @cmoveto, 0, 6, " LIVESTREAMAUS ", + @cmoveto, 0, 6, " LIVESTREAMAUS ", @cmoveto, 0, 7, " LAHTOKOHTAISESTI ", @cpage, @cmoveto, 0, 2, " LOBBAUS NAKYVAKSI ", @cmoveto, 0, 3, " LAAJA JULKISUUSLAKI", @cmoveto, 0, 4, "KANSANAANESTYSALOITE", - @cmoveto, 0, 5, " RAHANKERAYSLAIN ", - @cmoveto, 0, 6, " UUDISTUS ", - @cmoveto, 0, 7, " PERUSTULO ", + @cmoveto, 0, 5, " RAHANKERAYSLAIN ", + @cmoveto, 0, 6, " UUDISTUS ", + @cmoveto, 0, 7, " PERUSTULO ", @cpage, - @cmoveto, 0, 2, " PERUSOIKEUDET ", + @cmoveto, 0, 2, " PERUSOIKEUDET ", @cmoveto, 0, 3, " YKSITYISYYDENSUOJA ", - @cmoveto, 0, 4, " YHDENVERTAISUUS ", + @cmoveto, 0, 4, " YHDENVERTAISUUS ", @cmoveto, 0, 5, " KESTAVYYSSIIRTYMA ", - @cmoveto, 0, 6, " VETYTALOUDEN ", - @cmoveto, 0, 7, " TEKNOLOGIATUKI ", + @cmoveto, 0, 6, " VETYTALOUDEN ", + @cmoveto, 0, 7, " TEKNOLOGIATUKI ", @cpage, @cmoveto, 0, 2, " HYVINVOINTIALUEIDEN", @cmoveto, 0, 3, " VERONKANTO-OIKEUS ", @cmoveto, 0, 4, "PAIKALLISDEMOKRATIAN", - @cmoveto, 0, 5, " VAHVISTAMINEN ", + @cmoveto, 0, 5, " VAHVISTAMINEN ", @cmoveto, 0, 6, " LUONTO MAANKAYTTO ", - @cmoveto, 0, 7, " KESTAVYYS ", + @cmoveto, 0, 7, " KESTAVYYS ", @cpage, - @cmoveto, 0, 3, " TIETOPOLITIIKAN ", + @cmoveto, 0, 3, " TIETOPOLITIIKAN ", @cmoveto, 0, 4, " VAKIINNUTTAMINEN ", @cmoveto, 0, 5, " OSAKSI HALLINTO- ", - @cmoveto, 0, 6, " RAKENNETTA ", + @cmoveto, 0, 6, " RAKENNETTA ", @cpage, @cstop); - + mainPartAddressTable : array[25] of integer; colorAddressTable : array[25] of integer; - + @define mainPartSmallFontLoc $5000 mainPartSmallFont:incbin("resources/charsets/cavelon.bin", @mainPartSmallFontLoc); - + naamatDataPtr, naamatColorPtr : pointer; numbersPtr, namesPtr : pointer; - + pictureFade, textFade, numbersFade, nameFade : integer = 0; - + currentNaama : byte = 0; - + rasterLineMainCandidateText : byte = 180; - rasterLineMainScroller : byte = 240; - + rasterLineMainScroller : byte = 240; + // TODO optimize spaces - scrollText : string = " YARRRR SAILORS WELCOME TO THE FINNISH PIRATE PARTY PARLIAMENTARY ELECTION 2023 INTRO --- VOTE FOR US --- WE ROCK THE WORLD IN 8 BITS AND BEYOND --- WRITTEN BY GIMLE IN TRSE --- MUSIC BY GIMLE IN SIDFACTORY II --- MUCH LOVE AND GREETINGS TO THE C64 DEMOSCENE --- WE SALUTE SOME GROUNDBREAKING TECHNOLOGICAL PIRATES --- FINNISH GOLD - EXTEND - VIRTUAL DREAMS - FAIRLIGHT - BYTERAPERS - BLOODSUCKERS - ARTLINE DESIGNS - DEKADENCE - BOOZE DESIGN - ACCESSION - NOICE - PROXIMA - ORANGE - CNCD - KEWLERS - MFX - TPOLM - MATUREFURK - KATASTRO FI - SCOOPEX - TAAT - HEDELMAE - JUMALAUTA - KAITA FILMITUOTANTO - BRAINLEZ CODERS - SYMPTOM - GOTO 10 - DAMONES - DA JORMAS - WIDE LOAD - HIRMU --- "; + scrollText : string = " YARRRR SAILORS WELCOME TO THE FINNISH PIRATE PARTY PARLIAMENTARY ELECTION 2023 INTRO --- VOTE FOR US --- WE ROCK THE WORLD IN 8 BITS AND BEYOND --- WRITTEN BY GIMLE IN TRSE --- MUSIC BY GIMLE IN SIDFACTORY II --- MUCH LOVE AND GREETINGS TO THE C64 DEMOSCENE --- WE SALUTE SOME GROUNDBREAKING TECHNOLOGICAL PIRATES --- FINNISH GOLD - EXTEND - VIRTUAL DREAMS - FAIRLIGHT - BYTERAPERS - BLOODSUCKERS - ARTLINE DESIGNS - DEKADENCE - BOOZE DESIGN - ACCESSION - NOICE - PROXIMA - ORANGE - CNCD - KEWLERS - MFX - TPOLM - MATUREFURK - KATASTRO FI - SCOOPEX - TAAT - HEDELMAE - JUMALAUTA - KAITA FILMITUOTANTO - BRAINLEZ CODERS - SYMPTOM - GOTO 10 - DAMONES - DA JORMAS - WIDE LOAD - HIRMU --- "; scrollTextOffset : integer = 0; scrollTextLength : integer = 0; scrollCurrent : byte = 0; scrollFlashTimer : integer = 0; - + /* Music */ sidfile:incsid("resources/sid/piraattimusa.sid", 2); - + /* General flags */ @define useKernal 0 - + /* Spare pointers */ @@ -335,7 +335,7 @@ text : string = (@cmoveto, 6,10, tempInt : integer; //=========================================================================================================== -// Raster interrupt forward declarations +// Raster interrupt forward declarations //=========================================================================================================== interrupt MainRaster(); @@ -379,27 +379,27 @@ end; procedure CopyCharsetRomToRam(targetHi : byte); begin asm(" - ldx #$08 ; we loop 8 times (8x255 = 2Kb) - lda #$33 ; make the CPU see the Character Generator ROM... - sta $01 ; ...at $D000 by storing %00110011 into location $01 - lda #$d0 ; load high byte of $D000 - sta $fc ; store it in a free location we use as vector - ldy #$00 ; init counter with 0 - sty $fb ; store it as low byte in the $FB/$FC vector - lda $fd ; second pair in $FD/$FE - lda targetHi ; point to target - sta $fe + ldx #$08 ; we loop 8 times (8x255 = 2Kb) + lda #$33 ; make the CPU see the Character Generator ROM... + sta $01 ; ...at $D000 by storing %00110011 into location $01 + lda #$d0 ; load high byte of $D000 + sta $fc ; store it in a free location we use as vector + ldy #$00 ; init counter with 0 + sty $fb ; store it as low byte in the $FB/$FC vector + lda $fd ; second pair in $FD/$FE + lda targetHi ; point to target + sta $fe -loopc lda ($fb),y ; read byte from vector stored in $fb/$fc - sta ($fd),y ; write to the RAM - iny ; do this 255 times... - bne loopc ; ..for low byte $00 to $FF - inc $fc ; when we passed $FF increase high byte... - inc $fe - dex ; ... and decrease X by one before restart - bne loopc ; We repeat this until X becomes Zero - lda #$37 ; switch in I/O mapped registers again... - sta $01 ; ... with %00110111 so CPU can see them +loopc lda ($fb),y ; read byte from vector stored in $fb/$fc + sta ($fd),y ; write to the RAM + iny ; do this 255 times... + bne loopc ; ..for low byte $00 to $FF + inc $fc ; when we passed $FF increase high byte... + inc $fe + dex ; ... and decrease X by one before restart + bne loopc ; We repeat this until X becomes Zero + lda #$37 ; switch in I/O mapped registers again... + sta $01 ; ... with %00110111 so CPU can see them "); end; @@ -408,7 +408,7 @@ end; * Triple each bit in char both vertical and horizontal */ procedure PrintCharToSprite(char:byte, charsetptr, sPtr:pointer); -var +var chrBitMask : array[] of byte = ($01, $02, $04, $08, $10, $20, $40, $80); sprBitMask : array[] of byte = ($07, $38, $c0, $01, $0e, $70, $80, $03, $1c, $e0); sprOffset : array[] of byte = ($02, $02, $02, $01, $01, $01, $01, $00, $00, $00); @@ -421,9 +421,9 @@ var k : byte; begin while (char > 64) do char -= 64; - + tempPtr1 := charsetptr + char * 8; - + for k:=0 to 8 do begin temp[0] := 0; temp[1] := 0; @@ -431,7 +431,7 @@ begin for i:=0 to 10 do begin charTemp := tempPtr1[0] & chrBitMask[sprChrBit[i]]; sprOfsTemp := sprOffset[i]; - if charTemp then temp[sprOfsTemp] := temp[sprOfsTemp] | sprBitMask[i]; + if charTemp then temp[sprOfsTemp] := temp[sprOfsTemp] | sprBitMask[i]; end; for i:=0 to numLinesPtr[k] do begin sPtr[0] := temp[0]; @@ -441,7 +441,7 @@ begin end; tempPtr1 += 1; end; - + end; procedure PrintDebug(cx, cy, n : byte); @@ -461,7 +461,7 @@ begin tempPtr1[0]:=textPlasmaLumi[4+i]; end; end; - + procedure UpdateTextPlasma(); var iy, ix : byte; begin @@ -481,7 +481,7 @@ begin spriteX += lookup3Dx[x] * curWait; spriteY += lookup3Dy[y] * curWait; - + if (bigSprite) then begin spriteX -= 24; spriteY -= 21; @@ -506,19 +506,19 @@ begin TransformCharToSpriteLoc(textX, textY); SpritePos(spriteX, spriteY, 0); sprite_color[0] := flightColFade[curWait]; - if (bigSprite) then - begin + if (bigSprite) then + begin togglebit(sprite_stretch_x, 0, 1); togglebit(sprite_stretch_y, 0, 1); end else begin togglebit(sprite_stretch_x, 0, 0); - togglebit(sprite_stretch_y, 0, 0); + togglebit(sprite_stretch_y, 0, 0); end; end; dec(curWait); return(); end; - + // Moveto if (tp[0]=@cmoveto) then begin textX:=tp[1]; @@ -528,7 +528,7 @@ begin moveto(tp[1], tp[2], hi(screen_char_loc)); tp:=tp+3; onPause:=false; - + return(); end; @@ -544,7 +544,7 @@ begin // Stop - jump to next IRQ if (tp[0]=@cstop) then begin // jump to next part here - currentPartDone := true; + currentPartDone := true; return(); end; @@ -553,27 +553,27 @@ begin // Subtract 64 if (j>64) then j:=j-64; screenmemory[0]:=j; - + UpdateTextColor(); - - if (j <> KEY_SPACE) then - begin - PlaySound(sid_channel1, + + if (j <> KEY_SPACE) then + begin + PlaySound(sid_channel1, 10, // Volume Random()/128 + 5, // Hi byte frequency 0*16+0, // Attack voice 1 - 15*16 + 3, // Sustain = 16*15 + release=6 + 15*16 + 3, // Sustain = 16*15 + release=6 1 +sid_noise, // Waveform - sid_noise); // waveform - PlaySound(sid_channel2, + sid_noise); // waveform + PlaySound(sid_channel2, 13, // Volume - 6, // Hi byte frequency + 6, // Hi byte frequency 0*16+0, // Attack voice 1 - 4*16 + 3, // Sustain = 16*15 + release=6 + 4*16 + 3, // Sustain = 16*15 + release=6 1 + sid_tri, // Waveform - sid_tri); // waveform + sid_tri); // waveform end; - + // Increase tex,color and screen pointers tp:=tp+1; sp:=sp+1; @@ -583,7 +583,7 @@ begin // print next char on sprite if (j <> charOnSprite0) then PrintCharToSprite(j, @charSetCopyLoc, @spriteLoc); - + // PrintDebug(0, 24, textX); // PrintDebug(3, 24, textY); @@ -592,7 +592,7 @@ end; /** * Write 2x2 text on screen (vic bank 1) * - * input: + * input: * tp : pointer - text * */ @@ -620,18 +620,18 @@ begin sp[1] := k+1; sp[40] := k+2; sp[41] := k+3; - + tp += 1; sp += 2; end; end; - tp += 1; + tp += 1; end; /** * Write 1x1 text in bottom of main screen - * input: + * input: * namesPtr : pointer - text */ @@ -643,9 +643,9 @@ begin j := namesPtr[0]; if (j = KEY_SPACE) then j := 0; if (j > 64) then j := j - 64; - + sp[0] := j; - + namesPtr += 1; x += 1; sp += 1; @@ -660,7 +660,7 @@ procedure WriteScrollText() inline; begin tempPtr1 := #scrollText + scrollTextOffset; memcpyunroll(tempPtr1,0,^$47c0,40); -end; +end; /** * Subtract 64 from the ASCII text @@ -676,14 +676,14 @@ begin tempPtr1[0] := j; tempPtr1 += 1; end; -end; +end; /** * Copies a rectangle of one bitmap + color data to another, assumes width of both to be 320/160 pixels / 40 chars * - * input: + * input: * naamatDataPtr : pointer - bitmap data * naamatColorPtr : pointer - color data */ @@ -692,38 +692,38 @@ begin // copy bitmap data tempPtr1 := naamatDataPtr; tempPtr2 := @mainpart_bitmapArea; - + tempPtr1 += tab320[fromY]; // 40 * 8 bytes on a single row of characters tempPtr2 += tab320[toY]; tempPtr1 += fromX * 8; tempPtr2 += toX * 8; - + j := width * 8; // never call this with width >= 32 !! - for i := 0 to height do + for i := 0 to height do begin memcpy(tempPtr1, 0, tempPtr2, j); tempPtr1 += 320; tempPtr2 += 320; - end; - + end; + // copy color data #1 tempPtr1 := naamatColorPtr + 2; // skip bg & fg colors and go directly to color data tempPtr2 := #screen_char_loc2; - + tempPtr1 += fromY * 40 + fromX; tempPtr2 += toY * 40 + toX; - + for i := 0 to height do begin memcpyfast(tempPtr1, 0, tempPtr2, width); tempPtr1 += 40; tempPtr2 += 40; end; - + // copy color data #2 tempPtr1 := naamatColorPtr + 2 + colordatasize; // skip bg & fg colors and go directly to second color data tempPtr2 := #screen_col_loc; - + tempPtr1 += fromY * 40 + fromX; tempPtr2 += toY * 40 + toX; @@ -744,24 +744,24 @@ begin tempPtr2 := @mainpart_bitmapArea; tempPtr2 += tab320[toY]; tempPtr2 += toX2 * 8; - + j := width2 * 8; // never call this with width >= 32 !! - for i := 0 to height2 do + for i := 0 to height2 do begin fill(tempPtr2, 0, j); tempPtr2 += 320; - end; - - // color data #1 + end; + + // color data #1 tempPtr2 := #screen_char_loc2; tempPtr2 += toY2 * 40 + toX2; - + for i := 0 to height2 do begin fillfast(tempPtr2, 0, width2); tempPtr2 += 40; end; - + // color data #2 tempPtr2 := #screen_col_loc; tempPtr2 += toY2 * 40 + toX2; @@ -790,27 +790,27 @@ begin end; procedure UpdateSpriteXLSBPositions(posx:byte); -begin - poke(SPRITE_POS, 0, posx); - poke(SPRITE_POS, 2, posx + 24); - poke(SPRITE_POS, 4, posx + 48); - poke(SPRITE_POS, 6, posx + 72); - poke(SPRITE_POS, 8, posx + 96); - poke(SPRITE_POS, 10, posx + 120); - poke(SPRITE_POS, 12, posx + 144); - poke(SPRITE_POS, 14, posx + 168); +begin + poke(SPRITE_POS, 0, posx); + poke(SPRITE_POS, 2, posx + 24); + poke(SPRITE_POS, 4, posx + 48); + poke(SPRITE_POS, 6, posx + 72); + poke(SPRITE_POS, 8, posx + 96); + poke(SPRITE_POS, 10, posx + 120); + poke(SPRITE_POS, 12, posx + 144); + poke(SPRITE_POS, 14, posx + 168); end; procedure UpdateSpriteYPositions(posy:byte); -begin +begin poke(SPRITE_POS, 1, posy); poke(SPRITE_POS, 3, posy); poke(SPRITE_POS, 5, posy); - poke(SPRITE_POS, 7, posy); - poke(SPRITE_POS, 9, posy); - poke(SPRITE_POS, 11, posy); - poke(SPRITE_POS, 13, posy); - poke(SPRITE_POS, 15, posy); + poke(SPRITE_POS, 7, posy); + poke(SPRITE_POS, 9, posy); + poke(SPRITE_POS, 11, posy); + poke(SPRITE_POS, 13, posy); + poke(SPRITE_POS, 15, posy); end; procedure InitSpriteWriter(); @@ -920,13 +920,13 @@ procedure UpdateMainPart(); interrupt RasterTextPlasma(); begin startirq(@useKernal); - //screen_bg_col := red; + //screen_bg_col := red; UpdateTextPlasma(); //screen_bg_col := bgColBefore; GoToPurpleBarRasterStart(); closeirq(); end; - + interrupt RasterText(); begin startIRQ(@useKernal); @@ -939,8 +939,8 @@ interrupt RasterPurpleBarStart(); begin StartIRQ(@useKernal); nop(14); - screen_bg_col := purple; - screen_fg_col := purple; + screen_bg_col := purple; + screen_fg_col := purple; GoToPurpleBarRasterEnd(); CloseIRQ(); end; @@ -951,10 +951,10 @@ begin poke(^$39, 0, lo(spriteWobblePtr)); poke(^$3a, 0, hi(spriteWobblePtr)); nop(13); - screen_bg_col := purple; - screen_fg_col := purple; + screen_bg_col := purple; + screen_fg_col := purple; asm(" - ldy spriteWobbleOfs + ldy spriteWobbleOfs ldx #21 sprLoop lda ($39),y sta $d000 @@ -984,8 +984,8 @@ interrupt RasterPurpleBarEnd(); begin StartIRQ(@useKernal); nop(13); - screen_bg_col := bgColBefore; - screen_fg_col := fgColBefore; + screen_bg_col := bgColBefore; + screen_fg_col := fgColBefore; if (currentPart >= @partMain) then begin if (mainState = @mainPicture or mainState = @mainFadeToText) then @@ -1005,7 +1005,7 @@ begin end; UpdateMainPart(); end - else + else GoToMainRaster(); CloseIRQ(); end; @@ -1032,9 +1032,9 @@ end; //=========================================================================================================== // Demo part handlers //=========================================================================================================== - -procedure InitMainPart(); - + +procedure InitMainPart(); + procedure InitPart(part : byte); begin if (part = @partWriter) then @@ -1061,16 +1061,16 @@ begin spriteBounceOfs := 0; end; if (part = @partMain) then - begin + begin screen_bg_col := 0; screen_fg_col := 0; bgColBefore := 0; fgColBefore := 0; - + spriteBounceOfs := 0; - purpleBarStartRasterLine := 60 - 17; - purpleBarEndRasterLine := 60 + 17; - + purpleBarStartRasterLine := 60 - 17; + purpleBarEndRasterLine := 60 + 17; + spriteWobblePtr := #spriteWobbleEasy; spriteBounceStartY := 60 - @spriteBarCenterOffset; @@ -1085,22 +1085,22 @@ begin setcharsetlocation(@mainpart_bitmapArea); setbank(vic_bank1); - + tp := #mainText; - + naamatDataPtr := naamatAddresses[0]; naamatColorPtr := naamatAddresses[1]; namesPtr := #naamatNames; numbersPtr := #naamatNumbers; - + currentNaama := 0; mainState := @mainPicture; mainTime := 0; - + scrollTextLength := length(scrollText); - + numLinesPtr := #numLines2; - + InitMainPart(); end; end; @@ -1115,7 +1115,7 @@ begin textFade := 0; numbersFade := 0; nameFade := 0; - + if (mainState = @mainShowText) then begin //tempPtr1 := #screen_char_loc2 + 840; @@ -1137,29 +1137,29 @@ begin //tempPtr1 := AddressTable(#colorAddressTable, 0, 21); FillFast(^$4748, 0, 120); - + //tempPtr2 := #screen_col_loc + 960; // keep color for scroll text fillfast(^$DBC0, $a, 40); - + // set current picture currentNaamaX := naamatCoordinates[currentNaama * 4]; currentNaamaY := naamatCoordinates[currentNaama * 4 + 1]; currentNaamaWidth := naamatCoordinates[currentNaama * 4 + 2]; currentNaamaHeight := naamatCoordinates[currentNaama * 4 + 3]; - + // todo write these in main loop instead of raster interrupt PrintCharToSprite(numbersPtr[0], @mainPartSmallFontLoc, @numberSpriteCopies); PrintCharToSprite(numbersPtr[1], @mainPartSmallFontLoc, @numberSpriteCopies + 64); PrintCharToSprite(numbersPtr[2], @mainPartSmallFontLoc, @numberSpriteCopies + 128); numbersPtr += 3; if (numbersPtr[0] = @cstop) then numbersPtr := #naamatNumbers; - + // print the name WriteMainName(); if (namesPtr[1] = @cstop) then namesPtr := #naamatNames; - + plasmaHeight := 2; - end; + end; end; procedure UpdateMainPart(); @@ -1190,25 +1190,25 @@ begin tempPtr1 := #screen_col_loc + textFade * 4 + 100; memcpyfast(#textFadeReverse, 0, tempPtr1, 20); - + tempPtr1 := #screen_char_loc2 + textFade * 4 + 96; fillfast(tempPtr1, 0, 4); // clear character memory - + inc(textFade); end; if (mainState = @mainPicture) then begin // copy picture one row at a time - if (pictureFade < currentNaamaHeight) then + if (pictureFade < currentNaamaHeight) then begin CopyNaamatBitmapData(currentNaamaX, currentNaamaY + pictureFade, 13, 4 + pictureFade, currentNaamaWidth, 1, 1000); inc(pictureFade); end; - + // fade in the sprite colors if (mainTime > 100) then begin - if (numbersFade < @textFadeLumiLast) then + if (numbersFade < @textFadeLumiLast) then begin j := textFadeReverse[numbersFade]; sprite_color[0]:=j; @@ -1226,14 +1226,14 @@ begin end else fillfast(#sprite_color, 0, 6); - + if (nameFade < 85) then begin tempPtr1 := #screen_col_loc + 800 + nameFade; // starts at row 20 memcpyfast(#textFadeLumi, 0, tempPtr1, 20); - inc(nameFade); + inc(nameFade); end; - + if (mainTime > 350 and mainTime < 425) then begin i := mainTime - 350; @@ -1242,16 +1242,16 @@ begin end; end; if (mainState = @mainFadeToText) then - begin + begin // blank out picture one row at a time - if (pictureFade < currentNaamaHeight) then + if (pictureFade < currentNaamaHeight) then begin BlankNaamatBitmapData(currentNaamaX, currentNaamaY + pictureFade, 13, 4 + pictureFade, currentNaamaWidth, 1); inc(pictureFade); end; - + // fade out the sprite colors - if (numbersFade < @textFadeLumiLast) then + if (numbersFade < @textFadeLumiLast) then begin j := textFadeLumi[numbersFade]; sprite_color[0]:=j; @@ -1265,21 +1265,21 @@ begin begin sprite_color[0]:=0; sprite_color[1]:=0; - sprite_color[2]:=0; + sprite_color[2]:=0; sprite_color[3]:=$0; sprite_color[4]:=$0; sprite_color[5]:=$0; end; - + if (mainTime > 50 and nameFade < 150) then begin tempPtr1 := #screen_col_loc + 840 + nameFade; // starts at row 21 memcpyfast(#textFadeReverse, 0, tempPtr1, 20); - inc(nameFade); + inc(nameFade); end; end; - if (currentTime > 512 and mod(mainTime, 2) = 0)then + if (currentTime > 512 and mod(mainTime, 2) = 0)then begin if (scrollCurrent = 0) then begin @@ -1297,7 +1297,7 @@ procedure GoToNextMainPart(); begin mainTime := 0; mainState := mod(mainState + 1, 4); - + if (mainState = @mainPicture) then begin currentNaama := mod(currentNaama + 1, 12); naamatDataPtr := naamatAddresses[currentNaama * 2]; @@ -1311,11 +1311,11 @@ var lastSpriteWoblOfs : byte; wobblePause : boolean = false; wobblePauseTimer : integer = 0; cEqualsChangeFlag : boolean = false; -begin +begin if (part >= @partOpenBar) then Call(SIDFILE_1_PLAY); if (part = @partWriter) then RasterIRQ(RasterText(),0, @useKernal); - + if (part = @partOpenBar) then begin purpleBarStartRasterLine := purpleBarCenter - purpleBarBounce[purpleBounceOfs]; @@ -1324,7 +1324,7 @@ begin inc(purpleBounceOfs); if (purpleBounceOfs >= @purpleBarBounceSize) then currentPartDone := true; end; - + if (part = @partSpriteBounce) then begin spriteBounceXCurrent := spriteBounceStartX + spriteBounce[spriteBounceOfs]; @@ -1332,22 +1332,22 @@ begin RasterIRQ(RasterTextPlasma(), 0, @useKernal); if (spriteBounceOfs < @spriteBounceSize - 1) then spriteBounceOfs += 1; if (currentTime > 240) then currentPartDone := true; - end; - - if (part = @partFadeOutOpeningScreen) then + end; + + if (part = @partFadeOutOpeningScreen) then begin if (fadeStateCurrent = @fadeStateBorder) then begin bgColBefore := textFadeLumi[fadeOfsCurrent]; screen_bg_col := bgColBefore; RasterIRQ(RasterTextPlasma(), 0, @useKernal); - if (fadeOfsCurrent >= @textFadeLumiLast) then + if (fadeOfsCurrent >= @textFadeLumiLast) then begin fadeStateCurrent := @fadeStateText; fadeOfsCurrent := 0; end; end; - if (fadeStateCurrent = @fadeStateText) then + if (fadeStateCurrent = @fadeStateText) then begin fadeTemp := textFadeLumi[fadeOfsCurrent]; Fill(screen_col_loc, fadeTemp, 255); @@ -1355,11 +1355,11 @@ begin Fill(screen_col_loc + 512, fadeTemp, 255); Fill(screen_col_loc + 768, fadeTemp, 232); GoToPurpleBarRasterStart(); - if (fadeOfsCurrent >= @textFadeLumiLast) then + if (fadeOfsCurrent >= @textFadeLumiLast) then begin fadeStateCurrent := @fadeStateAll; fadeOfsCurrent := 0; - end; + end; end; if (fadeStateCurrent = @fadeStateAll) then begin @@ -1372,8 +1372,8 @@ begin end; fadeOfsCurrent += 1; end; - - if (part = @partLogoBarWobble) then + + if (part = @partLogoBarWobble) then begin fadeTemp := textLumi2[textBlinkOfs]; FillFast(screen_col_loc + 406 , fadeTemp, 30); @@ -1383,13 +1383,13 @@ begin if (currentTime > 150) then begin if (lastSpriteWoblOfs = 127 and spriteWobbleOfs = 128) then ChangeFlagToCEquals(); - lastSpriteWoblOfs := spriteWobbleOfs; + lastSpriteWoblOfs := spriteWobbleOfs; if (currentTime > 645) then currentPartDone := true; inc(spriteWobbleOfs); end; GoToPurpleBarRasterStart(); end; - + if (part = @partBounceBarUp) then begin purpleBarCenter := purpleBarBounce2[purpleBounceOfs]; @@ -1405,52 +1405,52 @@ begin if (purpleBounceOfs > 127) then currentPartDone := true; GoToPurpleBarRasterStart(); end; - + if (part = @partMain) then begin setbank(vic_bank1); - if (not(wobblePause)) then + if (not(wobblePause)) then begin inc(spriteWobbleOfs); - if (lastSpriteWoblOfs = 127 and spriteWobbleOfs = 128) then + if (lastSpriteWoblOfs = 127 and spriteWobbleOfs = 128) then begin if (cEqualsChangeFlag) then ChangeFlagToCEquals1(); cEqualsChangeFlag := not(cEqualsChangeFlag); end; end; lastSpriteWoblOfs := spriteWobbleOfs; - + inc(wobblePauseTimer); - if (wobblePauseTimer > 512) then + if (wobblePauseTimer > 512) then begin wobblePause := not(wobblePause); wobblePauseTimer := 0; spriteWobbleOfs := 245; end; - + InitLogoBounceSprites1(); UpdateSpriteYPositions(spriteBounceStartY); UpdateSpriteXLSBPositions(spriteWobble[0]); - + inc(numberSprite0FloatOfs); inc(numberSprite1FloatOfs); inc(numberSprite2FloatOfs); inc(numberSprite3FloatOfs); inc(numberSprite4FloatOfs); inc(numberSprite5FloatOfs); - + inc(mainTime); - + if (mainState = @mainFadeToPicture and mainTime > 200) then GoToNextMainPart(); if (mainState = @mainFadeToText and mainTime > 100) then GoToNextMainPart(); if (mainState = @mainPicture and mainTime > 650) then GoToNextMainPart(); if (mainState = @mainShowText and mainTime > 400) then GoToNextMainPart(); - + GoToPurpleBarRasterStart(); end; end; - + procedure GoToNextPart(); begin inc(currentPart); @@ -1473,13 +1473,13 @@ begin CloseIRQ(); end; -begin +begin bgColBefore := screen_bg_col; fgColBefore := screen_fg_col; - + DisableCIAInterrupts(); CopyCharsetRomToRam($c0); - + setmemoryconfig(1,@useKernal,0); // Some heavy part init here to spare work later @@ -1494,14 +1494,14 @@ begin ClearScreen(0, ^@mainpart_bitmapArea + 5000); ClearScreen(0, ^@mainpart_bitmapArea + 6000); ClearScreen(0, ^@mainpart_bitmapArea + 7000); - + CreateAddressTable(#mainPartAddressTable, $4400, 40, 25); CreateAddressTable(#colorAddressTable, $d800, 40, 25); - + Fill(^$0568, KEY_SPACE, 200); - + for i := 0 to 256 do fastPlasma[i] := textPlasmaLumi[textPlasmaX[i]]; - + PreProcessScrollText(); // Start demo @@ -1511,4 +1511,4 @@ begin enableirq(); Loop(); -end. \ No newline at end of file +end.