|This article relates only to the Model I versions of either of these wonderful music programs. I have no information on the Model 3/4 versions, although the patches should be just as easy.|
|If you have a large number of ORCH or PIANO music files, you might like a way to more completely automate the playing of them. The (G)et command only plays a few pieces before you have to attend to it again. I wanted to be able to call for any number of songs, preferably with their titles stored in an text file on disk.|
|Since most TRS-80 DOSs now have some kind of "DO" capability, which will feed simulated keystrokes from a text file into an application program, it seemed most straightforward to make use of this. Unfortunately, the ORCH and PIANO programs do not take their keyboard input via the standard system device drivers. Instead, they call their own keyboard driver, and they won't listen to a DO file input. To correct this the music programs must be made to call the DOS keyboard driver instead of their own. This technique works cleanly insofar as it has to, for reading and playing music files, but does not allow editing or composing etc. So don't try to use the modified ORCH or PIANO programs for this. Use them only for playing music files under the control of the DOS.|
|The keyboard driver call is easily altered, as described below, by changing only two bytes in either of the programs (at 5EE1 for ORCH-85 or at 6268 for PIANO-85). This change alone will let you use text file inputs as commands. Thus you could have a DO file such as this (where ORCH4GET/CMD is the modified ORCH-85/CMD program):|
G FUGUE GIGUE LONE PERGO TARREG etc..
G MERRILY NOEL ANGELS HYMN1 etc...
G ROMEO etc...
|and it would play all of the indicated songs. I was pretty happy with this, but also wanted to be able to call for some silences between the selections, to keep disk drive noises from interfering with the music. The best solution would have been to locate the code that reads and plays a file under the (G)et command, and patch in time delays there. I was unable to do this, so I considered just calling for some dummy or redundant (S)core operations for each song in my command file. This works fine but leads to very long command files, since you can only put one command on a line.|
|To tighten these up, I needed to make the ORCH or PIANO program recognize a substitute character for the Carriage Return (byte 0D). I enlarged upon the keyboard patch I already had, adding a filter action that would watch for ";" (byte 3B) and change it to 0D. This requires nine additional bytes of code, and the safest place I could put them is over the initial logo text. The remaining text can be modified to convey the same information still, if you like. With this filter patch in place, a command file such as this can be used:|
|In this example, after each piece is (R)ead it is (S)cored twice to provide for a delay while the disk drives stop, and after it has (P)layed it is again (S)cored a couple of times to provide another delay before the disk drives restart.|
|The patches for both programs are given below. You will need the address of the keyboard driver for your DOS. To find it, boot the DOS normally and examine locations 4016H and 4017H. You can do this using DEBUG or by just PEEKing them from Disk Basic. The bytes are in the normal low-high sequence; eg. for DOSPLUS the driver is at 4DC0, and 4016H holds C0 and 4017H holds 4D. In the patches below, LL refers to the byte found in 4016H, and HH refers to that found in 4017H.|
|To actually make any of these changes, you should either use the "Patch" utility supplied with your DOS, or use a high-memory machine language monitor, or the DOS 'LOAD' and 'DUMP' commands, in conjunction with DEBUG. The details of doing this vary greatly with each utility, and are beyond the scope of this discussion. Also note that for DOSPLUS, at least, the DO file operations proceed from high memory, which does not appear to be affected by the ORCH or PIANO music programs. This may not be the case with DO or JCL operations under other DOSs.|
|These are the modifications for ORCH-85 (after configuring and saving as four or five voice, fast or slow speed). The program loads from 5900 to 6CAF, with entry at 6B27.|
|To make it take its command inputs from a DO file, modify the keyboard driver call at 5EE1: change CD 1D 62 to CD LL HH.|
|To additionally make ORCH-85 take ";" for a carriage return, a patch is put in the logo text at 5D70: change " BOKELMAN" to CD LL HH FE 3B C0 3E 0D C9. Then at 5EE1 change the call to: CD 70 5D. Finally, change the number of bytes written for the logo (reduce by nine) at the two block moves that may be used: after 6300 and after 6C91, change the 01 2C to 01 23.|
|These are the modifications for PIANO-85 (after configuring and saving as fast or slow speed). The program loads from 5A00 to 6FA7, with entry at 6E86.|
|To make it take its command inputs from a DO file, modify the keyboard driver call at 6268: change CD A2 65 to CD LL HH.|
|To additionally make PIANO-85 take ";" for a carriage return, a patch is put in the logo text at 60F7: change " BOKELMAN" to CD LL HH FE 3B C0 3E 0D C9. Then at 6268 change the call to: CD F7 60. Finally, change the number of bytes written for the logo (reduce by nine) at the block move: after 668B change the 01 28 to 01 1F.|
|The above changes have been made to create: ORCH4GET/CMD, ORCH5GET/CMD, AND PIANOGET/CMD. All assume a 3.54 MHz clock, and ORCH5GET/CMD is configured for five voices. The others are for four voices.|