JOYTERM v 1.1 A simple terminal emulator for the GP2X -- a Linux based gaming machine Implemented by Martin Richards (c) July 2006 (heavily based on 'sterm' written by Chih-Chung Chang.) It works but is still being modified. Any feed back would be welcomed. (mr10@cl.cam.ac.uk) The only file needed is joyterm.gpu. Put it on the SD card. I chose to put it in a newly created Bin directory and either run it using the Utility menu or by running a shell script using the Game menu. See the scripts bcpl.gpe and cintpos.gpe in this package. Joyterm allows the user to send 8-bit ASCII characters to a bash shell using the joystick and/or buttons and to display the output from the shell. With practice input can be quite quick. I currently find the shoulder buttons more reliable than the joystick, although with practice the joy stick might be faster. The bottom line of the display shows the character being constructed in binary, eg ASCII Code The character in the current minipage Session 0 11 10*** `abc defg hijk lmno pqrs tuvw xyz{ |}~ A | -- ----- --------- - | | | Highlighted The bash session | | | | | The L-R sequence representing the least significant 5 bits of | | the character, asterisks (*) denote currently unspecified bits. | | The bits are supplied by either using the left and right shoulder | | buttons or the joystick. When all five bits are given, the | | character is transmitted to the current bash shell. The bottom | | line highlights the subset of character still possible. | | | The number of the mini-page of 32 characters currently selected. | This number can be changed by pressing the A button. | The senior bit. This is normally 0 but can be set to 1 by pressing the VOL+ button with Select held down. Every time a character is transmitted to a bash shell this bit is reset to 0. The controls are as follows: A: Increment the bash session number modulo 4 -- Sessions are not yet implemented. B: If the L-R sequence is empty this transmits a backspace to the current bash shell, otherwise undo the last pressing of L or R. X: Send a Space character to the current bask shell. Y: Send a Tab character to the current bask shell. L: Append a 0 to the L-R sequence R: Append a 1 to the L-R sequence. When the L-R sequence reaches length 5, the character specified by the most significant bit, the minipage number and the L-R sequence is transmitted to the bash shell, and the L-R sequence reset to empty. VOL+: If SELECT held down set the most significant bit of the next character to 1, otherwise increment the mini-page number modulo 4. VOL-: If SELECT held down set the most significant bit of the next character to 0, otherwise deccrement the mini-page number modulo 4. SELECT: While pressed the joystick will enter bits in the L-R sequence as described below. CLICK: Enter key START: Quit -- This is dangerous and will probably be changed. Joystick input. As an alternative to using five pressings of L and R, a character from the current mini-page can be selected using just two joystick movements. The first selects one of 8 four character subsets from the current mini-page and the second finally chooses the character. If the first joystick movement is wrong it can be undone using the B (backspace) button. If the current length of the L-R sequence is less than three, the joystick will set the L-R sequence as follows: UP 000** UPRIGHT 001** RIGHT 010** DOWNRIGHT 011** DOWN 100** DOWNLEFT 101** LEFT 110** UPLEFT 111** If the current length of the L-R sequence is three or four, the joystick will set the least significant 2 bits of the L-R sequence from abc?? to: UP abc00 RIGHT abc01 DOWN abc10 LEFT abc11 and transmit the newly specified character to the bash shell, reseting the L-R sequence to empty and clearing the most significant bit. If the second joystick direction is diagonal, its direction is 'rounded' to UP, RIGHT, DOWN or LEFT. If the diagonal direction is ambiguous then UP or DOWN is preferred. Eg: UPLEFT-DOWNRIGHT => DOWN giving 11110 UPRIGHT-UPRIGHT => UP giving 00100. The detailed ASCII encoding is given in the Appendix. Possibly future extensions. (1) Allow switching between different shell sessions. (2) Allow scrolling over taller and wider virtual screens. APPENDIX -- Joystick input for Joyterm O = first joystick direction X = second joystick direction(s) -- There may be alternatives # = O + X, ie first and second joystick direction Joystick Motion page 00 page 01 page 10 page 11 + # + 000 00 + + => ^@ space @ ` + + + + O X 000 01 + X => ^A ! A a + + + + O + 000 10 + + => ^B " B b X X X X O + 000 11 X + => ^C # C c + + + + X # 001 00 + + => ^D $ D d + + + + + O 001 01 + X => ^E % E e + + + + + O 001 10 + + => ^F & F f X X X X + O 001 11 X + => ^G ' G g + + + + X X 010 00 + O => ^H ( H h + + + + + + 010 01 + # => tab ) I i + + + + + + 010 10 + O => lf * J j + X X X + + 010 11 X O => ^K + K k X + + X X X 011 00 + + => ff , L l + + O + + + 011 01 + X => cr - M m + + O + + + 011 10 + + => ^N . N n + X # X + + 011 11 X + => ^O / O o X + O X X X 100 00 + + => ^P 0 P p + O + + + + 100 01 + X => ^Q 1 Q q + O X + + + 100 10 + + => ^R 2 R r + # + + + + 101 11 X + => ^S 3 S s X O + X X X 101 00 + + => ^T 4 T t O + + + + + 101 01 + X => ^U 5 U u O + X + + + 101 10 + + => ^V 6 V v # X + + + + 101 11 X + => ^W 7 W w O + + X X + 110 00 O + => ^X 8 X x + + + + + X 110 01 O X => ^Y 9 Y y + + X + + + 110 10 O + => ^Z : Z z X X + + + + 110 11 # + => esc ; [ { + + + # X + 111 00 + + => < \ | + + + O + X 111 01 + X => = ] } + + + O + + 111 10 + + => > ^ ~ X X X O + + 111 11 X + => ? _ del + + + Martin Richards mr10@cl.cam.ac.uk www.cl.cam.ac.uk/users/mr 12 July 2006