Stop Me

Started by airship, September 17, 2007, 01:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

airship

My first time with a trivia question, so I've decided to take it easy on you. You experienced guys hang back and give the newbies time to mull this one over.

So you're writing a really cool application that doesn't really use the keyboard, but you want the user to be able to hit 'Q' to quit. How can you do this by PEEKing a SINGLE memory location that's NOT in the keyboard buffer?

OK, begin...
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

airship

Anyone?...one?...one?...    <-echo.  :)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

airship

Okay, here's a hint: zero page. That ought to get you going.
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

hydrophilic

Am I allowed to answer ? :/  I've avoided posting my answers to give others a chance but they are so quite that this question is starting to bug me...

airship

I'm up here constantly, so it seems like a long time to me. But looking at the date of my original post, I see it hasn't even been a week yet. How about holding off another day or two to see if one of the 'once a week' people has some input. Then let 'er rip!

Hey, I'm just glad to find out that SOMEONE is paying attention! :)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

romwack

Well, WAIT 198,81 will do it.

Jase

BilHerd

You didn't say if the computer had to continue to operate after hitting the "Q".  I would think that there are about 240 locations you could clobber to make the application "quit"  (sound of tv-drama flatline noise.....)

Bil

airship

WAIT 198,81 doesn't work on the C128. That's for the C64, and it just waits for any keypress. I didn't make that clear, I guess, since I just assumed that in a C128 forum everyone would know I was talking about C128 mode.  What I have in mind doesn't work on a C64. (HINT...HINT...) And I'm talking about 'Q' in specific.

The program has to do a periodic check and continue to run until it finds the 'Q' being pressed. It can't wait for a 'Q'.

Thanks for checking in, Bil!  No special programming needed - it's a standard system usage of this location. I'm just talking about a benign PEEK. Unless there are zero-page locations you can PEEK and clobber the machine! :)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

airship

Hydrophilic, if you want to educate these guys, I think the time is ripe! :D
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

hydrophilic

Mathod 1:
IF PEEK(145)=191 THEN END
Method 2:
IF PEEK(212)=62 THEN END

airship

Yea! Absolutely right!

PEEK(145) is the location I had in mind. That location is called STKEY, and it's the scan value of the STOP key column of the keyboard. Of course, you can also use it to detect the RUN/STOP key, as well as space, Commodore, and control. But 'Q' is the only ALPHA key that can be seen here, just as '2' is the only NUMERIC key in this location. (Two other keys are also detected, but my PDF copy of Mapping the C128 that I can access here at work has OCR errors, so I can't tell what they are right now.)

I was so focused on a location that was unique to 'Q' that I forgot you could do the same thing by PEEKing 212, which works, of course, for any key at all.

Okay, your turn. Thanks for playing, all!
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

hydrophilic

I believe the other two keys are 1 and left arrow (not the cursor key).

I have no question so the floor is open...

airship

I think you're right. So my comment about 2 being the only numeric key would be untrue.

So who's got one? (Remember to start a new topic!)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine