Hi.
I'm writing a routine that requires the ESC to be set to off. (*ESC OFF.) However, the routine needs to establish whether the ESC has been set to off or on before it starts so that it can set it to the previous state on exiting, whether that was off or on. Is there a way to check the ESC state?
Matt
Establishing the ESC state
Re: Establishing the ESC state
Hi Matt,
I'd hoped this would be listed on this wiki page:
http://www.bbcbasic.co.uk/wiki/doku.php ... =variables
but unfortunately it wasn't. I tried extending it with this code:
And it looks like byte 1019 toggles between 0 (ESC ON) and 64 (ESC OFF).
Byte 384 also changes, but that's expected: the wiki says it tells you what statement you are on!
Without documentation, I don't know what that byte is doing, but judging from it being 0/64, not 0/1, it might well be a flag byte of some sort, so you'd probably need to check bit 7 specifically - the other bits may well record other settings.
Hope that's helpful and not to misleading - test with care - or better still, ask Richard directly (and report back?).
Best wishes,
D
I'd hoped this would be listed on this wiki page:
http://www.bbcbasic.co.uk/wiki/doku.php ... =variables
but unfortunately it wasn't. I tried extending it with this code:
Code: Select all
FOR x%= 0 TO 1023
*ESC ON
n%=?x%
*ESC OFF
f%=?x%
IF n%<>f% THEN
PRINT x%.n%,f%
*ESC ON
n%=?x%
PRINT n%
ENDIF
NEXT x%
*ESC ON
Byte 384 also changes, but that's expected: the wiki says it tells you what statement you are on!
Without documentation, I don't know what that byte is doing, but judging from it being 0/64, not 0/1, it might well be a flag byte of some sort, so you'd probably need to check bit 7 specifically - the other bits may well record other settings.
Hope that's helpful and not to misleading - test with care - or better still, ask Richard directly (and report back?).
Best wishes,
D
-
- Posts: 114
- Joined: Mon 16 Apr 2018, 06:17
Re: Establishing the ESC state
Richard's reply suggested that the 30th bit of the @flag% variable should indicate the ESC state.
To quote:
Also, I would just like to thank Richard for his advice.
Matt
To quote:
This does seem to work, so hope it will help anyone else as well[T]he 'ESC disabled' flag is bit 30 of @flags%:
Although that may not be explicitly documented, one might guess that isCode: Select all
*ESC OFF PRINT ~@flags% *ESC ON PRINT ~@flags%
where it would be because the 'Escape pending' flag *is* documented as
being the MS bit of @flags% (the next higher bit).
Also, I would just like to thank Richard for his advice.
Matt
Re: Establishing the ESC state
Thanks, Matt, I thought it would be in a logical place, and that is indeed a much more logical place...

D

D