Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 06:15:18 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2]   Go Down
  Print  
Author Topic: Prizm Getkey -  (Read 2233 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
AngelFish
This is my custom title
Administrator
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 08:17:37
Date Registered: 15 August, 2010, 09:18:54
Posts: 3190


Total Post Ratings: +220

View Profile
« Reply #15 on: 28 March, 2011, 03:57:55 »
0

That would indeed be possible. It could probably be done very efficiently if you used the barrel shifter in the CPU to rotate the proper bit in the register into the T bit.

EDIT: Looking it over with the keyboard matrix from Insight, you can actually optimize GetKey at run-time if some information can be computed beforehand (presumably at compile-time):


1
2
3
4
5
6
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,R3
SHLD R1,R3
« Last Edit: 28 March, 2011, 08:04:17 by Qwerty.55 » Logged

∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ
z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Topic starter
Total Post Ratings: +83

View Profile
« Reply #16 on: 19 August, 2011, 07:26:47 »
0

I've been working a making a getkey library that is OS independent for my contest entry and this is what I have so far. Currently it supports reading the key matrix then converting it into a short length identifier. Multi key support is not added yet but is coming soon. Here is the library along with an example program. To use just send a 12 byte array pointer to CustomKey() which will fill the array with the key buffer. Then use BufferConvert() to convert the buffer into a usable identifier. The key identifiers can be found in the #define section of CustomKey.h. Standby for full documentation


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#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 0x0940



void 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;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#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;
}




Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 04:23:20
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50233


Total Post Ratings: +2615

View Profile WWW
« Reply #17 on: 05 September, 2011, 22:07:00 »
0

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)
« Last Edit: 05 September, 2011, 22:07:26 by DJ_O » Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
z80man
Casio Traitor
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 04 September, 2012, 19:42:33
Date Registered: 26 December, 2010, 10:02:50
Location: City 17
Posts: 966


Topic starter
Total Post Ratings: +83

View Profile
« Reply #18 on: 06 September, 2011, 02:43:35 »
0

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)
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.
Logged


List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)
JosJuice
LV9 Veteran (Next: 1337)
*********
Offline Offline

Last Login: Yesterday at 22:11:00
Date Registered: 24 September, 2010, 16:46:12
Location: Sweden
Posts: 1300


Total Post Ratings: +51

View Profile
« Reply #19 on: 06 September, 2011, 16:14:45 »
0

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)
Yep. Insight has an example of it (the "keyboard ports" option).
Logged

Ashbad
Guest
« Reply #20 on: 07 September, 2011, 02:28:17 »
0

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)
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.

Personally, passing and returning a key[] matrix by reference and checking like key[KEY_PRGM_F1] I think would be my favorite way.
« Last Edit: 07 September, 2011, 02:28:44 by Ashbad » Logged
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 03:47:14
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #21 on: 07 September, 2011, 18:44:08 »
0

It would be pretty easy to make an isKeyPressed macro like the Ndless library has.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
t0xic_kitt3n
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 13 May, 2013, 01:56:35
Date Registered: 16 June, 2010, 20:46:00
Location: w,x,y,z
Posts: 1583


Total Post Ratings: +32

View Profile
« Reply #22 on: 07 September, 2011, 22:49:22 »
0

Does the prizm have a grid for the keys or can all keys be detected independent of each other?
Logged




██████  ██  ██  ███████           ████    ██    ██   ██ ███████
█ ██ █  ██  ██   ██   █          ██  ██  ████   ███ ███  ██   █
  ██    ██  ██   ██             ██   ██ ██  ██  ███████  ██    
  ██    ██  ██   ██  █         ██       ██  ██  ███████  ██  █
  ██    ██████   █████         ██       ██  ██  ██ █ ██  █████ 
  ██    ██  ██   ██  █         ██   ███ ██████  ██   ██  ██  █
  ██    ██  ██   ██             ██   ██ ██  ██  ██   ██  ██    
  ██    ██  ██   ██   █          ██  ██ ██  ██  ██   ██  ██   █
 ████   ██  ██  ███████           █████ ██  ██  ██   ██ ███████

PierrotLL
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 02 December, 2012, 19:26:25
Date Registered: 14 February, 2011, 23:12:59
Location: France
Posts: 19


Total Post Ratings: +2

View Profile
« Reply #23 on: 29 November, 2011, 03:01:30 »
0

Old topic but it's done : keydown function
Logged

Pages: 1 [2]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.324 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.