Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
V2.0 - DTR-less downloading
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Forum Index -> ZX-24
Author Message
stevech



Joined: 23 Feb 2006
Posts: 688

Posted: 27 January 2007, 6:30 AM    Post subject: Reply with quote

yes.
-m confused me for a moment!

I like it.
Back to top
dlh



Joined: 15 Dec 2006
Posts: 287
Location: ~Cincinnati

Posted: 27 January 2007, 17:59 PM    Post subject: Trigger command mode from code Reply with quote

It should be possible to trigger command mode from within a program by doing 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 does have the disadvantage that the number of writes to persistent memory is limited to 100,000 and this uses 2 writes each time it is invoked. Still, that means 136 years at one download cycle per day.

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.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 27 January 2007, 18:19 PM    Post subject: Re: Trigger command mode from code Reply with quote

dlh wrote:
It should be possible to trigger command mode from within a program by doing this...

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.

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.
Back to top
dlh



Joined: 15 Dec 2006
Posts: 287
Location: ~Cincinnati

Posted: 27 January 2007, 18:35 PM    Post subject: Re: Trigger command mode from code Reply with quote

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.

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.
Back to top
stevech



Joined: 23 Feb 2006
Posts: 688

Posted: 28 January 2007, 4:19 AM    Post subject: Reply with quote

The VM runs command mode/downloads at 115Kbaud? I didn't realize that - since I'd expect that quite a few PCs cannot reliably do that speed, or do so through certain cables.
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 06 May 2007, 11:19 AM    Post subject: Reply with quote

Is it possible to trigger the DTR-less download with ZLoad.dll?
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 06 May 2007, 17:12 PM    Post subject: Reply with quote

Don_Kirby wrote:
Is it possible to trigger the DTR-less download with ZLoad.dll?
Yes, but be forewarned that it is still experimental.

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:
long CALLBACK ZXSetParameter(long id, long value);

The first parameter should be ZX_PARAM_ATN_CHAR (defined in zxcomm.h) and the second parameter should be the ATN character 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.
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 06 May 2007, 18:12 PM    Post subject: Reply with quote

Don, how would that translate to VB6? I don't have Visual C to compile it.

-Don
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 07 May 2007, 16:21 PM    Post subject: Reply with quote

Don_Kirby wrote:
[H]ow would that translate to VB6?
Following the same pattern as for the others it would be
Code:
Declare Function ZXSetParameter(long id, long value) Lib "zload.dll" ( _
  ByVal id As Long, ByVal val As Long) As Long
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 10 May 2007, 23:03 PM    Post subject: Reply with quote

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
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 11 May 2007, 7:34 AM    Post subject: Reply with quote

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.
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 11 May 2007, 8:58 AM    Post subject: Reply with quote

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
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 11 May 2007, 11:25 AM    Post subject: Reply with quote

Don_Kirby wrote:
Does the call to ZXDownloadEX need to be modified in any way for no DTR downloads?

Yes, sorry. You need to add the value ZX_NO_DTR (&H20000) to the flags parameter.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZX-24 Time synchro. with the server - Timezone/DST with your computer
Goto page Previous  1, 2
Page 2 of 2

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group