![]() |
![]() |
#1 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 662
|
Keyboard Issue, multi-keys pressed
Hey Guys
Got a bit of a keyboard issue in the PT-1210 player. We're using keys 1,2,3 & 4 for channel muting. It seems that in WinUAE and on an A600, you can hit all the keys simultaneously and they react. However, on the A1200, its not working. Is there any difference between the two machines keyboard hardware wise? The keyboard interrupt code was kindly stolen from an example from WHDLoad (i think?) which is below. Is this a known hardware issue or something with the interrupt? Code:
***************************************** ** keyboard system ***************************************** include cia.i include intbits.i kbinit movem.l d0-a6,-(a7) move.l VBRptr,a0 move.l $68(a0),oldint move.b #CIAICRF_SETCLR|CIAICRF_SP,(ciaicr+$bfe001) ;clear all ciaa-interrupts tst.b (ciaicr+$bfe001) ;set input mode and.b #~(CIACRAF_SPMODE),(ciacra+$bfe001) ;clear ports interrupt move.w #INTF_PORTS,(intreq+$dff000) ;allow ports interrupt move.l #kbint,$68(a0) move.w #INTF_SETCLR|INTF_INTEN|INTF_PORTS,(intena+$dff000) movem.l (a7)+,d0-a6 rts kbrem movem.l d0-a6,-(a7) move.l VBRptr,a0 move.w #INTF_SETCLR|INTF_PORTS,(intena+$dff000) move.l oldint,$68(a0) movem.l (a7)+,d0-a6 rts kbint movem.l d0-d1/a0-a2,-(a7) lea $dff000,a0 move.w intreqr(a0),d0 btst #INTB_PORTS,d0 beq .end lea $bfe001,a1 btst #CIAICRB_SP,ciaicr(a1) beq .end ;read key and store him move.b ciasdr(a1),d0 or.b #CIACRAF_SPMODE,ciacra(a1) not.b d0 ror.b #1,d0 spl d1 and.w #$7f,d0 lea keys(pc),a2 move.b d1,(a2,d0.w) ;clr.w $100 ;handshake moveq #3-1,d1 .wait1 move.b vhposr(a0),d0 .wait2 cmp.b vhposr(a0),d0 beq .wait2 dbf d1,.wait1 ;set input mode and.b #~(CIACRAF_SPMODE),ciacra(a1) .end move.w #INTF_PORTS,intreq(a0) tst.w intreqr(a0) movem.l (a7)+,d0-d1/a0-a2 rte keys: dcb.b $80,0 keys2: dcb.b $80,0 keysfr: dcb.b $80,0 oldint dc.l 0 |
![]() |
![]() |
#2 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,526
|
that code seems to busy-wait inside an interrupt server for 3 scanlines, which is really unpleasant..
why it doesn't work on A1200, I'm not entirely sure.. handshake delay too short maybe? |
![]() |
![]() |
#3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,092
|
Keyboard limit? Many keyboards can't support more than 2 simultaneous key presses if they are located in same line in keyboard matrix.
|
![]() |
![]() |
#4 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,526
|
and this is a limitation of the keyboard controller, is it not!? and the behavior of that could easily be different between a600 and a1200..
|
![]() |
![]() |
#5 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,577
|
I would have assumed the A1200 and A600 would have a similar type of keyboard. But let's be honest, 2 keypresses at once seems rather feasible to press at once. This routine is not even accepting 2 keypresses at once.
The A1200 I am testing it on has a 030, if that changes anything :P Also: it used to work. h0f, did you compare the code of the version prior you putting the visual hints? Or perhaps I am confused, I should test an older version to check this. |
![]() |
![]() |
#6 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 662
|
I only ever noticed it when I started actually using the software on real hardware this year. The keyboard interrupt hasn't changed. The only thing that had possibly changed is the keyboard routines which look at the key data off the back of the interrupt but that shouldn't be an issue as the shift key function works to increase the nudge size.
|
![]() |
![]() |
#7 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 662
|
Ok guys, I've just hacked together a keyboard tester. When a key is pressed you'll see a small line appear at the top of the screen (basically loading the key data section into the plane register!).
If someone could run some tests on real hardware I'd really appreciate it ![]() Oh yeah, its in the zone. Last edited by h0ffman; 10 October 2013 at 19:56. Reason: forgot detail! |
![]() |
![]() |
#8 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 662
|
Right then, I've had it tested on real hardware and can confirm that the A1200 does not allow the keys 1-4 to be pressed at the same time. The A600 must be wired differently hence why it works on that! This is a proper sh*t as I'm going to have to find four keys next to each other where this works!
|
![]() |
![]() |
#9 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,848
|
|
![]() |
![]() |
#10 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 662
|
Thankfully the keyboard interrupt is lower down the list than the CIA interrupt. If it wasn't those 3 raster lines might cause me some serious issues!
Unless of course that may be pertaining to my issue stinger??? |
![]() |
![]() |
#11 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,577
|
Can anybody try this code on an A500 or other computers? It would be great that this works on every computer possible, really.
As for suggestions to move this, how about ZXCV ? Doesn''t PT mute/unmute by a modifier plus one of these? I mean, this is not absolutely a deal breaker, but it feels just RIGHT to mute/unmute multiple parts at the same time. Right now I am faking it cycling them as fast as I can. |
![]() |
![]() |
#12 |
Registered User
Join Date: Aug 2008
Location: Salisbury
Posts: 662
|
The multi press for mute has to work, mainly because its caughte out while playing before!!
|
![]() |
![]() |
#13 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,092
|
Small correction to my previous post, problem can happen when multiple keys (usually 3+) are pressed and they are located in different keyboard matrix lines or rows. (not in same line)
Does anyone have keyboard schematics? (that includes full matrix layout). Perhaps A1200 keyboard mcu has artificial limit of 3 simultaneous keys to prevent key "ghosting"? (press 3 keys, matrix "shorts" causing extra ghost key to be registered. Note that qualifier keys are always in separate matrix, they never cause ghosting) It would be easy to test if keyboard matrix layout was available. EDIT: search for "n-key rollover" or "nkro" for technical details. |
![]() |
![]() |
#14 |
Registered User
Join Date: May 2010
Location: Helsinki, Finland
Posts: 1,341
|
I remember that this was always an issue on the A1200, for example when playing certain multiplayer games that used the keyboard for a couple of the players. You needed to select some pretty odd combinations to be able to play. It seemed to be the worst on the A1200 in particular.
|
![]() |
![]() |
#15 |
Registered User
Join Date: Dec 2007
Location: The World
Age: 49
Posts: 476
|
The a1200 as you've discovered has some limitations on certain simultaneous key presses. I was very disappointed on octamed chord mode on my 1200 years ago, yet my mates 600 was perfect.
|
![]() |
![]() |
#16 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,526
|
Give me some credit here.. I know the delay is required!
![]() Busy-waiting in interrupt servers is most definitely not, and should in general be avoided at all cost; there will be cases where it's ok, but that depends entirely on what else is going on in the system.. |
![]() |
![]() |
#17 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 26,092
|
Quote:
You can't start timers in interrupts (unless you have taken over the system) and having separate Task (that Wait()s for Signal() from interrupt) only for keyboard handshaking is not that good idea either. Keyboard must work even in Forbid() state and it must never lose keyboard state. |
|
![]() |
![]() |
#18 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,848
|
That busy wait is required as I already said! If no CIA timers are used a CIA delay will be the better solution but it doesn't change the fact that this delay is required. Leave it out and you'll be left with a "dead" keyboard after a while.
|
![]() |
![]() |
#19 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,416
|
Perhaps h0ffman thought about starting a CIA timer during keyboard interrupt and do the handshaking in another routine, when the timer interrupt occurs. But I guess there would be too much overhead, for setting up and processing the interrupt, so that it isn't worth it.
The usual method is to start a CIA timer at the beginning of the keyboard interrupt and do all the required processing (key-mapping, etc.) while the timer is running. Then busy-wait until the timer expires and do the handshake. |
![]() |
![]() |
#20 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,577
|
What do you know, I never thought the A1200 had such a shit keyboard. I surely hope we can find a solution to this!
Toni: as I explained above, this routine doesn't even let me press two at the same time. So it feels like the limit is 1 :P |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Some of the keyboard keys not responding (A1200) | Kenan | support.Hardware | 39 | 27 May 2013 16:41 |
A1000 keyboard-keys compatible with Cherry keyboard-keys? | Centerguy | support.Hardware | 5 | 09 August 2010 00:56 |
When you play games, sometimes left-right keys stay "pressed" | hexaae | support.WinUAE | 4 | 18 April 2009 13:22 |
Keys on keyboard need fixing | Blackadder | support.Hardware | 10 | 28 January 2009 04:42 |
Keys on keyboard sticking | Graham Humphrey | support.Hardware | 6 | 31 December 2007 15:57 |
|
|