March 7, 2012

First time real calc!

I've been hesitant, until now, to install Punix on a real calculator, but I have finally done so. Here is a photo of my first test on a real TI-92+:

I was pleasantly surprised that it booted and functioned very much as it does in TiEmu. The grayscale is very slightly flickery, but it's tolerable. However, there are a few differences or glitches:

  • Address error exceptions do not work. This exception works flawlessly in the emulator. All other exceptions work fine (eg, illegal instruction, division by zero, etc), so I have to figure out what's wrong with this one exception.
  • LCD does not shut off with ctrl- or alt-ON. A single dark blue or black row of pixels stays on the screen, every time in a different row. The screen also fades back in weird when I turn the calc back on. I probably just didn't write to the LCD register(s) properly.
  • Last, and perhaps the most worrisome difference, the clock speed is way off. A short timing indicates the calculator is about 33% too slow. The interrupt that should fire once per second (int 3) fires about 2 times in a 3-second period. The supposed 256-Hz (int 1) and programmable timer (int 5) also run proportionally slower, ie about 170 Hz and 5461 Hz (this should be 8192 Hz for audio). My batteries are fresh, and I'm fairly sure that I have a HW2 92+; Punix crashed badly in HW1 mode in TiEmu, so it'd probably crash on my real 92+ if it were HW1. Grayscale also wouldn't work correctly either.

This is a good start, but now I have a good sense of what needs to be fixed.

Update 2012-03-09: I have fixed all issues but the address error exception. Turns out I incorrectly wrote to the screen's hardware registers to shut it off, and the register that controls the OSC2 rate was set incorrectly. Grayscale is also less flickery as a result of fixing the rate, and audio output sounds just as good as it does in TiEmu (that is, like garbage :)).


illwieckz said...

I watched your video on youtube with your 92+ playing music.

You say "The audio quality is not very good because the TI-92+ only has an I/O port which is designed for transferring digital data, not sound.", Yes, but do you know about the work of ExtendeD PWM (Pulse Width Modulation) Ti-Vibe player?

A video demo :
Another demo directly recorded from i/o port :

Theres is an article on ticalc

But the last archive is here :
with a ready to use audio sample.

Sound quality (7 bits, mono, ~22khz) is pretty amazing! (The code does'nt work on HW4 because ExtendeD does'nt know the sampling frequency for HW4.)

The source is in assembly and released under BSD (the LGPL in the archive is for the on-PC converter)

Christopher said...

Yes, I've seen that and other similar audio players, but those players wouldn't work in Punix because they are not friendly to multi-tasking, since they use busy loops for their timing. If any other program tries to run at the same time, the audio will sound bad.

Punix uses Auto-Int 5 running at the highest rate (8192Hz) for timing. This leaves the CPU free for programs to continue running while audio plays, and it gives very accurate timing so that audio plays at the correct rate.

I've actually experimented with 4-bit sound with two stereo samples in one byte, but the audio interrupt handler would have to consume a much larger proportion of the CPU time in order to toggle the output several times for each sample. The quality is definitely much better than 1-bit audio, though not as good as the TI-Vibe player since it is only 4 bits and limited to 8192Hz sample rate (but mine is still in stereo :) ).

For now the audio will be 1-bit until I add a way for user programs to change the audio driver to 4-bit PWM or PDM. This is on my to-do list.

illwieckz said...

Thank you for your clear explanations and motivations :)
I understand why it would be difficult to have this quality with other constraints, but already, the quality (!) in the video is better than what I heard with PolySnd (stereophonic wav a bit in 8192 Hz)

Christopher said...

PolySnd is a synthesizer (like MIDI), unlike Punix and TI-Vibe.

Of course, a program could just as easily play synthesized sounds with Punix (or TI-Vibe, for that matter) too. In fact, I'm currently researching speech synthesis on the calculator. Then we can put HAL9000 on it. :D

(I saw that you mentioned 2001 on yN recently :P)

illwieckz said...

PolySnd also manages wav, but it's very very ugly (there is some wave sample in PolySndPlayer, and Nebulus mix synthesis and wav) and so, fortunately for our ears, little used in this way! Indeed, it should not be used for anything other than the synthesis, the "garbage" word is too weak about Polysnd Wav :)

You read French?
I'm writing a news for a french website ( ) I intend to use your last "real calc" test as an excuse to present your project, and TI calculators, and how to develop on it (and therefore projects that allow it).

About another movie, is the "timmy" login on screenshots related to Jurassic Park ("It's a UNIX system, I know this!") ?

Christopher said...

Oh, I didn't know PolySnd supports wave samples. The quality of those samples probably depends on how well they were converted to 1-bit. I wrote my own program to convert audio data to 1 bit using a modified a delta-sigma modulation technique.

I actually don't read French. I translated yN with Babelfish. :)

I used the name "timmy" for the host name because it's on a "TI" calculator, hence "TImmy". I didn't even think about Jurassic Park. That's just a coincidence.

illwieckz said...

I published my news on Linuxfr :

I took the opportunity to provide an overview of development on these calculators, not only your project :)

DoctorPepper said...

I just found your blog this morning, thanks to All I can say is "awesome!". I ordered a used TI-92+ from today, in order to experiment with this. Thanks!

harald said...

Found your site through osnews ... awesome work! I think i am going to get a ti-92+ from somewhere. keep up the good work!

Jerry Gene said...

Very informative post. Keep up the good work. I would really look forward to your other posts

Lenovo - ThinkPad 343522U Tablet PC - Black

Lenovo - 14" ThinkPad Notebook - 4 GB Memory - 320 GB Hard Drive - Black