<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 05 Sep 2004 14:07:35 +0100
From   : jgh@... (Jonathan Graham Harston)
Subject: Re: Softkey definition memory

Andrew W <a.weston2@...> wrote:
> According to the BBC memory map I've got there are 255 bytes reserved
> for softkey definitions. If there are 9 function keys (excluding the
> cursor keys and Break) on the Beeb surely that would need 10*255? What
> happens in the event you define all 9?
 
First, there's *256*, not 255, bytes for function key definitions on the
BBC, secondly, there's *ten*, not nine, function keys excluding the cursor
keys and Break; there are sixteen in total. Thirdly, you're assuming that
you need 255 bytes for each function key definition. You don't. You only
need as much space as is needed for each definition, plus 17 index bytes
to define the start and end of each string.
 
In the event you define function key strings such that *all the strings
added together*[1] are longer than 244 bytes, *then* you get the "Bad key"
error, number 251.
 
FOR A=0 TO 15:OSCLI "KEY "+STR$A(A)+" "+STRING$(14,"*"):NEXT
 
will work, using 16*14+17=241 bytes of space, whereas
 
FOR A=0 TO 15:OSCLI "KEY "+STR$A(A)+" "+STRING$(15,"*"):NEXT
 
overflows, trying to use 16*15+17=257 bytes of space.
 
[1] You actually need enough space for all currently defined key strings
*plus* the new string you are string to assign.
 
-- 
J.G.Harston - jgh@...                - mdfs.net/User/JGH
Badly formed email is deleted unseen as spam
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>