[2J[1;1H[?25l[38;5;11m
EndBASIC tour: Welcome!
=========================
[39m
Welcome to the EndBASIC tour demo program. I'm glad you have made it this far!
EndBASIC is an interpreter for a BASIC-like language and is inspired by
Amstrad's Locomotive BASIC 1.1 and Microsoft's QuickBASIC 4.5. The main idea
behind EndBASIC is to provide a playground for learning the foundations of
programming in a simplified environment.
EndBASIC is written in Rust and is proven to work on Linux, macOS and Windows.
It likely works on other Unix systems too. And, thanks to WASM, it also runs
on the web--which I bet is how you are reading this right now.
If you are accessing EndBASIC via the web interface, please be aware that
this interface is highly experimental and has many rough edges. In particular,
things will go wrong if you try to resize the browser window. Just reload
the page for a "reboot".
[38;5;9mWhen not in the tour, use the HELP command to access the interactive help
system.
[39m
Without further ado, let's get started!
[38;5;11mPress ENTER to continue or ESC to exit the demo...[?25h[2J[1;1H[?25l
EndBASIC tour: Language basics
================================
[39m
There are four primitive types: booleans (?), double-precision floating
point numbers (#), 32-bit signed integers (%), and strings ($).
The common IF and SELECT CASE conditional structures, the DO, FOR, and WHILE
loops, as well as GOSUB and GOTO are supported.
A trivial program to ask a question and print an answer would look like:
@retry: INPUT "Enter a number greater than 10: ", n
IF n <= 10 THEN GOTO @retry
PRINT "Good job!"
Type HELP "LANG" for specific details about the language constructs.
[38;5;11mPress ENTER to continue or ESC to exit the demo...[?25h[2J[1;1H[?25l
EndBASIC tour: File manipulation
==================================
[39m
Given that you are reading this tour, you have already encountered how to
load a program and run it. But here is how you'd go about creating a new
program from scratch:
1. Type NEW to clear the machine's program and variables.
2. Type EDIT to enter the full-screen editor.
3. Type your program in the editor and then press ESC to exit.
4. Optionally save your program with SAVE "some-name.bas".
5. Run the program with RUN.
6. Repeat from 2 if things don't go as planned.
The cycle above works for demos too. You can LOAD any demo program and
enter the interactive editor with EDIT to see and modify its code. What
you cannot do is save them under their original name; you will have to pick
a different name.
If you are in the browser, rest assured that all programs are stored in
your browser's local storage. Nothing goes to the cloud.
[38;5;11mPress ENTER to continue or ESC to exit the demo...[?25h[2J[1;1H[?25l
EndBASIC tour: The file system
================================
[39m
In the previous page, you learned how to create files and how to save and
load them. Those examples used relative paths. However, EndBASIC supports
multiple drives (although it does not yet support directories).
Paths in EndBASIC have the form DRIVE:FILE or DRIVE:/FILE. Given that
directories are not yet supported, both are equivalent, but their meaning
might change in the future. All commands that operate on paths accept these
syntaxes. Note that the DRIVE: part is optional: when not specified, the
current drive (shown by the DIR command) will be used.
You can use the MOUNT command to display the list of currently-mounted drives
and to attach new ones. Pay attention to the default MOUNT output as it
shows some of the possible URIs you can use to mount other drives.
For example, if you want to gain access to an arbitrary directory in the
system, you could do:
MOUNT "TMP", "file:///PATH/TO/TMPDIR"
CD "TMP:/"
Pay attention to the double quotes surrounding these arguments: these are
EndBASIC commands and thus you must provide the arguments as strings. You
are bound to trip over this a few times due to muscle memory...
[38;5;11mPress ENTER to continue or ESC to exit the demo...[?25h[2J[1;1H[?25l
EndBASIC tour: Screen manipulation
====================================
[39m
You have several commands at your disposal to manipulate the contents of
the screen. Visual features are particularly interesting for teaching
purposes, so expect more in this regard.
For example, we can print the foundational colors by selecting them with
the "COLOR" command and positioning the cursor with "LOCATE":
[12;5H[38;5;0mThis is color 0
[13;5H[38;5;1mThis is color 1
[14;5H[38;5;2mThis is color 2
[15;5H[38;5;3mThis is color 3
[16;5H[38;5;4mThis is color 4
[17;5H[38;5;5mThis is color 5
[18;5H[38;5;6mThis is color 6
[19;5H[38;5;7mThis is color 7
[12;24H[38;5;8mThis is color 8
[13;24H[38;5;9mThis is color 9
[14;24H[38;5;10mThis is color 10
[15;24H[38;5;11mThis is color 11
[16;24H[38;5;12mThis is color 12
[17;24H[38;5;13mThis is color 13
[18;24H[38;5;14mThis is color 14
[19;24H[38;5;15mThis is color 15
[39m
[38;5;11mPress ENTER to continue or ESC to exit the demo...[?25h[2J[1;1H[?25l
EndBASIC tour: Hardware access
================================
[39m
If you happen to be running on a Raspberry Pi, EndBASIC has some support
to manipulate its hardware. At the moment this includes only basic access
to the GPIO lines. See the "DEMOS:/GPIO.BAS" demo for an example.
Please note that you have to be running on a Raspberry Pi *AND* you must
have compiled EndBASIC with --features=rpi for this to work.
[38;5;11mPress ENTER to continue or ESC to exit the demo...[?25h[2J[1;1H[?25l
EndBASIC tour: Enjoy
======================
[39m
And that's it for the tour. You can now type EDIT to see the code that
took you over this journey, load other demo files or... just go forth and
explore. HELP, MOUNT, and DIR are your friends at any point, but so that
you don't feel too lost, run this now:
[38;5;1m CD "DEMOS:/"
DIR
[39m
If you like what you have seen so far, please head to the project's GitHub
page and give it a star:
[38;5;12m
https://github.com/endbasic/endbasic/
[39mThen, visit my blog and subscribe to receive fresh EndBASIC content or...
you know, to keep me motivated in writing stuff and building this project:
[38;5;12m
https://jmmv.dev/
[39mThank you! :-)
[38;5;10m-- Brought to you by Julio Merino <jmmv@>
[?25h[39m