PDA

View Full Version : Xmodem CRC16 for 8080/Z80 CP/M file Transfer



tma
March 24th, 2016, 09:46 AM
Greetings,

I hope this information is not old. I searched the forum and didn't find anything on Xmodem - I hope I didn't miss something.

I have had success with using Xmodem CRC16 for transferring files in and out of my Imsai 8080 which works nicely for acquiring files from and backing up to the outside world. Previously I tried PIP and found it to be very slow requiring the injection of character and line delays. To acquire a large source listing file I found I needed to break the file up into chunks small enough to fit into the buffer as otherwise data was lost during disk write cycles. This required patching the source code back together with my favorite CP/M line editor. The PIP process was prone to error and I couldn't figure out how to use it for binary file transfers.

For Xmodem I am using a 9600 Baud port and the transfer throughput runs around 6 KB/S. It interfaces with Windows XP Hyperterminal quite nicely. I have transferred a number of files and have not noticed any errors. I transferred a COM file out and then back in again and it still ran OK on the Imsai.

I found this news group post describing an Xmodem source listing for 8080/Z80 CP/M machines:

https://groups.google.com/forum/#!topic/comp.os.cpm/1EdJzNh1ekM

The source listing looked very professional to me so I decided to try and get it to run on my Imsai. I decided direct communications to the port would be better than passing data via CP/M using the PUNCH/READER API. This required modifying the source listing a little with simple IO interface routines with the appropriate port status and data bus addresses. Sample interface routines were given in the source code comments which made this process easy. The most difficult part for me after I managed to get the source code loaded into the Imsai was re-learning how to use the line editor and CP/M assembler tools (it has been over 35 years since I did this, (:/))). Getting the source listing fixed back up with the characters that were lost during the PIP file transfer required a few re-assembler cycles. The Xmodem source listing can be found here:

https://docs.google.com/file/d/0B-XdfCubTNJJMXlrVHA4WHRvVjQ/edit?usp=sharing


A special thanks goes to Martin Eberhard for his good work and for posting this source code!

Best Regards,
tma

deramp5113
March 25th, 2016, 08:06 AM
Martin has updated his XMODEM utility since the version you referenced in your post. Now, a parameter file (plain text file) configures XMODEM at run-time to work with most any serial port configuration you could have. This means you don't have to edit or assemble the original source file to make XMODEM work on different hardware configurations.

Here's a link to the new version: http://deramp.com/downloads/index.php?dir=misc%2Fsoftware%2Fxmodem%2F

Mike

tma
March 29th, 2016, 09:50 PM
Greetings Mike,

Many thanks for bringing this update to my attention! I have downloaded the later version.

As you stated it appears the cfg file could match most any serial port. In my case the dual-serial/dual-parallel port card is by Solid State Music. With it the Baud rate and data parameters are set via hardware strapping options thus all I should need to do is update the cfg file /P option with port numbers and ready status mask info. This would have saved me some effort but I must admit I had fun re-learning how to edit and assemble under CP/M. The extra time spent provided a useful refresher.

The most difficult effort was getting the source file loaded into the IMSAI. As mentioned above I needed to split the source code up to fit into the IMSAI PIP RAM buffer then patch it back together. I broke it down into four files then I used a powerful freeware Windows terminal program called RealTerm to transfer it in via PIP. RealTerm permits one to insert character and end-of-line delays. I used 10mS character and 15mS end-of-line delays which reduced the 9600 Baud port throughput down by about 10 times. Even at this slow rate a few characters were still dropped during the transfer. But the files were easy to fix up with the CP/M editor. Now that I have Xmodem working it will be simple to transfer the updated version into the IMSAI. It is very easy to do now when running Xmodem. This file transfer ability reward was certainly worth the effort!

Thanks Again,
tma





Martin has updated his XMODEM utility since the version you referenced in your post. Now, a parameter file (plain text file) configures XMODEM at run-time to work with most any serial port configuration you could have. This means you don't have to edit or assemble the original source file to make XMODEM work on different hardware configurations.

Here's a link to the new version: http://deramp.com/downloads/index.php?dir=misc%2Fsoftware%2Fxmodem%2F

Mike


Martin has updated his XMODEM utility since the version you referenced in your post. Now, a parameter file (plain text file) configures XMODEM at run-time to work with most any serial port configuration you could have. This means you don't have to edit or assemble the original source file to make XMODEM work on different hardware configurations.

Here's a link to the new version: http://deramp.com/downloads/index.php?dir=misc%2Fsoftware%2Fxmodem%2F

