Could someone please tell me whether there is a location in QDOS/SMSQ guaranteed
to always yield a zero word? Ie PEEK_W(<location>) = 0. (And while were at it, for a
rainy day, a long word?)
peek-a-oh
peek-a-oh
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Re: peek-a-oh
The best place to PEEK_W a zero from is one you POKE_Wd a zero before.
(I'm a bit lost on what this could be good for, though)
Tobias
(I'm a bit lost on what this could be good for, though)
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: peek-a-oh
Hehe. Its no big deal, but a certain algorithm Im using requires a sentinel; a pointer to
some lowest value in memory. I thought if there were any spare zeros kicking around it
would save me the trouble (code and two bytes) to use that instead. I assumed
(erroneously, it appears) that such a technique would not be considered bizarre in this
august company
some lowest value in memory. I thought if there were any spare zeros kicking around it
would save me the trouble (code and two bytes) to use that instead. I assumed
(erroneously, it appears) that such a technique would not be considered bizarre in this
august company

Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Re: peek-a-oh
On the QL there used to be a "safe" zero word at 163842, but thats gone now
Not my algorithm, not my idea!

Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
- janbredenbeek
- Super Gold Card
- Posts: 673
- Joined: Wed Jan 21, 2015 4:54 pm
- Location: Hilversum, The Netherlands
- Contact:
Re: peek-a-oh
You could try the first entry of the slave block table, which is pointed to by SV.BTBAS ($28058). This will always be marked 'unusable' (all zeroes) since this entry corresponds to the first slave block in RAM, which starts at $28000 (or $30000 with dual-screen Minerva) and is unusable because the system variables start there. I cannot give any guarantee that this works in every version of SMSQ/E though...
One method that is guaranteed to work is calling MT.ALCHP with a small value (16 or so) which returns a pointer to an allocated area that is guaranteed to contain zeroes.
Jan.
One method that is guaranteed to work is calling MT.ALCHP with a small value (16 or so) which returns a pointer to an allocated area that is guaranteed to contain zeroes.
Jan.
Re: peek-a-oh
Thanks for the tip! However, I sensed such a chill wind of disapproval at the notion, that I quickly had to disown the idea (Not my pig, not my farm..)! So I re-wrote the whole thing and eliminated the problemjanbredenbeek wrote:You could try the first entry of the slave block table, which is pointed to by SV.BTBAS ($28058). <>

Yes, I guess were not poking Spectrums anymore, so throwing away a few good bytes - who cares?One method that is guaranteed to work is calling MT.ALCHP with a small value (16 or so) which returns a pointer to an allocated area that is guaranteed to contain zeroes.

Thanks for all replies!
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen