Yet Another BASIC - Phyllosoma BASIC compiler

I have it compiled and running on my PicoCalc – everything seems working.

Curious, why does picomite require changes to the SDK while Machikania doesn’t?

From their repo:

Build with sdk V2.1.1 but replace gpio.c, gpio.h, float_sci_m33_vfp.S, and flash.c with the ones included here

Looks like it’s about some tweaks and fixes:

Appears to be fixes, probably related to processor state transitions (blind guess).
… I’ve already updated my sdk according to their instructions and my Machikania build is using that.

btw after writing a few programs on it, I’m having doubts about syntax highlighting now: the terse nature of one-character-variables made it so that more color would probably distract.

edit: okay my doubts are cleared after knowing that you can usevar and useclass. :sweat_smile:

1 Like

If I may suggest a feature it would be LOAD: load, compile and run another program during execution.

This feature will enable a lot of OS-like scenarios.
I’m willing to help if you approve this feature.

1 Like

Actually, there are two modes of MachiKania type P: OS mode and editor mode that correspond to phyllosoma.uf2 and phyllosoma_kb.uf2, respectively.

To use the OS mode, tactile switch buttons are required, which do not exist in PicoCalc. So, only the editor mode is supported so far. I will think about selecting the OS mode in PicoCalc in addition to editor mode.

About the build and pico SDK, I don’t have any idea about PicoMite. We always check the newest version of SDK for building MachiKania. So far, SDK 2.1.1 is confirmed for building the newest version of MachiKania.

1 Like

why does picomite require changes to the SDK

@Katsumi some of the changes are merged in sdk v2.1.2: SDK 2.1.1 RP2350, writing to flash changes QSPI pad settings · Issue #2333 · raspberrypi/pico-sdk · GitHub

So I guess we can just wait and see :slight_smile:

This feature will enable a lot of OS-like scenarios.

Maybe this is a far reach, but I’m imagining that, with a load instruction, one could write dos “memory reservation” style routines and setup calling conventions between chainloaded programs.

  • Before load, the system saves the entire ram image of the running program, registers and BASIC vm states (e.g. g_vars_mem, tvmem, graphical buffer) somewhere – sdcard for example.
  • The load instruction can also supply arguments for the new program, which can be later retrieved with the system instruction
  • If a program exits, it can have a return value, which can be retrieved with the system instruction by the caller when the machine states are restored.

With these infrastructure, one can boot into a custom shell written in basic, use an editor written in basic etc. and ultimately have an extensive “userland” in basic.

1 Like

I see. Now I understand what the “LOAD” in your previous comment means.

It’s a challenge. I need to reconsider the compiler. It will be another level, and probably I need to start from scratch for it.

I’m also considering the next version of KM-BASIC (used in MachiKania), that will be for any CPU but not only for ARM. I will consider what you say here. Please wait me for 3-5 years…

1 Like

This is indeed a far reach. I can first pick up a more “basic” task to get familiar with the codebase :smiley:

Another suggestion: add DIM xxx AS type – after that, one does not need to append the type moniker after the variable name.

Perhaps this goes against the language design, but I truly feel the urge to have this when I dump 3DWAVE.bas by hand on the picocalc keyboard – I have to keep shift pressed down so as to input # more easily.

I also considered such definition for string/float variables, but found that the language syntax would lose consistency; SIN#(…), COS#(…), etc will remain with “#”. Removing all “#” from float function would make the language syntax more complicated.

Thank you very much for the suggestion and hint/help to improve MachiKania BASIC.

2 Likes

Could you please share some information about the libraries? I don’t see “libs” directory, nor classes like “httpd” in the repo. Thanks!

You can download the LIB directory from the GitHub repository releases page. “machikania-p-152.zip” contains it.

I prepared the English help files for these classes:

1 Like

The current production branch of GitHub repository supports the coloring in editor. Comments, reserved words, and strings are colored green, blue, and red, respectively.

3 Likes

I am using the multiboot bin version provided in the first post of this thread and it does not have coloring in the editor. Can you release a newer bin with coloring in the editor?

I can build the uf2 from source but I don’t know how to make a bin file that will work with multiboot.

I also don’t know how to make the “bin” file for multiboot. Can someone provide the way to do that (link or brief explanation)?

I got it by following the case of MicroPython. I will consider to include the bin file in the official release. Until the official release, please download it here: (phyllosoma_kb.bin).

Are there two versions of bootloade for Pico and Pico 2? Or, only for Pico 1?

By the way, the release of an official version of MachiKania for PicoCalc is on the way. I will be published in 2-3 weeks.

1 Like

Don’t worry about supporting multiboot, it’ll be completely obsolete fairly soon (same timeframe as your main release, a couple of weeks.) If there is any need for bootloader support after that I’m happy to help implement it.

2 Likes

I see. Thank you. I will provide the bin version of MachiKania after the official release of bootloader. Probably, I understood how to make the bin file for this purpose.

I am testing the 25050727 multiboot bin file.
Colors are working, however, F1, F2, F4 have disappeared from the bottom line.

The bottom line now looks like this:
LOAD|SAVE |RUN| LINE:xx

The bottom line of “F1-LOAD”, “F2-SAVE”, and “F4-RUN” is modification by guu. The “LOAD”, “SAVE” and “RUN” are our original ones. The F1, F2, and F4 keys still work.

Hey @Katsumi I’ve send you a PR to introduce editor autocompletion. Feel free to comment and suggest changes!

Hi yatli,

Thank you for suggesting the auto-completion in the editor. However, as I stated previously on July 5th, the MachiKania community is still small, and unfortunately, we are not in a position to accommodate large-scale pull requests at this time. I briefly saw your pull request, but we couldn’t pull it as we need to keep the stability of MachiKania for all implementations (the next release will contain 68 *.uf2 files).

Again, I appreciate your suggestion to improve MachiKania.

Katsumi

1 Like

Sure, I’ll illustrate my ideas (ergonomics, compiler, experimental stuff in my fork, for your reference.

1 Like