1 (edited by gazj82 2014-06-03 20:30:14)

Topic: Basic programs in /bin

Could it be possible to write a basic program and store it using save * "usefulprog" to the bin folder, then be able to recall the same basic program using .usefulprog ?

I thought I would try it but it just resets esxdos unfortunately.

Cheers
GazJ

2

Re: Basic programs in /bin

well. programs in /bin folder are binary programs which are loaded to divide ram an executed as machine code, not a basic program.

so, saving basic program to the /bin folder and then trying to execute it by .program command, is like trying to execute basic program by RANDOMIZE USR 23755 (address where is the basic program usually stored). (well.. files stored by SAVE *"..." command also have a +3dos header, so it is little bit different)

3 (edited by Luzie 2014-10-20 20:12:23)

Re: Basic programs in /bin

OK. Just tried a little bit with getting some MCODE
to work "from BASIC" on a real divIDE Interface with ESXDOS 0.86 Beta 4

It´s a little bit tricky as this ".dot-command" with BASIC-Part
runs from beginning of the BASIC-memory (PROG)
adress 23755 and when we put MCODE into the first BASIC program line
after a REM, this starts from 23760. So I have to find a way to jump from
23755 to 23760. Have done this with a Line Number 0
and a fixed length (about 53x Bytes) of the line 0.
So Bytes 23755 to 23760 contains the MCODE: NOP, NOP
and JR +2 which jumps to 23760.

Just for people who want to try it, please send me a PM
on this board so I can send you my DEMO Snapshot-File for this-
Because it seems I can´t attach anything here.

Luzie

4

Re: Basic programs in /bin

@Luzie Could you please explain what exactly are you trying to do and what do you want to achieve? Because from what you're describing I can't really see any connection to the /bin dot-command creation.

5

Re: Basic programs in /bin

Dear matofesi,

> Could you please explain what exactly are you trying to do
> and what do you want to achieve?
> Because from what you're describing I can't really see
> any connection to the /bin dot-command creation.

Thanks for your question.

I agree, that "my way of creating and running a mcode program"
is not very practical to an advanced programmer who will do an .command for ESXDOS.

I see it more as example what can be done on a real spectrum
running under ESXDOS: When someone has some machine code
in DATA-Lines (as type-ins from old spectrum magazines)
then this could be used to see, if this m/c-routine can be pokes
and runned from the spectrum.

Please don´t see to much "programmers brain"
in my doing ... ;-)

6

Re: Basic programs in /bin

Oh. OK. So it has nothing to do with the actual dot-commands wink

If the only case is simply running a MC "from BASIC" (without loading additional blocks of code) it's something that's been done in every advanced loader since the beginning of Spectrum wink The only problem is you can't be really sure that your code will be executed at the certain address - yes, BASIC program usually starts at 23755, but with Interface 1, or some other disk interfaces it's moved up to make space for extra system variables. So to be sure your code would work it should be relocatable (only use relative jumps inside the code etc.) and started with USR(PEEK 23635 + 256 * PEEK 23636) wink

But - as said before - it has nothing to do with dot-command smile

7

Re: Basic programs in /bin

I think the original idea of being able to create dot commands using basic is a very good idea, though it cannot be done as easy as the original poster suggests. If we could create dot commands with basic, basic would become the script language of ESXDOS as bash is for linux or bat files for windows. I know the best ways to do dot commands, but making creating dot commands easier (use Basic) may help have many commands we won't have had otherwise.

A possible solution would be creating a /BIN/TAP folder, and whenever a dot command is not found, look for a file in that folder named after the dot command and autoload it (i.e. if user types .test, look for /BIN/TAP/test.tap).

You can even evolve that idea making any arguments the dot command may have are stored at some specific address, so the TAP file can get them later using PEEK.

8

Re: Basic programs in /bin

having basic programs as a dot commands might look like a good idea, but i think it's not very usefull. because when you load basic program, the old one is lost, so you won't use such dot commands in basic programs.

anyway, all what you need to run basic program is to attach tap file to tapein slot (.tapein <tape file>) and then enter LOAD "". or (and it is maybe more comfortable) to just run nmi browser and press enter on a tap file.

9

Re: Basic programs in /bin

Actually, it would be good that any dot command that is not found, performs a search in /BIN/TAP and if found simulates a .tapein + LOAD "".

I agree it cannot exactly be used as batch files, but it can be used as shortcuts, so if someone can create  a norton commander like utility, it can be loaded just by writting .nc and not .tapein /utils/nc.tap, LOAD "". You can also use it to run the OUT needed for 48k compatibility in some games, just by including in a .tap file named 48k.tap and them calling it by typing .48k

You would even be able to create shortcuts for your favorite games, and run them with .aticatac or .tetris

10

Re: Basic programs in /bin

I came back to this thread and get some idea for solution of your "issue". I think this solution can make happy all of us as it is solution on "application" level, not a change to the core of esxdos.

The solution is to prepare small utility to create/delete tap launchers. So for example, you will use:

.launcher add /tmp/test.tap

by this, launcher will create external command /bin/test which you can then run by .test and it will assign /tmp/test.tap to tapein slot and call esxdos to autoload it.

.launcher del test

will remove /bin/test

and

.launcher list

will look to the /bin directory and lists all recognized launchers in there.

This way you even don't have to store taps in some specific folder as launcher will remember the full path of tap.

Do you think it is ok for you?

11 (edited by ub880d 2016-11-01 22:16:18)

Re: Basic programs in /bin

OK,

here is such utility:
http://sindik.at/~ub880d/tmp/launcher

Usage:
  .launcher add <name> <tap>
    - creates a new launcher with name <name>. it will autoload tape <tap>

  .launcher upd <name> <tap>
    - change launcher <name> to autoload tape <tap>

  .launcher del <name>
    - delete launcher <name>

  .launcher list
    - lists all created (and recognized) launchers

launcher name <name> must be a plain filename, not containing '/'
tap name <tap> must be a fullpath name, so it must start with '/'

launchers are created in the system's bin path where are all external commands so more commands/launchers you have 'list' will run longer.

also, keep in mind that esxdos for now supports only 8+3 format of names, so every component of path (for tap) must be in this format as well as the launcher name.

please note, that as usual, I'm not giving any warranty, and you are using this command at your own risk. so please, keep backups of your work while using this command.

12

Re: Basic programs in /bin

Download-Link fpr .launcher seem to be outdated. Actually I found it on:
http://sindik.at/~ub880d/2016/10/8-nove … -launcher/

13

Re: Basic programs in /bin

Uto wrote:

Actually, it would be good that any dot command that is not found, performs a search in /BIN/TAP and if found simulates a .tapein + LOAD "".

I agree it cannot exactly be used as batch files, but it can be used as shortcuts, so if someone can create  a norton commander like utility, it can be loaded just by writting .nc and not .tapein /utils/nc.tap, LOAD "". You can also use it to run the OUT needed for 48k compatibility in some games, just by including in a .tap file named 48k.tap and them calling it by typing .48k

You would even be able to create shortcuts for your favorite games, and run them with .aticatac or .tetris

I've come back to this thread to realize you replied and provided "launcher" about 18 months ago. Sorry I didn't notice but thank you any way, seems very close to what I was looking for and as you say, no need to modify ESXDOS core itself :-)