Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6622 > unrolled thread

Name of a program

Started byBob Latham <bob@sick-of-spam.invalid>
First post2026-04-16 17:34 +0100
Last post2026-04-18 13:55 +0100
Articles 20 on this page of 29 — 6 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-16 17:34 +0100
    Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-16 18:17 +0100
      Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-16 19:18 +0100
        Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-16 22:29 +0100
        Re: Name of a program Harriet Bazley <harriet@bazleyfamily.co.uk> - 2026-04-17 10:45 +0100
          Re: Name of a program Theo <theom+news@chiark.greenend.org.uk> - 2026-04-17 11:43 +0100
            Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-17 12:59 +0100
              Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-17 16:52 +0100
                Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-17 20:15 +0100
                  Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-17 23:24 +0100
                    Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-18 10:08 +0100
                  Re: Name of a program Theo <theom+news@chiark.greenend.org.uk> - 2026-04-18 10:56 +0100
                    Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-18 11:13 +0100
                      Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-18 13:50 +0100
                      Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-18 15:29 +0100
                        Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-18 16:30 +0100
                          Re: Name of a program Theo <theom+news@chiark.greenend.org.uk> - 2026-04-18 17:54 +0100
                            Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-18 18:06 +0100
                              Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-18 18:51 +0100
                          Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-18 19:08 +0100
                            Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-18 19:36 +0100
          Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-17 12:08 +0100
            Re: Name of a program Harriet Bazley <harriet@bazleyfamily.co.uk> - 2026-04-17 14:12 +0100
              Re: Name of a program Tank <webmaster@tankstage.co.uk> - 2026-04-17 15:09 +0100
                Re: Name of a program Harriet Bazley <harriet@bazleyfamily.co.uk> - 2026-04-17 19:35 +0100
                Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-17 20:17 +0100
                  Re: Name of a program Martin <News04@avisoft.f9.co.uk> - 2026-04-17 23:30 +0100
        Re: Name of a program Steve Fryatt <news@stevefryatt.org.uk> - 2026-04-18 11:39 +0100
          Re: Name of a program Bob Latham <bob@sick-of-spam.invalid> - 2026-04-18 13:55 +0100

Page 1 of 2  [1] 2  Next page →


#6622 — Name of a program

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-16 17:34 +0100
SubjectName of a program
Message-ID<5cca837cdbbob@sick-of-spam.invalid>
How can I get the name of program I'm running from within the program?

Thanks.

[toc] | [next] | [standalone]


#6623

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-16 18:17 +0100
Message-ID<5cca87776fNews04@avisoft.f9.co.uk>
In reply to#6622
In article <5cca837cdbbob@sick-of-spam.invalid>,
   Bob Latham <bob@sick-of-spam.invalid> wrote:
> How can I get the name of program I'm running from within the
> program?

I would have thought that a program would know what it is called?!
So not sure what you are wanting.

You can get the command used to start the program, if that is any
help, by using SWI OS_GetEnv. The name of the program file run will be
in that command, but the command will need parsing to get it. OS_Args
could be used to help that, or do it 'manually' in the program.

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6624

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-16 19:18 +0100
Message-ID<5cca8d05ebbob@sick-of-spam.invalid>
In reply to#6623
In article <5cca87776fNews04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:
> In article <5cca837cdbbob@sick-of-spam.invalid>,
>    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > How can I get the name of program I'm running from within the
> > program?

> I would have thought that a program would know what it is called?!
> So not sure what you are wanting.

I want to hide the name of the source file in assemble code. I would
like to be able to look at my code and be able to find out which
source file it came from.

> You can get the command used to start the program, if that is any
> help, by using SWI OS_GetEnv. The name of the program file run will
> be in that command, but the command will need parsing to get it.
> OS_Args could be used to help that, or do it 'manually' in the
> program.

I'm obviously missing something because I've looked at this before
and had no joy.

If in a Basic assembler file I run SWI OS_GetEnv it just says BASIC,
which I suppose that is what it is running but it's of no use to me.

I want the name of Basic assembler file.

Thanks.

Bob.

[toc] | [prev] | [next] | [standalone]


