RSS Bot Posted May 10, 2018 Share Posted May 10, 2018 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.The second circuit was thrown together with a speaker salvaged from a greeting card. This clicked and blinked. (and hasn't burned out yet)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./* 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 pinint pulse; //logic value of pinint midiCommand = 153; //noteon channel 10int midiNote = 36; //C2-base drumint midiVol = 127; //volumn maxint midiVolOff = 0; //volumn offvoid setup() {pinMode(inPin, INPUT);Serial.begin(31250); //midi baud rate}void loop() { pulse = digitalRead(inPin); if(pulse == HIGH){ //send midi data Serial.write(midiCommand); Serial.write(midiNote); Serial.write(midiVol); delay(5); Serial.write(midiCommand); Serial.write(midiNote); Serial.write(midiVolOff); }}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.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/20180110 ;0120 ;A Diamond GOS METRONOME program0130 ;to output a pulse to the SI/O0140 ;cassette motor control to0150 ;activate external hardware0160 ;0170 *= $20000180 ;0190 .OPT NO LIST0200 .OPT OBJ0210 ;0220 ; LIBRARY0230 .INCLUDE #D1:SYSEQU.M650240 .INCLUDE #D1:LIBRARY.M650250 .INCLUDE #D1:DMACROSM.M650260 ;0270 ;JRS SUBROUTINES0280 .INCLUDE #D2:INFODIA.M650290 .INCLUDE #D2:DROPMENU.M650300 .INCLUDE #D2:DLITIMER.M650310 .INCLUDE #D2:INITICON.M650320 .INCLUDE #D2:PRNTIME.M650330 .INCLUDE #D2:PRNBPM.M650340 ;0350 PU .BYTE " 030 - 60TH SEC. ",2550360 BPMU .BYTE "BPM",2550390 NUMCHR0400 .BYTE $30,$31,$32,$33,$340410 .BYTE $35,$36,$37,$38,$390420 ;0430 START0440 INIT 00450 JSR DROPMENU0460 JSR PLACEICONS0465 SYSDRAW PU,11,138,00470 JSR INIDLI0480 JSR INFODIA0485 SYSDRAW BPMU,25,72,00487 JSR PRNTIME0489 JSR PRNBPM0490 .INCLUDE #D2:EVENT.M650500 ;0510 *= $02E00520 .WORD START Attached thumbnail(s) Attached File(s) dMetron_atr.zip (20.29KB)Number of downloads: 0 http://atariage.com/forums/blog/556/entry-14705-dmetronome-tick-tick-tick-tick-tick/ Link to comment Share on other sites More sharing options...
Recommended Posts