English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 22 September 2018, 19:16   #21
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by Photon View Post
I'm not 100% sure this routine is compatible with A2000 keyboards made by Cherry (difference in behavior). All hardware routines should be checked on this combo(!)
What's the difference? Timing for the handshake?
(on my routine I wait 85us)
ross is offline  
Old 22 September 2018, 22:49   #22
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 646
@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.
Asman is offline  
Old 22 September 2018, 23:05   #23
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,185
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.
Leffmann is offline  
Old 22 September 2018, 23:35   #24
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by Leffmann View Post
Up to 200 µs needed for some Cherry keyboards apparently.
Heck! 200 µs..

Well, i use CIA timer so is a simple value change, but this keyboard is totally out of specs!
ross is offline  
Old 23 September 2018, 02:44   #25
Photon
Moderator
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,589
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.
Photon is offline  
Old 23 September 2018, 10:08   #26
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by Photon View Post
If I find it I will post it. But it was mostly about these special keyboards.
Thanks Photon.

Anyway, one more reason not to use the wait by scanlines wait.
Too many time lost..

Quote:
Like there are some floppy drives that ignore HRM also and require a blind 500ms wait somewhere.
The very same reason 'cause on my loader I blindly wait

Cheers
ross is offline  
Old 23 September 2018, 13:11   #27
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by phx View Post
You may also look into input.asm from the Solid Gold source (should be the same in Trap Runner). It implements a Level 2 keyboard interupt handler and a FIFO queue for fast typing. Nevertheless it's quite compact.
Just Looked at input.asm: good and compact routine, very similar to mine (i've to look at SG source more often!).

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!
ross is offline  
Old 24 September 2018, 14:05   #28
Steril707
OCS rocks!

 
Join Date: Sep 2016
Location: Amiga Island
Posts: 476
Wow, thanks for these many answers, my friends... Will have a look into this over the next days..

This is really a great place...
Steril707 is offline  
Old 24 September 2018, 17:07   #29
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,201
Quote:
Originally Posted by ross View Post
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).
True. I'm optimizing my games always for the slowest supported architecture, so I didn't think it was worth it. Especially when key presses are rather rare within the game (usually just ESC to quit it).

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:
And the request for a Disable() when you've to read a key is a bit to much, I prefer a semaphore
This was rather a note to myself than a request. My games usually runs in a VERTB-routine, so I am always safe to call getkey.

Quote:
One day i'll rewrite a routine that sum-up all this goodies..
LOL
Please do!
phx is offline  
Old 25 September 2018, 15:51   #30
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 495
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....
NorthWay is offline  
Old 01 October 2018, 16:36   #31
Steril707
OCS rocks!

 
Join Date: Sep 2016
Location: Amiga Island
Posts: 476
@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..
Steril707 is offline  
Old 02 October 2018, 21:40   #32
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,201
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.
phx is offline  
Old 08 October 2018, 22:38   #33
Photon
Moderator
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,589
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
Photon is offline  
 


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 01:07
[REQ:ASM] Loading a static image and its palette jman Coders. Tutorials 3 04 June 2011 15:08
[REQ:ASM] Assembling and running jman Coders. Tutorials 9 07 May 2011 19:39
REQ:ASM getting elapsed time on A1200 jman Coders. Tutorials 18 11 January 2011 23:24
REQ:ASM How to use buffers jman Coders. Tutorials 7 01 December 2010 02:41

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.08391 seconds with 15 queries