diff --git a/Makefile b/Makefile index 3d629dde..90302be1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ TOPDIR = $(realpath .) -SUBDIRS = tools lib system intro effects +SUBDIRS = tools lib system intro EXTRA-FILES = tags cscope.out CLEAN-FILES = bootloader.bin a500rom.bin addchip.bootblock.bin vbrmove diff --git a/config.mk b/config.mk index 471c79d2..209317a4 100644 --- a/config.mk +++ b/config.mk @@ -2,13 +2,13 @@ # to aid debugging and profiling. This may render executable files # unusable (most likely crash) on real hardware. # 0 => Disable use of aforementioned features. Required for a release! -UAE := 1 +UAE := 0 # [only when UAE=0] Redirect diagnostic and log messages to: # 0 => null output (drop messages) # 1 => parallel port # 2 => serial port -LOGOUT := 2 +LOGOUT := 0 # 1 => Make executable files compatible with AmigaOS. Created ADFs will # be formatted with Old Filesystem (KS1.3) and contain special bootblock @@ -16,27 +16,27 @@ LOGOUT := 2 # automatically facilitating `startup-sequence` feature of AmigaDOS. # 0 => Executable files must be started from ROM or ADF since they require # custom environment created by bootstrap code. -AMIGAOS := 0 +AMIGAOS := 1 # 1 => Turn on profiler that reports minimum-average-maximum number of raster # lines measured between calls to ProfilerStart / ProfilerStop. # The measurement is reported every 50 frames (i.e. once a second). -PROFILER := 1 +PROFILER := 0 # 1 => Enable multitasking feature. It can be necessary to run background thread # that loads data from disk while the effects are running. -MULTITASK := 1 +MULTITASK := 0 # 1 => Enable dynamic memory allocation debugging incl. nice diagnostic printout # when memory corruption is detected or we run out of memory. -MEMDEBUG := 1 +MEMDEBUG := 0 # [only when AMIGAOS=1] Amount of chip and fast (or public) memory # (in kilobytes!) passed to our custom memory allocator. # To calculate total memory taken after an executable file # is loaded into memory please use `m68k-amigaos-objdump` tool. -CHIPMEM := 160 -FASTMEM := 288 +CHIPMEM := 200 +FASTMEM := 160 # Pass "VERBOSE=1" at command line to display command being invoked by GNU Make VERBOSE ?= 0 diff --git a/effects/Config.fs-uae b/effects/Config.fs-uae index 62038770..c050044a 100644 --- a/effects/Config.fs-uae +++ b/effects/Config.fs-uae @@ -5,6 +5,7 @@ fade_in_duration = 0 fade_out_duration = 0 accuracy = 1 amiga_model = A500 +#amiga_model = A1200 # A500 A500+ A600 A1200 A1200/020 A3000 A4000/040 # chip_memory = 512 # slow_memory = 512 diff --git a/include/linkerset.h b/include/linkerset.h index 72d7aaa5..66a33eef 100644 --- a/include/linkerset.h +++ b/include/linkerset.h @@ -18,12 +18,20 @@ * Constructors are called in ascending order of priority, * while destructors in descending. */ +#if 0 #define ADD2INIT(ctor, pri) \ ADD2LIST(ctor, __INIT_LIST__, N_SETT); \ STABS(_L(__INIT_LIST__), N_SETA, 0, 0, pri + 128) +#else +#define ADD2INIT(ctor, pri) +#endif +#if 0 #define ADD2EXIT(dtor, pri) \ ADD2LIST(dtor, __EXIT_LIST__, N_SETT); \ STABS(_L(__EXIT_LIST__), N_SETA, 0, 0, 128 - pri) +#else +#define ADD2EXIT(dtor, pri) +#endif #endif /* !__LINKERSET_H__ */ diff --git a/intro/Makefile b/intro/Makefile index c861ff2d..1aa1a431 100644 --- a/intro/Makefile +++ b/intro/Makefile @@ -2,7 +2,7 @@ TOPDIR := $(realpath ..) DELTA := 0 VQ := 0 -KLANG := 0 +KLANG := 1 MODULE := JazzCat-DerKlang diff --git a/intro/main.c b/intro/main.c index 44220e82..4d9c129e 100644 --- a/intro/main.c +++ b/intro/main.c @@ -56,7 +56,8 @@ static EffectT *AllEffects[] = { }; static void ShowMemStats(void) { - Log("[Memory] CHIP: %d FAST: %d\n", MemAvail(MEMF_CHIP), MemAvail(MEMF_FAST)); + Log("[Memory] CHIP: %d FAST: %d\n", + MemAvail(MEMF_CHIP), MemAvail(MEMF_PUBLIC)); } void PixmapToBitmap(BitmapT *bm, short width, short height, short depth, @@ -190,6 +191,8 @@ static void RunEffects(void) { } extern void InitSamples(void); +extern void InitColorTab(void); +extern void InitSinTab(void); int main(void) { /* NOP that triggers fs-uae debugger to stop and inform GDB that it should @@ -197,6 +200,8 @@ int main(void) { asm volatile("exg %d7,%d7"); ResetSprites(); + InitColorTab(); + InitSinTab(); InitSamples(); PtInstallCIA(); PtInit(Module, Samples, 0); diff --git a/lib/libmisc/sintab.py b/lib/libmisc/sintab.py index 1bf097f8..19e447e6 100755 --- a/lib/libmisc/sintab.py +++ b/lib/libmisc/sintab.py @@ -7,26 +7,33 @@ with open('sintab.c', 'w') as fh: with redirect_stdout(fh): prec = 4096 + n = prec // 4 print('#include ') print('#include \n') - print('short sintab[%d] = {' % prec) + print('short sintab[%d];\n' % (prec + 1)) - sintab = [int(sin(i * 2 * pi / prec) * prec) for i in range(prec)] - prev = 0 - - for a in sintab: - print('\t%d,' % (a - prev)) - prev = a + sintab = [int(sin(i * 2 * pi / prec) * prec) for i in range(n + 1)] + print('static char _sintab_encoded[%d] = {' % len(sintab)) + prev = 0 + for curr in sintab: + print('\t%d,' % (curr - prev)) + prev = curr print('};') + print('\nvoid InitSinTab(void) {') - print(' short sum = 0, n = %d;' % prec) - print(' short *tab = sintab;') + print(' short sum = 0, n = %d;' % n) + print(' char *encoded = _sintab_encoded;') + print(' short *inc = &sintab[0];') + print(' short *dec = &sintab[%d + 1];' % (n * 2)) print(' Log("[Init] Preparing sinus table\\n");') - print(' while (--n >= 0) {') - print(' sum += *tab;') - print(' *tab++ = sum;') - print(' }') + print(' do {') + print(' sum += *encoded++;') + print(' inc[2048] = -sum;') + print(' *inc++ = sum;') + print(' *--dec = sum;') + print(' dec[2048] = -sum;') + print(' } while (--n != -1);') print('}') print('\nADD2INIT(InitSinTab, 0);') diff --git a/lib/libmisc/sync.c b/lib/libmisc/sync.c index 2a4ae770..fd317520 100644 --- a/lib/libmisc/sync.c +++ b/lib/libmisc/sync.c @@ -90,12 +90,14 @@ short TrackValueGet(TrackT *track, short frame) { return curr->value + normfx(track->delta * k); } +#if 0 case TRACK_QUADRATIC: { short t = div16(shift12(step), track->interval); short k = normfx(t * t); return curr->value + normfx(track->delta * k); } +#endif case TRACK_TRIGGER: { diff --git a/system/amigaos.c b/system/amigaos.c index 32a34306..f7f564e2 100644 --- a/system/amigaos.c +++ b/system/amigaos.c @@ -149,6 +149,9 @@ BootDataT *SaveOS(void) { Log("[Startup] Save AmigaOS state.\n"); + Log("[Startup] AvailMem: CHIP=%lu FAST=%lu\n", + AvailMem(MEMF_CHIP), AvailMem(MEMF_FAST)); + /* KS 1.3 and earlier are brain-dead since they don't clear BSS sections :( */ if (ExecVer <= 34) { bzero(_bss, (size_t)_bss_size); diff --git a/system/effect.c b/system/effect.c index 56034f68..91d7696d 100644 --- a/system/effect.c +++ b/system/effect.c @@ -87,6 +87,7 @@ void EffectUnLoad(EffectT *effect) { SendEffectStatus(effect); } +#if 0 void EffectRun(EffectT *effect) { SetFrameCounter(0); @@ -101,3 +102,4 @@ void EffectRun(EffectT *effect) { lastFrameCount = t; } while (!exitLoop); } +#endif diff --git a/system/kernel/memory.c b/system/kernel/memory.c index 26213032..46acfe97 100644 --- a/system/kernel/memory.c +++ b/system/kernel/memory.c @@ -309,6 +309,7 @@ static void ArenaMemFree(ArenaT *ar, void *ptr) { MutexUnlock(&MemMtx); } +#if 0 static void *ArenaMemResize(ArenaT *ar, void *old_ptr, u_int size) { void *new_ptr = NULL; u_int reqsz, sz; @@ -364,6 +365,7 @@ static void *ArenaMemResize(ArenaT *ar, void *old_ptr, u_int size) { Debug("%s(%p, %ld) = %p", __func__, old_ptr, size, new_ptr); return new_ptr; } +#endif #if MEMDEBUG #define Msg(...) if (verbose) Log(__VA_ARGS__) @@ -455,6 +457,7 @@ void MemFree(void *p) { ArenaMemFree(ArenaOf(p), p); } +#if 0 void *MemResize(void *old_ptr, u_int size) { void *new_ptr; ArenaT *ar; @@ -482,6 +485,7 @@ void *MemResize(void *old_ptr, u_int size) { return NULL; } +#endif #if MEMDEBUG void MemCheck(int verbose) { diff --git a/system/loader.c b/system/loader.c index 82764b96..826e5660 100644 --- a/system/loader.c +++ b/system/loader.c @@ -73,14 +73,18 @@ void Loader(BootDataT *bd) { #if MULTITASK TaskInit(CurrentTask, "main", bd->bd_stkbot, bd->bd_stksz); #endif +#if 0 CallFuncList(&__INIT_LIST__); +#endif { __unused int retval = main(); Log("[Loader] main() returned %d.\n", retval); } +#if 0 CallFuncList(&__EXIT_LIST__); +#endif Log("[Loader] Shutdown complete!\n"); }