#6625

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-16 22:29 +0100
Message-ID<5cca9e7724News04@avisoft.f9.co.uk>
In reply to#6624
In article <5cca8d05ebbob@sick-of-spam.invalid>,
   Bob Latham <bob@sick-of-spam.invalid> wrote:
> In article <5cca87776fNews04@avisoft.f9.co.uk>,
>    Martin <News04@avisoft.f9.co.uk> wrote:
> > In article <5cca837cdbbob@sick-of-spam.invalid>,
> >    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > > How can I get the name of program I'm running from within the
> > > program?

> > I would have thought that a program would know what it is called?!
> > So not sure what you are wanting.

> I want to hide the name of the source file in assemble code. I
> would like to be able to look at my code and be able to find out
> which source file it came from.

> > You can get the command used to start the program, if that is any
> > help, by using SWI OS_GetEnv. The name of the program file run
> > will be in that command, but the command will need parsing to get
> > it. OS_Args could be used to help that, or do it 'manually' in
> > the program.

> I'm obviously missing something because I've looked at this before
> and had no joy.

> If in a Basic assembler file I run SWI OS_GetEnv it just says
> BASIC, which I suppose that is what it is running but it's of no
> use to me.

How are you running the program? 

It sounds as if you are using the BASIC command to open an interactive
editor, then running the program within that using LOAD/RUN. The only
RISC OS command used to start it was BASIC.

> I want the name of Basic assembler file.

If you simply double-click on the BASIC file name in a Filer display,
then what does OS_GetEnv return?

Alternatively, run the assembler code and save the output.
Double-click that aand GetEnv will show the saved file name.

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6626

FromHarriet Bazley <harriet@bazleyfamily.co.uk>
Date2026-04-17 10:45 +0100
Message-ID<01ece1ca5c.harriet@bazleyfamily.co.uk>
In reply to#6624
On 16 Apr 2026 as I do recall,
          Bob Latham  wrote:

> In article <5cca87776fNews04@avisoft.f9.co.uk>,
>    Martin <News04@avisoft.f9.co.uk> wrote:
> > In article <5cca837cdbbob@sick-of-spam.invalid>,
> >    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > > How can I get the name of program I'm running from within the
> > > program?
> 
> > I would have thought that a program would know what it is called?!
> > So not sure what you are wanting.
> 
> I want to hide the name of the source file in assemble code. I would
> like to be able to look at my code and be able to find out which
> source file it came from.

Do you mean 'embed' the name of the source file in assembly code?  I
don't think it's inherently in the assembled machine code, which doesn't
know whether it was assembled on the fly by running a parent BASIC file
or loaded from disc and executed by calling the address of the area it
was stored into, i.e. there is nothing to hide.

Or is this for the purposes of error trapping?


Probably the best way to label your machine code is simply to manually
embed a string near the top of it (like the string that is the name of a
relocatable module) with EQUS, so that you can visually inspect it - or
check for its presence at a known offset from the start of the code.


-- 
Harriet Bazley                     ==  Loyaulte me lie ==

The nice thing about standards is that there are so many to choose from

[toc] | [prev] | [next] | [standalone]


#6627

FromTheo <theom+news@chiark.greenend.org.uk>
Date2026-04-17 11:43 +0100
Message-ID<F4l*XoiEA@news.chiark.greenend.org.uk>
In reply to#6626
Harriet Bazley <harriet@bazleyfamily.co.uk> wrote:
> On 16 Apr 2026 as I do recall,
>           Bob Latham  wrote:
> 
> > In article <5cca87776fNews04@avisoft.f9.co.uk>,
> >    Martin <News04@avisoft.f9.co.uk> wrote:
> > > In article <5cca837cdbbob@sick-of-spam.invalid>,
> > >    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > > > How can I get the name of program I'm running from within the
> > > > program?
> > 
> > > I would have thought that a program would know what it is called?!
> > > So not sure what you are wanting.
> > 
> > I want to hide the name of the source file in assemble code. I would
> > like to be able to look at my code and be able to find out which
> > source file it came from.
> 
> Do you mean 'embed' the name of the source file in assembly code?  I
> don't think it's inherently in the assembled machine code, which doesn't
> know whether it was assembled on the fly by running a parent BASIC file
> or loaded from disc and executed by calling the address of the area it
> was stored into, i.e. there is nothing to hide.
> 
> Or is this for the purposes of error trapping?
> 
> 
> Probably the best way to label your machine code is simply to manually
> embed a string near the top of it (like the string that is the name of a
> relocatable module) with EQUS, so that you can visually inspect it - or
> check for its presence at a known offset from the start of the code.

