22 September 2018, 18:16 | #21 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,534
|
|
22 September 2018, 21:49 | #22 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 830
|
@Photon
As I see in ChkKey.S you are waiting at least one scanline. In worst case it will be one scanline and it will take 63.5us. No offence, but I think is it not enough for handshake. |
22 September 2018, 22:05 | #23 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Up to 200 µs needed for some Cherry keyboards apparently.
Reading vhposr and waiting for 4 line changes should work best, you'll get a delay no less than 192 µs (probably closer to 200 with code overhead), and no more than 256 µs. If you want an even simpler routine you can just ignore the delay and handshake next VBL or whenever you call your keyboard routine. You'll get low throughput and can't use it for proper typing, but it's enough if you just want to register a few keypresses. |
22 September 2018, 22:35 | #24 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,534
|
|
23 September 2018, 01:44 | #25 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,756
|
Yes, this is the oldest routine then, modify as you like. It was mostly because I couldn't quickly see a runnable routine with Rawkey LUT linked.
I did a search through my later source backups but apparently I haven't commented the code with the fix... so I can't provide it quickly now. If I find it I will post it. But it was mostly about these special keyboards. Like there are some floppy drives that ignore HRM also and require a blind 500ms wait somewhere. |
23 September 2018, 09:08 | #26 | ||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,534
|
Quote:
Anyway, one more reason not to use the wait by scanlines wait. Too many time lost.. Quote:
Cheers |
||
23 September 2018, 12:11 | #27 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,534
|
Quote:
You have opted for 'interior' CIA wait, I've an 'exterior' wait (I start a timer and differ the handshake so I dont waste cycles on fast machine). Moreover my L2 IRQ manager is more general because i've a dispacher for the variuos sources (also other timers and TOD), but I change it according to the needs, it can also become with only the handshake and without buffer since I use it for the various games/demos patches. And the request for a Disable() when you've to read a key is a bit to much, I prefer a semaphore But I like also Photon approach for the qualifier keys. The best would be for a "bit level" approach like used by system in InputEvent.ie_Qualifier (well, actually if I need a qualifier I opt for the input.device method ) One day i'll rewrite a routine that sum-up all this goodies.. Cheers! |
|
24 September 2018, 13:05 | #28 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,806
|
Wow, thanks for these many answers, my friends... Will have a look into this over the next days..
This is really a great place... |
24 September 2018, 16:07 | #29 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,574
|
Quote:
Interestingly, the "interior handshake" seems to be the prefered method by OS drivers. AmigaOS keyboard.device and NetBSD /dev/kbd do it the same. Quote:
Quote:
Please do! |
|||
25 September 2018, 14:51 | #30 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 877
|
I have one of those A2000 Cherry keyboards (currently connected to my A1000).
It is mindblowing how many games it doesn't work with - you get one single keypress and then it is total incommunicado. For my own simpleton key reading I just did a bunch of e-clock accesses to waste time. You should ofc use a timer interrupt for anything better than a 7MHz 68000.... |
01 October 2018, 15:36 | #31 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,806
|
@phx: unfortunately, I get a lot of errors regarding autovecbase, which I don't use in my code.
Just copying the variable from OS.asm didn't do the trick it seems.. |
02 October 2018, 20:40 | #32 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,574
|
AutoVecBase must be initialized with the VBR.
When you still have assembler errors, although the symbol exists, then I guess you are confused by the Small Data model I am using (all variables are addressed base-relative via A4). Remove the "(A4)" from all instructions. |
08 October 2018, 21:38 | #33 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,756
|
Northway just helped me verify that >=200 microseconds handshake is the only modification required to fix skipped or frozen key values on the Cherry A2000 keyboards
|
02 August 2023, 09:50 | #34 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 278
|
Quote:
Mine is based on an article of the German Amiga Magazin from 1992. See enclosed page as pdf. My code looks like this: Code:
keyboard_handler btst #CIAICRB_SP,CIAICR(a4) ;CIA-A SP-Interrupt ? beq kh_no_keyboard_handler ;No -> skip btst #CIACRAB_SPMODE,CIACRA(a4) ;Output ? bne kh_no_keyboard_handler ;Yes ->skip move.b CIASDR(a4),d0 ;Keycode ror.b #1,d0 not.b d0 bmi.s kh_reset_serial_port ;Key released -> skip tst.b kh_key_flag(a3) ;Keycode already saved? bne.s kh_reset_serial_port ;Yes -> skip move.b d0,kh_key_code(a3) not.b kh_key_flag(a3) ;Set key flag kh_reset_serial_port moveq #FALSE,d0 move.b d0,CIASDR(a4) ;Pulse: Set SP line = low moveq #CIACRAF_SPMODE,d0 or.b d0,CIACRA(a4) ;Serial port output, start handshake moveq #CIACRBF_START,d0 or.b d0,CIACRB(a4) ;Start timer for delay 85 microseconds kh_delay_loop btst #CIACRBB_START,CIACRB(a4) bne.s kh_delay_loop moveq #TRUE,d0 move.b d0,CIASDR(a4) ;Pulse: Set SP line = high moveq #~CIACRAF_SPMODE,d0 and.b d0,CIACRA(a4) ;Serial port input, stop handshake kh_check_key clr.b kh_key_flag(a3) ;Clear key flag move.b kh_key_code(a3),d0 cmp.b #kh_key1,d0 ;F1 ? ... Last edited by dissident; 02 August 2023 at 11:05. Reason: typo |
|
17 August 2023, 12:36 | #35 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,574
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[REQ:ASM] Sprite collisions basics | jman | Coders. Tutorials | 5 | 03 September 2011 00:07 |
[REQ:ASM] Loading a static image and its palette | jman | Coders. Tutorials | 3 | 04 June 2011 14:08 |
[REQ:ASM] Assembling and running | jman | Coders. Tutorials | 9 | 07 May 2011 18:39 |
REQ:ASM getting elapsed time on A1200 | jman | Coders. Tutorials | 18 | 11 January 2011 22:24 |
REQ:ASM How to use buffers | jman | Coders. Tutorials | 7 | 01 December 2010 01:41 |
|
|