Add item to main index

Use this section to showcase your programming examples. Or to ask members for programming suggestions
Post Reply
Zzoom
Posts: 19
Joined: Thu Feb 22, 2024 12:58 pm
Location: Banbury=ish UK

Add item to main index

Post by Zzoom »

What code do I put into a packs boot.opl to automatically place an item (shortcut) on the main menu ?
Lostgallifreyan
Posts: 83
Joined: Thu Jan 12, 2023 8:25 pm

Re: Add item to main index

Post by Lostgallifreyan »

You'll need to use the system service TL$addi.

One source of menu-specific detail is here:
https://www.jaapsch.net/psion/tech16.htm
Just over half-way down, with an example of use from the Comms Link code.

Another page:
https://www.jaapsch.net/psion/mcosxp2.htm#toplevel
Again, a bit over half-way down.

Calling the code directly at boot is likely possible only with machine code. You'll need to make a pack with a binary boot file with code that includes and calls your menu-adding code, using the developer's kit BLDPACK program (with your binary file being the first in the image), making the pack image bootable. ORG-Link can make the pack from the image. You'll probably need a lot of trial and error, so a RAM pack is best for speed and repeatability.
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

Add item to main menu

Post by Martin »

Hi Zzoom

Check out the videos and the MAKEing Packs Hints and Tips (here) and the developer manual from the same page.

Test MAKEing the packs to a RAM pack if you have one - saves all the UV formatting.
Remember NOT to put a newly UV formatted datapak in the Organiser until instructed by them MAKE command

1) Create a TRN file (in notepad) that contains a list of all the procedures to be translated from OPL to OB3
2) Create a BLD file (in notepad) that contains all the files to be built into the pack including BOOT BIN, BOOT OB3, ADDTOP OB3
2) Fire up DOSbox or CMD.EXE
3) Use OPLTRAN on the TRN file (in 1) eg OPLTRAN @TOOLS
4) Use BLDPACK on the BLD file (in 2) eg BLDPACK @xpTOOLS
5) Connect a Comms Link and confirm it is connected correctly by transmitting and receiving a file possibly A:MAIN
6) Use ORG-Link to [MAKE PACK C:] follow the prompts

Be sure to use the latest versions of these programs and BIN files (from DevPACK)

This is an example TRN file for (xp)TOOLS

Code: Select all

TOOLS
BOOT
ADDTOP
YORN%
XPFILES
XPMM
XPFILES
XPINFO
XPCOMMS
This is an example BLD file for xpTOOLS

Code: Select all

xpTOOLS 32
BOOT BIN
BOOT OB3
ADDTOP OB3
TOOLS OB3
YORN% OB3
MDIR OB3
XPFILES OB3
XPMM OB3
XPINFO OB3
XPCOMMS OB3
This is an example of Addtop.OPL

Code: Select all

addtop:(item$,pos%)
LOCAL I%,A%(2)
IF LEN(item$)>8
        RAISE 202 :REM Menu too big
ENDIF
POKEB $2187,LEN(item$)
I%=1
WHILE I%<=LEN(item$)
POKEB $2187+I%,ASC(MID$(item$,I%,1))
I%=I%+1
ENDWH
POKEW $2188+LEN(item$),0
A%(1)=$3F65 :REM Careful here
A%(2)=$3900 :REM Careful here
USR(ADDR(A%()), pos%)
This is an example of BOOT.OPL

Code: Select all

BOOT:
ADDTOP:("TOOLS",3)
It is a great feeling when you get a fully working self booting datapak.
Sincerely Martin
Daren
Posts: 58
Joined: Tue Jan 03, 2023 10:03 pm

Re: Add item to main index

Post by Daren »

One day I will get around to doing this :lol: This tutorial is great Martin, you do a grand job of demystifying the more technical aspects of Psion useage.
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

PS I forgot

Post by Martin »

.
If you've watched the video's then you may have notied I fogot to mention...

(4a) If you don't have a Rampak to practice on, you can try your pack image (OPK) in (Jape) to ensure it works before going to all the trouble of burning the pack just to find it doesn't.

and also
(3a) if you are develping a pack for an Organiser CM/XP don't forget the -x flag when using OPLTRAN.

Again - always sincere
Martin
.
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

Getting round to it..

Post by Martin »

Daren wrote: Sun Mar 10, 2024 12:25 pm One day I will get around to doing this :lol: This tutorial is great Martin, you do a grand job of demystifying the more technical aspects of Psion useage.
Thanks Daren

