LoginLogin
Might make SBS readonly: thread

I Got a Pi STARTER

Root / General / [.]

amihartCreated:
Pi STARTER vs PasocomMini MZ-80C The Pi STARTER's version of SmileBASIC is called "SmileBASIC-R" and seems to be an improved version of the PasocomMini MZ-80C's SmileBASIC. The SmileBASIC on the PasocomMini MZ-80C had different commands than the console versions and some things worked differently. It had better commands when dealing with file-handling since you actually control the real file system, and it also has commands for Raspberry Pi specific things like controlling the GPIO pins. The Pi STARTER is the same way but with some commands added and some removed and overall a more stable version. They removed all commands dealing with the emulator. In the PasocomMini MZ-80C, you had commends like "emustop" and "emutrace" and "emumem" etc which could control the emulator. Since there is no emulator here, those commands were pulled. One nice thing about Pi STARTER is that it does not try to take over your whole Pi. It's not like the PasocomMini MZ-80C where it boots directly into software and there is no way to close it without turning off the machine. The Pi STARTER adds a "quit" command in SmileBASIC which closes the software but does not turn off the Pi, it instead returns you to standard Bash shell so you can then just use Raspbian normally and do standard Pi-related things, and then when you are ready to use SmileBASIC again you just type in the command and it reloads. The Pi STARTER also has internet capabilities, unlike the board in the PasocomMini MZ-80C which lacked any internet capabilities. HTTPGET$() / HTTPOST$() Pi STARTER has new internet-related commands, which are pretty neat. Specifically, they added HTTPGET$() and HTTPPOST$() as well as URLENCODE(). Here I will show you how to write a simple program to send and receive files from your computer and Pi STARTER over WiFi. This does not even require an internet connection, both devices just have to be connected to the same router, independent of whether or not that router is connected to a modem. In order to do this, you first have to install PHP. On Windows, go to C:\Program Files and create a new folder called PHP. Download this and then double-click it to open it, select all files (Ctrl+A) and copy and paste them into that PHP folder. Right-click "This PC" and click "Properties" then "Advance Settings" and then "Environment Variables..." and in the second "System variables" box, click "Path" then the "Edit..." button then click the "New" button and type in "C:\Program Files\PHP" (without quotes). And that's it, PHP will be installed! In order to transfer programs over WiFi between your computer and the Pi STARTER, you have to write a program that will listen for the Pi STARTER and respond to its requests. Here is a very simple PHP script to do this.
Spoiler
<?php
if ($_POST["type"] == "receive") {
	$fname = $_POST["name"];
	if (file_exists($fname)) {
		$file = fopen($fname, "r");
		echo fread($file, filesize($fname));
		fclose($file);
	
	}
} else if ($_POST["type"] == "send") {
	$fname = $_POST["name"];
	$fdata = $_POST["data"];
	$file = fopen($fname, "w");
	fwrite($file, $fdata);
	fclose($file);
}
?>
Here is a simple PHP program which I named "index.php" (name is important). It checks for a post request "type" and if that equals "receive" then it reads a file with the file name stored in the post request "name" and then "echoes" (returns) that file data. If the "type" is instead "send" then it checks the post request "name" for a file name then "data" for the file's contents, and then it opens a file with that name and writes the data to it. I can then create something similar in SmileBASIC on the Pi STARTER's end.
Spoiler
option strict
var PROTOCOL$ = "http"
var IPADDR$ = "192.168.0.29"
var PORT$ = "8083"
def ConnStr$()
  return PROTOCOL$ + "://" + IPADDR$ + ":" + PORT$
end
def SendFile fname$
  var fdata$ = load("txt:" + fname$)
  var datstr$ = "type=send"
  push datstr$, "&name=" + fname$
  push datstr$, "&data=" + urlencode$(fdata$)
  var junk$ = httpost(ConnStr$(), datstr$)
end
def ReceiveFile fname$
  var datstr$ = "type=receive"
  push datstr$, "&name=" + fname$
  var fdata$ = httpost(ConnStr$(), datstr$)
  save "txt:" + fname$, fdata$
end
In order for the Pi to connect to your computer, you need a connection string. The connection string consists of a protocol followed by "://" then an IP address followed by ":" and then a port number. We can then follow that with "/" and a path, however, since we named our PHP file "index.php", we do not have to as it will automatically know to access index.php by default. Here I am using a local IP address for my computer on the local network. On Windows, you can open the Command Prompt and type in "ipconfig" and you should see a section titled something like "Wireless LAN adapter" and under it "IPv4 Address" and that row will tell you your local IP address. The port is something you can choose arbitrarily, I just picked port 8083 at random. Use whatever port you want. If you have PHP installed on your computer, just open the Command Prompt, type in "cd " followed by a path to where your index.php file is located, then type "php -S 192.168.0.29:8083" to run the program (if you get a "is not recognized as an internal or external command" error then you did not install PHP properly), replacing the "192.168.0.29" by whatever your local IP address is and "8083" by whatever port number you wish to use. In the SmileBASIC codeblock above, I actually sent that from my Pi STARTER to my computer simply by typing in:
SendFile "ftrans"
That opened the file "ftrans" (I named it this for "file transfer") and then sent it to my computer, and then the PHP code received the data and wrote it also to a file named "ftrans". I could then just open this file and copy/paste the contents to this post. Pretty cool! Although take note that the size of data you can send out as a post request is rather limited, so you may need to break the file up into multiple post requests if it is quite a lengthy file you are sending. I would find developing for this thing a lot easier than developing on a 3DS since you can transfer large files over like images and such basically instantly without any wires. The Pi STARTER does use an older version of SmileBASIC though than the Switch with different commands, so once it is complete and you wish to transfer your completed program over to 3DS and Switch to publish, some additional porting will likely be required. SYSTEM$() One of the neatest new commands is SYSTEM$(). It executes a Linux command and returns the output as a string. Meaning, you can write programs in something like C or JavaScript or PHP and then call them in SmileBASIC and get the output. We can even create a whole usuable shell interface purely within SmileBASIC itself.
Spoiler
def ws(s$)
  if asc(s$) < 33 then return 1
  return 0
end
def trim$(s$)
  if len(s$) == 0 then
    return s$
  endif
  while asc(s$[0]) < 33
    s$ = right$(s$, len(s$) - 1)
    if len(s$) == 0 then
      return s$
    endif
  wend
  while asc(s$[len(s$) - 1]) < 33
    s$ = left$(s$, len(s$) - 1)
    if len(s$) == 0 then
      return s$
    endif
  wend
  return s$
end
def GetAddr$()
  var addr$ = ""
  var info$ = system$("ifconfig -a")
  while left$(info$, 5) != "wlan0"
    info$ = right$(info$, len(info$) - 1)
    if len(info$) == 0 then
      return "offline"
    endif
  wend
  while left$(info$, 4) != "inet"
    info$ = right$(info$, len(info$) - 1)
    if len(info$) == 0 then
      return "offline"
    endif
  wend
  info$ = right$(info$, len(info$) - len("inet"))
  while asc(info$[0]) < 33
    info$ = right$(info$, len(info$) - 1)
    if len(info$) == 0 then
      return "offline"
    endif
  wend
  var i
  for i = 0 to len(info$) - 1
    if asc(info$[i]) < 33 then
      break
    endif
    addr$ = addr$ + info$[i]
  next
  return addr$
end

var addr$ = GetAddr$()
var home$ = trim$(system$("pwd"))
var path$ = home$
var prompt$
var cmd$ = ""
while true
  prompt$ = path$
  if len(prompt$) >= len(home$) then
    if left$(prompt$, len(home$)) == home$ then
      prompt$ = "~" + mid$(prompt$, len(home$), len(prompt$) - len(home$))
    endif
  endif
  color rgb(22, 198, 12)
  print "pi@" + addr$;
  color rgb(204, 204, 204)
  print ":";
  color rgb(59, 120, 255)
  print prompt$;
  color rgb(204, 204, 204)
  print "$ ";
  input "", cmd$
  cmd$ = trim$(cmd$)
  if cmd$ == "exit" then
    break
  endif
  if left$(cmd$, 2) == "cd" then
    cmd$ = "HOME='" + home$ + "'&&cd '" + path$ + "' && " + cmd$
    if len(trim$(system$(cmd$))) == 0 then
      cmd$ = cmd$ + " && pwd"
      path$ = trim$(system$(cmd$))
    else
      print system$(cmd$)
    endif
  elseif left$(cmd$, 5) == "HOME=" then
    cmd$ = "HOME='" + home$ + "'&&cd '" + path$ + "' && " + cmd$
    cmd$ = cmd$ + "&&echo $HOME"
    home$ = trim$(system$(cmd$))
  else
    cmd$ = "HOME='" + home$ + "'&&cd '" + path$ + "' && " + cmd$
    print system$(cmd$)
  endif
