Skip to content

Commit bd314e9

Browse files
authored
Merge pull request #240 from chrisws/12_28
12 28
2 parents 5d8f044 + 593a645 commit bd314e9

File tree

107 files changed

+3736
-905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3736
-905
lines changed

ChangeLog

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
2025-02-18 (12.28)
2+
ANDROID: added experimental usb communication support
3+
4+
2025-02-02 (12.28)
5+
TEENSY: added experimental runtime platform for teensy mcu
6+
7+
2025-01-27 (12.28)
8+
ANDROID: Updated app icon, thanks to bplus, j7m, round157, qube, baggey
9+
Final design by j7m
10+
11+
2024-10-09 (12.28)
12+
COMMON: Fix #232: TICKS stops working after 50 days
13+
ANDROID: Fix delay accuracy
14+
ANDROID: Fix location regression
15+
16+
2024-10-06 (12.28)
17+
ANDROID: Fix web UI regression
18+
19+
2024-09-27 (12.28)
20+
ANDROID: Fix issue with playing an audio file on android #231
21+
122
2024-04-14 (12.27)
223
COMMON: Fix bug #149: Problem with big hex numbers in windows
324
COMMON: Add new function TRANSPOSE()

configure.ac

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [12.27])
10+
AC_INIT([smallbasic], [12.28])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET
@@ -53,6 +53,11 @@ AC_ARG_ENABLE(dist,
5353
[ac_build_dist="yes"],
5454
[ac_build_dist="no"])
5555

