Memory Full

Forum / Development

Improving Locomotive Basic

Hicks * 21 Apr 2020 15:46:46

For a long time I have been using the CPC Basic to generate data & cie, and there are some things that are not very practical. But there are probably some tricks and facilities. I know that the Utopia ROM adds functionality (we can read this for example).

Is there anything else? Calling a subroutine with an explicit name and not a line number, replacing the heavy "table=table+1" with something else, etc.

Do you think the alternatives in C language are better suited for this?

m_dr_m * 21 Apr 2020 17:58:41

BASIC is kind of flawed to begin with!

There is a port of Forth on CPC which me be worth looking into. Pascal and C are other options!

BTW, Orgams's editor can be reused for any language.

toms * 21 Apr 2020 18:01:42

Maybe DEF FN can help you?

It can be a kind of named subroutine returning a result.
Also to avoid table=table+1, you can write DEFN FN inc=table+1 at the beginning of your code, and after table=FNinc.

Not sure if it's really better...?

I always use BASIC to generate my datas, but when it's too slow I write some PHP scripts to do the job. It looks like C language, but not as fast. However it doesn't need to be compiled before running it.

Targhan * 22 Apr 2020 01:32:03

Python is certainly be more friendly than PHP for scripting! Of course not available on CPC.

I think you will find C really tedious. What about Turbo Pascal? Certainly more readable.

(for my current project I use Kotlin to generate Z80 code, and it's AWESOME).

krusty * 22 Apr 2020 13:58:04

I always take care to choose a language for which the hello world program does not fit in a CPC ;)
I'm currently using rust in replace of python (mainly for code generation)