I am trying recreating a small pocket computer like the Canon X-07 I owned long ago and was very fan of.
I have seen the Smart Response XE Reverse Engineering project a few month ago and found that terminal of some interest. I then bought a couple of them on Ebay and started playing with. I first recreated the schematic of the board. I am now realizing the adaptation of a BASIC interpreter to make the terminal a small pocket computer. I am trying recreating a small pocket computer like the Canon X-07 I owned long ago and was very fan of.
Project is not dead but I currently have no satisfying solution concerning the file system. Also, with COVID-19, I am confined at home and take that time doing some work on my house.
I have also considered replacing the flash inside the terminal with an SD card reader. It has some advantage the card handle the problem of allocating the blocks and the wear leveling, The SD card can also be extracted from the terminal and the files read or edited on any computer.
Apart from that, I have noticed that the standby mode is really efficient. My terminal is in stanby for months now (I think since mid of february) on a pack of NiMh batteries and I power it on from time to time to look at the battery level. The batteries are slowly draining out but the terminal is still functionnal.
The main progress was on the status line. Previously there was a problem with the voltage of the battery now fixed with small modification in the initialization of the ADC.
The way status is managed has evolved. Previously, status was updated in the loop() function but the status line was not updated sometimes. I have moved the call to printStatus function in the functions that are reading the keyboard in host.cpp. In host_readLine, that is used for the command line and in host_ESCkeyPressed that is used during execution so now informations are also updated while the program is running. But in order to not slow down the software too much the status line is only updated every 2 seconds.
I have also corrected the function that compute BASIC memory usage. Previously, memory used by variables was not taken into account.
As usual, the code is on my github.
Next step will be saving and loading programs into the Flash memory of the terminal.
Edit: just found a bug in genbitmapRLE.py. The array size, in the generated file, was wrong, it was still the size of the bitmap not the one of the compressed file. The size of the firmware has suddenly lost 10kB.
When I received my terminals, I first powered them to see if they were operational. I liked the terminal startup screen and found it really attractive. There was a little picture of the terminal in level of gray.
So today I decided there was no reason why my terminal didn't have one.
The problem is that a bitmap the size of the display is quite a large amount of bytes.
I first reproduced the bitmap of the original startup screen with GIMP. And, of course, found the file really large.
To simplify the software in the Arduino the picture was coded 3 pixels in a byte as the display expected it. The file was still large.
The second step was to find a way to compress the file in a way that allows it to be displayed with the limited power of the Arduino while significantly reducing the size of the file. For this I decided to choose an RLE compression. This type of compression is easy to program and it does not require a large buffer because decompression can be performed on the fly. To simplify data handling, the length of a run was limited to 254 bytes so the length can be stored on a single byte.
The file is a succession of bytes coding the size and the value each on a byte.
In order for the software to handle any size of picture, the width and the height of the picture are added at the beginning of the file.
Adapting Arduino BASIC to the SMART Response XE terminal was quite easy as the interface was limited to a pair of functions that were easy to replace with the ones in the Low Level Library.
But the display is not that large and the limitation imposed by its graphic controler lead to some problems. The contraint is that font width shall be multiple of 3. You can have small fonts that give many lines with many characters difficult to read (for my eyes at least) or large fonts that are easy to read but with less lines with less characters. It made me want to be able to change the font at any moment.. The low level library alreay defines 4 fonts
# of char
# of lines
9 x 8
12 x 16
8 unused lines
15 x 16
8 unused lines
As the larger fonts leave 8 lines I decided to do the same for the smaller ones. The 8 unused lines will be used to display some information on screen.
The cpp file in which the interface with the host is defined was upgraded in order to be able to change the font on the fly. I first defined a structure that holds parameters depending on the font size. And replaced all the constants with members of the structure.
The terminal has some "special" keys. I used the menu one to launch a function with which I can change the font.
The 8 unused lines are located at the bottom of the screen. They display the status of the terminal. Actually, battery level, font used and memory usage.
Concerning the BASIC language, there is already support for note generation and BASIC gives access to the I/O with the PIN statement. You can easily make your BASIC programs blink and beep as you wish.
The LED is located on the top side so it can be seen from the front face and its legs are folded back in order to connect to the pads on the components side
The front face is drilled but the hole does not open on the front face. The black coating of the film that makes the front face is scratch from the inside so the LED can be viewed. By doing so you don't have to perfectly align the LED position with the front hole.
I have also added an extension connector in order to have access to some signals
The left part of the top row is compliant with the FTDI download cable pinout.
The SMART Response XE terminal was designed years ago as an interactive terminal used in colleges. It is now a bit obsolete and can be purchased on Ebay for a tenth of its original price. For a few dollars you have a keyboard, a screen, and a ATmega128RFA1 processeur (an ATmega128 with wireless interface). The processor has 128kB of program Flash, 16kB of RAM and 4kB of EEPROM. The terminal integrates also a serial Flash that can be used too. As it is an ATmega, with minimum work, the software can be designed in the Arduino IDE giving access to all the existing softwares and libraries that were developed in the Arduino ecosystem.
I have bought 2 terminals and opened one to reverse engineer the schematic with the help of some hires pictures found here.
Some words on the softwares I rely on
The library I use is based on bitbank2 work. He has made a library that handles all the low level of the SMART Response XE Terminal. It manage the keyboard, the display. Some word on the display. It is probably the weakest link in this system, it has a good resolution but two drawbacks.
pixels are written three at a time
it is not possible to read back the frame memory
These two limitations prevent from making elaborate drawing as when setting a pixel you can modify two others.
These limitations are the reason why I will first work on text interface only for the BASIC.
The BASIC I will use is based on Robin Hedwards work. He has made an Arduino BASIC that works well and it needs not too much adaptation to work with the terminal.