V2.0 - DTR-less downloading
Trigger command mode from code
It should be possible to trigger command mode from within a program by doing this...
It also allows use of a single character trigger without any possibility that it will accidently be triggered by the normal data stream.
There are probably a few details I've overlooked but I'll try to write some code to test this.
- 1. Send a command (from PC) to start the procedure.
2. Switch PC to 115200.
3. Write a value to address 19 of persistent memory.
4. Stuff the same value into the COM1 input queue.
5. Download.
6. Write &HFF to address 19.
7. Reset.
It also allows use of a single character trigger without any possibility that it will accidently be triggered by the normal data stream.
There are probably a few details I've overlooked but I'll try to write some code to test this.
Re: Trigger command mode from code
The sequence is a bit tricky because of the speed switching involved. The ATN character has to be sent by the PC at the baud rate at which the ZX is listening in "normal" mode - 19,200 by default but it could be different if your application changes it. After the ATN character is sent, the PC can delay a bit, switch to 115.2K baud (the speed in command mode), purge its input buffer and then send an ESC (&H1b). If the ZX responds with a command mode prompt (greater than symbol, &H3e) it is in command mode and awaiting a command.dlh wrote:It should be possible to trigger command mode from within a program by doing this...
When you are finished with command mode, you tell the ZX to begin executing (via a WatchDog reset) by sending it an Execute command (&H21). Immediately after sending that command, the PC would switch back to 19,200 baud.
The issue of write cycle limitation of Persistent memory would be avoided and the process simplified slightly if an "enter command mode" API were available. That should be fairly simple to implement.
- Don Kinzer
Re: Trigger command mode from code
I'm trying to eliminate the need to send the ATN character from the PC becaiuse my app (and I suspect many apps) is ALWAYS likely to trigger ATN accidentally. I'll send a command (2 bytes or more) using my normal communications protocol and then I'll do the little dance I described to get the ZX into command mode. Of course, it would be simplified if I could just toggle ATN using PulseOut and simplified even further with an API function.dkinzer wrote:The sequence is a bit tricky because of the speed switching involved. The ATN character has to be sent by the PC at the baud rate at which the ZX is listening in "normal" mode - 19,200 by default but it could be different if your application changes it.
Yes, but be forewarned that it is still experimental.Don_Kirby wrote:Is it possible to trigger the DTR-less download with ZLoad.dll?
Before commencing a download, you have to make a call to set a parameter, specifically, the ATN character. You do that with the entry point
Code: Select all
long CALLBACK ZXSetParameter(long id, long value);
The file zload.c demonstrates the use of the call above to support the -a option for zload.exe that implements the ATN character.
- Don Kinzer
Following the same pattern as for the others it would beDon_Kirby wrote:[H]ow would that translate to VB6?
Code: Select all
Declare Function ZXSetParameter(long id, long value) Lib "zload.dll" ( _
ByVal id As Long, ByVal val As Long) As Long
- Don Kinzer
It seems that I'm not quite up to speed on this yet. Using the format provided in the ZLoad VB sample, I make the call to set the ATNChar, then proceed with the download as normal.
I can perform a DTR-less download through the IDE and command line, and I can trigger it via a Shell call in VB. I can successfully download/update using the DLL from VB with DTR.
You did mention that it's still experimental... Perhaps there in lies the difficulty?
-Don
I can perform a DTR-less download through the IDE and command line, and I can trigger it via a Shell call in VB. I can successfully download/update using the DLL from VB with DTR.
You did mention that it's still experimental... Perhaps there in lies the difficulty?
-Don
I'm unclear as to where you're having difficulty. It seems that you can perform a DTR-less download using the zload utility. This would imply that you have also successfully set the ATN character in the device itself. (Obviously, the device and the downloader must both be configured to use the same ATN character.)
As far as using the DLL, you should set the ATN character as early as possible. I don't recall if it matters if it is set before or after the port is opened but I would suggest doing so before opening.
As far as using the DLL, you should set the ATN character as early as possible. I don't recall if it matters if it is set before or after the port is opened but I would suggest doing so before opening.
- Don Kinzer
Basically, I am attempting to add the no DTR download ability to the included VB sample. I am calling ZXSetParameter before the call to download/update. I consistently get "Device failed to respond to the ATN signal." Does the call to ZXDownloadEX need to be modified in any way for no DTR downloads?
-Don
-Don