🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #7803

Re: Setting the serial port baudrate from Basic

#7803
From: fillmore
Date: Fri, 28 Dec 1990 05:13
33 lines
1498 bytes
Somebody asked a while ago how to set the serial port baud rate to MIDI speed
from an AmigaBasic program.  Here is a code fragment from a program I wrote
when I first got my Amiga:

   OPEN "com1:9600,n,8,1" as 1
   adr1 = &HDFF
   adr2 = &H32
   adr = adr2 + adr1*4096
   POKEW adr,(1000000!/(.2794*31250))

This opens the serial port as usual, but then pokes the hardware to switch to
MIDI speed.

Input can be read as follows:

   WHILE LOC(1)<>0
     b$ = INPUT$(1,1)
     { process byte b$ }
   WEND

Output can be sent by:

   PRINT #1,b$;

Keep in mind that the speed will not be very accurate from Basic because
of the slow interpreter speed, garbage collection, etc.
It works well enough to write a MIDI patch librarian, MIDI hex dump, etc.

________________________
Bob Fillmore, Systems Software & Communications     BITNET:  FILLMORE@EMRCAN
  Computer Services Centre,                         BIX:     bfillmore
  Energy, Mines, & Resources Canada                 Voice:   (613) 992-2832
  588 Booth St., Ottawa, Ontario, Canada  K1A 0E4   FAX:     (613) 996-2953
Technical Details
Message-ID: <5A0C1B1738190175-MTAEMR1*fillmore@emrcan>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!olivea!apple!agate!ucbvax!emrcan.BITNET!fillmore

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!olivea!apple!agate!ucbvax!emrcan.BITNET!fillmore
From: fillmore@emrcan.BITNET
Newsgroups: comp.sys.amiga.tech
Subject: Re: Setting the serial port baudrate from Basic
Message-ID: <5A0C1B1738190175-MTAEMR1*fillmore@emrcan>
Date: 28 Dec 90 05:13:58 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 33