Vladimir Ivanov wrote:
>
> On Fri, 10 Feb 2012, Michael J. Mahon wrote:
>
>> I develop on a Zip Chip-equipped //e, so all my cycle-counted code
>> depends on temporarily disabling the acceleration it provides.
>
>
> Yes, as long as they are cyclic enough.
>
>> In NadaNet, my approach is to reference the "motor off" softswitch
>> repeatedly (more often than every 50ms) in NadaNet arbitrate, send,
>> and receive code. I find this approach much simpler than the IIgs
>> approach of using multiple instructions to set and reset a speed
>> toggle.
>
>
> This is definitely a very specific corner case. :-)
But it is a quite general technique for disabling acceleration
in timing-critical code that has a loop period of less than 50ms.
In the case of NadaNet, the maximum packet size is 256 bytes, plus
an 8-byte header, all of which takes less than 51ms, so a single
instruction in serve, send, receive, and arbitrate subroutines
does the job, with no need to explicitly switch back to fast mode.
I'd venture to say that a very large fraction of timing-critical
code cases can be handled in exactly the same way.
(After Apple released the IIc+, I supposed that they had endorsed
this acceleration switching mechanism, and was surprised to find
that only the "go slow/go fast" switch mechanism was supported by
the IIgs.)
>> In my sound synthesis code, the problem of rests does not arise,
>> because a "rest" is actually a continuous stream of 22kHz speaker
>> pulses, so speaker references never actually stop.
>
>
> PWM can't have problems with ZipChip. I was thinking simpler one-voice
> output.
Certainly the common case, and one that is very common if, for
example, animation is interspersed with sound generation.
>> I've never heard of any program that is incompatible with the
>> "50ms slowdown" approach, though as Vlad points out, one could
>> easily be constructed by using a timed disk access delay in
>> excess of 50ms.
>
>
> The one that bit me nasty with HDDD A2 - very popular disk copy program
> (I think it was Locksmith) doing simple timed delay on drive spin-up.
> With 4 MHz ZipChip this delay goes less than 200 msec and it's a bit of
> a miracle that regular Disk II drive is still able to write reliable data.
Yes, that makes sense. RWTS uses an "interactive" method which
is served well by the Zip Chip approach, but a simple long-delay
loop would fail.
Giving a Disk ][ about one rotation to get up to speed is
certainly pushing the specification! But I suppose it isn't
surprising that it can do it. The drive motor is quite capable,
the belt is relatively "stiff", and the disk and spindle moment
of inertia is small.
>> Besides not being particularly useful, such a timed delay would
>> need to be quite tolerant of variations, since 50ms is 1/4th of
>> a rotation, and normal disk speed variations would result in a
>> significant variance in track position after such a long delay.
>
>
> By quick calculation variation in position (relative to track) due to
> disk speed seems to be within +/- 4%, which is comparable to one sector,
> so a very pathologically synthetical case seems still possible.
Yes, I can imagine a copy-protection scheme that used track sync
with a delay, though I can't quickly come up with anything that
would benefit from using such a delay...
>> For cases where a shorter slowdown is appropriate, a reference
>> to the paddle timer trigger will cause the Zip Chip to slow down
>> for about 7ms, IIRC, if the chip's mode is set for paddle slowdown.
>
>
> Ouch, I forgot that paddle and speaker enjoy much smaller delay - about
> 5 msec. That makes my sound prediction much much worse. ;-)
It sure does. In fact, any simple tone under 100Hz will be
increased since part of its timing loop is accelerated.