OxC0FFEE Posted February 4, 2017 Share Posted February 4, 2017 I know you can turn on or off the key click (POKE 731,0 or POKE 731,255), but I'm wondering if it's possible to generate the key click sound on command? Is there a bit of code to call from basic, or possibly a way in basic to generate the same or very similar noise? I don't remember my sound coding from back in the day or I'd probably be able to figure it out myself. I don't mind cheating by calling the existing key click routine Quote Link to comment Share on other sites More sharing options...
DanBoris Posted February 5, 2017 Share Posted February 5, 2017 I know you can turn on or off the key click (POKE 731,0 or POKE 731,255), but I'm wondering if it's possible to generate the key click sound on command? Is there a bit of code to call from basic, or possibly a way in basic to generate the same or very similar noise? I don't remember my sound coding from back in the day or I'd probably be able to figure it out myself. I don't mind cheating by calling the existing key click routine The keyboard speaker is controlled by writing either a 0 or an 8 to the GTIA register at address 53279 (D01F). This simple pushes the speaker cone out or pull it back in, so you have to continually change the value to make a sound. You can do this through BASIC, but you really need machine language to control it effectively. Quote Link to comment Share on other sites More sharing options...
OxC0FFEE Posted February 5, 2017 Author Share Posted February 5, 2017 The keyboard speaker is controlled by writing either a 0 or an 8 to the GTIA register at address 53279 (D01F). This simple pushes the speaker cone out or pull it back in, so you have to continually change the value to make a sound. You can do this through BASIC, but you really need machine language to control it effectively. Agreed. Any idea if I can call the OS's keyclick code directly from basic? I'm using Turbo Basic XL if that matters. Quote Link to comment Share on other sites More sharing options...
OxC0FFEE Posted February 5, 2017 Author Share Posted February 5, 2017 Looking to execute the appropriate part of the keyboard handler that makes the click. Reading the following resources I've gotten more understanding of the keyboard handler. http://www.atariarchives.org/mapping/appendix18.phpand http://www.atarimania.com/documents/Complete_and_Essential_Map_For_the_XL_XE_Part_I.pdfand http://atariage.com/forums/topic/241272-how-do-i-use-the-keyboard-handler-the-proper-way/They are tantalizing but don't tell me much (but the statement "SHIFT + CONTROL + key (which generate keyclick but don't return anything)" indicates that there is a way to do this, but it eludes me). I wonder if it's possible to pass a "null" key and still generate the click, or alternately simply call the routine that generates the click sound. Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 5, 2017 Share Posted February 5, 2017 There's no standard OS entry to generate a keyclick, and very bad practice to just find where it is and call it since it's different among OS revisions. The keyclick is only generated when the E: or K: handler is asked to perform input, which in the case of a running user program is usually not the case. In theory you could open a K: device file then POKE 764,12 and use the GET statement. The "danger" in doing so is like you said those null keypresses if anadvertantly triggered by the user can cause the program to get stuck. What you'd want to do is disable the normal keyboard temporarily so that your "forced keystroke" doesn't get messed up. Like this - press Start to generate the keyclick. 5 POKE 53279,8:IF PEEK(53279)<>6 THEN 5 10 OPEN #1,4,0,"K:" : IRQEN = PEEK(16) 20 POKE 16,0 : POKE 53774,0 : POKE 764,12 30 GET #1,C : POKE 16,IRQEN : POKE 53774,IRQEN Probably a way better method would be an assembler program to just do it yourself... I'll see what I can do. Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 5, 2017 Share Posted February 5, 2017 OK - better alternative. Quick and dirty assembly routine to generate a keyclick, and sample program wrapped around it. The assembly routine gets put into a string, since it's relocatable. 10 GOSUB 900 : GRAPHICS 0 20 POKE 764,255 30 IF PEEK(764)<>255 THEN Z=USR(ADR(K$)):GOTO 20 40 GOTO 30 899 STOP 900 DIM K$(30):A=1:TRAP 920 910 READ D:K$(A,A)=CHR$(D):A=A+1:GOTO 910 920 RETURN 1000 DATA 104,162,126,142,31,208,173,11,212,205,11,212,240,251,202,202,16,241,96,-1 4 Quote Link to comment Share on other sites More sharing options...
+CharlieChaplin Posted February 5, 2017 Share Posted February 5, 2017 Hmmm, I thought GTIA-sounds work in that manner, e.g. the Beep-em-all sounddemos... http://a8.fandal.cz/search.php?search=Beep&butt_details_x= and http://xxl.atari.pl/beepem-all/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.