wend
I don't really have a good way to capture HDMI but you can sort of see what it looks like in this low-quality video. It runs the commands with the "pi" user which is part of the "sudo" group meaning you can use "sudo " before a command and run it with administrator privileges. So they really don't try to lock you out of anything. I'm really happy how Pi STARTER does not try to lock you into propriety stuff but gives you full access to everything alongside SmileBASIC. It doesn't remove any features from the Pi but only adds features. The system$() functionality is nice because you do not even need to leave Pi STARTER to do a lot of things. For example, I can even write a C program within Pi STARTER, compile and run it, without ever leaving it. Again, another low quality video. Performance One thing I was curious about is performance. Not just how does the Pi STARTER compare to 3DS and Switch, but does the Pi STARTER even take full advantage of the Raspberry Pi? By this I mean, if I upgrade my Raspberry Pi, will I actually see a performance boost? What if I overclock my Pi? I have a Pi 1, 2, 3, and 4. Pi STARTER technically boots on the Pi 1 but is incredibly buggy and I had to try a few times to even get into the menu to run the speed test. It does not boot at all on the Pi 4. This is probably an issue with the version of Raspbian and not SmileBASIC so with some work it may be possible to boot it, but I'm just going to leave Pi 4 out of the testing for now. The speed tests list 4 categories and the greater the number, the faster the speed. Here is the data for Pi 1A+ / Pi 2B / Pi 3B+: Addition: 58147 / 711994 / 1611856 PRINT Statement: 14051 / 19751 / 22587 Moving a sprite: 25210 / 307894 / 808431 Drawing a line: 9207 / 10619 / 66355 As you can see, it does indeed improve in speeds with better Pis, and quite significantly as well. I might try to overclock my 3B+ in the future to see if I can get better scores from it. Let's run compare these scores to the DSi / 3DS / New 3DS / Switch: Addition: 14348 / 178261 / 596599 / 2057723 PRINT Statement: 4173 / 35401 / 148326 / 851788 Moving a sprite: 9969 / 80265 / 294073 / 1176164 Drawing a line: 5709 / 21783 / 82761 / 310204 Does Pi STARTER outperform the console version of SmileBASIC? Well, it depends. It outperforms the DSi. For some reason, the PRINT statement is pretty fast on the 3DS, but other than that, if you have at least a Pi 2, it will generally do a bit better than the original 3DS. The peformance seems to be very different depending on the different tests, but I'd assume generally you'd get around new 3DS or better performance depending on the type of game. Of course, as expected, even the 3B+ falls behind the Switch in every category. So you're looking at performance that sits between New 3DS and Switch. Keyboard You can order the Pi STARTER with a special keyboard designed specifically for SmileBASIC. Although, if your order the bundled version, they annoyingly do not send you a real case for the Pi STARTER. They send the SD card in a little envelope case which doesn't really look good on your shelf like the normal case. So it might be better to buy them separately than to buy the bundle of them together. Although I'm honestly not sure if this is caused by me ordering it as a bundle or maybe they've discontinued the nicer cases entirely. I assume the former but it could also be the latter. The keyboard is a Japanese keyboard with the different little symbols you can use in SmileBASIC on the different keys, like the little person character, the clock, the apple, the music note, the smiley face, the space invader, etc. So you can type these symbols more easily. You can also use the KBDTYPE command to just switch to a standard US keyboard if you do not have this fancy keyboard. The SmileBASIC keyboard also works pretty well with the Nintendo Switch even in the US version. For a membrane keyboard, it is surprisingly comfortable to use, the keys don't feel mushy at all and feel pretty nice to type on. Menus There are 9 boxes you can click when you boot it.
  • Tech Demo
  • Change settings
  • Software update
  • Play SOLID GUNNER-R
  • Write a program
  • View useful TIPS
  • Mouse-only Paint Tool
  • GPIO Monitor
  • File Management
