Metronome - Software Timer Demo in DE RE Atari
metronome software timer
I was thinking about making an 8-step sequencer for a Gakken SX-150 Mark II analog synthesizer using the Atari8. Then I thought, "Why not just use the Pokey chip instead of the Gakken? " Then I thought, "Why not develop it using Diamond GOS? I'll bet no one has done that yet."
While reading up on the hardware and software timers, the metronome program in De Re Atari looked like it could be easily modified with a Diamond upgrade to change the tempo using a slide bar.
It was a good idea but it would not run as listed and decided to get it running without Diamond.
In the book De Re Atari the hardware timers are explained on page 8-39 and the software timers on 8-40. As an example of using a software timer, a metronome was programed in two parts. Figure 8-19 lists the Assembly language that runs during the vertical blank. With this routine running in the background the BASIC program(figure 8-18) can be used to adjust the beats/min using a joystick.
As fate would have it, the routine would not run on the 130XE as listed. The following changes were made to the Assembly code using MAC65.
1- the sound registers were reset.
2- relocated the time set byte (ZTIME) from $00 to the byte after the ML program($403D)
3- the program was compiled at $4000.
Changes to the BASIC code:
1. GRAPHIC 0 added to line 5
2. Modified line 56 PRINT
3. Line 60 POKEs X into ZTIME at location 16445
4. Line 70 changed to GOTO 20. Not sure where NEXT came from.
If you want to look at the code or need a metronome, the files are in the zipped ATR.
1. Boot with disk in Drive #1. The metronome should start after AUTORUN.SYS executes.
2. RUN "D:METRONOM.BAS" at BASIC's READY prompt.
3. Move Joystick 1 forward and back to adjust the beats/min.
DOS/DUP - Atari 2.5
AUTORUN.SYS - copy of DERE0844.OBJ
DERE0844.M65 - ML Source code
DERE0844.OBJ - Compiled code at $4000
METRONOM.BAS - Adjusts beats/min of object code.
I learned a lot about the software timers while trouble shooting this program. I'm feeling pretty confident that a Diamond GOS facade can be built.
- carlsson likes this