emulationFIRST (aka PBasic emulator)

I’m finally ready to release the first version (0.01) of my PBasic emulation also known as emulationFIRST (like we didn’t have enough bad puns on the FIRST name already). So far, I’ve got it to run the DefaultProgram.bsx (the one provided by InnovationFIRST). This does not implement too many more features than required to run the DefaultProgram.bsx. However, I would like to have some help in figuring out what I need to add and also to figure out where bugs in the program lie. I do know that it leaks memory like crazy but I haven’t been able to get it to crash. I’d like to know where it fails in your program and for what reason (doesn’t parse the code right, unimplemented feature, etc.).

At the moment, the only interface is via a text-based console (ie, you run it via command.com). You provide it the name of your PBasic file and it will prompt you for inputs everytime it hits a Serin and will output values everytime it finds a Serout.

I do plan to implement the rest of the features that are used in FIRST programs but that is obviously a matter of time and version numbers. Also, a GUI is planned for the near future but I wanted to get the actual parser working correctly before I started on anything like that.

There are binaries available for both Windows and Linux as well as the source code. The provided code will only compile under Linux at the moment (I need to merge some changes back in that are required to make it compile on Windows).

As far as architectural details go, it used bison (a general-purpose parser generator) and flex (a lexical analyzer) as well as C code. It makes use of only one non-ANSI C call (strcasecmp or _stricmp on Windows; does anyone know a good case insensitive string compare call?) so should compile easily on all platforms with minimal effort.

Any help you can provide is greatly appreciated. The program can be found here: http://www.rit.edu/~msl8101/emulationFIRST/

Matt

hmm, when i run the program, it gives me a bunch of errors, but i think it’s cause i’m using unsupported commands. otherwise, it seems to work fine. good work, hope you can get the GUI version out soon :D.

If you send me your code I can run it through my copy and see where it bombs out and try to implement those features. Or if you just want to tell me what’s causing it to bomb out. I’ll probably add features on much more of a request basis as I’d like to add what people want first.

Matt

i’m not exactly sure where it’s screwing up, but i think it’s mostly just the eeprom (i used that), because that was really the only advanced feature i used. since this was my first year, and i had learn everything myself, i didn’t learn the cool things (like MIN, MAX, etc) until after the code worked. of course, after it all worked, no one let me touch it :D.

Whenever it reaches a parse error, it will output “Parse error” and then the line and column that it first occurred on. If you correlate that to your code, it’d be helpful.

Matt

*Originally posted by Matt Leese *
**

As far as architectural details go, it used bison (a general-purpose parser generator) and flex (a lexical analyzer) as well as C code. It makes use of only one non-ANSI C call (strcasecmp or _stricmp on Windows; does anyone know a good case insensitive string compare call?) so should compile easily on all platforms with minimal effort.

**

When writing my emulator, I ran into the same thing, so I just converted EVERYTHING to uppercase before doing any sort of work on it. PBASIC is case-insensitive anyway, and it seems to work just fine. Anyway, just my 2c.