20 March 2016, 11:15 | #1 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
|
Reading the keyboard...
Has anyone got a small, compact, fast & working (non system friendly) keyboard reading routine in ASM?
I can't seem to locate my old one on any of my (few) backups. I seem to remember also a a sequence of NOP's in my original code (that I borrowed off Del) |
20 March 2016, 12:42 | #2 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
yeah, you need some delay for the handshake, so NOPs won't work with different cpu's..
|
20 March 2016, 12:57 | #3 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
You can use this one.
Code:
IntLvlTwoPorts: movem.l d0-d1/a0-a2,-(a7) lea _custom,a0 moveq #INTF_PORTS,d0 ;check if is it level 2 interrupt move.w intreqr(a0),d1 and.w d0,d1 beq.b .end ;check if SP cause interrupt, hopefully CIAICRF_SP = 8 lea _ciaa,a1 move.b ciaicr(a1),d1 and.b d0,d1 beq.b .end move.b ciasdr(a1),d1 ;get keycode or.b #CIACRAF_SPMODE,ciacra(a1) ;start SP handshaking lea dt+keys(pc),a2 not.b d1 lsr.b #1,d1 scc (a2,d1.w) ;handshake moveq #3-1,d1 .wait1 move.b vhposr(a0),d0 .wait2 cmp.b vhposr(a0),d0 beq.b .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 Or I can post above version with cia usage. Just give me a sign. |
02 August 2023, 11:29 | #4 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Quote:
|
|
02 August 2023, 11:41 | #5 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,475
|
Quote:
The bit is idle low and you are the only one setting and executing the pulse (and in any case completing the operation). |
|
02 August 2023, 14:12 | #6 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Thx for your fast answer .That confirms my assumption that it seems not to be really necessary. Okay. so the only important thing seems to be the delay time for the handshake between setting input, then output. If I understood it correctly, 85 microseconds are not enough for some keyboards. 200 microseconds should be used instead for some keyboards.
|
02 August 2023, 14:34 | #7 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,475
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keyboard Problem with AOS 4.1 FE Classic in WinUAE.. Keyboard doesn't work! | QBit | support.WinUAE | 1 | 07 January 2015 13:43 |
Reading / writing files and the keyboard | jimmy2x2x | Coders. Asm / Hardware | 3 | 07 December 2014 19:58 |
Wanted: Amiga 600 keyboard membrane (Blue) or full keyboard assembly | RetromanIE | MarketPlace | 8 | 19 August 2012 14:48 |
Reading Amiga CD on a PC | AndersHP | support.WinUAE | 5 | 22 August 2010 18:21 |
|
|