This sounds a bit like:

REM >Filename
file$ = FNgetmyfilename()
[
.myfunction_file
EQUS file$:EQUB 0:ALIGN
.myfunction_name
EQUS "myfunction":EQUB 0:ALIGN
.myfunction
<stuff>
ADR r0, myfunction_file
SWI "OS_Write0"
SWI &100+ASC":"  ; print a colon
ADR r0, myfunction_name
SWI "OS_Write0"
<stuff>
MOV pc,r14
]


Except I don't think the <get my filename> function exists for BASIC,
because BASIC doesn't have a concept of executing a file.  You might have
LOADed it into memory, but the name of the file given to LOAD isn't recorded
anywhere.  The command line from OS_GetEnv just tells you the *Command that
was run, which isn't quite the same.

What you could do is start at PAGE and then walk the tokenised code until
you spot a REM > statement, which is sort-of a convention for how to label
BASIC files with their filenames.  This wouldn't work if the file is part of
a LIBRARY, which is something you often do when assembling from multiple
source files.  It is also fairly nasty (eg would break if BASIC changed
its tokenisation, or if somebody renamed the file but failed to edit the
comment).

In C, it's easier because you have a macro __FILE__ which can be used to
embed the name of the source file into any string.  There are also 'debug
symbols' which can be enabled to annotate functions with their names to aid
in debugging.  BASIC doesn't have this (although if you were generating an
AIF binary in BASIC assembly you could hand-generate the debug symbols if
you wanted).

Theo

[toc] | [prev] | [next] | [standalone]


#6629

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-17 12:59 +0100
Message-ID<5ccaee3398bob@sick-of-spam.invalid>
In reply to#6627
In article <F4l*XoiEA@news.chiark.greenend.org.uk>,
   Theo <theom+news@chiark.greenend.org.uk> wrote:

> or if somebody renamed the file but failed to edit the comment).

Which I know I would do - endlessly.

The nearest I've got is to intercept vector 5 and if you double click
a Basic file it will set the variable and you're good to go. But, if
you drop into Basic and then load the basic program then no-go.

Unfortunately I do a lot of work in Basic because when something goes
wrong you get more info like a line number and you can do tests, just
running the code is okay if it all works.

I'm concluding this can't be done.

Thanks everyone for trying to help me.

Bob.

[toc] | [prev] | [next] | [standalone]


#6632

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-17 16:52 +0100
Message-ID<5ccb038169News04@avisoft.f9.co.uk>
In reply to#6629
In article <5ccaee3398bob@sick-of-spam.invalid>,
   Bob Latham <bob@sick-of-spam.invalid> wrote:
> The nearest I've got is to intercept vector 5 and if you double
> click a Basic file it will set the variable and you're good to go.

Have you have done an OS_Claim,5 in another program, before
double-clicking the program you are wanting to find the name of? 
Beware that adds an overhead on EVERY command that is issued until the
OS_Release,5.  And there can be many hundreds of them!

> But, if you drop into Basic and then load the basic program then
> no-go.

That is to be expected... 

Double-clicking a any file (BASIC, Absolute, Utility, Command, Jpeg,
etc) will result in an command: 
    Run <pathname><filename>
This issues another command depending on the hex file type. For a
BASIC program this is:
    @RunType_FFB <pathname><filename>
The Alias$@RunType_FFB for a BASIC program then issues command
    Basic -quit "<pathname><filename>"

All these three  are OS commands, and will pass through the OS_CLI
vector 5, and will be seen by anything intercepting that vector at
that time.

However, when in interactive BASIC, a 
    LOAD filename 
is a BASIC command, and NOT an OS command, so it is not seen by the
OS_CLI vector. The last OS command issued is just BASIC.
Issuing a *command or OSCLI("command") would be an OS command.

