The PSION Organiser II Homepage
Forum Home Forum Home Help Help Search Search Members Members Login Login Register Register

Welcome, Guest. Please Login or Register.
Why register?
   The Psion Organiser II Forum
   User Forum
   General
(Moderator: Mikesan)
   Calling top level routines from OPL
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Calling top level routines from OPL  (Read 211 times)
MartinReid
Power Member




   
WWW

Posts: 97
Calling top level routines from OPL
« on: May 13th, 2018, 7:48am »
Quote Quote Modify Modify

Dear All..
 
Anybody know how to call a top level routine from within an OPL procedure? I'm looking to add 'Calc' and 'Plan' (the spreadsheet pack will be in slot C:) to a utility I'm writing. I seem to remember reading something about this back in the day.
 
I've searched through the user manuals on Jaaps PSION pages but can't find it.
 
Sincerely and in good faith
Martin
theBot
Administrator




   
WWW

Posts: 46
Re: Calling top level routines from OPL
« Reply #1 on: May 13th, 2018, 8:18pm »
Quote Quote Modify Modify

Hi Martin, you CAN NOT call Calc from OPL!
 
Yes, it would be useful - I wanted to do it myself, but this is not possible.
 
I got this from Psion tech support back in the day.  It says in our resources here that you can:
 
http://archive.psion2.org/org2/mcoslz.htm#CA$ENTR
 
so you could have a go, but...
jaap
active Member




   
WWW

Posts: 37
Re: Calling top level routines from OPL
« Reply #2 on: May 14th, 2018, 10:41am »
Quote Quote Modify Modify

Calling Calc from a procedure would be extremely hard to do.
 
Many of the system variables and the language stack are used for different things in different contexts. For example parsing/translating a procedure or calculator expression uses them in one way, and running a procedure or doing a calculation uses them in a different way.
 
The calculator will therefore mess up a lot of the things that are needed when a procedure is running. You would have to copy all of that and restore it afterwards. It would be very difficult to work out exactly what needs to be saved/restored, and to do that correctly.
 
 
It is likely that PLAN has similar problems. It uses calculations in the spreadsheets, and might be using built-in parsing routines to evaluate them. And worse, it can call an OPL procedure from a spreadsheet cell. So it seems quite likely that it too corrupts some things that are needed by the execution environment.
 
If you want to try calling Plan from OPL anyway, or call some other bootable pack that uses machine code, here's what to do. When the pack boots, it loads its program into memory and inserts PLAN into the main menu. It should be possible from OPL to PEEK at the main menu and search for the PLAN entry, then read the memory address after that entry to find out where the program is located, and then call that with the USR function. If you actually do this with PLAN, it is likely to crash as soon as you exit the spreadsheet program. You may be able to avoid the crash by putting a STOP command directly after the USR call, but that is still risky.

Jaap Scherphuis
https://www.jaapsch.net/psion/
MartinReid
Power Member




   
WWW

Posts: 97
Re: Calling top level routines from OPL
« Reply #3 on: May 14th, 2018, 7:11pm »
Quote Quote Modify Modify

Thank you for this chaps.. It was just a thought, but not a problem.
 
Here's another one; When I get my 256k RAMpak back from Olivier; is it possible to [MAKE] the 'pocket spreadsheet image with the boot routine and everything' on that pack before I copy all my OB3's and spreadsheet files onto it?
 
I read somewhere in Jaaps pages that the RAMpak frees-up the space made available after a deletion by rewriting and moving all the files up into that space. What effect would this have on the 'spreadsheet' image?
 
It would be interesting to read your thoughts on this.
 
Again sincerely and in good faith
Martin
jaap
active Member




   
WWW

Posts: 37
Re: Calling top level routines from OPL
« Reply #4 on: May 14th, 2018, 11:32pm »
Quote Quote Modify Modify

on May 14th, 2018, 7:11pm, MartinReid wrote:
is it possible to [MAKE] the 'pocket spreadsheet image with the boot routine and everything' on that pack before I copy all my OB3's and spreadsheet files onto it?

 
That should be possible.
- Take the spreadsheet opk file, and edit it to remove the write and copy protection (e.g. using my online opk editor, or using a hex editor to change the 7th byte from 46h to 7Eh). You don't have to change anything else.
- Using MAKE you can install this onto the ram pack (MAKE will take care of any further changes needed to make the 32k datapack image suitable to a 256k rampak).
 
The pack should then work as a spreadsheet pack, and you should also be able to use the remaining space to write/delete files and procedures. As the spreadsheet program is at the start of the pack, it will not be moved or affected by any changes that you make to the contents on the rest of the pack.
« Last Edit: May 14th, 2018, 11:36pm by jaap »

