My struggles with compilers...

Anything QL Software or Programming Related.
User avatar
Sparrowhawk
Super Gold Card
Posts: 645
Joined: Wed Dec 15, 2010 12:33 pm
Location: @131072
Contact:

Re: My struggles with compilers...

Post by Sparrowhawk »

I really liked QLib in the day, for one main reason: it allowed computed RESTORE commands which was great if you had lots of data in DATA statements. For example, in my adventure Dreamlands, blocks of data would represent locations, objects, text responses. So to get the room data for location 12, I could derive it by something like:

Code: Select all

RESTORE locationsStartLine% + roomId%
I can't remember the actual code right now, but it was something like that. I think that actually the start line was a constant integer which got automatically updated in the RESTORE statements when I RENUM'ed which was a nice feature, possibly implemented by TK_2? I could be imagining that though

I think Turbo supports them too but I can't say for sure as I have never used it.


a.k.a. Jean-Yves
RWAP
RWAP Master
Posts: 2837
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: My struggles with compilers...

Post by RWAP »

From memory, the problem with TURBO is that the restore could not just be calculated - it had to be

Code: Select all

RESTORE 2000 
or

Code: Select all

RESTORE 2000 + offset %
As then Turbo could update the initial pointer - I could be wrong however.


User avatar
Dave
SandySuperQDave
Posts: 2776
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: My struggles with compilers...

Post by Dave »

Which doesn't affect me at all, fortunately. My programming style was always to ALCHP and then load the data in and peek it. I did this because it was more compact than SuperBASIC on mdv, a bit quicker to load, and just fun to do.


User avatar
tofro
Font of All Knowledge
Posts: 2701
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: My struggles with compilers...

Post by tofro »

Dave wrote:Which doesn't affect me at all, fortunately. My programming style was always to ALCHP and then load the data in and peek it. I did this because it was more compact than SuperBASIC on mdv, a bit quicker to load, and just fun to do.
And it saves memory: With READ/DATA you have to hold your data both in program code and in variables which always seemed to be a silly thing for me to do. When PEEKing, you can pick whatever you need into a temporary variable. READ (if READing a field, as intended) needs to read sequentially or use tricky RESTORE methods.

Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Dave
SandySuperQDave
Posts: 2776
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: My struggles with compilers...

Post by Dave »

I also do it that way because I can traverse my data easily, and edit in place. It's great for maps, contour graphs, etc...

That said, I now need to re-write all my library procedures for that :)


Post Reply