muaddib@m-net.UUCP (David Pieczkiewicz) (04/01/89)
I never thought I'd be programming in Applesoft BASIC again, but here I am... I recently ran across a BASIC program that utilizes the DEF FN statement to graph a function. The user of the program enters his equation, and the program graphs it. In an attempt to update it for ProDOS and 80-columns, I ran across some interesting code within the program. When the user enters his function (as a string), the input is added to "170 DEF FN R(Q) " to form an Applesoft statement. This new string is placed into a text file along with a RUN command on another line. The program STOPs and the text file is EXECed, in effect placing a new line 170 into the program, changing the function to the input given by the user. My question is this: how can I make this process more efficient? I've tried making a statement to the effect of DEF FN R(Q) = EQ$ (The equation string entered by the user), but the function is then defined *as a string*, and cannot be used properly within the program. I would rather not mess with EXECing text files again, but I do not know of a way for a program to change one of its own lines during a run. If anyone knows of a way to accomplish this, in either BASIC or a machine language call, please let me know, either here or by mail. My other question is this: Recently, I ran across a program called LIFELIKE that I found while bumming around in FTP. This program, a ProDOS binary file, was a full-featured implementation of the "Life" game, including double-hi-res graphics, saves of scenarios, and even the ability to change the growth and death "rules". Unfortunately, when I EXECed the files (it came in two parts), both crashed into the monitor just before saving their binaries. I am a Life freak, and would desperately like to get a hold of a working copy of this program. If anyone knows about this program, or has it, or knows about similar programs, again, please let me know. A few mintues ago, I read a query about the Apple keys (actually, a response without a reference to the original; we haven't gotten the original yet, it seems...). From what I know about them, the Apple keys are simply hardwires of the paddle buttons, and their condition can be read by PEEK(49249), or PEEK(-16287) in the case of pre-IIe's, for button #0 (AKA the Open-Apple key), and PEEK(49250) (PEEK(-16286) for early Apples) for button #1, also known as the Closed-Apple on the IIe/IIc and the Option key on the GS. If the returned value is > 127, the key is being pressed. (Curiously, the source of this info, Beagle Bros.' indispensable Peeks, Pokes and Pointers chart, lists a third button (#2) under 49251 (-16285). Anyone know anything about this?) Thanks for your time... David Pieczkiewicz, muaddib@m-net.ann-arbor.mi.us, "Kwisatz Haderach of M-Net"
dr@skivs.UUCP (David Robins) (04/03/89)
In article <3038@m2-net.UUCP> muaddib@m-net.UUCP (David Pieczkiewicz) writes: ... >From what I know about them, the Apple >keys are simply hardwires of the paddle buttons, and their condition >can be read by PEEK(49249), or PEEK(-16287) in the case of pre-IIe's, for >button #0 (AKA the Open-Apple key), and PEEK(49250) (PEEK(-16286) for >early Apples) for button #1, also known as the Closed-Apple on the IIe/IIc >and the Option key on the GS. If the returned value is > 127, the key >is being pressed. (Curiously, the source of this info, Beagle Bros.' >indispensable Peeks, Pokes and Pointers chart, lists a third button (#2) >under 49251 (-16285). Anyone know anything about this?) SW 2 is a third switch input. The Apple //e Tech manual states that "some software for the older models of the Apple II uses the third switch, switch 2, as a way of detecting the shift key." (mentions the single-wire shift-key modification). SW 2 is available on the //e gameport, as well as the internal 16-pin gameport on the motherboard. It is no connected to any keyboard buttons. It is detected the same as SW 0 and SW 1. -- David Robins, M.D. (ophthalmologist / electronics engineer) The Smith-Kettlewell Institute of Visual Science, *** net: uunet!skivs!dr 2232 Webster St, San Francisco CA 94115 *** 415/561-1705 (voice) The opinions expressed herein do not reflect the opinion of the Institute!
brianw@microsoft.UUCP (Brian Willoughby) (04/11/89)
In article <3038@m2-net.UUCP>, muaddib@m-net.UUCP (David Pieczkiewicz) writes: > original yet, it seems...). From what I know about them, the Apple > keys are simply hardwires of the paddle buttons, and their condition > can be read by PEEK(49249), or PEEK(-16287) in the case of pre-IIe's, for > button #0 (AKA the Open-Apple key), and PEEK(49250) (PEEK(-16286) for > early Apples) for button #1, also known as the Closed-Apple on the IIe/IIc > and the Option key on the GS. If the returned value is > 127, the key > is being pressed. (Curiously, the source of this info, Beagle Bros.' > indispensable Peeks, Pokes and Pointers chart, lists a third button (#2) > under 49251 (-16285). Anyone know anything about this?) > > Thanks for your time... > David Pieczkiewicz, muaddib@m-net.ann-arbor.mi.us, "Kwisatz Haderach of M-Net" The third button is available to those who build their own paddles (me!), as well as TWO other paddles (total of four dimensions, or two joysticks). The only sad thing is that no software company (that I know of, ed.) ever wrote anything to take advantage of any of these "non-standard" extras. I've often wondered what a dual joystick version of video games would be like! Brian Willoughby microsoft!brianw@uunet.UU.NET or uw-beaver!microsoft!brianw or just microsoft!brianw
cbdougla@uokmax.UUCP (Collin Broadrick Douglas) (04/13/89)
To: brianw@microsoft.UUCP Subject: Re: Trouble with Applesoft's DEF FN Newsgroups: comp.sys.apple In-Reply-To: <4012@microsoft.UUCP> References: <3038@m2-net.UUCP> Organization: University of Oklahoma, Norman, OK Cc: Bcc: > >The third button is available to those who build their own paddles (me!), >as well as TWO other paddles (total of four dimensions, or two joysticks). >The only sad thing is that no software company (that I know of, ed.) ever wrote >anything to take advantage of any of these "non-standard" extras. I've often >wondered what a dual joystick version of video games would be like! > > >Brian Willoughby microsoft!brianw@uunet.UU.NET > or uw-beaver!microsoft!brianw > or just microsoft!brianw two games I know of that use the second joystick are One on one (Dr. J and Larry Bird) and Superstar Ice Hockey by Mindscape. There are several others but these are the two that I know of. It is extremely fun to play Ice hockey. I usually play goalie and my friend plays center. I've got a GS. If you have a IIe then I do believe that there is a Superstar Ice Hockey for the //e also (and I know there is a one on one for the //e). oops, almost forgot. I think Two on Two GS also supports the second joystick... Collin