memotech-bill / picobb Goto Github PK
View Code? Open in Web Editor NEWBBC BASIC for Raspberry Pi Pico
License: zlib License
BBC BASIC for Raspberry Pi Pico
License: zlib License
i want to be able to to use my computer with picocom with serial interface but use a little oled or lcd. how would i do this?
This instruction is reporting 'Too many parameters':
ADCS r0, r0, r3
The reference I am using for the Cortex-M0+ instruction set is here. I am assuming that the assembler is designed to accept 'unified syntax', not the old Thumb16 syntax which is deprecated.
Are you planning to support the Raspberry Pi Pico W? I'm assuming that all this would involve is adding to the list of functions callable by SYS those necessary to access the network stack (and then somebody writing a library to make use of them, ideally compatible with the existing BBC BASIC 'socklib' libraries).
I use the bbcbasic_pwg version on a VGA base to play around with BBC BASIC. To me it seems that the USB keyboard input is kinda sluggish - there is a noticeable delay with keyboard presses and sometimes even keypresses are missed. I tried several different USB keyboards, but that made no difference.
This behavior makes direct programming on the device harder as you have to watch each keypress and type carefully. Are there any ways to make the keyboard more responsive?
It appears that some of the example programs bundled with the Pico console edition are GUI versions, which can't run, rather than the correct console versions. Specifically these are calendar.bbc, hanoi.bbc, sortdemo.bbc, sudoku.bbc and timing.bbc. The code at fault seems to be here:
cp ../../BBCSDL/examples/general/calendar.bbc tree/
cp ../../BBCSDL/examples/general/sortdemo.bbc tree/
for i in hanoi.bbc sudoku.bbc sudoku.dat; \
do cp ../../BBCSDL/examples/games/$$i tree/$$i; done
cp ../../BBCSDL/examples/tools/timing.bbc tree/
Probably it should be deleted.
It appears that if the FAT filesystem is enabled, but there's no SD card (or for some reason it cannot be mounted), the 'autorun' facility does not work. I suspect it is waiting indefinitely for a console connection in order to output the 'Failed to mount SD card' message, before running 'autorun.bbc'.
The syntax for open a serial port using BBC BASIC Windows is :
port% = OPENUP("COM1: baud=9600 parity=N data=8 stop=1")
What is the syntax to use for the PI PICO ?
Best regards
Georges
Running this program:
MODE 3
PRINT STRING$(100, "0123456789")
results in the first line wrapping one character early on the Pico, but not when run locally in a native console; I don't understand why there should be a difference. Here is a screenshot from the Pico (PuTTY in Windows, the same thing happens with picoterm in Linux):
and here running locally (Windows):
I had a request for a version of Pico BBC BASIC that used a USB console for program entry and editing, but was still able to display text and graphics on a VGA monitor.
I have implemented an experimental version to do this: bbcbasic_pkv.zip (Zipped UF2 file).
Output is controlled by the *output
command:
*output 0
sends output to the USB console*output 14
sends output to the VGA display*output 15
sends output to bothe the console and the VGA displayRemember that BBC BASIC implements plotting via VDU commands, so output must be directed to the VGA display in order to run any of the plotting commands. The console driver ignores the plotting commands.
The attached build has no support for UART console, SD card or Sound. This leaves all the Pico pins not used for VGA output free for use. In particular the three ADC pins are free.
The Makefile for this build is in the console/pico_v
folder.
I'm sorry to raise this as an 'issue', but I couldn't find a more appropriate way. To enable BBCSDL-like sound some changes to the files in your repository are necessary. Here are the details:
bbpico.c
146a147,148
> #elif PICO_SOUND == 3
> ", SDL Sound"
1701a1704,1707
> #if PICO_SOUND == 3
> envels = (signed char*) (filbuf[0] + 0x800); // Envelopes
> waves = (short*) (envels + 0x100); // Sound wave buffer
> #endif
Makefile
3c3
< SOUND=N
---
> SOUND=SDL
11a12,13
> ../../BBCSDL/src/sound_sdl.c \
> ../../BBCSDL/src/bbccos.c \
14d15
< ../../src/bbccos.c \
CMakeLists.txt
These changes were made in an ad-hoc fashion; they cause the other builds to fail so need to be re-worked by somebody who understands CMake!
28c28
< ../../src/bbccos.c
---
> ../../BBCSDL/src/bbccos.c
62a63,64
> pico_multicore
> hardware_pwm
87a90,103
> elseif ( ${SOUND} STREQUAL "SDL")
> message(STATUS "Generate sound like BBCSDL")
> target_compile_definitions(bbcbasic PUBLIC
> -DPICO_SOUND=3
> PICO_MCLOCK
> PICO_STACK_SIZE=0x3B800
> PICO_CORE1_STACK_SIZE=0x800
> )
> pico_set_linker_script(bbcbasic
> ${CMAKE_SOURCE_DIR}/../pico_gui/gui_pico.ld
> )
> target_sources(bbcbasic PRIVATE
> ../../BBCSDL/src/sound_sdl.c
> )
166,167c182,183
< target_compile_definitions(bbcbasic PUBLIC PICO_STACK_SIZE=0x3C000)
< pico_set_linker_script(bbcbasic ${CMAKE_SOURCE_DIR}/bbc_pico.ld)
---
> # target_compile_definitions(bbcbasic PUBLIC PICO_STACK_SIZE=0x3C000)
> # pico_set_linker_script(bbcbasic ${CMAKE_SOURCE_DIR}/bbc_pico.ld)
173,174c189,190
< target_compile_definitions(bbcbasic PUBLIC PICO_STACK_SIZE=0x3C000)
< pico_set_linker_script(bbcbasic ${CMAKE_SOURCE_DIR}/bbc_pico.ld)
---
> # target_compile_definitions(bbcbasic PUBLIC PICO_STACK_SIZE=0x3C000)
> # pico_set_linker_script(bbcbasic ${CMAKE_SOURCE_DIR}/bbc_pico.ld)
180,181c196,197
< target_compile_definitions(bbcbasic PUBLIC PICO_STACK_SIZE=0x3C000)
< pico_set_linker_script(bbcbasic ${CMAKE_SOURCE_DIR}/bbc_pico.ld)
---
> # target_compile_definitions(bbcbasic PUBLIC PICO_STACK_SIZE=0x3C000)
> # pico_set_linker_script(bbcbasic ${CMAKE_SOURCE_DIR}/bbc_pico.ld)
I'm not sure whether this is your issue or mine, but the Pico version of BBC BASIC is reporting 'Number too big' from this statement:
PRINT 1/0
whereas I would have expected 'Division by zero'. The other editions (including ARM editions) built from the same source code work as expected, so something strange is happening. The relevant code is this in bbeval.c:
if (isinf(x.f) || isnan(x.f) || (x.i.t == -1) || errno)
{
if (op == '/')
error (18, NULL) ; // 'Division by zero'
else if (op == '^')
error (22, NULL) ; // 'Logarithm range'
else
error (20, NULL) ; // 'Number too big'
}
There's no way that op can be anything other than '/' that I can see from the code.
I get an error about "multiple definition of `libtop'" when I try to make the project with Ubuntu 22.04 on an Intel 64 bits CPU :
~/src/PicoBB/bin/pico$ export PICO_SDK_PATH=/home/chips/src/pico-sdk/
~/src/PicoBB/bin/pico$ export PICO_EXTRAS_PATH=/home/chips/src/pico-extras/
~/src/PicoBB/bin/pico$ export PICO_BOARD=vgaboard_sd
~/src/PicoBB/bin/pico$ LANG=C make
rm -rf build
mkdir -p build
cd ../../src/pico && symbols/header_funcs.py /home/chips/src/PicoBB/bin/pico//build/symbols_sdk.txt /home/chips/src/PicoBB/bin/pico//build/pico_stub.c \
../../src/pico/symbols/sdk_headers.txt ../../src/pico/symbols/sdk_cyw43_gpio.txt
../../src/pico/symbols/merge_funcs.py build/sympico.h build/symbols_sdk.txt
cd build && PICO_SDK_PATH=/home/chips/src/pico-sdk/ \
cmake -DPICO_BOARD=vgaboard_sd_w -DSTDIO=PICO -DLFS=Y -DFAT=Y -DSOUND=I2S \
-DSTACK_CHECK=4 -DMIN_STACK=Y -DPRINTER=N -DSERIAL_DEV=0 \
-DCYW43=GPIO -DBBC_SRC=../../BBCSDL --no-warn-unused-cli -S ../../../src/pico -B .
Not searching for unused variables given on the command line.
Using PICO_SDK_PATH from environment ('/home/chips/src/pico-sdk/')
PICO_SDK_PATH is /home/chips/src/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
Using PICO_EXTRAS_PATH from environment ('/home/chips/src/pico-extras/')
-- The C compiler identification is GNU 10.3.1
-- The CXX compiler identification is GNU 10.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
Build type is Release
Using PICO_BOARD from environment ('vgaboard_sd')
...
[100%] Linking CXX executable bbcbasic.elf
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/bbcbasic.dir/home/chips/src/PicoBB/src/bbpico.c.obj:/home/chips/src/PicoBB/src/bbpico.c:340: multiple definition of `libtop'; CMakeFiles/bbcbasic.dir/home/chips/src/PicoBB/BBCSDL/src/bbmain.c.obj:/home/chips/src/PicoBB/BBCSDL/src/bbmain.c:50: first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/bbcbasic.dir/build.make:1767: bbcbasic.elf] Error 1
make[3]: Leaving directory '/home/chips/src/PicoBB/bin/pico/build'
make[2]: *** [CMakeFiles/Makefile2:1744: CMakeFiles/bbcbasic.dir/all] Error 2
make[2]: Leaving directory '/home/chips/src/PicoBB/bin/pico/build'
make[1]: *** [Makefile:91: all] Error 2
make[1]: Leaving directory '/home/chips/src/PicoBB/bin/pico/build'
make: *** [../../src/pico/Makefile:179: bbcbasic_pkg.uf2] Error 2
Hi,
I find a program "blink" to SET / RESET pins.
What is the syntax to read a PIN STATE ?
Thanks for all
Georges
When the pico powers up with your uf2 tinyusb makes your program output wait until DTR is asserted. The problem is the time between DTR being asserted and you expecting a reply from your terminal width enquiry is critical.
When Hearsay - the terminal program I'm modifying on riscos - starts up a terminal it asserts DTR early for modem connection - yes old school - and as a result misses your cursor position enquiry reply window which it handles when it is ready. As a result of not getting the cursor position enquiry early enough you default to a 1 column row. This isn't a problem if I reset the pico usb then reconnect from the terminal window
If I type MODE whatever the screen resizes with the esc[t command you send with a mode change.
Can't you start your program with a MODE whatever instead of inquiring the screen size? Then you are not dependent on a timely reply.
When trying to build PicoBB on a Raspberry Pi 400 (Raspbian Buster, fully updated, and freshly installed Pico-SDK) I am getting this error:
cc: error: unrecognized command line option '-fcallgraph-info=su'
It's entirely likely that this results from me doing something silly, or not doing something I should, but I don't know how to proceed.
Because of upstream changes bbpico.c
needs these modifications:
index 849285d..06e8e92 100644
--- a/src/bbpico.c
+++ b/src/bbpico.c
@@ -1,12 +1,12 @@
/******************************************************************\
* BBC BASIC Minimal Console Version *
-* Copyright (C) R. T. Russell, 2021-2022 *
+* Copyright (C) R. T. Russell, 2021-2023 *
* *
* Modified 2021 by Eric Olson and Memotech-Bill for *
* Raspberry Pico *
* *
* bbpico.c Main program, Initialisation, Keyboard handling *
-* Version 0.40a, 23-Jan-2022 *
+* Version 0.45a, 03-Sep-2023 *
\******************************************************************/
#ifndef KBD_STDIN
@@ -133,7 +133,7 @@ static inline void ISTORE(void* p, int i){ if ((intptr_t)p&3) *((unaligned_int*)
#define ESCTIME 200 // Milliseconds to wait for escape sequence
#define QRYTIME 1000 // Milliseconds to wait for cursor query response
-#define QSIZE 16 // Twice longest expected escape sequence
+#define QSIZE 32 // Twice longest expected escape sequence
#ifdef _WIN32
#define HISTORY 100 // Number of items in command history
@@ -371,6 +371,7 @@ char *szCmdLine;
int MaximumRAM = MAXIMUM_RAM;
timer_t UserTimerID;
unsigned int palette[256];
+void *TTFcache[1];
#ifdef PICO
void *libtop;
#endif
@@ -459,6 +460,7 @@ void quiet (void);
// Dummy functions:
void gfxPrimitivesSetFont(void) { };
void gfxPrimitivesGetFont(void) { };
+void RedefineChar(void) { };
// File scope variables:
#if KBD_STDIN
It looks as though a debug flag has been left set in the console mode build. For example if I start BBC BASIC and enter:
CHAIN "solve"
It displays the following:
Above MaximumRAM = 0x20027700
Above MaximumRAM = 0x20027700
Enter number of unknowns (2-6):
Here the "Enter number of unknowns (2-6):" is the expected prompt from the program but the other two lines are spurious.
If you escape out of snake the cursor is off type MODE 3 and it is still off
A minor problem but it would be nice to have the cursor switched back on.
If i try to set the time with TIME$="FR.10 Mar 2023,17:00:00" I get the message mistake.
If it needs a RTC on which GPIO pins does it expect the I2C RTC?
Hello
Something is going wrong , and I don't know how to fix the problem
cp build/bbcbasic.elf bbcbasic_pkc.elf
cd ../../src/lfsutil && make mklfsimage
cd ../../littlefs && make
make[2]: Nothing to be done for `all'.
gcc -O2 -Wall -I.. -I../../littlefs -I../../include -o mklfsimage mklfsimage.c ../lfsmcu.c ../../littlefs/lfs.a
clang: error: no such file or directory: '../../littlefs/lfs.a'
make[1]: *** [mklfsimage] Error 1
make: *** [../../src/lfsutil/mklfsimage] Error 2
I have tried tirelessly for hours to build the serial + vga builds but its very difficult. it would be good to include the builds as many people do not have a OTG adapter and can't build the correct uf2. the whole build process is confusing.
it outputs vga fine but makes the sprites look like tv static. also how do i build a VGA version but with usb serial. i dont like having to constantly run *output 15
every time i make a typo. also, a clockspeed star command would be nice because some programs run too quickly.
SYS "memcpy"...
is now reporting "No such system call". It used to work - it's needed by the picowav.bbc example program - but seems to have gone AWOL.
I've updated all the other Console Mode editions to v0.42, but this issue is preventing me from updating the Pico build.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.