Hey I'm trying to make a bitlash interpreter, but my experience with the arduino IDE is limited.
I'm trying to recycle code that was meant to do that but with a specific LCD. So I'm adding Tvout for more compatibility and it so happens I'm having compatibility issues. also before I forget I'm using a library that decodes proprietary the output to ascii (So the pic inside doesn't need to be reprogrammed)
#include "Chatpad.h"
#include "Arduino.h"
#include "bitlash.h"
// TVout
#include <TVout.h>
#include <video_gen.h>
#include <font4x6.h>
#include <font6x8.h>
#include <font8x8.h>
#include <font8x8ext.h>
#include <fontALL.h>
#include <Chatpad.h>
TVout TV;
#define cear_screen() fill(0)
//#define _sclk 13
//#define _miso 12
//#define _mosi 11
//#define _cs 10
//#define _dc 9
//#define _rst 8
//Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _rst);
int screenMem[168]; //the implementation of frame buffer is referenced from Ben Heck's
int cursorX = 0; //Retro BASIC computer's source
int checkChar = 0;
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// ASCII Characters
#define CR '\r'
#define NL '\n'
#define LF 0x0a
#define TAB '\t'
#define BELL '\b'
#define SPACE ' '
#define SQUOTE '\''
#define DQUOTE '\"'
#define CTRLC 0x1B // Changed to ESC key (27 - 0x1B)
#define CTRLH 0x08
#define CTRLS 0x13
#define CTRLX 0x18
static const unsigned char initmsg[] PROGMEM = "bitlash here! v2.0 (c) 2013 Bill Roy -type HELP- 13346 bytes free";
void send_cmd_2(char c) {
outchar(c);
doFrame(147);
}
void send_cmd(char c) {
outchar(c);
doFrame(147);
}
void setup(void) {
initBitlash(4800);
TV.begin(PAL, 640, 480);
clear_screen();
TV.select_font(font6x8);
set_hbi_hook(Chatpad.begin());
set_cursor(0,0);
for (int xg = 0 ; xg < 169 ; xg++) {
screenMem[xg] = 32;
}
setOutputHandler(&char);
printmsg(initmsg);
doFrame(147);
printmsg(initmsg);
}
void loop(void) {
runBitlash();
}
static void outchar(unsigned char c)
{
print(char(c));
}
static void print(char(byte c)) {
if (c == 8) { //Backspace?
if (cursorX > 0) {
cursorX -= 1;
screenMem[147 + cursorX] = 32;
doFrame(147 + cursorX);
}
}
if (c != 13 and c != 10 and c != 8) {
screenMem[147 + cursorX] = c;
cursorX += 1;
if (cursorX < 21) {
set_cursor(cursorX*6,8*7);
print(c);
}
}
if (cursorX == 21 or c == 10) {
for (int xg = 21 ; xg > 0 ; xg--) {
screenMem[0 + xg] = screenMem[21 + xg];
screenMem[21 + xg] = screenMem[42 + xg];
screenMem[42 + xg] = screenMem[63 + xg];
screenMem[63 + xg] = screenMem[84 + xg];
screenMem[84 + xg] = screenMem[105 + xg];
screenMem[105 + xg] = screenMem[126 + xg];
screenMem[126 + xg] = screenMem[147 + xg];
screenMem[147 + xg] = 32;
}
cursorX = 0;
doFrame(147);
}
}
static void doFrame(byte amount) {
int xposi,yposi,yshift;
clear_screen();
for (int xg = 0 ; xg < amount ; xg++) {
yshift=int(xg/21.0);
yposi=yshift*8;
xposi=(xg-yshift*21)*6;
set_cursor(xposi,yposi);
print(screenMem[xg]);
}
}
/***************************************************************************/
void printmsgNoNL(const unsigned char *msg)
{
while( pgm_read_byte( msg ) != 0 ) {
outchar( pgm_read_byte( msg++ ) );
};
}
/***************************************************************************/
void printmsg(const unsigned char *msg)
{
printmsgNoNL(msg);
line_terminator();
}
static void line_terminator(void)
{
outchar(NL);
outchar(CR);
}
and below is the error messages. Please help.
Arduino: 1.6.3 (Windows 8.1), Board: "Arduino Uno"
bitlasholed.ino:16:22: error: "0" may not appear in macro parameter list
bitlasholed.ino: In function 'void send_cmd_2(char)':
bitlasholed.ino:51:13: error: 'doFrame' was not declared in this scope
bitlasholed.ino: In function 'void send_cmd(char)':
bitlasholed.ino:57:13: error: 'doFrame' was not declared in this scope
In file included from bitlasholed.ino:6:0:
bitlasholed.ino: In function 'void setup()':
C:\Users\Samuel\Documents\Arduino\libraries\TVout/TVout.h:66:33: error: 'fill' was not declared in this scope
#define clear_screen() fill(0)
^
bitlasholed.ino:64:5: note: in expansion of macro 'clear_screen'
bitlasholed.ino:66:25: error: expected primary-expression before '.' token
bitlasholed.ino:66:33: error: 'set_hbi_hook' was not declared in this scope
bitlasholed.ino:67:19: error: 'set_cursor' was not declared in this scope
bitlasholed.ino:71:21: error: expected primary-expression before 'char'
bitlasholed.ino:73:14: error: 'doFrame' was not declared in this scope
bitlasholed.ino: In function 'void outchar(unsigned char)':
bitlasholed.ino:83:18: error: 'print' was not declared in this scope
bitlasholed.ino: In function 'void print(char (*)(byte))':
bitlasholed.ino:88:6: error: 'c' was not declared in this scope
bitlasholed.ino:94:25: error: 'doFrame' was not declared in this scope
bitlasholed.ino:100:6: error: 'c' was not declared in this scope
bitlasholed.ino:105:34: error: 'set_cursor' was not declared in this scope
bitlasholed.ino:111:23: error: 'c' was not declared in this scope
bitlasholed.ino:132:14: error: 'doFrame' was not declared in this scope
In file included from bitlasholed.ino:6:0:
bitlasholed.ino: In function 'void shift(byte)':
C:\Users\Samuel\Documents\Arduino\libraries\TVout/TVout.h:66:33: error: 'fill' was not declared in this scope
#define clear_screen() fill(0)
^
bitlasholed.ino:141:9: note: in expansion of macro 'clear_screen'
bitlasholed.ino:146:32: error: 'set_cursor' was not declared in this scope
bitlasholed.ino:147:21: error: invalid conversion from 'int' to 'char (*)(byte) {aka char (*)(unsigned char)}' [-fpermissive]
bitlasholed.ino:86:13: error: initializing argument 1 of 'void print(char (*)(byte))' [-fpermissive]
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
this is where the original code comes from:
Bitlash interpreter:https://github.com/kodera2t/TinyBasicPlus_OLED_support/blob/master/bitlasholed.ino
TVout:Google Code Archive - Long-term storage for Google Code Project Hosting.