Note that all the OS commands issued can be seen easily if my Reporter
is running - see www.avisoft.f9.co.uk   

> I'm concluding this can't be done.

Yes it can, if what you want is the filename of the running program...

If the program that is actually running issues an OS_GetEnv SWI you
get returned the address of the OS command which started that program.
It will include the full <pathname><filename>, and is exactly the same
as passed to OS_CLI and passes through the vector.

Therefore...
If you have double-clicked a BASIC program <filename> it will show
    Basic -quit <pathname><filename>
If in interactive BASIC it will still just show BASIC after a LOAD.

No Claim for OSCLI vector 5 is required.

Does that help?

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6634

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-17 20:15 +0100
Message-ID<5ccb161bb5bob@sick-of-spam.invalid>
In reply to#6632
In article <5ccb038169News04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:
> In article <5ccaee3398bob@sick-of-spam.invalid>,
>    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > The nearest I've got is to intercept vector 5 and if you double
> > click a Basic file it will set the variable and you're good to go.

> Have you have done an OS_Claim,5 in another program, 

Yes, I have had a module running for at least 20 years to which sets
the variable Basic$Dir which I use a great deal. 

[Snip]

> > I'm concluding this can't be done.

The module method I have can also get the filename if you run the
basic program with a double click etc.

> Yes it can, if what you want is the filename of the running program...

> If the program that is actually running issues an OS_GetEnv SWI you
> get returned the address of the OS command which started that
> program. It will include the full <pathname><filename>, and is
> exactly the same as passed to OS_CLI and passes through the vector.

Yes, but my new found knowledge makes me doubt it can do what I want
it to do.

I write my assembler programs in BBC basic inside StrongED. I save
the file. I don't usually run the program by double clicking because
if it goes wrong there is nothing you can do to investigate why. My
new code usually goes wrong several time and has to be debugged
before it runs properly. 

So I have another program of mine which sits on the icon bar and I
drop the Basic prog on to that. This opens the Basic environment and
loads my new code into it. I now work old style in Basic to get the
bugs out. at some point i hit F12 which saves the resultant machine
code.

I then quit Basic and return to the desktop.

So as my Basic assemble code has not been 'run' from the filer but
within Basic the path will not have been set and indeed that's what
I'm seeing.

Yes, your idea is better from an overheads point of view but I don't
think it will fix my issue. 
  
> Does that help?

Better than my module - probably. Does what I want - I don't think so.

Thanks for trying to help me.

Bob.

[toc] | [prev] | [next] | [standalone]


#6636

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-17 23:24 +0100
Message-ID<5ccb276441News04@avisoft.f9.co.uk>
In reply to#6634
In article <5ccb161bb5bob@sick-of-spam.invalid>,
   Bob Latham <bob@sick-of-spam.invalid> wrote:
> In article <5ccb038169News04@avisoft.f9.co.uk>,
>    Martin <News04@avisoft.f9.co.uk> wrote:
> > In article <5ccaee3398bob@sick-of-spam.invalid>,
> >    Bob Latham <bob@sick-of-spam.invalid> wrote:

> > Have you have done an OS_Claim,5 in another program, 
> Yes, I have had a module running for at least 20 years to which sets
> the variable Basic$Dir which I use a great deal. 

That explains that.

[Snip]

> > If the program that is actually running issues an OS_GetEnv SWI
> > you get returned the address of the OS command which started that
> > program. It will include the full <pathname><filename>, and is
> > exactly the same as passed to OS_CLI and passes through the
> > vector.

> Yes, but my new found knowledge makes me doubt it can do what I want
> it to do.

> I write my assembler programs in BBC basic inside StrongED. I save
> the file. I don't usually run the program by double clicking because
> if it goes wrong there is nothing you can do to investigate why. My
> new code usually goes wrong several time and has to be debugged
> before it runs properly. 

That applies to code I write as well ... and some using BASIC, and
some BASIC Assembler. And there are things you can do to investigate
what has gone wrong.  If you want some help with this, please email me
directly.

Is your debugging simply using the facilities of the BASIC Interpreter
to display variable values? How do you display register values from
the assembler? How do you display blocks of storage?

