Jump to content
IGNORED

Switching Keyboard Input Off


snicklin

Recommended Posts

Hi,

With the game that I am writing, if I hit any keyboard key, it currently crashes the program. I do however want to be able to accept input from "Start", "Select" and "Option".

 

Is there a way of switching off the keyboard handler? I bet that there's a little 'poke' that I can do which'll do this... or not?

Link to comment
Share on other sites

Maybe investigate what's causing it?

 

You could be corrupting the Keyboard IRQ Vector ($208), or even the Immediate IRQ Vector ($216)

 

But if you really want to turn off the keyboard IRQ, clear bit 6 of IRQEN ($D20E) and the shadow POKMSK ($10)

 

You might want to disable Break key IRQ as well (it's seperate, clear bit 7 for that)

 

Console keys have no IRQ, you only read them from CONSOL, and the only time the factory OS does any checking of them is during powerup or Self-Test.

Link to comment
Share on other sites

Hi,

With the game that I am writing, if I hit any keyboard key, it currently crashes the program. I do however want to be able to accept input from "Start", "Select" and "Option".

 

Is there a way of switching off the keyboard handler? I bet that there's a little 'poke' that I can do which'll do this... or not?

The code that makes the annoying(to some) key click uses several WSYNCs. Is it possible this is causing an interrupt to take too long?

  • Like 1
Link to comment
Share on other sites

That's only in the 400/800 OS, the XL one does wait loops on VCOUNT to prevent DLI corruption.

 

In the case you're allowing E: to function it becomes a whole new ballgame. It uses all manner of RAM locations which you need to be careful of.

 

But I reckon it's probably just something simple causing the crash.

  • Like 1
Link to comment
Share on other sites

Thank you both for your input (pun intended) on this matter.

 

As for it being something to do with the key click, I suspect that this isn't the case as I am not getting any clicking sounds out. Unless it is crashing before the click can occur.

 

As for why I do not find out why it is crashing my code... laziness and not knowing where to look. But you've now giving me some pointers (pun intended again) as to locations to look at.

 

I'll attempt to switch off the keyboard now, wish me luck! I'll have the keyboard switch off routine as a function which I can switch on and off depending on if I am debugging.

 

Oh, and you both can have a reputation point from me.

Link to comment
Share on other sites

Maybe investigate what's causing it?

 

You could be corrupting the Keyboard IRQ Vector ($208), or even the Immediate IRQ Vector ($216)

 

But if you really want to turn off the keyboard IRQ, clear bit 6 of IRQEN ($D20E) and the shadow POKMSK ($10)

 

You might want to disable Break key IRQ as well (it's seperate, clear bit 7 for that)

 

Console keys have no IRQ, you only read them from CONSOL, and the only time the factory OS does any checking of them is during powerup or Self-Test.

 

OK, I've just tried unsetting bit 6 on locations 53774 and 16 and it is causing an immediate crash. (everything hangs).

 

I've checked the locations $208 and $216 and they appear to be pointing to the correct places according to Mapping the Atari.

 

Any ideas?

Link to comment
Share on other sites

Remember, IRQEN is write-only, reading it gives IRQST.

 

The procedure is:

lda $10

and #$7f ; or $3f

sta $10

sta $d20e

 

If you've inadvertantly written a wrong value into IRQEN, that could enable Pokey Timers, which could overrun the machine with IRQs.

 

I'm a little stumped now! Thanks for the code. I've tried it out, I'm using CC65 so I put the code in as:

asm("LDA $10");

asm("AND #$7F");

asm("ORA $3F");

asm("STA $10");

asm("STA $D20E");

 

and I checked the .s file created from it (incase something was optimised out)....

lda $10

and #$7F

ora $3F

sta $10

sta $D20E

 

I ran that and I found that it hung again. I then realised that maybe the ORA (cc65 won't allow OR) needed to be written as ORA #$3F , I then compiled this and ran but it still hung.

 

For this to work, are there any pre-conditions which you know of? Maybe I'm not complying with those....

Link to comment
Share on other sites

The ; or $3f is definately a comment. ORA #$3F will enable the Timers = big trouble.

 

The Timers are a low priority on the IRQ list, so take a long time to process.

Also, given that the AUDF registers will likely be zeroed, they'll saturate the system with never-ending IRQs.

Link to comment
Share on other sites

Finally, problem resolved!! I've found the problem, here are the steps that I went through....

 

1. Thanks Groovybee, a little misunderstanding there from me. I have corrected the code and it still hung.

2. Then I went debugging and found that the code hadn't actually come to a halt, it was still running in the background but nothing was changing on my screen. This was because any movements on my screen were driven by the VBI which wasn't working.

3. I then placed the code at the very start of the program, instead of in the middle of it and all worked !

 

Why do I write assembly in the middle of my 'C', because I wanted to make sure that the code that I got from Rybags was used exactly as he's written it. For such a short bit of code, I don't want to add a new file especially. I already have some Assembly language files which I link in - and boy do they save me time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...