Jump to content



Photo
- - - - -

[Project Idea] Fastbasic

Basic Project Team fx9860

  • Please log in to reply
27 replies to this topic

#1 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 06 January 2013 - 05:34 PM

Hi,
I'm planning to make a faster basic-interpreter for the fx-series in c.
The idea: The interpreter uses the same code like the Casiobasic-interpreter. But instead of slow, useless functions I want to use fast ones, for example from Monochromelib or Revolutionfx. I also want to interpret the Send/Receive commands, so they would work.
That means we would play the same basic games like before - but faster and with better quality and new functions.
I already have some good ideas.

But I do not want to program this alone: I want it to be a team project.
So, who wants to join the project?

Edited by Casimo, 06 January 2013 - 06:28 PM.

  • MicroPro and naib864 like this

#2 Forty-Two

Forty-Two

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 528 posts
  • Gender:Male
  • Location:Well, The sign says "You are here"...

  • Calculators:
    Casio fx-CG10 Prizm
    Casio fx-9860GII
    TI-84+ SE

Posted 06 January 2013 - 05:50 PM

I suggest that you produce some actual code before asking others to join on the project. This shows that you can actually produce code, and that they won't be doing all the work

On the idea: I really don't see much use for trying to make a faster interpreter. The casio people already have it at a high speed, and they have all the technical documentation (which you have none of). I don't think you will get very far with this.

#3 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 06 January 2013 - 05:55 PM

I already started.
code :
#include "stdio.h"
#include "fxlib.h"
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
int LongToAscHex(int value, uchar *dest, int digits);
struct TDirectoryItem{uchar name[8];int offset;int length;char flags[4];};
int App_PRGM(void);
int SearchDirectoryItem( uchar*dir, uchar*item, char*flags_0, struct TDirectoryItem*item_ptr, int*data_ptr, int*data_length );
int InputString( uchar*buffer, uchar *heading, int maxlen );
#define TRUE 1
#define FALSE 0
int data_ptr, data_lenght, pos = 0;
#define CHAR 1
#define CMD 2
#define LOOP 3
#define ASC_A 65
#define ASC_Z 90
#define ASC_COMMA 0x2C
#define OC_QT 0x0022
#define OC_CLRTXT 0x18
#define OC_CLRGRPH 0x19

uchar cursorx = 1, cursory = 1;
void printstr()
{
uchar str1 = *(uchar*)(data_ptr + (--pos << 1) + 1);
uchar str2;
locate(cursorx, cursory);
cursorx++;
if(cursorx >= 21)
{
cursorx = 1;
cursory++;
if(cursory >= 9)
cursory = 8;
}

PrintC(&str1);
while(1)
{
pos++;
str1 = *(uchar*)(data_ptr + (pos << 1) + 1);
str2 = *(uchar*)(data_ptr + (pos << 1));
if(str2 == OC_QT)
{
pos++;
Bdisp_PutDisp_DD();
return;
}
else
{
locate(cursorx, cursory);
PrintC(&str2);
PrintC(&str1);
cursorx += 2;
if(cursorx >= 21)
{
cursorx = 1;
cursory++;
if(cursory >= 9)
cursory = 8;
}
}
}
}
char nextoc()
{
uchar curoc = *(uchar*)(data_ptr + (pos << 1) + 1);
uchar octype = *(uchar*)(data_ptr + (pos << 1) );

pos++;

if(pos > data_lenght)
return 0;

if(octype < 0xF7)
{
if(octype == OC_QT)
{
printstr();
}
}

switch(curoc)
{
case OC_CLRTXT:
case OC_CLRGRPH:
Bdisp_AllClr_VRAM();
break;
}

return 1;
}
char loadfile()
{
char program_name[9] = {0};
struct TDirectoryItem item_ptr;
InputString(&program_name, "Open Program : ", 8);

if(SearchDirectoryItem("system", &program_name, &item_ptr.flags[0], &item_ptr, &data_ptr, &data_lenght) != 0)
return -1;

return 1;
}
int AddIn_main(int isAppli, ushort OptionNum)
{
char x = 1, txt[5];

if(loadfile() >= 0)
{
Bdisp_AllClr_DDVRAM();

while(x != 0)
{
x = nextoc();
}

GetKey(&x);
}
App_PRGM();
return 0;
}
#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, ushort OptionNum)
{return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section

1. You can open a program.
2. Actually, you can display text and clear the screen.

Edited by Casimo, 08 January 2013 - 04:11 PM.


#4 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 06 January 2013 - 11:39 PM

maybe making something like PRGM2 would be better? But i do think the idea is good.

#5 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 07 January 2013 - 12:52 PM

... The casio people already have it at a high speed ...

Nah, they don't. ;) At least on the ClassPad they didn't.


I actually tried to do this for ClassPad two years ago: Look here and here. I called it CP QBasic. Because the code grew long and longer and turned out that I had a bad design, and I kinda lost motivation I stopped; but it wasn't impossible. I could actually get a lot of better speed by just rewriting a parser.


This idea is good. From the opinions people gave me, in case you're going to implement this, try to support some advanced features such as subroutines, etc too.


What is PRGM2?


Edited by MicroPro, 07 January 2013 - 12:56 PM.


#6 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 07 January 2013 - 02:40 PM

PRGM2 is a basic extension. It interprets the variables. It looks like this: 1->A
While A=1
WhileEnd
This draws, for example, a box in the middle of the screen.

#7 naib864

naib864

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 316 posts
  • Gender:Male
  • Location:Behind the Moon :D
  • Interests:Programming, Minecraft

  • Calculators:
    fx-9860GII

Posted 07 January 2013 - 08:33 PM

The Idea of an own basicprogram is great, because casio basic is a bit slow.
Example: The pxl/plot-commands. If you try to create a picture, the program is working a long time.
(I'm new here and I hope my english is okay, because I'm from Germany.)

#8 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 07 January 2013 - 09:19 PM

The Idea of an own basicprogram is great, because casio basic is a bit slow.
Example: The pxl/plot-commands. If you try to create a picture, the program is working a long time.
(I'm new here and I hope my english is okay, because I'm from Germany.)


Your English is great :)

