[net.micro.trs-80] XMODEM for

ir682@sdcc6.UUCP (Gerald Steinberg) (05/30/86)

Model 100?
Summary: 
Expires: 
References: 
Sender: 
Reply-To: ir682@sdcc6.UUCP (Gerald Steinberg)
Followup-To: 
Distribution: net
Organization: U.C. San Diego, Academic Computer Center
Keywords: 

Does anyone have a
working XMODEM
program for the
Model 100?  If so,
would it be possible
to post it on the
net or to send it to
me via E-Mail?

Also, is there a
public domain
program that would
allow text editing
or file manipulation
(ie, killing a file)
while using TELCOM?

Last request: Some
months ago, Gregg
Thompson posted a
list of public
domain Model 100
software which he
had.  I have been
unable to send to
the address I have
for him.  If Gregg
Thompson reads this
or someone has a
correct address,
please let me know.

Much obliged,

G. Steinberg

howarde@mmintl.UUCP (Howard Eglowstein) (06/02/86)

I found this on some BBS a while back and have used it with great
success.  I assume that's public domain...

--- Cut here --- XMDDOC.DO follows ----------------------------

             CREATING 'XMD100.CO'
             ********************


  The XMD100.HEX file must be converted to XMD100.CO for use. 
When XMD100.HEX is downloaded you should name it XMD100.DO. 
Before conversion, and before each time the program is run, the
high memory pointer must be set to (or be KNOWN to be) a maximum
of 59391 (lower is OK) using the CLEAR command (see the model 100
manual).  This can be accomplished with the simple BASIC program
(below) if other HIMEM values have been set by other programs
that you use.  If you never change HIMEM, then it is only
necessary to do this once from BASIC. "XMD100.CO" may then be run
directly on later occasions.
   100 CLEAR 256,59391
   200 RUNM "XMD100.CO"
 This will reset HIMEM each time it runs and then run the XMD100
machine language program.  The value '256' in line 100 is nominal
and may be changed to anything desired.  The 59391 may be changed
to anything lower, if necessary for other purposes.  "XMD100.BA"
would be a logical name to use for this program: it would then be
run instead of "XMD100.CO", which would be then be run by it
(RUNM).

    Use LOAD.BA from DL4 to convert "XMD100.DO" to "XMD100.CO". 
When LOAD.BA runs, it will prompt you for a filename.  Just
XMD100 will be sufficient.  It will then begin to print out the
decimal addresses of each checksum block. , starting with 59392
and ending with 62285.  This will take about 8 minutes and it
will beep when done, so don't bother watching.  "XMD100.CO" also
uses 62286 to 629555 (F34E-F5EB hex) for ram variables and
buffering, so if you have other concurrent uses for any of this
memory, then you will need a version assembled at a lower memory
location (it is not relocatable)...leave me a message
(71716,1642)  When LOAD.BA is finished, it will prompt you for a
RUN address.  Just press "ENTER", since it runs at the beginning
address (59392).  You have now saved a .CO file named
"XMD100.CO", which you should see on your menu.

             RUNNING 'XMD100.CO'
             *******************

    Put your menu cursor on "XMD100.CO" and press "ENTER".  The
screen will clear and the copyright and version message will be
displayed, followed by the prompt "TelXcommand:".  If it doesn't,
there is probably a memory conflict with another program, or an
error occured during the creation process (leave me a  message). 
This is command mode, and is very like the same mode of "TELCOM" 
except TERM is at [F7] and [F4] and [F5] are the directory and
free RAM  displays, respectively.

    To send or receive with XMODEM protocol you must enter the
normal terminal  mode (in any of the normal ways) and then the
XMODEM terminal mode (same mode,  actually, only the function
keys are different) by pressing "[F7] Xmod".  Now  you will see
"[F2] Send" and "[F3] Recv".  Before proceeding, the host 
(computer being Sent to or Received from) must be at the point of
waiting for  the XMODEM transfer to begin.  It will either be
awaiting a CRC or checksum  request, or repeatedly sending same. 
Pressing either "[F2] Send" or "[F3]  Recv" will prompt for a
filename (must be an ASCII file, i.e., .DO).  In the  case of
receiving, the file must not already exist.  If it does, you will
be  asked if you want to erase it.  This is different from the
Download routine,  which will presumptuously erase your file
without asking.  After this filename  is entered, Send or Receive
will automatically go on to completion or error,  either of which
beeps the buzzer.  In the case of error, it displays the cause 
of error and retry number (it trys up to 10 times).  After a
successful tranfer it returns to XMODEM terminal mode.

   NOTES:

 The Xmodem transfer can be used with any baud rate,
