EASy68K  
It is currently Sun Dec 17, 2017 4:24 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: keypad IRQ
PostPosted: Thu Jun 25, 2009 2:45 pm 
Offline

Joined: Thu Jun 25, 2009 2:42 pm
Posts: 2
Great tool guys, my students love it.

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 29, 2009 12:08 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1056
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.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 29, 2009 2:11 pm 
Offline

Joined: Thu Jun 25, 2009 2:42 pm
Posts: 2
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...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 29, 2009 4:15 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1056
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.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 29, 2009 6:40 pm 
Offline

Joined: Mon Dec 20, 2004 6:03 pm
Posts: 50
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:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group