keyrow from assembly

Anything QL Software or Programming Related.
User avatar
nitrofurano
Chuggy Microdrive
Posts: 53
Joined: Sat Nov 16, 2013 10:48 am

Re: keyrow from assembly

Post by nitrofurano »

and at http://www.dilwyn.me.uk/docs/manuals/qltm.pdf i'm seeing "18.13 Hardware Keys", "PC_IPCRD $18020 IPC read is the same", "PC_IPCWR $18003 IPC write" - does it mean that we can access ipc "directly" by poke/peek (i/o), and specially reading the keyrows, without using traps?


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: keyrow from assembly

Post by mk79 »

nitrofurano wrote:and at http://www.dilwyn.me.uk/docs/manuals/qltm.pdf i'm seeing "18.13 Hardware Keys", "PC_IPCRD $18020 IPC read is the same", "PC_IPCWR $18003 IPC write" - does it mean that we can access ipc "directly" by poke/peek (i/o), and specially reading the keyrows, without using traps?
Could? Sure. Should? No no no no no and never.


User avatar
XorA
Site Admin
Posts: 1640
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: keyrow from assembly

Post by XorA »

mk79 wrote:
nitrofurano wrote:and at http://www.dilwyn.me.uk/docs/manuals/qltm.pdf i'm seeing "18.13 Hardware Keys", "PC_IPCRD $18020 IPC read is the same", "PC_IPCWR $18003 IPC write" - does it mean that we can access ipc "directly" by poke/peek (i/o), and specially reading the keyrows, without using traps?
Could? Sure. Should? No no no no no and never.
As someone who has tried to understand IPC protocol and is now hairless, this is seconded. Use the pre-written code for that insanity!


User avatar
nitrofurano
Chuggy Microdrive
Posts: 53
Joined: Sat Nov 16, 2013 10:48 am

Re: keyrow from assembly

Post by nitrofurano »

tofro wrote:...

Code: Select all

***************************************************************************************
* keyScan
* Check keyboard row 1 (cursor keys, ESC, Enter and Space)
* return result in d1.b
* trashes d5 and d7!
***************************************************************************************
keyScan 
                lea.l   IPC_Cmd,a3
                move.w  #$11,d0
                trap 	#1
                ; (QDOSMT$ MT.IPCOM)
                rts 

IPC_Cmd         dc.l    $09010000               ;IPC command 
                dc.l    $00000102               ;9=kbd,1=4bits in,2=8bits out (set to read row 1 in here)
from these dc.l lines, which $01 is used for selecting the reading row?


User avatar
NormanDunbar
Forum Moderator
Posts: 2488
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: keyrow from assembly

Post by NormanDunbar »

http://www.dilwyn.me.uk/docs/manuals/qltm.pdf pages 79-80 tells you everything you need to know.

For KEYROW it's:

Command $9 read a row of the keyboard:
1 parameter, 4 bits in size = the row number,
8 bits for the returned result.

So:

Code: Select all

      dc.b    9,1,0,0,0,0,1,2
Is:

9 = command.
1 = Number of parameter bytes to follow
0,0,0,0, = defines the bits of the parameter to send, 00 = least significant 4 bits. This is encoded in bits 0 and 1 for parameter 1, 2 and 3 for parameter 2, ....
1 = The parameter byte, LS nibble sent = row number.
2 = Size of reply, encoded in bits 0 and 1, 10 = all 8 bits.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply