[comp.sys.atari.8bit] Homemade MIDI Interface -- Part 2 of 2

terpin@acsu.buffalo.edu (christophe d terpin) (03/28/91)

Below are the uuencoded, compressed files:

MIDI.BAS  - (Atari Basic listing)  A simple MIDI recorder for use
            with the interface described in Part 1 of this article
MIDI.ASM  - Assembler source listing of machine language routines
	    used in MIDI.BAS 

The assembler source code is an improved version of the source
code I posted several weeks ago. 


Christopher Terpin
terpin@autarch.acsu.buffalo.edu

--------------------------(cut here)-------------------------
begin 600 midi.arc
M&@A-241)+D%330!>7EY>01@  'H6B "F,P O   ,,6"  .&"2A(J3(J $!&$
M3A@Y:4 T24,F8A(W=,K(,1-F3!D1FV0() @ER!&%(H: H*(13AHW(&+DR!$#
MY R!.T",D5,F3$8R.D# L/$"1XZ!/.VDF5,&*(P9+VANHH%S4PV<$BE&/&%%
MQPD02,*X(<-&XR8;56]@!3$$#<0Y=-[ 0:-Q9<N7FW"LC4&#!H@B9\YHI -"
MRILP9#;E6"NDCAF.;-ZP .'$1187,6G(B%%C$XR :S/*<>D&2)@Z#N6,0>.B
MXYPZ+L0XAOS&1=,ZGF,$!)'SC1P0HDD#J2/;31H\K<>\CCT[3&3;9'!_%LD[
M]TW>*Y$DF0)BRI,J4H8H'/*$B,+M()(XR5XD-U7L4*H(89)$)9$G38*H=Y'[
M*ORR83 %@AEEE,'&@#R5 =P;(+3Q1D5FY &"6(E]AA9V:;0!AQQOV*$@'6@L
MI=.#96 & A0 ,I6;6MB515@;"J[AQAMW3"C&&ZA-Z(:$;82AAF^YZ86AAAQZ
M""-&<X#@&PBRG9%D'CCFMAAV:(3A(0@5S3%&AQHUA5D1;OR81PB>B505#)N=
M*0-U.Y1Y74YEX%'&&*BE\09,9G#8!@@-/92&$$%,49\.9;ZW0PR80?'$$@H%
M9 ,+G-&@PQ%2N "##O=-4:9_.\B 662(@4"$#DTD0402+CPAA!*;UL#;#)C)
M40=,@ JJTA@/T0$1&8*5>>$.-&"61 ]53"$%"C/09 ,.+(S1!ADL; %7KI.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5AY
M6/B.VCAR9E. \9B)TO@1J3>+GVAU:IAS*-B*U.@@="A#ZB-\ :EXW,A0]M> 
M&RAU552+SUB2MO* 9I-VC\5Y'BF,%JE_-,-S':*!5721UUA%SDAR/"F1UM>0
M8/B0'EF&STB%66>3"3B*K\AV/^B1Z/B,3'>27%B4(ZA_'EF/-[&)H8=V9A..
M--AS5>21 'D38QE].]F$LW=Z\KB6-Z@JE&AU-'"*O,AX1#E[47>7'EF1 B*#
M;<AS)TF28 B,(15*K8>0I%> 27>2>OAN"]F58/A_\+)__8>!<B=P('D3-_""
MT:=TL-ATJ'@N7_23,="96G=\-H"'C,>&;$D#2?A%2'D3-A"3BND@-IF&Z7*!
MY1<0H!*9L#F"/8<:8-B#E7F C\F5NW@NC^B PJES-IB$R?<KYNB;9XEV-AD0
MK1F(EF<K-ODKCSF71\=0S1F<R_E^?(=V=O=%?KF,+AB4:MF49%F-:828VY>6
M[N>*=N>6),E0#ZB'-J"2Q..9_U>73FF#N(*"K9E&-"F9>NF48,E[&;<;IMF4
M;,AX,WAS3\>8:32;2KB3Y4B0IW>'8[@;4TF;M]*2M,>3KLF8;[@;RDF.N-("
(.\$$D$ #&@"8
 
end

rlcollins@miavx1.acs.muohio.edu (Ryan 'Gozar' Collins) (03/29/91)

After seeing the diagram for the MIDI interface I was wondering. How hard 
would it be to hook it up to an ST through the MIDI ports, and be abel to 
transfer data back and for? (Or even to use the ST as a pseudo disk drive 
for the Atari. I'd be willing to write the software for the ST, hopefully 
writing it as a DA so you can be using both your ST and your 8-bit at the 
same time.)

Any thoughts or ideas?

------------------------------------------------------------------------------
Ryan 'Gozar' Collins 	  Question for IBM Users:      rlcollins@miavx1.BITNET
   ||||   Power Without     How DO you move/copy a      rc1dsanu@miamiu.BITNET
  / || \  The Price!!	      Subdirectory?               R.COLLINS1 on GEnie
------------------------------------------------------------------------------

terpin@acsu.buffalo.edu (christophe d terpin) (04/03/91)

In article <4484.27f222d7@miavx1.acs.muohio.edu> rlcollins@miavx1.acs.muohio.edu (Ryan 'Gozar' Collins) writes:
>After seeing the diagram for the MIDI interface I was wondering. How hard 
>would it be to hook it up to an ST through the MIDI ports, and be abel to 
>transfer data back and for? (Or even to use the ST as a pseudo disk drive 
>for the Atari. I'd be willing to write the software for the ST, hopefully 
>writing it as a DA so you can be using both your ST and your 8-bit at the 
>same time.)
>
>Any thoughts or ideas?
>
>------------------------------------------------------------------------------
>Ryan 'Gozar' Collins 	  Question for IBM Users:      rlcollins@miavx1.BITNET
>   ||||   Power Without     How DO you move/copy a      rc1dsanu@miamiu.BITNET
>  / || \  The Price!!	      Subdirectory?               R.COLLINS1 on GEnie
>------------------------------------------------------------------------------
It would probably be fairly easy. In fact, I originally used my interface as 
an RS232 link to my IBM-PC to transfer data at 19200 baud.  The 8bit 
software for this Null modem was virtually identical to the MIDI source code.
The only differences were that it didn't insert the VBI timing marks during
input ("recording") and the values for AUDF3 and AUDF4 were different.
 (I've seen a formula that relates AUDF3,AUDF4 to baud rate-- I believe it's in
the Operating System listing.)

The V: handler I wrote for the MIDI interface will work fine for SENDING
data TO the ST:  i.e. here's a basic 8bit program to transfer a file from your
8bit to your ST through the interface:

         5 REM make sure D:MIDI.OBJ has been loaded 
	10 DIM FILE$(20)
	20 PRINT "Enter filename to send";:INPUT FILE$
	30 CLOSE #1: OPEN #1,4,0,FILE$
	40 I=USR(39158,ASC("I")) : REM initialize handler
	50 CLOSE #2: OPEN #2,8,0,"V:"
	60 TRAP 80
	70 GET #1,A:PUT #2,A:GOTO 70
	80 CLOSE #1:CLOSE #2

The ST program would dump its MIDI data to some buffer.  Unfortunately,
I don't own an ST (which is what motivated me to build a MIDI in the first 
place :) ), so I have no idea how to access the MIDI port through the ST.

	The V: handler as I have written it, however, doesn't work very
well for input nor does it use the normal SIO protocol.  The source code
would have to be modified by disabling the VBI timer routine in the 
RECORD section of the source.  Using the new object code, the 8bit receive 
program goes something like this:

	5  REM make sure modified MIDI.OBJ is loaded in.
	10 DIM DATA$(20000) :REM buffer for received data
	20 DIM FILE$(20)
	30 DATA$(1)=CHR$(0):DATA$(20000)=CHR$(0):DATA$(2)=DATA$
	40 I=USR(39158, ASC("I"): REM init V: handler
	50 CLOSE #1:OPEN #1,4,0,"K:"
	60 PRINT "Hit any key to start receiving":GET #1,K
	65 REM ST starts transmission here.
	70 I=USR(39158, ASC("R"), ADR(DATA$)): POKE 204,1
	80 PRINT "Hit any key to stop receiving": GET #1,K:POKE 204,0
	90 PRINT "Filename to save data to?":INPUT FILE$
	100 CLOSE #2:OPEN #2,8,0,FILE$
	110 ?#2;DATA$;
	120 CLOSE #2
 
	To load in the object code you can use one of 2 methods:

	1)  POKE 106,153:GR.0:DOS & load binary file MIDI.OBJ
	2)  POKE 106,153:GR.0:XIO 41,#1,0,0,"D:MIDI.OBJ"

	The POKE is necessary to move the HIMEM page value down so that 
	the screen data and the program don't overlap.

	Hope this helps.
	
	Chris Terpin
	terpin@ubunix.acsu.buffalo.edu

wallmann@ipsi.UUCP (Georg Wallmann) (04/08/91)

In article <68434@eerie.acsu.Buffalo.EDU> terpin@acsu.buffalo.edu (christophe d terpin) writes:
>In article <4484.27f222d7@miavx1.acs.muohio.edu> rlcollins@miavx1.acs.muohio.edu (Ryan 'Gozar' Collins) writes:
>>After seeing the diagram for the MIDI interface I was wondering. How hard 
>>would it be to hook it up to an ST through the MIDI ports, and be abel to 
>>transfer data back and for? (Or even to use the ST as a pseudo disk drive 
>>for the Atari. I'd be willing to write the software for the ST, hopefully 
>>writing it as a DA so you can be using both your ST and your 8-bit at the 
>>same time.)
>>
>>Any thoughts or ideas?
>>

>It would probably be fairly easy. In fact, I originally used my interface as 
>an RS232 link to my IBM-PC to transfer data at 19200 baud.  The 8bit 
>software for this Null modem was virtually identical to the MIDI source code.
>The only differences were that it didn't insert the VBI timing marks during
>input ("recording") and the values for AUDF3 and AUDF4 were different.
> (I've seen a formula that relates AUDF3,AUDF4 to baud rate-- I believe it's in
>the Operating System listing.)
>
But to get any kind of speed better use the parallel port on the
ST and the (sadly overused) joystick ports and the serial port on the 8-bit. 
I have something like this working and the hardware is simplicity itself just a 
schmitt-trigger IC and two resistors (apart from the cables). Unfortunately
on the software side the ST is single-tasking, which takes some of the fun
away and my stab at making the ST multitask apparently fails with TOS 1.4,
although I haven't investigated that yet. If I get my head out of this
ocean of work to get some oxygen and maybe enough time to rewrite the server
for Micro RTX or MiNT I will release this stuff.

The server is unstable at the moment, meaning that you shouldn't try to
run programs while using the server on the ST.

Just to brag a little, this can be done:

N: device handler 98% SpartaDOS eq.
   with SpartaDOS 2.X, you can do stuff like
D1: N:    # typed from memory, syntax maybe not 100% correct
N: DIR
N: CWD N:E:/FOOBLE>BAR\TMP
N: COPY TMP/BIGFILE.DAT D8:
N: COPY D8:BIGFILE.DAT N:TMP
N: CREDIR LILO

Transferring DEGELITE.PRG (approx 150K) takes not much more than 15 sec
from RAMdisk to RAMdisk.


If you don't mind occasional crashes, I could send interested parties
the prototype server and device driver software (binaries only, sorry). 
Beats any Null modem transfer anytime, anyway!

Email to : XBR1DE7B@DDATH21.BITNET

Ah, yes and asking this for maybe the tenth time... "How does one write
a device driver for the X cartridge ?"


The interface BTW looks like this:

------- port a
                ------<<<>>>---------------- parallel port ST ----
------- port b

------- IRQ Pin 13 SIO  ---------<<<------- Strobe Centronics ----

------- Motor Pin 7or8 SIO -->>>-- 1K --+-[IC]-- Busy Centronics -
                                        |
                                       1K
                                        |
                                     Ground

As you may be able to tell, this makes using the tape recorder impossible.
TOO BAD! (har har)

Nat!
"If there's a new way, I'll be the first in line/But it better work this time"
[Mustaine]

Ordania-DM@cup.portal.com (Charles K Hughes) (04/09/91)

George Wallman writes:
>Ah, yes and asking this for maybe the tenth time... "How does one write
>a device driver for the X cartridge ?"

  One doesn't.  :)  There is no documentation AT ALL for programming the
SDX cart available to anyone other than what is given in the SDX manual.
I've argued with ICD about this and they maintain that there is no info
available.  We all know that this is a crock of shit, but they are quite
adamant about it.

>
>

Charles_K_Hughes@cup.portal.com