How many key groups can you activate at one time? If I need to use keys from Groups 0,1,5,and 6, would you recommend that I use direct input/output, or just use getCSC?
I'm afraid I don't get your question. By groups, do you mean having something like: 01101110b as the group? I think that is allowed, but you will get weird results, and won't be able to know which key someone pressed. (ASMin28days has that example, I think). If you need to check all of those key groups, just resend the group to port 1. It will probably still be faster than GetCSC. All you would do is send the group, nop twice, and then check your keys. After you've checked them, send another group, and keep going.
kk. that answers. thanks.


Code:
KeyCheck:
   ld a,%11111110
   out ($01),a
   nop
   in a,($01)
   bit 0,a
   call z,DownPressed
   bit 1,a
   jr z,LeftPressed
   bit 2,a
   jr z,RightPressed
   bit 3,a
   jr z,UpPressed
   ld a,%11111101
   out ($01),a
   nop
   in a,($01)
   bit 3,a
   jr z,TimesPressed
   bit 4,a
   jr z,DivPressed
   bit 5,a
   jr z,ModPressed
   bit 6,a
   jr z,ClearPressed
   ld a,%11011111
   out ($01),a
   nop
   in a,($01)
   bit 6,a
   jr z,MathPressed
   bit 7,a
   jr z,AlphaPressed
   ld a,%10111111
   out ($01),a
   nop
   in a,($01)
   bit 0,a
   jr z,GraphPressed
   bit 1,a
   jr z,TracePressed
   bit 2,a
   jr z,ZoomPressed
   bit 3,a
   jr z,WindowPressed
   bit 4,a
   jr z,YEquPressed
   bit 5,a
   jr z,SecondPressed
   bit 6,a
   jr z,ModePressed


this work??
Assuming all of those numbers are correct, yes, that is the way you do it. Why do you calll z, the first time, and then jr z, the rest of the time? Also, you might want to do two nops, that is what Kerm told me to do a long time ago when I was trying to do direct input. A single nop might work for slower speeds, but if you bump it up to 15mhz, you will probably need two. Just my two cents.
I second everything that Tanner just said, namely:

>> 2 nops, not 1
>> Why the call z / jr z inconsistency?
>> Yes, that's the way to do it, and still much faster than GetCSC

You could, alternatively, come up with a table-based approach that would cut code size, but lose you a tiny bit of speed. Probably not worth it.
The call is an error. Should be all jr z's
ACagliano wrote:
The call is an error. Should be all jr z's
That's fair; I can only assume that that came from an incomplete conversion from all calls to all jumps? What about our other concerns?
As for the nop's, I put one in because of this line...
Z80 heaven wrote:
The keyboard isn't one of the slower drivers, so we won't need a delay. We'll just test to see if any keys were pressed.

Should I have two?

As for doing a table, I'm interested in speed. Don't want to fall behind, since CALCnet will be active...
You _need_ two nops, as described by ASMin28days.
souvik1997 wrote:
You _need_ two nops, as described by ASMin28days.
This. I've experimentally found that the two nops are indeed necessary over only having one. Smile
Ok. That has been done. It has two 'nops' every time I write a byte to ($01).
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement