Crossposted from Omnimaga
This is PrizmIO, a port of NspireIO for the Casio Prizm. You can now easily output text with printf in your apps!
Right now only char output (with 16 different colors!) and very limited input (\n) works (the rest is commented out), I intend the library to be as much compatible as the Nspire version (same function prototypes, so you can write code that compiles on both Nspire and Prizm).
Download the code on
http://github.com/juju2143/prizmio
If you need text input, feel free to take a look at
this input routine on WikiPrizm that I wrote. Looking great so far, though, keep it up. If you need scanf/printf code, I believe that Tari may have made a nearly-complete implementation.
printf works pretty great right now (all those lines were printed using printf), thanks for the input routine, I'll look at this ^_^
KermMartian wrote:
If you need scanf/printf code, I believe that Tari may have made a nearly-complete implementation.
I dug through the code a little; it calls out to vsprintf, which is implemented in libc, so all he'll have to do is use an up-to-date version of the libraries (which indeed it seems he has).
scanf and friends are (presumably) a similar situation, though I haven't implemented any of it.
Awesome stuff, Juju

do you have plans to support xterm's 256 colors?
No, but that could be nice. I have plans for supporting the VT100 escape codes though. Right now, I have to figure out getch() (Kerm's routine is not exactly what I want...), also maybe a way to directly dump stuff to the display so you don't have to call Bdisp_PutDisp_DD() manually (which can be pretty slow).
I'm afraid I must disagree; I find Bdisp_PutDisp_DD() to be extremely fast indeed! If you're seeing a slowdown, I'm afraid it's likely other factors.
Actually it is fast, but if you're gonna use it after every few pixels, it's not that efficient. So I'm pondering what I'm doing, leave the user do Bdisp_PutDisp_DD() after everything gets drawn in the VRAM, or use Bdisp_SetPoint_DD(x, y, color) in the setPixel function, or something inbetween? Is there a function that only displays a portion of the VRAM instead of the whole?
UPDATE: Input should work (some keys might be missing though, I should add more keys, tell me what you think) and instead of drawing the screen manually with Bdisp_something it's drawn pixel-by-pixel now (drawing the screen fully is rather slow but it might be more effective for redrawing single characters, but again, tell me what you think, I think I'll need lots of input on this.)
By now, the basic display input/output should work enough for making potable applications, it's just that initializing the console is slow, therefore this library is now released as beta. (Not tested this commit yet as I have some problems with my Prizm on this computer.)
EDIT: Oh wait. Keyboard messed up. Will look at this.
UPDATE: Keyboard works fine now. Shift and Alpha works as expected, OPTN switches between lower and uppercase, feel free to suggest me a more complete keymap.
juju2143 wrote:
UPDATE: Keyboard works fine now. Shift and Alpha works as expected, OPTN switches between lower and uppercase, feel free to suggest me a more complete keymap.
Personally, I think it might be a good idea to post an image of the keymap. Did you base your routine on my text input routine, or write something from scratch?
I based my code on
this, then I did the rest from scratch/based on the existing NspireIO code.
And yeah, I might post pics of the keymap, that's a good idea, anyone have a keyboard template?
juju2143 wrote:
I based my code on
this, then I did the rest from scratch/based on the existing NspireIO code.
And yeah, I might post pics of the keymap, that's a good idea, anyone have a keyboard template?
I'm afraid not; you'll have to make one yourself, if you have the patience for it.
Fortunately, I do have the patience for it. My mom said she might even help me
Now on display glitches. The display takes way too long to first load.
EDIT: Fixed in latest commit.
0.1 release!
https://github.com/downloads/juju2143/prizmio/prizmio-0.1.zip
Note that some functions are still stubs, but the rest should work fine.
UPDATE:
Woohoo main page
Also, as Ashbad suggested,
Looks great! By the way, do you currently have a way to embed color codes in strings? That would be very cool and helpful, and might make command-line LuaZM programs that use stdin/stdout look sexy.
That's the next thing planned, VT100 escape codes.
juju2143 wrote:
That's the next thing planned, VT100 escape codes.
Perfect! Keep me posted on that so that I can upgrade LuaZM accordingly. Can I assume that you're going to allow them to work without the ESC (0x1B) character?
Probably not, if you can do stuff like string.char(27). Well, depends how I'm gonna implement it. Also I might add a ESC key on the keyboard.
And I'll keep you updated for sure.