EASy68K
http://www.easy68k.com/EASy68Kforum/

keypad IRQ
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=9&t=677
Page 1 of 1

Author:  slavikmj [ Thu Jun 25, 2009 2:45 pm ]
Post subject:  keypad IRQ

Great tool guys, my students love it.

Any plans to support an IRQ for the keypad, similar to what exists now for the mouse?

Author:  profkelly [ Mon Jun 29, 2009 12:08 am ]
Post subject: 

Thanks for the praise! It's the only pay we get and we really appreciate it. :thumbright:

I did a little programming over the weekend. Here is what I am planning.
    Trap task 62
    Enable/Disable keyboard IRQ
    An IRQ is created when a key is pressed or released in the output window.
    D1.W High Byte = IRQ level (1-7), 0 to turn off
    D1.W Low Byte = 1 in the corresponding bit to indicate which keyboard event triggers IRQ where:
    Bit1 = key Up, Bit0 = key Down
    (Example D1.W = $0103, Enable keyboard IRQ level 1 for key Up and key Down)
    (Example D1.W = $0002, Disable keyboard IRQ for key Up)
    Read the last key down or key up with trap task #19.

To read the key that caused the interrupt I debated about adding a new trap task or changing task #19. I don't like changing trap tasks that have the potential to break existing code but task #19 seems like where it belongs. So there is a slight chance the new simulator might break some existing programs. Here is the new task #19:

    Returns current state of up to 4 specified keys or returns key scan code.
    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.
    Pre: D1.L = $00000000
    Post: D1.L upper word contains key code of last key up. (Sim68K v4.7.3 and newer)
    D1.L lower word contains key code of last key down.

Comments are welcome.

Version 4.7.3 will be ready for posting in a few days.

Author:  slavikmj [ Mon Jun 29, 2009 2:11 pm ]
Post subject: 

Wow, quick turnaround! Thanks!

Trap 62 looks perfect. I have the same hesitation regarding trap 19 about changing the existing interface, but in this case it seems programs should remain compatible as long as they use the proper byte-size compares on the return value. I guess you can wait a little while and see if anyone complains...

Author:  profkelly [ Mon Jun 29, 2009 4:15 pm ]
Post subject: 

Available in EASy68K v4.7.3

If the change in task #19 breaks any existing programs I'll just blame it on sloppy code :argue: for testing more than the lower byte of D1.

Author:  ABeakyboy [ Mon Jun 29, 2009 6:40 pm ]
Post subject: 

profkelly wrote:
If the change in task #19 breaks any existing programs I'll just blame it on sloppy code :argue: for testing more than the lower byte of D1.


Sounds like a plan to me :lol:

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