Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

v97i019: TRANS - PC->Amiga file transfer, Part 01/01

20 views
Skip to first unread message

Tony Friery

unread,
Nov 28, 1997, 3:00:00 AM11/28/97
to

Submitted-by: to...@DONT.SPAM.ME.basoft.enta.net (Tony Friery)
Posting-number: Volume 97, Issue 19
Archive-name: networking/TRANS/part01

#!/bin/sh
# This is networking/TRANS, a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 11/26/1997 18:07 UTC by z...@ibx.com
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 548 -rw------- binconv.bas
# 1810 -rw------- binconv.htm
# 1884 -rw------- binconv.txt
# 632 -rw------- convbin.bas
# 2021 -rw------- convbin.htm
# 2079 -rw------- convbin.txt
# 325 -rw------- rlist.bas
# 1717 -rw------- rlist.htm
# 1796 -rw------- rlist.txt
# 2408 -rw------- rx.bas
# 3212 -rw------- rx.htm
# 3323 -rw------- rx.txt
# 3034 -rw------- sx.bas
# 3812 -rw------- sx.htm
# 3922 -rw------- sx.txt
# 7474 -rw------- trans.htm
# 4178 -rw------- trans.txt
#
if test -r _shar_seq_.tmp; then
echo 'Must unpack archives in sequence!'
echo Please unpack part `cat _shar_seq_.tmp` next
exit 1
fi
# ============= binconv.bas ==============
if test -f 'binconv.bas' -a X"$1" != X"-c"; then
echo 'x - skipping binconv.bas (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting binconv.bas (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'binconv.bas' &&
CLS
PRINT "Source file: ";
LINE INPUT sf$
PRINT "Destination file: ";
LINE INPUT df$
OPEN sf$ FOR BINARY AS #1
OPEN df$ FOR BINARY AS #2
x = 0
PRINT
PRINT " 1111111111222222222233333333334444444444555555"
PRINT "1234567890123456789012345678901234567890123456789012345"
WHILE NOT EOF(1)
t$ = INPUT$(40, 1)
m$ = ""
FOR z = 1 TO LEN(t$)
m$ = m$ + RIGHT$("00" + HEX$(ASC(MID$(t$, z, 1))), 2)
NEXT z
m$ = m$ + CHR$(13)
PUT #2, LOF(2) + 1, m$
x = x + 40
IF x / 1000 = INT(x / 1000) THEN PRINT ".";
WEND
CLOSE 2
CLOSE 1
PRINT x; " bytes written"
X
SHAR_EOF
chmod 0600 binconv.bas ||
echo 'restore of binconv.bas failed'
Wc_c="`wc -c < 'binconv.bas'`"
test 548 -eq "$Wc_c" ||
echo 'binconv.bas: original size 548, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= binconv.htm ==============
if test -f 'binconv.htm' -a X"$1" != X"-c"; then
echo 'x - skipping binconv.htm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting binconv.htm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'binconv.htm' &&
<TITLE>BINCONV.BAS - Prepare binary on PC for transmission</TITLE>
<H1 ALIGN=Center>BINCONV.BAS</H1>
<BR>
<HR>
<B>The following QBASIC program will convert a binary into a 'Hex-Dump' style text file in preparation for transmission to an Amiga using the SX.BAS program. Run the program, enter the source and destination filenames, and then sit back and wait.</B>
<BR>
<HR>
<BR>
<PRE>
CLS
PRINT "Source file: ";
LINE INPUT sf$
PRINT "Destination file: ";
LINE INPUT df$
OPEN sf$ FOR BINARY AS #1
OPEN df$ FOR BINARY AS #2
x = 0
PRINT
PRINT " 1111111111222222222233333333334444444444555555"
PRINT "1234567890123456789012345678901234567890123456789012345"
WHILE NOT EOF(1)
t$ = INPUT$(40, 1)
m$ = ""
FOR z = 1 TO LEN(t$)
m$ = m$ + RIGHT$("00" + HEX$(ASC(MID$(t$, z, 1))), 2)
NEXT z
m$ = m$ + CHR$(13)
PUT #2, LOF(2) + 1, m$
x = x + len(t$)
IF x / 1000 = INT(x / 1000) THEN PRINT ".";
WEND
CLOSE 2
CLOSE 1
PRINT x; " bytes written"
<BR></PRE>
<HR>
<BR>
<UL>
<LI>The source and destination files are opened in binary mode
<LI>40 characters are read from the source file
<LI>Using a FOR..NEXT loop, this is converted into a string of hex characters (using HEX$)
<LI>This string is then output to the dest file
<LI>The counter is incremented by the no. of chars read
<LI>Every 100 characters processed, a '.' is printed
<LI>The program loops around until the end of the source file [EOF(1)]
<LI>All files are closed, and the number of bytes processed displayed
</UL>
<BR>
<HR>
<BR>
<B>The information contained on this page is &copy; Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.</B><BR><BR>
<I>The author can be contacted by E-Mail at <A HREF="mailto:to...@basoft.enta.net">to...@basoft.enta.net</A></I>
SHAR_EOF
chmod 0600 binconv.htm ||
echo 'restore of binconv.htm failed'
Wc_c="`wc -c < 'binconv.htm'`"
test 1810 -eq "$Wc_c" ||
echo 'binconv.htm: original size 1810, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= binconv.txt ==============
if test -f 'binconv.txt' -a X"$1" != X"-c"; then
echo 'x - skipping binconv.txt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting binconv.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'binconv.txt' &&
BINCONV.BAS
X
X
--------------------------------------------------------------------------------
The following QBASIC program will convert a binary into a 'Hex-Dump' style text file in preparation for transmission to an Amiga using the SX.BAS program. Run the program, enter the source and destination filenames, and then sit back and wait.
X
--------------------------------------------------------------------------------
X
X
CLS
PRINT "Source file: ";
LINE INPUT sf$
PRINT "Destination file: ";
LINE INPUT df$
OPEN sf$ FOR BINARY AS #1
OPEN df$ FOR BINARY AS #2
x = 0
PRINT
PRINT " 1111111111222222222233333333334444444444555555"
PRINT "1234567890123456789012345678901234567890123456789012345"
WHILE NOT EOF(1)
t$ = INPUT$(40, 1)
m$ = ""
FOR z = 1 TO LEN(t$)
m$ = m$ + RIGHT$("00" + HEX$(ASC(MID$(t$, z, 1))), 2)
NEXT z
m$ = m$ + CHR$(13)
PUT #2, LOF(2) + 1, m$
x = x + len(t$)
IF x / 1000 = INT(x / 1000) THEN PRINT ".";
WEND
CLOSE 2
CLOSE 1
PRINT x; " bytes written"
X
X
--------------------------------------------------------------------------------
X
X
The source and destination files are opened in binary mode
40 characters are read from the source file
Using a FOR..NEXT loop, this is converted into a string of hex characters (using HEX$)
This string is then output to the dest file
The counter is incremented by the no. of chars read
Every 100 characters processed, a '.' is printed
The program loops around until the end of the source file [EOF(1)]
All files are closed, and the number of bytes processed displayed
X
X
--------------------------------------------------------------------------------
X
The information contained on this page is (c) Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.
X
The author can be contacted by E-Mail at to...@basoft.enta.net
SHAR_EOF
chmod 0600 binconv.txt ||
echo 'restore of binconv.txt failed'
Wc_c="`wc -c < 'binconv.txt'`"
test 1884 -eq "$Wc_c" ||
echo 'binconv.txt: original size 1884, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= convbin.bas ==============
if test -f 'convbin.bas' -a X"$1" != X"-c"; then
echo 'x - skipping convbin.bas (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting convbin.bas (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'convbin.bas' &&
CLS
PRINT "Source: ";: LINE INPUT sf$
PRINT "Dest: ";: LINE INPUT df$
OPEN sf$ FOR INPUT AS #1
OPEN df$ FOR OUTPUT AS #2
x=0
WHILE NOT EOF(1)
X LINE INPUT#1,t$
X REM PRINT LEN(t$)
X FOR y=1 TO LEN(t$) STEP 2
X hx$=MID$(t$,y,2)
X GOSUB 100
X PRINT #2,CHR$(hx);
X NEXT y
X x=x+(LEN(t$)/2)
X IF (x/100)=INT(x/100) THEN PRINT ".";
X
X IF (x/1000)=INT(x/1000) THEN PRINT " (";x; "Bytes Processed )"
X
WEND
CLOSE 2
CLOSE 1
PRINT: PRINT x;" bytes written in total"
END
X
100 REM
u$=LEFT$(hx$,1)
GOSUB 200
hv=rv
u$=RIGHT$(hx$,1)
GOSUB 200
hx=rv+(16*hv)
RETURN
X
200 REM
IF ASC(u$)<65 THEN
X rv=VAL(u$)
ELSE
X rv=ASC(u$)-55
END IF
RETURN
SHAR_EOF
chmod 0600 convbin.bas ||
echo 'restore of convbin.bas failed'
Wc_c="`wc -c < 'convbin.bas'`"
test 632 -eq "$Wc_c" ||
echo 'convbin.bas: original size 632, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= convbin.htm ==============
if test -f 'convbin.htm' -a X"$1" != X"-c"; then
echo 'x - skipping convbin.htm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting convbin.htm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'convbin.htm' &&
<TITLE>CONVBIN.BAS - Convert received HEX dump back to a binary</TITLE>
<H1 ALIGN=Center>CONVBIN.BAS</H1>
<BR>
<HR>
<B>The following AmigaBASIC program will convert a 'Hex-Dump' style text file back to a binary file after reception from a PC using the RX.BAS program. Run the program, enter the source and destination filenames, and then sit back and wait.</B>
<BR>
<HR>
<BR>
<PRE>
CLS
PRINT "Source: ";: LINE INPUT sf$
PRINT "Dest: ";: LINE INPUT df$
OPEN sf$ FOR INPUT AS #1
OPEN df$ FOR OUTPUT AS #2
x=0
WHILE NOT EOF(1)
X LINE INPUT#1,t$
X REM PRINT LEN(t$)
X FOR y=1 TO LEN(t$) STEP 2
X hx$=MID$(t$,y,2)
X GOSUB 100
X PRINT #2,CHR$(hx);
X NEXT y
X x=x+(LEN(t$)/2)
X IF (x/100)=INT(x/100) THEN PRINT ".";
X
X IF (x/1000)=INT(x/1000) THEN PRINT " (";x; "Bytes Processed )"
X
WEND
CLOSE 2
CLOSE 1
PRINT: PRINT x;" bytes written in total"
END
X
100 REM
u$=LEFT$(hx$,1)
GOSUB 200
hv=rv
u$=RIGHT$(hx$,1)
GOSUB 200
hx=rv+(16*hv)
RETURN
X
200 REM
IF ASC(u$)<65 THEN
X rv=VAL(u$)
ELSE
X rv=ASC(u$)-55
END IF
RETURN
<BR></PRE>
<HR>
<BR>
For a description of the file routines, see the BINCONV page.<BR>
The following explains the HEX conversion routines...<BR>
<UL>
<LI>[100] This is the double-hex convert (0x00 to 0xff) routine
<LI>Take the first character, and call the single-hex routine, storing the result
<LI>Take the last character and call the single-hex routine
<LI>Take the result and add it to (16*the previous result)
<LI>Return the value calculated
<LI>[200] This is the single-hex convert (0-f) routine
<LI>Is the character < ASCII 65 ('A') If yes, then simply take the value of it, otherwise...
<LI>Take the ASCII value and subtract 55.
<LI>Return the value
</UL>
<BR>
<HR>
<BR>
<B>The information contained on this page is &copy; Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.</B><BR><BR>
<I>The author can be contacted by E-Mail at <A HREF="mailto:to...@basoft.enta.net">to...@basoft.enta.net</A></I>
SHAR_EOF
chmod 0600 convbin.htm ||
echo 'restore of convbin.htm failed'
Wc_c="`wc -c < 'convbin.htm'`"
test 2021 -eq "$Wc_c" ||
echo 'convbin.htm: original size 2021, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= convbin.txt ==============
if test -f 'convbin.txt' -a X"$1" != X"-c"; then
echo 'x - skipping convbin.txt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting convbin.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'convbin.txt' &&
CONVBIN.BAS
X
X
--------------------------------------------------------------------------------
The following AmigaBASIC program will convert a 'Hex-Dump' style text file back to a binary file after reception from a PC using the RX.BAS program. Run the program, enter the source and destination filenames, and then sit back and wait.
X
--------------------------------------------------------------------------------
X
X
CLS
PRINT "Source: ";: LINE INPUT sf$
PRINT "Dest: ";: LINE INPUT df$
OPEN sf$ FOR INPUT AS #1
OPEN df$ FOR OUTPUT AS #2
x=0
WHILE NOT EOF(1)
X LINE INPUT#1,t$
X REM PRINT LEN(t$)
X FOR y=1 TO LEN(t$) STEP 2
X hx$=MID$(t$,y,2)
X GOSUB 100
X PRINT #2,CHR$(hx);
X NEXT y
X x=x+(LEN(t$)/2)
X IF (x/100)=INT(x/100) THEN PRINT ".";
X
X IF (x/1000)=INT(x/1000) THEN PRINT " (";x; "Bytes Processed )"
X
WEND
CLOSE 2
CLOSE 1
PRINT: PRINT x;" bytes written in total"
END
X
100 REM
u$=LEFT$(hx$,1)
GOSUB 200
hv=rv
u$=RIGHT$(hx$,1)
GOSUB 200
hx=rv+(16*hv)
RETURN
X
200 REM
IF ASC(u$)<65 THEN
X rv=VAL(u$)
ELSE
X rv=ASC(u$)-55
END IF
RETURN
X
X
--------------------------------------------------------------------------------
X
For a description of the file routines, see the BINCONV page.
The following explains the HEX conversion routines...
X
[100] This is the double-hex convert (0x00 to 0xff) routine
Take the first character, and call the single-hex routine, storing the result
Take the last character and call the single-hex routine
Take the result and add it to (16*the previous result)
Return the value calculated
[200] This is the single-hex convert (0-f) routine
Is the character < ASCII 65 ('A') If yes, then simply take the value of it, otherwise...
Take the ASCII value and subtract 55.
Return the value
X
X
--------------------------------------------------------------------------------
X
The information contained on this page is (c) Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.
X
The author can be contacted by E-Mail at to...@basoft.enta.net
SHAR_EOF
chmod 0600 convbin.txt ||
echo 'restore of convbin.txt failed'
Wc_c="`wc -c < 'convbin.txt'`"
test 2079 -eq "$Wc_c" ||
echo 'convbin.txt: original size 2079, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rlist.bas ==============
if test -f 'rlist.bas' -a X"$1" != X"-c"; then
echo 'x - skipping rlist.bas (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rlist.bas (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rlist.bas' &&
OPEN "com1:9600,n,8,1" FOR RANDOM AS #1
INPUT "Filename: "; fl$
OPEN fl$ FOR OUTPUT AS #2
CLS
PRINT "Waiting for list to commence..."
PRINT
WHILE LOC(1) = 0
WEND
PRINT "List begins..."
t = 0
WHILE t < 30000
a$ = INPUT$(1, 1)
PRINT a$;
PRINT #2, a$;
t = 0
WHILE LOC(1) = 0 AND t < 30000
t = t + 1
WEND
WEND
CLOSE #2
CLOSE #1
X
SHAR_EOF
chmod 0600 rlist.bas ||
echo 'restore of rlist.bas failed'
Wc_c="`wc -c < 'rlist.bas'`"
test 325 -eq "$Wc_c" ||
echo 'rlist.bas: original size 325, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rlist.htm ==============
if test -f 'rlist.htm' -a X"$1" != X"-c"; then
echo 'x - skipping rlist.htm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rlist.htm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rlist.htm' &&
<TITLE>RLIST.BAS - Receive AmigaBASIC Listing onto PC</TITLE>
<H1 ALIGN=Center>RLIST.BAS</H1>
<BR>
<HR>
<B>The following QBASIC program will receive an AmigaBASIC program via a null-modem cable. To use it,
first type LPRINT on the Amiga, run this program on the PC, enter the filename, and then LLIST on the Amiga. When the listing has completed, wait for this program to time out and the file will then be closed and the program will terminate normally.</B>
<BR>
<HR>
<BR>
<PRE>
OPEN "com1:9600,n,8,1" FOR RANDOM AS #1
INPUT "Filename: "; fl$
OPEN fl$ FOR OUTPUT AS #2
CLS
PRINT "Waiting for list to commence..."
PRINT
WHILE LOC(1) = 0
WEND
PRINT "List begins..."
t = 0
WHILE t < 30000
a$ = INPUT$(1, 1)
PRINT a$;
PRINT #2, a$;
t = 0
WHILE LOC(1) = 0 AND t < 30000
t = t + 1
WEND
WEND
CLOSE #2
CLOSE #1
<BR></PRE>
<HR>
<BR>
<UL>
<LI>The OPEN statement opens the COM port on the PC
<LI>The filename is asked for in fl$ and opened for output
<LI>WHILE LOC(1)=0:WEND Waits for some input on the COM port (i.e. waits for LLIST cmd)
<LI>The whole input routine is looped until a timout occurs (t>=30000)
<LI>A character is input from the COM port, echoed and written to the file
<LI>The timeout counter is reset
<LI>The counter is then incremented until a character is ready to be rec'd, or timeout occurs
<LI>If timeout didn't occur, then loop, otherwise close the files
</UL>
<BR>
<HR>
<BR>
<B>The information contained on this page is &copy; Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.</B><BR><BR>
<I>The author can be contacted by E-Mail at <A HREF="mailto:to...@basoft.enta.net">to...@basoft.enta.net</A></I>
SHAR_EOF
chmod 0600 rlist.htm ||
echo 'restore of rlist.htm failed'
Wc_c="`wc -c < 'rlist.htm'`"
test 1717 -eq "$Wc_c" ||
echo 'rlist.htm: original size 1717, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rlist.txt ==============
if test -f 'rlist.txt' -a X"$1" != X"-c"; then
echo 'x - skipping rlist.txt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rlist.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rlist.txt' &&
RLIST.BAS
X
X
--------------------------------------------------------------------------------
The following QBASIC program will receive an AmigaBASIC program via a null-modem cable. To use it, first type LPRINT on the Amiga, run this program on the PC, enter the filename, and then LLIST on the Amiga. When the listing has completed, wait for this program to time out and the file will then be closed and the program will terminate normally.
X
--------------------------------------------------------------------------------
X
X
OPEN "com1:9600,n,8,1" FOR RANDOM AS #1
INPUT "Filename: "; fl$
OPEN fl$ FOR OUTPUT AS #2
CLS
PRINT "Waiting for list to commence..."
PRINT
WHILE LOC(1) = 0
WEND
PRINT "List begins..."
t = 0
WHILE t < 30000
a$ = INPUT$(1, 1)
PRINT a$;
PRINT #2, a$;
t = 0
WHILE LOC(1) = 0 AND t < 30000
t = t + 1
WEND
WEND
CLOSE #2
CLOSE #1
X
X
--------------------------------------------------------------------------------
X
X
The OPEN statement opens the COM port on the PC
The filename is asked for in fl$ and opened for output
WHILE LOC(1)=0:WEND Waits for some input on the COM port (i.e. waits for LLIST cmd)
The whole input routine is looped until a timout occurs (t>=30000)
A character is input from the COM port, echoed and written to the file
The timeout counter is reset
The counter is then incremented until a character is ready to be rec'd, or timeout occurs
If timeout didn't occur, then loop, otherwise close the files
X
X
--------------------------------------------------------------------------------
X
The information contained on this page is (c) Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.
X
The author can be contacted by E-Mail at to...@basoft.enta.net
SHAR_EOF
chmod 0600 rlist.txt ||
echo 'restore of rlist.txt failed'
Wc_c="`wc -c < 'rlist.txt'`"
test 1796 -eq "$Wc_c" ||
echo 'rlist.txt: original size 1796, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rx.bas ==============
if test -f 'rx.bas' -a X"$1" != X"-c"; then
echo 'x - skipping rx.bas (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rx.bas (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rx.bas' &&
timeout%=30000
OPTION BASE 1
OPEN "com1:19200,n,8,1,BIN" AS #1
CLS
PRINT "File recv v1.0 by B A Software"
PRINT "(C) Copyright 1997 All rights reserved"
x=0
PRINT: PRINT "Filename to receive: ";
LINE INPUT fl$
OPEN fl$ FOR OUTPUT AS #2
CLOSE 2
OPEN fl$ FOR APPEND AS #2
conn%=0
FOR a=1 TO 10
X PRINT "Attempting to connect with <C> command... ";
X PRINT#1, "C";
X t=0
X WHILE ((LOC(1)<>1) AND (t<>timeout%))
X t=t+1
X WEND
X IF t<>timeout% THEN
X conn%=1
X PRINT "<C> taken OK"
X a=10
X ELSE
X PRINT "Timed out"
X END IF
NEXT a
IF conn%=1 THEN
X done%=0
X blk%=0
X WHILE (done%=0)
X cd$=INPUT$(1,1)
X IF (cd$=CHR$(1) OR cd$=CHR$(4)) THEN
X REM header
X blk%=blk%+1
X REM PRINT "Header arriving..."
X q$=""
X WHILE LEN(q$)<132
X WHILE LOC(1)=0
X WEND
X q$=q$+INPUT$(1,1)
X REM PRINT HEX$(ASC(RIGHT$(q$,1)));"(";LEN(q$);") ";
X REM PRINT "(";HEX$(LEN(q$));")";
X REM IF LEN(q$)/20=INT(LEN(q$)/20) THEN PRINT "!";LEN(q$);"!"
X REM print loc(1)
X WEND
X z$=LEFT$(q$, 1)
X y$=MID$(q$, 2, 1)
X ib=ASC(z$)+(128*ASC(y$))
X bok%=1
X IF cd$=CHR$(1) THEN
X PRINT "Block ";ib; " incoming... ";
X IF ((ib<>blk%) AND (cd$=CHR$(1))) THEN
X PRINT "Hmm.. I was expecting block: ";blk%
X bok%=0
X blk%=blk%-1
X END IF
X ELSE
X PRINT "Last block incoming... ";
X done%=1
X END IF
X IF bok%=1 THEN
X cs=0
X drok%=0
X FOR a=3 TO 130
X cs=(cs+ASC(MID$(q$,a,1))) AND 65535&
X NEXT a
X bcs=ASC(MID$(q$,131,1))+(128*(ASC(RIGHT$(q$,1))))
X IF cs=bcs THEN
X PRINT "C/Sum OK"
X drok%=1
X ELSE
X PRINT "Expected ";cs; " C/Sum, but got ";bcs
X blk%=blk%-1
X END IF
X ELSE
X drok%=0
X END IF
X IF drok%=1 THEN
X PRINT #1,CHR$(6);
X REM write it to file
X IF done%=1 THEN
X cc=ib
X ELSE
X cc=128
X END IF
X m$=MID$(q$,3,cc)
X PRINT #2,m$;
X ELSE
X PRINT #1,CHR$(21);
X END IF
X ELSE
X REM bogusa cmd
X REM wait for empty buf
X WHILE LOC(1)<>0
X t$=INPUT$(1,1)
X WEND
X REM send nak
X PRINT #1,CHR$(21);
X END IF
X WEND
X PRINT "Reception of ";blk%; "blocks completed OK."
ELSE
X PRINT "Failed to establish connection with remote machine"
END IF
CLOSE 2
CLOSE 1
SHAR_EOF
chmod 0600 rx.bas ||
echo 'restore of rx.bas failed'
Wc_c="`wc -c < 'rx.bas'`"
test 2408 -eq "$Wc_c" ||
echo 'rx.bas: original size 2408, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rx.htm ==============
if test -f 'rx.htm' -a X"$1" != X"-c"; then
echo 'x - skipping rx.htm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rx.htm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rx.htm' &&
<TITLE>RX.BAS - Receive a file from a PC to Amiga</TITLE>
<H1 ALIGN=Center>RX.BAS</H1>
<BR>
<HR>
<B>The following AmigaBASIC program will receive a text file onto an Amiga froma PC running the SX.BAS program. Run the SX program on the PC, enter the source filename, Run this program, enter the destination filename, and then sit back and wait.</B>
<BR>
<HR>
<BR>
<PRE>
timeout%=30000
OPTION BASE 1
OPEN "com1:19200,n,8,1,BIN" AS #1
CLS
PRINT "File recv v1.0 by B A Software"
PRINT "(C) Copyright 1997 All rights reserved"
x=0
PRINT: PRINT "Filename to receive: ";
LINE INPUT fl$
OPEN fl$ FOR OUTPUT AS #2
CLOSE 2
OPEN fl$ FOR APPEND AS #2
conn%=0
FOR a=1 TO 10
X PRINT "Attempting to connect with <C> command... ";
X PRINT#1, "C";
X t=0
X WHILE ((LOC(1)<>1) AND (t<>timeout%))
X t=t+1
X WEND
X IF t<>timeout% THEN
X conn%=1
X PRINT "<C> taken OK"
X a=10
X ELSE
X PRINT "Timed out"
X END IF
NEXT a
IF conn%=1 THEN
X done%=0
X blk%=0
X WHILE (done%=0)
X cd$=INPUT$(1,1)
X IF (cd$=CHR$(1) OR cd$=CHR$(4)) THEN
X REM header
X blk%=blk%+1
X REM PRINT "Header arriving..."
X q$=""
X WHILE LEN(q$)<132
X WHILE LOC(1)=0
X WEND
X q$=q$+INPUT$(1,1)
X REM PRINT HEX$(ASC(RIGHT$(q$,1)));"(";LEN(q$);") ";
X REM PRINT "(";HEX$(LEN(q$));")";
X REM IF LEN(q$)/20=INT(LEN(q$)/20) THEN PRINT "!";LEN(q$);"!"
X REM print loc(1)
X WEND
X z$=LEFT$(q$, 1)
X y$=MID$(q$, 2, 1)
X ib=ASC(z$)+(128*ASC(y$))
X bok%=1
X IF cd$=CHR$(1) THEN
X PRINT "Block ";ib; " incoming... ";
X IF ((ib<>blk%) AND (cd$=CHR$(1))) THEN
X PRINT "Hmm.. I was expecting block: ";blk%
X bok%=0
X blk%=blk%-1
X END IF
X ELSE
X PRINT "Last block incoming... ";
X done%=1
X END IF
X IF bok%=1 THEN
X cs=0
X drok%=0
X FOR a=3 TO 130
X cs=(cs+ASC(MID$(q$,a,1))) AND 65535&
X NEXT a
X bcs=ASC(MID$(q$,131,1))+(128*(ASC(RIGHT$(q$,1))))
X IF cs=bcs THEN
X PRINT "C/Sum OK"
X drok%=1
X ELSE
X PRINT "Expected ";cs; " C/Sum, but got ";bcs
X blk%=blk%-1
X END IF
X ELSE
X drok%=0
X END IF
X IF drok%=1 THEN
X PRINT #1,CHR$(6);
X REM write it to file
X IF done%=1 THEN
X cc=ib
X ELSE
X cc=128
X END IF
X m$=MID$(q$,3,cc)
X PRINT #2,m$;
X ELSE
X PRINT #1,CHR$(21);
X END IF
X ELSE
X REM bogusa cmd
X REM wait for empty buf
X WHILE LOC(1)<>0
X t$=INPUT$(1,1)
X WEND
X REM send nak
X PRINT #1,CHR$(21);
X END IF
X WEND
X PRINT "Reception of ";blk%; "blocks completed OK."
ELSE
X PRINT "Failed to establish connection with remote machine"
END IF
CLOSE 2
CLOSE 1
<BR></PRE>
<HR>
<BR>
For an explanation of how this program works, see the main TRANS page.
<BR>
<HR>
<BR>
<B>The information contained on this page is &copy; Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.</B><BR><BR>
<I>The author can be contacted by E-Mail at <A HREF="mailto:to...@basoft.enta.net">to...@basoft.enta.net</A></I>
SHAR_EOF
chmod 0600 rx.htm ||
echo 'restore of rx.htm failed'
Wc_c="`wc -c < 'rx.htm'`"
test 3212 -eq "$Wc_c" ||
echo 'rx.htm: original size 3212, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= rx.txt ==============
if test -f 'rx.txt' -a X"$1" != X"-c"; then
echo 'x - skipping rx.txt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting rx.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rx.txt' &&
RX.BAS
X
X
--------------------------------------------------------------------------------
The following AmigaBASIC program will receive a text file onto an Amiga froma PC running the SX.BAS program. Run the SX program on the PC, enter the source filename, Run this program, enter the destination filename, and then sit back and wait.
X
--------------------------------------------------------------------------------
X
X
timeout%=30000
OPTION BASE 1
OPEN "com1:19200,n,8,1,BIN" AS #1
CLS
PRINT "File recv v1.0 by B A Software"
PRINT "(C) Copyright 1997 All rights reserved"
x=0
PRINT: PRINT "Filename to receive: ";
LINE INPUT fl$
OPEN fl$ FOR OUTPUT AS #2
CLOSE 2
OPEN fl$ FOR APPEND AS #2
conn%=0
FOR a=1 TO 10
X PRINT "Attempting to connect with command... ";
X PRINT#1, "C";
X t=0
X WHILE ((LOC(1)<>1) AND (t<>timeout%))
X t=t+1
X WEND
X IF t<>timeout% THEN
X conn%=1
X PRINT " taken OK"
X a=10
X ELSE
X PRINT "Timed out"
X END IF
NEXT a
IF conn%=1 THEN
X done%=0
X blk%=0
X WHILE (done%=0)
X cd$=INPUT$(1,1)
X IF (cd$=CHR$(1) OR cd$=CHR$(4)) THEN
X REM header
X blk%=blk%+1
X REM PRINT "Header arriving..."
X q$=""
X WHILE LEN(q$)<132
X WHILE LOC(1)=0
X WEND
X q$=q$+INPUT$(1,1)
X REM PRINT HEX$(ASC(RIGHT$(q$,1)));"(";LEN(q$);") ";
X REM PRINT "(";HEX$(LEN(q$));")";
X REM IF LEN(q$)/20=INT(LEN(q$)/20) THEN PRINT "!";LEN(q$);"!"
X REM print loc(1)
X WEND
X z$=LEFT$(q$, 1)
X y$=MID$(q$, 2, 1)
X ib=ASC(z$)+(128*ASC(y$))
X bok%=1
X IF cd$=CHR$(1) THEN
X PRINT "Block ";ib; " incoming... ";
X IF ((ib<>blk%) AND (cd$=CHR$(1))) THEN
X PRINT "Hmm.. I was expecting block: ";blk%
X bok%=0
X blk%=blk%-1
X END IF
X ELSE
X PRINT "Last block incoming... ";
X done%=1
X END IF
X IF bok%=1 THEN
X cs=0
X drok%=0
X FOR a=3 TO 130
X cs=(cs+ASC(MID$(q$,a,1))) AND 65535&
X NEXT a
X bcs=ASC(MID$(q$,131,1))+(128*(ASC(RIGHT$(q$,1))))
X IF cs=bcs THEN
X PRINT "C/Sum OK"
X drok%=1
X ELSE
X PRINT "Expected ";cs; " C/Sum, but got ";bcs
X blk%=blk%-1
X END IF
X ELSE
X drok%=0
X END IF
X IF drok%=1 THEN
X PRINT #1,CHR$(6);
X REM write it to file
X IF done%=1 THEN
X cc=ib
X ELSE
X cc=128
X END IF
X m$=MID$(q$,3,cc)
X PRINT #2,m$;
X ELSE
X PRINT #1,CHR$(21);
X END IF
X ELSE
X REM bogusa cmd
X REM wait for empty buf
X WHILE LOC(1)<>0
X t$=INPUT$(1,1)
X WEND
X REM send nak
X PRINT #1,CHR$(21);
X END IF
X WEND
X PRINT "Reception of ";blk%; "blocks completed OK."
ELSE
X PRINT "Failed to establish connection with remote machine"
END IF
CLOSE 2
CLOSE 1
X
X
--------------------------------------------------------------------------------
X
For an explanation of how this program works, see the main TRANS page.
X
--------------------------------------------------------------------------------
X
The information contained on this page is (c) Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.
X
The author can be contacted by E-Mail at to...@basoft.enta.net
SHAR_EOF
chmod 0600 rx.txt ||
echo 'restore of rx.txt failed'
Wc_c="`wc -c < 'rx.txt'`"
test 3323 -eq "$Wc_c" ||
echo 'rx.txt: original size 3323, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= sx.bas ==============
if test -f 'sx.bas' -a X"$1" != X"-c"; then
echo 'x - skipping sx.bas (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting sx.bas (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'sx.bas' &&
REM variables
timeout% = 20000
X
CLS
PRINT "File trans v1.0 by B A Software"
PRINT "(c) Copyright 1997 All rights reserved"
OPEN "com1:19200,n,8,1,BIN" FOR RANDOM AS #1
PRINT : PRINT "Filename to send: ";
LINE INPUT fl$
OPEN fl$ FOR BINARY AS #2
bs = LOF(2)
bc = bs / 128
IF bc <> INT(bc) THEN bc = INT(bc) + 1
PRINT "File opened. Size: "; bs; " bytes ("; bc; " blocks)"
PRINT
FOR a = 1 TO 10
X PRINT "Waiting for host to connect with <C> command... Attempt "; a;
X t = 0
X WHILE ((LOC(1) <> 1) AND (t <> timeout%))
X t = t + 1
X WEND
X i$ = "": conn% = 0
X IF t <> timeout% THEN
X i$ = INPUT$(1, 1)
X IF i$ = "C" THEN
X conn% = 1
X EXIT FOR
X ELSE
X PRINT "Bad cmd: $"; HEX$(ASC(i$))
X END IF
X ELSE
X PRINT "Timed out!"
X END IF
NEXT a
IF conn% = 1 THEN
X PRINT "<C> Recd OK"
X REM now send the blocks
X FOR rl = 1 TO bc
X i$ = INPUT$(128, 2)
X WHILE LEN(i$) < 128
X i$ = i$ + CHR$(26)
X WEND
X ack% = 0
X WHILE (ack% = 0)
X cs = 0
X hbn = INT(rl / 128)
X IF rl = bc THEN
X PRINT #1, CHR$(4); CHR$(bs - ((bc - 1) * 128)); CHR$(0);
X ELSE
X PRINT #1, CHR$(1); CHR$(rl - (128 * hbn)); CHR$(hbn);
X END IF
X FOR z = 1 TO 128
X cs = (cs + ASC(MID$(i$, z, 1))) AND 65535
X PRINT #1, MID$(i$, z, 1);
X REM PRINT HEX$(ASC(MID$(i$, z, 1))); " ";
X REM IF z / 20 = INT(z / 20) THEN PRINT
X FOR dl = 1 TO del%: NEXT dl
X NEXT z
X hb = INT(cs / 128)
X lb = cs - (hb * 128)
X PRINT #1, CHR$(lb); CHR$(hb);
X t = 0
X PRINT "Block "; rl; "/"; bc; " sent --- "; cs; "checksum --- ";
X WHILE ((LOC(1) <> 1) AND (t <> timeout%))
X t = t + 1
X WEND
X IF t <> timeout% THEN
X r$ = INPUT$(1, 1)
X IF r$ = CHR$(6) THEN
X ack% = 1
X PRINT "OK!"
X ELSE
X PRINT "Rejected"
X END IF
X ELSE
X PRINT "No response"
X END IF
X WEND
X NEXT rl
X PRINT "Transmission completed."
ELSE
X PRINT "Host failed to connect. Terminating"
END IF
CLOSE 2
CLOSE 1
X
X
SHAR_EOF
chmod 0600 sx.bas ||
echo 'restore of sx.bas failed'
Wc_c="`wc -c < 'sx.bas'`"
test 3034 -eq "$Wc_c" ||
echo 'sx.bas: original size 3034, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= sx.htm ==============
if test -f 'sx.htm' -a X"$1" != X"-c"; then
echo 'x - skipping sx.htm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting sx.htm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'sx.htm' &&
<TITLE>SX.BAS - Transmit a file from a PC to Amiga</TITLE>
<H1 ALIGN=Center>SX.BAS</H1>
<BR>
<HR>
<B>The following QBASIC program will send a text file from a PC to an Amiga running the RX.BAS program. Run the program, enter the source filename, Run the Amiga RX program, enter the filename, and then sit back and wait.</B>
<BR>
<HR>
<BR>
<PRE>
REM variables
timeout% = 20000
X
CLS
PRINT "File trans v1.0 by B A Software"
PRINT "(c) Copyright 1997 All rights reserved"
OPEN "com1:19200,n,8,1,BIN" FOR RANDOM AS #1
PRINT : PRINT "Filename to send: ";
LINE INPUT fl$
OPEN fl$ FOR BINARY AS #2
bs = LOF(2)
bc = bs / 128
IF bc <> INT(bc) THEN bc = INT(bc) + 1
PRINT "File opened. Size: "; bs; " bytes ("; bc; " blocks)"
PRINT
FOR a = 1 TO 10
X PRINT "Waiting for host to connect with <C> command... Attempt "; a;
X t = 0
X WHILE ((LOC(1) <> 1) AND (t <> timeout%))
X t = t + 1
X WEND
X i$ = "": conn% = 0
X IF t <> timeout% THEN
X i$ = INPUT$(1, 1)
X IF i$ = "C" THEN
X conn% = 1
X EXIT FOR
X ELSE
X PRINT "Bad cmd: $"; HEX$(ASC(i$))
X END IF
X ELSE
X PRINT "Timed out!"
X END IF
NEXT a
IF conn% = 1 THEN
X PRINT "<C> Recd OK"
X REM now send the blocks
X FOR rl = 1 TO bc
X i$ = INPUT$(128, 2)
X WHILE LEN(i$) < 128
X i$ = i$ + CHR$(26)
X WEND
X ack% = 0
X WHILE (ack% = 0)
X cs = 0
X hbn = INT(rl / 128)
X IF rl = bc THEN
X PRINT #1, CHR$(4); CHR$(bs - ((bc - 1) * 128)); CHR$(0);
X ELSE
X PRINT #1, CHR$(1); CHR$(rl - (128 * hbn)); CHR$(hbn);
X END IF
X FOR z = 1 TO 128
X cs = (cs + ASC(MID$(i$, z, 1))) AND 65535
X PRINT #1, MID$(i$, z, 1);
X REM PRINT HEX$(ASC(MID$(i$, z, 1))); " ";
X REM IF z / 20 = INT(z / 20) THEN PRINT
X FOR dl = 1 TO del%: NEXT dl
X NEXT z
X hb = INT(cs / 128)
X lb = cs - (hb * 128)
X PRINT #1, CHR$(lb); CHR$(hb);
X t = 0
X PRINT "Block "; rl; "/"; bc; " sent --- "; cs; "checksum --- ";
X WHILE ((LOC(1) <> 1) AND (t <> timeout%))
X t = t + 1
X WEND
X IF t <> timeout% THEN
X r$ = INPUT$(1, 1)
X IF r$ = CHR$(6) THEN
X ack% = 1
X PRINT "OK!"
X ELSE
X PRINT "Rejected"
X END IF
X ELSE
X PRINT "No response"
X END IF
X WEND
X NEXT rl
X PRINT "Transmission completed."
ELSE
X PRINT "Host failed to connect. Terminating"
END IF
CLOSE 2
CLOSE 1
<BR></PRE>
<HR>
<BR>
For an explanation of how this program works, see the main TRANS page.
<BR>
<HR>
<BR>
<B>The information contained on this page is &copy; Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.</B><BR><BR>
<I>The author can be contacted by E-Mail at <A HREF="mailto:to...@basoft.enta.net">to...@basoft.enta.net</A></I>
SHAR_EOF
chmod 0600 sx.htm ||
echo 'restore of sx.htm failed'
Wc_c="`wc -c < 'sx.htm'`"
test 3812 -eq "$Wc_c" ||
echo 'sx.htm: original size 3812, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= sx.txt ==============
if test -f 'sx.txt' -a X"$1" != X"-c"; then
echo 'x - skipping sx.txt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting sx.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'sx.txt' &&
SX.BAS
X
X
--------------------------------------------------------------------------------
The following QBASIC program will send a text file from a PC to an Amiga running the RX.BAS program. Run the program, enter the source filename, Run the Amiga RX program, enter the filename, and then sit back and wait.
X
--------------------------------------------------------------------------------
X
X
REM variables
timeout% = 20000
X
CLS
PRINT "File trans v1.0 by B A Software"
PRINT "(c) Copyright 1997 All rights reserved"
OPEN "com1:19200,n,8,1,BIN" FOR RANDOM AS #1
PRINT : PRINT "Filename to send: ";
LINE INPUT fl$
OPEN fl$ FOR BINARY AS #2
bs = LOF(2)
bc = bs / 128
IF bc <> INT(bc) THEN bc = INT(bc) + 1
PRINT "File opened. Size: "; bs; " bytes ("; bc; " blocks)"
PRINT
FOR a = 1 TO 10
X PRINT "Waiting for host to connect with command... Attempt "; a;
X t = 0
X WHILE ((LOC(1) <> 1) AND (t <> timeout%))
X t = t + 1
X WEND
X i$ = "": conn% = 0
X IF t <> timeout% THEN
X i$ = INPUT$(1, 1)
X IF i$ = "C" THEN
X conn% = 1
X EXIT FOR
X ELSE
X PRINT "Bad cmd: $"; HEX$(ASC(i$))
X END IF
X ELSE
X PRINT "Timed out!"
X END IF
NEXT a
IF conn% = 1 THEN
X PRINT " Recd OK"
X REM now send the blocks
X FOR rl = 1 TO bc
X i$ = INPUT$(128, 2)
X WHILE LEN(i$) < 128
X i$ = i$ + CHR$(26)
X WEND
X ack% = 0
X WHILE (ack% = 0)
X cs = 0
X hbn = INT(rl / 128)
X IF rl = bc THEN
X PRINT #1, CHR$(4); CHR$(bs - ((bc - 1) * 128)); CHR$(0);
X ELSE
X PRINT #1, CHR$(1); CHR$(rl - (128 * hbn)); CHR$(hbn);
X END IF
X FOR z = 1 TO 128
X cs = (cs + ASC(MID$(i$, z, 1))) AND 65535
X PRINT #1, MID$(i$, z, 1);
X REM PRINT HEX$(ASC(MID$(i$, z, 1))); " ";
X REM IF z / 20 = INT(z / 20) THEN PRINT
X FOR dl = 1 TO del%: NEXT dl
X NEXT z
X hb = INT(cs / 128)
X lb = cs - (hb * 128)
X PRINT #1, CHR$(lb); CHR$(hb);
X t = 0
X PRINT "Block "; rl; "/"; bc; " sent --- "; cs; "checksum --- ";
X WHILE ((LOC(1) <> 1) AND (t <> timeout%))
X t = t + 1
X WEND
X IF t <> timeout% THEN
X r$ = INPUT$(1, 1)
X IF r$ = CHR$(6) THEN
X ack% = 1
X PRINT "OK!"
X ELSE
X PRINT "Rejected"
X END IF
X ELSE
X PRINT "No response"
X END IF
X WEND
X NEXT rl
X PRINT "Transmission completed."
ELSE
X PRINT "Host failed to connect. Terminating"
END IF
CLOSE 2
CLOSE 1
X
X
--------------------------------------------------------------------------------
X
For an explanation of how this program works, see the main TRANS page.
X
--------------------------------------------------------------------------------
X
The information contained on this page is (c) Copyright 1997 by B A Software. It is provided for information purposes only and as such is offered without any form of warranty, implicit or otherwise.
X
The author can be contacted by E-Mail at to...@basoft.enta.net
SHAR_EOF
chmod 0600 sx.txt ||
echo 'restore of sx.txt failed'
Wc_c="`wc -c < 'sx.txt'`"
test 3922 -eq "$Wc_c" ||
echo 'sx.txt: original size 3922, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= trans.htm ==============
if test -f 'trans.htm' -a X"$1" != X"-c"; then
echo 'x - skipping trans.htm (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting trans.htm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'trans.htm' &&
<HTML>
<HEAD>
<TITLE>Transferring information with TRANS</TITLE>
</HEAD>
X
<BODY>
X
<H1 ALIGN=Center>TRANS - The file transfer suite</H1>
<HR>
X
<BR>
The TRANS suite of BASIC programs has been written (very hastily) to enable a PC and Amiga 500 owner to send files from the PC to the Amiga. It is not at all fast at doing this, but hey, it does the job so who's complaining!!?<P>
X
<BR>
<U><B>The following programs make up the TRANS suite:</B></U>
<BR>
<BR>
X
<TABLE ALIGN=Center BORDER=2>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>RX.BAS</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>AmigaBASIC</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Gray>Receive a text file on the Amiga</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>SX.BAS</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>QBASIC</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Gray>Send a text file from the PC</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>CONVBIN.BAS</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>AmigaBASIC</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Gray>Convert a HEX dump text to BINary</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>BINCONV.BAS</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>QBASIC</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Gray>Convert a BINary to HEX dump text</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>RLIST.BAS</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>QBASIC</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Gray>Receive a BASIC listing from the Amiga to PC</TD>
</TR>
</TABLE>
<BR>
<I>Except RX and SX, to see a description of how each of these works, and how to use them, see their relevant pages (eg. CONVBIN.HTM)</I>
<BR><BR>
<U><B>How to work RX & SX and how they work</B></U>
<BR>
<BR>
SX and RX are complementary programs. While SX is run on the PC, RX must be run on the Amiga. They transfer information serially using a (modified) X-Modem-Cksum style protocol. The importance of this is twofold... Firstly, because a checksum is used, no errors can occur in transmission without being noticed, and secondly, a 'handshaking' protocol is introduced which ensures that all blocks are received in the correct order (and accurately, as has already been established).
<P>
An important note first: The order in which the programs is run is significant. Because a handshake establishes the connection between the two, and timeouts can occur, they are better run as follows (and take this as operating instructions!):
<P>
<OL>
<LI>Run the RX program on the Amiga
<LI>Enter the destination filename, but DO NOT PRESS ENTER YET
<LI>Run the SX program on the PC
<LI>Enter the source filename and press ENTER
<LI>Press ENTER on the Amiga
<LI>Watch the block counters increase on the two machines!
</OL>
<P>
<B>So how does it work?</B>
<BR><BR>
Erm, S L O W L Y!<BR>
<BR>
This program would not win any contests in the speed stakes. This is because of the crippled way in which it has been necessary to perform the transfer.<P>
Mainly, the Amiga (/AmigaBASIC) does not seem capable of receiving ASCII 255 over the serial port <grrrrrr> so this is why CONVBIN and BINCONV are necessary. This is annoying because it doubles the size of the files that have to be transferred, thus lengthening an already lengthy process.<P>
Details: The program uses an adaptation of the XModem protocol to perform handshaking and checksum. See below for a sample session:<P>
<TABLE ALIGN=Center BORDER=2>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua><B>Sender (SX)</B></TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White><B>Receiver (RX)</B></TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua><I>Waiting for C</I></TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White> </TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua> </TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>C</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Send Packet 1</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White> </TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua> </TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>ACK</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Send Packet 2</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White> </TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua></TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>NAK <I>(Error)</I></TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Send Packet 2</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White> </TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua> </TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>ACK</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Send Last Packet (3)</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White> </TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua> </TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>ACK</TD>
</TR>
</TABLE>
<P>
The packets are constructed as follows:
<P>
<TABLE ALIGN=Center BORDER=2>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Command</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>Block Number</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Data</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>Checksum</TD>
</TR>
<TR ALIGN=Center VALIGN=Middle>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Byte 0</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>Bytes 1-2</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=Aqua>Byte 3-130</TD>
<TD ALIGN=Center VALIGN=Middle BGCOLOR=White>Bytes 131-132</TD>
</TR>
</TABLE>
<P>
Where the command can be one of:
<UL>
<LI>0x01 - Standard Packet follows
<LI>0x04 - Last Packet follows (Only difference in packets being that the last packet command is followed by the number of bytes of data that are significant in that packet, and not the block number)
</UL>
<P>
The block number and checksum are written in Lo-Hi order, *but* the high-byte is 128-based, not 255-based. Therefore to calculate the checksum or block no, use: [byte0]+(128*[byte1])<P>
The checksum is simply the sum of the DATA bytes in the packet, ANDed with 65535 (i.e. ensure it does not exceed 0xffff, although technically this should be ANDed with 32768...0x8000)
<P>
<B>Tips:</B>
<OL>
<LI>Have some formatted disks ready to receive the files
<LI>Receive the files directly into RAM:
<LI>As soon as reception is complete, COPY RAM:[file]#? TO DF1: ASAP!
<LI>Use this to transfer the smallest comms program possible then ditch it!
<LI>Suggest using TWIN to perform transfers... This is about 50k, and will take between 30-60 mins to transfer, but it's VERY fast at doing what this does VERY slowly.
</OL>
<P>
<U><B>Disclaimer:</B></U>
<BR><BR>
This information is provided for reference only. No warranty is offered, whether implicit or otherwise. <P>
X
<HR>
<ADDRESS>
Tony Friery<BR>
Send e-mail to <A HREF="mailto:to...@basoft.enta.net">to...@basoft.enta.net</A>
</ADDRESS>
<HR>
X
<SMALL>Copyright &copy; 1997 Tony Friery. </SMALL><BR>
<SMALL>Page created 12 November 1997. Last updated 12 November 1997 at 9:18 AM.<BR>
</SMALL>
X
</BODY>
</HTML>
SHAR_EOF
chmod 0600 trans.htm ||
echo 'restore of trans.htm failed'
Wc_c="`wc -c < 'trans.htm'`"
test 7474 -eq "$Wc_c" ||
echo 'trans.htm: original size 7474, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= trans.txt ==============
if test -f 'trans.txt' -a X"$1" != X"-c"; then
echo 'x - skipping trans.txt (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting trans.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'trans.txt' &&
TRANS - The file transfer suite
X
--------------------------------------------------------------------------------
X
The TRANS suite of BASIC programs has been written (very hastily) to enable a PC and Amiga 500 owner to send files from the PC to the Amiga. It is not at all fast at doing this, but hey, it does the job so who's complaining!!?
X
The following programs make up the TRANS suite:
X
RX.BAS AmigaBASIC Receive a text file on the Amiga
SX.BAS QBASIC Send a text file from the PC
CONVBIN.BAS AmigaBASIC Convert a HEX dump text to BINary
BINCONV.BAS QBASIC Convert a BINary to HEX dump text
RLIST.BAS QBASIC Receive a BASIC listing from the Amiga to PC
X
Except RX and SX, to see a description of how each of these works, and how to use them, see their relevant pages (eg. CONVBIN.HTM)
X
How to work RX & SX and how they work
X
SX and RX are complementary programs. While SX is run on the PC, RX must be run on the Amiga. They transfer information serially using a (modified) X-Modem-Cksum style protocol. The importance of this is twofold... Firstly, because a checksum is used, no errors can occur in transmission without being noticed, and secondly, a 'handshaking' protocol is introduced which ensures that all blocks are received in the correct order (and accurately, as has already been established).
X
An important note first: The order in which the programs is run is significant. Because a handshake establishes the connection between the two, and timeouts can occur, they are better run as follows (and take this as operating instructions!):
X
X
Run the RX program on the Amiga
Enter the destination filename, but DO NOT PRESS ENTER YET
Run the SX program on the PC
Enter the source filename and press ENTER
Press ENTER on the Amiga
Watch the block counters increase on the two machines!
So how does it work?
X
Erm, S L O W L Y!
X
This program would not win any contests in the speed stakes. This is because of the crippled way in which it has been necessary to perform the transfer.
X
Mainly, the Amiga (/AmigaBASIC) does not seem capable of receiving ASCII 255 over the serial port so this is why CONVBIN and BINCONV are necessary. This is annoying because it doubles the size of the files that have to be transferred, thus lengthening an already lengthy process.
X
Details: The program uses an adaptation of the XModem protocol to perform handshaking and checksum. See below for a sample session:
X
Sender (SX) Receiver (RX)
Waiting for C
X C
Send Packet 1
X ACK
Send Packet 2
X NAK (Error)
Send Packet 2
X ACK
Send Last Packet (3)
X ACK
X
X
The packets are constructed as follows:
X
Command Block Number Data Checksum
Byte 0 Bytes 1-2 Byte 3-130 Bytes 131-132
X
X
Where the command can be one of:
X
0x01 - Standard Packet follows
0x04 - Last Packet follows (Only difference in packets being that the last packet command is followed by the number of bytes of data that are significant in that packet, and not the block number)
The block number and checksum are written in Lo-Hi order, *but* the high-byte is 128-based, not 255-based. Therefore to calculate the checksum or block no, use: [byte0]+(128*[byte1])
X
The checksum is simply the sum of the DATA bytes in the packet, ANDed with 65535 (i.e. ensure it does not exceed 0xffff, although technically this should be ANDed with 32768...0x8000)
X
Tips:
X
Have some formatted disks ready to receive the files
Receive the files directly into RAM:
As soon as reception is complete, COPY RAM:[file]#? TO DF1: ASAP!
Use this to transfer the smallest comms program possible then ditch it!
Suggest using TWIN to perform transfers... This is about 50k, and will take between 30-60 mins to transfer, but it's VERY fast at doing what this does VERY slowly.
Disclaimer:
X
This information is provided for reference only. No warranty is offered, whether implicit or otherwise.
X
X
X
--------------------------------------------------------------------------------
X
Tony Friery
Send e-mail to to...@basoft.enta.net
X
--------------------------------------------------------------------------------
Copyright (c) 1997 Tony Friery.
Page created 12 November 1997. Last updated 12 November 1997 at 9:18 AM.
SHAR_EOF
chmod 0600 trans.txt ||
echo 'restore of trans.txt failed'
Wc_c="`wc -c < 'trans.txt'`"
test 4178 -eq "$Wc_c" ||
echo 'trans.txt: original size 4178, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
exit 0
--
== B A Software
== Please remove the anti-spam text to email me
== Pandora's Rule: Never open a box you didn't close!

0 new messages