Commodore (as an example) has a built-in real-time clock, sort of. I have used it for keeping time in games and such. Perhaps someone who knows machine language (not me, I wish) can take a look at the Commodore Kernel code for that function and write a similar routine for the Apple. A thought, they are both 6502. On Wed, May 24, 2017 at 8:51 AM, Glenn Roberts via vcf-midatlantic < vcf-midatlantic@lists.vintagecomputerfederation.org> wrote:
three ways come to mind to do timing. one is the brute force FOR..NEXT loop, which of course is completely dependent on CPU speed and generally non-portable. As Bill says use a stopwatch!
In the world of Heathkit (and probably many others) there's a "heartbeat" interrupt that occurs every 2 milliseconds. You can use this to count interrupts and very accurately measure time. This is more portable (at least within the Heath ecosystem) and is generally independent of CPU speed. A popular Heath hack was to use the H8 front panel LEDs to show a real time clock using this technique.
If you have a hardware clock/calendar chip or board you can read the clock and count out time that way (usually via direct Port I/O or possibly memory mapped I/O). This is most useful for longer time periods (minutes or hours) as the clock resolution may or may not be very fine grained (some simply count seconds). Most such clock cards can be configured to be interrupt driven as well.
hope this helps.
- Glenn Roberts
On Wed, May 24, 2017 at 7:36 AM, william degnan via vcf-midatlantic < vcf-midatlantic@lists.vintagecomputerfederation.org> wrote:
There was a whole industry in 8bit times selling clock cards with batteries. I have also seen replacement chips with clock/batteries on them. Not sure what specifically was used for your machine to accomplish this but that's one thing you can do, IF the clock writes to a memory location that BASIC can then access.
Poor man's alternative, use a stopwatch and run the program. Have an on-screen counter running that shoes your program loop counter maybe a space bar to force a stop. Eventually you'll find the best method to accomplish.
Help?
Bill Degnan twitter: billdeg vintagecomputer.net On May 24, 2017 1:03 AM, "Evan Koblentz via vcf-midatlantic" < vcf-midatlantic@lists.vintagecomputerfederation.org> wrote:
Suppose I want an Applesoft (Microsoft) BASIC program to do something for a certain amount of time as measured in seconds or minutes.
FOR-NEXT loops don't align to any real increment -- they just count based on how fast the processor can go, right?
If so, then how do you make something happen for a time amount? ------------------------- Evan Koblentz, director Vintage Computer Federation A 501(c)3 educational non-profit
Evan@vcfed.org (646) 546-9999
www.vcfed.org facebook.com/vcfederation twitter.com/vcfederation