Thursday, February 26, 2015

I need to emulate my own functions

Cyprida has 124 kb EEPROM space for code, way more than the 8 or 16 kb ROM of the home computers of the Legendary Eighties™, when Men were Men and had to fight with limited RAM resources and the twin monsters PEEK & POKE. Thus I will have limited RAM and will only need to implement some cryptic PEEKs & POKEs.

To test features without rewriting the EEPROM every time, I separated the actual Arduino-only code from the interpreter/editor code (which I can run on my PC). Now I have:

- cyprida.ino: sketch that will run on the ArduinoMega. Has a large setup() initializing everything, a library for the its peripherals, and a loop() that only calls emma() to start the interpreter/editor;

- cyprida.h: prototypes for the "emulable" functions (like "clear screen", "print a character", etc)

- ardlib.cpp: emulation of the Arduino functions ("clear screen" and so on): initializes the Linux terminal and then starts emma()

- emma.cpp: the actual environment-interpreter only depending on cyprida.h functions (it is included by both cyprida.ino and ardlib.cpp).


The Makefile builds both the Arduino sketch and an emma executable to test.


No comments:

Post a Comment