> So I have another program of mine which sits on the icon bar and I
> drop the Basic prog on to that. This opens the Basic environment and
> loads my new code into it. I now work old style in Basic to get the
> bugs out. at some point i hit F12 which saves the resultant machine
> code.

So this other program knows the full file name of what it is about to
load into BASIC? So can it set a variable name or something with the
program name?

I am still unsure what you need the program name for, and how you want
to use it!

> So as my Basic assemble code has not been 'run' from the filer but
> within Basic the path will not have been set and indeed that's what
> I'm seeing.

Correct. The OS command processor has not seen it.

Martin

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6638

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-18 10:08 +0100
Message-ID<5ccb6262dfbob@sick-of-spam.invalid>
In reply to#6636
In article <5ccb276441News04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:
> In article <5ccb161bb5bob@sick-of-spam.invalid>,
>    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > In article <5ccb038169News04@avisoft.f9.co.uk>,
> >    Martin <News04@avisoft.f9.co.uk> wrote:
> > > In article <5ccaee3398bob@sick-of-spam.invalid>,
> > >    Bob Latham <bob@sick-of-spam.invalid> wrote:

[Snip]

> That applies to code I write as well ... and some using BASIC, and
> some BASIC Assembler. And there are things you can do to
> investigate what has gone wrong.  If you want some help with this,
> please email me directly.

> Is your debugging simply using the facilities of the BASIC
> Interpreter to display variable values? 

Mostly.

> How do you display register values from the assembler?

For the most part I don't. I do store a register in a particular
temporary address sometimes. A list of important variables and their
values are squirted to a file when the assembler has finished. I also
tend to use conditional swi 256+7 to find out where code is getting
to.

> How do you display blocks of storage?

!SpyGlass or !StrongED.

I'm sure I know what you're going to say. I should be using Reporter.

I don't want to come across as a moaner but my honest problem is I'm
not the sharpest knife in the box and many, many things seem to be
beyond my understanding. An example is Rool Development suite, got
it, can't get anywhere with it. 

Likewise Reporter, way beyond me. Unfortunately, I'm limited in what
I can learn and understand not helped by my dislike of reading which
I find hard work.

> > So I have another program of mine which sits on the icon bar and
> > I drop the Basic prog on to that. This opens the Basic
> > environment and loads my new code into it. I now work old style
> > in Basic to get the bugs out. at some point i hit F12 which saves
> > the resultant machine code.

> So this other program knows the full file name of what it is about
> to load into BASIC? 

It may well do. I wrote it decades ago and it's in Basic.  

> So can it set a variable name or something with the program name?

It would seem likely I agree, I'll have a look...

> I am still unsure what you need the program name for, and how you
> want to use it!

Okay. 

My source files follow this pattern...

major changes and consolidated code..
SF14, SF15, SF16, SF17,
Then small changes and testing...
SF18_d02_01, SF18_d02_02, SF18_d04_01
When these changes do what I want it will become SF18.

Sometimes I get confused, I've got 3 or 4 Assembled !RunImages and I
notice a fault I'd not spotted earlier. I find some RunImages don't
have the issue but I've only got the date stamp to identify the
source file that last produced code without a fault.

If I could look at a fixed location in my code and it contained the
name of the source file......

Cheers,

Bob.

[toc] | [prev] | [next] | [standalone]


#6639

FromTheo <theom+news@chiark.greenend.org.uk>
Date2026-04-18 10:56 +0100
Message-ID<D4l*rvnEA@news.chiark.greenend.org.uk>
In reply to#6634
Bob Latham <bob@sick-of-spam.invalid> wrote:
> 
> Yes, but my new found knowledge makes me doubt it can do what I want
> it to do.
> 
> I write my assembler programs in BBC basic inside StrongED. I save
> the file. I don't usually run the program by double clicking because
> if it goes wrong there is nothing you can do to investigate why. My
> new code usually goes wrong several time and has to be debugged
> before it runs properly. 
> 
> So I have another program of mine which sits on the icon bar and I
> drop the Basic prog on to that. This opens the Basic environment and
> loads my new code into it. I now work old style in Basic to get the
> bugs out. at some point i hit F12 which saves the resultant machine
> code.
> 
> I then quit Basic and return to the desktop.
> 
> So as my Basic assemble code has not been 'run' from the filer but
> within Basic the path will not have been set and indeed that's what
> I'm seeing.