Jaap Scherphuis
https://www.jaapsch.net/psion/
MartinReid
Power Member




   
WWW

Posts: 97
Re: Calling top level routines from OPL
« Reply #5 on: May 15th, 2018, 6:39am »
Quote Quote Modify Modify

Thank you Jaap; I'll give it a go when I get the RAMpak back.
 
Sincerely
Martin
MartinReid
Power Member




   
WWW

Posts: 97
Re: Calling top level routines from OPL
« Reply #6 on: May 15th, 2018, 8:48pm »
Quote Quote Modify Modify

Dear Jaap
 
One more thing if you don't mind.
 
I've made a copy OPK of sprdsht_v34 and as suggested unchecked write and copy protection. If I'm going to [MAKE] it onto a 256k RAMpak. Do you suggest I set the Pack Size to 256k in the OPK File Editor before saving to disk?
 
Have you any experience of using Filip Van Vooren's load routine to transfer the remaining OB3's?
 
Again thank's for your help
Sincerely
Martin
jaap
active Member




   
WWW

Posts: 37
Re: Calling top level routines from OPL
« Reply #7 on: May 15th, 2018, 8:57pm »
Quote Quote Modify Modify

on May 15th, 2018, 8:48pm, MartinReid wrote:
If I'm going to [MAKE] it onto a 256k RAMpak. Do you suggest I set the Pack Size to 256k in the OPK File Editor before saving to disk?

As I wrote in my previous post, you don't need to. MAKE will handle all that.
 
BTW, you should probably also change the filename to something with 8 or fewer letters (e.g. sprdsht.opk) to make it easier to handle in MAKE/DosBox.
 
Have you any experience of using Filip Van Vooren's load routine to transfer the remaining OB3's?

No, I don't think I've ever used that.

Jaap Scherphuis
https://www.jaapsch.net/psion/
MartinReid
Power Member




   
WWW

Posts: 97
Re: Calling top level routines from OPL
« Reply #8 on: May 31st, 2018, 9:03am »
Quote Quote Modify Modify

Dear Jaap and Olivier
 
Just keep everyone up to date.
 
I have my 256k RAMpak back, thank you for that Olivier. Also I have access to a PC at work with a COMM1 'D' port 'Window XP 32bit'. It is used for driving a woodworking machine.
 
Following Japps advice to remove write and copy protection, I got sprdsht_v34.opk from his Pack Images page and loaded it into his OPK file editor, turned off Write protect and Copy protect in the file header. Saved this pack as sprdsht.opk
 
Transferred this OPK to the Windows XP marching and using CMD.exe MAKEing the pack to my - Utility Formatted - 256k RAMpaks in C:.
 
Fantastic - Works a treat, it boots Plan to the main menu and (I didn't realise I had a spreadsheet file open) opened in my current timesheet. Fantastic I'll copy across the remaining OB3's using Filip Van Vooren's load routine (from the Software by others page) when I get home. Now I've got everything I need on one RAMpak and a free port for the Thesaurus and Spelling Checker.
 
Thank you again everyone.
Sincerely and in good faith
Martin
 
P.S. My questions are never ending. I read somewhere (probably in one of Jaaps pages) about changing the position in the Main Menu of a bootable item! Anyone got any idea how I can get Plan to boot to position 3 on the Main Menu. It is only a cosmetic thing but it would bee neat.
jaap
active Member




   
WWW

Posts: 37
Re: Calling top level routines from OPL
« Reply #9 on: May 31st, 2018, 9:42am »
Quote Quote Modify Modify

Good to hear it's all working.
 
on May 31st, 2018, 9:03am, MartinReid wrote:

P.S. My questions are never ending. I read somewhere (probably in one of Jaaps pages) about changing the position in the Main Menu of a bootable item! Anyone got any idea how I can get Plan to boot to position 3 on the Main Menu. It is only a cosmetic thing but it would bee neat.

 
I don't think that is easy. Even if you delete all the other menu items and re-insert them after Plan, as soon as you press ON the pack is rebooted and it puts Plan back at the end of the menu.
 
The only way I see for doing this is to change the code in the pack image (i.e. find where it inserts the menu item and change it from -1 to 2 or 3, and update the code checksum accordingly). Then re-Make the pack image.

Jaap Scherphuis
https://www.jaapsch.net/psion/
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

The Psion Organiser II Forum » Powered by YaBB 1 Gold - SP 1.1!
YaBB 2000-2002,
Xnull. All Rights Reserved.
top