word length,  parity, number of stop bits, and flow control
(XON/XOFF enabled or not) since  it forces the setting to
"x8N1D"(where 'x' is the baud rate [1-9 or M] you have set)
during the transfer, then restores your previous settings when
finished or aborted.  However, if the "RESET" button on the back
of the model 100 is  pressed during the transfer, the settings
remain at "x8N1D".

    In this version, tranfer can be aborted by pressing control-X
(CTRL and X  together), which returns to XMODEM terminal mode
without breaking the  connection.  This does not, however, send
the host a CTRL-X character, which it should to signal the abort. 
The transfer routine doesn't respond to the abort  signal from
the host except as a BAD HEADER, and must receive at least 10 to
be aborted.  Also, at the end of a tranfer, you make see some
extraneous  characters, or a truncated message from the host. 
This is because the "send"  or "receive OK" message is printed
before the serial settings are restored and  therefore XON/XOFF
is still disabled, causing the loss of a few characters from any
post-transfer message the host may send.  Later versions should
correct  these oversights.

  Command Mode Function Keys:

   [F1] Find / search ADRS.DO for a number (see 'TELCOM' section
of model 100  operating manual)
   [F2] Call / dial a selected number, just as in TELCOM
   [F3] Stat / display or alter the serial port status
   [F4] File / displays the filename directory, as in BASIC
   [F5] Free / displays free RAM remaining, as in the MENU display
   [F6] is unused (suggestions ?)
   [F7] Term / switches to normal terminal emulation mode
   [F8] Menu / returns to the MENU

  Normal Terminal Mode Function Keys:

   [F1] Prev / displays the previous 8 lines (also XOFF's the
reception, if  enabled) until [F1] is pressed again
   [F2] Down / downloads just like "TELCOM"
   [F3]  Up  / uploads just like "TELCOM"
   [F4] Full or Half / toggles between full and half duplex 
(remains in effect in XMODEM terminal mode; see model 100
operating manual)
   [F5] Echo (or blank) / toggles the printer echoing on and off
(remains in  effect in XMODEM terminal mode)
   [F6] Wait (or blank)/ says 'Wait' when reception has been
stopped by the  host (see model 100 operating manual)
   [F7] Xmod / switches to XMODEM terminal mode (see below)
   [F8] Bye  / returns to command mode, 'Y' to confirm

  XMODEM Terminal Mode Function Keys:

   [F1] Prev / displays the previous 8 lines (also XOFF's the
reception, if  enabled) until [F1] is pressed again
   [F2] Send / sends a .DO file to the host, using XMODEM
protocol, beginning  by prompting for a filename (.DO ext may be
left off)
   [F3] Recv / receives a .DO file from the host, using XMODEM
protocol,  beginning by prompting for a filename(.DO ext may be
left off)
   [F4] File / displays the filename directory, as in BASIC
   [F5] Free / displays free RAM remaining, as in the MENU display
   [F6] Wait (or blank)/ says 'Wait' when reception has been
stopped by the  host (see model 100 operating manual)
   [F7] CRC or CkSm / toggles between CRC (cyclic redundancy
check: a  polynomial-generated 16-bit checksum) and regular
checksum mode...overridden by host request when sending XMODEM.
   [F8] Norm / returns to normal terminal emulation mode


   Please address any questions or reports of difficulties to:
    JOHN CHENOWETH 71716,1642

   I would also like to hear from anyone with a model 200 or
working knowledge  of same since I wish to rewrite this for the
200, but I don't have access to  one.

--- Cut here --- XMD100.DO follows (HEX file)-------------------------

