This App demonstrates the use of SCM’s idle timer events. It should run on any Z80 or Z180 system with SCM.
A timer event routine is executed periodically when SCM is idle. This is typically when SCM is waiting for a key to be pressed. Idle events are a simple way of running background tasks without having to use interrupts.
This demonstration outputs a ‘+’ character to the terminal every second while SCM is idle. SCM can still be used while the plus signs are being output, although the terminal output can get confusing.
The interval is only very approximate on systems without hardware timers.
If the hardware includes a primary Z80 CTC then the CTC will be used to generate the events, otherwise, software loop counting is used. Software loop counting is not accurate as it is unknown how long the firmware takes to handle other activities. In the case of systems using a bit-bang serial port, the events are many times slower than for hardware (UART style) serial ports.
The demonstration can be stopped with the SCM command: “API 13 0”
Version 2 includes a patch to work around a bug in SCM v1.3 for Z80 systems
Version 1 only runs on versions of SCM that are free of the bug!
Recommended for Z80 processors |
Requirements: Small Computer Monitor (SCM) v1.0 or later Z80 processor |
SCM_IdleTimerDemo_v2.0_Z80_code8000.hex (code starts at 8000) |
Version 2.0 (2022-10-01) |
Recommended for Z180 processors |
Requirements: Small Computer Monitor (SCM) v1.0 or later Z180 processor |
SCM_IdleTimerDemo_v2.0_Z180_code8000.hex (code starts at 8000) |
Version 2.0 (2022-10-01) |
Source code |
SCM_IdleTimerDemo_v2.0.asm |
Version 2.0 (2022-10-01) |
Below is an example of the terminal output when loading and running the App.
Small Computer Monitor - RC2014 * <<< send hex file here >>> *Ready * *g8000 SCM App: Idle Timer Demo v2.0.0 *++++d+ev+ice+s+ Supported devices: = Z80 SIO (rc) @ 80 detected = Z80 SIO @ 80 = Z80 SIO (rc) @ 84 = Z80 SIO @ 84 = Z80 CTC @ 88 detected = Z80 CTC @ 8C = ACIA @ 80 = ACIA @ 40 = Bit-bang serial @ 28 detected = CF Card @ 10 = Diagnostic LEDs @ 00 = Status LED @ 08 detected Console devices: 1 = Z80 SIO (rc) @ 80 2 = Z80 SIO (rc) @ 80 3 = Bit-bang serial @ 28 *++++a+pi+ +13+ 0+ 0C 0000 *