I think the motivation for 'getting on with it' is to have a project in mind. I'm fortunate (or unfortunate depending on your point of view) that people like Gary Hawes Ham Radio enthusiast and member here who suggested what became (HamLog) and Chris Makin (not a member here) who was interested in FORMASTER which we (he helped with the punter terminology) republished as (Turf). Which by the way I'm getting ready to build a pack for a punter off eBay.

Let me know if you have any ideas for your 'project' I may be able to give you some pointers

Sincerely
Martin
Zzoom
Posts: 19
Joined: Thu Feb 22, 2024 12:58 pm
Location: Banbury=ish UK

Re: Add item to main index

Post by Zzoom »

OK a bit more complex than I thought but will give it a go and let you know how I do :P
Daren
Posts: 58
Joined: Tue Jan 03, 2023 10:03 pm

Re: Add item to main index

Post by Daren »

That is most kind of you Martin, currently I have a bunch of ideas for specific tools that I intend to program in OPL, mostly just calculators with a front end or user interface to facilitate easy actions on specific types of calculations related to audio equipment that I use. I am fairly confident in my ability to make all the separate programs and once I have done that the intention is to put them all on a datapak, with a boot menu and with a selection menu like the XPtools datapak I got from you.

I want to try to get some kind of uniformity in the programs, so I’m currently just figuring all that out and whilst at it making sure that I have covered all the bases with regard to keeping everything efficient and concise, for example putting a few different types of calculations be within 1 OPL program and have contextual options within that program as required. Then things like deciding which variables should be global and which local, if for example using the same parameters for multiple calculations etc.
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

Re: Add item to main index

Post by Martin »

Hi again Daren

Couple of things come to mind about the 'planning' stage

(1) I start by considering the output screen..
Take a look in the ZIP at the attached example spreadheet (FWORD tab) for how I lay out the screen

(2) If you have a menu that leads to a second menu - Put as short MENU title in the actual menu but don't do anything if it is selected... Like xpTOOLS [TOOLS] and [XFILE] examples in the ZIP

(3) Don't forget you can pass values between procedures using parameters. And RETURN a value from one procedure to another (page 105 of the CM/XP manual) example below.

Sincerely
Martin
Screens.zip
.
Short TEST procedure (calculates pitch angle) and on a certain key press (down arrow) passes the pitch angle to DMS 'function'

Code: Select all

TEST:
Local g%,pitch,going,rise

REM Example of passing perimeters and returning values
REM Calculate pitch angle of say stairs
REM No checking of dimensions
REM Keys (Down arrow) in TEST call DMS 
REM Keys (up arrow) in DMS show decimal angle
REM Keys (ON/CLEAR) Quits / Returns
REM Keys Any other key goes again

DO
 CLS
 PRINT "Calculate Pitch"
 AT 1,2 :PRINT "Going ="; :INPUT going
 AT 1,2 :PRINT "Rise  ="; :INPUT rise
 pitch=DEG(ATAN(rise/going))
 PRNT::
 REM clear line 2 (;) stops it scrolling 
 AT 1,2 :PRINT "                ";
 AT 1,2 :PRINT "Pitch "+FIX$(pitch,4,8)
 g%=GET
 IF g%=4     :REM Down Arrow
  g%=DMS:(pitch)
 ENDIF
 IF g%=3     :REM Up arrow
  GOTO PRNT::
 ENDIF
 IF g%=1     :REM ON/CLEAR
  RETURN
 ENDIF
UNTIL g%=1
.
Procedure accepts the pitch angle (from any routine) and shows the Deg,Min,Sec waits for a key press and returns the value of the key pressed

Code: Select all

DMS:(Dd)
LOCAL g%,d,m,s

REM A routine that 'returns' a value
REM could be called a user defined function

d=INT(Dd)
m=INT((Dd-d)*60)
s=INT((((Dd-d)*60)-m)*60)
AT 1,2 :PRINT "                ";
AT 1,2 :Print CHR$(15)+"Angle ";d;chr$(223);m;CHR$(39);s;CHR$(34)
g%=GET :IF g%=4 :g%=3 :ENDIF
RETURN g%
You do not have the required permissions to view the files attached to this post.
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

Project Title

Post by Martin »

Hi again Darren

Have you thought of the name for your audio calculations project?

What about ACME (Audio Calculating Main Equations) that would look cool on a main menu..
.
.
Acmexp.jpg
.
Always sincere
Martin
You do not have the required permissions to view the files attached to this post.
Post Reply