The GPIO Monitor is quite neat because when coding for WiringPi I often have to go to their website to look up a diagram for all the pins. This has a built-in thing for you which is neat. File management can also download from the internet and also mount USB devices. Public Keys I can't seem to find anywhere in the Pi STARTER software to download programs from public keys. I tried to translate all the menus and couldn't find anything. You can pull some data down using the API that this website uses.
Spoiler
option strict
var PKEY$ = "QK4N3PZF"
var API$ = "http://sbapi.me/get/"
def ParseList$(ls$)
  dim ret$[0]
  ls$ = mid$(ls$, 2, len(ls$) - 4)
  var i
  var name$ = ""
  for i = 0 to len(ls$) - 1
    if ls$[i] != chr$(34) then
      name$ = name$ + ls$[i]
    else
      push ret$, name$
      i = i + 2
      name$ = ""
    endif
  next
  if len(name$) != 0 then
    push ret$, name$
  endif
  return ret$
end
def DownloadText n$
  var txt$ = httpget$(API$ + PKEY$ + "/" + n$ + "/text")
  save "txt:" + mid$(n$, 1, len(n$) - 1), txt$
end
def DownloadBinary n$
  var txt$ = httpget$(API$ + PKEY$ + "/" + n$ + "/csv")
  var ret%[0]
  var num$ = ""
  var i, c$
  for i = 0 to len(txt$) - 1
    num$ = ""
    c$ = txt$[i]
    while asc(c$) < asc("0") || asc(c$) > asc("9")
      i = i + 1
      if i >= len(txt$) then break
      c$ = txt$[i]
    wend
    while asc(c$) >= asc("0") && asc(c$) <= asc("9")
      num$ = num$ + c$
      i = i + 1
      if i >= len(txt$) then break
      c$ = txt$[i]
    wend
    push ret%, val(num$)
  next
  save "dat:" + mid$(n$, 1, len(n$) - 1), ret%
end
'Grab program name
print "Fetching program name..."
var INFO$ = httpget$(API$ + PKEY$ + "/info?json=1")
var NAME$ = ""
var beginCopy = 0
var i
for i = 0 to len(INFO$) - 1
  if mid$(INFO$, i, len("filename")) == "filename" then
    i = i + len("filename") + 4
    beginCopy = 1
  endif
  if beginCopy then
    if INFO$[i] == chr$(34) then
      break
    endif
    NAME$ = NAME$ + INFO$[i]
  endif
next
print "Creating new directory..."
'Create the directory
mkdir NAME$
chdir NAME$
print "Fetching all files..."
'Get a list of all the files
dim LIST$[0]
LIST$=ParseList$(httpget$(API$ + PKEY$ + "/list?json=1"))
i = 0
for i = 0 to len(LIST$) - 1
  print "Downloading ";
  print i + 1;
  print "/";
  print len(LIST$);
  print " (" + mid$(LIST$[i], 1, len(LIST$[i]) - 1) + ")..."
  var n$ = LIST$[i]
  if n$[0] == "T" then
    DownloadText n$
  else
    DownloadBinary n$
  endif
next

