Jump to content

dMetronome - tick tick tick tick tick………..

Posted by k-Pack, 10 May 2018 · 280 views

Diamond GOS metronome
dMetronome - tick tick tick tick tick………..

Every computer needs a metronome program but only a few Atari8 owners have the Diamond GOS to run this one and even fewer would want to build the simple hardware to hear it. That shouldn't stop you from enjoying the video.

It may have been easier to write this one in BASIC but I wanted to get back into Assembly and thought a metronome based on the software timer example in De Re Atari would be a good place to start.  The original idea involved pulsing the Cassette Motor Control(CMC) pin on the SIO, then  it evolved into a metronome with a bunch of options, and then it digressed back into controlling the timing of the CMC.  
The first problem was getting the tick to make a reliable POKEY sound.   Most of the programming changes seemed to make the problem worse until it stopped entirely.   A LED and 330ohm resister was used on the CMC pin to monitor its blinking.  It did blink.    Gone was the POKEY sound.
Attached Image
The second circuit was thrown together with a speaker salvaged from a greeting card.  This clicked and blinked.  (and hasn't burned out yet)
Attached Image
Attached Image
A slider bar to adjust the BPM was going to be programmed but by the time the math started working,   Two arrow icons were used.  Click one icon to increase the DLI counter  (1 = 1/60 second). Click the other to decrease.  The DLI counter can be set between 15 and 155 - 60ths of a second(240 - 23 beats/min).  This kept the math programming to a minimum and the values were limited to 3 figures to simplifying printing them to the screen.
If you find the greeting card speaker to be inadequate, I programed an Arduino to check the output from the CMC and send out a MIDI - NOTEON,C2,127 for each pulse it detects.  This so happens to be the base drum.
Attached Image
Attached Image
/* This program accepts a digital input to activate
 *  output to a midi device.
 *  used to test dMetronome on the Atari 130EX.
 *  digital signial from Cassette Motor Control.
int inPin = 5;            //pulse input pin
int pulse;                //logic value of pin
int midiCommand = 153;    //noteon channel 10
int midiNote = 36;        //C2-base drum
int midiVol = 127;        //volumn max
int midiVolOff = 0;       //volumn off
void setup() {
pinMode(inPin, INPUT);
Serial.begin(31250);    //midi baud rate
void loop() {
  pulse = digitalRead(inPin);  
  if(pulse == HIGH){              //send midi data
The program is on the ATR and titled DMETRON.APP.  Boot up with Diamond and connect you device.  I have tested the program with Diamond 3.0 on a 130xe using DOS 2.5.  It should run on Diamond 2.0 because the diamond functions used are in both carts.
Attached File  dMetron_atr.zip (20.29KB)
downloads: 41
Those long assembly language listings in Analog always intimidated me. I tried splitting up the program into smaller files and #including them.  I thought that working with a group of small files would help and it did in some ways.  I could test many of the subroutines independent of the others and could find the locations of interest if I remembered which file was of interest.  It did slow down development near the end when the locating the numbers on the screen required tweaking.  There were two function calls in two files to set up the display.  It ended up being somewhat tedious. 
MAC/65 source code for central program.  The rest is in the zip file.  DMACROSM.M65 are the diamond function macros with Paraprint modification as described in a previous blog entry.
0100 ;dMetronome 5/2018
0110 ;
0120 ;A Diamond GOS METRONOME program
0130 ;to output a pulse to the SI/O
0140 ;cassette motor control to
0150 ;activate external hardware
0160 ;
0170     *=  $2000
0180 ;
0190     .OPT NO LIST
0200     .OPT OBJ
0210 ;
0220 ; LIBRARY
0230     .INCLUDE #D1:SYSEQU.M65
0240     .INCLUDE #D1:LIBRARY.M65
0250     .INCLUDE #D1:DMACROSM.M65
0260 ;
0280     .INCLUDE #D2:INFODIA.M65
0290     .INCLUDE #D2:DROPMENU.M65
0300     .INCLUDE #D2:DLITIMER.M65
0310     .INCLUDE #D2:INITICON.M65
0320     .INCLUDE #D2:PRNTIME.M65
0330     .INCLUDE #D2:PRNBPM.M65
0340 ;
0350 PU  .BYTE " 030 - 60TH SEC. ",255
0360 BPMU .BYTE "BPM",255
0400     .BYTE $30,$31,$32,$33,$34
0410     .BYTE $35,$36,$37,$38,$39
0420 ;
0430 START
0440      INIT  0
0465      SYSDRAW  PU,11,138,0
0470     JSR INIDLI
0480     JSR INFODIA
0485      SYSDRAW  BPMU,25,72,0
0487     JSR PRNTIME
0489     JSR PRNBPM
0490     .INCLUDE #D2:EVENT.M65
0500 ;
0510     *=  $02E0
0520     .WORD START

May 2019

192021222324 25

My Picture

Latest Visitors