Hello naib864 and welcome to UCF! You should introduce yourself.

#9 naib864

naib864

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 316 posts
  • Gender:Male
  • Location:Behind the Moon :D
  • Interests:Programming, Minecraft

  • Calculators:
    fx-9860GII

Posted 07 January 2013 - 10:34 PM

Thank's! Introduction is online.

#10 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 08 January 2013 - 11:41 AM

Example: The pxl/plot-commands. If you try to create a picture, the program is working a long time.

Yes Casio's implementation refreshes the screen after each drawing operation. But if you refresh the screen "smartly", e.g only in specified intervals and before input commands then you could drastically improve the performance.

#11 louloux

louloux

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male

  • Calculators:
    Graph 85 SD
    Graph 35+
    fx-92

Posted 09 January 2013 - 09:27 PM

Do you know there's a project in the french website, to make a new basic interpreter ? => http://www.planet-ca...asic-Casio.html
  • MicroPro likes this

#12 naib864

naib864

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 316 posts
  • Gender:Male
  • Location:Behind the Moon :D
  • Interests:Programming, Minecraft

  • Calculators:
    fx-9860GII

Posted 09 January 2013 - 09:30 PM

Thanks. I've got Frensh as second language in school, so I try to read this :)

#13 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 10 January 2013 - 03:58 PM

Do you know there's a project in the french website, to make a new basic interpreter ? => http://www.planet-ca...asic-Casio.html


I don't understand this project. Is it the same like this? It is coded in c++, but I thought that there is no cout in the sdk...

#14 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 10 January 2013 - 04:02 PM

The sdk can handle c and c++ ;)

#15 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 10 January 2013 - 04:04 PM

I know, but I don't know if the SDK has a "<<" ">>" or cout-function

Edited by Casimo, 10 January 2013 - 04:05 PM.


#16 louloux

louloux

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male

  • Calculators:
    Graph 85 SD
    Graph 35+
    fx-92

Posted 10 January 2013 - 09:13 PM

This is actually just a parser.

It will become :
-an emulator on computer
-a new oncalc Basic interpreter

Other questions about the project ? Translation ?

#17 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 11 January 2013 - 03:53 PM

Ok, now I understand. So the oncalc project hasn't been started yet.

#18 naib864

naib864

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 316 posts
  • Gender:Male
  • Location:Behind the Moon :D
  • Interests:Programming, Minecraft

  • Calculators:
    fx-9860GII

Posted 12 January 2013 - 09:35 AM

But the first question was who is going to work with Casimo.
And I say yes.;)

#19 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 12 January 2013 - 10:21 AM

