EasyPTR APPMAN help

Anything QL Software or Programming Related.
User avatar
JonS
Bent Pin Expansion Port
Posts: 77
Joined: Fri Nov 11, 2011 3:54 pm
Location: Cumbria

Re: EasyPTR APPMAN help

Post by JonS »

Norman

Thanks, but it works fine if I add the menu to an extension file as per your example.

However, as I always have the extensions loaded, that's adding a large chunk of "duplicate" code so I am trying to create an _app file, with just the menus in.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: EasyPTR APPMAN help

Post by NormanDunbar »

Disassembling the calc_cde from that old tutorial, I see the following:

Code: Select all

L0000   bra L0206

L0206   bsr L0612
L020A   bne L03BE
L020E   movea.w $110,a2     ; BI_INIPR/BP_INIT
L0212   lea L0052,a1
L0216   jmp (a2)
Label L0052 is $52 and equates to the decinmal '82 in the $$asmb line. So it looks fine from here.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: EasyPTR APPMAN help

Post by NormanDunbar »

JonS wrote:Norman

Thanks, but it works fine if I add the menu to an extension file as per your example. However, as I always have the extensions loaded, that's adding a large chunk of "duplicate" code so I am trying to create an _app file, with just the menus in.
Ah, right, sorry. To be honest, I'm not sure that you can actually do that. I might be wrong though. I am of the impression that if I want to compile a program, I'd love to have all its dependencies inbuilt - and that would include the PTRMEN_CDE and my menus etc as well.

I might have to dig out my manual and have a read!

By the way, we crossed in the post, please ignore my previous post.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: EasyPTR APPMAN help

Post by NormanDunbar »

Ok, I checked the EasyPTR 4 manual, it says this:
With APPMAN menus, sprites, blobs and patterns appended to the SuperBASIC extension files
'easyptr_cde', 'easymen_cde' or 'ptrmen_cde' can be managed.
(my emphasis)

This appears to say that you need an extensions file loaded. Further on it says:
7.1 Base file

The first extension file loaded with the option

[Extension (+Appendix)]

in the FILES menu is treated to be the base file, which is written out with the appendix when saved with
the same option.
Which seems to back it up, you need to load the extensions file as the base, then the menus on top.


That's what I've always done too.


I notice that the manual now states that
APPMAN's _app files can be included in Qliberated programs using

Code: Select all

REMark $$asmb=filename,0,60
Whereas mine has worked in the past, with EasyPTR 3, with:

Code: Select all

REMark $$asmb=filename,4,82
My EasyPTR 3 manual says nothing, in the APPMAN section, about how to link the files into Qliberated programs.

HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: EasyPTR APPMAN help

Post by pjw »

Try adding rem $$chan=4 at the top of the program..


Per
dont be happy. worry
- ?
EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: EasyPTR APPMAN help

Post by EmmBee »

JonS wrote:Per,

Doing that allows it to show the menu in SBASIC. If I compile with it LRESPR'd and compile without the $$asmb directive, it runs okay as well.

However, linking in with $$asmb=filename,0,64 results in a message of "String is not numeric" (!!) on the line calling APPA0.
The Manual says ...

[ Command see → APPA ] [ n ]
Here the number of the APPAn command in an EASYAPP file is set. 'n' can be any number from '0'
through '9', i.e. ten different EASYAPP files with different commands APPA0 through APPA9 can be
generated.

So, you need to specify a number in the range 0 to 9, and not use ... adr = APPA0('qlib1') which is specifying a string.


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

Re: EasyPTR APPMAN help

Post by tofro »

EmmBee wrote: The Manual says ...

[ Command see → APPA ] [ n ]
Here the number of the APPAn command in an EASYAPP file is set. 'n' can be any number from '0'
through '9', i.e. ten different EASYAPP files with different commands APPA0 through APPA9 can be
generated.

So, you need to specify a number in the range 0 to 9, and not use ... adr = APPA0('qlib1') which is specifying a string.
The number 0..9 is part of the function name, as any program can have up to 9 appendices that return their embedded ressources by string, so

Code: Select all

menu = APPA0("main_menu") 
returns the menu named "main_menu" from appendix 0, while

Code: Select all

sprite = APPA9 ("spaceship") 
returns the sprite named "spaceship" from appendix 9. It's a bit complicated (also, explained in a weird way in the manual), but allows easy inclusion of WM resources into programs. A bit later in the manual, the APPAn function is explained a bit better.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
JonS
Bent Pin Expansion Port
Posts: 77
Joined: Fri Nov 11, 2011 3:54 pm
Location: Cumbria

Re: EasyPTR APPMAN help

Post by JonS »

Well, true to form this was my mistake.

$$asmb=name,0,60 does work. As the QLiberator manual clearly states, the extension (in this case APPA0) must be loaded when compiled. However, I had QSAVE'd before loading it and compiling it. I always save code using QSAVE so never use the LIBERATE name, structure but use the interactive.

I'm updating my QLiberator manual to say

IT IS ESSENTIAL THAT SUCH EXTENSIONS ARE ALREADY LOADED WHEN THE PROGRAM IS SAVED/COMPILED. If this is not observed, the compiler will find ambiguous names or unpredictable runtime behaviour will result.

Thanks for all advice given.


User avatar
RalfR
Aurora
Posts: 871
Joined: Fri Jun 15, 2018 8:58 pm

Re: EasyPTR APPMAN help

Post by RalfR »

The problem with the SMSQ/E way of QSAVE/QLOAD is, that contrary to the original Liberation one, after loading a QSAVEd file and not having loaded the extensions first, then the Liberation one states "Extensions missing!", whereas the SMSQ/E one does not.

Those missing extensions may give problems, because QLiberator v3.36 then assumes externals or overlays and does not report an error during compile time ("ambiguous name").
Last edited by RalfR on Fri Feb 07, 2020 12:35 pm, edited 3 times in total.


4E75 7000
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: EasyPTR APPMAN help

Post by dilwyn »

JonS wrote:Well, true to form this was my mistake.

$$asmb=name,0,60 does work. As the QLiberator manual clearly states, the extension (in this case APPA0) must be loaded when compiled. However, I had QSAVE'd before loading it and compiling it. I always save code using QSAVE so never use the LIBERATE name, structure but use the interactive.

I'm updating my QLiberator manual to say

IT IS ESSENTIAL THAT SUCH EXTENSIONS ARE ALREADY LOADED WHEN THE PROGRAM IS SAVED/COMPILED. If this is not observed, the compiler will find ambiguous names or unpredictable runtime behaviour will result.

Thanks for all advice given.
Thanks for letting us know the outcome. With hindsight, probably obvious to regular users, but worth noting just the same. Ralf's comments about the difference between the way the original QLOAD/QSAVE work compared to the SMSQ/E version is also worth noting.


Post Reply