Path: utzoo!attcan!uunet!tellab5!toth From: toth@tellab5.tellabs.com (Joseph G. Toth Jr.) Newsgroups: comp.sys.apple2 Subject: Re: Hyperc more questions... Summary: Answers and observations Docs, Docs, who's got the Docs?? Message-ID: <2274@tellab5.tellabs.com> Date: 21 Mar 90 14:05:26 GMT References: <9678@wpi.wpi.edu> Organization: Tellabs, Inc. Lisle, IL Lines: 79 In article <9678@wpi.wpi.edu>, greyelf@wpi.wpi.edu (Michael J Pender) writes: > Well by this point I've spent a LOT of time playing with hyperc, and still > have some questions. So, have I; on bothe points. > How do I fetch a random number for making games? Write your own.. I have. However there is a problem with HyperC in regards to generating random numbers; most good algorithms(sp) for integer random number generation require more than 16 bit accuracy and HyperC's treatment of 'long' is not twice the size of 'int' - they made 'long' (2 bytes) equal to 'int' (2 bytes). I have had problems with this since I have yet to figure out how to pass a parameter of the type 'LONG' (from the 'fp' definitions) through a procedural call. (ie. LONG *proc_name(parm) LONG parm; { code(); } errors occur on either use of LONG ) I always get some kind of error, of course this might be due to the method used to create a 4 byte integer '#typedef char LONG[4]'. Maybe the documentation provides some description of how this could be accomplished. NOTE: While most advanced C compliers implement 'long' as twice the size of the 'int' variable, the K&R standard does not require it, from 'A Book on C' by Al Kelley and Ira Pohl. > How do we create a system file that can be executed independent of the > shell? There is an object file 's.o' that is the first file to be included into the links when performing a compile to netive code. Somebody would have to write a new one fo these that sets up all initial values for variables used by the HyperC compiled/linked executable. Also the 'exit()' code would have to be re-coded to perform a ProDOS 'bye' operationi (there might be better operations to avoid having a program started from the basic environment exiting all the way to the crummy ProDOS selector - not as important if you use one of the many shells/program launchers).. > Is there a nice clean way to scan the keyboard or a string for > decimal numbers, hex numbers, etc.? like sscanf("%d %c", a,b); There is an ' = atoi();' operation. but a good scan function would have to be written by somebody. > How do I access the printer? I haven't figured out how to do this from the code yet (No Docs again). But i did write a small program that reads a file and prints it to the screen (called it 'cat', like unix), and then do 'print #1 cat ' where the '1' is the slot number ( type the '#' or the system hangs ). > I haven't got my computer set up right now, but when I do I'll > upload a few commands I wrote for the c system. Maybe there ought to be a new newsgroup for HyperC under apple2 so that interest in 'C' on a ][ c/e (excuse the nomenclature) could grow. > Oh, and how is memory allocated under C? If I patched Daemon into C, > we might really have something... If you are refering to the use of the alloc() or free(), but it probably takes all memory between the top address of the program and the value in HIMEM and uses that as the free space. > --- > Michael J Pender Jr Box 1942 c/o W.P.I. W.O.S. is not dead. > greyelf@wpi.bitnet 100 Institute Rd. ...its time to get started, > greyelf@wpi.wpi.edu Worcester, Ma 01609 there is much to be done. > If my next computer isn't a IIgs, it won't be an apple... Me. -- ------------------------------------------------+--------------------- Maybe I shouldn't have done it, sarcasm is so | Joseph G. Toth Jr. seldom understood. Don't FLAME on me, please. | uunet!tellab5!toth