I think I've found a solution. When the dog developer says STEP ON NO PETS, my response is WAS IT A CAT I SAW? This immediately redirects the conversation back to the merge of BBC Basic.
Since bbccon.c was not merged, I removed it from the diff.
Code: Select all
diff -w -c -r -x .git -x build -x bbccon.c picostuff/.gitignore master/.gitignore
*** picostuff/.gitignore 2021-09-18 10:06:46.755429250 -0700
--- master/.gitignore 2021-09-18 10:07:40.842708385 -0700
***************
*** 47,53 ****
*~
#*
.#*
-
- # Work in progress
- vdu/
- test/
--- 47,49 ----
Only in master/: Pico.md
Only in picostuff/: bbcbasicuart.elf
Only in picostuff/: bbcbasicusb.elf
diff -w -c -r -x .git -x build -x bbccon.c picostuff/console/pico/CMakeLists.txt master/console/pico/CMakeLists.txt
*** picostuff/console/pico/CMakeLists.txt 2021-09-18 10:06:46.845431379 -0700
--- master/console/pico/CMakeLists.txt 2021-09-18 10:07:40.894709614 -0700
***************
*** 18,24 ****
if (TARGET tinyusb_device)
add_executable(bbcbasic
../../src/bbmain.c ../../src/bbexec.c ../../src/bbeval.c
! ../../src/bbasmb_arm_32.c ../../src/bbccos.c ../../src/bbccon.c
../../src/bbdata_arm_32.s
../../mcu/sympico.c ../../mcu/lfswrap.c
../../mcu/m0FaultDispatch/m0FaultDispatch.c
--- 18,24 ----
if (TARGET tinyusb_device)
add_executable(bbcbasic
../../src/bbmain.c ../../src/bbexec.c ../../src/bbeval.c
! ../../src/bbasmb_arm_32.c ../../src/bbccos.c ../../src/bbpico.c
../../src/bbdata_arm_32.s
../../mcu/sympico.c ../../mcu/lfswrap.c
../../mcu/m0FaultDispatch/m0FaultDispatch.c
Only in picostuff/examples: pico
Only in picostuff/: filesystem.elf
diff -w -c -r -x .git -x build -x bbccon.c picostuff/include/BBC.h master/include/BBC.h
*** picostuff/include/BBC.h 2021-09-18 10:06:47.031435778 -0700
--- master/include/BBC.h 2021-09-18 10:07:41.093714321 -0700
***************
*** 3,14 ****
* Copyright (c) R. T. Russell, 2000-2021 *
* *
* BBC.h constant, variable and structure declarations *
! * Version 1.25b, 22-Aug-2021 *
\******************************************************************/
// Constants:
#define STACK_NEEDED 512
#define ACCSLEN 65536 // Must be the same in bbcsdl.h and bbccon.h
// Sentinels:
#define CALCHK 0xC3414C43
--- 3,19 ----
* Copyright (c) R. T. Russell, 2000-2021 *
* *
* BBC.h constant, variable and structure declarations *
! * Version 1.25d, 02-Sep-2021 *
\******************************************************************/
// Constants:
#define STACK_NEEDED 512
+ #ifdef PICO
+ void *libtop;
+ #define ACCSLEN 1024 // Must be the same in bbcsdl.h and bbccon.h
+ #else
#define ACCSLEN 65536 // Must be the same in bbcsdl.h and bbccon.h
+ #endif
// Sentinels:
#define CALCHK 0xC3414C43
***************
*** 355,366 ****
extern const char szNotice [] ;
extern void *userRAM ;
- // Defined in bbccon.c
- #ifdef PICO
- extern void *libtop;
- #endif
-
- // NOTE: the following alignment macros must match those in bbccon.c exactly
// Alignment helper types:
typedef __attribute__((aligned(1))) int unaligned_int;
typedef __attribute__((aligned(1))) intptr_t unaligned_intptr_t;
--- 360,365 ----
***************
*** 371,378 ****
--- 370,383 ----
typedef __attribute__((aligned(1))) VAR unaligned_VAR;
// Helper macros to fix alignment problem:
+ #ifdef PICO
+ static inline int ILOAD(void* p){ return (intptr_t)p&3 ? *((unaligned_int*)p) : *((int*)p); }
+ static inline void ISTORE(void* p, int i){ if ((intptr_t)p&3) *((unaligned_int*)p) = i; else *((int *)p) = i; }
+ #else
#define ILOAD(p) *((unaligned_int*)(p))
#define ISTORE(p,i) *((unaligned_int*)(p)) = i
+ #endif
+
#define TLOAD(p) *((unaligned_intptr_t*)(p))
#define TSTORE(p,i) *((unaligned_intptr_t*)(p)) = i
#define ULOAD(p) *((unaligned_uint*)(p))
diff -w -c -r -x .git -x build -x bbccon.c picostuff/include/bbccon.h master/include/bbccon.h
*** picostuff/include/bbccon.h 2021-09-18 10:06:47.032435802 -0700
--- master/include/bbccon.h 2021-09-18 10:07:41.094714344 -0700
***************
*** 3,22 ****
* Copyright (c) R. T. Russell, 2000-2021 *
* *
* bbccon.h constant definitions *
! * Version v0.36, 21-Aug-2021 *
\******************************************************************/
// System constants :
#define YEAR "2021" // Copyright year
! #define VERSION "v0.36c" // Version string
#ifdef PICO
! #define ACCSLEN 1024 // Must be the same in BBC.h
#define DEFAULT_RAM PAGE_OFFSET+0x20000 // Initial amount of RAM to allocate
#else
! #define ACCSLEN 65536 // Must be the same in BBC.h
#define DEFAULT_RAM PAGE_OFFSET+0x200000 // Initial amount of RAM to allocate
#endif
#define PAGE_OFFSET ACCSLEN + 0x1300 // Offset of PAGE from memory base
#define MINIMUM_RAM PAGE_OFFSET+0x20000 // Minimum amount of RAM to allocate
#define MAXIMUM_RAM 0x10000000 // Maximum amount of RAM to allocate
--- 3,23 ----
* Copyright (c) R. T. Russell, 2000-2021 *
* *
* bbccon.h constant definitions *
! * Version v0.37, 14-Sep-2021 *
\******************************************************************/
// System constants :
#define YEAR "2021" // Copyright year
! #define VERSION "v0.37" // Version string
#ifdef PICO
! #define ACCSLEN 1024 // Must be the same in bbcsdl.h and bbccon.h
#define DEFAULT_RAM PAGE_OFFSET+0x20000 // Initial amount of RAM to allocate
#else
! #define ACCSLEN 65536 // Must be the same in bbcsdl.h and bbccon.h
#define DEFAULT_RAM PAGE_OFFSET+0x200000 // Initial amount of RAM to allocate
#endif
+
#define PAGE_OFFSET ACCSLEN + 0x1300 // Offset of PAGE from memory base
#define MINIMUM_RAM PAGE_OFFSET+0x20000 // Minimum amount of RAM to allocate
#define MAXIMUM_RAM 0x10000000 // Maximum amount of RAM to allocate
***************
*** 44,50 ****
#define BIT6 0x40
#define BIT7 0x80
! // Bits in _flags byte (must be the same as in BBCEQUS.INC):
#define IOFLAG BIT0 // Insert/overtype
#define EGAFLG BIT1 // EGA-compatible modes (*EGA [ON])
--- 45,51 ----
#define BIT6 0x40
#define BIT7 0x80
! // Bits in [vflags]:
#define IOFLAG BIT0 // Insert/overtype
#define EGAFLG BIT1 // EGA-compatible modes (*EGA [ON])
***************
*** 195,197 ****
--- 196,199 ----
extern int bChanged ; // Display refresh required
extern unsigned int platform ; // OS platform
extern unsigned int palette[256] ;
+
diff -w -c -r -x .git -x build -x bbccon.c picostuff/include/version.h master/include/version.h
*** picostuff/include/version.h 2021-09-18 10:06:47.035435873 -0700
--- master/include/version.h 2021-09-18 10:07:41.096714391 -0700
***************
*** 1,6 ****
#define YEAR "2021" // Copyright year
! #define VERSION "1.23a" // Version string
! #define VER_RES 1,23,1,00 // For VERSIONINFO resource
#define DEFAULT_RAM PAGE_OFFSET+0x200000 // Initial amount of RAM to allocate
#ifdef __EMSCRIPTEN__
#define MAXIMUM_RAM 0x1000000 // Maximum amount of RAM to allocate
--- 1,6 ----
#define YEAR "2021" // Copyright year
! #define VERSION "1.24a" // Version string
! #define VER_RES 1,24,1,00 // For VERSIONINFO resource
#define DEFAULT_RAM PAGE_OFFSET+0x200000 // Initial amount of RAM to allocate
#ifdef __EMSCRIPTEN__
#define MAXIMUM_RAM 0x1000000 // Maximum amount of RAM to allocate
Only in master/mcu/fatfs: LICENSE.txt
Only in master/mcu/fatfs: README.asc
Only in master/mcu/fatfs: documents
Only in master/mcu/fatfs: source
Only in master/mcu/littlefs: .github
Only in master/mcu/littlefs: .gitignore
Only in master/mcu/littlefs: DESIGN.md
Only in master/mcu/littlefs: LICENSE.md
Only in master/mcu/littlefs: Makefile
Only in master/mcu/littlefs: README.md
Only in master/mcu/littlefs: SPEC.md
Only in master/mcu/littlefs: bd
Only in master/mcu/littlefs: lfs.c
Only in master/mcu/littlefs: lfs.h
Only in master/mcu/littlefs: lfs_util.c
Only in master/mcu/littlefs: lfs_util.h
Only in master/mcu/littlefs: scripts
Only in master/mcu/littlefs: tests
diff -w -c -r -x .git -x build -x bbccon.c picostuff/src/bbccos.c master/src/bbccos.c
*** picostuff/src/bbccos.c 2021-09-18 10:06:47.094437268 -0700
--- master/src/bbccos.c 2021-09-18 10:07:41.189716591 -0700
***************
*** 1,8 ****
/******************************************************************\
* BBC BASIC Minimal Console Version *
* Copyright (C) R. T. Russell, 2021 *
* bbccos.c: Command Line Interface, ANSI VDU drivers *
! * Version 0.36a, 09-Aug-2021 *
\*****************************************************************/
#include <stdlib.h>
--- 1,9 ----
/******************************************************************\
* BBC BASIC Minimal Console Version *
* Copyright (C) R. T. Russell, 2021 *
+ * *
* bbccos.c: Command Line Interface, ANSI VDU drivers *
! * Version 0.37a, 14-Sep-2021 *
\*****************************************************************/
#include <stdlib.h>
***************
*** 13,19 ****
#include <string.h>
#ifdef PICO
#include "lfswrap.h"
! extern char __StackLimit;
#else
#include <dirent.h>
#endif
--- 14,21 ----
#include <string.h>
#ifdef PICO
#include "lfswrap.h"
! extern char *szLoadDir ; // @dir$
! extern int dirlen;
#else
#include <dirent.h>
#endif
***************
*** 35,43 ****
#endif
#undef MAX_PATH
! #define NCMDS 40 // number of OSCLI commands
#define POWR2 32 // largest power-of-2 less than NCMDS
#define COPYBUFLEN 512 // length of buffer used for *COPY command
#define _S_IWRITE 0x0080
#define _S_IREAD 0x0100
#define MAX_PATH 260
--- 37,49 ----
#endif
#undef MAX_PATH
! #define NCMDS 39 // number of OSCLI commands
#define POWR2 32 // largest power-of-2 less than NCMDS
+ #ifdef PICO
#define COPYBUFLEN 512 // length of buffer used for *COPY command
+ #else
+ #define COPYBUFLEN 4096 // length of buffer used for *COPY command
+ #endif
#define _S_IWRITE 0x0080
#define _S_IREAD 0x0100
#define MAX_PATH 260
***************
*** 82,88 ****
"dump", "era", "erase", "esc", "exec", "float", "fx",
"help", "hex", "input", "key", "list", "load", "lock", "lowercase",
"md", "mkdir", "output", "quit", "rd", "refresh",
! "ren", "rename", "rmdir", "run", "save", "sbrk", "spool", "spoolon",
"timer", "tv", "type", "unlock" } ;
enum {
--- 88,94 ----
"dump", "era", "erase", "esc", "exec", "float", "fx",
"help", "hex", "input", "key", "list", "load", "lock", "lowercase",
"md", "mkdir", "output", "quit", "rd", "refresh",
! "ren", "rename", "rmdir", "run", "save", "spool", "spoolon",
"timer", "tv", "type", "unlock" } ;
enum {
***************
*** 90,96 ****
DUMP, ERA, ERASE, ESC, EXEC, FLOAT, FX,
HELP, HEX, INPUT, KEY, LIST, LOAD, LOCK, LOWERCASE,
MD, MKDIR, OUTPUT, QUIT, RD, REFRESH,
! REN, RENAME, RMDIR, RUN, SAVE, SBRK, SPOOL, SPOOLON,
TIMER, TV, TYPE, UNLOCK } ;
// Change to a new screen mode:
--- 96,102 ----
DUMP, ERA, ERASE, ESC, EXEC, FLOAT, FX,
HELP, HEX, INPUT, KEY, LIST, LOAD, LOCK, LOWERCASE,
MD, MKDIR, OUTPUT, QUIT, RD, REFRESH,
! REN, RENAME, RMDIR, RUN, SAVE, SPOOL, SPOOLON,
TIMER, TV, TYPE, UNLOCK } ;
// Change to a new screen mode:
***************
*** 566,579 ****
return 0 ;
}
- extern char *szLoadDir ; // @dir$
- extern int dirlen;
void oscli (char *cmd)
{
int b = 0, h = POWR2, n ;
char cpy[256] ;
char path[MAX_PATH], path2[MAX_PATH] ;
FILE *srcfile, *dstfile ;
char *p, *q, dd ;
unsigned char flag ;
--- 572,584 ----
return 0 ;
}
void oscli (char *cmd)
{
int b = 0, h = POWR2, n ;
char cpy[256] ;
char path[MAX_PATH], path2[MAX_PATH] ;
FILE *srcfile, *dstfile ;
+ DIR *d ;
char *p, *q, dd ;
unsigned char flag ;
***************
*** 646,656 ****
}
if (chdir (path))
error (206, "Bad directory") ;
getcwd (szLoadDir,255) ;
dirlen = strlen (szLoadDir) ;
- #ifdef _WIN32
- szLoadDir[dirlen++] = '\\' ;
- #else
szLoadDir[dirlen++] = '/' ;
#endif
return ;
--- 651,659 ----
}
if (chdir (path))
error (206, "Bad directory") ;
+ #ifdef PICO
getcwd (szLoadDir,255) ;
dirlen = strlen (szLoadDir) ;
szLoadDir[dirlen++] = '/' ;
#endif
return ;
***************
*** 730,736 ****
text (p) ;
crlf () ;
! DIR *d = opendir (q) ;
if (d == NULL)
error (254, "Bad command") ;
--- 733,739 ----
text (p) ;
crlf () ;
! d = opendir (q) ;
if (d == NULL)
error (254, "Bad command") ;
***************
*** 1073,1087 ****
crlf () ; // Zero COUNT
return ;
- case SBRK:
- printf("Current sbrk address is %p.\r\n",sbrk(0)) ;
- printf("Current stack address: %p.\r\n",&b) ;
- #ifdef PICO
- printf("System malloc heap remaining %llu.\r\n",
- (unsigned long long int)(&__StackLimit-(char *)sbrk(0))) ;
- #endif
- return ;
-
case UNLOCK:
setup (path, p, ".bbc", ' ', NULL) ;
if (0 != chmod (path, _S_IREAD | _S_IWRITE))
--- 1076,1081 ----
diff -w -c -r -x .git -x build -x bbccon.c picostuff/src/bbcmos.c master/src/bbcmos.c
*** picostuff/src/bbcmos.c 2021-09-18 10:06:47.094437268 -0700
--- master/src/bbcmos.c 2021-09-18 10:07:41.190716615 -0700
***************
*** 45,51 ****
unsigned int rnd (void) ; // Return a pseudo-random number
// Declared in bbccli.c:
! char *setup (char *, char *, char *, char, int *) ;
void oscli (char *) ; // Execute an emulated OS command
// Interpreter entry point:
--- 45,51 ----
unsigned int rnd (void) ; // Return a pseudo-random number
// Declared in bbccli.c:
! char *setup (char *, char *, char *, char, unsigned char *) ;
void oscli (char *) ; // Execute an emulated OS command
// Interpreter entry point:
diff -w -c -r -x .git -x build -x bbccon.c picostuff/src/bbcvdu.c master/src/bbcvdu.c
*** picostuff/src/bbcvdu.c 2021-09-18 10:06:47.095437292 -0700
--- master/src/bbcvdu.c 2021-09-18 10:07:41.190716615 -0700
***************
*** 7,13 ****
* *
* bbcvdu.c VDU emulator and graphics drivers *
* This module runs in the context of the GUI thread *
! * Version 1.24a, 24-Jul-2021 *
\*****************************************************************/
#include <stdlib.h>
--- 7,13 ----
* *
* bbcvdu.c VDU emulator and graphics drivers *
* This module runs in the context of the GUI thread *
! * Version 1.25a, 11-Sep-2021 *
\*****************************************************************/
#include <stdlib.h>
***************
*** 1180,1186 ****
txtfor = 0 ;
bakgnd = colmsk << 8 ;
txtbak = colmsk ;
- palette[(int) colmsk] = 0xFFFFFFFF ; // opaque peak white
}
vflags &= ~UFONT ;
--- 1180,1185 ----
***************
*** 1487,1494 ****
case 8: // PLOT 64-71, Plot a single 'dot' (size depends on mode)
rect.x = cx ;
rect.y = cy ;
! rect.w = pixelx & 0xffff;
! rect.h = pixely & 0xffff;
setcol (col) ;
SDL_RenderFillRect(memhdc, &rect) ;
break ;
--- 1486,1493 ----
case 8: // PLOT 64-71, Plot a single 'dot' (size depends on mode)
rect.x = cx ;
rect.y = cy ;
! rect.w = pixelx & 0xFFFF ;
! rect.h = pixely & 0xFFFF ;
setcol (col) ;
SDL_RenderFillRect(memhdc, &rect) ;
break ;
diff -w -c -r -x .git -x build -x bbccon.c picostuff/src/bbexec.c master/src/bbexec.c
*** picostuff/src/bbexec.c 2021-09-18 10:06:47.098437363 -0700
--- master/src/bbexec.c 2021-09-18 10:07:41.193716685 -0700
***************
*** 1236,1242 ****
while (1) // for each statement
{
#ifdef PICO
! if(&al < (signed char *)libtop + 0x800)
error(0, "Recursion too deep!");
#endif
if (flags & (KILL + PAUSE + ALERT + ESCFLG))
--- 1236,1242 ----
while (1) // for each statement
{
#ifdef PICO
! if((&al < (signed char *)libtop + 0x800) && (&al >= (signed char *)userRAM))
error(0, "Recursion too deep!");
#endif
if (flags & (KILL + PAUSE + ALERT + ESCFLG))
Only in master/src: bbpico.c
which except for bbexec.c seems pretty straight forward.
So these are my comments. Other than the change to the stack check in bbexec.c everything looks understandable to me.