🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.amiga.tech
1 messages
1 total messages Started by fillmore Fri, 28 Dec 1990 05:13
Re: Setting the serial port baudrate from Basic
#7803
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads