News:

;) This forum is the property of Proton software developers

Main Menu

Addressable Gosub?

Started by david, Nov 01, 2024, 06:54 AM

Previous topic - Next topic

david

Hi All,
I'm sure this has come up before.  Is there a concise way of creating the equivalent of this-

If variable=n then Gosub label n

I have 6 small sub routines to cover and presently I'm using If/Then for the various values of the variable and of course it has to test each value in sequence.  Probably not a lot in it but it just seems a bit clunky.

David

Stephen Moss

Have you looked at the On Gosub command, I think that will do what you want.

david

Oh dear!  How have I missed that?  That's exactly what I want.
Many thanks.  Now tell me it has been there for several years....

Cheers,
David

top204

The On Gosub and On Goto commands have been with the 8-bit compiler for about 18 years, and with the 16-bit compiler since I created it in around 2012 (ish). :-)

Stephen Moss

@david, if I am being honest the On Gosub command it was not my initial though, that was to create an array and fill it with the addresses, and use the variable to index them, something like...
Dim MySubArray[3] as Byte = Varptr SubName1, Varptr SubName2, Varptr SubName3
GoSub MySubArray[Variable]
and I was trying to find an indication in the manual that the Gosub command would accept that name when I re-discovered the On GoSub command.

david

Ha!  So we both have to plead guilty.
I still can't help feeling a bit ashamed as I've been using Proton/Positron before it was a thing. 
Way back I remember wanting to try getting in to micros and there was a program I downloaded which had a reference to Malta.  It was a basic compiler with a very limited range of commands but it worked and I felt like the sorcerer's apprentice.  I'm sure it later became Proton. 

Best regards,
David

top204

#6
That was the dreadful L.E.T compiler!

It was so bad when I took it over that I did not want my name attached with it, so I decided to create a new compiler that I was proud of. So I read as much as I could about compiler creation, and especially Jack Crenshaw's documents, and created the Proton compiler from scratch, but based upon microcontrollers and not microprocessors that have all the trimmings of a 'real' stack and lots of RAM, so it was an uphill struggle with the fragmented RAM, no stack, and paged RAM and code memory etc.. (and all on my own and in my own time).

david

I think I still have the L.E.T compiler booklet but this was an earlier piece of work and free to download but as mentioned, it was quite limited.  It was the first steps to greater things.

David

flosigud

LET Basic was not free. At least I payed GBP 15.00 for it and got a CD by mail. I think I still have the manual somewhere.

david

I agree - LET Basic was not free but very reasonably priced.
I was talking about something earlier than that and it was not branded.  Just a website to download from and I don't think it was made available for long.  It had references to Malta.

David

flosigud

It was prior to internet for me. I got a check from the bank, put in an envelope along with the order cut out from from probably ETI. I was never any good at assembler, but now I got some results, and soon after an upgrade.

joesaliba

Quote from: david on Nov 01, 2024, 12:34 PMI agree - LET Basic was not free but very reasonably priced.
I was talking about something earlier than that and it was not branded.  Just a website to download from and I don't think it was made available for long.  It had references to Malta.

David

I was told by someone at Crownhill that eventually they begin their business from Malta, I know the place.

david

That's interesting.
I wish I could remember more but I think it was like an enthusiast's website and the very simple application was not posted for very long before being taken down.  Having had a taste of micros with this, I was more than happy to purchase the L.E.T. Basic when it came out.

Cheers,
David