transfer from pc to ql is it possible

Helpful tips and guides, also new users can ask for help here.
Traindriver69
ROM Dongle
Posts: 28
Joined: Mon Feb 16, 2015 8:42 pm

Re: transfer from pc to ql is it possible

Postby Traindriver69 » Sat Feb 28, 2015 9:40 pm

Any help would be brilliant i would like to expand the memory but again it is finding one


User avatar
ppe
Bent Pin Expansion Port
Posts: 88
Joined: Tue Dec 14, 2010 10:48 am
Location: Espoo, Finland

Re: transfer from pc to ql is it possible

Postby ppe » Sat Feb 28, 2015 10:20 pm

Mr vanpeebles seems to be reporting there's also 512 sram on the Qubide clone card so that would sort you out pretty nicely.


User avatar
ppe
Bent Pin Expansion Port
Posts: 88
Joined: Tue Dec 14, 2010 10:48 am
Location: Espoo, Finland

Re: transfer from pc to ql is it possible

Postby ppe » Tue Mar 03, 2015 9:01 pm

So I tested a few things. The constraints (128k black box / only microdrives) are rather severe, though, so results are not exactly stellar :)

First off, copying binary files with "copy" command direct to microdrive from the serial port seems to be a non-starter. Small text files (such as small SuperBasic programs) are ok. So, we need another way to transfer the QTerm communication binary to the QL. There are many ways to do this, but a couple of straightforward ones are:
- uuencode the qterm binary, create a uudecode basic program, transfer the uuencoded binary and decode it using the basic program
- create an xmodem receiver program in superbasic and use that to receive the qterm binary

UUdecode and Xmodem, despite their simplicity, run very, very slowly when implemented in superbasic. I tried both mechanisms and the xmodem is slightly faster. As expected, the bottleneck is not the serial port speed but the receiving superbasic program's running speed. Granted, I did not spend a lot of time optimizing but still, total transfer time for qterm_cde which is the main binary that needs to be trasnferred is approximately 30 minutes (running the serial port at 1200 baud). The binary is 23172 bytes so the effective transfer speed is around 12 bytes per second... One of the very obvious problems while running the transfer is that while writing to microdrive you get transmit errors on the serial port so you end up with a *lot* of retries. But, thanks to the rudimentary retry/error correction you still end up with a valid binary.

Once you have the qterm binary on microdrive, you can bump up the transfer speed a bit (I was able to do 4800 baud) and start using the more advanced XModem-1k protocol which results in a better efficiency. The bottleneck is still the microdrive. Again, you are going to see block errors while qterm writes to microdrive. The obvious way to prevent this would be to use a ramdisk for the received file but with a 128k machine it is not such an attractive option.

So yes, you are able to transfer stuff from PC to a plain old 128k black box ql and microdrives but it takes a a lot of patience :) Also, since you will be unable to run unzip on the unexpanded black box, you will need to unzip the binaries/files on an emulator on the pc before transferring them over. And, you need to set job headers on any executable files.

IF you still want to do this, I can post detailed step-by-step instructions and the SuperBasic XModem receiver program I wrote.

Anyway, it's been a lot of fun coming up with a solution to this problem.

Cheers,
Petri


RWAP
RWAP Master
Posts: 2450
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: transfer from pc to ql is it possible

Postby RWAP » Wed Mar 04, 2015 8:47 am

Why not transmit the size of the program first as a header, and then set that amount of memory aside with RESPR - you could then POKE the incoming bytes into memory and only save it to microdrive with SEXEC (or SBYTES) once the transfer is complete?

That would prevent the loss of data when writing to the microdrive.

The first file to transfer could even be a RAM disk code if you preferred to do that...


User avatar
ppe
Bent Pin Expansion Port
Posts: 88
Joined: Tue Dec 14, 2010 10:48 am
Location: Espoo, Finland

Re: transfer from pc to ql is it possible

Postby ppe » Wed Mar 04, 2015 11:47 am

Hi Rich,

