diff --git a/Makefile b/Makefile index dc8ca36d..c389c6e7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ TOPDIR = $(realpath .) -SUBDIRS = tools lib effects SUBDIRS = tools lib system effects EXTRA-FILES = tags cscope.out CLEAN-FILES = bootloader.bin a500rom.bin addchip.bootblock.bin vbrmove diff --git a/effects/anim-polygons/Makefile b/effects/anim-polygons/Makefile index 4043fd66..ebc94a50 100644 --- a/effects/anim-polygons/Makefile +++ b/effects/anim-polygons/Makefile @@ -6,6 +6,6 @@ PNG2C.dancing-pal := --pixmap gradient,16x22x12 include $(TOPDIR)/build/effect.mk -%.c: %.svg +data/%.c: data/%.svg @echo "[ANIM] $(DIR)$< -> $(DIR)$@" $(PYTHON3) encode.py $< > $@ diff --git a/effects/anim-polygons/anim-polygons.c b/effects/anim-polygons/anim-polygons.c index af2595ea..9670154d 100644 --- a/effects/anim-polygons/anim-polygons.c +++ b/effects/anim-polygons/anim-polygons.c @@ -136,4 +136,4 @@ static void Render(void) { maybeSkipFrame = 1; } -EFFECT(AnimPolygons, NULL, NULL, Init, Kill, Render); +EFFECT(AnimPolygons, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/anim/anim.c b/effects/anim/anim.c index 1f722699..6481d627 100644 --- a/effects/anim/anim.c +++ b/effects/anim/anim.c @@ -109,4 +109,4 @@ static void Render(void) { active = (active + 1) % (DEPTH + 1); } -EFFECT(Anim, Load, UnLoad, Init, Kill, Render); +EFFECT(Anim, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/ball/ball.c b/effects/ball/ball.c index 3aad7820..59cd9a5b 100644 --- a/effects/ball/ball.c +++ b/effects/ball/ball.c @@ -347,4 +347,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Ball, NULL, NULL, Init, Kill, Render); +EFFECT(Ball, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/blurred/blurred.c b/effects/blurred/blurred.c index 948f2cf6..0fb6b63d 100644 --- a/effects/blurred/blurred.c +++ b/effects/blurred/blurred.c @@ -140,4 +140,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Blurred, Load, UnLoad, Init, Kill, Render); +EFFECT(Blurred, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/blurred3d/blurred3d.c b/effects/blurred3d/blurred3d.c index 29911fdb..d53e5d06 100644 --- a/effects/blurred3d/blurred3d.c +++ b/effects/blurred3d/blurred3d.c @@ -495,4 +495,4 @@ static void Render(void) { swapr(screen0, screen1); } -EFFECT(Blurred3D, Load, UnLoad, Init, Kill, Render); +EFFECT(Blurred3D, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/bobs3d/bobs3d.c b/effects/bobs3d/bobs3d.c index 074a883c..a995e29f 100644 --- a/effects/bobs3d/bobs3d.c +++ b/effects/bobs3d/bobs3d.c @@ -253,4 +253,4 @@ static void Render(void) { swapr(screen0, screen1); } -EFFECT(Bobs3D, NULL, NULL, Init, Kill, Render); +EFFECT(Bobs3D, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/bumpmap-rgb/bumpmap-rgb.c b/effects/bumpmap-rgb/bumpmap-rgb.c index 855886f3..25da6f80 100644 --- a/effects/bumpmap-rgb/bumpmap-rgb.c +++ b/effects/bumpmap-rgb/bumpmap-rgb.c @@ -381,4 +381,4 @@ static void Render(void) { active ^= 1; } -EFFECT(BumpMapRGB, Load, UnLoad, Init, Kill, Render); +EFFECT(BumpMapRGB, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/butterfly-gears/butterfly-gears.c b/effects/butterfly-gears/butterfly-gears.c index 4023bb11..6dbfb25b 100644 --- a/effects/butterfly-gears/butterfly-gears.c +++ b/effects/butterfly-gears/butterfly-gears.c @@ -203,4 +203,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(ButterflyGears, NULL, NULL, Init, Kill, Render); +EFFECT(ButterflyGears, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/circles/circles.c b/effects/circles/circles.c index 404ee346..a66447c9 100644 --- a/effects/circles/circles.c +++ b/effects/circles/circles.c @@ -44,4 +44,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(Circles, NULL, NULL, Init, Kill, Render); +EFFECT(Circles, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/credits/credits.c b/effects/credits/credits.c index 7972c63b..83097f69 100644 --- a/effects/credits/credits.c +++ b/effects/credits/credits.c @@ -189,4 +189,4 @@ static void Render(void) { swapr(cp0, cp1); } -EFFECT(Credits, NULL, NULL, Init, Kill, Render); +EFFECT(Credits, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/empty/empty.c b/effects/empty/empty.c index a1854050..51a48a6e 100644 --- a/effects/empty/empty.c +++ b/effects/empty/empty.c @@ -27,4 +27,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(Empty, NULL, NULL, Init, Kill, Render); +EFFECT(Empty, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/flatshade-convex/flatshade-convex.c b/effects/flatshade-convex/flatshade-convex.c index 9c400cf4..a76e1187 100644 --- a/effects/flatshade-convex/flatshade-convex.c +++ b/effects/flatshade-convex/flatshade-convex.c @@ -342,4 +342,4 @@ static void Render(void) { active ^= 1; } -EFFECT(FlatShadeConvex, Load, UnLoad, Init, Kill, Render); +EFFECT(FlatShadeConvex, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/flatshade/flatshade.c b/effects/flatshade/flatshade.c index 51157a72..ef4e5b13 100644 --- a/effects/flatshade/flatshade.c +++ b/effects/flatshade/flatshade.c @@ -359,4 +359,4 @@ static void Render(void) { swapr(screen0, screen1); } -EFFECT(FlatShade, Load, UnLoad, Init, Kill, Render); +EFFECT(FlatShade, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/floor-old/floor-old.c b/effects/floor-old/floor-old.c index 22118d10..2be3ef50 100644 --- a/effects/floor-old/floor-old.c +++ b/effects/floor-old/floor-old.c @@ -467,4 +467,4 @@ static void Render(void) { active ^= 1; } -EFFECT(FloorOld, Load, UnLoad, Init, Kill, Render); +EFFECT(FloorOld, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/floor/floor.c b/effects/floor/floor.c index b7f900c8..d991b9c4 100644 --- a/effects/floor/floor.c +++ b/effects/floor/floor.c @@ -259,4 +259,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Floor, NULL, NULL, Init, Kill, Render); +EFFECT(Floor, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/game-of-life/game-of-life.c b/effects/game-of-life/game-of-life.c index 0cf3b028..ef1baba3 100755 --- a/effects/game-of-life/game-of-life.c +++ b/effects/game-of-life/game-of-life.c @@ -522,4 +522,4 @@ static void Render(void) { #endif } -EFFECT(GameOfLife, NULL, NULL, Init, Kill, Render); +EFFECT(GameOfLife, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/glitch/glitch.c b/effects/glitch/glitch.c index a6c35c94..e700bb8a 100644 --- a/effects/glitch/glitch.c +++ b/effects/glitch/glitch.c @@ -133,4 +133,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Glitch, NULL, NULL, Init, Kill, Render); +EFFECT(Glitch, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/growing-tree/growing-tree.c b/effects/growing-tree/growing-tree.c index c235f078..5889cc44 100644 --- a/effects/growing-tree/growing-tree.c +++ b/effects/growing-tree/growing-tree.c @@ -323,4 +323,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(GrowingTree, NULL, NULL, Init, Kill, Render); +EFFECT(GrowingTree, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/gui/gui.c b/effects/gui/gui.c index 02b71f1e..75f1d99b 100644 --- a/effects/gui/gui.c +++ b/effects/gui/gui.c @@ -137,4 +137,4 @@ static void Render(void) { exitLoop = !HandleEvent(); } -EFFECT(GUI, Load, NULL, Init, Kill, Render); +EFFECT(GUI, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/highway/highway.c b/effects/highway/highway.c index 5fcabe0c..a74ffd54 100644 --- a/effects/highway/highway.c +++ b/effects/highway/highway.c @@ -216,4 +216,4 @@ static void Render(void) { active ^= 1; } -EFFECT(HighWay, NULL, NULL, Init, Kill, Render); +EFFECT(HighWay, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/kbtest/kbtest.c b/effects/kbtest/kbtest.c index a1de22de..92631010 100644 --- a/effects/kbtest/kbtest.c +++ b/effects/kbtest/kbtest.c @@ -108,4 +108,4 @@ static void Render(void) { exitLoop = !HandleEvent(); } -EFFECT(KbdTest, NULL, NULL, Init, Kill, Render); +EFFECT(KbdTest, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/layers/layers.c b/effects/layers/layers.c index a01bdad8..90dd62c8 100644 --- a/effects/layers/layers.c +++ b/effects/layers/layers.c @@ -192,4 +192,4 @@ static void Render(void) { swapr(cp0, cp1); } -EFFECT(Credits, NULL, NULL, Init, Kill, Render); +EFFECT(Credits, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/lines/lines.c b/effects/lines/lines.c index 7a7b946d..4981af9a 100644 --- a/effects/lines/lines.c +++ b/effects/lines/lines.c @@ -101,4 +101,4 @@ static void Render(void) { ProfilerStop(Lines); } -EFFECT(Lines, Load, UnLoad, Init, NULL, Render); +EFFECT(Lines, Load, UnLoad, Init, NULL, Render, NULL); diff --git a/effects/main.c b/effects/main.c index d9ddd7bc..5f28677a 100644 --- a/effects/main.c +++ b/effects/main.c @@ -24,11 +24,21 @@ static void StartBgTask(void) { } #endif +static int VBlankISR(void) { + if (Effect.VBlank) + Effect.VBlank(); + return 0; +} + +INTSERVER(VBlankInterrupt, 0, (IntFuncT)VBlankISR, NULL); + int main(void) { /* NOP that triggers fs-uae debugger to stop and inform GDB that it should * fetch segments locations to relocate symbol information read from file. */ asm volatile("exg %d7,%d7"); + AddIntServer(INTB_VERTB, VBlankInterrupt); + #if BGTASK StartBgTask(); #endif @@ -39,5 +49,7 @@ int main(void) { EffectKill(&Effect); EffectUnLoad(&Effect); - return 0; + RemIntServer(INTB_VERTB, VBlankInterrupt); + + return 0; } diff --git a/effects/metaballs/metaballs.c b/effects/metaballs/metaballs.c index 9b2b2390..78834829 100644 --- a/effects/metaballs/metaballs.c +++ b/effects/metaballs/metaballs.c @@ -127,4 +127,4 @@ static void Render(void) { active ^= 1; } -EFFECT(MetaBalls, Load, UnLoad, Init, Kill, Render); +EFFECT(MetaBalls, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/multipipe/multipipe.c b/effects/multipipe/multipipe.c index 50b1cf7d..3ece1495 100644 --- a/effects/multipipe/multipipe.c +++ b/effects/multipipe/multipipe.c @@ -211,4 +211,4 @@ static void Render(void) { active ^= 1; } -EFFECT(MultiPipe, Load, UnLoad, Init, Kill, Render); +EFFECT(MultiPipe, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/neons/neons.c b/effects/neons/neons.c index 8616eb25..e06bb8d1 100644 --- a/effects/neons/neons.c +++ b/effects/neons/neons.c @@ -5,7 +5,6 @@ #include "2d.h" #include "fx.h" #include -#include #define WIDTH 320 #define HEIGHT 256 @@ -108,7 +107,7 @@ static void UnLoad(void) { DeleteBitmap(screen[1]); } -static int CustomRotatePalette(void) { +static void CustomRotatePalette(void) { u_short *src = palette[0]->colors; CopInsT *ins = pal + 1; int i = frameCount; @@ -117,11 +116,9 @@ static int CustomRotatePalette(void) { while (--n >= 0) CopInsSet16(ins++, src[i++ & 15]); - return 0; + return; } -INTSERVER(RotatePaletteInterrupt, 0, (IntFuncT)CustomRotatePalette, NULL); - static void Init(void) { EnableDMA(DMAF_BLITTER); @@ -143,15 +140,11 @@ static void Init(void) { CopListActivate(cp); EnableDMA(DMAF_RASTER); - - AddIntServer(INTB_VERTB, RotatePaletteInterrupt); } static void Kill(void) { DisableDMA(DMAF_COPPER | DMAF_RASTER | DMAF_BLITTER); - RemIntServer(INTB_VERTB, RotatePaletteInterrupt); - DeleteCopList(cp); } @@ -228,4 +221,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Neons, Load, UnLoad, Init, Kill, Render); +EFFECT(Neons, Load, UnLoad, Init, Kill, Render, CustomRotatePalette); diff --git a/effects/plasma/plasma.c b/effects/plasma/plasma.c index f9ad138c..5f5edea5 100644 --- a/effects/plasma/plasma.c +++ b/effects/plasma/plasma.c @@ -177,4 +177,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Plasma, Load, NULL, Init, Kill, Render); +EFFECT(Plasma, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/playahx/playahx.c b/effects/playahx/playahx.c index 2494a0d1..63968006 100644 --- a/effects/playahx/playahx.c +++ b/effects/playahx/playahx.c @@ -282,4 +282,4 @@ static bool HandleEvent(void) { return true; } -EFFECT(PlayAHX, NULL, NULL, Init, Kill, Render); +EFFECT(PlayAHX, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/playctr/playctr.c b/effects/playctr/playctr.c index 13320989..960be3a7 100644 --- a/effects/playctr/playctr.c +++ b/effects/playctr/playctr.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -49,16 +48,14 @@ static void UnLoad(void) { MemFree(module); } -static int CinterMusic(void) { +static void CinterMusic(void) { if (stopped) - return 0; + return; CinterPlay1(player); CinterPlay2(player); - return 0; + return; } -INTSERVER(CinterMusicServer, 10, (IntFuncT)CinterMusic, NULL); - static void Init(void) { KeyboardInit(); @@ -83,8 +80,6 @@ static void Init(void) { CinterInit(module, instruments, player); musicStart = player->c_MusicPointer; - AddIntServer(INTB_VERTB, CinterMusicServer); - ConsoleSetCursor(&console, 0, 0); ConsolePutStr(&console, "Pause (SPACE) -10s (LEFT) +10s (RIGHT)\n" @@ -94,8 +89,6 @@ static void Init(void) { } static void Kill(void) { - RemIntServer(INTB_VERTB, CinterMusicServer); - DisableDMA(DMAF_COPPER | DMAF_RASTER | DMAF_AUDIO); DeleteCopList(cp); @@ -173,4 +166,4 @@ static bool HandleEvent(void) { return true; } -EFFECT(PlayCinter, Load, UnLoad, Init, Kill, Render); +EFFECT(PlayCinter, Load, UnLoad, Init, Kill, Render, CinterMusic); diff --git a/effects/playp61/playp61.c b/effects/playp61/playp61.c index f18858a6..4700ee10 100644 --- a/effects/playp61/playp61.c +++ b/effects/playp61/playp61.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -24,8 +23,6 @@ static CopListT *cp; static ConsoleT console; static CIATimerT *p61tmr; -INTSERVER(P61PlayerServer, 10, (IntFuncT)P61_Music, NULL); - static inline void putpixel(u_char *line, short x) { bset(line + (x >> 3), ~x); } @@ -118,8 +115,6 @@ static void Init(void) { P61_Init(module, NULL, NULL); P61_ControlBlock.Play = 1; - AddIntServer(INTB_VERTB, P61PlayerServer); - ConsolePutStr(&console, "Pause (SPACE) Prev (LEFT) Next (RIGHT)\n" "Exit (ESC)\n"); @@ -129,7 +124,6 @@ static void Kill(void) { P61_ControlBlock.Play = 0; P61_End(); - RemIntServer(INTB_VERTB, P61PlayerServer); ReleaseTimer(p61tmr); DisableDMA(DMAF_COPPER | DMAF_RASTER | DMAF_BLITTER); @@ -222,4 +216,4 @@ static bool HandleEvent(void) { return true; } -EFFECT(PlayP61, NULL, NULL, Init, Kill, Render); +EFFECT(PlayP61, NULL, NULL, Init, Kill, Render, P61_Music); diff --git a/effects/playpt/playpt.c b/effects/playpt/playpt.c index 1bfa9408..70ad6fd2 100644 --- a/effects/playpt/playpt.c +++ b/effects/playpt/playpt.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -12,6 +11,10 @@ #define HEIGHT 256 #define DEPTH 1 +/* XXX: Always consult this value with AmigaKlang output, + * otherwise you'll experience a really nasty debugging session. */ +#define AKLANG_BUFLEN 36864 + #include "data/lat2-08.c" extern u_char Module[]; @@ -28,14 +31,12 @@ extern u_int AK_Progress; void AK_Generate(void *TmpBuf asm("a1")); static void Load(void) { - void *TmpBuf = MemAlloc(32768, MEMF_PUBLIC); + void *TmpBuf = MemAlloc(AKLANG_BUFLEN, MEMF_PUBLIC); + Log("Generating samples, please wait...\n"); AK_Generate(TmpBuf); MemFree(TmpBuf); } -static void UnLoad(void) { -} - static void Init(void) { KeyboardInit(); @@ -181,4 +182,4 @@ static bool HandleEvent(void) { return true; } -EFFECT(PlayProtracker, Load, UnLoad, Init, Kill, Render); +EFFECT(PlayProtracker, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/plotter/plotter.c b/effects/plotter/plotter.c index 84e9f854..365fc3d2 100644 --- a/effects/plotter/plotter.c +++ b/effects/plotter/plotter.c @@ -98,4 +98,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Plotter, NULL, NULL, Init, Kill, Render); +EFFECT(Plotter, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/prisms/prisms.c b/effects/prisms/prisms.c index c60875e3..994513da 100644 --- a/effects/prisms/prisms.c +++ b/effects/prisms/prisms.c @@ -342,4 +342,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Prisms, NULL, NULL, Init, Kill, Render); +EFFECT(Prisms, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/rotator/rotator.c b/effects/rotator/rotator.c index d203e6a9..8e5d35f5 100644 --- a/effects/rotator/rotator.c +++ b/effects/rotator/rotator.c @@ -310,4 +310,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Rotator, NULL, NULL, Init, Kill, Render); +EFFECT(Rotator, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/sea-anemone/sea-anemone.c b/effects/sea-anemone/sea-anemone.c index 751c4cd7..d519debe 100644 --- a/effects/sea-anemone/sea-anemone.c +++ b/effects/sea-anemone/sea-anemone.c @@ -310,4 +310,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(SeaAnemone, Load, UnLoad, Init, Kill, Render); +EFFECT(SeaAnemone, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/shapes/shapes.c b/effects/shapes/shapes.c index ccae1220..baca1ff1 100644 --- a/effects/shapes/shapes.c +++ b/effects/shapes/shapes.c @@ -140,4 +140,4 @@ static void Render(void) { planeC ^= 1; } -EFFECT(Shapes, Load, UnLoad, Init, Kill, Render); +EFFECT(Shapes, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/showpchg/showpchg.c b/effects/showpchg/showpchg.c index 59d39a51..19cbd859 100644 --- a/effects/showpchg/showpchg.c +++ b/effects/showpchg/showpchg.c @@ -52,4 +52,4 @@ static void Kill(void) { DeleteCopList(cp); } -EFFECT(ShowPCHG, NULL, NULL, Init, Kill, NULL); +EFFECT(ShowPCHG, NULL, NULL, Init, Kill, NULL, NULL); diff --git a/effects/stripes/stripes.c b/effects/stripes/stripes.c index d5bf9587..ef137fe8 100644 --- a/effects/stripes/stripes.c +++ b/effects/stripes/stripes.c @@ -186,4 +186,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Stripes, NULL, NULL, Init, Kill, Render); +EFFECT(Stripes, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/textscroll/textscroll.c b/effects/textscroll/textscroll.c index 62f83772..af1fcc66 100644 --- a/effects/textscroll/textscroll.c +++ b/effects/textscroll/textscroll.c @@ -150,4 +150,4 @@ static void Render(void) { active ^= 1; } -EFFECT(TextScroll, NULL, NULL, Init, Kill, Render); +EFFECT(TextScroll, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/thunders/thunders.c b/effects/thunders/thunders.c index 9240e72a..b37a1ec9 100644 --- a/effects/thunders/thunders.c +++ b/effects/thunders/thunders.c @@ -449,4 +449,4 @@ static void Render(void) { { BitmapT *tmp = screen0; screen0 = screen1; screen1 = tmp; } } -EFFECT(Thunders, Load, NULL, Init, Kill, Render); +EFFECT(Thunders, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/tiles16/tiles16.c b/effects/tiles16/tiles16.c index a0c1bb3e..f1001b57 100644 --- a/effects/tiles16/tiles16.c +++ b/effects/tiles16/tiles16.c @@ -203,4 +203,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Tiles16, Load, NULL, Init, Kill, Render); +EFFECT(Tiles16, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/tiles8/tiles8.c b/effects/tiles8/tiles8.c index a9e31de9..d8d80a0a 100644 --- a/effects/tiles8/tiles8.c +++ b/effects/tiles8/tiles8.c @@ -222,4 +222,4 @@ static void Render(void) { swapr(screen0, screen1); } -EFFECT(Tiles8, Load, NULL, Init, Kill, Render); +EFFECT(Tiles8, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/tilezoomer/tilezoomer.c b/effects/tilezoomer/tilezoomer.c index 75be7f08..dc35f11d 100644 --- a/effects/tilezoomer/tilezoomer.c +++ b/effects/tilezoomer/tilezoomer.c @@ -269,4 +269,4 @@ static void Render(void) { #endif } -EFFECT(TileZoomer, NULL, NULL, Init, Kill, Render); +EFFECT(TileZoomer, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/transparency/transparency.c b/effects/transparency/transparency.c index 8c443294..9b55c951 100644 --- a/effects/transparency/transparency.c +++ b/effects/transparency/transparency.c @@ -88,4 +88,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(Transparency, NULL, NULL, Init, Kill, Render); +EFFECT(Transparency, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/turmite/turmite.c b/effects/turmite/turmite.c index 7f62448b..1a2ae519 100644 --- a/effects/turmite/turmite.c +++ b/effects/turmite/turmite.c @@ -304,4 +304,4 @@ static void Render(void) { TaskWaitVBlank(); } -EFFECT(Turmite, Load, NULL, Init, Kill, Render); +EFFECT(Turmite, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/twister-rgb/twister-rgb.c b/effects/twister-rgb/twister-rgb.c index 653c488c..94cd0ce8 100644 --- a/effects/twister-rgb/twister-rgb.c +++ b/effects/twister-rgb/twister-rgb.c @@ -189,4 +189,4 @@ static void Render(void) { active ^= 1; } -EFFECT(TwisterRGB, NULL, NULL, Init, Kill, Render); +EFFECT(TwisterRGB, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/uvlight/uvlight.c b/effects/uvlight/uvlight.c index c574ffff..3eacee16 100644 --- a/effects/uvlight/uvlight.c +++ b/effects/uvlight/uvlight.c @@ -359,4 +359,4 @@ static void Render(void) { active ^= 1; } -EFFECT(UVLight, Load, NULL, Init, Kill, Render); +EFFECT(UVLight, Load, NULL, Init, Kill, Render, NULL); diff --git a/effects/uvmap-rgb/uvmap-rgb.c b/effects/uvmap-rgb/uvmap-rgb.c index bb6d9843..ec25fff2 100644 --- a/effects/uvmap-rgb/uvmap-rgb.c +++ b/effects/uvmap-rgb/uvmap-rgb.c @@ -291,4 +291,4 @@ static void Render(void) { active ^= 1; } -EFFECT(UVMapRGB, Load, UnLoad, Init, Kill, Render); +EFFECT(UVMapRGB, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/effects/uvmap/uvmap.c b/effects/uvmap/uvmap.c index 0b30fa28..8bad6582 100644 --- a/effects/uvmap/uvmap.c +++ b/effects/uvmap/uvmap.c @@ -315,4 +315,4 @@ static void Render(void) { active ^= 1; } -EFFECT(UVMap, NULL, NULL, Init, Kill, Render); +EFFECT(UVMap, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/weave/weave.c b/effects/weave/weave.c index b6aa5dd9..cb0c7659 100644 --- a/effects/weave/weave.c +++ b/effects/weave/weave.c @@ -308,4 +308,4 @@ static void Render(void) { active ^= 1; } -EFFECT(Weave, NULL, NULL, Init, Kill, Render); +EFFECT(Weave, NULL, NULL, Init, Kill, Render, NULL); diff --git a/effects/wireframe/wireframe.c b/effects/wireframe/wireframe.c index d993d8fc..9ba81255 100644 --- a/effects/wireframe/wireframe.c +++ b/effects/wireframe/wireframe.c @@ -335,4 +335,4 @@ static void Render(void) { active = 0; } -EFFECT(Wireframe, Load, UnLoad, Init, Kill, Render); +EFFECT(Wireframe, Load, UnLoad, Init, Kill, Render, NULL); diff --git a/include/ptplayer.h b/include/ptplayer.h index 020101e0..ef8e9f1f 100644 --- a/include/ptplayer.h +++ b/include/ptplayer.h @@ -129,7 +129,6 @@ typedef struct { u_char mt_PattDelTime2; } __attribute__((packed)) PtPlayer; -extern u_short PtPatternPos; -extern u_char PtSongPos; +extern PtPlayer PtData; #endif diff --git a/lib/libpt/Makefile b/lib/libpt/Makefile index 494507f1..588fb75a 100644 --- a/lib/libpt/Makefile +++ b/lib/libpt/Makefile @@ -4,6 +4,6 @@ SOURCES := pt.asm include $(TOPDIR)/build/lib.mk -VASMFLAGS.pt += -DMINIMAL=1 -DENABLE_SAWRECT=0 -DENABLE_VUMETER=0 +VASMFLAGS.pt += -DMINIMAL=1 -DENABLE_SAWRECT=0 -DENABLE_VUMETER=0 -DJAZZCAT=1 pt.o: pt.asm ptplayer.asm $(TOPDIR)/include/ptplayer.h diff --git a/lib/libpt/README.md b/lib/libpt/README.md new file mode 100644 index 00000000..b3fcde5d --- /dev/null +++ b/lib/libpt/README.md @@ -0,0 +1,11 @@ +JazzCat does not use following commands: + + * Bxy + * Dxy + * Exy + * 4xy + * 6xy + * 7xy + * 8xy + +You can disable them by changing `JAZZCAT` to 1 in `Makefile`. diff --git a/lib/libpt/pt.asm b/lib/libpt/pt.asm index ee56f06c..49582a64 100644 --- a/lib/libpt/pt.asm +++ b/lib/libpt/pt.asm @@ -2,17 +2,15 @@ xdef _PtRemoveCIA xdef _PtInit xdef _PtEnd - xdef _PtSongPos - xdef _PtPatternPos + xdef _PtData xdef _PtEnable xdef _PtE8Trigger section '.text',code +_PtData set mt_data+mt_chan1 _PtEnable set _mt_Enable _PtE8Trigger set _mt_E8Trigger -_PtSongPos set mt_data+mt_SongPos -_PtPatternPos set mt_data+mt_PatternPos _PtInstallCIA: movem.l d2-d7/a2-a6,-(sp) diff --git a/lib/libpt/ptplayer.asm b/lib/libpt/ptplayer.asm index ffec6b1e..cffbe33a 100644 --- a/lib/libpt/ptplayer.asm +++ b/lib/libpt/ptplayer.asm @@ -566,7 +566,7 @@ mt_generate_period_table: ; ; See: https://eab.abime.net/showpost.php?p=1465997&postcount=132 - rem + ifeq JAZZCAT mt_generate_vib_sine_table: move.l d2,-(sp) @@ -595,7 +595,7 @@ mt_generate_vib_sine_table: dc.w $b400,$c500,$d400,$e000,$eb00,$f400,$fa00,$fd00 dc.w $ff00,$fd00,$fa00,$f400,$eb00,$e000,$d400,$c500 dc.w $b400,$a100,$8d00,$7800,$6100,$4a00,$3100,$1800 - erem + endc ; JAZZCAT ;--------------------------------------------------------------------------- @@ -669,9 +669,9 @@ _mt_init: ;Antiriad - generator code bsr mt_generate_period_table ;Create period table - rem + ifeq JAZZCAT bsr mt_generate_vib_sine_table ;Create sine vibrato table - erem + endc ; JAZZCAT ;Antiriad - end ;Fallthrough to mt_reset @@ -1559,13 +1559,14 @@ mt_checkfx: move.w fx_tab(pc,d0.w),d0 jmp fx_tab(pc,d0.w) -; [cahir] disabled commands + ifne JAZZCAT mt_arpeggio set mt_nop ; 0 x y mt_portaup set mt_nop ; 1 x y mt_vibrato set mt_nop ; 4 x y mt_vibrvolslide set mt_nop ; 6 x y mt_tremolo set mt_nop ; 7 x y mt_e_cmds set mt_nop ; E x y + endc ; JAZZCAT fx_tab: dc.w mt_arpeggio-fx_tab ; $0 @@ -1888,10 +1889,11 @@ checkmorefx: .1: move.w morefx_tab(pc,d5.w),d0 jmp morefx_tab(pc,d0.w) -; [cahir] disabled commands + ifne JAZZCAT mt_posjump set mt_pernop ; B x y mt_patternbrk set mt_pernop ; D x y mt_e_cmds set mt_pernop ; E x y + endc ; JAZZCAT morefx_tab: dc.w mt_pernop-morefx_tab,mt_pernop-morefx_tab,mt_pernop-morefx_tab @@ -1917,12 +1919,13 @@ moreblockedfx: move.w blmorefx_tab(pc,d6.w),d0 jmp blmorefx_tab(pc,d0.w) -; [cahir] disabled commands + ifne JAZZCAT mt_arpeggio set mt_nop ; 0 x y mt_fineportaup set mt_nop ; 1 x y mt_posjump set mt_nop ; B x y mt_patternbrk set mt_nop ; D x y blocked_e_cmds set mt_nop ; E x y + endc ; JAZZCAT blmorefx_tab: dc.w mt_nop-blmorefx_tab,mt_nop-blmorefx_tab @@ -1938,7 +1941,7 @@ blmorefx_tab: dc.w mt_setspeed-blmorefx_tab ; $F endc ; !MINIMAL - rem + ifeq JAZZCAT mt_arpeggio: ; cmd 0 x y (x = first arpeggio offset, y = second arpeggio offset) ; d4 = xy @@ -2005,7 +2008,7 @@ mt_fineportadn: tst.b mt_Counter(a4) beq do_porta_down rts - erem + endc ; JAZZCAT mt_portadown: ; cmd 2 x x (add xx to period) @@ -2076,7 +2079,7 @@ mt_toneporta_nc: .5: move.w d2,AUDPER(a5) .6 rts - rem + ifeq JAZZCAT mt_vibrato: ; cmd 4 x y (x = speed, y = amplitude) ; d4 = xy @@ -2130,7 +2133,7 @@ mt_vibrato_nc: ; increase vibratopos by speed add.b d4,n_vibratopos(a2) rts - erem + endc ; JAZZCAT mt_tonevolslide: ; cmd 5 x y (x = volume-up, y = volume-down) @@ -2139,7 +2142,7 @@ mt_tonevolslide: pea mt_volumeslide(pc) bra mt_toneporta_nc - rem + ifeq JAZZCAT mt_vibrvolslide: ; cmd 6 x y (x = volume-up, y = volume-down) ; d4 = xy @@ -2214,7 +2217,7 @@ mt_tremolo: ; increase tremolopos by speed add.b d4,n_tremolopos(a2) rts - erem + endc ; JAZZCAT mt_volumeslide: ; cmd A x y (x = volume-up, y = volume-down) @@ -2250,7 +2253,7 @@ set_vol: move.w d0,AUDVOL(a5) rts - rem + ifeq JAZZCAT mt_posjump: ; cmd B x y (xy = new song position) ; d4 = xy @@ -2263,7 +2266,7 @@ jump_pos0: move.w d7,mt_PBreakPos(a4) st mt_PosJumpFlag(a4) rts - erem + endc ; JAZZCAT mt_volchange: ; cmd C x y (xy = new volume) @@ -2280,7 +2283,7 @@ mt_volchange: move.w d4,AUDVOL(a5) rts - rem + ifeq JAZZCAT mt_patternbrk: ; cmd D x y (xy = break pos in decimal) ; d4 = xy @@ -2300,7 +2303,7 @@ mt_patternbrk: mult10tab: dc.b 0,10,20,30,40,50,60,70,80,90,0,0,0,0,0,0 - erem + endc ; JAZZCAT mt_setspeed: ; cmd F x y (xy<$20 new speed, xy>=$20 new tempo) @@ -2321,7 +2324,7 @@ mt_setspeed: move.b d0,CIAB+CIATAHI rts - rem + ifeq JAZZCAT mt_e_cmds: ; cmd E x y (x=command, y=argument) ; d4 = xy @@ -2577,7 +2580,7 @@ mt_funk: move.w d0,n_funk(a2) bne mt_updatefunk .1: rts - erem + endc ; JAZZCAT mt_updatefunk: ; d0 = funk speed @@ -3164,10 +3167,10 @@ mt_TuningM1 rs.w 36 ; Antiriad - end of periodtable ; Antiriad - vibrato sine table - rem + ifeq JAZZCAT mt_VibratoSineTable rs.b 16*64 mt_VibratoSineTable_End rs.b 0 - erem + endc ; JAZZCAT ; Antiriad - end of vibrato sine table mt_chan1 rs.b n_sizeof diff --git a/system/effect.c b/system/effect.c index 3730aa09..450362d2 100644 --- a/system/effect.c +++ b/system/effect.c @@ -94,7 +94,7 @@ void EffectRun(EffectT *effect) { int t = ReadFrameCounter(); exitLoop = LeftMouseButton(); frameCount = t; - if (effect->Render) + if ((lastFrameCount != frameCount) && effect->Render) effect->Render(); lastFrameCount = t; } while (!exitLoop);