Ok, you want to work with me? That's great!
I continued programming:
#include "stdio.h"
#include "stdarg.h"
#include "fxlib.h"
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
int LongToAscHex(int value, uchar *dest, int digits);
struct TDirectoryItem{uchar name[8];int offset;int length;char flags[4];};
int App_PRGM(void);
int SearchDirectoryItem( uchar*dir, uchar*item, char*flags_0, struct TDirectoryItem*item_ptr, int*data_ptr, int*data_length );
int InputString( uchar*buffer, uchar *heading, int maxlen );
#define TRUE 1
#define FALSE 0
int data_ptr, data_lenght, pos = 0;
#define CHAR 1
#define CMD 2
#define LOOP 3
#define ASC_A 65
#define ASC_Z 90
#define ASC_COMMA 0x2C
#define OC_QT 0x22
#define OC_NL 0x0D
#define OC_CLRTXT 0x18
#define OC_CLRGRPH 0x19
#define OC_LCTE 0x10
#define OC_PXLON 0xAB
#define asctonum(x) (x - 48)
#define INVALID_CHAR -2
#define INVALID_VAL -3
#define SUCCESS 1
void throwerr(char errcode)
{
uint key;
Bdisp_AllClr_VRAM();
PopUpWin(2);
locate(3,3);
Print("Error!");
locate(3,4);

switch(errcode)
{
  case INVALID_CHAR:
   Print("Invalid character");
   break;
  case INVALID_VAL:
   Print("Invalid parameter");
   break;
}
GetKey(&key);
}
void addtostr(char **ptr, uchar lenght, char c)
{
char *temp = (char*)malloc(lenght + 2);
memcpy(temp, *ptr, lenght);
*(temp + lenght) = c;
*(temp + lenght + 1) = 0;
free(*ptr);
*ptr = temp;
}
/*
char arg(uchar count,  ...)//This should become a function that reads the arguments of a command. This isn't ready yet!
{
uchar num;
uchar i;
uchar space, *pval;
va_list vl;
va_start(vl, count);
for (i = 0; i<count; i += 2)
{
  pval = va_arg(vl, uchar*);
  space = va_arg(vl,uchar);
 
  num = asctonum(*(uchar*)(data_ptr + pos++));
  if(num <= 9 && num >= 0)
  {
   *pval += num;
  }
  else
  {
   va_end(vl);
   return INVALID_CHAR;
  }
 
  num = asctonum(*(uchar*)(data_ptr + pos++));
 
  if(num <= 9 && num >= 0)
  {
   *pval += num * 10;
  }
  else
  {
   if(*(uchar*)(data_ptr + pos - 1) != space)
   {
    va_end(vl);
    return INVALID_CHAR;
   }
  }
}
va_end(vl);
return SUCCESS;
}*/
char getarg(uchar* val1, uchar space1, uchar* val2, uchar space2)//The actual function. It supports 2 Digits, the interface is like this: CommandParam1char1Param2char2
//for example: Locate 10,2,
{
uchar num = asctonum(*(uchar*)(data_ptr + pos++));

*val1 = 0;
*val2 = 0;
if(num <= 9 && num >= 0)
{
  *val1 += num;
}
else
{
  return INVALID_CHAR;
}

num = asctonum(*(uchar*)(data_ptr + pos++));

if(num <= 9 && num >= 0)
{
  *val1 += num * 10;
}
else
{
  if(*(uchar*)(data_ptr + pos - 1) != space1)
  {
   return INVALID_CHAR;
  }
}

num = asctonum(*(uchar*)(data_ptr + pos++));
if(num <= 9 && num >= 0)
{
  *val2 += num;
}
else
{
  return INVALID_CHAR;
}

num = asctonum(*(uchar*)(data_ptr + pos++));
if(num <= 9 && num >= 0)
{
  *val2 += num * 10;
}
else
{
  if(*(uchar*)(data_ptr + pos - 1) != space2)
  {
   return INVALID_CHAR;
  }
}
return SUCCESS;
}
uchar cursorx = 1, cursory = 1;
void printstr()
{
uchar str = *(uchar*)(data_ptr + pos++);
locate(cursorx, cursory);
cursorx++;
if(cursorx >= 21)
{
  cursorx = 1;
  cursory++;
  if(cursory >= 9)
   cursory = 8;
}

PrintC(&str);
while(1)
{
  str = *(uchar*)(data_ptr + pos++);
  if(str == OC_QT)
  {
   Bdisp_PutDisp_DD();
   return;
  }
  else
  {
   locate(cursorx, cursory);
   PrintC(&str);
   cursorx ++;
   if(cursorx >= 21)
   {
    cursorx = 1;
    cursory++;
    if(cursory >= 9)
    cursory = 8;
   }
  }
}
}
void basiclocate()
{
char err = getarg(&cursorx, ',', &cursory, ',');
if(err < 0)
{
  throwerr(err);
}
}
void basicpxl()
{
uchar x, y;
char err = getarg(&x, ',', &y, OC_NL);
if(x > 127 || y > 63)err = INVALID_VAL;
if(err < 0)
{
  throwerr(err);
  return;
}
Bdisp_SetPoint_VRAM(x, y, 1);
Bdisp_PutDisp_DD();
}
char nextoc()
{
uchar opcode = *(uchar*)(data_ptr + pos++);

if(pos > data_lenght)
return 0;

if(opcode < 0xF7)//if the opcode is a character
{
  switch(opcode)
  {
   case OC_NL:
    return 1;
   case OC_QT:
    printstr();
    return 1;
  }
}

opcode = *(uchar*)(data_ptr + pos++);

switch(opcode)//if the opcode is a function with the prefix 0xF7
{
  case OC_CLRTXT:
  case OC_CLRGRPH:
   Bdisp_AllClr_VRAM();
   break;
  case OC_LCTE:
   basiclocate();
   break;
  case OC_PXLON:
   basicpxl();
   break;
}

return 1;
}
char loadfile()
{
char program_name[9] = {0};
struct TDirectoryItem item_ptr;
InputString(&program_name, "Open Program : ", 8);

if(SearchDirectoryItem("system", &program_name, &item_ptr.flags[0], &item_ptr, &data_ptr, &data_lenght) != 0)
return -1;

return 1;
}
int AddIn_main(int isAppli, ushort OptionNum)
{
char x = 1, txt[5];

if(loadfile() >= 0)//load the file
{
  Bdisp_AllClr_DDVRAM();
  
  while(x != 0)
  {
   x = nextoc();//loop through data
  }
 
  GetKey(&x);//wait
}

App_PRGM();//call PRGM-App
return 0;
}

