| /* | |
| * | |
| * $Id: hardware.h,v 1.1 2024/02/25 04:43:16 stefan Exp stefan $ | |
| * | |
| * Stefan's basic interpreter | |
| * | |
| * See the licence file on | |
| * https://github.com/slviajero/tinybasic for copyright/left. | |
| * (GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007) | |
| * | |
| * Author: Stefan Lenz, sl001@serverfabrik.de | |
| * | |
| * | |
| * Runtime environment for the BASIC interpreter, the | |
| * hardware configuration file. It contains all hardware | |
| * related settings and dependencies. | |
| * | |
| * This is hardware.h for POSIX systems and the POSIX runtime | |
| * environment runtime.c. | |
| * | |
| * Default setting is POSIX for most UNIXes including Mac. | |
| * RASPPI activates Raspberry PI related features. | |
| * MINGW activates windows related features. | |
| * MSDOS for MSDOS compiles with tc 2.0 (untested in this version, last tested in 1.4) | |
| * | |
| */ | |
| /* | |
| * MEMSIZE sets the BASIC main memory to a fixed value, | |
| * if MEMSIZE=0 a heuristic is used based on free heap | |
| * size and architecture parameters | |
| */ | |
| /* | |
| * Hardware flags of the POSIX systems | |
| * POSIXTERMINAL, POSIXVT52TOANSI: ensure compatibility of BASIC programs | |
| * control characters of BASIC are translated to ANSI, bringing the Aruino | |
| * VT52 commands to POSIX | |
| * POSIXSIGNALS: enables signal handling of ^C interrupting programs | |
| * POSIXNONBLOCKING: non blocking I/O to handle GET and the BREAKCHAR | |
| * tricky on DOS, not very portable, experimental, use signals instead | |
| * POSIXFRAMEBUFFER: directly draw to the frame buffer of Raspberry PI | |
| * only tested on this platform | |
| * POSIXWIRE: simple Raspberry PI wire code | |
| * POSIXMQTT: analogous to ARDUINOMQTT, send and receive MQTT messages (unfinished) | |
| * POSIXWIRING: use the (deprectated) wiring code for gpio on Raspberry Pi | |
| * POSIXPIGPIO: use the pigpio library on a Raspberry PI - currently broken - wire change - don't use | |
| */ | |
| /* simulates SPI RAM, only test code, keep undefed if you don't want to do something special */ | |
| /* use a serial port as printer interface - unfinished - similar to Arduino */ | |
| /* use TAB in MS mode */ | |
| /* build in BASIC programs on Posix currently without function */ | |
| /* this is the demo module */ | |
| // #define BUILDINMODULE "buildin/buildin.h" | |
| /* a small tutorial */ | |
| // #define BUILDINMODULE "buildin/buildin-tutorial.h" | |
| // #define BUILDINMODULE "buildin/buildin-games.h" | |
| /* used pins and other parameters */ | |
| /* | |
| * Mechanisms to interrupt the interpreter | |
| * | |
| * BREAKCHAR is the character stopping the program on Ardunios | |
| * BREAKPIN can be set, it is a pin that needs to go to low to stop a BASIC program | |
| * This should be done in hardware*.h | |
| * BREAKSIGNAL can also be set, should be done in hardware*.h | |
| */ | |
| /* set this is you want pin 4 on low interrupting the interpreter */ | |
| /* #define BREAKPIN 4 */ | |
| /* the SIGNAL the interpreters listens to for interrupt */ | |
| /* | |
| * In case of non blocking IO turn on background tasks, we check BREAKCHAR only | |
| * once every second in background and don't poll the keyboard after each statement. | |
| * | |
| * This is also needed for slow keyboards on Arduino. | |
| */ | |
| /* frame buffer health check - currently only supported on Raspberry */ | |
| /* wire parameters for Raspberry*/ | |
| /* the size of the EEPROM dummy */ | |
| /* they all have this */ | |
| /* and they have this */ | |
| /* some have this */ | |
| /* we can do graphics and tell language.h that we can */ | |
| /* after run behaviour on POSIX systems, 1 to terminate if started | |
| on the command line with a file argument, 0 to stay active and | |
| show a BASIC prompt*/ | |
| /* | |
| * all the things the POSIX platforms need to source | |
| */ | |
| /* define all the types Arduino has for compatibility of the interface */ | |
| typedef unsigned char uint8_t; | |
| typedef signed char int8_t; | |
| typedef unsigned short uint16_t; | |
| typedef signed short int16_t; | |
| typedef unsigned char byte; | |
| typedef unsigned long long uint64_t; | |
| typedef unsigned int uint32_t; | |
| /* | |
| * additional prototypes in an non Arduino world | |
| */ | |
| unsigned long millis(); | |
| /* the ususal suspects */ | |
| /* floating point maths only needed if HASFLOAT*/ | |
| /* time stuff */ | |
| /* directories and files */ | |
| /* windowy things for windows */ | |
| /* | |
| * Tell BASIC we have a second serial port | |
| */ | |
| /* | |
| * Tell BASIC we have a radio adapter | |
| */ | |
| /* | |
| * Tell BASIC we have MQTT | |
| */ | |
| /* we definitely don't run on an Arduino */ | |
| /* and we use the buffer sizes for real computers */ | |
| /* the buffer size for simulated serial RAM */ | |
| /* | |
| * This code measures the fast ticker frequency. | |
| */ | |
| /* | |
| * Does the platform has command line args and do we want to use them | |
| */ | |
| /* | |
| * How restrictive are we on function recursive calls to protect the stack | |
| * On Posix systems we can be more generous. | |
| */ | |
| /* all POSIXish systems can do the full interpreter, only here for compatibility with Arduino */ | |