Mike

deramp5113
March 30th, 2016, 08:19 AM
I have written numerous versions of two programs, PCGET and PCPUT, for a wide variety of serial boards. These are essentially XMODEM pre-configured to receive a file from a PC (PCGET) or write a file to a PC (PCPUT). What serial board are you using in your IMSAI?

Mike

tma
April 3rd, 2016, 01:25 PM
Hi Mike,

My IMSAI IO board was a kit from Solid State Music, if I recall correctly it is a model IO4. It provides two RS232 serial ports and two parallel ports. As mentioned above the Baud rate and data settings for the serial ports are hardware selected via wired strapping options.

Nice to hear that there are alternative Xmodem protocol file transfer CP/M programs. The single Xmodem.com application I mentioned here will do file transfers in either direction using either CRC16 or checksum modes as determined by command line switches. I have the impression that your PCGET and PCPUT programs provide the equivalent functionality. Great stuff!

Many thanks!
tma




I have written numerous versions of two programs, PCGET and PCPUT, for a wide variety of serial boards. These are essentially XMODEM pre-configured to receive a file from a PC (PCGET) or write a file to a PC (PCPUT). What serial board are you using in your IMSAI?

Mike

bokmann
July 2nd, 2016, 07:42 AM
As you stated it appears the cfg file could match most any serial port.


I'm trying to get this to work with CP/M running on a custom Z80 kit from http://cpuville.com/computer_details.html

I can SEND files using the console's serial port with 'xmodem <filename> /X0 /Q /S', but when I try to RECEIVE a file, I'm running into an issue... I start the transfer, then go to my terminal software's send, but it just sits there waiting for the receiver to start.

Looking up the XModem protocol, I see the transfer is controlled by the receiver... and that the receiver should sit there, sending an ASCII 'c' every three seconds until the sender acknowledges, but this software only sends the 'c' once (and much more quickly than I can select the file to send on my end). It also only seems to send the 'c' when I'm not in quiet mode, but I'm not sure thats actually an issue or not.

Has anyone successfully used this to receive files from a console serial port, or have I found a legit bug?

Thanks,

-db

Randy McLaughlin
July 2nd, 2016, 12:43 PM
I'm trying to get this to work with CP/M running on a custom Z80 kit from http://cpuville.com/computer_details.html

I can SEND files using the console's serial port with 'xmodem <filename> /X0 /Q /S', but when I try to RECEIVE a file, I'm running into an issue... I start the transfer, then go to my terminal software's send, but it just sits there waiting for the receiver to start.

Looking up the XModem protocol, I see the transfer is controlled by the receiver... and that the receiver should sit there, sending an ASCII 'c' every three seconds until the sender acknowledges, but this software only sends the 'c' once (and much more quickly than I can select the file to send on my end). It also only seems to send the 'c' when I'm not in quiet mode, but I'm not sure thats actually an issue or not.

Has anyone successfully used this to receive files from a console serial port, or have I found a legit bug?

Thanks,

-db

Xmodem is OK but by far the best way to transfer via serial ports is move-it.

Move-it runs on CP/M 80, CP/M 86, and DOS.

It has a bit of the flavor of FTP, you can get local or remote directory - even a way to auto start a remote CP/M program (by xfering a $$$.sub file).

Move-it has multiple sites with it available as well as the manual.

http://maben.homeip.net/static/s100/software/woolf/index.html


PS I always used a console port to capture a hexified version then use load filename.hex to convert back to binary to do the initial xfer to the target site.



Randy

deramp5113
July 3rd, 2016, 05:17 AM
In general, it is best to set up a config file and use direct port I/O (X2 option) since there is a very good chance that the console input routine in your BIOS strips the msbit and XMODEM requires 8 bit transfers. Although, I don't believe this would cause the not-starting symptom you're seeing.

Which version of XMODEM did you download?

Mike

deramp5113
February 7th, 2018, 07:07 PM
Martin has updated his XMODEM utility since the version you referenced in your post. Now, a parameter file (plain text file) configures XMODEM at run-time to work with most any serial port configuration you could have. This means you don't have to edit or assemble the original source file to make XMODEM work on different hardware configurations.

Here's a link to the new version: http://deramp.com/downloads/index.php?dir=misc%2Fsoftware%2Fxmodem%2F

Mike

Here is an updated link to the XMODEM program mentioned: http://deramp.com/downloads/misc/software/xmodem/

Mike

rlauzon
October 18th, 2018, 03:26 AM
The new link is here: http://deramp.com/downloads/misc_software/xmodem/