EASy68K
http://easy68k.com/EASy68Kforum/

More Keys input from keyboard
http://easy68k.com/EASy68Kforum/viewtopic.php?f=9&t=650
Page 1 of 1

Author:  Dan [ Mon May 11, 2009 2:26 am ]
Post subject:  More Keys input from keyboard

b]I need the function keys, the cursor keys along with
delete, insert, pgup, page down, and most of the control keys.
My 68000 machine can use a PC keyboard and all of he keys are
decoded, If you need he source code I can supply it. My word processing and business programs will not work without the special
keys for proper control.
Dan danfar@windstream.net
[/b]

Author:  profkelly [ Sun May 24, 2009 11:12 pm ]
Post subject: 

Trap task 19 will read the key code.

Code:
*-----------------------------------------------------------
* Written by    : CK
* Description   : Display key code
* Note. Several function keys are predefined by the simulator
*-----------------------------------------------------------
START   ORG   $1000

loop
    move.b   #19,d0      ; read key code
    clr.l   d1
   trap   #15
   move.b   #15,d0      ; display d1 as number
   move.b   #16,d2      ; in base 16
   trap   #15
   lea       crlf,a1
   move.b   #14,d0
   trap   #15
       
   bra   loop            ; infinite loop

crlf   dc.b   $d,$a,0

   END   START

Author:  Dan [ Mon May 25, 2009 8:16 pm ]
Post subject:  More Keys input from keyboard

THAT WORKS, THANK YOU
However, how do I know if input is pending from the special keys? The #7 function does not respond from the special keys. I can compare if the key input is the same as the last input and ignore it until I get a new key input, but that does not work if I want to input 2 or more of the same key such as up arrow. Is there a way to reset the last keycode entered to zero?
Dan

Author:  profkelly [ Tue May 26, 2009 12:50 am ]
Post subject: 

Trap task #19 may also be used to test for 4 specific keys. Place the key codes for the corresponding keys in register D1.L
Pre: D1.L = four 1-byte key codes
Post: D1.L contains four 1-byte Booleans.
$FF = corresponding key is pressed, $00 = corresponding key not pressed.

Author:  Dan [ Tue May 26, 2009 3:08 am ]
Post subject:  More keys input from keyboard

OK, if I expect text and 12 different commands, I will have to load up D!and function 19 3 times and function 7 and go into a loop waiting for an input char from the keyboard. The televideo terminal and the smartee terminal I wrote for the VGA and IBM keyboard was a lot simpler. I think I could get by with only 20 different commands, That would require 5 function 19 and 1 function 7. If I put that into the BIOS my programs would never know the difference. I 'll let you know if it works
Dan

Author:  profkelly [ Tue May 26, 2009 11:27 am ]
Post subject: 

Several of the function keys are predefined in the simulator. I'll take a look at adding the ability to disable the simulator function keys for programs that want to use them.

Author:  Dan [ Tue May 26, 2009 2:11 pm ]
Post subject:  More keys input from keyboard

That would help.
The function #19 does not reset the last keypress. Nothing I do will work, as long as the key is depressed you get output, after that you can't get any response until an ascii key is depressed, then if 2 ascii keys are depressed you get two returns. Function 7 will dot reset or will function 5 reset.
The best solution is for the d1=0 function #19 to read the last keypress and reset. do not continue to read as long as the key is depressed and then be ready to get the next keypress even if it is the same key.
Your demo program run continuously and it should not. It should output one character and wait for the next keypress The same way function 5 will clear the input buffer.
Dan

Author:  profkelly [ Wed May 27, 2009 1:17 pm ]
Post subject: 

I have expanded my above example. Trap task #19 may also be used to test the current state of a key. In this example the key scan code for a key is displayed only once. The program then waits for the key to be released.

Code:
*-----------------------------------------------------------
* Written by    : CK
* Description   : Display key code
* Note. Several function keys are predefined by the simulator
*-----------------------------------------------------------
START   ORG   $1000

loop
    move.b  #19,d0      ; read key code of last key press
    clr.l   d1
    trap    #15
    move.b  d1,d3       ; save key code
    trap    #15         ; check to see if it is currently pressed
    tst.b   d1          ; d1.b = 00 if key not pressed
    beq     loop        ; wait until key press
   
    move.b  d3,d1
    move.b  #15,d0      ; display key code
    move.b  #16,d2      ; in base 16
    trap    #15
   
    lea     crlf,a1
    move.b  #14,d0      ; display newline
    trap    #15
       
keydown
    move.b  #19,d0      ; wait for key up
    move.b  d3,d1       ; restore key code
    trap    #15
    tst.b   d1          ; d1.b = $FF if key pressed
    bne     keydown

    bra     loop        ; infinite loop

crlf   dc.b   $d,$a,0

   END   START

Author:  Dan [ Thu May 28, 2009 2:58 pm ]
Post subject:  More keys input from keyboard

That works fine
Thank you
Dan

Author:  profkelly [ Tue Jun 02, 2009 7:17 pm ]
Post subject: 

V4.7.0 has a new trap task to disable simulator shortcuts so that all keys may be read with task 19.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/