0 Members and 2 Guests are viewing this topic.
Returns 1 in T bit if the current key is being pressed. Returns 0 in T bit otherwise.R1= -1*Number of shifts (two's complement notation)R2= Specific longword of keyboard matrix (A44B0000, A44B0004, or A44B0008)MOV.L @R2,R3SHLD R1,R3
#define KEY_EXE 0x0004#define KEY_RETURN 0x0004#define KEY_NEGATIVE 0x0008#define KEY_ANS 0x0008#define KEY_EXP 0x0010#define KEY_PI 0x0010#define KEY_QUOTE 0x0010#define KEY_POINT 0x0020#define KEY_EQUAL 0x0020#define KEY_SPACE 0x0020#define KEY_NUM_ZERO 0x0040#define KEY_IMAGINARY 0x0040#define KEY_ALPHA_Z 0x0040#define KEY_AC_ON 0x0101#define KEY_OFF 0x0101#define KEY_DIV 0x0204#define KEY_CURLY_RIGHT 0x0204#define KEY_ALPHA_T 0x0204#define KEY_MULT 0x0208#define KEY_CURLY_LEFT 0x0208#define KEY_ALPHA_S 0x0208#define KEY_NUM_SIX 0x0210#define KEY_ALPHA_R 0x0210#define KEY_NUM_FIVE 0x0220#define KEY_FORMAT 0x0220#define KEY_ALPHA_Q 0x0220#define KEY_NUM_FOUR 0x0240#define KEY_CATALOG 0x0240#define KEY_ALPHA_P 0x0240#define KEY_MINUS 0x0304#define KEY_BRACKET_RIGHT 0x0304#define KEY_ALPHA_Y 0x0304#define KEY_PLUS 0x0308#define KEY_BRACKET_LEFT 0x0308#define KEY_ALPHA_X 0x0308#define KEY_NUM_THREE 0x0310#define KEY_ALPHA_W 0x0310#define KEY_NUM_TWO 0x0320#define KEY_MAT 0x0320#define KEY_ALPHA_V 0x0320#define KEY_NUM_ONE 0x0340#define KEY_LIST 0x0340#define KEY_ALPHA_U 0x0340#define KEY_ARROW 0x0402#define KEY_SWAP 0x0402#define KEY_ALPHA_L 0x0402#define KEY_COMMA 0x0404#define KEY_MOVE 0x0404#define KEY_ALPHA_K 0x0404#define KEY_PARA_RIGHT 0x0408#define KEY_RECIPROCAL 0x0408#define KEY_ALPHA_J 0x0408#define KEY_PARA_LEFT 0x0410#define KEY_CUBIC_ROOT 0x0410#define KEY_ALPHA_I 0x0410#define KEY_FRAC_DEC 0x0420#define KEY_MIXED_IMPROPER 0x0420#define KEY_ALPHA_H 0x0420#define KEY_FRAC 0x0440#define KEY_MIXED 0x0440#define KEY_ALPHA_G 0x0440#define KEY_DEL 0x0508#define KEY_INS 0x0508#define KEY_UNDO 0x0508#define KEY_NUM_NINE 0x0510#define KEY_PASTE 0x0510#define KEY_ALPHA_O 0x0510#define KEY_NUM_EIGHT 0x0520#define KEY_CLIP 0x0520#define KEY_ALPHA_N 0x0520#define KEY_NUM_SEVEN 0x0540#define KEY_CAPTURE 0x0540#define KEY_ALPHA_M 0x0540#define KEY_RIGHT 0x0602#define KEY_DOWN 0x0604#define KEY_EXIT 0x0608#define KEY_QUIT 0x0608#define KEY_RAISE 0x0610#define KEY_X_ROOT 0x0610#define KEY_THETA 0x0610#define KEY_SQUARE 0x0620#define KEY_SQUARE_ROOT 0x0620#define KEY_RADIAN 0x0620#define KEY_ALPHA 0x0640#define KEY_ALPHA_LOCK 0x0640#define KEY_TAN 0x0702#define KEY_REVERSE_TAN 0x0702#define KEY_ALPHA_F 0x0702#define KEY_COS 0x0704#define KEY_REVERSE_COS 0x0704#define KEY_ALPHA_E 0x0704#define KEY_SIN 0x0708#define KEY_REVERSE_SIN 0x0708#define KEY_ALPHA_D 0x0708#define KEY_LN 0x0710#define KEY_E_X 0x0710#define KEY_ALPHA_C 0x0710#define KEY_LOG 0x0720#define KEY_TEN_X 0x0720#define KEY_ALPHA_B 0x0720#define KEY_X 0x0740#define KEY_ANGLE 0x0740#define KEY_ALPHA_A 0x0740#define KEY_F_SIX 0x0802#define KEY_G_T 0x0802#define KEY_F_FIVE 0x0804#define KEY_G_SOLVE 0x0804#define KEY_F_FOUR 0x0808#define KEY_SKETCH 0x0808#define KEY_F_THREE 0x0810#define KEY_V_WINDOW 0x0810#define KEY_F_TWO 0x0820#define KEY_ZOOM 0x0820#define KEY_F_ONE 0x0840#define KEY_TRACE 0x0840#define KEY_UP 0x0902#define KEY_LEFT 0x0904#define KEY_MENU 0x0908#define KEY_SETUP 0x0908#define KEY_VARS 0x0910#define KEY_PRGM 0x0910#define KEY_OPTN 0x0920#define KEY_SHIFT 0x0940void CustomKey( char * buffer);short BufferConvert( char * buffer);void CustomKey( char * buffer){ const char * keyaddress = 0xa44b0000; for (int index = 0; index < 12; index++) { buffer[index] = keyaddress[index]; }}short BufferConvert( char * buffer){ short KeyResult; for(short index = 0; index < 12; index++) { if(buffer[index] != 0) KeyResult = (index << 8) | ((short) buffer[index]); } return KeyResult;}
#include <display.h>#include <SYSTEM_syscalls.h>#include <CustomKey.h>#include <keyboard.h>//void main(void) { int x = 1; int y = 1; int color = 0; int mode = 0; char keybuffer[12]; short key; int iContinue = 1; char* heart = " "; heart[2] = 0xE5; heart[3] = 0xE2; Bdisp_AllCr_VRAM(); while (iContinue) { key = 0; Bdisp_AllCr_VRAM(); PrintXY(x, y, heart, mode, color); Bdisp_PutDisp_DD(); while (key == 0) { CustomKey( keybuffer ); key = BufferConvert(keybuffer); } switch (key) { case KEY_EXIT: iContinue = 0; break; case KEY_UP: y = y == 1 ? 8 : y-1; break; case KEY_DOWN: y = y == 8 ? 1 : y+1; break; case KEY_LEFT: x = x == 0 ? 21 : x-1; break; case KEY_RIGHT: x = x == 21 ? x=1 : x+1; break; case KEY_PLUS: color = color == 7 ? 0 : color+1; break; case KEY_MINUS: color = color == 0 ? 7 : color-1; break; case KEY_MULT: mode = !mode; break; case KEY_DIV: mode = !mode; break; } } return;}
I wonder if adding multi key support will be easy? Does the Prizm allows direct input like on TI calcs? (where instead of returning the keycode, it checks if a specific key was pressed or not)
Quote from: DJ_O on September 05, 2011, 04:07:00 pmI wonder if adding multi key support will be easy? Does the Prizm allows direct input like on TI calcs? (where instead of returning the keycode, it checks if a specific key was pressed or not)Yes the entire keyboard is hardware memory mapped so you can if any key is currently up or down without any difficulty. On the matter of multi key support that is easily done but I'm still working on the best way to implement the function in C that would be very simple for another Prizm coder to use.