[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple II Interrupt card



Michael J. Mahon wrote:


Contiki needs the clock() function, which is missing from the cc65 AppleII library. There could be several versions of this function based upon hardware configuration (mouse card, interrupt manager card, clock card(s)) the base version could be a crude software timer. There may also be several other missing functions as well.


It is insufficient to say that "Contiki needs the clock() function", since
the issue is what it needs it for, and what level of imprecision in timing
would still meet the functionality needs of Contiki.

Which is why I said there could be several options, including a crude software timer. Since the clock() function is a standard library function for cc65, a more precise function hardware version may well be necessary for some future programs. Apple apparently found it necessary for GSOS.


From what Adam posted, it seems unlikely that Contiki requires much
precision from the clock() function.  He stated that it is only called in
the idle loop--I'm guessing for the purpose of determining when some
timeout(s) have occurred.

That's true.

Generally (but not always) a timeout interval
need not be neither precise nor repeatable, as long as it meets some
rather loose limits between too short and too long.

If this is the case, it may be that a simple counter loop can be used
to determine when to run waiting tasks or to "expire" timers.  The
accurate elapsed time may be unnecessary, as I believe you noted.

Yes Adam's original suggestion was, exactly that, with I believe an approximate value for CLK_TCK


In any case, Contiki does not require interrupts, only an approximate
implementation of the clock() function.

Interestingly, I found a old post on uip which apparently implemented a software timing loop in lieu of clock() in earlier versions. 0.4 I think.

Interrupts are just one way
of providing an elapsed real time function, and, at least on the Apple II,
not the preferred way, since they necessarily interfere with timing loops.

What are the other ways, more preferred ways? Other than the admittedly imprecise software timing loop, the only other way I can think of is an external timing (clock) chip, and the existing clock cards may not have a simple way to compare time.


If there are additional unimplemented functions, they apparently did
not prevent some from compiling the source, using the Apple II library.
Assuming that the Apple II library does not contain stubs for any
unimplemented functions, that suggests that all the functions that
Contiki uses are present.

I implemented the CLK_TCK constant and it still failed to make. Contiki also needs some way of taking to a Super Serial Card, for network connections. AFAICT the cc65 libraries for the Apple2 do not contain any RS-232 functions. This is where Chris Morse started looking at porting Contiki.

-michael


--
Rob

"Never ascribe to malice that which can be adequately explained by stupidity"