SER2_pmc is a 92-byte machine-code extension that lets Psion ARCHIVE 2.38 (ARCdev/ARCrtm) and Psion XCHANGE send a string out of the SER2 port at a chosen baud rate, for example to make a Hayes-compatible modem dial a phone number. It does not work with ARCHIVE 2.3 or 2.35. The BASIC loader POKEs the bytes from DATA, checks their total against 6567 and saves SER2_pmc with SBYTES (FLP1_ by default).
In ARCHIVE, load it with LOAD USR ‘SER2′, put the modem command in a variable (LET number$=’ATDT1234567’+CHR(13)) and call LET x=USR(3,’number$’), where 3 is the speed (0=75, 1=300 up to 7=19200 baud); x returns a QDOS error code. The commented 68000 source is included in the listing. Written by Real Gagnon and HIC LOGIQUE, Montreal, December 1990, and donated to the public domain.
Published in Sinc-Link March-April 1991 (The Quebec Link).
Source Code
100 REMark LOADER for SER2_pmc
110 REMark by Real Gagnon, Montreal Quebec dec90
120 :
130 CLS:INPUT "SAVE SER2_pmc WHERE? (default flp1_)?";sauve$
140 IF LEN(sauve$)=0:sauve$="flp1_"
150 PRINT "One moment please.";
160 :
170 RESTORE 1000
180 memoire=RESPR(512):base_memoire=memoire
190 compte=0 : checksum=6567 : checkme=0
200 :
210 REPeat loop
220 IF EOF:EXIT loop
230 READ byte:POKE memoire,byte:memoire=memoire+1
240 compte=compte+1
245 checkme=checkme+byte
250 PRINT ".";
260 END REPeat loop
265 :
270 IF checkme<>checksum:PRINT "Checksum incorrect":STOP
280 :
290 SBYTES sauve$&'SER2_pmc',base_memoire,compte
300 PRINT 'Ok!':STOP
310 :
1000 DATA 112, 109, 99, 48, 0, 86, 38, 72, 65, 250
1001 DATA 0, 66, 50, 24, 81, 200, 255, 252, 112, 18
1002 DATA 78, 65, 114, 255, 38, 60, 0, 0, 0, 0
1003 DATA 65, 250, 0, 36, 112, 1, 78, 66, 74, 64
1004 DATA 102, 0, 0, 24, 20, 27, 72, 130, 118, 255
1005 DATA 34, 75, 112, 7, 78, 67, 74, 64, 102, 0
1006 DATA 0, 6, 112, 2, 78, 66, 78, 117, 0, 6
1007 DATA 83, 69, 82, 50, 105, 114, 0, 75, 1, 44
1008 DATA 2, 88, 4, 176, 9, 96, 18, 192, 37, 128
1009 DATA 75, 0
*********************************************************
* filename : SER2_pmc version 1.0 *
* date : december 1990 *
* *
* Machine code extension for ARCHIVE 2.38 and XCHANGE *
* to add the possibility to talk directly to the *
* SER2 port. *
* *
* LOAD with the command LOAD USR 'ser2' *
* USE with the command *
* LET result=USR(speed,'string$') *
* where speed is the baud rate to be used *
* 0=75 1=300 2=600 3=1200 4=2400 *
* 5=4800 6=9600 7=19200 *
* where strings$ is the variable name *
* containing the string to be sent. *
* note that you have to put quotes around *
* it. *
* *
* the routine returns an error code in the *
* variable result if any. 0 = no error *
* other = error *
* *
* This program is donated to the public domain *
* *
* written by Real Gagnon and HIC LOGIQUE *
* [address omitted] P.O. Box 1393 *
* Place du Parc *
* Montreal Quebec *
* CANADA H2W 2R4 *
*********************************************************
MT_BAUD equ $12 set the baud rate
IO_OPEN equ $1 open a channel
IO_CLOSE equ $2 close a channel
IO_SSTRG equ $7 send a string to a channel
THIS_JOB equ -1
header dc.b 'pmc0'
dc.w finish-start
*-------------------------------------
* A0 contains the pointer of the string to be sent.
* D0 contains the baud rate to be used
*-------------------------------------
*-------------------------------------
* set the baud rate
*-------------------------------------
start move.l a0,a3 preserve the string address
lea baud_choice,a0 find the correct baud rate
baud_loop move.w (a0)+,d1
dbra d0,baud_loop
moveq #MT_BAUD,d0
trap #1
*-------------------------------------
* open a channel for SER2
*-------------------------------------
moveq #THIS_JOB,d1
move.l #0,d3 we open a channel for a device
lea device_name,a0
moveq #IO_OPEN,d0
trap #2 open the channel
tst d0 error?
bne error_detected
*-------------------------------------
* A0 contains the CHANNEL ID (needed for IO_SSTRG)
* now we have to send the string pointed by A4
*-------------------------------------
move.b (a3)+,d2 length of the string
ext.w d2
moveq #-1,d3 no timeout
move.l a3,a1 string address
moveq #IO_SSTRG,d0
trap #3
tst d0
bne error_detected
*-------------------------------------
* now, we close the channel (A0 still contains CHANNEL ID
)
*-------------------------------------
exit_send moveq #IO_CLOSE,d0
trap #2
error_detected rts go back to ARCHIVE/XCHANGE
device_name dc.w 6 length of the device name
dc.b 'SER2ir' no handshake and no parity
baud_choice dc.w 75,300,600,1200,2400,4800,9600,19200
finish endNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.