:20E8000021F5F2CD9157CD4442217BE8CDA542C3D0E8CD2942217BE8CD7C5ACD535DCDB4D8
:20E82000EFCDA0EF2112E82252F62142E8CD9157CD4446D7A7CA1BE81150E8CDA76CCA1261
:20E84000E8C954656C58636F6D6D616E643A200053544154C9E85445524DD3E943414C4C54
:20E860003EE946494E4453E94D454E55975746494C45A8E846524545AEE8FF46696E6420E9
:20E880008043616C6C208053746174208046696C65738D467265658D805465726D8D4D65BA
:20E8A0006E758D4A52433337CD3AEBC31BE8CD31EBC31BE853657269616C20506F727420F3
:20E8C0005374617475733A20002BD73C3DC2FCE821B4E8CD9157215BF606057EE72305C2FB
:20E8E000DBE83E2CE73A2BF60F3E3298E721F6E8CDB127C31BE8302070707300DA0DE9FED0
:20E900002CCA19E9CDE90FFE4DC212E823CDE617CDCB6E2BD7A7CA1BE8CF2CCD2E11FE14B1
:20E92000CA29E9D60AC212E83C322BF6C31BE8214452CD585AD1CD8AE9CA12E8EBF637E502
:20E94000214452DC585AE1CD2D53DA12E8C21BE8C3E9E997CDB15DE5CDA65ACA12E8CDE37E
:20E960005AEBE1CD3F5CD212E8E5D5CDC55DCD8AE9C498E9CD2242CDBAE9CA12E8FE43CA9F
:20E980002FE9D1CD6D5CE1C363E9CDAEE9C8E7FE3A13C28AE9C3B4E9CDAEE9C8FE3CCAA93C
:20E9A000E9FE3AC8E713C398E9E73E3EE7C9CD745C1B1AC8FE1ACA12E8C9D5212B5DCD7C17
:20E9C0005ACDAE5CF5217BE8CD7C5ACDBC5DF1FE51D1C9215AF6D7D45734F5CDE617F13F94
:20E9E000DCE452DAD3EACDA0EF3E403250F6327BF6AF32C2FA32C3FACDD3453EFF325AF34C
:20EA0000CD38F0CD21F0CD4455CD5655CD6255CDA842CD4942CD93EFCD5D5D217CEA2252E1
:20EA2000F63A42FFA7CA33EA3A40FF21D9F7AE0FDC6255CDDB13CA4FEACDCB12DA89EA4721
:20EA40003A58F6A778CC444BA7C4326EDA6FEACD6D6DCA18EACD7E6DDA18EAF5E67FE7F13D
:20EA6000473A59F6A778C4554BCDC556C318EAAF3240FFCD9F72DA73EAC318EACD2942AFB5
:20EA80003259F6CD5655C318EA5F16FF2A5EF319197E23666F1115EAD5E92355D9EFF3EF31
:20EAA0003E5550551D55EBEABFEA507265F6446F77EE2055F0808080586D6FE44279E5213B
:20EAC0008657CDCFEFFE59CAD3EA217157CD9157C315EAAF3250F66F6722C2FACDCB6ECDE2
:20EAE0004E42CDBB52CD7063C306E83AC2FAB7C4EDEF2131EB225EF32107EBCD7C5A3A5A14
:20EB0000F3CD48EBC30FEA507265F653656EE4526563F646696CE5467265E580804E6F72DE
:20EB2000ED235551EBE9EC3AEB31EB1D5540EB03EACD2242CDAC7EC32242CD2242C33A1FF8
:20EB40003A5AF3EEFF325AF311E9F7212DF2C36B552112F02252F6E52181F0CDCFEFA7C810
:20EB600032C6FACDFA21CD0B4CC0CD8F202250F3EB2252F32254F3217C57CA9157CD8DEF4C
:20EB800021ADF0CD9157AF3258F33257F3210100224EF3C3AFEB3A57F33C3257F3FE0BD063
:20EBA0002112F1CD9157CDE5EECD6DEFCAA3EE21FDFF2B7DB4CA96EB010C00CDC6EECD6DCC
:20EBC0006DCAB2EBE5CD7E6DE1C2B2EBDAA3EEFE15C2D8EBAFC3DFEBFE43C2B2EB3EFFCD9B
:20EBE00045EBAF3257F33A57F33C3257F3FE0BD0CD6DEFCAA3EECDF1EE0E01CDC2EE3A4E61
:20EC0000F34F2FF5CDC2EEF1CDB5EEAF3256F3210000225BF32A54F3EB0E801AFE1AC224F3
:20EC2000EC3258F3CDA9EECDB5EE130DC21BEC3A5AF3B7C23FEC3A56F3CDB5EEC34AEC2A6D
:20EC40005BF37CCDB5EE7DCDB5EE01FDFFCD6D6DCA6EECC5CD7E6DC1FE06CA80ECFE15C278
:20EC60006EEC214CF1CD9157CDE5EEC3E6EB0B79B0C24DEC212EF1CD9157CDE5EEC3E6EB9B
:20EC80003A58F3B7C29BEC2A54F3118000192254F32A4EF323224EF3C3E2EBAF3257F33A85
:20ECA00057F33C3257F3FE0BC8CD6DEFCAA3EE0E04CDC2EE01FDFFCD6D6DCAC7ECC5CD7E3D
:20ECC0006DC1FE06CAE1ECC5016400CDC6EEC10B79B0C2B7EC216AF1CD9157CDE5EEC39F33
:20ECE000ECE12184F1CD9157C9210CF02252F6E52194F0CDCFEFA7C832C6FACDFA21CD0B76
:20ED00004CC0CD0F222252F32254F3EB2250F3D229ED21A6F1CDCFEFFE59C02102EDE52A68
:20ED200052F3EB2A50F3CDBE1F210100224EF3AF3258F33D325DF3CD8DEF21C1F1CD91574B
:20ED400021E2F10E153A5AF3B7CA51ED21F7F10E43C5CD9157C1CDC2EEAF3257F33A59F393
:20ED6000B7C268EDAF3258F33A57F33C3257F3FE0BD0FE07DA8FED3A5DF3473A5AF3A0CA67
:20ED80008FEDAF325AF3210CF2CD9157C329EDCD6DEFCAA3EEAF3256F3210000225BF3CD10
:20EDA0003AEFC267EEFE04CA98EEFE01C261EEAF325DF3CD3AEFC267EE5F3A4EF3BBC261BB
:20EDC000EECD3AEFC267EE2FBBC261EE16001E80216CF5CD3AEFC267EE77CDA9EEFE1AC245
:20EDE000E5ED3258F33A58F3B7C2EDED14231DC2D3ED3A5AF3B7CA13EE0E02C5CD3AEFC181
:20EE0000C267EECDA9EE0DC2FBEDCD2DF0C25BEEC321EECD3AEFC267EE473A56F3B8C25553
:20EE2000EE7AB7CA3FEE4F06002A54F3C5E5CD6D6BE1C1DA88EE116CF5CDC4EF2254F3CD8D
:20EE400025EFCD35EF2A4EF323224EF33A58F33259F3C359ED2192F2C36AEE21A9F2C36A07
:20EE6000EE214DF2C36AEE2135F2CD9157CDE5EECD7FEF0E153A5DF3473A5AF3A0CA82EEFC
:20EE80000E43CDC2EEC35DED2170F2CD91572A52F3EB2A50F3CDBE1FE121C0F2CD9157CDB8
:20EEA00035EFC921E5F2C315F0F5E52156F38677E1F1C363F0F5C5D5E54FCDC2EEE1D1C1C9
:20EEC000F1C9C5C33A6EF50000000B79B0C2C7EEF1C9E56F2600CDDBEEE1C9F5C5D5CDD404
:20EEE00039D1C1F1C9F53A57F3CDD2EECD2242F1C921F7EEC328EF0D1B4D20202053454E01
:20EF000044494E4720424C4F434B202320000D1B4D2020524543454956454420424C4F43A5
:20EF20004B20232000210EEFCD91572A4EF3CDDBEE3E0DE7C90E06C3C2EE010F00D5E5C53E
:20EF400001050DC5CD6D6DCA55EFCD7E6DC255EFC1C1E1D1C9010A00CDC6EEC10B79B0C226
:20EF600043EFC10B79B0C23FEF0DE1D1C9CD7072CA7CEFCDCB12FE03C8FE18C8AF3DC90107
:20EF80000100CD3DEFC0CD6DEFC8C37FEF2166F3C396EF2160F37EFE4DC2E61723C3E617F4
:20EFA0002160F3115BF61A3266F3010500C3C4EF384E3144AF3265F3326BF32167F311B05A
:20EFC000EF01040079B0C81A7713230BC3C4EFCD9157CD3E46D7C3E90FCD46213AC2FAEE54
:20EFE000FF32C2FACAEDEF21F9EFC38F56CD9E5AC383632106F0C3A055AF32C2FACD9E5A2E
:20F00000216857C315F0215957C315F021A5F0C315F0218FF0CD9157217157CDB127C31576
:20F02000EA21AAEA225EF321AAEAC37C5AE52A5BF37CB5E1C83EFFC9216CF30E00EB210099
:20F040000079C50608AC6729D253F03E10AC673E21AD6F05C247F0C1EB72247325230CC26E
:20F060003DF0C9F5C5D5E52A5BF3EB0600AA4F216CF3097EAB57245EEB225BF3E1D1C1F17A
:20F08000C946696C6520746F2073656E64200053656E640046696C6520746F20726563656E
:20F0A000697665200052656365697665000D0A46494C4520464F554E44202D2052454144CD
:20F0C0005920544F2053454E440D0A57414954494E472E2E2E000D0A202020202043524387
:20F0E00020524551554553542052454345495645440D0A000D0A434845434B53554D20526D
:20F100004551554553542052454345495645440D0A001B4D0D0709496E697469616C204EDD
:20F12000414B2074696D656F7574202320001B4D0D0709426C6F636B2041434B2F4E414B51
:20F140002074696D656F7574202320001B4D0D0709426C6F636B204E414B6B6564202D201A
:20F16000726573656E64202320001B4D0D070946696E616C2041434B2074696D656F757426
:20F18000202320000D0A0A072053454E44204F4B20286E6F7720696E205445524D206D6FF9
:20F1A0006465290D0A0046696C6520657869737473202D2065726173652028592F4E292022
:20F1C000000D0A46494C45204F50454E202D20524541445920544F20524543454956450DD1
:20F1E0000A00434845434B53554D20494E204546464543540D0A002020202020435243207F
:20F20000494E204546464543540D0A001B4D0D09535749544348494E4720544F2043484592
:20F22000434B53554D204D4F44450D0A0043524320436B536D1B4D0D0709526563656976A6
:20F24000652074696D656F7574202320001B4D0D07426164206865616465722072656365F4
:20F2600069766564202D207265747279202320000D0A074F7574206F66206D656D6F7279DC
:20F28000202D2066696C652064656C657465640D0A001B4D0D0709436865636B73756D207B
:20F2A0006572726F72202320001B4D0D07092020202020435243206572726F722023200017
:20F2C0000D0A0A072052656365697665204F4B20286E6F7720696E205445524D206D6F641E
:20F2E00065290D0A001B4D0D07425245414B206B6579202D000D4D2D31303020584D6F6422
:20F30000656D205854656E73696F6E2056657273696F6E20312E30300D0A202D207265760D
:20F3200069736564202D2030392F31312F3835202D0D0A28432931393835206279204A20D1
:0EF3400052204368656E6F776574680D0A0091
:00000001FF