chdir ".."
(the website broke the third line of code... that is not what I typed, there are now URL brackets there) I seem to have issues with binary files, though. If I pull the "/raw" file down using Bash then the file fails to load. So here I set it up to pull down the /csv for "DAT:" (assuming one-dimensional integers) binary files and /text for "TXT:" text files. But this breaks if those binary files are something like GRP or whatever. The headers are not the same in Pi STARTER so if I pull the raw binary file down it won't load properly. I can't even pull down the headers because the null characters in the headers break things. Maybe someone else can figure that out, it honestly doesn't seem worth the effort because most every program contains 3DS-specific stuff and you have to manually port it anyways. DRM I guess some one would probably wonder if Pi STARTER is DRM protected. And the answer is yes. It comes with a license key which you register. In fact, I don't even think the software comes on the SD card they provide. The SD card only has software to connect to their servers, and then you input the license key and it downloads the software. You do not need to be on the internet to use it every time, though, because after it verifies your license key, it creates a license file which ties itself to your SD card so you can then use it offline or in any Pi, but cannot clone the SD card without connecting to the servers again and re-inputting the license key. Although the verification to prevent you from cloning the SD card is literally just a CID check which is pointless since you can spoof the CID in like 1 line of code on Raspberry Pis. Although you still would not want to clone SD cards because if they see that somehow your SD card is requesting updates from many many different IP addresses, they'd probably catch on quick and ban that license key and then no more updates forever. The CID check almost seems a bit pointless, the check with verifying the license key online is where the real DRM is at. At least until they stop releasing updates. Emulation If this allows you to run SmileBASIC on a Pi, then can you emulate a Pi and run SmileBASIC on your PC? The answer is no. Because there is literally no such thing as a Raspberry Pi emulator. There are articles that claim to "emulate the Raspberry Pi" but they are incredibly misleading. The emulator QEMU has the capabilities of emulating the ARM instruction set, so these people load Raspbian into it, boot it, see the Raspberry Pi logo, and declare that they've emulated the Raspberry Pi! But no, they have not. All they've done is emulate a generic ARM CPU, which is enough to boot Raspbian. But the moment you try to do anything that requires the Pi's hardware, it will crash. SmileBASIC is focused largely on game development. So of course it will utilize the Pi's GPU. Meaning, it is impossible to emulate. In QEMU, I managed to boot the SD card and have it verify with SmileBoom's servers, but then it immediately crashes, throwing an error that it could not find the Videocore GPU, because of course it can't, QEMU does not emulate it. No one has fully reverse-engineered the Pi's GPU. I don't know why the Pi is so hard to emulate, but no one has done it yet, so forget emulating it. Getting This If you are wondering how I got it, SmileBoom still in 2021 is selling this here. You have to go through a proxy service to buy it, I bought it through one called ZenMarket, which is also where i got my PasocomMini MZ-80C through. The End I don't really know if anyone here even cares much about about this. But I like it a lot. If there are still people here who care about this, you can ask whatever other question you want and I'll try to answer it here. I know there is another thread on Pi STARTER but I saw a mod tell someone not to necrobump so I decided to make a new thread, so if anyone wants me to try something or wants to see me run something on it or whatever, you can post that here.

The Raspberry Pi 4B has a different boot process that makes it so you can't use existing SD cards. Judging by how long ago it was released, it's probably also based on Debian Stretch, whereas the Pi 4B requires a Raspbian version based on Buster.

The Raspberry Pi 4B has a different boot process that makes it so you can't use existing SD cards. Judging by how long ago it was released, it's probably also based on Debian Stretch, whereas the Pi 4B requires a Raspbian version based on Buster.
Yeah I thought as much. But I have tried upgrading the SD image it came on to Buster with no luck. I thought maybe I'd just install Buster fresh and then transfer the software over, but then getting it to actually work has been a pain. It wouldn't run at first because it needed libcurl3 and apt refused to let me install that so I had to uninstall 4 and get the .deb directly from the Debian website. But now I've encountered another issue. * failed to add service - already in use? No idea what this means, but I found a forum post stating this.
There is no legacy / firmware GL driver on the Pi4. The V3D block has been upgraded (from VideoCore 4 to VideoCore 6) and the firmware has no driver for it. Legacy mode gives you a DispmanX based framebuffer (instead of DRM/KMS) but no GL/GLES at all on Pi4, and that isn't going to change. Forgive my naivete, I'm just an end user trying to compile an application...the chip changed significantly. Think of it as changing from a Nvidia/ATI/Intel Generation X graphics card to a Generation Y graphics card. It's programmed differently so needs driver updates. On the old generation there was a processor as part of the GPU (VideoCore) that basically took high level GLES commands and executed them on the hardware, mainly as the ARM cores on the Pi0 & 1 aren't up to the processing to set the hardware up. On the new generation the ARM cores are far beefier, and all the code to convert the GL and GLES commands into instructions to drive the hardware is already written as part of the Linux kernel and Mesa support applications.
If this means it has to be recompiled from source then we are out of luck. If there is some other change that could it working, I have no clue.