"Option AtnChar &H00" Apparently Disables ZxCm

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
Innovator_99
Posts: 12
Joined: 14 February 2009, 19:12 PM

"Option AtnChar &H00" Apparently Disables ZxCm

Post by Innovator_99 »

The ZBasic language reference indicates that Option AtnChar and Register.AtnChar can accept values from &H00 through &H1F, and doesn't indicate that &H00 will be treated any differently than the other allowable values.

However, after compiling for the ZX44t using IDE 1.7.5 and compiler 4.3.13, it seems that Option AtnChr &H00 disables ZxCmdMode. Specifically, application calls to ZxCmdMode are compiled without error but don't actually do anything, and the compiled application does not automatically invoke ZxCmdMode if &H00 appears in the serial stream.

What I was hoping was that Option AtnChr &H00 would have the same effect as writing &H00 to persistent &H13 in a circa-2012 ZX24r, i.e. that it would enable application calls to ZxCmdMode without linking code to automatically trap an ATN character. That way my application could detect the ATN character itself and perform some housekeeping (e.g. writing data to persistent memory) before calling ZxCmdMode.

So far, the only way I've found to approach this with the current compiler and ZX44t is as follows:
  • - I use Option AtnChr to specify an allowable non-zero value *other* than the desired ATN character in order to enable ZxCmdMode().
    - I include code to trap the desired ATN character, perform the required housekeeping, and call ZxCmdMode().
    - I instruct the IDE to use the desired ATN character (not the Option AtnChar value) for download.
This works, but carries the risk that command mode will be triggered without the required housekeeping being performed if the byte specified in Option AtnChr happens to appear in the serial stream.

Is there a way to enable application-controlled entry into ZxCmdMode that doesn't present this risk?

TIA,
Phil
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: "Option AtnChar &H00" Apparently Disables

Post by dkinzer »

Innovator_99 wrote:Is there a way to enable application-controlled entry into ZxCmdMode that doesn't present this risk?
You've discovered an oversight that went undetected. You can work around this problem until it is corrected in the compiler like this:

Code: Select all

Sub Main()
#c
    ZB_REQUEST_ENTRY(runMonitor);
#endc
    Call ZXCmdMode()
End Sub
The "magic" comprises the three lines beginning with #c. They can be put in any routine but it is recommended to put them in the Main(). The effect of these lines is to pull in some required code from the ZBasic System Library. Without that code, the call to ZXCmdMode() is effectively a NoOp.
Last edited by dkinzer on 28 December 2015, 18:10 PM, edited 1 time in total.
- Don Kinzer
Innovator_99
Posts: 12
Joined: 14 February 2009, 19:12 PM

Post by Innovator_99 »

Great...this works fine for now. Thanks yet again!

Cheers,
Phil
Post Reply