--- Cut here --- LOAD.BA follows ----------------------------

10 GOTO 1000:REM a LOAD program for Intel .HEX files - John Chenoweth 09/11/85
300 IF LEN(HEX$)<>4 THEN POP:GOTO 9000 ELSE DIGITS=4:GOTO 310
302 IF LEN(HEX$)<>2 THEN POP:GOTO 9000 ELSE DIGITS=2
310 HSUM=0:FOR J=1 TO DIGITS
320 CV=ASC(MID$(HEX$,J,1))
330 IF CV>57 THEN CV=CV-7
335 CV=CV-48:IF CV<0 OR CV>15 THEN POP:GOTO 9000
340 HSUM=HSUM*16+CV
350 NEXT J
360 DX=HSUM:RETURN
700 DX=DX/256:DX=INT(DX):RETURN
800 TMPX=DX:GOSUB 700:DX=DX*256:DX=TMPX-DX:RETURN
1000 INPUT"Enter filename:";FIL$
1010 FIL$=LEFT$(FIL$,6)+".DO"
1020 OPEN FIL$ FOR INPUT AS 1
1030 ON ERROR GOTO 5000
1040 HP=0:LP=65535
1100 CHKSUM=0:HEX$=INPUT$(1,1):IF HEX$< >":" THEN PRINT"ERROR:on the ':' 
delimiter":GOTO 9900
1110 HEX$=INPUT$(2,1):GOSUB 302:CHKSUM=CHKSUM+DX:NUMBYT=DX
1120 HEX$=INPUT$(4,1):GOSUB 300:PNTR=DX:GOSUB 700:CHKSUM=CHKSUM+DX:DX=PNTR:GOSUB 800:CHKSUM=CHKSUM+DX
1130 HEX$=INPUT$(2,1):IF HEX$<>"00" THEN 4000
1160 IF PNTR < LP THEN LP=PNTR
1170 IF PNTR+NUMBYT-1 > HP THEN HP=PNTR+NUMBYT-1
1180 PRINT PNTR
1200 FOR B=1 TO NUMBYT
1210 HEX$=INPUT$(2,1):GOSUB 302:IF DX<0 OR DX>255 THEN PRINT:PRINT"ERROR:bad 
byte value":GOTO 9900
1220 POKE PNTR,DX:CHKSUM=CHKSUM+DX:PNTR=PNTR+1:NEXT B
1230 HEX$=INPUT$(2,1):GOSUB 302:CHKSUM=CHKSUM+DX
1240 DX=CHKSUM:GOSUB 800:IF DX <> 0 THEN PRINT:PRINT"ERROR:checksum":GOTO 9900
1250 HEX$=INPUT$(2,1):IF HEX$ <> CHR$(13)+CHR$(10) THEN PRINT "blew the 
CRLF":GOTO 9000 ELSE 1100
4000 IF HEX$<>"01" THEN PRINT "ERROR:on the reserved byte":GOTO 9900
4010 HEX$=INPUT$(2,1):IF HEX$<>"FF" THEN PRINT "ERROR:checksum":GOTO 9900
5000 REM here we create the .CO file
5010 CLOSE #1:FOR J=1 TO 7:BEEP:NEXT J
5020 PRINT " LOW POINTER =";LP
5030 PRINT "HIGH POINTER =";HP
5040 RA=LP:REM default run address
5050 PRINT "Just press ENTER for RUN at low pointer"
5060 INPUT"RUN ADDRESS ";RA
5070 SAVEM FIL$,LP,HP,RA:PRINT "DONE":MENU
9000 PRINT"ERROR:bad Intel .HEX format"
9900 CLOSE #1
9999 END

