![]() |
![]() |
#1 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Keyboard Problems
Hello!
![]() I'll try to keep it simple. I'm attempting to use "keyboard.device" to get keyboard input, and it seems like it's working. However, I wouldn't be here if it was. Here are the relevant snippets from my code: Initializing keyboard device: Code:
Call CreateMsgPort ; Create a message port move.l D0,KeyboardPort ; Save the message port's pointer in "KeyboardPort" move.l D0,A0 ; copy it to A0 aswell move.l #IOSTD_SIZE,D0 ; Read the size of the "IOSTD" structure into D0 Call CreateIORequest ; Create an I/O request (message) move.l D0,KeyboardMessage ; Save the request's pointer in "KeyboardMessage" lea KeyboardName,A0 move.l D0,A1 clr.l D0 clr.l D1 Call OpenDevice tst.l D0 bne KeyboardError move.l KeyboardMessage,A0 move.l KBD_READMATRIX,IO_COMMAND(A0) move.l #13,IO_LENGTH(A0) move.l MemSpace,A1 add.l #80,A1 move.l A1,IO_DATA(A0) Code:
move.l KeyboardMessage,A1 move.l #5,A0 lea IO_DATA(A1,A0),A0 WLoop Call DoIO ; 4th bit of byte 5 move.l (A0),D0 btst D0,4 beq WLoop When I paused the code execution without pressing any keys, it was going through the loop just fine. However, if I pressed a random key and then paused, it was looping the first command in the program. If I pressed the key it's listening for (enter), I couldn't pause the program and the Amiga froze. I can program well, but the lack of good documentation for this is infuriating. ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
#2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,087
|
Code:
; move.l KBD_READMATRIX,IO_COMMAND(A0) move.l #KBD_READMATRIX,IO_COMMAND(A0) Code:
WLoop move.l a0,-(a7) Call DoIO ; 4th bit of byte 5 move.l (a7)+,a0 move.l (a0),d0 ; btst D0,4 btst #4,D0 ; maybe? not sure what you are trying to do since you say byte *5* Last edited by a/b; 01 September 2022 at 13:16. |
![]() |
![]() |
#3 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
IO_COMMANDis a word. And, as a/b already pointed out, you want to write the constant KBD_READMATRIX to it (immediate addressing mode): Code:
move.w #KBD_READMATRIX,IO_COMMAND(A0) Quote:
KeyboardMessageand you really want to check the 4th bit from the 5th byte of the matrix (which means keycode 44) you may try this: Code:
move.l KeyboardMessage,a2 WLoop move.l a2,a1 Call DoIO move.l IO_DATA(a2),a0 btst #4,5(a0) beq WLoop |
|
![]() |
![]() |
#4 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Thanks! I don't often use libraries in the software I make, so I just forget all the things they do, apart from the inputs/outputs.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keyboard problems | dlsa | support.Hardware | 4 | 05 April 2021 10:28 |
WHDLoad and Keyboard Problems | Ebster | project.WHDLoad | 4 | 19 January 2010 18:32 |
Keyboard problems | Feltzkrone | New to Emulation or Amiga scene | 0 | 31 May 2004 18:05 |
keyboard problems | webwurm | support.WinUAE | 1 | 27 July 2003 07:57 |
Problems with the Keyboard | Unregistered | support.WinUAE | 0 | 14 August 2002 11:18 |
|
|