XModem file download

Started by Michau, September 03, 2010, 02:50 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Michau

I'm back :) Due to some business circumstances, I wasn't able to focus on the 610 programming in the past weeks. But now I have some free time again, and I'm back at work on the IEC routines.

Here's the first useful program I wrote - a utility that downloads files from PC via XModem protocol. I will be using it to upload compiled software from my PC to the 610, to save on burning EPROMs :)

100 print "Enter filename:" : input f$                                       
110 open 1,8,3,f$+",s,w"
200 open 2,2,3,chr$(26)+chr$(1)
210 print#2, chr$(21);
220 b = 1
300 gosub 500
310 if asc(c$) <> 1 goto 600
320 gosub 500
330 gosub 500
340 for i = 1 to 128
350 gosub 500
360 print#1, c$;
370 next
380 gosub 500
390 print "Received block "; b
400 b = b + 1
410 print#2, chr$(6);
420 goto 300
500 get#2, c$ : if st = 16 goto 500
502 if c$ = "" then c$ = chr$(0)
510 return
600 print#2, chr$(6);
610 close 1 : close 2


On PC, fire up HyperTerminal, select the COM port, and leave default settings (2400, 8N1). Select Transfer -> Upload file, choose XModem and browse to the file. Then click Upload.

On Commodore: run the program, and enter the name of the file to be saved (it must not exist). The download process now will start.

Of course, you will need an appropriate nullmodem cable, with DB9 female at one end, and DB25 male at the other. I bought such cable on Ebay for 5GBP.

Enjoy!