diff --git a/public/octatrack-modules/tapeecho/0.1.8-experimental.mwrm b/public/octatrack-modules/tapeecho/0.1.8-experimental.mwrm new file mode 100644 index 0000000000..d551f2b7cf Binary files /dev/null and b/public/octatrack-modules/tapeecho/0.1.8-experimental.mwrm differ diff --git a/sdk/catalog.json b/sdk/catalog.json index 0d6b2f0cfc..ca510ff54f 100644 --- a/sdk/catalog.json +++ b/sdk/catalog.json @@ -9,7 +9,7 @@ }, { "id": "tapeecho", - "version": "0.1.6-experimental", + "version": "0.1.8-experimental", "addedAt": "2026-10-01T06:53:41Z" }, { diff --git a/sdk/machines/octatrack/module-adapters/standalone-recipes.json b/sdk/machines/octatrack/module-adapters/standalone-recipes.json index 4c0f70af07..7e8be6573f 100644 --- a/sdk/machines/octatrack/module-adapters/standalone-recipes.json +++ b/sdk/machines/octatrack/module-adapters/standalone-recipes.json @@ -158,18 +158,19 @@ }, "tapeecho": { "schema": 1, - "imageSha256": "def1bc39f8bc9e998cf49b7df6ab36725f42f460b1e73c079238ebc4c25caded", + "imageSha256": "ba47d759eadf54b4cf80f1c732584818ff903ad90d4d981109ad1940182b5721", "sources": { - "sdk/octabam/modules/tapeecho/cpu_hooks.s": "d1d959af91fbd0759191c5e244b4396613d18c057c8e65281d76cb67beb73e34", - "sdk/octabam/modules/tapeecho/cpu.c": "bbb50e96305a64f99d72045defa40d09ab3e8fc910e717d8122dd1f070de35a7", + "sdk/octabam/modules/tapeecho/cpu_hooks.s": "941e9d01fe4dbdc9727e3f0e53ec184b848b36034a0701cef4cdcf4ff611b515", + "sdk/octabam/modules/tapeecho/cpu.c": "a46aee0821d024e9ce04b5685f5f7fb64af7ff5e00d018c00f87bda878438da2", "sdk/octabam/modules/tapeecho/time_fmt.s": "f50337532bbd802f67bb3c93d975405c2e386ec2a75bf525a814b9f9756f9d15", "sdk/octabam/modules/tapeecho/cpu_tables.h": "1d2e3e062651f021ca94fd19339dde824bcf49c4d867da790c20957dd24db9b2", "sdk/octabam/modules/tapeecho/manifest.py": "8444fc496776df2c719401f6967aba44a5922e15f0906268286663d012dd94b8", - "sdk/octabam/modules/tapeecho/octamod.module.json": "5f41cfb21b3a9cecc514a69825ce3278ccb1b2d6aeea52053e3452bc5111befc", - "sdk/octabam/modules/tapeecho/cpu_kernels.s": "1cb1d400cbf0f0b7a75dc0ea13f6afc70b56221f2d45f424f7f58fa79ce6347f", - "sdk/octabam/modules/tapeecho/cpu.s": "783901f817efc5496c9b6178367459cfae1fe036adfd2a5be3a89d62e37906b6", + "sdk/octabam/modules/tapeecho/octamod.module.json": "432b0b6b570504e250baaaf02c7ae6f622ac836e13e8ab6a7aa7805446eb28d3", + "sdk/octabam/modules/tapeecho/runtime.json": "b66e3eddc16f9d5d40586f537cab7ccdf1c19688fed1c88e314525dab026dd87", + "sdk/octabam/modules/tapeecho/cpu_kernels.s": "0abbfc5cb6189f08f5ecddb101867b67de23a8de6894ffb00c89583b420360bc", + "sdk/octabam/modules/tapeecho/cpu.s": "0040e5d5234e15e2e668e6449370916133002c9bd233bbbc40284057e5345c49", "sdk/octabam/modules/tapeecho/cpu_passthrough.asm": "68ef0beaa213de43e116d2feb367b437ef8c73c7f7b1c07328fde2d72edb3fdc", - "sdk/octabam/modules/tapeecho/cpu.h": "d07d496a62b95f23f8c2cbd893a0125e8a67071e83bf2c642e14251e48e69ff3", + "sdk/octabam/modules/tapeecho/cpu.h": "b3afe117675ec7cc9a6cd3cf0930a482161575d5ca12d034016571e7646c2e72", "sdk/octabam/modules/tapeecho/generate_tables.py": "3461b659e2f22d7da776eb87755610094a4a3e72609c875e82902a8da9a8a69c", "sdk/octabam/modules/tapeecho/generate_cpu.py": "09477f59af29dc6b68458454f818ec999339f4f4eefadb979cc13236ce431353", "sdk/octabam/modules/tapeecho/media/capture.json": "8e0627d47f074322917978cd4abf505d82d9b53ece8e8c2b1ad280b69cd2902b", @@ -205,7 +206,7 @@ "src/engine/coldfire-elf.ts": "319ca0d835d1b0c602c8f4b06990016d0ebfe246cedbfc596cea3cc7adfe3cd2", "src/engine/module-build.ts": "dcd8397b8cecf6fab61debd9aa2f86f612da0ca6ccf363c79d56033bc170b993", "src/catalog/modules.ts": "14304ea8450f8ec7ecaaf3ccf9e764929161288babe7b34cb37ff41e44fe1b43", - "src/engine/assets/dsp-packages.json": "2fa2454f9a802eb2b40e6ddbf4f69f34802894130504f38f2bf1db6a31479155", + "src/engine/assets/dsp-packages.json": "300d2620eb43fe37e86c9995c889859326102073bfd4839c6391a4c383108bb2", "src/engine/assets/descriptor-recipes.json": "a68ac90d1e83ead391f8058f51458e0dc4a48a250db9585135b2c620d66dac0b", "src/engine/assets/menu-recipes.json": "da6bf3602d4546eca11d1cc76f2772127b505bc01ecc8bae04d697e6ce0bc942", "src/engine/assets/rom-packages.json": "3c45c7b7b681d4df243c6f332dbb6a6119f5008aefd4abd5175423f7d500c6de", @@ -244,120 +245,7 @@ "sdk/firmware_codec/transport.py": "30f1b71c28cf4c57fdbe38c0e535465cc2f29503ef348888a68940f93f070ae5", "sdk/octabam/modules/tapeecho/evidence/cpu-price.json": "e36a69f6d41fea8d53ce061599289edf1fecc99b6722542fe6504f578cc7f02c" }, - "copies": [ - { - "offset": 676, - "length": 16, - "address": 1073984446, - "sha256": "2208dade979a9235783eacb36cdde6fac1f68a1c1e97629678e6ef71eaa7643b", - "purpose": "Authored free instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/time_fmt.s", - "lines": [ - 46, - 49 - ], - "symbol": "free", - "method": "native-formatter" - } - }, - { - "offset": 3076, - "length": 18, - "address": 1073753950, - "sha256": "1e998d15e30ac012a8b3cd88d4588e8f85d7921a2850b0551b2259a84752a995", - "purpose": "Authored render_head instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/cpu.s", - "lines": [ - 915, - 919 - ], - "symbol": "render_head", - "method": "native-unit" - } - }, - { - "offset": 3100, - "length": 26, - "address": 1074366192, - "sha256": "90dc32b1ff6203f13faaba47d8a89d606c770746e69ea8010df241e1241fd9c5", - "purpose": "Authored render_head instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/cpu.s", - "lines": [ - 921, - 927 - ], - "symbol": "render_head", - "method": "native-unit" - } - }, - { - "offset": 3462, - "length": 19, - "address": 1074375602, - "sha256": "3fd2ea50644e110d89a47a30180101283abeae689e44d39c646c941fea217965", - "purpose": "Authored te_target instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/cpu.s", - "lines": [ - 1055, - 1060 - ], - "symbol": "te_target", - "method": "native-unit" - } - }, - { - "offset": 7462, - "length": 13, - "address": 1073973354, - "sha256": "2393ebbe40716982dc0fc11a30e3e53f13d60755b68dc8f156a4cf02ec77c2f2", - "purpose": "Authored te_filter_block instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/cpu.s", - "lines": [ - 27285, - 27332 - ], - "symbol": "te_filter_block", - "method": "native-unit" - } - }, - { - "offset": 8940, - "length": 8, - "address": 1073897668, - "sha256": "8937904adb028ee826e1da6e9593b99222dd3fb141bbaa852b54ef596f94054f", - "purpose": "Authored te_tape_block instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/cpu.s", - "lines": [ - 27523, - 27524 - ], - "symbol": "te_tape_block", - "method": "native-unit" - } - }, - { - "offset": 8948, - "length": 16, - "address": 1073745896, - "sha256": "324b9e08fe60e608cbdebbbd690d3efdac6a0fc7a2ec6b9756fc1f64e1ef5281", - "purpose": "Authored te_read_linear instruction span; reconstructed identically from guarded stock coincidence", - "authored": { - "source": "sdk/octabam/modules/tapeecho/cpu.s", - "lines": [ - 27525, - 27545 - ], - "symbol": "te_read_linear", - "method": "native-unit" - } - } - ], + "copies": [], "fills": [] }, "euclid": { @@ -406,7 +294,7 @@ "src/engine/coldfire-elf.ts": "319ca0d835d1b0c602c8f4b06990016d0ebfe246cedbfc596cea3cc7adfe3cd2", "src/engine/module-build.ts": "dcd8397b8cecf6fab61debd9aa2f86f612da0ca6ccf363c79d56033bc170b993", "src/catalog/modules.ts": "14304ea8450f8ec7ecaaf3ccf9e764929161288babe7b34cb37ff41e44fe1b43", - "src/engine/assets/dsp-packages.json": "2fa2454f9a802eb2b40e6ddbf4f69f34802894130504f38f2bf1db6a31479155", + "src/engine/assets/dsp-packages.json": "300d2620eb43fe37e86c9995c889859326102073bfd4839c6391a4c383108bb2", "src/engine/assets/descriptor-recipes.json": "a68ac90d1e83ead391f8058f51458e0dc4a48a250db9585135b2c620d66dac0b", "src/engine/assets/menu-recipes.json": "da6bf3602d4546eca11d1cc76f2772127b505bc01ecc8bae04d697e6ce0bc942", "src/engine/assets/rom-packages.json": "3c45c7b7b681d4df243c6f332dbb6a6119f5008aefd4abd5175423f7d500c6de", diff --git a/sdk/octabam/tools/harness/tapeecho_cpu_probe.cpp b/sdk/octabam/tools/harness/tapeecho_cpu_probe.cpp index e54ebeda19..5971fe19da 100644 --- a/sdk/octabam/tools/harness/tapeecho_cpu_probe.cpp +++ b/sdk/octabam/tools/harness/tapeecho_cpu_probe.cpp @@ -174,7 +174,7 @@ static void kernel_tests(ot::Machine& m) { const unsigned mode=test%4; s.mix=mode==0?0:mode==1?2147483640:(random()%128)*16909320u; s.hiss=te_hiss[random()%128]<<16; - s.filters[0][0]=int32_t(random())/8;s.filters[0][1]=int32_t(random())/8; + s.fir[0]=int32_t(random())/8;s.fir[1]=int32_t(random())/8; int32_t dm=0,df=0,dn=0; if(mode==3) { dm=test%16==3?-s.mix/8:(int32_t((random()%128)*16909320u)-s.mix)/512; @@ -274,12 +274,16 @@ static void kernel_tests(ot::Machine& m) { std::puts(" [PASS] reader data-load counts match overlap reuse: settled block reads 17 uncached words instead of 32"); } #endif +// Stock's free-running DTIM3 count, which Tape Echo's overload hold reads. It +// stands still (no hold ever) unless a test moves it. +static uint32_t g_dtcn3=0; // The boot-only Machine deliberately has no peripheral models. Attach the // production descriptor/completion model plus a synchronous RAM DMA mover. // This proves addresses/order/bytes, NOT cache coherency or bus timing. static void dma_model(ot::Machine& m, ot::Edma& dma) { m.setPeripheralHandlers( [&](uint32_t a, uint8_t n, uint32_t& v) { + if(a>=0xfc07c00cu && a<0xfc07c010u) { v=n==4?g_dtcn3:n==2?(a&2?g_dtcn3&0xffff:g_dtcn3>>16):(g_dtcn3>>(8*(3-(a&3))))&255; return true; } if(a=ot::Edma::g_tcd+512) return false; v=dma.read(a,n); return true; }, @@ -302,6 +306,7 @@ static void benchmark(const std::vector& image,const std::vector& image,const std::vector& image,const std::vector>std::hex>>address>>type>>name && name==wanted) return address; + } + std::fprintf(stderr,"missing symbol %s\n",wanted); std::exit(1); +} +// The steady path (te_cpu_frame: the same knob words and tempo as the last full +// block, which left s->steady set) must compute exactly what the full control +// half computes. Two native engines, one always full, one taking the steady +// path whenever that decision allows it, over random piecewise-constant +// controls (out-of-range knobs, invalid tempos, SYNC values above 1, dirty +// re-entries): every state word, audio and record word equal after every block. +static void steady_equivalence() { + uint32_t rs=0x2545f491u; + auto rnd=[&]{rs^=rs<<13;rs^=rs>>17;rs^=rs<<5;return rs;}; + auto knob=[&]{return rnd()%100<3 ? 128+rnd()%128 : rnd()%128;}; + static std::vector ringA(TE_RING*2), ringB(TE_RING*2); + for(unsigned i=0;i>(rnd()%4); + const unsigned steady=B.steady && B.active && !std::memcmp(&p,&prev,sizeof p); + steadyBlocks+=steady; + te_process(&A,&p,ringA.data(),write,audioA,recA); + te_host_process(&B,&p,ringB.data(),write,audioB,recB,steady); + if(std::memcmp(&A,&B,sizeof A)||std::memcmp(audioA,audioB,sizeof audioA)||std::memcmp(recA,recB,sizeof recA)) { + std::fprintf(stderr,"steady path differs from the full path at block %lu (steady %u)\n",b,steady);std::exit(1); + } + for(unsigned i=0;i<32;++i)ringA[2*write+i]=ringB[2*write+i]=recA[i]; + write+=16; if(write>=TE_RING)write=0; + prev=p; + } + if(steadyBlocks> rings(8, std::vector(TE_RING * 2)); unsigned write = TE_RING - 160, peak = 0; - const unsigned frames = 2300; + // 2300..3499: controls that stand still for hundreds of blocks, so the + // ColdFire takes its steady path (only the full control half stores + // s->active: those stores count the full blocks); then + // 3500..3503 move stock's DTIM3 count: one frame, a frame and a half late + // at 3502, must hold every instance and nothing else. + const unsigned frames = 3504, settled = 2300, settledEnd = 3500; + unsigned holdChecked = 0, full = 0; + m.addWriteWatch(state,state+8*sizeof(TapeState),[&full,state](uint32_t a,uint8_t,uint32_t,uint32_t){full+=(a-state)%sizeof(TapeState)==0;}); for (unsigned frame = 0; frame < frames; ++frame) { + if(frame==settled)full=0; + if(frame==settledEnd) { + const unsigned blocks=8*(settledEnd-settled); + if(full>=blocks*3/4){std::fprintf(stderr,"steady path not taken: %u of %u blocks ran the full control half\n",full,blocks);return 1;} + std::printf(" [PASS] ColdFire steady path taken while controls stand still: %u of %u blocks ran the full control half\n",full,blocks); + } + if(frame>=settledEnd) g_dtcn3 = frame==settledEnd ? 1000000u : g_dtcn3 + (frame==settledEnd+2 ? TE_FRAME_COUNTS*3/2 : TE_FRAME_COUNTS); + const bool holding = frame==settledEnd+2; if(frame==2000) { // A second, synthetic full-history phase covers long BEAT // targets and an active-history wrap, not startup silence. @@ -562,6 +636,12 @@ int main(int argc, char **argv) { p.mix=(frame/13+t*31)%128;p.sync=(frame/41)%2; } p.age=(frame/8+t*13)%128; + if (frame >= settled) { + // Piecewise constant: one small FDBK step on T1-T4 halfway, a + // tempo change on T3 every 100 frames (FREE: target unchanged). + p = TapeParams{60u+t, 70u+(frame>=2900 && t<4), t&1 ? 0u : 25u, t==3, t==5 ? 127u : t==6 ? 0u : 40u, 64, + t==2 ? (100u+(frame/100)%40)*24 : 2880u}; + } p.lane=t; unsigned values[] = {p.time,p.feedback,p.wow,p.age,p.sync,p.mix}; // Execute the stock producer-to-consumer copy for the six page-1 @@ -589,7 +669,9 @@ int main(int argc, char **argv) { #endif out[i] = in[i]; m.write32(audio+4*i,in[i]); } - te_process(&states[t], &p, rings[t].data(), write, out, rec); + const TapeState before = states[t]; + if (holding) { for (unsigned i=0;i<32;++i) rec[i]=0; } + else te_process(&states[t], &p, rings[t].data(), write, out, rec); m68k_set_reg(m.getCpuState(), M68K_REG_SP, stack); // Execute stock's actual MACSR setup, then this image's detour. run(m,0x400031c4,0x400031ca); @@ -606,6 +688,11 @@ int main(int argc, char **argv) { } rings[t][write*2+i]=rec[i]; m.write32(ring+write*8+4*i,rec[i]); } + if (holding) { + // Held: dry passed untouched, silence recorded, only the history count moved. + states[t].valid = std::min(before.valid + TE_FRAMES, TE_RING - 1); + ++holdChecked; + } const uint32_t *s = reinterpret_cast(&states[t]); for (unsigned i=0;i #include "cpu.h" #include "cpu_tables.h" _Static_assert(sizeof(TapeState) == 200, "cpu_hooks.s allocation: 8 x 200 bytes"); +_Static_assert(offsetof(TapeState, rng) == 20 && offsetof(TapeState, mix) == 24 && + offsetof(TapeState, feedback) == 28 && offsetof(TapeState, hiss) == 40 && + offsetof(TapeState, fir) == 44, "te_tape_block's state offsets"); +_Static_assert(sizeof(TapeGuard) == 24 && offsetof(TapeGuard, live) == 20, + "cpu_hooks.s: te_guard after te_states, its live mask in byte 23"); static uint32_t minimum(uint32_t a, uint32_t b) { return a < b ? a : b; } /* Signed fractional EMAC, MACSR=0xa0 as established by stock 0x400031c4. @@ -191,7 +197,7 @@ static void render_head(int32_t *out, volatile int32_t *ring, uint32_t write, /* The assembly kernels read these tables; keep them in the unit. */ __attribute__((used)) static const int32_t *const te_kernel_tables[] = {te_hp, te_tape_curve, te_record_gain}; -/* Both playback sections in one pass, z = filters[1..2]. */ +/* Both playback sections in one pass, z = s->z. */ void te_filter_block(int32_t *, const int32_t *, int32_t *); #define filter_block te_filter_block /* Record sum, [1,6,1]/8 FIR, tape curve, DMA staging and output mix. */ @@ -250,7 +256,7 @@ static void tape_block(TapeState *restrict s, const int32_t *restrict wet, int32_t dm, int32_t df, int32_t dn) { const int32_t drive=te_record_gain[0]; const int settled=!(dm|df|dn); - int32_t x1=s->filters[0][0], x2=s->filters[0][1]; + int32_t x1=s->fir[0], x2=s->fir[1]; uint32_t rng=s->rng; for (unsigned i=0;imix+=dm; s->feedback+=df; s->hiss+=dn; @@ -276,7 +282,7 @@ static void tape_block(TapeState *restrict s, const int32_t *restrict wet, audio[2*i+1]=readout(4*emac(w,wg) + emac(R,dg)); } } - s->rng=rng; s->filters[0][0]=x1; s->filters[0][1]=x2; + s->rng=rng; s->fir[0]=x1; s->fir[1]=x2; } #define te_tape_block tape_block #ifdef TE_HOST @@ -316,24 +322,67 @@ static __attribute__((noinline)) void tone_update(TapeState *s) { if (update_corner || update_worn) for (unsigned j=0;j<3;++j) { int32_t c=te_tone[worn*57+index][j]; if (index<56) c+=mul31(te_tone[worn*57+index+1][j]-c,(speed&8191u)<<18); - s->filter_targets[0][j]=c; + s->filter_targets[j]=c; } /* The /8 step at quarter control rate retains roughly the old /32 * smoothing time. Skip settled coefficients until tone changes. */ if (update_corner || update_worn || s->filter_pending) { s->filter_pending=0; for (unsigned j=0;j<3;++j) { - int32_t delta=s->active ? (s->filter_targets[0][j]-s->coefficients[0][j])/8 - : s->filter_targets[0][j]; - s->coefficients[0][j]+=delta; + int32_t delta=s->active ? (s->filter_targets[j]-s->coefficients[j])/8 + : s->filter_targets[j]; + s->coefficients[j]+=delta; s->filter_pending |= delta!=0; } } } -void te_process(TapeState *restrict s, const TapeParams *restrict p, +/* Two cheap oscillators: 0.8 Hz wow, gently randomized ~8..12 Hz + * flutter. No travel-time integration, speed-dependent oscillator + * divisions, capstan harmonic or drift oscillator. At WOW=44 this + * retains about eight cents RMS; AGE increases the flutter component. + * age and wow are s->age and s->wow before this block's ramp step. Sets + * s->wobble_step, the head's wow step for this block. */ +static inline void oscillate(TapeState *restrict s, int32_t age, int32_t wow) { + s->phase += 16u*77913u; + s->flutter_rate += ((int32_t)s->flutter_target-(int32_t)s->flutter_rate)/16; + uint32_t old=s->flutter; + s->flutter+=16u*s->flutter_rate; + if (s->flutterflutter_target=779132u+(random32(s)&0x3ffffu); + int32_t wobble_step = -s->wobble/16; + if (wow || s->wobble) { + int32_t wow_amp=mul31(159*256,wow); + int32_t flutter_amp=mul31(256+8*(age>>16),wow); + int32_t w=2*mul31(wow_amp,sine(s->phase)) + +2*mul31(flutter_amp,sine(s->flutter)); + wobble_step = (w*256 - s->wobble)/16; + } + /* A snapped time changes the integrated wow offset. Do not traverse + * that offset in one block: bound acceleration as well as velocity. + * Normal low-rate wow is below these bounds; a mode/TIME jump is not. */ + if (wobble_step>s->wobble_step+128) wobble_step=s->wobble_step+128; + if (wobble_stepwobble_step-128) wobble_step=s->wobble_step-128; + if (wobble_step>8192) wobble_step=8192; + if (wobble_step<-8192) wobble_step=-8192; + s->wobble_step=wobble_step; +} + +/* One block. steady (te_cpu_hook only) says the previous block left + * s->steady set and these are its controls again: then every control + * computation below would repeat itself, every ramp delta is zero and the + * motor and fades are at rest, so they are left out and only the clocks, + * the head and the audio run. The arithmetic is te_process's either way. */ +void te_block(TapeState *restrict s, const TapeParams *restrict p, volatile int32_t *restrict ring, uint32_t write, - int32_t *restrict audio, int32_t *restrict record) { + int32_t *restrict audio, int32_t *restrict record, unsigned steady) { + int32_t dm = 0, df = 0, dn = 0, movement = 0; + unsigned dry = 0; /* MIX is 0: snap the ramp's residual after the block */ + /* The oscillators read AGE and WOW before this block's ramp steps, and + * nothing after them reads either: the old order, ramps stepped earlier. */ + int32_t age_now = s->age, wow_now = s->wow; + if (steady) { + if (!((s->control_clock++ + p->lane) & 3u)) tone_update(s); + } else { if (p->tempo >= 720 && p->tempo <= 7200) s->tempo = p->tempo; if (s->tempo < 720 || s->tempo > 7200) s->tempo = 2880; uint32_t target = te_target(p, s->tempo); @@ -369,50 +418,36 @@ void te_process(TapeState *restrict s, const TapeParams *restrict p, if (!((s->control_clock++ + p->lane) & 3u) || !s->active) tone_update(s); s->active = 1; /* ~12 ms gain ramps; no gain reset or phase reset at FREE/BEAT changes. */ - int32_t dm = (mix-s->mix)/512, df = (feedback-s->feedback)/512; + dm = (mix-s->mix)/512; df = (feedback-s->feedback)/512; int32_t da = ((int32_t)(age<<16)-s->age)/512, dw = (wow-s->wow)/512; - int32_t dn = ((te_hiss[age]<<16)-s->hiss)/512; - /* Two cheap oscillators: 0.8 Hz wow, gently randomized ~8..12 Hz - * flutter. No travel-time integration, speed-dependent oscillator - * divisions, capstan harmonic or drift oscillator. At WOW=44 this - * retains about eight cents RMS; AGE increases the flutter component. */ - s->phase += 16u*77913u; - s->flutter_rate += ((int32_t)s->flutter_target-(int32_t)s->flutter_rate)/16; - uint32_t old=s->flutter; - s->flutter+=16u*s->flutter_rate; - if (s->flutterflutter_target=779132u+(random32(s)&0x3ffffu); - int32_t wobble_step = -s->wobble/16; - if (s->wow || s->wobble) { - int32_t wow_amp=mul31(159*256,s->wow); - int32_t flutter_amp=mul31(256+8*(s->age>>16),s->wow); - int32_t w=2*mul31(wow_amp,sine(s->phase)) - +2*mul31(flutter_amp,sine(s->flutter)); - wobble_step = (w*256 - s->wobble)/16; - } - /* A snapped time changes the integrated wow offset. Do not traverse - * that offset in one block: bound acceleration as well as velocity. - * Normal low-rate wow is below these bounds; a mode/TIME jump is not. */ - if (wobble_step>s->wobble_step+128) wobble_step=s->wobble_step+128; - if (wobble_stepwobble_step-128) wobble_step=s->wobble_step-128; - if (wobble_step>8192) wobble_step=8192; - if (wobble_step<-8192) wobble_step=-8192; - s->wobble_step=wobble_step; - int32_t playback[TE_FRAMES]; - uint32_t position=s->position; - int32_t motor_step=0; - if (!p->sync && !s->fade_left && position!=target) { - int32_t error=(int32_t)target-(int32_t)position; + dn = ((te_hiss[age]<<16)-s->hiss)/512; + if (!p->sync && !s->fade_left && s->position!=target) { + int32_t error=(int32_t)target-(int32_t)s->position; /* One slew calculation per block. No motor acceleration model or * fractional velocity state. Fractional read positions still ramp * linearly through the block, so the read head never jumps. */ - int32_t movement=error/64; + movement=error/64; if (!movement) movement=error>0?1:-1; if (movement>512) movement=512; if (movement<-512) movement=-512; - s->position=position+movement; - motor_step=movement*16; + s->position+=movement; + } + /* Nothing ramps or moves and no fade runs: the same controls again + * would compute exactly these values and change nothing. */ + s->steady = !(dm|df|da|dw|dn) && s->position == target && !s->fade_left && + s->mode == !!p->sync; + age_now = s->age; wow_now = s->wow; + s->age += 16*da; s->wow += 16*dw; + /* Exact dry must not leave a tiny ramp residual forever. */ + if (!wow && s->wow < 512) s->wow = 0; + dry = !mix; } - render_head(playback,ring,write,position,s->wobble,wobble_step+motor_step,s->valid,TE_PLAIN); + oscillate(s, age_now, wow_now); + /* The head reads from where the motor stood at the block's start. */ + uint32_t position=s->position-movement; + int32_t wobble_step=s->wobble_step; + int32_t playback[TE_FRAMES]; + render_head(playback,ring,write,position,s->wobble,wobble_step+16*movement,s->valid,TE_PLAIN); if (s->fade_left) { /* The second head only exists during a BEAT transition; it * crossfades into the new head as it is read. */ @@ -423,43 +458,23 @@ void te_process(TapeState *restrict s, const TapeParams *restrict p, s->wobble+=16*wobble_step; /* All heads are >=32 samples behind this uncommitted block: playback * and record filters can be batched without changing feedback causality. */ - filter_block(playback,s->coefficients[0],s->filters[1]); + filter_block(playback,s->coefficients,s->z); te_tape_block(s,playback,audio,record,dm,df,dn); - s->age += 16*da; s->wow += 16*dw; - /* Exact dry must not leave a tiny ramp residual forever. */ - if (!mix && s->mix < 512) s->mix = 0; - if (!wow && s->wow < 512) s->wow = 0; + if (dry && s->mix < 512) s->mix = 0; s->valid = minimum(s->valid + TE_FRAMES, TE_RING - 1); } -#ifndef TE_HOST -#define U32(a) (*(volatile uint32_t *)(a)) -unsigned te_cpu_frame(uint32_t *sp) { - unsigned track = sp[112/4]; - const uint8_t *setup = (const uint8_t *)sp[76/4]; - if (track >= 8) return 0; - TapeState *s = &te_states[track]; - if (setup[7] != TE_ID || *(const uint8_t *)sp[108/4] == 7) { - s->active = 0; - return 0; - } - /* Six staged page-1 halfwords; each control is the high (first) byte. */ - const uint8_t *k = (const uint8_t *)sp[72/4]; - TapeParams p = {k[0], k[2], k[4], k[8], k[10], k[6], U32(0x8000181c), track}; - uint32_t base = 0x4f502c10u + track * TE_STRIDE; - uint32_t write = (sp[48/4] - base) >> 3; - if (write > TE_RING - TE_FRAMES) { s->active = 0; return 0; } - /* Stock 0x40003624 toggles these two scratch buffers after prefetching - * the NEXT track into the other one. Skipping that toggle would overwrite - * an in-flight DMA read and break every following stock-delay track. */ - U32(0x800000e8) ^= U32(0x40003626); - /* The stock filter drains its accumulators on its first sample. We - * bypass it, so establish the same empty accumulators first. */ - __asm__ volatile ("move.l #0,%%acc0\n\tmove.l #0,%%acc1\n\t" - "move.l #0,%%acc2\n\tmove.l #0,%%acc3" ::: "memory"); - te_process(s, &p, (volatile int32_t *)base, write, - (int32_t *)sp[96/4], (int32_t *)U32(0x800000e8)); - U32(0x80006180) += 68; /* stock filter's per-track state iterator */ - return 1; +void te_process(TapeState *restrict s, const TapeParams *restrict p, + volatile int32_t *restrict ring, uint32_t write, + int32_t *restrict audio, int32_t *restrict record) { + te_block(s, p, ring, write, audio, record, 0); +} +#ifdef TE_HOST +void te_host_process(TapeState *s, const TapeParams *p, volatile int32_t *ring, + uint32_t write, int32_t *audio, int32_t *record, unsigned steady) { + te_block(s, p, ring, write, audio, record, steady); } #endif + +/* The ColdFire's per-track entry, the overload hold and the steady decision + * are in cpu_hooks.s (te_cpu_hook). */ diff --git a/sdk/octatrack/modules/tapeecho/cpu.h b/sdk/octatrack/modules/tapeecho/cpu.h index 208305dbb1..b6641dfdbd 100644 --- a/sdk/octatrack/modules/tapeecho/cpu.h +++ b/sdk/octatrack/modules/tapeecho/cpu.h @@ -7,31 +7,55 @@ #define TE_RING 176400u #define TE_STRIDE 1411328u #define TE_FADE 512u +/* 16 samples at 44.1 kHz in counts of stock's free-running DTIM3 (132 MHz). */ +#define TE_FRAME_COUNTS 47891u typedef struct { uint32_t active, valid, position, tempo, phase, rng; - int32_t mix, feedback, age, wow, hiss; - int32_t filters[3][5], coefficients[1][5]; + int32_t mix, feedback, age, wow, hiss; /* te_tape_block reads 20..40 */ + int32_t fir[2]; /* 44: the record FIR's history */ + uint32_t unused0[3]; + int32_t z[8]; /* 64: both playback sections' histories and carries */ + uint32_t unused1; + uint32_t steady; /* nonzero: nothing ramps, glides or fades */ + int32_t coefficients[3]; + uint32_t unused2[2]; uint32_t flutter, flutter_rate, flutter_target; int32_t wobble, wobble_step; uint32_t fade_from, fade_left, mode; uint32_t cached_position, cached_age, cached_speed, cached_index, filter_pending; - int32_t filter_targets[1][5]; + int32_t filter_targets[3]; + uint32_t unused3[2]; uint32_t control_clock; } TapeState; typedef struct { uint32_t time, feedback, wow, sync, mix, age, tempo; uint32_t lane; /* track index: stagger slow tone work across instances */ } TapeParams; +/* Shared by every instance (cpu_hooks.s, beside te_states): the overload hold's + * clock and counters, and the tracks whose state may be active (low byte). */ +typedef struct { + uint32_t call, last, hold, holds, late, live; +} TapeGuard; void te_process(TapeState *, const TapeParams *, volatile int32_t *ring, uint32_t write, int32_t *audio, int32_t *record); uint32_t te_target(const TapeParams *, uint32_t tempo); extern TapeState te_states[8]; +extern TapeGuard te_guard; +/* Per track, the stock knob words and tempo of the last block that left s->steady set (te_cpu_hook). */ +extern uint32_t te_keys[8][4]; #ifdef TE_HOST void te_host_read_linear(int32_t *, volatile int32_t *, int32_t, int32_t, int32_t, int32_t); void te_host_filter_block(int32_t *, const int32_t *, int32_t *); void te_host_tape_block(TapeState *, const int32_t *, int32_t *, int32_t *, int32_t, int32_t, int32_t); +/* te_process with the ColdFire's steady path: steady nonzero only when the + * previous block left s->steady set and these are its controls again. */ +void te_host_process(TapeState *, const TapeParams *, volatile int32_t *ring, + uint32_t write, int32_t *audio, int32_t *record, unsigned steady); #endif -/* Returns nonzero only when the stock track loop must skip its DSP-era mix. */ -unsigned te_cpu_frame(uint32_t *stock_stack); +/* One block; te_process is te_block(..., 0). te_cpu_hook (cpu_hooks.s) calls + * it with steady nonzero only when the previous block left s->steady set and + * the stock knob words and tempo are the same again (te_keys). */ +void te_block(TapeState *, const TapeParams *, volatile int32_t *ring, uint32_t write, + int32_t *audio, int32_t *record, unsigned steady); #endif diff --git a/sdk/octatrack/modules/tapeecho/cpu.s b/sdk/octatrack/modules/tapeecho/cpu.s index 269d9c2278..a20608ec70 100644 --- a/sdk/octatrack/modules/tapeecho/cpu.s +++ b/sdk/octatrack/modules/tapeecho/cpu.s @@ -1,4 +1,4 @@ -| Generated by generate_cpu.py; edit cpu.c / cpu_hooks.s / cpu_kernels.s. +| Generated by generate_cpu.py (m68k-elf-gcc 16.2.0); edit cpu.c / cpu_hooks.s / cpu_kernels.s. #NO_APP .file "cpu.c" .text @@ -22,15 +22,15 @@ tone_update: move.l %a2,20(%sp) move.l %a3,24(%sp) cmp.l 156(%a0),%d3 - jeq .L29 + jeq .L26 lsr.l #8,%d0 move.l #1156055040,%d1 divu.l %d0,%d1 cmp.l #524288,%d1 - jhi .L30 + jhi .L27 cmp.l #65536,%d1 - jcs .L31 -.L9: + jcs .L28 +.L7: move.l %d3,156(%a0) moveq #13,%d3 move.l %d1,%d0 @@ -40,9 +40,9 @@ tone_update: subq.l #8,%d0 move.l %d0,168(%a0) cmp.l 20(%sp),%d1 - jne .L32 + jne .L29 cmp.l 24(%sp),%a1 - jeq .L25 + jeq .L22 clr.l 24(%sp) moveq #1,%d3 move.b %d3,31(%sp) @@ -53,68 +53,25 @@ tone_update: move.l %d4,%a1 add.l %d0,%a1 cmp.l %d0,%d3 - jcs .L11 -.L37: - moveq #18,%d4 - moveq #12,%d0 - move.l %a1,%d3 - muls.l %d0,%d3 - lsl.l %d4,%d1 + jcc .L11 +.L34: move.l %a1,%d0 moveq #12,%d4 - addq.l #1,%d0 muls.l %d4,%d0 lea te_tone,%a1 - move.l (%a1,%d3.l),%a2 - move.l (%a1,%d0.l),%d4 - move.l %a2,20(%sp) - and.l #2147221504,%d1 - sub.l %a2,%d4 -#APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d4,%d1,%acc0 - movclr.l %acc0,%d4 -| 0 "" 2 -#NO_APP - add.l %a1,%d3 - move.l %d3,%a2 add.l %d0,%a1 - move.l 4(%a2),%a2 - move.l 20(%sp),%a3 - add.l %d4,%a3 - move.l 4(%a1),%d0 - sub.l %a2,%d0 - move.l %a2,32(%sp) - move.l %a3,176(%a0) -#APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d0,%d1,%acc0 - movclr.l %acc0,%d4 -| 0 "" 2 -#NO_APP - move.l %d3,%a2 - move.l 32(%sp),%a3 - add.l %d4,%a3 - move.l 8(%a2),%d0 - move.l 8(%a1),%d3 - sub.l %d0,%d3 - move.l %a3,180(%a0) -#APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d3,%d1,%acc0 - movclr.l %acc0,%d1 -| 0 "" 2 -#NO_APP - add.l %d1,%d0 + move.l 8(%a1),%d0 + move.l (%a1),176(%a0) + move.l 4(%a1),180(%a0) .L12: move.l %d0,184(%a0) tst.l 24(%sp) - jne .L6 + jne .L13 tst.b 31(%sp) - jeq .L33 -.L6: + jeq .L30 +.L13: tst.l %d2 - jne .L13 + jne .L9 move.l 176(%a0),%d0 move.l 180(%a0),%d3 move.l 184(%a0),%d2 @@ -133,14 +90,14 @@ tone_update: movem.l (%sp),#3100 lea (40,%sp),%sp rts -.L25: +.L22: tst.l 172(%a0) jeq .L1 -.L13: +.L9: move.l 104(%a0),%a1 move.l 176(%a0),%d0 sub.l %a1,%d0 - jmi .L34 + jmi .L31 asr.l #3,%d0 move.l 108(%a0),%d3 move.l 180(%a0),%d1 @@ -148,8 +105,8 @@ tone_update: add.l %d0,%a1 move.l %a1,104(%a0) tst.l %d1 - jlt .L35 -.L17: + jlt .L32 +.L16: asr.l #3,%d1 move.l 184(%a0),%d2 move.l %d1,%a1 @@ -158,8 +115,8 @@ tone_update: sub.l %d1,%d2 move.l %d3,108(%a0) tst.l %d2 - jlt .L36 -.L18: + jlt .L33 +.L17: move.l %a1,%d3 asr.l #3,%d2 or.l %d3,%d0 @@ -168,7 +125,7 @@ tone_update: sne %d0 mvs.b %d0,%d0 neg.l %d0 -.L39: +.L36: move.l %d1,112(%a0) move.l %d0,172(%a0) jra .L1 @@ -177,10 +134,10 @@ tone_update: move.l #1156055040,%d1 divu.l %d0,%d1 cmp.l #524288,%d1 - jls .L21 + jls .L18 moveq #8,%d1 swap %d1 -.L22: +.L19: moveq #1,%d0 move.l %d3,156(%a0) moveq #13,%d3 @@ -193,27 +150,69 @@ tone_update: lsr.l %d3,%d0 subq.l #8,%d0 move.l %d0,168(%a0) -.L38: +.L35: move.w %a1,%d4 moveq #55,%d3 mulu.w #57,%d4 move.l %d4,%a1 add.l %d0,%a1 cmp.l %d0,%d3 - jcc .L37 + jcs .L34 .L11: + moveq #12,%d4 + moveq #18,%d0 + move.l %a1,%d3 + muls.l %d4,%d3 + lsl.l %d0,%d1 move.l %a1,%d0 - moveq #12,%d1 - muls.l %d1,%d0 + addq.l #1,%d0 + muls.l %d4,%d0 lea te_tone,%a1 + move.l (%a1,%d3.l),%a2 + move.l (%a1,%d0.l),%d4 + and.l #2147221504,%d1 + move.l %a2,20(%sp) + sub.l %a2,%d4 +#APP +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d4,%d1,%acc0 + movclr.l %acc0,%d4 +| 0 "" 2 +#NO_APP + add.l %a1,%d3 + move.l %d3,%a2 add.l %d0,%a1 - move.l 8(%a1),%d0 - move.l (%a1),176(%a0) - move.l 4(%a1),180(%a0) + move.l 4(%a2),%a2 + move.l 20(%sp),%a3 + add.l %d4,%a3 + move.l 4(%a1),%d0 + sub.l %a2,%d0 + move.l %a2,32(%sp) + move.l %a3,176(%a0) +#APP +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d0,%d1,%acc0 + movclr.l %acc0,%d4 +| 0 "" 2 +#NO_APP + move.l %d3,%a2 + move.l 32(%sp),%a3 + add.l %d4,%a3 + move.l 8(%a2),%d0 + move.l 8(%a1),%d3 + sub.l %d0,%d3 + move.l %a3,180(%a0) +#APP +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d3,%d1,%acc0 + movclr.l %acc0,%d1 +| 0 "" 2 +#NO_APP + add.l %d1,%d0 jra .L12 -.L21: +.L18: cmp.l #65536,%d1 - jcc .L22 + jcc .L19 moveq #1,%d0 moveq #1,%d1 swap %d1 @@ -228,8 +227,8 @@ tone_update: move.l %d1,164(%a0) subq.l #8,%d0 move.l %d0,168(%a0) - jra .L38 -.L36: + jra .L35 +.L33: move.l %a1,%d3 addq.l #7,%d2 or.l %d3,%d0 @@ -239,8 +238,8 @@ tone_update: sne %d0 mvs.b %d0,%d0 neg.l %d0 - jra .L39 -.L35: + jra .L36 +.L32: addq.l #7,%d1 asr.l #3,%d1 move.l 184(%a0),%d2 @@ -250,9 +249,9 @@ tone_update: sub.l %d1,%d2 move.l %d3,108(%a0) tst.l %d2 - jge .L18 - jra .L36 -.L34: + jge .L17 + jra .L33 +.L31: addq.l #7,%d0 asr.l #3,%d0 move.l 108(%a0),%d3 @@ -261,33 +260,33 @@ tone_update: add.l %d0,%a1 move.l %a1,104(%a0) tst.l %d1 - jge .L17 - jra .L35 -.L29: + jge .L16 + jra .L32 +.L26: move.l 168(%a0),%d0 move.l %d4,160(%a0) cmp.l %d4,%a3 - jeq .L25 + jeq .L22 moveq #1,%d1 clr.l 24(%sp) move.b %d1,31(%sp) move.l 20(%sp),%d1 jra .L4 -.L31: +.L28: moveq #1,%d1 swap %d1 - jra .L9 -.L30: + jra .L7 +.L27: moveq #8,%d1 swap %d1 - jra .L9 -.L33: + jra .L7 +.L30: tst.l 172(%a0) - jne .L6 + jne .L13 movem.l (%sp),#3100 lea (40,%sp),%sp rts -.L32: +.L29: cmp.l 24(%sp),%a1 sne %d3 moveq #1,%d4 @@ -300,54 +299,54 @@ tone_update: .align 2 .type render_head, @function render_head: - lea (-52,%sp),%sp + lea (-48,%sp),%sp movem.l #31996,(%sp) - move.l 76(%sp),%d0 + move.l 72(%sp),%d0 move.l %d0,%d3 lsl.l #4,%d3 - move.l 72(%sp),%d1 + move.l 68(%sp),%d1 move.l %d1,%d4 move.l %d0,44(%sp) - move.l 56(%sp),%a0 - move.l 60(%sp),%a1 - move.l 64(%sp),%d2 - move.l 68(%sp),%a6 - move.l 80(%sp),%d0 - move.l 84(%sp),%d5 + move.l 52(%sp),%a0 + move.l 56(%sp),%a1 + move.l 60(%sp),%d2 + move.l 64(%sp),%a5 + move.l 76(%sp),%d0 + move.l 80(%sp),%d5 add.l %d1,%d3 cmp.l %d1,%d3 - jge .L41 + jge .L38 move.l %d3,%d4 -.L41: +.L38: asr.l #8,%d4 move.l %d4,%a2 - move.l %a6,%d4 + move.l %a5,%d4 add.l %a2,%d4 cmp.l #8191,%d4 - jle .L42 + jle .L39 move.l %d1,%a3 cmp.l %d1,%d3 - jgt .L92 + jgt .L88 move.l %a3,%d3 asr.l #8,%d3 move.l %d3,%a3 - move.l %a6,%d3 + move.l %a5,%d3 add.l %a3,%d3 cmp.l #45157888,%d3 - jle .L93 -.L44: + jle .L89 +.L41: lsr.l #8,%d4 move.l %d0,%d3 add.l #15,%d3 addq.l #1,%d4 cmp.l %d4,%d3 - jcc .L42 + jcc .L39 tst.l %d5 - jlt .L94 + jlt .L90 clr.l %d0 move.l (%a0),%d1 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d5,%acc0 mac.l %d1,%d5,%acc0 @@ -359,7 +358,7 @@ render_head: add.l #4194304,%d1 move.l 4(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -371,7 +370,7 @@ render_head: add.l #8388608,%d1 move.l 8(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -383,7 +382,7 @@ render_head: add.l #12582912,%d1 move.l 12(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -395,7 +394,7 @@ render_head: add.l #16777216,%d1 move.l 16(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -407,7 +406,7 @@ render_head: add.l #20971520,%d1 move.l 20(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -419,7 +418,7 @@ render_head: add.l #25165824,%d1 move.l 24(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -431,7 +430,7 @@ render_head: add.l #29360128,%d1 move.l 28(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -443,7 +442,7 @@ render_head: add.l #33554432,%d1 move.l 32(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -455,7 +454,7 @@ render_head: add.l #37748736,%d1 move.l 36(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -467,7 +466,7 @@ render_head: add.l #41943040,%d1 move.l 40(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -479,7 +478,7 @@ render_head: add.l #46137344,%d1 move.l 44(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -491,7 +490,7 @@ render_head: add.l #50331648,%d1 move.l 48(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -503,7 +502,7 @@ render_head: add.l #54525952,%d1 move.l 52(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -515,7 +514,7 @@ render_head: add.l #58720256,%d1 move.l 56(%a0),%d2 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d1,%acc0 mac.l %d2,%d1,%acc0 @@ -526,7 +525,7 @@ render_head: add.l #62914560,%d5 move.l 60(%a0),%d1 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d0,%acc0 msac.l %d0,%d5,%acc0 mac.l %d1,%d5,%acc0 @@ -534,66 +533,65 @@ render_head: | 0 "" 2 #NO_APP move.l %d0,60(%a0) -.L40: +.L37: movem.l (%sp),#31996 - lea (52,%sp),%sp + lea (48,%sp),%sp rts -.L42: +.L39: lsl.l #8,%d2 tst.l %d5 - jlt .L95 + jlt .L91 add.l 44(%sp),%d1 move.l %d0,%a2 lea (16,%a2),%a2 move.l %d1,%d3 asr.l #8,%d3 move.l %d3,%d4 - add.l %a6,%d4 + add.l %a5,%d4 cmp.l #45157888,%d4 - jle .L72 -.L97: + jle .L68 +.L93: move.l #45157888,%d4 -.L73: +.L69: move.l %d4,%d3 lsr.l #8,%d3 addq.l #1,%d3 cmp.l %d3,%d0 - jcs .L81 -.L98: + jcs .L77 +.L94: move.l %d2,%d3 sub.l %d4,%d3 - jmi .L96 + jmi .L92 move.l %d3,%d4 lsr.l #8,%d4 cmp.l #176399,%d4 - jeq .L82 -.L99: + jeq .L78 +.L95: move.l %d4,%a4 addq.l #1,%a4 - move.l %a4,%d6 - moveq #21,%d7 - lsl.l #3,%d6 + move.l %a4,%d7 + moveq #21,%d6 + lsl.l #3,%d7 + lsl.l %d6,%d3 lsl.l #3,%d4 - lsl.l %d7,%d3 - lea (%a1,%d6.l),%a4 - move.l (%a4),%a5 - move.l #536870912,%d6 - lea (%a1,%d4.l),%a4 + lea (%a1,%d7.l),%a4 + move.l (%a4),%a4 + move.l #536870912,%d7 + move.l (%a1,%d4.l),%d4 and.l #534773760,%d3 - move.l (%a4),%d4 - move.l %a5,%d7 + move.l %a4,%d6 #APP -| 49 "modules/tapeecho/cpu.c" 1 - mac.l %d4,%d6,%acc0 +| 60 "modules/tapeecho/cpu.c" 1 + mac.l %d4,%d7,%acc0 msac.l %d4,%d3,%acc0 - mac.l %d7,%d3,%acc0 + mac.l %d6,%d3,%acc0 movclr.l %acc0,%d4 | 0 "" 2 #NO_APP -.L74: +.L70: move.l (%a0),%d3 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d4,%acc0 msac.l %d4,%d5,%acc0 mac.l %d3,%d5,%acc0 @@ -605,29 +603,29 @@ render_head: add.l #4194304,%d5 add.l #256,%d2 cmp.l %d0,%a2 - jeq .L40 -.L88: + jeq .L37 +.L84: add.l 44(%sp),%d1 move.l %d1,%d3 asr.l #8,%d3 move.l %d3,%d4 - add.l %a6,%d4 + add.l %a5,%d4 cmp.l #45157888,%d4 - jgt .L97 -.L72: + jgt .L93 +.L68: cmp.l #8192,%d4 - jge .L73 + jge .L69 move.l #8192,%d4 move.l %d4,%d3 lsr.l #8,%d3 addq.l #1,%d3 cmp.l %d3,%d0 - jcc .L98 -.L81: + jcc .L94 +.L77: move.l (%a0),%d3 clr.l %d4 #APP -| 61 "modules/tapeecho/cpu.c" 1 +| 72 "modules/tapeecho/cpu.c" 1 move.l %d4,%acc0 msac.l %d4,%d5,%acc0 mac.l %d3,%d5,%acc0 @@ -639,278 +637,273 @@ render_head: add.l #4194304,%d5 add.l #256,%d2 cmp.l %d0,%a2 - jne .L88 - jra .L40 -.L96: + jne .L84 + jra .L37 +.L92: add.l #45158400,%d3 move.l %d3,%d4 lsr.l #8,%d4 cmp.l #176399,%d4 - jne .L99 -.L82: + jne .L95 +.L78: + moveq #21,%d6 lsl.l #3,%d4 - moveq #21,%d7 - lsl.l %d7,%d3 + lsl.l %d6,%d3 move.l %a1,%a4 - move.l #536870912,%d6 - move.l (%a4),%a5 - move.l %a5,%d7 - lea (%a1,%d4.l),%a4 - move.l (%a4),%d4 + move.l #536870912,%d7 + move.l (%a4),%a4 + move.l %a4,%d6 + move.l (%a1,%d4.l),%d4 and.l #534773760,%d3 #APP -| 49 "modules/tapeecho/cpu.c" 1 - mac.l %d4,%d6,%acc0 +| 60 "modules/tapeecho/cpu.c" 1 + mac.l %d4,%d7,%acc0 msac.l %d4,%d3,%acc0 - mac.l %d7,%d3,%acc0 + mac.l %d6,%d3,%acc0 movclr.l %acc0,%d4 | 0 "" 2 #NO_APP - jra .L74 -.L95: + jra .L70 +.L91: add.l 44(%sp),%d1 - move.l %d0,%a5 - lea (16,%a5),%a5 + move.l %d0,%a4 + lea (16,%a4),%a4 move.l %d1,%d3 asr.l #8,%d3 move.l %d3,%d4 - add.l %a6,%d4 + add.l %a5,%d4 cmp.l #45157888,%d4 - jle .L64 -.L101: + jle .L60 +.L97: move.l #45157888,%d4 -.L65: +.L61: move.l %d4,%d3 lsr.l #8,%d3 addq.l #1,%d3 cmp.l %d3,%d0 - jcs .L80 -.L102: + jcs .L76 +.L98: move.l %d2,%d3 sub.l %d4,%d3 - jmi .L67 + jmi .L63 move.l %d3,%d4 lsr.l #8,%d4 cmp.l #176399,%d4 - jeq .L100 -.L68: - move.l %d4,%a2 - addq.l #1,%a2 - move.l %a2,%d5 - move.l #536870912,%d6 - lsl.l #3,%d5 + jeq .L96 +.L64: + move.l %d4,%a3 + addq.l #1,%a3 + move.l %a3,%d6 + moveq #21,%d7 + lsl.l #3,%d6 lsl.l #3,%d4 - lea (%a1,%d5.l),%a2 - moveq #21,%d5 - lsl.l %d5,%d3 - move.l (%a2),%a4 - lea (%a1,%d4.l),%a2 - move.l (%a2),%d7 - move.l %a4,%d4 + lsl.l %d7,%d3 + lea (%a1,%d6.l),%a3 + move.l (%a3),%a3 + move.l %a3,%d5 + move.l (%a1,%d4.l),%d7 and.l #534773760,%d3 + move.l #536870912,%d4 #APP -| 49 "modules/tapeecho/cpu.c" 1 - mac.l %d7,%d6,%acc0 +| 60 "modules/tapeecho/cpu.c" 1 + mac.l %d7,%d4,%acc0 msac.l %d7,%d3,%acc0 - mac.l %d4,%d3,%acc0 + mac.l %d5,%d3,%acc0 movclr.l %acc0,%d3 | 0 "" 2 #NO_APP -.L66: +.L62: move.l %d3,(%a0)+ addq.l #1,%d0 add.l #256,%d2 - cmp.l %d0,%a5 - jeq .L40 -.L89: + cmp.l %d0,%a4 + jeq .L37 +.L85: add.l 44(%sp),%d1 move.l %d1,%d3 asr.l #8,%d3 move.l %d3,%d4 - add.l %a6,%d4 + add.l %a5,%d4 cmp.l #45157888,%d4 - jgt .L101 -.L64: + jgt .L97 +.L60: cmp.l #8192,%d4 - jge .L65 + jge .L61 move.l #8192,%d4 move.l %d4,%d3 lsr.l #8,%d3 addq.l #1,%d3 cmp.l %d3,%d0 - jcc .L102 -.L80: + jcc .L98 +.L76: clr.l %d3 move.l %d3,(%a0)+ addq.l #1,%d0 add.l #256,%d2 - cmp.l %d0,%a5 - jne .L89 - jra .L40 -.L67: + cmp.l %d0,%a4 + jne .L85 + jra .L37 +.L63: add.l #45158400,%d3 move.l %d3,%d4 lsr.l #8,%d4 cmp.l #176399,%d4 - jne .L68 -.L100: + jne .L64 +.L96: lsl.l #3,%d4 - moveq #21,%d5 - lsl.l %d5,%d3 - move.l %a1,%a2 - move.l #536870912,%d6 - move.l (%a2),%a4 - lea (%a1,%d4.l),%a2 - move.l (%a2),%d7 - move.l %a4,%d4 + moveq #21,%d7 + lsl.l %d7,%d3 + move.l %a1,%a3 + move.l (%a3),%a3 + move.l %a3,%d5 + move.l (%a1,%d4.l),%d7 and.l #534773760,%d3 + move.l #536870912,%d4 #APP -| 49 "modules/tapeecho/cpu.c" 1 - mac.l %d7,%d6,%acc0 +| 60 "modules/tapeecho/cpu.c" 1 + mac.l %d7,%d4,%acc0 msac.l %d7,%d3,%acc0 - mac.l %d4,%d3,%acc0 + mac.l %d5,%d3,%acc0 movclr.l %acc0,%d3 | 0 "" 2 #NO_APP - jra .L66 -.L93: + jra .L62 +.L89: lsr.l #8,%d3 addq.l #1,%d3 cmp.l %d3,%d0 - jcs .L44 + jcs .L41 lsl.l #8,%d2 - sub.l %a6,%d2 + sub.l %a5,%d2 move.l %d2,%d0 add.l #3840,%d0 move.l %d2,%d3 sub.l %a2,%d0 sub.l %a3,%d3 tst.l %d0 - jlt .L103 + jlt .L99 cmp.l #45158399,%d3 - jle .L46 + jle .L43 add.l #-45158400,%d2 add.l #-45158400,%d0 cmp.l #45158143,%d0 - jle .L49 -.L48: + jle .L46 +.L45: tst.l %d5 - jlt .L50 + jlt .L47 add.l 44(%sp),%d1 - move.l %d2,%a4 + move.l %d2,%a3 move.l %d2,%d0 - lea (4096,%a4),%a4 + lea (4096,%a3),%a3 move.l #536870912,%d4 move.l %d1,%d3 asr.l #8,%d3 sub.l %d3,%d0 - jmi .L104 -.L58: + jmi .L100 +.L55: cmp.l #45158399,%d0 - jle .L59 + jle .L56 add.l #-45158400,%d0 -.L59: +.L56: move.l %d0,%d3 lsr.l #8,%d3 move.l %d3,%a2 addq.l #1,%a2 - move.l %a2,%d7 - lsl.l #3,%d7 + move.l %a2,%d6 + lsl.l #3,%d6 cmp.l #176399,%d3 - jeq .L79 -.L105: + jeq .L75 +.L101: + moveq #21,%d7 lsl.l #3,%d3 - moveq #21,%d6 - lsl.l %d6,%d0 - lea (%a1,%d7.l),%a2 - move.l (%a2),%a3 - move.l %a3,%d7 - lea (%a1,%d3.l),%a2 - move.l (%a2),%d3 + lsl.l %d7,%d0 + lea (%a1,%d6.l),%a2 + move.l (%a2),%a2 + move.l %a2,%d6 + move.l (%a1,%d3.l),%d3 and.l #534773760,%d0 #APP -| 49 "modules/tapeecho/cpu.c" 1 +| 60 "modules/tapeecho/cpu.c" 1 mac.l %d3,%d4,%acc0 msac.l %d3,%d0,%acc0 - mac.l %d7,%d0,%acc0 - movclr.l %acc0,%d3 + mac.l %d6,%d0,%acc0 + movclr.l %acc0,%d0 | 0 "" 2 #NO_APP - move.l (%a0),%d0 + move.l (%a0),%d3 #APP -| 61 "modules/tapeecho/cpu.c" 1 - move.l %d3,%acc0 - msac.l %d3,%d5,%acc0 - mac.l %d0,%d5,%acc0 +| 72 "modules/tapeecho/cpu.c" 1 + move.l %d0,%acc0 + msac.l %d0,%d5,%acc0 + mac.l %d3,%d5,%acc0 movclr.l %acc0,%d0 | 0 "" 2 #NO_APP move.l %d0,(%a0)+ add.l #256,%d2 add.l #4194304,%d5 - cmp.l %d2,%a4 - jeq .L40 -.L90: + cmp.l %d2,%a3 + jeq .L37 +.L86: move.l %d2,%d0 add.l 44(%sp),%d1 move.l %d1,%d3 asr.l #8,%d3 sub.l %d3,%d0 - jpl .L58 -.L104: + jpl .L55 +.L100: add.l #45158400,%d0 move.l %d0,%d3 lsr.l #8,%d3 move.l %d3,%a2 addq.l #1,%a2 - move.l %a2,%d7 - lsl.l #3,%d7 + move.l %a2,%d6 + lsl.l #3,%d6 cmp.l #176399,%d3 - jne .L105 -.L79: + jne .L101 +.L75: + moveq #21,%d7 lsl.l #3,%d3 - moveq #21,%d6 - lsl.l %d6,%d0 + lsl.l %d7,%d0 move.l %a1,%a2 - move.l (%a2),%a3 - move.l %a3,%d7 - lea (%a1,%d3.l),%a2 - move.l (%a2),%d3 + move.l (%a2),%a2 + move.l %a2,%d6 + move.l (%a1,%d3.l),%d3 and.l #534773760,%d0 #APP -| 49 "modules/tapeecho/cpu.c" 1 +| 60 "modules/tapeecho/cpu.c" 1 mac.l %d3,%d4,%acc0 msac.l %d3,%d0,%acc0 - mac.l %d7,%d0,%acc0 - movclr.l %acc0,%d3 + mac.l %d6,%d0,%acc0 + movclr.l %acc0,%d0 | 0 "" 2 #NO_APP - move.l (%a0),%d0 + move.l (%a0),%d3 #APP -| 61 "modules/tapeecho/cpu.c" 1 - move.l %d3,%acc0 - msac.l %d3,%d5,%acc0 - mac.l %d0,%d5,%acc0 +| 72 "modules/tapeecho/cpu.c" 1 + move.l %d0,%acc0 + msac.l %d0,%d5,%acc0 + mac.l %d3,%d5,%acc0 movclr.l %acc0,%d0 | 0 "" 2 #NO_APP move.l %d0,(%a0)+ add.l #256,%d2 add.l #4194304,%d5 - cmp.l %d2,%a4 - jne .L90 - jra .L40 -.L92: + cmp.l %d2,%a3 + jne .L86 + jra .L37 +.L88: move.l %d3,%a3 move.l %a3,%d3 asr.l #8,%d3 move.l %d3,%a3 - move.l %a6,%d3 + move.l %a5,%d3 add.l %a3,%d3 cmp.l #45157888,%d3 - jgt .L44 - jra .L93 -.L94: + jgt .L41 + jra .L89 +.L90: movem.l (%sp),#31996 clr.l (%a0) clr.l 4(%a0) @@ -928,69 +921,62 @@ render_head: clr.l 52(%a0) clr.l 56(%a0) clr.l 60(%a0) - lea (52,%sp),%sp + lea (48,%sp),%sp rts -.L103: +.L99: add.l #45158400,%d2 add.l #45158400,%d3 add.l #45158400,%d0 -.L46: +.L43: tst.l %d3 - jlt .L48 + jlt .L45 cmp.l #45158143,%d0 - jgt .L48 -.L49: - move.l %d5,76(%sp) - move.l %d2,64(%sp) + jgt .L45 +.L46: + move.l %d5,72(%sp) + move.l %d2,60(%sp) movem.l (%sp),#31996 - move.l 44(%sp),72(%sp) - move.l %d1,68(%sp) - move.l %a1,60(%sp) - move.l %a0,56(%sp) - lea (52,%sp),%sp + move.l 44(%sp),68(%sp) + move.l %d1,64(%sp) + move.l %a1,56(%sp) + move.l %a0,52(%sp) + lea (48,%sp),%sp jmp te_read_linear -.L50: +.L47: move.l %d2,%a5 - move.l #1411192,%a3 + move.l #1411192,%a2 lea (4096,%a5),%a5 - move.l #536870912,%a6 -.L57: + move.l #536870912,%d5 +.L54: add.l 44(%sp),%d1 move.l %d2,%d0 move.l %d1,%d3 asr.l #8,%d3 sub.l %d3,%d0 - jmi .L52 -.L106: + jmi .L49 +.L102: cmp.l #45158399,%d0 - jle .L53 + jle .L50 add.l #-45158400,%d0 -.L53: - moveq #21,%d4 - move.l %d0,%d7 - lsl.l %d4,%d7 +.L50: + move.l %d0,%d3 + lsr.l #8,%d3 move.l %d0,%d4 - lsr.l #8,%d4 - move.l %d4,%d3 - move.l %d4,%d5 - addq.l #1,%d3 - lsl.l #3,%d3 - lsl.l #3,%d5 - cmp.l #176399,%d4 - jeq .L54 -.L107: - lea (%a1,%d3.l),%a2 - move.l (%a2),%d4 - move.l %d7,%d0 - lea (%a1,%d5.l),%a4 - and.l #534773760,%d0 - move.l (%a4),%d3 - move.l %a6,%d6 + moveq #21,%d6 + lsl.l %d6,%d4 + move.l %d3,%d7 + lsl.l #3,%d7 + cmp.l #176399,%d3 + jeq .L51 +.L103: + move.l 8(%a1,%d7.l),%d3 + and.l #534773760,%d4 + move.l (%a1,%d7.l),%d0 #APP -| 49 "modules/tapeecho/cpu.c" 1 - mac.l %d3,%d6,%acc0 - msac.l %d3,%d0,%acc0 - mac.l %d4,%d0,%acc0 +| 60 "modules/tapeecho/cpu.c" 1 + mac.l %d0,%d5,%acc0 + msac.l %d0,%d4,%acc0 + mac.l %d3,%d4,%acc0 movclr.l %acc0,%d0 | 0 "" 2 #NO_APP @@ -998,36 +984,32 @@ render_head: add.l #256,%d2 addq.l #4,%a0 cmp.l %d2,%a5 - jeq .L40 + jeq .L37 move.l %d2,%d0 add.l 44(%sp),%d1 move.l %d1,%d3 asr.l #8,%d3 sub.l %d3,%d0 - jpl .L106 -.L52: + jpl .L102 +.L49: add.l #45158400,%d0 - moveq #21,%d4 - move.l %d0,%d7 - lsl.l %d4,%d7 + move.l %d0,%d3 + lsr.l #8,%d3 move.l %d0,%d4 - lsr.l #8,%d4 - move.l %d4,%d3 - move.l %d4,%d5 - addq.l #1,%d3 - lsl.l #3,%d3 - lsl.l #3,%d5 - cmp.l #176399,%d4 - jne .L107 -.L54: + moveq #21,%d6 + lsl.l %d6,%d4 + move.l %d3,%d7 + lsl.l #3,%d7 + cmp.l #176399,%d3 + jne .L103 +.L51: moveq #21,%d7 lsl.l %d7,%d0 move.l (%a1),%d4 - move.l %a6,%d5 - move.l (%a1,%a3.l),%d3 + move.l (%a1,%a2.l),%d3 and.l #534773760,%d0 #APP -| 49 "modules/tapeecho/cpu.c" 1 +| 60 "modules/tapeecho/cpu.c" 1 mac.l %d3,%d5,%acc0 msac.l %d3,%d0,%acc0 mac.l %d4,%d0,%acc0 @@ -1038,9 +1020,9 @@ render_head: add.l #256,%d2 addq.l #4,%a0 cmp.l %d2,%a5 - jne .L57 + jne .L54 movem.l (%sp),#31996 - lea (52,%sp),%sp + lea (48,%sp),%sp rts .size render_head, .-render_head .align 2 @@ -1054,30 +1036,30 @@ te_target: move.l 12(%sp),%a1 add.l #-720,%d0 cmp.l #6480,%d0 - jls .L109 + jls .L105 move.w #2880,%a0 -.L109: +.L105: move.l (%a1),%d0 moveq #127,%d1 cmp.l %d0,%d1 - jcc .L110 + jcc .L106 moveq #127,%d0 -.L110: +.L106: tst.l 12(%a1) - jne .L111 + jne .L107 add.l #32,%d0 mvz.w %d0,%d0 moveq #14,%d2 lsl.l %d2,%d0 -.L112: +.L108: cmp.l #44896256,%d0 - jls .L113 + jls .L109 move.l #44896256,%d0 -.L113: +.L109: move.l (%sp)+,%d2 move.l (%sp)+,%d3 rts -.L111: +.L107: mulu.w #12,%d0 lea clocks2,%a1 move.l #1323000,%d3 @@ -1093,696 +1075,685 @@ te_target: lsl.l #8,%d0 divu.l %d2,%d0 add.l %d1,%d0 - jra .L112 + jra .L108 .size te_target, .-te_target .align 2 - .globl te_process - .type te_process, @function -te_process: - lea (-136,%sp),%sp - move.l 144(%sp),%a1 - movem.l #23804,(%sp) - move.l 140(%sp),%a6 - move.l 24(%a1),%a2 - move.l %a2,%d0 - add.l #-720,%d0 - cmp.l #6480,%d0 - jhi .L118 - move.l %a2,12(%a6) -.L119: - move.l (%a1),%d0 - moveq #127,%d1 - cmp.l %d0,%d1 - jcc .L155 - moveq #127,%d0 -.L155: - move.l 12(%a1),%d6 - tst.l %d6 - jne .L156 - add.l #32,%d0 - mvz.w %d0,%d0 - moveq #14,%d2 - lsl.l %d2,%d0 -.L157: - cmp.l #44896256,%d0 - jls .L120 - move.l #44896256,%d0 -.L120: - move.l 20(%a1),%d7 - moveq #127,%d1 - cmp.l %d7,%d1 - jcc .L121 - moveq #127,%d7 -.L121: - move.l 16(%a1),%d5 - moveq #127,%d2 - cmp.l %d5,%d2 - jcc .L122 - moveq #127,%d5 -.L122: - move.l 8(%a1),%d4 - move.l #16909320,%d3 - muls.l %d3,%d5 - moveq #127,%d1 - cmp.l %d4,%d1 - jcc .L123 - moveq #127,%d4 -.L123: - move.l 4(%a1),%d1 - move.l #16909320,%d2 - muls.l %d2,%d4 - moveq #127,%d3 - cmp.l %d1,%d3 - jcc .L124 - moveq #127,%d1 -.L124: - lea te_feedback,%a0 - move.l (%a0,%d1.l*4),%a3 - move.l %d7,%d1 - swap %d1 - clr.w %d1 - move.l %d1,%a4 - tst.l (%a6) - jeq .L174 - lea te_hiss,%a0 -.L125: - tst.l 148(%a6) - jne .L127 - tst.l %d6 - jeq .L178 -.L128: - move.l 8(%a6),%d1 - cmp.l %d1,%d0 - jeq .L129 - move.w #512,%a2 - move.l %d1,144(%a6) - move.l %d0,8(%a6) - move.l %a2,148(%a6) -.L129: - tst.l %d6 - sne %d1 - mvs.b %d1,%d1 - neg.l %d1 - move.l %d1,152(%a6) -.L127: - move.l 196(%a6),%d2 - move.l %d2,%d1 - add.l 28(%a1),%d1 - addq.l #1,%d2 - move.l %d2,196(%a6) - moveq #3,%d2 - and.l %d2,%d1 - tst.l %d1 - jeq .L130 - tst.l (%a6) - jne .L131 -.L130: - move.l %a6,-(%sp) - move.l %d0,52(%sp) - move.l %a0,48(%sp) - jsr tone_update - addq.l #4,%sp - move.l 44(%sp),%a0 - move.l 48(%sp),%d0 -.L131: - move.l %d5,%d2 - moveq #1,%d1 - sub.l 24(%a6),%d2 - move.l %d1,(%a6) - tst.l %d2 - jlt .L179 - moveq #9,%d3 - asr.l %d3,%d2 - move.l %a3,%d1 - sub.l 28(%a6),%d1 - move.l %d2,56(%sp) - tst.l %d1 - jlt .L180 -.L133: - moveq #9,%d2 - asr.l %d2,%d1 - move.l 32(%a6),%a2 - move.l %a4,%d3 - sub.l %a2,%d3 - move.l %d1,60(%sp) - tst.l %d3 - jlt .L181 -.L134: - moveq #9,%d1 - move.l 36(%a6),%a3 - move.l %d4,%d2 - asr.l %d1,%d3 - sub.l %a3,%d2 - jmi .L182 -.L135: - move.l (%a0,%d7.l*4),%d7 - moveq #9,%d1 - asr.l %d1,%d2 - swap %d7 - clr.w %d7 - move.l %d2,%a4 - sub.l 40(%a6),%d7 - jmi .L183 -.L136: - moveq #9,%d2 - asr.l %d2,%d7 - move.l 16(%a6),%a1 - add.l #1246608,%a1 + .globl te_block + .type te_block, @function +te_block: + lea (-132,%sp),%sp + movem.l #31996,(%sp) + move.l 136(%sp),%a6 + move.l 140(%sp),%a2 + tst.l 160(%sp) + jeq .L114 + move.l 196(%a6),%a0 + move.l %a0,%d7 + add.l 28(%a2),%d7 + moveq #3,%d1 + addq.l #1,%a0 + move.l 32(%a6),%d0 + move.l 36(%a6),%d4 + and.l %d1,%d7 + move.l %a0,196(%a6) + tst.l %d7 + jeq .L184 + move.l 16(%a6),%a2 + add.l #1246608,%a2 move.l 128(%a6),%d1 - move.l %a1,16(%a6) - move.l %d7,64(%sp) - move.l 132(%a6),%d7 - sub.l %d1,%d7 - jmi .L184 -.L137: - asr.l #4,%d7 - add.l %d7,%d1 - move.l %d1,%d2 - lsl.l #4,%d2 - move.l 124(%a6),%d7 + sub.l %a5,%a5 + move.l 132(%a6),%a0 + clr.l %d7 + clr.l 56(%sp) + clr.l %d2 + clr.l %d3 + clr.l %d5 + sub.l %d1,%a0 + move.l %a2,16(%a6) + tst.l %a0 + jlt .L185 +.L146: + move.l %a0,%d6 + asr.l #4,%d6 + move.l 124(%a6),%a3 + add.l %d6,%d1 + move.l %d1,%d6 + lsl.l #4,%d6 move.l %d1,128(%a6) - move.l %d2,%a0 - add.l %d7,%a0 - move.l %a0,124(%a6) - cmp.l %a0,%d7 - jls .L138 + lea (%a3,%d6.l),%a1 + move.l %a1,124(%a6) + cmp.l %a3,%a1 + jcc .L147 move.l 20(%a6),%d1 - moveq #13,%d2 - move.l %d1,%d7 - lsl.l %d2,%d7 - moveq #17,%d2 - eor.l %d7,%d1 - move.l %d1,%d7 - lsr.l %d2,%d7 - eor.l %d7,%d1 - move.l %d1,%d7 - lsl.l #5,%d7 - eor.l %d7,%d1 - move.l %d1,%d7 - and.l #262143,%d7 + moveq #13,%d6 + lsl.l %d6,%d1 + move.l 20(%a6),%d6 + eor.l %d6,%d1 + moveq #17,%d6 + move.l %d1,%a0 + lsr.l %d6,%d1 + move.l %a0,%d6 + eor.l %d1,%d6 + move.l %d6,%d1 + lsl.l #5,%d1 + eor.l %d6,%d1 + move.l %d1,%d6 + and.l #262143,%d6 move.l %d1,20(%a6) - add.l #779132,%d7 - move.l %d7,132(%a6) -.L138: - move.l 136(%a6),%d7 - move.l %a3,%d1 - or.l %d7,%d1 - jeq .L139 + move.l %d6,%a0 + add.l #779132,%a0 + move.l %a0,132(%a6) +.L147: + move.l 136(%a6),%a0 + move.l %a0,%d1 + or.l %d4,%d1 + jeq .L148 move.l #40704,%d1 - move.l %a3,%d2 #APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d1,%d2,%acc0 - movclr.l %acc0,%d2 +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d1,%d4,%acc0 + movclr.l %acc0,%d1 | 0 "" 2 #NO_APP - move.l %a2,%d1 - swap %d1 - ext.l %d1 - move.l %d2,68(%sp) - move.l %a3,%d2 - add.l #32,%d1 - lsl.l #3,%d1 + swap %d0 + ext.l %d0 + add.l #32,%d0 + lsl.l #3,%d0 #APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d1,%d2,%acc0 - movclr.l %acc0,%d2 +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d0,%d4,%acc0 + movclr.l %acc0,%d0 | 0 "" 2 #NO_APP - move.l %d2,40(%sp) - moveq #9,%d2 - move.l %a1,%d1 - lsl.l %d2,%d1 - moveq #22,%d2 + moveq #9,%d6 + move.l %a2,%d4 + lsl.l %d6,%d4 + moveq #22,%d6 + move.l %d4,52(%sp) + move.l %a2,%d4 + lsr.l %d6,%d4 lea te_sine,%a2 - move.l %d1,52(%sp) - move.l %a1,%d1 - lsr.l %d2,%d1 - move.l (%a2,%d1.l*4),%a3 - move.l 4(%a2,%d1.l*4),%a1 - move.l 52(%sp),%d1 - sub.l %a3,%a1 - move.l %a1,%d2 - and.l #2147483136,%d1 + move.l 52(%sp),%d6 + move.l (%a2,%d4.l*4),%a3 + move.l 4(%a2,%d4.l*4),%d4 + and.l #2147483136,%d6 + sub.l %a3,%d4 #APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d2,%d1,%acc0 - movclr.l %acc0,%d2 +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d4,%d6,%acc0 + movclr.l %acc0,%d4 | 0 "" 2 #NO_APP - move.l 68(%sp),%d1 - add.l %a3,%d2 + add.l %a3,%d4 #APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d1,%d2,%acc0 - movclr.l %acc0,%d2 +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d1,%d4,%acc0 + movclr.l %acc0,%d6 | 0 "" 2 #NO_APP - move.l %d2,52(%sp) - moveq #9,%d2 - move.l %a0,%d1 - lsl.l %d2,%d1 - moveq #22,%d2 + moveq #9,%d4 + move.l %a1,%d1 + lsl.l %d4,%d1 + move.l %d6,52(%sp) + move.l %a1,%d6 move.l %d1,%a3 - move.l %a0,%d1 - lsr.l %d2,%d1 - move.l (%a2,%d1.l*4),%a1 - move.l 4(%a2,%d1.l*4),%a0 - move.l %a3,%d1 - sub.l %a1,%a0 - and.l #2147483136,%d1 - move.l %a0,%d2 + moveq #22,%d1 + lsr.l %d1,%d6 + move.l (%a2,%d6.l*4),%d4 + move.l 4(%a2,%d6.l*4),%a1 + move.l %a3,%d6 + sub.l %d4,%a1 + and.l #2147483136,%d6 + move.l %a1,%d1 #APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d2,%d1,%acc0 - movclr.l %acc0,%d2 +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d1,%d6,%acc0 + movclr.l %acc0,%d1 | 0 "" 2 #NO_APP - move.l 40(%sp),%d1 - add.l %a1,%d2 + add.l %d1,%d4 #APP -| 18 "modules/tapeecho/cpu.c" 1 - mac.l %d1,%d2,%acc0 - movclr.l %acc0,%d1 +| 24 "modules/tapeecho/cpu.c" 1 + mac.l %d0,%d4,%acc0 + movclr.l %acc0,%d0 | 0 "" 2 #NO_APP - move.l %d1,%a0 - moveq #9,%d2 + moveq #9,%d4 move.l 52(%sp),%d1 - add.l %a0,%d1 - lsl.l %d2,%d1 - sub.l %d7,%d1 - jmi .L185 - asr.l #4,%d1 -.L139: - move.l 140(%a6),%a0 - lea (128,%a0),%a2 - cmp.l %a2,%d1 - jge .L141 - move.l %d1,%a2 -.L141: - move.l %a0,%d1 - add.l #-128,%d1 - cmp.l #-8192,%d1 - jge .L142 - move.l #-8192,%d1 -.L142: - cmp.l %a2,%d1 - jle .L143 - move.l %d1,%a2 -.L143: - cmp.l #8192,%a2 - jle .L144 - move.w #8192,%a2 -.L144: - move.l 8(%a6),%d1 - move.l %a2,140(%a6) - tst.l %d6 - jne .L160 - tst.l 148(%a6) - jne .L160 - cmp.l %d1,%d0 - jeq .L160 - sub.l %d1,%d0 - move.l %d0,%d6 - tst.l %d0 - jlt .L186 -.L146: - asr.l #6,%d6 - jne .L147 - tst.l %d0 - jle .L187 - moveq #1,%d6 - moveq #16,%d0 - add.l %d1,%d6 - move.l %d6,8(%a6) - add.l %a2,%d0 -.L145: + add.l %d0,%d1 + lsl.l %d4,%d1 + sub.l %a0,%d1 + jmi .L186 + asr.l #4,%d1 +.L148: + move.l 140(%a6),%d0 + move.l %d0,%d4 + add.l #-128,%d4 + cmp.l #-8192,%d4 + jge .L150 + move.l #-8192,%d4 +.L150: + add.l #128,%d0 + cmp.l %d0,%d1 + jge .L151 + move.l %d1,%d0 +.L151: + cmp.l %d4,%d0 + jle .L152 + move.l %d0,%d4 +.L152: + cmp.l #8192,%d4 + jle .L153 + move.l #8192,%d4 +.L153: pea -1.w move.l 4(%a6),-(%sp) - move.l %d0,-(%sp) - move.l %d7,-(%sp) - move.l %d1,-(%sp) + move.l 64(%sp),%a1 lea render_head,%a3 - move.l 172(%sp),-(%sp) - move.l 172(%sp),-(%sp) - move.l %sp,%d6 - add.l #100,%d6 - move.l %d6,-(%sp) + pea (%a1,%d4.l) + move.l %a0,-(%sp) + move.l 8(%a6),%d0 + sub.l %a5,%d0 + lea (84,%sp),%a2 + move.l %d0,-(%sp) + move.l 168(%sp),-(%sp) + move.l 168(%sp),-(%sp) + move.l %a2,-(%sp) + move.l %d4,140(%a6) jsr (%a3) lea (32,%sp),%sp move.l 148(%a6),%d0 tst.l %d0 - jne .L188 -.L151: - move.l %a2,%d0 - move.l %a4,%d2 - lsl.l #4,%d0 + jne .L187 +.L154: + lsl.l #4,%d4 pea 64(%a6) pea 104(%a6) - move.l %d6,-(%sp) - lsl.l #4,%d2 - lsl.l #4,%d3 - add.l %d0,136(%a6) + move.l %a2,-(%sp) + add.l %d4,136(%a6) jsr te_filter_block - move.l 76(%sp),-(%sp) - move.l 76(%sp),-(%sp) - move.l 76(%sp),-(%sp) - move.l 184(%sp),-(%sp) - move.l 184(%sp),-(%sp) - move.l %d6,-(%sp) + move.l %d2,-(%sp) + move.l %d3,-(%sp) + move.l %d5,-(%sp) + move.l 180(%sp),-(%sp) + move.l 180(%sp),-(%sp) + move.l %a2,-(%sp) move.l %a6,-(%sp) jsr te_tape_block lea (40,%sp),%sp - add.l 36(%a6),%d2 - add.l %d3,32(%a6) - move.l %d2,36(%a6) - tst.l %d5 - jne .L152 - move.l #511,%d3 - cmp.l 24(%a6),%d3 - jge .L189 -.L152: - tst.l %d4 - jne .L153 - cmp.l #511,%d2 - jle .L190 -.L153: - moveq #16,%d0 - add.l %d0,4(%a6) + tst.l %d7 + jeq .L155 + move.l #511,%d1 + cmp.l 24(%a6),%d1 + jlt .L155 + clr.l 24(%a6) +.L155: + moveq #16,%d2 + add.l %d2,4(%a6) move.l 4(%a6),%d0 cmp.l #176399,%d0 - jls .L154 + jls .L156 move.l #176399,%d0 -.L154: +.L156: move.l %d0,4(%a6) - movem.l (%sp),#23804 - lea (136,%sp),%sp + movem.l (%sp),#31996 + lea (132,%sp),%sp rts -.L160: - pea -1.w - move.l 4(%a6),-(%sp) - move.l %a2,%d0 - move.l %d0,-(%sp) - move.l %d7,-(%sp) - move.l %d1,-(%sp) - move.l 172(%sp),-(%sp) - lea render_head,%a3 - move.l 172(%sp),-(%sp) - move.l %sp,%d6 - add.l #100,%d6 - move.l %d6,-(%sp) - jsr (%a3) - lea (32,%sp),%sp - move.l 148(%a6),%d0 - tst.l %d0 - jeq .L151 - jra .L188 -.L174: - move.l %a6,%d1 - move.l %a6,%a0 - add.l #200,%d1 - move.l %a4,%d3 -.L126: - clr.l (%a0)+ - cmp.l %a0,%d1 - jne .L126 - tst.l %d6 - sne %d1 - lea te_hiss,%a0 - move.l (%a0,%d7.l*4),%d2 - move.l %d3,%a4 - move.l #1831565813,%d3 - move.l %a2,12(%a6) - move.l #751934170,%a2 - swap %d2 - clr.w %d2 - move.l %d3,20(%a6) - move.l #973915,%d3 - move.l %d0,8(%a6) - move.l %d5,24(%a6) - mvs.b %d1,%d1 - move.l %a3,28(%a6) - move.l %a4,32(%a6) - move.l %d4,36(%a6) - neg.l %d1 - move.l %a2,124(%a6) - move.l %d3,132(%a6) - move.l %d3,128(%a6) - move.l %d2,40(%a6) - move.l %d1,152(%a6) - jra .L125 -.L156: - mulu.w #12,%d0 - lea clocks2,%a0 - move.l #1323000,%d1 - move.l %a2,%d2 - lsr.l #7,%d0 - mvz.b (%a0,%d0.l),%d0 - muls.l %d1,%d0 - move.l %d0,%d1 - remu.l %d2,%d3:%d1 - divu.l %d2,%d1 - mvz.w %d3,%d0 - move.l %a2,%d3 - lsl.l #8,%d1 - lsl.l #8,%d0 - divu.l %d3,%d0 - add.l %d1,%d0 - jra .L157 -.L118: - move.l 12(%a6),%a2 - move.l %a2,%d0 +.L114: + move.l 24(%a2),%d5 + move.l %d5,%d0 add.l #-720,%d0 cmp.l #6480,%d0 - jls .L119 - move.l #2880,%d0 - move.l %d0,12(%a6) - move.l %d0,%a2 - jra .L119 -.L184: - add.l #15,%d7 - jra .L137 -.L183: - add.l #511,%d7 + jls .L188 + move.l 12(%a6),%d5 + move.l %d5,%d0 + add.l #-720,%d0 + cmp.l #6480,%d0 + jls .L117 + move.l #2880,%d2 + move.l %d2,12(%a6) + move.l %d2,%d5 +.L117: + move.l (%a2),%d0 + moveq #127,%d3 + cmp.l %d0,%d3 + jcc .L157 + moveq #127,%d0 +.L157: + move.l 12(%a2),%a3 + tst.l %a3 + jne .L158 + move.l %d0,%a0 + moveq #14,%d4 + lea (32,%a0),%a0 + mvz.w %a0,%d0 + lsl.l %d4,%d0 + move.l %d0,%a0 +.L159: + cmp.l #44896256,%a0 + jls .L118 + move.l #44896256,%a0 +.L118: + move.l 20(%a2),%d6 + moveq #127,%d7 + cmp.l %d6,%d7 + jcc .L119 + moveq #127,%d6 +.L119: + move.l 16(%a2),%d1 + moveq #127,%d0 + cmp.l %d1,%d0 + jcc .L120 + moveq #127,%d1 +.L120: + move.l 8(%a2),%d2 + move.l #16909320,%d3 + muls.l %d3,%d1 + moveq #127,%d4 + cmp.l %d2,%d4 + jcc .L121 + moveq #127,%d2 +.L121: + move.l #16909320,%d7 + muls.l %d2,%d7 + move.l 4(%a2),%d0 + moveq #127,%d2 + move.l %d7,60(%sp) + cmp.l %d0,%d2 + jcc .L122 + moveq #127,%d0 +.L122: + lea te_feedback,%a1 + move.l %d6,%d4 + move.l (%a1,%d0.l*4),%d3 + swap %d4 + clr.w %d4 + tst.l (%a6) + jeq .L180 + lea te_hiss,%a5 +.L123: + tst.l 148(%a6) + jne .L125 + tst.l %a3 + jeq .L189 +.L126: + move.l 8(%a6),%d0 + cmp.l %d0,%a0 + jeq .L127 + move.l %d0,144(%a6) + move.l #512,%d0 + move.l %d0,148(%a6) + move.l %a0,8(%a6) +.L127: + tst.l %a3 + sne %d0 + mvs.b %d0,%d0 + neg.l %d0 + move.l %d0,152(%a6) +.L125: + move.l 196(%a6),%a1 + move.l %a1,%d0 + add.l 28(%a2),%d0 + moveq #3,%d2 + addq.l #1,%a1 + move.l %a1,196(%a6) + and.l %d2,%d0 + tst.l %d0 + jeq .L128 + tst.l (%a6) + jne .L129 +.L128: + move.l %a6,-(%sp) + move.l %d1,52(%sp) + move.l %a0,48(%sp) + jsr tone_update + addq.l #4,%sp + move.l 44(%sp),%a0 + move.l 48(%sp),%d1 +.L129: + move.l %d1,%d5 + moveq #1,%d0 + sub.l 24(%a6),%d5 + move.l %d0,(%a6) + tst.l %d5 + jlt .L190 + moveq #9,%d7 + sub.l 28(%a6),%d3 + asr.l %d7,%d5 + tst.l %d3 + jlt .L191 +.L131: moveq #9,%d2 - asr.l %d2,%d7 - move.l 16(%a6),%a1 - add.l #1246608,%a1 - move.l 128(%a6),%d1 - move.l %a1,16(%a6) - move.l %d7,64(%sp) - move.l 132(%a6),%d7 - sub.l %d1,%d7 - jpl .L137 - jra .L184 -.L182: - move.l (%a0,%d7.l*4),%d7 - add.l #511,%d2 - moveq #9,%d1 - swap %d7 - clr.w %d7 - asr.l %d1,%d2 - move.l %d2,%a4 - sub.l 40(%a6),%d7 - jpl .L136 - jra .L183 -.L181: - add.l #511,%d3 - moveq #9,%d1 - move.l 36(%a6),%a3 + asr.l %d2,%d3 + move.l 32(%a6),%d0 move.l %d4,%d2 - asr.l %d1,%d3 - sub.l %a3,%d2 - jpl .L135 - jra .L182 -.L180: - add.l #511,%d1 - moveq #9,%d2 - asr.l %d2,%d1 - move.l 32(%a6),%a2 - move.l %a4,%d3 - sub.l %a2,%d3 - move.l %d1,60(%sp) - tst.l %d3 - jge .L134 - jra .L181 -.L179: - add.l #511,%d2 - moveq #9,%d3 - asr.l %d3,%d2 - move.l %a3,%d1 - sub.l 28(%a6),%d1 - move.l %d2,56(%sp) + sub.l %d0,%d2 + jmi .L192 +.L132: + moveq #9,%d7 + asr.l %d7,%d2 + move.l 36(%a6),%d4 + move.l 60(%sp),%a1 + sub.l %d4,%a1 + move.l %d2,%a2 + tst.l %a1 + jlt .L193 +.L133: + move.l (%a5,%d6.l*4),%d2 + moveq #9,%d7 + move.l %a1,%d6 + asr.l %d7,%d6 + swap %d2 + clr.w %d2 + move.l %d6,%a1 + sub.l 40(%a6),%d2 + jmi .L194 +.L134: + moveq #9,%d6 + asr.l %d6,%d2 + move.l %a2,%d6 + move.l %a1,%d7 + or.l %d5,%d6 + or.l %d3,%d6 + or.l %d7,%d6 + or.l %d2,%d6 + move.l %d6,52(%sp) + tst.l %a3 + jne .L162 +.L199: + move.l 148(%a6),%a5 + tst.l %a5 + jne .L162 + move.l 8(%a6),%a4 + move.l %a4,64(%sp) + cmp.l %a0,%a4 + jeq .L195 + move.l %a0,%d7 + sub.l 64(%sp),%d7 + move.l %d7,%d6 + tst.l %d7 + jlt .L196 + asr.l #6,%d6 + jeq .L197 +.L140: + cmp.l #32831,%d7 + jgt .L165 + cmp.l #-512,%d6 + jge .L142 + move.l #-512,%d6 +.L142: + move.l %d6,%a5 + lsl.l #4,%d6 + move.l %d6,56(%sp) + move.l 64(%sp),%d6 + add.l %a5,%d6 + move.l %d6,8(%a6) +.L135: + tst.l 52(%sp) + jne .L138 + cmp.l 8(%a6),%a0 + jeq .L198 +.L138: + move.l %a1,%d7 + move.l %a2,%d6 + lsl.l #4,%d7 + lsl.l #4,%d6 + move.l 160(%sp),100(%a6) + move.l %d7,%a1 + add.l %d4,%a1 + add.l %d0,%d6 + move.l %d6,32(%a6) + move.l %a1,36(%a6) + tst.l 60(%sp) + jne .L145 + cmp.l #511,%a1 + jgt .L145 + clr.l 36(%a6) +.L145: tst.l %d1 - jge .L133 - jra .L180 -.L188: + seq %d7 + move.l 16(%a6),%a2 + add.l #1246608,%a2 + move.l %a2,16(%a6) + move.l 128(%a6),%d1 + move.l 132(%a6),%a0 + sub.l %d1,%a0 + mvs.b %d7,%d7 + neg.l %d7 + tst.l %a0 + jge .L146 +.L185: + lea (15,%a0),%a0 + jra .L146 +.L187: move.l #512,%d1 + moveq #22,%d6 sub.l %d0,%d1 - moveq #22,%d0 - lsl.l %d0,%d1 + lsl.l %d6,%d1 move.l %d1,-(%sp) move.l 4(%a6),-(%sp) - move.l %a2,-(%sp) + move.l %d4,-(%sp) move.l 136(%a6),-(%sp) move.l 144(%a6),-(%sp) - move.l 172(%sp),-(%sp) - move.l 172(%sp),-(%sp) - move.l %d6,-(%sp) + move.l 168(%sp),-(%sp) + move.l 168(%sp),-(%sp) + move.l %a2,-(%sp) jsr (%a3) lea (32,%sp),%sp - moveq #-16,%d1 - add.l %d1,148(%a6) - jra .L151 -.L185: + moveq #-16,%d0 + add.l %d0,148(%a6) + jra .L154 +.L186: add.l #15,%d1 asr.l #4,%d1 - jra .L139 -.L178: - tst.l 152(%a6) - jeq .L127 - jra .L128 -.L189: - clr.l 24(%a6) - jra .L152 + jra .L148 +.L188: + move.l %d5,12(%a6) + jra .L117 .L190: - clr.l 36(%a6) - jra .L153 -.L186: - add.l #63,%d6 - jra .L146 -.L147: - cmp.l #32831,%d0 - jgt .L162 - cmp.l #-512,%d6 - jge .L150 - move.l #-512,%d6 -.L150: - move.l %d6,%d0 - add.l %d1,%d6 - lsl.l #4,%d0 - move.l %d6,8(%a6) - add.l %a2,%d0 - jra .L145 + sub.l 28(%a6),%d3 + add.l #511,%d5 + moveq #9,%d7 + asr.l %d7,%d5 + tst.l %d3 + jge .L131 +.L191: + moveq #9,%d2 + add.l #511,%d3 + asr.l %d2,%d3 + move.l 32(%a6),%d0 + move.l %d4,%d2 + sub.l %d0,%d2 + jpl .L132 +.L192: + add.l #511,%d2 + moveq #9,%d7 + asr.l %d7,%d2 + move.l 36(%a6),%d4 + move.l 60(%sp),%a1 + sub.l %d4,%a1 + move.l %d2,%a2 + tst.l %a1 + jge .L133 +.L193: + move.l (%a5,%d6.l*4),%d2 + lea (511,%a1),%a1 + moveq #9,%d7 + move.l %a1,%d6 + asr.l %d7,%d6 + swap %d2 + clr.w %d2 + move.l %d6,%a1 + sub.l 40(%a6),%d2 + jpl .L134 +.L194: + moveq #9,%d6 + add.l #511,%d2 + asr.l %d6,%d2 + move.l %a2,%d6 + move.l %a1,%d7 + or.l %d5,%d6 + or.l %d3,%d6 + or.l %d7,%d6 + or.l %d2,%d6 + move.l %d6,52(%sp) + tst.l %a3 + jeq .L199 .L162: - move.l #512,%d6 - move.l #8192,%d0 - add.l %d1,%d6 + sub.l %a5,%a5 + clr.l 56(%sp) + jra .L135 +.L180: + move.l %a6,%d0 + move.l %a6,%a1 + add.l #200,%d0 +.L124: + clr.l (%a1)+ + cmp.l %a1,%d0 + jne .L124 + tst.l %a3 + sne %d0 + lea te_hiss,%a5 + move.l (%a5,%d6.l*4),%d2 + move.l #973915,%a4 + move.l %d5,12(%a6) + move.l #751934170,%a1 + swap %d2 + clr.w %d2 + move.l #1831565813,%d5 + move.l %a0,8(%a6) + move.l %d5,20(%a6) + mvs.b %d0,%d0 + move.l %d1,24(%a6) + move.l %d3,28(%a6) + move.l %d4,32(%a6) + neg.l %d0 + move.l %a1,124(%a6) + move.l %a4,132(%a6) + move.l %a4,128(%a6) + move.l 60(%sp),36(%a6) + move.l %d2,40(%a6) + move.l %d0,152(%a6) + jra .L123 +.L158: + mulu.w #12,%d0 + lea clocks2,%a0 + move.l #1323000,%d3 + lsr.l #7,%d0 + mvz.b (%a0,%d0.l),%d0 + muls.l %d3,%d0 + move.l %d0,%d1 + remu.l %d5,%d4:%d1 + divu.l %d5,%d1 + mvz.w %d4,%d0 + lsl.l #8,%d1 + lsl.l #8,%d0 + divu.l %d5,%d0 + move.l %d0,%a0 + add.l %d1,%a0 + jra .L159 +.L184: + move.l %a6,-(%sp) + move.l %d0,52(%sp) + jsr tone_update + addq.l #4,%sp + sub.l %a5,%a5 + clr.l 56(%sp) + move.l 16(%a6),%a2 + add.l #1246608,%a2 + move.l 48(%sp),%d0 + clr.l %d2 + move.l 128(%a6),%d1 + clr.l %d3 + clr.l %d5 + move.l 132(%a6),%a0 + sub.l %d1,%a0 + move.l %a2,16(%a6) + tst.l %a0 + jge .L146 + jra .L185 +.L189: + tst.l 152(%a6) + jeq .L125 + jra .L126 +.L198: + tst.l 148(%a6) + jne .L138 + tst.l %a3 + sne %d7 + mvs.b %d7,%d7 + neg.l %d7 + cmp.l 152(%a6),%d7 + seq %d7 + mvs.b %d7,%d7 + neg.l %d7 + move.l %d7,160(%sp) + jra .L138 +.L197: + tst.l %d7 + jle .L164 + move.w #1,%a5 + move.w #16,%a4 + move.l 64(%sp),%d6 + add.l %a5,%d6 + move.l %a4,56(%sp) move.l %d6,8(%a6) - add.l %a2,%d0 - jra .L145 -.L187: - moveq #-1,%d6 - moveq #-16,%d0 - add.l %d1,%d6 + jra .L135 +.L196: + add.l #63,%d6 + asr.l #6,%d6 + jne .L140 + jra .L197 +.L195: + tst.l %d6 + jeq .L163 + clr.l 160(%sp) + clr.l 56(%sp) + jra .L138 +.L163: + tst.l %a3 + sne %d7 + clr.l 56(%sp) + mvs.b %d7,%d7 + neg.l %d7 + cmp.l 152(%a6),%d7 + seq %d7 + mvs.b %d7,%d7 + neg.l %d7 + move.l %d7,160(%sp) + jra .L138 +.L165: + move.w #512,%a5 + move.w #8192,%a4 + move.l 64(%sp),%d6 + add.l %a5,%d6 + move.l %a4,56(%sp) move.l %d6,8(%a6) - add.l %a2,%d0 - jra .L145 - .size te_process, .-te_process + jra .L135 +.L164: + move.w #-1,%a5 + move.w #-16,%a4 + move.l 64(%sp),%d6 + add.l %a5,%d6 + move.l %a4,56(%sp) + move.l %d6,8(%a6) + jra .L135 + .size te_block, .-te_block .align 2 - .globl te_cpu_frame - .type te_cpu_frame, @function -te_cpu_frame: - link.w %fp,#-44 - move.l 8(%fp),%a1 - moveq #7,%d1 - move.l %d3,-(%sp) - move.l %d2,-(%sp) - move.l 112(%a1),%d0 - cmp.l %d0,%d1 - jcs .L192 - move.l 76(%a1),%a0 - moveq #15,%d2 - mvz.b 7(%a0),%d1 - cmp.l %d1,%d2 - jne .L193 - move.l 108(%a1),%a0 - mvz.b (%a0),%d1 - subq.l #7,%d1 - tst.l %d1 - jeq .L193 - move.l 72(%a1),%a0 - mvz.b (%a0),%d1 - move.l %d1,-32(%fp) - move.l #1411328,%d1 - mvz.b 2(%a0),%d2 - muls.l %d0,%d1 - move.l %d2,-28(%fp) - mvz.b 4(%a0),%d3 - add.l #1330654224,%d1 - move.l %d3,-24(%fp) - mvz.b 8(%a0),%d2 - move.l 48(%a1),%d3 - sub.l %d1,%d3 - move.l %d3,-44(%fp) - lsr.l #3,%d3 - move.l %d2,-20(%fp) - mvz.b 10(%a0),%d2 - move.l %d3,-36(%fp) - move.l %d2,-16(%fp) - mvz.b 6(%a0),%d3 - move.l -44(%fp),%d2 - move.l %d3,-12(%fp) - move.l -2147477476,%a0 - move.l %d0,-4(%fp) - move.l %a0,-8(%fp) - cmp.l #1411079,%d2 - jls .L196 - move.l #200,%d3 - muls.l %d3,%d0 - lea te_states,%a0 - clr.l (%a0,%d0.l) -.L192: - clr.l %d0 -.L191: - move.l -52(%fp),%d2 - move.l -48(%fp),%d3 - unlk %fp - rts -.L193: - move.l #200,%d1 - muls.l %d1,%d0 - lea te_states,%a0 - clr.l (%a0,%d0.l) - clr.l %d0 - jra .L191 -.L196: - move.l 1073755686,%d2 - move.l #-2147483416,%a0 - move.l (%a0),%d3 - eor.l %d2,%d3 - move.l %d3,(%a0) -#APP -| 435 "modules/tapeecho/cpu.c" 1 - move.l #0,%acc0 - move.l #0,%acc1 - move.l #0,%acc2 - move.l #0,%acc3 -| 0 "" 2 -#NO_APP - move.l #200,%d2 - move.l (%a0),%a0 - muls.l %d2,%d0 - move.l %a0,-(%sp) - move.l 96(%a1),-(%sp) - move.l -36(%fp),-(%sp) - move.l %d1,-(%sp) - pea -32(%fp) - add.l #te_states,%d0 - move.l %d0,-(%sp) - jsr te_process - lea (24,%sp),%sp - move.l -52(%fp),%d2 - move.l #-2147458688,%a0 - moveq #1,%d0 - move.l -48(%fp),%d3 - move.l (%a0),%d1 - add.l #68,%d1 - move.l %d1,(%a0) - unlk %fp + .globl te_process + .type te_process, @function +te_process: + clr.l -(%sp) + move.l 28(%sp),-(%sp) + move.l 28(%sp),-(%sp) + move.l 28(%sp),-(%sp) + move.l 28(%sp),-(%sp) + move.l 28(%sp),-(%sp) + move.l 28(%sp),-(%sp) + jsr te_block + lea (28,%sp),%sp rts - .size te_cpu_frame, .-te_cpu_frame + .size te_process, .-te_process .section .rodata .align 2 .type te_kernel_tables, @object @@ -5273,7 +5244,7 @@ te_feedback: .long 1694524788 .long 1725316314 .long 1756417301 - .align 4 + .align 2 .type te_tone, @object .size te_tone, 87552 te_tone: @@ -27172,19 +27143,18 @@ te_hp: .long 2117197394 .long 2086669682 .long -2087152599 - .section .note.GNU-stack,"",@progbits | Enter after the stock DMA read wait and next-track prefetch, before its | filter/mix. sp is still the stock routine's 148-byte frame. Stock's own | EMAC save/restore and ring DMA commit surround this adapter. .text .balign 4 - .global te_cpu_hook, te_cpu_reset, te_states + .global te_cpu_hook, te_cpu_reset, te_states, te_guard, te_keys te_cpu_reset: lea -12(%sp),%sp movem.l %d0-%d1/%a0,(%sp) - lea te_states,%a0 - move.l #399,%d1 + lea te_keys,%a0 + move.l #437,%d1 | te_keys, te_guard and te_states: 438 longs moveq #0,%d0 te_clear_loop: move.l %d0,(%a0)+ @@ -27195,24 +27165,201 @@ te_clear_loop: lea -16(%sp),%sp movem.l %d2-%d5,(%sp) jmp 0x40002f4c +| Every track's seam comes here. Another effect's track (or a track whose +| byte at 108(sp) is 7) goes straight back to stock, in a5 and d0 only: the +| stock replay below reloads both. Its Tape Echo state is cleared on the +| first such frame (te_guard's live mask says which tracks may hold any). +| Stock's code from 0x4000377a reads neither a5 nor d0 before writing it. te_cpu_hook: - lea -20(%sp),%sp - movem.l %d0-%d1/%a0-%a1,4(%sp) - lea 20(%sp),%a0 - move.l %a0,(%sp) - jsr te_cpu_frame - tst.l %d0 - beq.s te_stock_path - movem.l 4(%sp),%d0-%d1/%a0-%a1 - lea 20(%sp),%sp + move.l 76(%sp),%a5 + mvz.b 7(%a5),%d0 + cmpi.l #0x0f,%d0 | TE_ID + bne te_decline + move.l 108(%sp),%a5 + mvz.b (%a5),%d0 + subq.l #7,%d0 + beq te_decline +| A Tape Echo track. Frame: 0..31 TapeParams p, 32..71 saved d1-d5/a0-a4, +| the stock routine's frame at 72(sp): 48 ring write address, 72 knob +| words, 96 audio, 112 track. Registers: d2 track, then steady; d3 ring +| base; d4 write index; d5 tempo; a2 the state; a3 the record buffer; a4 +| the steady key. + lea -72(%sp),%sp + movem.l %d1-%d5/%a0-%a4,32(%sp) + move.l 72+112(%sp),%d2 + moveq #8,%d0 + cmp.l %d0,%d2 + bcc te_track_stock + move.l #1411328,%d3 | TE_STRIDE + mulu.l %d2,%d3 + add.l #0x4f502c10,%d3 | this track's ring, uncached + move.l 72+48(%sp),%d4 + sub.l %d3,%d4 + lsr.l #3,%d4 + move.l %d2,%d0 + mulu.w #200,%d0 + lea te_states,%a2 + adda.l %d0,%a2 + cmp.l #176384,%d4 | TE_RING - TE_FRAMES + bhi te_track_far +| Stock 0x40003624 toggles these two scratch buffers after prefetching the +| NEXT track into the other one; skipping that toggle would overwrite an +| in-flight DMA read. Its immediate is 0x800039a0 ^ 0x80003ae0, written only +| by stock's delay reset (0x40002fae, under te_cpu_reset). + move.l 0x800000e8,%d0 + eori.l #0x340,%d0 + move.l %d0,0x800000e8 + movea.l %d0,%a3 + moveq #68,%d0 + add.l %d0,0x80006180 | stock filter's per-track state iterator + tst.l (%a2) | an active state already has its live bit + bne.s 1f + lea te_guard+23,%a1 + bset %d2,(%a1) +| Overload hold (TapeGuard: 0 call, 4 last, 8 hold, 12 holds, 16 late). The +| stock delay routine runs once a frame at IPL 5; a call that begins more +| than a quarter frame later than the last one's (stock's free-running +| DTIM3, 132 MHz) holds every instance for that block. A count that stands +| still, or a gap of two frames or more, never holds. +1: lea te_guard,%a1 + move.l 0xfc07c00c,%d0 + move.l %d0,%d1 + sub.l 4(%a1),%d1 + cmp.l #23945,%d1 | TE_FRAME_COUNTS / 2: this call's first block + bls.s 3f + move.l %d0,%d1 + sub.l (%a1),%d1 + move.l %d0,(%a1) + clr.l 8(%a1) + cmp.l #95782,%d1 | 2 * TE_FRAME_COUNTS + bcc.s 3f + cmp.l 16(%a1),%d1 + bls.s 2f + move.l %d1,16(%a1) +2: cmp.l #59863,%d1 | TE_FRAME_COUNTS + TE_FRAME_COUNTS / 4 + bls.s 3f + moveq #1,%d1 + move.l %d1,8(%a1) +3: move.l %d0,4(%a1) + tst.l 8(%a1) + bne te_hold +| The stock filter drains its accumulators on its first sample. It is +| bypassed, so establish the same empty accumulators first. + move.l #0,%acc0 + move.l #0,%acc1 + move.l #0,%acc2 + move.l #0,%acc3 +| Steady: the state says nothing ramps, glides or fades and the six stock +| knob halfwords and the tempo word are the last steady block's. + move.l 72+72(%sp),%a0 + move.l %d2,%d0 + lsl.l #4,%d0 + lea te_keys,%a4 + adda.l %d0,%a4 + move.l 0x8000181c,%d5 + move.l %d2,28(%sp) | p.lane + tst.l 100(%a2) | s->steady + beq.s te_full + tst.l (%a2) | s->active + beq.s te_full + cmp.l 12(%a4),%d5 + bne.s te_full + move.l (%a0),%d0 + cmp.l (%a4),%d0 + bne.s te_full + move.l 4(%a0),%d0 + cmp.l 4(%a4),%d0 + bne.s te_full + move.l 8(%a0),%d0 + cmp.l 8(%a4),%d0 + bne.s te_full + moveq #1,%d2 + bra.s te_call +| Each control is the high (first) byte of its staged halfword. +te_full: + mvz.b (%a0),%d0 + move.l %d0,(%sp) | time + mvz.b 2(%a0),%d0 + move.l %d0,4(%sp) | feedback + mvz.b 4(%a0),%d0 + move.l %d0,8(%sp) | wow + mvz.b 8(%a0),%d0 + move.l %d0,12(%sp) | sync + mvz.b 10(%a0),%d0 + move.l %d0,16(%sp) | mix + mvz.b 6(%a0),%d0 + move.l %d0,20(%sp) | age + move.l %d5,24(%sp) | tempo + moveq #0,%d2 +te_call: + move.l %d2,-(%sp) | te_block(s, &p, ring, write, audio, record, steady) + move.l %a3,-(%sp) + move.l 80+96(%sp),-(%sp) + move.l %d4,-(%sp) + move.l %d3,-(%sp) + pea 20(%sp) + move.l %a2,-(%sp) + jsr te_block + lea 28(%sp),%sp +| A full block that leaves s->steady set keys the next steady ones. + tst.l %d2 + bne.s te_track_done + tst.l 100(%a2) + beq.s te_track_done + move.l 72+72(%sp),%a0 + move.l (%a0),(%a4) + move.l 4(%a0),4(%a4) + move.l 8(%a0),8(%a4) + move.l %d5,12(%a4) +te_track_done: + movem.l 32(%sp),%d1-%d5/%a0-%a4 + lea 72(%sp),%sp jmp 0x4000377a -te_stock_path: - movem.l 4(%sp),%d0-%d1/%a0-%a1 - lea 20(%sp),%sp +| Held: silence to the tape, the dry signal untouched, only the history +| count moves. 32 stores and no ring read. +te_hold: + addq.l #1,12(%a1) + moveq #31,%d0 +4: clr.l (%a3)+ + subq.l #1,%d0 + bpl.s 4b + tst.l (%a2) + beq.s te_track_done + moveq #16,%d0 + add.l 4(%a2),%d0 + cmp.l #176399,%d0 | TE_RING - 1 + bls.s 5f + move.l #176399,%d0 +5: move.l %d0,4(%a2) + bra.s te_track_done +| The write position leaves no room for a block: stock's path, and the +| instance starts afresh when it comes back. +te_track_far: + clr.l (%a2) +te_track_stock: + movem.l 32(%sp),%d1-%d5/%a0-%a4 + lea 72(%sp),%sp + bra.s te_replay +te_decline: + move.l 112(%sp),%d0 + cmpi.l #8,%d0 + bcc.s te_replay + lea te_guard+23,%a5 + btst %d0,(%a5) + beq.s te_replay + bclr %d0,(%a5) + mulu.w #200,%d0 + lea te_states,%a5 + clr.l (%a5,%d0.l) | its active word +te_replay: move.l 92(%sp),%a5 move.l 0x800000e8,%d0 jmp 0x40003624 - .balign 4 + .balign 16 +te_keys: + .zero 128 +te_guard: + .zero 24 te_states: .zero 1600 @@ -27364,10 +27511,13 @@ te_tape_block: move.l %d4,%a6 bra .Ltape_mix - .macro TE_TAPE_RECORD x1,x2,ramp +| pre: dry L is already in d5 (the previous sample's output loaded it). + .macro TE_TAPE_RECORD x1,x2,ramp,pre=0 mulu.l 44(%sp),%d0 add.l #1013904223,%d0 + .if !\pre move.l (%a0),%d5 + .endif mac.l %d5,%a5,4(%a0),%d6,%acc0 mac.l %d6,%a5,(%a2)+,%d3,%acc0 mac.l %d3,%d7,%acc0 @@ -27409,18 +27559,21 @@ te_tape_block: move.l %d4,\x2 .endm +| The first product loads the next sample's dry L into d5 (the last one +| reads the word after the block: a load only, of stock's own audio RAM). .macro TE_TAPE_WET + mac.l %d3,%a6,8(%a0),%d5,%acc2 mac.l %d3,%a6,%acc2 mac.l %d3,%a6,%acc2 mac.l %d3,%a6,%acc2 - mac.l %d3,%a6,%acc2 - movclr.l %acc2,%d5 - move.l %d5,(%a0)+ - move.l %d5,(%a0)+ + movclr.l %acc2,%d6 + move.l %d6,(%a0)+ + move.l %d6,(%a0)+ .endm | Per channel: 4*g*wet + k*dry, g in a6 and k from 52(sp). Dry L/R reload -| through multiply-with-load while the wet products accumulate. +| through multiply-with-load while the wet products accumulate, and the +| last right-channel wet product loads the next sample's dry L into d5. .macro TE_TAPE_MIX load .if \load mac.l %d3,%a6,52(%sp),%d4,%acc2 @@ -27434,10 +27587,10 @@ te_tape_block: mac.l %d3,%a6,%acc3 mac.l %d3,%a6,%acc3 mac.l %d3,%a6,%acc3 - mac.l %d3,%a6,%acc3 + mac.l %d3,%a6,8(%a0),%d5,%acc3 mac.l %d6,%d4,%acc3 - movclr.l %acc2,%d5 - move.l %d5,(%a0)+ + movclr.l %acc2,%d4 + move.l %d4,(%a0)+ movclr.l %acc3,%d6 move.l %d6,(%a0)+ .endm @@ -27480,21 +27633,24 @@ te_tape_block: .Ltape_wet: move.l #2147483647,%a6 + move.l (%a0),%d5 .Ltape_wet_pair: - TE_TAPE_RECORD %d1,%d2,0 + TE_TAPE_RECORD %d1,%d2,0,1 TE_TAPE_WET - TE_TAPE_RECORD %d2,%d1,0 + TE_TAPE_RECORD %d2,%d1,0,1 TE_TAPE_WET cmpa.l 48(%sp),%a2 bne .Ltape_wet_pair bra .Ltape_done .Ltape_mix: - TE_TAPE_RECORD %d1,%d2,0 + move.l (%a0),%d5 +.Ltape_mix_pair: + TE_TAPE_RECORD %d1,%d2,0,1 TE_TAPE_MIX 1 - TE_TAPE_RECORD %d2,%d1,0 + TE_TAPE_RECORD %d2,%d1,0,1 TE_TAPE_MIX 1 cmpa.l 48(%sp),%a2 - bne .Ltape_mix + bne .Ltape_mix_pair bra .Ltape_done .Ltape_dry: TE_TAPE_RECORD %d1,%d2,0 diff --git a/sdk/octatrack/modules/tapeecho/cpu_hooks.s b/sdk/octatrack/modules/tapeecho/cpu_hooks.s index 8306bef683..69d4a89cf3 100644 --- a/sdk/octatrack/modules/tapeecho/cpu_hooks.s +++ b/sdk/octatrack/modules/tapeecho/cpu_hooks.s @@ -3,12 +3,12 @@ | EMAC save/restore and ring DMA commit surround this adapter. .text .balign 4 - .global te_cpu_hook, te_cpu_reset, te_states + .global te_cpu_hook, te_cpu_reset, te_states, te_guard, te_keys te_cpu_reset: lea -12(%sp),%sp movem.l %d0-%d1/%a0,(%sp) - lea te_states,%a0 - move.l #399,%d1 + lea te_keys,%a0 + move.l #437,%d1 | te_keys, te_guard and te_states: 438 longs moveq #0,%d0 te_clear_loop: move.l %d0,(%a0)+ @@ -19,23 +19,200 @@ te_clear_loop: lea -16(%sp),%sp movem.l %d2-%d5,(%sp) jmp 0x40002f4c +| Every track's seam comes here. Another effect's track (or a track whose +| byte at 108(sp) is 7) goes straight back to stock, in a5 and d0 only: the +| stock replay below reloads both. Its Tape Echo state is cleared on the +| first such frame (te_guard's live mask says which tracks may hold any). +| Stock's code from 0x4000377a reads neither a5 nor d0 before writing it. te_cpu_hook: - lea -20(%sp),%sp - movem.l %d0-%d1/%a0-%a1,4(%sp) - lea 20(%sp),%a0 - move.l %a0,(%sp) - jsr te_cpu_frame - tst.l %d0 - beq.s te_stock_path - movem.l 4(%sp),%d0-%d1/%a0-%a1 - lea 20(%sp),%sp + move.l 76(%sp),%a5 + mvz.b 7(%a5),%d0 + cmpi.l #0x0f,%d0 | TE_ID + bne te_decline + move.l 108(%sp),%a5 + mvz.b (%a5),%d0 + subq.l #7,%d0 + beq te_decline +| A Tape Echo track. Frame: 0..31 TapeParams p, 32..71 saved d1-d5/a0-a4, +| the stock routine's frame at 72(sp): 48 ring write address, 72 knob +| words, 96 audio, 112 track. Registers: d2 track, then steady; d3 ring +| base; d4 write index; d5 tempo; a2 the state; a3 the record buffer; a4 +| the steady key. + lea -72(%sp),%sp + movem.l %d1-%d5/%a0-%a4,32(%sp) + move.l 72+112(%sp),%d2 + moveq #8,%d0 + cmp.l %d0,%d2 + bcc te_track_stock + move.l #1411328,%d3 | TE_STRIDE + mulu.l %d2,%d3 + add.l #0x4f502c10,%d3 | this track's ring, uncached + move.l 72+48(%sp),%d4 + sub.l %d3,%d4 + lsr.l #3,%d4 + move.l %d2,%d0 + mulu.w #200,%d0 + lea te_states,%a2 + adda.l %d0,%a2 + cmp.l #176384,%d4 | TE_RING - TE_FRAMES + bhi te_track_far +| Stock 0x40003624 toggles these two scratch buffers after prefetching the +| NEXT track into the other one; skipping that toggle would overwrite an +| in-flight DMA read. Its immediate is 0x800039a0 ^ 0x80003ae0, written only +| by stock's delay reset (0x40002fae, under te_cpu_reset). + move.l 0x800000e8,%d0 + eori.l #0x340,%d0 + move.l %d0,0x800000e8 + movea.l %d0,%a3 + moveq #68,%d0 + add.l %d0,0x80006180 | stock filter's per-track state iterator + tst.l (%a2) | an active state already has its live bit + bne.s 1f + lea te_guard+23,%a1 + bset %d2,(%a1) +| Overload hold (TapeGuard: 0 call, 4 last, 8 hold, 12 holds, 16 late). The +| stock delay routine runs once a frame at IPL 5; a call that begins more +| than a quarter frame later than the last one's (stock's free-running +| DTIM3, 132 MHz) holds every instance for that block. A count that stands +| still, or a gap of two frames or more, never holds. +1: lea te_guard,%a1 + move.l 0xfc07c00c,%d0 + move.l %d0,%d1 + sub.l 4(%a1),%d1 + cmp.l #23945,%d1 | TE_FRAME_COUNTS / 2: this call's first block + bls.s 3f + move.l %d0,%d1 + sub.l (%a1),%d1 + move.l %d0,(%a1) + clr.l 8(%a1) + cmp.l #95782,%d1 | 2 * TE_FRAME_COUNTS + bcc.s 3f + cmp.l 16(%a1),%d1 + bls.s 2f + move.l %d1,16(%a1) +2: cmp.l #59863,%d1 | TE_FRAME_COUNTS + TE_FRAME_COUNTS / 4 + bls.s 3f + moveq #1,%d1 + move.l %d1,8(%a1) +3: move.l %d0,4(%a1) + tst.l 8(%a1) + bne te_hold +| The stock filter drains its accumulators on its first sample. It is +| bypassed, so establish the same empty accumulators first. + move.l #0,%acc0 + move.l #0,%acc1 + move.l #0,%acc2 + move.l #0,%acc3 +| Steady: the state says nothing ramps, glides or fades and the six stock +| knob halfwords and the tempo word are the last steady block's. + move.l 72+72(%sp),%a0 + move.l %d2,%d0 + lsl.l #4,%d0 + lea te_keys,%a4 + adda.l %d0,%a4 + move.l 0x8000181c,%d5 + move.l %d2,28(%sp) | p.lane + tst.l 100(%a2) | s->steady + beq.s te_full + tst.l (%a2) | s->active + beq.s te_full + cmp.l 12(%a4),%d5 + bne.s te_full + move.l (%a0),%d0 + cmp.l (%a4),%d0 + bne.s te_full + move.l 4(%a0),%d0 + cmp.l 4(%a4),%d0 + bne.s te_full + move.l 8(%a0),%d0 + cmp.l 8(%a4),%d0 + bne.s te_full + moveq #1,%d2 + bra.s te_call +| Each control is the high (first) byte of its staged halfword. +te_full: + mvz.b (%a0),%d0 + move.l %d0,(%sp) | time + mvz.b 2(%a0),%d0 + move.l %d0,4(%sp) | feedback + mvz.b 4(%a0),%d0 + move.l %d0,8(%sp) | wow + mvz.b 8(%a0),%d0 + move.l %d0,12(%sp) | sync + mvz.b 10(%a0),%d0 + move.l %d0,16(%sp) | mix + mvz.b 6(%a0),%d0 + move.l %d0,20(%sp) | age + move.l %d5,24(%sp) | tempo + moveq #0,%d2 +te_call: + move.l %d2,-(%sp) | te_block(s, &p, ring, write, audio, record, steady) + move.l %a3,-(%sp) + move.l 80+96(%sp),-(%sp) + move.l %d4,-(%sp) + move.l %d3,-(%sp) + pea 20(%sp) + move.l %a2,-(%sp) + jsr te_block + lea 28(%sp),%sp +| A full block that leaves s->steady set keys the next steady ones. + tst.l %d2 + bne.s te_track_done + tst.l 100(%a2) + beq.s te_track_done + move.l 72+72(%sp),%a0 + move.l (%a0),(%a4) + move.l 4(%a0),4(%a4) + move.l 8(%a0),8(%a4) + move.l %d5,12(%a4) +te_track_done: + movem.l 32(%sp),%d1-%d5/%a0-%a4 + lea 72(%sp),%sp jmp 0x4000377a -te_stock_path: - movem.l 4(%sp),%d0-%d1/%a0-%a1 - lea 20(%sp),%sp +| Held: silence to the tape, the dry signal untouched, only the history +| count moves. 32 stores and no ring read. +te_hold: + addq.l #1,12(%a1) + moveq #31,%d0 +4: clr.l (%a3)+ + subq.l #1,%d0 + bpl.s 4b + tst.l (%a2) + beq.s te_track_done + moveq #16,%d0 + add.l 4(%a2),%d0 + cmp.l #176399,%d0 | TE_RING - 1 + bls.s 5f + move.l #176399,%d0 +5: move.l %d0,4(%a2) + bra.s te_track_done +| The write position leaves no room for a block: stock's path, and the +| instance starts afresh when it comes back. +te_track_far: + clr.l (%a2) +te_track_stock: + movem.l 32(%sp),%d1-%d5/%a0-%a4 + lea 72(%sp),%sp + bra.s te_replay +te_decline: + move.l 112(%sp),%d0 + cmpi.l #8,%d0 + bcc.s te_replay + lea te_guard+23,%a5 + btst %d0,(%a5) + beq.s te_replay + bclr %d0,(%a5) + mulu.w #200,%d0 + lea te_states,%a5 + clr.l (%a5,%d0.l) | its active word +te_replay: move.l 92(%sp),%a5 move.l 0x800000e8,%d0 jmp 0x40003624 - .balign 4 + .balign 16 +te_keys: + .zero 128 +te_guard: + .zero 24 te_states: .zero 1600 diff --git a/sdk/octatrack/modules/tapeecho/cpu_kernels.s b/sdk/octatrack/modules/tapeecho/cpu_kernels.s index 18e0b1b04a..ac2eaf3ce1 100644 --- a/sdk/octatrack/modules/tapeecho/cpu_kernels.s +++ b/sdk/octatrack/modules/tapeecho/cpu_kernels.s @@ -146,10 +146,13 @@ te_tape_block: move.l %d4,%a6 bra .Ltape_mix - .macro TE_TAPE_RECORD x1,x2,ramp +| pre: dry L is already in d5 (the previous sample's output loaded it). + .macro TE_TAPE_RECORD x1,x2,ramp,pre=0 mulu.l 44(%sp),%d0 add.l #1013904223,%d0 + .if !\pre move.l (%a0),%d5 + .endif mac.l %d5,%a5,4(%a0),%d6,%acc0 mac.l %d6,%a5,(%a2)+,%d3,%acc0 mac.l %d3,%d7,%acc0 @@ -191,18 +194,21 @@ te_tape_block: move.l %d4,\x2 .endm +| The first product loads the next sample's dry L into d5 (the last one +| reads the word after the block: a load only, of stock's own audio RAM). .macro TE_TAPE_WET + mac.l %d3,%a6,8(%a0),%d5,%acc2 mac.l %d3,%a6,%acc2 mac.l %d3,%a6,%acc2 mac.l %d3,%a6,%acc2 - mac.l %d3,%a6,%acc2 - movclr.l %acc2,%d5 - move.l %d5,(%a0)+ - move.l %d5,(%a0)+ + movclr.l %acc2,%d6 + move.l %d6,(%a0)+ + move.l %d6,(%a0)+ .endm | Per channel: 4*g*wet + k*dry, g in a6 and k from 52(sp). Dry L/R reload -| through multiply-with-load while the wet products accumulate. +| through multiply-with-load while the wet products accumulate, and the +| last right-channel wet product loads the next sample's dry L into d5. .macro TE_TAPE_MIX load .if \load mac.l %d3,%a6,52(%sp),%d4,%acc2 @@ -216,10 +222,10 @@ te_tape_block: mac.l %d3,%a6,%acc3 mac.l %d3,%a6,%acc3 mac.l %d3,%a6,%acc3 - mac.l %d3,%a6,%acc3 + mac.l %d3,%a6,8(%a0),%d5,%acc3 mac.l %d6,%d4,%acc3 - movclr.l %acc2,%d5 - move.l %d5,(%a0)+ + movclr.l %acc2,%d4 + move.l %d4,(%a0)+ movclr.l %acc3,%d6 move.l %d6,(%a0)+ .endm @@ -262,21 +268,24 @@ te_tape_block: .Ltape_wet: move.l #2147483647,%a6 + move.l (%a0),%d5 .Ltape_wet_pair: - TE_TAPE_RECORD %d1,%d2,0 + TE_TAPE_RECORD %d1,%d2,0,1 TE_TAPE_WET - TE_TAPE_RECORD %d2,%d1,0 + TE_TAPE_RECORD %d2,%d1,0,1 TE_TAPE_WET cmpa.l 48(%sp),%a2 bne .Ltape_wet_pair bra .Ltape_done .Ltape_mix: - TE_TAPE_RECORD %d1,%d2,0 + move.l (%a0),%d5 +.Ltape_mix_pair: + TE_TAPE_RECORD %d1,%d2,0,1 TE_TAPE_MIX 1 - TE_TAPE_RECORD %d2,%d1,0 + TE_TAPE_RECORD %d2,%d1,0,1 TE_TAPE_MIX 1 cmpa.l 48(%sp),%a2 - bne .Ltape_mix + bne .Ltape_mix_pair bra .Ltape_done .Ltape_dry: TE_TAPE_RECORD %d1,%d2,0 diff --git a/sdk/octatrack/modules/tapeecho/octamod.module.json b/sdk/octatrack/modules/tapeecho/octamod.module.json index 1301c6fa10..ef70c08b18 100644 --- a/sdk/octatrack/modules/tapeecho/octamod.module.json +++ b/sdk/octatrack/modules/tapeecho/octamod.module.json @@ -3,7 +3,7 @@ "id": "tapeecho", "key": "TAPE ECHO", "name": "Tape Echo", - "version": "0.1.6-experimental", + "version": "0.1.8-experimental", "category": "effects", "author": { "github": "repeat98", @@ -82,7 +82,7 @@ "location": "FX2", "conflicts": [], "limitations": [ - "The pinned hardware record reports six instances running and a seventh freezing the unit; that limit remains open. Recorded gates cover native arithmetic parity, dirty state, eight-instance stress, moving controls and repeat/feedback behavior. Hardware timing and worst-case CPU headroom remain unqualified." + "The pinned hardware record reports six instances running and a seventh freezing the unit; that limit remains open. Recorded gates cover native arithmetic parity, dirty state, eight-instance stress, moving controls and repeat/feedback behavior. Hardware timing and worst-case CPU headroom remain unqualified. From 0.1.8 every instance holds for one block (dry passes, silence is recorded) when stock's delay routine starts more than a quarter frame late; that hold is not yet observed on a unit." ], "effectId": 15 }, @@ -99,11 +99,11 @@ }, "processing": { "label": "CPU instruction peak", - "display": "22,571 per frame", + "display": "22,586 per frame", "value": null, "unit": "see display", "method": "emulator", - "conditions": "Eight instances with all controls reversing in BEAT mode. FREE peaked at 19,087. 0.1.6 adds 1,024 to both while MIX, FDBK or AGE is moving. These emulator instruction counts are not hardware cycles or CPU percentages.", + "conditions": "Eight instances with all controls reversing in BEAT mode (22,571 in 0.1.7). FREE peaked at 19,178. One instance on the default page costs 1,800 instructions a frame (2,075 in 0.1.7); eight settled instances 14,315 for the whole routine (15,283). These emulator instruction counts are not hardware cycles or CPU percentages.", "source": "TESTING.md" }, "impact": { @@ -111,7 +111,7 @@ "cpu": { "level": "high", "basis": "measured-comparison", - "rationale": "Tape Echo processes audio continuously on ColdFire. Eight modulated instances peak at 22,571 emulator instructions per frame in BEAT mode, versus 7,628 for eight stock DELAY instances in the same record. High is a relative work estimate, not a CPU percentage.", + "rationale": "Tape Echo processes audio continuously on ColdFire. Eight modulated instances peak at 22,586 emulator instructions per frame in BEAT mode, versus 7,628 for eight stock DELAY instances in the same record. High is a relative work estimate, not a CPU percentage.", "source": "TESTING.md" }, "dsp": { @@ -139,7 +139,7 @@ }, "tests": { "report": "TESTING.md", - "summary": "0.1.6 follows BBD's MIX law so turning Tape Echo on no longer turns the track down (issue #969): up to MIX 64 the echo rises over the whole dry signal, above it the dry fades out; the default is MIX 40. The ColdFire kernels match their native oracle bit for bit on the emulator; the echo path, feedback law and self-oscillation headroom are unchanged. The pinned hardware record reports six instances running and a seventh freezing the unit; that limit remains open, and no hardware run, chip timing or listening test exists for 0.1.6. See TESTING.md.", + "summary": "0.1.8 produces the same samples as 0.1.7 with less ColdFire work: other effects' tracks leave its hook in assembly, steady blocks skip the control half, and the per-track entry is assembly. One instance on the default page executes 1,800 instructions a frame against 2,075. A new overload hold drops one block of echo when stock's delay routine starts more than a quarter frame late. The ColdFire kernels and the steady path match their native oracle bit for bit on the emulator; nothing is measured on a unit yet. The pinned hardware record reports six instances running and a seventh freezing the unit; that limit remains open. See TESTING.md.", "hardwareStatus": "untested", "evidenceRevision": "b8deefc88b2c3e5f3c6158e364eb741df1924e1d", "gates": [ diff --git a/sdk/octatrack/modules/tapeecho/runtime.json b/sdk/octatrack/modules/tapeecho/runtime.json new file mode 100644 index 0000000000..03428e9550 --- /dev/null +++ b/sdk/octatrack/modules/tapeecho/runtime.json @@ -0,0 +1,4 @@ +{ + "schema": 1, + "rests": ["0x40002f44", "0x4000361a"] +} diff --git a/src/community/module-changelogs/tapeecho.json b/src/community/module-changelogs/tapeecho.json index 9fded3bf58..70c0f305f7 100644 --- a/src/community/module-changelogs/tapeecho.json +++ b/src/community/module-changelogs/tapeecho.json @@ -1,4 +1,22 @@ [ + { + "version": "0.1.8-experimental", + "date": "2026-11-22", + "changes": [ + "Takes less of the Octatrack's processor while it plays, most of all while its knobs stand still. It sounds exactly as before.", + "When the Octatrack falls behind, Tape Echo drops a moment of echo instead of adding to the load.", + "Not yet checked on a unit." + ] + }, + { + "version": "0.1.7-experimental", + "date": "2026-11-20", + "changes": [ + "Costs the Octatrack nothing of its own while no slot of the project uses Tape Echo, on the next base (0.7.11), and quiet delays on other tracks keep being skipped.", + "Picking Tape Echo wakes it before the pick lands; its sound and controls are unchanged.", + "Not yet checked on a unit." + ] + }, { "version": "0.1.6-experimental", "date": "2026-10-27", diff --git a/src/engine/assets/dsp-packages.json b/src/engine/assets/dsp-packages.json index d84efa8f1a..57dbbfc49d 100644 --- a/src/engine/assets/dsp-packages.json +++ b/src/engine/assets/dsp-packages.json @@ -320,7 +320,7 @@ }, { "id": "tapeecho", - "version": "0.1.6-experimental", + "version": "0.1.8-experimental", "key": "TAPE ECHO", "author": "repeat98", "sources": { diff --git a/src/engine/assets/octatrack-module-packages.json b/src/engine/assets/octatrack-module-packages.json index e56a236d9a..23238074da 100644 --- a/src/engine/assets/octatrack-module-packages.json +++ b/src/engine/assets/octatrack-module-packages.json @@ -238,16 +238,17 @@ "pinned": true, "standalone": true, "abi": 8, - "features": 3, + "features": 1, "sites": 2, - "copies": 7, + "copies": 0, "fills": 0, - "version": "0.1.6-experimental", + "requiresCapabilities": 2048, + "version": "0.1.8-experimental", "name": "Tape Echo", "module": "9f482bb9", - "bytes": 112124, - "sha256": "921e7a60c3418e7ece96f24c254802b44fee2082713f25e7b964b37f233bbe9e", - "path": "octatrack-modules/tapeecho/0.1.6-experimental.mwrm" + "bytes": 112328, + "sha256": "d5a0bd7b51103d9f8a97a3f4b5c2300ae09d539e9c97932734de468171174b73", + "path": "octatrack-modules/tapeecho/0.1.8-experimental.mwrm" }, { "id": "euclid", diff --git a/src/engine/elekloader/module-set.test.ts b/src/engine/elekloader/module-set.test.ts index 2b8db4d3a2..9bd2788494 100644 --- a/src/engine/elekloader/module-set.test.ts +++ b/src/engine/elekloader/module-set.test.ts @@ -104,7 +104,8 @@ describe('preparing a module set', () => { const target = { name: 'All published', moduleIds: USB_MODULE_IDS }, fetched = vi.fn(load) // RINGMOD SC is a published ABI 9 package (a key bus reader) and Analog BD's carries its engine for the base's hook // site (ABI 10): a capable base reports ABI 10. - const events = { abi: 10, features: 7 | 128 | 512 | RuntimeFeature.uiRoots, maxSites: 128, maxCopies: 128 } // Tuner asks for uiRoots (base 0.7.5) + // Tuner asks for uiRoots (base 0.7.5), Tape Echo's resting detours for judgedRests (base 0.7.11) + const events = { abi: 10, features: 7 | 128 | 512 | RuntimeFeature.uiRoots | RuntimeFeature.judgedRests, maxSites: 128, maxCopies: 128 } await expect(prepareModuleSet(target, empty, fetched)).rejects.toBeInstanceOf(BaseUpdateRequired) await expect(prepareModuleSet(target, empty, fetched, { ...events, features: 7 })).rejects.toBeInstanceOf(BaseUpdateRequired) // Repitch subscribes await expect(prepareModuleSet(target, empty, fetched, { ...events, abi: 7 })).rejects.toBeInstanceOf(BaseUpdateRequired)