56+
AC_ARG_ENABLE(teensy,
57+
AS_HELP_STRING([--enable-teensy],[build teensy version(default=no)]),
58+
[ac_build_teensy="yes"],
59+
[ac_build_teensy="no"])
60+
5661
function checkForWindows() {
5762
win32=no
5863
case "${host_os}" in
@@ -126,6 +131,10 @@ function checkPCRE() {
126131
have_pcre="no"
127132
fi
128133

134+
if test x$ac_build_teensy = xyes; then
135+
have_pcre="no"
136+
fi
137+
129138
if test "${have_pcre}" = "yes" ; then
130139
AC_DEFINE(USE_PCRE, 1, [match.c used with libpcre.])
131140
PACKAGE_LIBS="${PACKAGE_LIBS} `pcre-config --libs`"
@@ -144,6 +153,10 @@ function checkTermios() {
144153
have_termios_h="no"
145154
fi
146155

156+
if test x$ac_build_teensy = xyes; then
157+
have_termios_h="no"
158+
fi
159+
147160
if test "${have_termios_h}" = "yes" ; then
148161
AC_DEFINE(USE_TERM_IO, 1, [use the termios library.])
149162
fi
@@ -373,6 +386,24 @@ function buildEmscripten() {
373386
(cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/emcc/main_bas.h)
374387
}
375388

389+
function buildTEENSY() {
390+
TARGET="Building teensy version."
391+
BUILD_SUBDIRS="src/platform/teensy"
392+
AC_CHECK_PROG(have_xxd, xxd, [yes], [no])
393+
if test "${have_xxd}" = "no" ; then
394+
AC_MSG_ERROR([xxd command not installed: configure failed.])
395+
fi
396+
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
397+
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
398+
AC_DEFINE(_MCU, 1, [Micro controller based builds])
399+
AC_DEFINE(_TEENSY, 1, [Teensy Micro controller based build])
400+
AC_DEFINE(USE_TERM_IO, 0, [dont use the termios library.])
401+
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
402+
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
403+
AC_SUBST(BUILD_SUBDIRS)
404+
(cd src/platform/teensy && xxd -i main.bas > src/main_bas.h)
405+
}
406+
376407
function buildFLTK() {
377408
TARGET="Building FLTK version."
378409

@@ -444,6 +475,8 @@ elif test x$ac_build_fltk = xyes; then
444475
buildFLTK
445476
elif test x$ac_build_emcc = xyes; then
446477
buildEmscripten
478+
elif test x$ac_build_teensy = xyes; then
479+
buildTEENSY
447480
else
448481
buildConsole
449482
fi
@@ -484,6 +517,7 @@ src/platform/emcc/Makefile
484517
src/platform/sdl/Makefile
485518
src/platform/web/Makefile
486519
src/platform/fltk/Makefile
520+
src/platform/teensy/Makefile
487521
])
488522
AC_OUTPUT
489523

images/sb-logo.blend

814 KB
Binary file not shown.

images/sb-logo.png

26.1 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import android
2+
3+
'
4+
' request usage: endpoint [, data, apiKey]
5+
' data, apikey: uses POST to send data, apiKey applied as bearer authorisation
6+
'
7+
const endPoint = "http://ip-api.com/json"
8+
print android.request(endPoint)
9+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import android
2+
3+
usb = android.openUsbSerial(0x16C0)
4+
5+
while 1
6+
usb.send("hello");
7+
print usb.receive()
8+
delay 1000
9+
wend
10+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'
2+
' provided by rpnielsen
3+
' https://www.syntaxbomb.com/smallbasic/the-play-string-command-and-the-latest-beta/
4+
'
5+
nrtests=5
6+
tempo=240 '1/4 notes pr min
7+
length=4 'play 1/x notes
8+
9+
expDur=(240000/tempo)/length
10+
11+
play "V10O3T"+tempo+"L"+length
12+
13+
? nrtests;" tests of 10 1/";length;" notes"
14+
? "at tempo = ";tempo;" 1/4 notes pr minute"
15+
? "Expected note duration = ";expDur;" ms."
16+
? "--------------------------"
17+
?
18+
19+
for a=1 to nrtests
20+
delay 50 'because otherwise nothing is printed to screen until after PLAY is done
21+
t=ticks
22+
play "CDEFGGFEDC"
23+
actDur=(ticks-t)/10
24+
dev=actDur-expDur
25+
? "Test ";a
26+
? "Average note duration = ";actDur;" ms."
27+
? "Deviaton = ";dev;" ms = ";((actDur/expDur)-1)*100;" %"
28+
totalDur=totalDur+actDur
29+
totalDev=totalDev+dev
30+
?
31+
next a
32+
33+
? "Overall average:"
34+
? "Duration = ";totalDur/nrtests;" ms"
35+
? "Deviation = ";totalDev/nrtests;" ms = ";(((totalDur/nrtests)/expDur)-1)*100;" %"
36+
37+
end

src/common/blib_func.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ void cmd_intN(long funcCode, var_t *r) {
19221922
if (l >= 0 && l < v_maxdim(var_p)) {
19231923
r->v.i = v_ubound(var_p, l);
19241924
} else {
1925-
rt_raise(ERR_BOUND_DIM, v_maxdim(var_p));
1925+
rt_raise(ERR_BOUND_DIM, l, v_maxdim(var_p));
19261926
}
19271927
}
19281928
} else {

src/common/brun.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ void cmd_chain(void) {
351351
if (h != -1) {
352352
struct stat st;
353353
if (fstat(h, &st) == 0) {
354-
int len = st.st_size;
354+
size_t len = st.st_size;
355355
code = (char *)malloc(len + 1);
356356
len = read(h, code, len);
357357
code[len] = '\0';
@@ -1185,18 +1185,16 @@ int brun_create_task(const char *filename, byte *preloaded_bc, int libf) {
11851185
} else {
11861186
find_unit(filename, fname);
11871187
}
1188-
if (access(fname, R_OK)) {
1188+
// open & load
1189+
int h = open(fname, O_RDWR | O_BINARY);
1190+
if (h == -1) {
11891191
panic("File '%s' not found", fname);
11901192
}
11911193
// look if it is already loaded
11921194
if (search_task(fname) != -1) {
1195+
close(h);
11931196
return search_task(fname);
11941197
}
1195-
// open & load
1196-
int h = open(fname, O_RDWR | O_BINARY);
1197-
if (h == -1) {
1198-
panic("File '%s' not found", fname);
1199-
}
12001198
// load it
12011199
if (libf) {
12021200
read(h, &uft, sizeof(unit_file_t));

src/common/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ void dev_chdir(const char *dir);
969969
*
970970
* @return the current directory
971971
*/
972-
char *dev_getcwd(void);
972+
const char *dev_getcwd(void);
973973

974974
/**
975975
* @ingroup dev

0 commit comments

Comments
 (0)