I send you more infos soon.

#20 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 13 January 2013 - 01:18 PM

Do you know there's a project in the french website, to make a new basic interpreter ? => http://www.planet-ca...asic-Casio.html

This Pylaterreur guy seems very knowledgeable... Doesn't he visit English forums?

I think his code was also very well-structured, although being object-oriented can slow it down a few milliseconds or so...

I wonder if you guys want to cooperate with him (or him cooperate with you) for making your alternate Basic interpreter? Already having a parser will save you a lot of trouble.

#21 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 13 January 2013 - 02:43 PM

Sorry, I simply don't understand what a parser does / why this parser helpful is xD
Could someone explain it?

#22 louloux

louloux

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male

  • Calculators:
    Graph 85 SD
    Graph 35+
    fx-92

Posted 18 January 2013 - 07:42 PM

A parser is a program which reads a Basic code. It's as the main motor.
If you add all functions it becomes an interpreter ;)


This Pylaterreur guy seems very knowledgeable... Doesn't he visit English forums?

Both english community and french community play their part. We're an active community and we don't really know yours...

#23 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 18 January 2013 - 09:12 PM

Ah, now I know. Thank you for your explaination.

#24 Cartix

Cartix

    Newbie

  • Members
  • Pip
  • 18 posts
  • Gender:Male

  • Calculators:
    Classpad

Posted 21 January 2013 - 05:25 PM

I actually tried to do this for ClassPad two years ago: Look here and here. I called it CP QBasic.


Is it possible to get the source of this add-in ?

Edited by Cartix, 21 January 2013 - 05:25 PM.


#25 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 25 January 2013 - 06:37 PM

Sorry, I simply don't understand what a parser does / why this parser helpful is xD
Could someone explain it?

More specifically, it provides functions that replace your nextoc, getarg and other functions that need to parse the file.

Both english community and french community play their part. We're an active community and we don't really know yours...

Of course you are. Many French programmers visit here. But I always thought programs written by the English community had more audience.

Is it possible to get the source of this add-in ?

Of course. I will post it in its own topic (the second one) when I get some time.

#26 louloux

louloux

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male

  • Calculators:
    Graph 85 SD
    Graph 35+
    fx-92

Posted 26 January 2013 - 10:16 PM

Many French programmers visit here. But I always thought programs written by the English community had more audience.

More audience ? I have 8063 downloads :P

#27 naib864

naib864

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 316 posts
  • Gender:Male
  • Location:Behind the Moon :D
  • Interests:Programming, Minecraft

  • Calculators:
    fx-9860GII

Posted 26 January 2013 - 10:27 PM

More audience ? I have 8063 downloads :P

Yes, but this site is no site for downloading games, programs,…, it's a forum.

Edited by naib864, 26 January 2013 - 10:28 PM.


#28 Forty-Two

Forty-Two

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 528 posts
  • Gender:Male
  • Location:Well, The sign says "You are here"...

  • Calculators:
    Casio fx-CG10 Prizm
    Casio fx-9860GII
    TI-84+ SE

Posted 28 January 2013 - 04:12 PM

Yes, but this site is no site for downloading games, programs,…, it's a forum.


Actually, it is, but the dl section has not been updated since the site was first founded.





Also tagged with one or more of these keywords: Basic, Project, Team, fx9860

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users