I can think of a couple of routes to doing what you want:

1. Have your desktop program run the command of '*Basic -load $.MyProg'
Then it starts Basic with the file loaded but not run.
Use OS_GetEnv to get the command and parse out the filename.

2. Have your desktop program set a system variable MyLoader$Filename to be
the name of the Basic prog, then SAVE "<MyLoader$Filename>"
(or read the sysvar to a Basic string first)

I'm not sure how your 'hit F12' save works, but perhaps you could 
*Key 12 SAVE "<MyLoader$Filename>"

Theo

[toc] | [prev] | [next] | [standalone]


#6640

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-18 11:13 +0100
Message-ID<5ccb684e90News04@avisoft.f9.co.uk>
In reply to#6639
In article <D4l*rvnEA@news.chiark.greenend.org.uk>,
   Theo <theom+news@chiark.greenend.org.uk> wrote:
> I can think of a couple of routes to doing what you want:

> 1. Have your desktop program run the command of 
> '*Basic -load $.MyProg'
> Then it starts Basic with the file loaded but not run.
> Use OS_GetEnv to get the command and parse out the filename.

That is a brilliant idea! 

> 2. Have your desktop program set a system variable
> MyLoader$Filename to be the name of the Basic prog, then SAVE
> "<MyLoader$Filename>" (or read the sysvar to a Basic string first)

If Basic$Prog was set to the required name, then adding a simple FNid
would add the name value to the code:

    1 DIM code% 100
    2 P% = code%
    3 [
    4 ; some other bits of your code
    5   FNid         ; Insert program name
    6   ALIGN        ; to next word boundary
    7 ; some other bits of your code
    8 ]
    9 END
   10 
   11 DEF FNid       :REM insert program name at P%
   12   SYS "XOS_ReadVarVal","Basic$Prog",P%,255,0,3 TO ,,L%
   13   P% += L%     :REM move ptr after name 
   14  = 0

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6642

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-18 13:50 +0100
Message-ID<5ccb76adcabob@sick-of-spam.invalid>
In reply to#6640
In article <5ccb684e90News04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:
> In article <D4l*rvnEA@news.chiark.greenend.org.uk>,
>    Theo <theom+news@chiark.greenend.org.uk> wrote:
> > I can think of a couple of routes to doing what you want:

> > 1. Have your desktop program run the command of 
> > '*Basic -load $.MyProg'
> > Then it starts Basic with the file loaded but not run.

Actually, it already does that. 

> > 2. Have your desktop program set a system variable

Yes, I added my code for that this morning.

It now sets both Basic$Dir and now Basic$File. 

> 11 DEF FNid       :REM insert program name at P% 
> 12   SYS "XOS_ReadVarVal","Basic$Prog",P%,255,0,3 TO ,,L% 
> 13   P% += L% :REM move ptr after name 
> 14  = 0

That's helpful thanks.

Bob.

[toc] | [prev] | [next] | [standalone]


#6644

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-18 15:29 +0100
Message-ID<5ccb7fc02dbob@sick-of-spam.invalid>
In reply to#6640
In article <5ccb684e90News04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:

>     4 ; some other bits of your code
>     5   FNid         ; Insert program name
>     6   ALIGN        ; to next word boundary

Can't get past syntax error or no such mnemonic with this.

It doesn't like FNid at all.


Bob.

[toc] | [prev] | [next] | [standalone]


#6645

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-18 16:30 +0100
Message-ID<5ccb85512cNews04@avisoft.f9.co.uk>
In reply to#6644
In article <5ccb7fc02dbob@sick-of-spam.invalid>,
   Bob Latham <bob@sick-of-spam.invalid> wrote:
> In article <5ccb684e90News04@avisoft.f9.co.uk>,
>    Martin <News04@avisoft.f9.co.uk> wrote:

> >     4 ; some other bits of your code
> >     5   FNid         ; Insert program name
> >     6   ALIGN        ; to next word boundary