yes, the alternative method would be to respr and poke, but since the initial superbasic program is there for the sole purpose of transferring QTerm (i.e. a proper file transfer program) over I couldn't be bothered to elaborate on the trivial implementation :) I'll be happy to share the code if someone wants to write a fancier version.

Cheers,
Petri


Traindriver69
ROM Dongle
Posts: 28
Joined: Mon Feb 16, 2015 8:42 pm

Re: transfer from pc to ql is it possible

Postby Traindriver69 » Fri Mar 06, 2015 8:14 am

Hi all
I have now ordered a miracle systems 512k expansion card so if ppe could please post a step by step guide and the program I need I would be very grateful.


User avatar
ppe
Bent Pin Expansion Port
Posts: 88
Joined: Tue Dec 14, 2010 10:48 am
Location: Espoo, Finland

Re: transfer from pc to ql is it possible

Postby ppe » Sun Mar 08, 2015 8:30 pm

Hey,

it's been a long time but there's been very little time for hobbies lately :(

Anyway, I got some spare time this weekend so I decided to implement the xmodem receiver in assembly. It's now faster, more reliable and first copies the received binary to memory to prevent errors during receiving due to spinning microdrive. You should be able to download the Qterm binary using this new version in just a couple of minutes.

Step by step instructions, apologies if I'm being too verbose with the explanations:

1) Download TeraTerm 4.86 for your PC from here and install it
2) Download the SuperBasic loader and frontend for XModem receiver from here
3) Download QTerm distribution from Dilwyn's site Unzip using your PC, the file you need from the zip is qterm_cde. This is the binary that is a proper communication and file transfer program that knows XModem-1k (a better version of Xmodem) and is able to transfer files both ways
4) Download a RAM disk driver from Dilwyn's site Unzip it on your PC, the binary you are going to need is called ramdisc_cde. Read the manual inside the zip. This will give you a RAM1_ device that you can use to temporarily store files received using QTerm. Again, using a RAM disk is a good idea to prevent transfer errors and retries due to spinning microdrives if you download direct to a cartridge. Rather, you are better off downloading to RAM disk and then copying to a microdrive
5) Hook up your QL and PC using the serial cable. Without knowing the specifics about how your cable is wired I can't say if it works in ser1 or ser2 port on your QL. You may need to try both
6) Fire up TeraTerm on your PC. When it starts, choose "Serial" as the connection type. The default is "TCP/IP". Choose the correct COM port on your PC.
7) Change Serial port settings. To try and prevent any errors during the initial transfer, go to Setup/Serial Port and choose correct port, 1200 Baud Rate, Data 8-bit, Parity None, Stop 1 bit, Flow control None (you may be able to use "hardware" depending on how your cable is wired
8) On the QL, set the baud rate: "BAUD 1200"
9) Now, let's transfer the SuperBasic loader "xmrecv_bas" to the QL. On the QL, load the basic program through serial port: "LOAD ser1z" N.B. you may need to try port 2 as stated previously. The "z" parameter is rather important, it will let you stop the transfer in an orderly fashion from the PC. The QL will now seem to lock up. It is waiting for data through the serial port.
10) On the PC TeraTerm, choose File/Send file... and pick xmrecv_bas from wherever you saved it to
11) You should see a transfer progress window. Once that closes, press Ctrl-Z (hold Ctrl key and press 'z' key) in the TeraTerm window.
12) Once the file is loaded , you should again see a flashing cursor on the QL. This should only take a minute
12 a) You can now bump up transfer speed a bit: try "BAUD 2400" on the QL and change serial port speed in TeraTerm to match the speed set the QL ("Setup/Serial Port").
13) Now you have a file receiver on the QL. To load the machine code, enter: "load_code".
14) After machine code has loaded, we'll load the QTerm binary - enter: "recv" on the QL. Give the received file a name when prompted, e.g "mdv1_qterm_cde". When prompted for the serial port device name, enter "ser1r", NOTE! this time you need "r", not "z" because we are receiving a binary file
15) When you see the "Press enter to start receiving" prompt, go to TeraTerm and choose "File/Transfer/XMODEM/Send...". Make sure "Checksum" is selected as "Option" at the bottom of the file chooser dialogue box. Choose the qterm_cde binary file from where you unzipped it. Once you have selected the file you should see an "XMODEM Send" window pop up. Now press Enter at the QL prompt. If all goes well, you should see progress messages on the QL and the progress bar should advance in TeraTerm, speed should be around 220 bytes per second or so. The transfer will take around three minutes, I believe. Once the transfer is over, the receiver will save the received binary.
16) Now repeat the process (steps 14-15, no need to reload the code with "load_code") for the ramdisc binary, save it as "mdv1_ramdisc_cde"
17) You now have a RAM disk program and a QTerm binary on microdrive, create a boot file for them so that they load automatically once you start the ql with the microdrive in drive 1. Enter "NEW" and then type in a boot program, something like this file. Save the boot program as "mdv1_boot"
18) Reset the QL and boot with the new boot file. It should print messages that it loads the qterm binary and ramdisc binary.
19) format a ram disk to receive a file to, e.g.: "FORMAT RAM1_200" (for a 100k RAM disk)
20) type TERMINAL and you'll fire up Qterm, configure settings using F3, set baud rate using F3/B, set port using F3/S Configure port 1 or 2, No parity and 8 bits data. Configure RAM disk as the target through F3/U and enter ram1_ as default device. Now you can send and receive files using XMODEM-1k. Transfers in QTerm are initiated using F2 and then choosing 3 for XMODEM-1k. Then select Send or Receive as appropriate. On TeraTerm side, you should now pick "1k" as transfer type Option (and binary checkmarked) in the XMODEM Send or Receive dialogue window.
21) Experiment with different speed of transfers. I can use the 4800 baud rate on my non-Hermes chipset (regular) QL. This typically results in a few transfer errors but not too many.