--- Cut here -------------------------------------------
Many programs reset the string areas.  Machine language programs
frequently use this space and it needs to be reset.  SETRAM does
just that for both the M100 and M200 (note to FLOPPY.CO users!!).
 I also added the K)eys option to restore the function keys in
BASIC back to sane settings.  A whole lot of programs zap these
suckers to WEIRD settings and they're a pain to restore.  Keep
this program around with XMD100.CO and you'll never go wrong.
--- Cut here --- SETRAM.BA follows -------------------------

10 'RAM Area Setting
15 ' line 70 was ... 256,59400
20 CLS:PRINT:PRINT" K)eys, Area  S)et or F)ree ?"
30 K$=INKEY$:IF K$="" THEN 30
40 K$=CHR$(ASC(LEFT$(K$,1)) AND 223)
50 IF K$="F" THEN CLEAR 256,MAXRAM: MENU
55 IF K$="K" THEN 90
60 IF K$<>"S" THEN BEEP:GOTO 30
70 IF PEEK(1)=171 THEN CLEAR 256,57500 ELSE CLEAR 256,59391
80 MENU
90 KEY 1,"Files"+CHR$(13)
100 KEY 2,"Load "+CHR$(34)
110 KEY 3,"Save "+CHR$(34)
120 KEY 4,"Run"+CHR$(13)
130 KEY 5,"List "
140 KEY 6,""
150 KEY 7,""
160 KEY 8,"Menu"+CHR$(13)
170 MENU