Earlier on this blog, I posted something about the BASIC language on Linux.
It turns out that all the tools mentioned in this posting are available on Raspberry Pi computers too. In fact, BWBASIC, FreeBasic and Geany work in the exact same way.
Earlier on this blog, I posted something about the BASIC language on Linux.
It turns out that all the tools mentioned in this posting are available on Raspberry Pi computers too. In fact, BWBASIC, FreeBasic and Geany work in the exact same way.
Raspberry Pi computers may not always have the best amount of RAM available. For small embedded applications, this is just perfect, no precious ram wasted by remaining empty.
However, depending on the application, more memory might be required. The fallback would be virtual memory. In big server installations, swap is not even a topic. However, if an SD-card is were the files live on, SWAP is somewhat out of the picture.
If CPU power is not an issue, ZRAM might be a solution of the RAM-shortage of an RPi-application.
While my RPi500 has plenty of RAM, I installed ZRAM anyways.
This is what my present memory situation looks like:
total used free shared buff/cache available
Mem: 8131616 835544 6173708 103560 1315828 7296072
Swap: 4270584 0 4270584
Who does not remember the good old times when all (home) computers came with BASIC. To recreate the good old time feeling, BASIC had to be back on my Linux systems.
I figured out a combination of bwbasic and FreeBasic.
The Bywater BASIC interpreter offers an interactive environment, similar to GW-BASIC. With a tiny trick, bwbasic can be used in a batch mode directly from shell. The "trick" being using the SYSTEM or QUIT statement at the end of the code, rather than the END statement. Here is an example:
10 for i=0 to 10
20 gosub 100
30 next
40 ?
50 system
100 ? i;
110 return
Line numbers are not necessary, however, line numbers allow to edit the code in the bwbasics interactive environment.
Sometimes, one might want to compile a program. In comes the FreeBasic compiler. It is important to point out that bwbasic and FreeBasic are not 100% compatible. I order successfully compile code as displayed above, one needs to the a "-lang" option. I found "fbc -lang qb [filename]" to work fine.
Another remark, while SYSTEM and QUIT are equivalents under bwbasic, fbc does understand SYSTEM, but not QUIT.
One interesting comparison is the performance of the interpreter and the compiled code.
Interpreter:
$ time bwbasic count.bas
Bywater BASIC Interpreter/Shell, version 2.20 patch level 2
Copyright (c) 1993, Ted A. Campbell
Copyright (c) 1995-1997, Jon B. Volkoff
0 1 2 3 4 5 6 7 8 9 10
real 0m0.007s
user 0m0.003s
sys 0m0.004s
In my previous post. I discussed the use of a Dell Wyse 5060 thing client. There is a better option, which meanwhile made it into my collection, the Dell Wyse 5070.
The version I got is equipped with a 16GB onboard eMMC device, which is big enough for a small Linux installation. My joice fell on Xubuntu Minimal. With some additional software installed, 48% of the eMMC drive are used, roughly 6.5GB.
To keep things simple, I am using an external 2TB USB3 HDD. This disk is partitioned into a Linux swap and an ext4 partition. The ext4 partition serves as home-drive.
Swapping over USB3 is certainly not ideal. However, with only 4GB RAM, swap is desireable. In order to improve on the swap situation, zram takes care of part of the virtual memory. The total virtual memory is now 4GB (HDD) + 1.8GB (zram).