> Can't get past syntax error or no such mnemonic with this.
> It doesn't like FNid at all.

Did you include the DEF FNid from lines 11-14 ?

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6646

FromTheo <theom+news@chiark.greenend.org.uk>
Date2026-04-18 17:54 +0100
Message-ID<F4l*v3oEA@news.chiark.greenend.org.uk>
In reply to#6645
Martin <News04@avisoft.f9.co.uk> wrote:
> In article <5ccb7fc02dbob@sick-of-spam.invalid>,
>    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > In article <5ccb684e90News04@avisoft.f9.co.uk>,
> >    Martin <News04@avisoft.f9.co.uk> wrote:
> 
> > >     4 ; some other bits of your code
> > >     5   FNid         ; Insert program name
> > >     6   ALIGN        ; to next word boundary
> 
> > Can't get past syntax error or no such mnemonic with this.
> > It doesn't like FNid at all.
> 
> Did you include the DEF FNid from lines 11-14 ?

Do you not have to do 'OPT FNid' in the assembly?  I'm somewhat rusty...

Theo

[toc] | [prev] | [next] | [standalone]


#6647

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-18 18:06 +0100
Message-ID<5ccb8e16fdNews04@avisoft.f9.co.uk>
In reply to#6646
In article <F4l*v3oEA@news.chiark.greenend.org.uk>,
   Theo <theom+news@chiark.greenend.org.uk> wrote:
> Martin <News04@avisoft.f9.co.uk> wrote:
> > In article <5ccb7fc02dbob@sick-of-spam.invalid>,
> >    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > > In article <5ccb684e90News04@avisoft.f9.co.uk>,
> > >    Martin <News04@avisoft.f9.co.uk> wrote:
> > 
> > > >     4 ; some other bits of your code
> > > >     5   FNid         ; Insert program name
> > > >     6   ALIGN        ; to next word boundary
> > 
> > > Can't get past syntax error or no such mnemonic with this.
> > > It doesn't like FNid at all.
> > 
> > Did you include the DEF FNid from lines 11-14 ?

> Do you not have to do 'OPT FNid' in the assembly?  I'm somewhat
> rusty...

Nope. I originally posted a working, tested program!
Though I do realise that it used DIM LOCAL, which requires a BASIC
later than the Select ones.

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6648

FromMartin <News04@avisoft.f9.co.uk>
Date2026-04-18 18:51 +0100
Message-ID<5ccb9239b4News04@avisoft.f9.co.uk>
In reply to#6647
In article <5ccb8e16fdNews04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:
> Though I do realise that it used DIM LOCAL, which requires a BASIC
> later than the Select ones.

Gah! No it does not. That was an earlier version! DIM not now used.

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 

[toc] | [prev] | [next] | [standalone]


#6649

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-04-18 19:08 +0100
Message-ID<5ccb93c129bob@sick-of-spam.invalid>
In reply to#6645
In article <5ccb85512cNews04@avisoft.f9.co.uk>,
   Martin <News04@avisoft.f9.co.uk> wrote:
> In article <5ccb7fc02dbob@sick-of-spam.invalid>,
>    Bob Latham <bob@sick-of-spam.invalid> wrote:
> > In article <5ccb684e90News04@avisoft.f9.co.uk>,
> >    Martin <News04@avisoft.f9.co.uk> wrote:

> > >     4 ; some other bits of your code
> > >     5   FNid         ; Insert program name
> > >     6   ALIGN        ; to next word boundary

> > Can't get past syntax error or no such mnemonic with this.
> > It doesn't like FNid at all.

> Did you include the DEF FNid from lines 11-14 ?

Yes I did at the end of the source file after END

I then noticed that L% was already in use so I've changed your
supplement code to V%. I also added O%.

That stopped the errors and space was created in the machine code but
the text was wrong. Penny dropped. Insertion needed at O% not P%.

 DEF FNid
 SYS "XOS_ReadVarVal","Basic$File",O%,255,0,3 TO ,,V%
 P% += V% : O% += V%
 =0

Looks good at the moment, need to test it more.

Thanks.

Bob.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.sys.acorn.programmer


csiph-web