Theoretically, you should always first start the "Send" side first and then initiale "Receive" on the other machine but XMODEM does also recover if you do it the other way around if you are fast enough in initiating the "Send" process after "Receive".

Be sure to transfer files first to RAM disk and then copy them over to microdrive.

Whew, that was easy, wasn't it.... :)

Unzip will *just* fit on a microdrive, but I think it will need ToolKit II (again, from Dilwyn's site) to run properly. Remember, if you transfer any EXECable programs to the QL, they need to be unzipped using a QL Unzip program so that their file headers are set properly on the QL. There are quite a few threads on this subject on the forums.

Hope this helps. I tested all the steps with a bare bones 640k QL and a PC and did not have any problems. I guess having a correctly wired serial cable and selecting the right port on the QL are the cornerstones.

Cheers,
Petri


User avatar
ppe
Bent Pin Expansion Port
Posts: 88
Joined: Tue Dec 14, 2010 10:48 am
Location: Espoo, Finland

Re: transfer from pc to ql is it possible

Postby ppe » Sun Mar 08, 2015 8:43 pm

And just in case somebody is interested in the ASM source code for the xmodem bit, it can be downloaded here. Compile using George Gwilt's Lite Assembler. It's a quick and dirty version so probably has quite a few bugs in there.


User avatar
belg4rion67
Trump Card
Posts: 179
Joined: Sun Feb 20, 2011 6:15 pm
Location: Milan - Italy

Re: transfer from pc to ql is it possible

Postby belg4rion67 » Mon Mar 09, 2015 10:42 am

Very pretty work !
Great bit of programming for original BBQL
Thank you very much
Paolo


Only original hardware! :)
User avatar
ppe
Bent Pin Expansion Port
Posts: 88
Joined: Tue Dec 14, 2010 10:48 am
Location: Espoo, Finland

Re: transfer from pc to ql is it possible

Postby ppe » Mon Mar 09, 2015 4:53 pm

Hi Paolo, thank you for your kind words! It's just a quick hack but hopefully useful for someone.

Cheers,
Petri


belg4rion67 wrote:Very pretty work !
Great bit of programming for original BBQL
Thank you very much
Paolo



Return to “Help for New Users”

Who is online

Users browsing this forum: No registered users and 1 guest